svn commit: r351935 - head/sys/netipsec
Author: fabient Date: Fri Sep 6 14:30:23 2019 New Revision: 351935 URL: https://svnweb.freebsd.org/changeset/base/351935 Log: Fix broken window replay check that will allow old packet to be accepted. This was introduced in r309144. Submitted by: Jean-Francois HREN Approved by: ae@ MFC after:3 days Modified: head/sys/netipsec/ipsec.c Modified: head/sys/netipsec/ipsec.c == --- head/sys/netipsec/ipsec.c Fri Sep 6 14:25:41 2019(r351934) +++ head/sys/netipsec/ipsec.c Fri Sep 6 14:30:23 2019(r351935) @@ -1323,6 +1323,8 @@ ok: __func__, replay->overflow, ipsec_sa2str(sav, buf, sizeof(buf; } + + replay->count++; return (0); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r334054 - in head: sys/kern sys/netipsec tools/tools/crypto usr.bin/netstat
Le 22 mai 2018 à 17:58:10, Ravi Pokala (rpok...@freebsd.org) a écrit: -Original Message- From: <owner-src-committ...@freebsd.org> on behalf of Fabien Thomas <fabi...@freebsd.org> Date: 2018-05-22, Tuesday at 08:54 To: <src-committ...@freebsd.org>, <svn-src-...@freebsd.org>, <svn-src-head@freebsd.org> Subject: svn commit: r334054 - in head: sys/kern sys/netipsec tools/tools/crypto usr.bin/netstat > Author: fabient > Date: Tue May 22 15:54:25 2018 > New Revision: 334054 > URL: https://svnweb.freebsd.org/changeset/base/334054 > > Log: > Add a SPD cache to speed up lookups. What does "SPD" expand to in this context? I usually hack on platform stuff, and "Serial Presence Detect" doesn't seem applicable to this change. :-) Yes, that was not obvious after reading the comment again. :) SPD is related to IPsec so Security Policy Database. Thanks, Ravi (rpokala@) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r334054 - in head: sys/kern sys/netipsec tools/tools/crypto usr.bin/netstat
Author: fabient Date: Tue May 22 15:54:25 2018 New Revision: 334054 URL: https://svnweb.freebsd.org/changeset/base/334054 Log: Add a SPD cache to speed up lookups. When large SPDs are used, we face two problems: - too many CPU cycles are spent during the linear searches in the SPD for each packet - too much contention on multi socket systems, since we use a single shared lock. Main changes: - added the sysctl tree 'net.key.spdcache' to control the SPD cache (disabled by default). - cache the sp indexes that are used to perform SP lookups. - use a range of dedicated mutexes to protect the cache lines. Submitted by: Emeric PouponReviewed by: ae Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D15050 Modified: head/sys/kern/uipc_mbuf.c head/sys/netipsec/ipsec.h head/sys/netipsec/key.c head/tools/tools/crypto/ipsecstats.c head/usr.bin/netstat/ipsec.c Modified: head/sys/kern/uipc_mbuf.c == --- head/sys/kern/uipc_mbuf.c Tue May 22 15:52:22 2018(r334053) +++ head/sys/kern/uipc_mbuf.c Tue May 22 15:54:25 2018(r334054) @@ -1633,9 +1633,6 @@ m_unshare(struct mbuf *m0, int how) mprev->m_len += m->m_len; mprev->m_next = m->m_next; /* unlink from chain */ m_free(m); /* reclaim mbuf */ -#if 0 - newipsecstat.ips_mbcoalesced++; -#endif } else { mprev = m; } @@ -1665,9 +1662,6 @@ m_unshare(struct mbuf *m0, int how) mprev->m_len += m->m_len; mprev->m_next = m->m_next; /* unlink from chain */ m_free(m); /* reclaim mbuf */ -#if 0 - newipsecstat.ips_clcoalesced++; -#endif continue; } Modified: head/sys/netipsec/ipsec.h == --- head/sys/netipsec/ipsec.h Tue May 22 15:52:22 2018(r334053) +++ head/sys/netipsec/ipsec.h Tue May 22 15:54:25 2018(r334054) @@ -219,8 +219,9 @@ struct ipsecstat { uint64_t ips_out_inval; /* output: generic error */ uint64_t ips_out_bundlesa; /* output: bundled SA processed */ - uint64_t ips_mbcoalesced; /* mbufs coalesced during clone */ - uint64_t ips_clcoalesced; /* clusters coalesced during clone */ + uint64_t ips_spdcache_hits; /* SPD cache hits */ + uint64_t ips_spdcache_misses; /* SPD cache misses */ + uint64_t ips_clcopied; /* clusters copied during clone */ uint64_t ips_mbinserted;/* mbufs inserted during makespace */ /* Modified: head/sys/netipsec/key.c == --- head/sys/netipsec/key.c Tue May 22 15:52:22 2018(r334053) +++ head/sys/netipsec/key.c Tue May 22 15:54:25 2018(r334054) @@ -173,6 +173,48 @@ static VNET_DEFINE(u_long, sphash_mask); #defineSPHASH_HASHVAL(id) (key_u32hash(id) & V_sphash_mask) #defineSPHASH_HASH(id) _sphashtbl[SPHASH_HASHVAL(id)] +/* SPD cache */ +struct spdcache_entry { + struct secpolicyindex spidx;/* secpolicyindex */ + struct secpolicy *sp; /* cached policy to be used */ + + LIST_ENTRY(spdcache_entry) chain; +}; +LIST_HEAD(spdcache_entry_list, spdcache_entry); + +#defineSPDCACHE_MAX_ENTRIES_PER_HASH 8 + +static VNET_DEFINE(u_int, key_spdcache_maxentries) = 0; +#defineV_key_spdcache_maxentries VNET(key_spdcache_maxentries) +static VNET_DEFINE(u_int, key_spdcache_threshold) = 32; +#defineV_key_spdcache_thresholdVNET(key_spdcache_threshold) +static VNET_DEFINE(unsigned long, spd_size) = 0; +#defineV_spd_size VNET(spd_size) + +#define SPDCACHE_ENABLED() (V_key_spdcache_maxentries != 0) +#define SPDCACHE_ACTIVE() \ + (SPDCACHE_ENABLED() && V_spd_size >= V_key_spdcache_threshold) + +static VNET_DEFINE(struct spdcache_entry_list *, spdcachehashtbl); +static VNET_DEFINE(u_long, spdcachehash_mask); +#defineV_spdcachehashtbl VNET(spdcachehashtbl) +#defineV_spdcachehash_mask VNET(spdcachehash_mask) + +#defineSPDCACHE_HASHVAL(idx) \ + (key_addrprotohash(&(idx)->src, &(idx)->dst, &(idx)->ul_proto) & \ + V_spdcachehash_mask) + +/* Each cache line is protected by a mutex */ +static VNET_DEFINE(struct mtx *, spdcache_lock); +#defineV_spdcache_lock VNET(spdcache_lock) + +#defineSPDCACHE_LOCK_INIT(a) \ + mtx_init(_spdcache_lock[a], "spdcache", \ + "fast ipsec SPD
svn commit: r328088 - head/usr.sbin/pmcstat
Author: fabient Date: Wed Jan 17 16:55:35 2018 New Revision: 328088 URL: https://svnweb.freebsd.org/changeset/base/328088 Log: Only call flush in pipe mode. It fixes a crash with a socket in top mode. Ex: # pmcstat -R 127.0.0.1:8080 -T -w1 then # pmcstat -n1 -Sclock.prof -Slock.failed -O 127.0.0.1:8080 MFC after:1 week Sponsored by: Stormshield Modified: head/usr.sbin/pmcstat/pmcstat.c Modified: head/usr.sbin/pmcstat/pmcstat.c == --- head/usr.sbin/pmcstat/pmcstat.c Wed Jan 17 16:41:22 2018 (r328087) +++ head/usr.sbin/pmcstat/pmcstat.c Wed Jan 17 16:55:35 2018 (r328088) @@ -1350,6 +1350,7 @@ main(int argc, char **argv) } /* print out counting PMCs */ if ((args.pa_flags & FLAG_DO_TOP) && + (args.pa_flags & FLAG_HAS_PIPE) && pmc_flush_logfile() == 0) do_read = 1; do_print = 1; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328087 - in head: lib/libpmc sys/dev/hwpmc
Author: fabient Date: Wed Jan 17 16:41:22 2018 New Revision: 328087 URL: https://svnweb.freebsd.org/changeset/base/328087 Log: Fix pmcstat exit from kernel introduced by r325275. pmcstat request for close will generate a close event. This event will be in turn received by pmcstat to close the file. Reviewed by: kib Tested by:pho MFC after:1 week Sponsored by: Stormshield Modified: head/lib/libpmc/pmclog.c head/sys/dev/hwpmc/hwpmc_logging.c head/sys/dev/hwpmc/hwpmc_mod.c Modified: head/lib/libpmc/pmclog.c == --- head/lib/libpmc/pmclog.cWed Jan 17 15:12:52 2018(r328086) +++ head/lib/libpmc/pmclog.cWed Jan 17 16:41:22 2018(r328087) @@ -335,6 +335,8 @@ pmclog_get_event(void *cookie, char **data, ssize_t *l ev->pl_u.pl_cc.pl_pc[npc] = (uintfptr_t) 0; break; case PMCLOG_TYPE_CLOSELOG: + ev->pl_state = PMCLOG_EOF; + return (-1); case PMCLOG_TYPE_DROPNOTIFY: /* nothing to do */ break; Modified: head/sys/dev/hwpmc/hwpmc_logging.c == --- head/sys/dev/hwpmc/hwpmc_logging.c Wed Jan 17 15:12:52 2018 (r328086) +++ head/sys/dev/hwpmc/hwpmc_logging.c Wed Jan 17 16:41:22 2018 (r328087) @@ -799,6 +799,8 @@ pmclog_close(struct pmc_owner *po) PMCDBG1(LOG,CLO,1, "po=%p", po); + pmclog_process_closelog(po); + mtx_lock(_kthread_mtx); /* Modified: head/sys/dev/hwpmc/hwpmc_mod.c == --- head/sys/dev/hwpmc/hwpmc_mod.c Wed Jan 17 15:12:52 2018 (r328086) +++ head/sys/dev/hwpmc/hwpmc_mod.c Wed Jan 17 16:41:22 2018 (r328087) @@ -2928,7 +2928,6 @@ pmc_syscall_handler(struct thread *td, void *syscall_a po : NULL); } else if (po->po_flags & PMC_PO_OWNS_LOGFILE) { pmclog_proc_ignite(pmclog_proc_handle, NULL); - pmclog_process_closelog(po); error = pmclog_close(po); if (error == 0) { LIST_FOREACH(pm, >po_pmcs, pm_next) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r327696 - head/sys/opencrypto
Author: fabient Date: Mon Jan 8 13:43:12 2018 New Revision: 327696 URL: https://svnweb.freebsd.org/changeset/base/327696 Log: Fix uninitialized crp_retw_id when using asynchronous crypto drivers with defered callbacks. Submitted by: emeric.pou...@stormshield.eu Reported by: mav@ Reviewed by: fabient@ Modified: head/sys/opencrypto/crypto.c Modified: head/sys/opencrypto/crypto.c == --- head/sys/opencrypto/crypto.cMon Jan 8 13:19:15 2018 (r327695) +++ head/sys/opencrypto/crypto.cMon Jan 8 13:43:12 2018 (r327696) @@ -896,11 +896,12 @@ crypto_dispatch(struct cryptop *crp) binuptime(>crp_tstamp); #endif + crp->crp_retw_id = crp->crp_sid % crypto_workers_num; + if (CRYPTOP_ASYNC(crp)) { if (crp->crp_flags & CRYPTO_F_ASYNC_KEEPORDER) { struct crypto_ret_worker *ret_worker; - crp->crp_retw_id = crp->crp_sid % crypto_workers_num; ret_worker = CRYPTO_RETW(crp->crp_retw_id); CRYPTO_RETW_LOCK(ret_worker); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326390 - head/share/man/man9
Author: fabient Date: Thu Nov 30 08:28:04 2017 New Revision: 326390 URL: https://svnweb.freebsd.org/changeset/base/326390 Log: Update man page for r325354. Reported by: bjk Modified: head/share/man/man9/crypto.9 Modified: head/share/man/man9/crypto.9 == --- head/share/man/man9/crypto.9Thu Nov 30 08:23:40 2017 (r326389) +++ head/share/man/man9/crypto.9Thu Nov 30 08:28:04 2017 (r326390) @@ -17,7 +17,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 10, 2015 +.Dd November 6, 2017 .Dt CRYPTO 9 .Os .Sh NAME @@ -333,9 +333,10 @@ specified the flag). .It Dv CRYPTO_F_ASYNC Try to do the crypto operation in a pool of workers -if the operation is synchronous (that the driver specified the +if the operation is synchronous (that is, if the driver specified the .Dv CRYPTOCAP_F_SYNC -flag). It aims to speed up processing by dispatching crypto operations +flag). +It aims to speed up processing by dispatching crypto operations on different processors. .It Dv CRYPTO_F_ASYNC_KEEPORDER Dispatch callbacks in the same order they are posted. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r325354 - in head: share/man/man9 sys/netipsec sys/opencrypto
Author: fabient Date: Fri Nov 3 10:27:22 2017 New Revision: 325354 URL: https://svnweb.freebsd.org/changeset/base/325354 Log: crypto(9) is called from ipsec in CRYPTO_F_CBIFSYNC mode. This is working fine when a lot of different flows to be ciphered/deciphered are involved. However, when a software crypto driver is used, there are situations where we could benefit from making crypto(9) multi threaded: - a single flow is to be ciphered: only one thread is used to cipher it, - a single ESP flow is to be deciphered: only one thread is used to decipher it. The idea here is to call crypto(9) using a new mode (CRYPTO_F_ASYNC) to dispatch the crypto jobs on multiple threads, if the underlying crypto driver is working in synchronous mode. Another flag is added (CRYPTO_F_ASYNC_KEEPORDER) to make crypto(9) dispatch the crypto jobs in the order they are received (an additional queue/thread is used), so that the packets are reinjected in the network using the same order they were posted. A new sysctl net.inet.ipsec.async_crypto can be used to activate this new behavior (disabled by default). Submitted by: Emeric PouponReviewed by: ae, jmg, jhb Differential Revision:https://reviews.freebsd.org/D10680 Sponsored by: Stormshield Modified: head/share/man/man9/crypto.9 head/sys/netipsec/ipsec.c head/sys/netipsec/ipsec.h head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c head/sys/opencrypto/crypto.c head/sys/opencrypto/cryptodev.h Modified: head/share/man/man9/crypto.9 == --- head/share/man/man9/crypto.9Fri Nov 3 07:30:54 2017 (r325353) +++ head/share/man/man9/crypto.9Fri Nov 3 10:27:22 2017 (r325354) @@ -331,6 +331,17 @@ Do callback immediately if operation is synchronous (t specified the .Dv CRYPTOCAP_F_SYNC flag). +.It Dv CRYPTO_F_ASYNC +Try to do the crypto operation in a pool of workers +if the operation is synchronous (that the driver specified the +.Dv CRYPTOCAP_F_SYNC +flag). It aims to speed up processing by dispatching crypto operations +on different processors. +.It Dv CRYPTO_F_ASYNC_KEEPORDER +Dispatch callbacks in the same order they are posted. +Only relevant if the +.Dv CRYPTO_F_ASYNC +flag is set and if the operation is synchronous. .El .It Va crp_buf Points to the input buffer. Modified: head/sys/netipsec/ipsec.c == --- head/sys/netipsec/ipsec.c Fri Nov 3 07:30:54 2017(r325353) +++ head/sys/netipsec/ipsec.c Fri Nov 3 10:27:22 2017(r325354) @@ -149,7 +149,16 @@ sysctl_def_policy(SYSCTL_HANDLER_ARGS) * 0 take anything */ VNET_DEFINE(int, crypto_support) = CRYPTOCAP_F_HARDWARE | CRYPTOCAP_F_SOFTWARE; + /* + * Use asynchronous mode to parallelize crypto jobs: + * + * 0 - disabled + * 1 - enabled + */ +VNET_DEFINE(int, async_crypto) = 0; + +/* * TCP/UDP checksum handling policy for transport mode NAT-T (RFC3948) * * 0 - auto: incrementally recompute, when checksum delta is known; @@ -195,6 +204,9 @@ SYSCTL_INT(_net_inet_ipsec, IPSECCTL_ECN, ecn, SYSCTL_INT(_net_inet_ipsec, OID_AUTO, crypto_support, CTLFLAG_VNET | CTLFLAG_RW, _NAME(crypto_support), 0, "Crypto driver selection."); +SYSCTL_INT(_net_inet_ipsec, OID_AUTO, async_crypto, + CTLFLAG_VNET | CTLFLAG_RW, _NAME(async_crypto), 0, + "Use asynchronous mode to parallelize crypto jobs."); SYSCTL_INT(_net_inet_ipsec, OID_AUTO, check_policy_history, CTLFLAG_VNET | CTLFLAG_RW, _NAME(check_policy_history), 0, "Use strict check of inbound packets to security policy compliance."); Modified: head/sys/netipsec/ipsec.h == --- head/sys/netipsec/ipsec.h Fri Nov 3 07:30:54 2017(r325353) +++ head/sys/netipsec/ipsec.h Fri Nov 3 10:27:22 2017(r325354) @@ -283,6 +283,7 @@ VNET_DECLARE(int, ip4_ipsec_dfbit); VNET_DECLARE(int, ip4_ipsec_ecn); VNET_DECLARE(int, ip4_esp_randpad); VNET_DECLARE(int, crypto_support); +VNET_DECLARE(int, async_crypto); VNET_DECLARE(int, natt_cksum_policy); #defineIPSECSTAT_INC(name) \ @@ -296,6 +297,7 @@ VNET_DECLARE(int, natt_cksum_policy); #defineV_ip4_ipsec_ecn VNET(ip4_ipsec_ecn) #defineV_ip4_esp_randpad VNET(ip4_esp_randpad) #defineV_crypto_supportVNET(crypto_support) +#defineV_async_crypto VNET(async_crypto) #defineV_natt_cksum_policy VNET(natt_cksum_policy) #define ipseclog(x)do { if (V_ipsec_debug) log x; } while (0) Modified: head/sys/netipsec/xform_ah.c == --- head/sys/netipsec/xform_ah.cFri Nov 3 07:30:54 2017 (r325353) +++ head/sys/netipsec/xform_ah.cFri
svn commit: r315270 - in head/sys: arm/include dev/hwpmc
Author: fabient Date: Tue Mar 14 16:06:57 2017 New Revision: 315270 URL: https://svnweb.freebsd.org/changeset/base/315270 Log: Fix arm stack frame walking support: - Adjust stack offset for Clang - Correctly fill registers for fake stack frame (soft PMC) MFC after:1 week Sponsored by: Stormshield Differential Revision:https://reviews.freebsd.org/D7396 Modified: head/sys/arm/include/pmc_mdep.h head/sys/dev/hwpmc/hwpmc_arm.c Modified: head/sys/arm/include/pmc_mdep.h == --- head/sys/arm/include/pmc_mdep.h Tue Mar 14 16:01:36 2017 (r315269) +++ head/sys/arm/include/pmc_mdep.h Tue Mar 14 16:06:57 2017 (r315270) @@ -70,7 +70,9 @@ union pmc_md_pmc { /* Build a fake kernel trapframe from current instruction pointer. */ #define PMC_FAKE_TRAPFRAME(TF) \ do {\ + (TF)->tf_spsr = PSR_SVC32_MODE; \ __asm __volatile("mov %0, pc" : "=r" ((TF)->tf_pc));\ + __asm __volatile("mov %0, r11" : "=r" ((TF)->tf_r11)); \ } while (0) /* Modified: head/sys/dev/hwpmc/hwpmc_arm.c == --- head/sys/dev/hwpmc/hwpmc_arm.c Tue Mar 14 16:01:36 2017 (r315269) +++ head/sys/dev/hwpmc/hwpmc_arm.c Tue Mar 14 16:06:57 2017 (r315270) @@ -42,6 +42,17 @@ __FBSDID("$FreeBSD$"); #include #include +/* XXX: Userland code compiled with gcc will need an heuristic + * to be correctly detected. + */ +#ifdef __clang__ +#define PC_OFF 1 +#define FP_OFF 0 +#else +#define PC_OFF -1 +#define FP_OFF -3 +#endif + struct pmc_mdep * pmc_md_initialize() { @@ -100,7 +111,7 @@ pmc_save_kernel_callchain(uintptr_t *cc, for (count = 1; count < maxsamples; count++) { /* Use saved lr as pc. */ - r = fp - sizeof(uintptr_t); + r = fp + PC_OFF * sizeof(uintptr_t); if (!PMC_IN_KERNEL_STACK(r, stackstart, stackend)) break; pc = *(uintptr_t *)r; @@ -110,7 +121,7 @@ pmc_save_kernel_callchain(uintptr_t *cc, *cc++ = pc; /* Switch to next frame up */ - r = fp - 3 * sizeof(uintptr_t); + r = fp + FP_OFF * sizeof(uintptr_t); if (!PMC_IN_KERNEL_STACK(r, stackstart, stackend)) break; fp = *(uintptr_t *)r; @@ -147,7 +158,7 @@ pmc_save_user_callchain(uintptr_t *cc, i for (count = 1; count < maxsamples; count++) { /* Use saved lr as pc. */ - r = fp - sizeof(uintptr_t); + r = fp + PC_OFF * sizeof(uintptr_t); if (copyin((void *)r, , sizeof(pc)) != 0) break; if (!PMC_IN_USERSPACE(pc)) @@ -157,7 +168,7 @@ pmc_save_user_callchain(uintptr_t *cc, i /* Switch to next frame up */ oldfp = fp; - r = fp - 3 * sizeof(uintptr_t); + r = fp + FP_OFF * sizeof(uintptr_t); if (copyin((void *)r, , sizeof(fp)) != 0) break; if (fp < oldfp || !PMC_IN_USERSPACE(fp)) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r309144 - in head: lib/libipsec sys/net sys/netipsec
Hi, Sorry about that. Normally we build universe with it but it seems we missed something... I've not access to a machine to fixit before monday... Fabien > Le 25 nov. 2016 à 22:32, Raphael Kubo da Costa <rak...@freebsd.org> a écrit : > > Fabien Thomas <fabi...@freebsd.org> writes: > >> Author: fabient >> Date: Fri Nov 25 14:44:49 2016 >> New Revision: 309144 >> URL: https://svnweb.freebsd.org/changeset/base/309144 >> >> Log: >> IPsec RFC6479 support for replay window sizes up to 2^32 - 32 packets. >> >> Since the previous algorithm, based on bit shifting, does not scale >> with large replay windows, the algorithm used here is based on >> RFC 6479: IPsec Anti-Replay Algorithm without Bit Shifting. >> The replay window will be fast to be updated, but will cost as many bits >> in RAM as its size. >> >> The previous implementation did not provide a lock on the replay window, >> which may lead to replay issues. > > This broke the build here: > > In file included from /usr/src/sys/netipsec/key_debug.c:54: > In file included from /usr/src/sys/netipsec/ipsec.h:46: > In file included from /usr/src/sys/netipsec/keydb.h:38: > /usr/src/sys/sys/mutex.h:367:2: error: LOCK_DEBUG not defined, include > before > #error LOCK_DEBUG not defined, include before ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309146 - head/sys/libkern
Author: fabient Date: Fri Nov 25 17:20:23 2016 New Revision: 309146 URL: https://svnweb.freebsd.org/changeset/base/309146 Log: Update r309143 to prevent false sharing. Reported by: mjg Approved by: so MFC after:1 month Modified: head/sys/libkern/arc4random.c Modified: head/sys/libkern/arc4random.c == --- head/sys/libkern/arc4random.c Fri Nov 25 16:04:36 2016 (r309145) +++ head/sys/libkern/arc4random.c Fri Nov 25 17:20:23 2016 (r309146) @@ -31,13 +31,13 @@ int arc4rand_iniseed_state = ARC4_ENTR_N MALLOC_DEFINE(M_ARC4RANDOM, "arc4random", "arc4random structures"); struct arc4_s { + struct mtx mtx; u_int8_t i, j; int numruns; u_int8_t sbox[256]; time_t t_reseed; - struct mtx mtx; -}; +} __aligned(CACHE_LINE_SIZE); static struct arc4_s *arc4inst = NULL; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r309143 - head/sys/libkern
> Le 25 nov. 2016 à 17:00, Mateusz Guzik <mjgu...@gmail.com> a écrit : > > On Fri, Nov 25, 2016 at 01:49:33PM +, Fabien Thomas wrote: >> Author: fabient >> Date: Fri Nov 25 13:49:33 2016 >> New Revision: 309143 >> URL: https://svnweb.freebsd.org/changeset/base/309143 >> >> Log: >> In a dual processor system (2*6 cores) during IPSec throughput tests, >> we see a lot of contention on the arc4 lock, used to generate the IV >> of the ESP output packets. >> >> The idea of this patch is to split this mutex in order to reduce the >> contention on this lock. >> >> +MALLOC_DEFINE(M_ARC4RANDOM, "arc4random", "arc4random structures"); >> >> -static u_int8_t arc4_randbyte(void); >> +struct arc4_s { >> +u_int8_t i, j; >> +int numruns; >> +u_int8_t sbox[256]; >> +time_t t_reseed; >> + >> +struct mtx mtx; >> +}; >> + > > Why is the lock at the end? Right now you got false sharing with the > next entry. > > That said, I suggest: > 1. moving thelock to the beginning > 2. annotating the struct with __aligned(CACHE_LINE_SIZE) Yes good catch, it will be better that way. Committed as r309146. Thanks > > -- > Mateusz Guzik ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309144 - in head: lib/libipsec sys/net sys/netipsec
Author: fabient Date: Fri Nov 25 14:44:49 2016 New Revision: 309144 URL: https://svnweb.freebsd.org/changeset/base/309144 Log: IPsec RFC6479 support for replay window sizes up to 2^32 - 32 packets. Since the previous algorithm, based on bit shifting, does not scale with large replay windows, the algorithm used here is based on RFC 6479: IPsec Anti-Replay Algorithm without Bit Shifting. The replay window will be fast to be updated, but will cost as many bits in RAM as its size. The previous implementation did not provide a lock on the replay window, which may lead to replay issues. Reviewed by: ae Obtained from:emeric.pou...@stormshield.eu Sponsored by: Stormshield Differential Revision:https://reviews.freebsd.org/D8468 Modified: head/lib/libipsec/pfkey.c head/lib/libipsec/pfkey_dump.c head/sys/net/pfkeyv2.h head/sys/netipsec/ipsec.c head/sys/netipsec/key.c head/sys/netipsec/key_debug.c head/sys/netipsec/keydb.h head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c Modified: head/lib/libipsec/pfkey.c == --- head/lib/libipsec/pfkey.c Fri Nov 25 13:49:33 2016(r309143) +++ head/lib/libipsec/pfkey.c Fri Nov 25 14:44:49 2016(r309144) @@ -1776,6 +1776,7 @@ pfkey_align(msg, mhp) case SADB_EXT_SPIRANGE: case SADB_X_EXT_POLICY: case SADB_X_EXT_SA2: + case SADB_X_EXT_SA_REPLAY: mhp[ext->sadb_ext_type] = (caddr_t)ext; break; case SADB_X_EXT_NAT_T_TYPE: Modified: head/lib/libipsec/pfkey_dump.c == --- head/lib/libipsec/pfkey_dump.c Fri Nov 25 13:49:33 2016 (r309143) +++ head/lib/libipsec/pfkey_dump.c Fri Nov 25 14:44:49 2016 (r309144) @@ -219,6 +219,7 @@ pfkey_sadump(m) struct sadb_key *m_auth, *m_enc; struct sadb_ident *m_sid, *m_did; struct sadb_sens *m_sens; + struct sadb_x_sa_replay *m_sa_replay; /* check pfkey message. */ if (pfkey_align(m, mhp)) { @@ -243,6 +244,7 @@ pfkey_sadump(m) m_sid = (struct sadb_ident *)mhp[SADB_EXT_IDENTITY_SRC]; m_did = (struct sadb_ident *)mhp[SADB_EXT_IDENTITY_DST]; m_sens = (struct sadb_sens *)mhp[SADB_EXT_SENSITIVITY]; + m_sa_replay = (struct sadb_x_sa_replay *)mhp[SADB_X_EXT_SA_REPLAY]; /* source address */ if (m_saddr == NULL) { @@ -306,7 +308,8 @@ pfkey_sadump(m) /* replay windoe size & flags */ printf("\tseq=0x%08x replay=%u flags=0x%08x ", m_sa2->sadb_x_sa2_sequence, - m_sa->sadb_sa_replay, + m_sa_replay ? (m_sa_replay->sadb_x_sa_replay_replay >> 3) : + m_sa->sadb_sa_replay, m_sa->sadb_sa_flags); /* state */ Modified: head/sys/net/pfkeyv2.h == --- head/sys/net/pfkeyv2.h Fri Nov 25 13:49:33 2016(r309143) +++ head/sys/net/pfkeyv2.h Fri Nov 25 14:44:49 2016(r309144) @@ -283,6 +283,14 @@ struct sadb_x_nat_t_frag { }; _Static_assert(sizeof(struct sadb_x_nat_t_frag) == 8, "struct size mismatch"); +/* Additional large replay window support + */ +struct sadb_x_sa_replay { + u_int16_t sadb_x_sa_replay_len; + u_int16_t sadb_x_sa_replay_exttype; + u_int32_t sadb_x_sa_replay_replay; /* in packets */ +}; +_Static_assert(sizeof(struct sadb_x_sa_replay) == 8, "struct size mismatch"); #define SADB_EXT_RESERVED 0 #define SADB_EXT_SA 1 @@ -311,7 +319,8 @@ _Static_assert(sizeof(struct sadb_x_nat_ #define SADB_X_EXT_NAT_T_OAI 23 /* Peer's NAT_OA for src of SA. */ #define SADB_X_EXT_NAT_T_OAR 24 /* Peer's NAT_OA for dst of SA. */ #define SADB_X_EXT_NAT_T_FRAG 25 /* Manual MTU override. */ -#define SADB_EXT_MAX 25 +#define SADB_X_EXT_SA_REPLAY 26 /* Replay window override. */ +#define SADB_EXT_MAX 26 #define SADB_SATYPE_UNSPEC 0 #define SADB_SATYPE_AH 2 Modified: head/sys/netipsec/ipsec.c == --- head/sys/netipsec/ipsec.c Fri Nov 25 13:49:33 2016(r309143) +++ head/sys/netipsec/ipsec.c Fri Nov 25 14:44:49 2016(r309144) @@ -251,7 +251,6 @@ static int ipsec6_setspidx_ipaddr(const #endif static void ipsec_delpcbpolicy(struct inpcbpolicy *); static struct secpolicy *ipsec_deepcopy_policy(struct secpolicy *src); -static void vshiftl(unsigned char *, int, int); MALLOC_DEFINE(M_IPSEC_INPCB, "inpcbpolicy", "inpcb-resident ipsec policy"); @@ -1476,57 +1475,70 @@ ipsec_hdrsiz(const struct mbuf *m, u_int * beforehand). * 0 (zero) is returned if packet
svn commit: r309143 - head/sys/libkern
Author: fabient Date: Fri Nov 25 13:49:33 2016 New Revision: 309143 URL: https://svnweb.freebsd.org/changeset/base/309143 Log: In a dual processor system (2*6 cores) during IPSec throughput tests, we see a lot of contention on the arc4 lock, used to generate the IV of the ESP output packets. The idea of this patch is to split this mutex in order to reduce the contention on this lock. Reviewed by: delphij, markm, ache Approved by: so Obtained from: emeric.pou...@stormshield.eu MFC after: 1 month Sponsored by: Stormshield Differential Revision:https://reviews.freebsd.org/D8130 Modified: head/sys/libkern/arc4random.c Modified: head/sys/libkern/arc4random.c == --- head/sys/libkern/arc4random.c Fri Nov 25 13:15:28 2016 (r309142) +++ head/sys/libkern/arc4random.c Fri Nov 25 13:49:33 2016 (r309143) @@ -19,6 +19,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #defineARC4_RESEED_BYTES 65536 #defineARC4_RESEED_SECONDS 300 @@ -26,13 +28,23 @@ __FBSDID("$FreeBSD$"); int arc4rand_iniseed_state = ARC4_ENTR_NONE; -static u_int8_t arc4_i, arc4_j; -static int arc4_numruns = 0; -static u_int8_t arc4_sbox[256]; -static time_t arc4_t_reseed; -static struct mtx arc4_mtx; +MALLOC_DEFINE(M_ARC4RANDOM, "arc4random", "arc4random structures"); -static u_int8_t arc4_randbyte(void); +struct arc4_s { + u_int8_t i, j; + int numruns; + u_int8_t sbox[256]; + time_t t_reseed; + + struct mtx mtx; +}; + +static struct arc4_s *arc4inst = NULL; + +#define ARC4_FOREACH(_arc4) \ + for (_arc4 = [0]; _arc4 <= [mp_maxid]; _arc4++) + +static u_int8_t arc4_randbyte(struct arc4_s *arc4); static __inline void arc4_swap(u_int8_t *a, u_int8_t *b) @@ -48,7 +60,7 @@ arc4_swap(u_int8_t *a, u_int8_t *b) * Stir our S-box. */ static void -arc4_randomstir(void) +arc4_randomstir(struct arc4_s* arc4) { u_int8_t key[ARC4_KEYBYTES]; int n; @@ -60,15 +72,15 @@ arc4_randomstir(void) */ (void)read_random(key, ARC4_KEYBYTES); getmicrouptime(_now); - mtx_lock(_mtx); + mtx_lock(>mtx); for (n = 0; n < 256; n++) { - arc4_j = (arc4_j + arc4_sbox[n] + key[n]) % 256; - arc4_swap(_sbox[n], _sbox[arc4_j]); + arc4->j = (arc4->j + arc4->sbox[n] + key[n]) % 256; + arc4_swap(>sbox[n], >sbox[arc4->j]); } - arc4_i = arc4_j = 0; + arc4->i = arc4->j = 0; /* Reset for next reseed cycle. */ - arc4_t_reseed = tv_now.tv_sec + ARC4_RESEED_SECONDS; - arc4_numruns = 0; + arc4->t_reseed = tv_now.tv_sec + ARC4_RESEED_SECONDS; + arc4->numruns = 0; /* * Throw away the first N words of output, as suggested in the * paper "Weaknesses in the Key Scheduling Algorithm of RC4" @@ -77,8 +89,9 @@ arc4_randomstir(void) * http://dl.acm.org/citation.cfm?id=646557.694759 */ for (n = 0; n < 256*4; n++) - arc4_randbyte(); - mtx_unlock(_mtx); + arc4_randbyte(arc4); + + mtx_unlock(>mtx); } /* @@ -87,33 +100,57 @@ arc4_randomstir(void) static void arc4_init(void) { + struct arc4_s *arc4; int n; - mtx_init(_mtx, "arc4_mtx", NULL, MTX_DEF); - arc4_i = arc4_j = 0; - for (n = 0; n < 256; n++) - arc4_sbox[n] = (u_int8_t) n; + arc4inst = malloc((mp_maxid + 1) * sizeof(struct arc4_s), + M_ARC4RANDOM, M_NOWAIT | M_ZERO); + KASSERT(arc4inst != NULL, ("arc4_init: memory allocation error")); + + ARC4_FOREACH(arc4) { + mtx_init(>mtx, "arc4_mtx", NULL, MTX_DEF); + + arc4->i = arc4->j = 0; + for (n = 0; n < 256; n++) + arc4->sbox[n] = (u_int8_t) n; - arc4_t_reseed = 0; + arc4->t_reseed = -1; + arc4->numruns = 0; + } } +SYSINIT(arc4, SI_SUB_LOCK, SI_ORDER_ANY, arc4_init, NULL); + + +static void +arc4_uninit(void) +{ + struct arc4_s *arc4; + + ARC4_FOREACH(arc4) { + mtx_destroy(>mtx); + } + + free(arc4inst, M_ARC4RANDOM); +} + +SYSUNINIT(arc4, SI_SUB_LOCK, SI_ORDER_ANY, arc4_uninit, NULL); -SYSINIT(arc4_init, SI_SUB_LOCK, SI_ORDER_ANY, arc4_init, NULL); /* * Generate a random byte. */ static u_int8_t -arc4_randbyte(void) +arc4_randbyte(struct arc4_s *arc4) { u_int8_t arc4_t; - arc4_i = (arc4_i + 1) % 256; - arc4_j = (arc4_j + arc4_sbox[arc4_i]) % 256; + arc4->i = (arc4->i + 1) % 256; + arc4->j = (arc4->j + arc4->sbox[arc4->i]) % 256; - arc4_swap(_sbox[arc4_i], _sbox[arc4_j]); + arc4_swap(>sbox[arc4->i], >sbox[arc4->j]); - arc4_t = (arc4_sbox[arc4_i] + arc4_sbox[arc4_j]) % 256; - return arc4_sbox[arc4_t]; +
svn commit: r308216 - head/usr.sbin/rtadvd
Author: fabient Date: Wed Nov 2 15:11:23 2016 New Revision: 308216 URL: https://svnweb.freebsd.org/changeset/base/308216 Log: In rtadvd, interface lookup calls if_indextoname() many times in a loop, (it takes a long time on systems with many interfaces) without reason and without checking its return value. Reviewed by: cem Obtained from: Maryse LevavasseurMFC after: 1 month Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D6979 Modified: head/usr.sbin/rtadvd/if.c Modified: head/usr.sbin/rtadvd/if.c == --- head/usr.sbin/rtadvd/if.c Wed Nov 2 14:25:30 2016(r308215) +++ head/usr.sbin/rtadvd/if.c Wed Nov 2 15:11:23 2016(r308216) @@ -470,11 +470,18 @@ update_ifinfo(struct ifilist_head_t *ifi ifindex != ifm->ifm_index) continue; + /* ifname */ + if (if_indextoname(ifm->ifm_index, ifname) == NULL) { + syslog(LOG_WARNING, + "<%s> ifname not found (idx=%d)", + __func__, ifm->ifm_index); + continue; + } + /* lookup an entry with the same ifindex */ TAILQ_FOREACH(ifi, ifi_head, ifi_next) { if (ifm->ifm_index == ifi->ifi_ifindex) break; - if_indextoname(ifm->ifm_index, ifname); if (strncmp(ifname, ifi->ifi_ifname, sizeof(ifname)) == 0) break; @@ -493,15 +500,7 @@ update_ifinfo(struct ifilist_head_t *ifi ifi->ifi_ifindex = ifm->ifm_index; /* ifname */ - if_indextoname(ifm->ifm_index, ifi->ifi_ifname); - if (ifi->ifi_ifname == NULL) { - syslog(LOG_WARNING, - "<%s> ifname not found (idx=%d)", - __func__, ifm->ifm_index); - if (ifi_new) - free(ifi); - continue; - } + strlcpy(ifi->ifi_ifname, ifname, IFNAMSIZ); if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { syslog(LOG_ERR, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r291301 - head/sys/netinet
Hi Gleb, > > Note that g...@freebsd.org and gleb...@freebsd.org are two different persons. > Sorry for the mistake. Fabien ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r291301 - head/sys/netinet
Author: fabient Date: Wed Nov 25 14:45:43 2015 New Revision: 291301 URL: https://svnweb.freebsd.org/changeset/base/291301 Log: The r241129 description was wrong that the scenario is possible only for read locks on pcbs. The same race can happen with write lock semantics as well. The race scenario: - Two threads (1 and 2) locate pcb with writer semantics (INPLOOKUP_WLOCKPCB) and do in_pcbref() on it. - 1 and 2 both drop the inp hash lock. - Another thread (3) grabs the inp hash lock. Then it runs in_pcbfree(), which wlocks the pcb. They must happen faster than 1 or 2 come INP_WLOCK()! - 1 and 2 congest in INP_WLOCK(). - 3 does in_pcbremlists(), drops hash lock, and runs in_pcbrele_wlocked(), which doesn't free the pcb due to two references on it. Then it unlocks the pcb. - 1 (or 2) gets wlock on the pcb, runs in_pcbrele_wlocked(), which doesn't report inp as freed, due to 2 (or 1) still helding extra reference on it. The thread tries to do smth with a disconnected pcb and crashes. Submitted by: emeric.pou...@stormshield.eu Reviewed by: gleb@ MFC after:1 week Sponsored by: Stormshield Tested by: Cassiano Peixoto, Stormshield Modified: head/sys/netinet/in_pcb.c Modified: head/sys/netinet/in_pcb.c == --- head/sys/netinet/in_pcb.c Wed Nov 25 13:26:42 2015(r291300) +++ head/sys/netinet/in_pcb.c Wed Nov 25 14:45:43 2015(r291301) @@ -1220,8 +1220,17 @@ in_pcbrele_wlocked(struct inpcb *inp) INP_WLOCK_ASSERT(inp); - if (refcount_release(>inp_refcount) == 0) + if (refcount_release(>inp_refcount) == 0) { + /* +* If the inpcb has been freed, let the caller know, even if +* this isn't the last reference. +*/ + if (inp->inp_flags2 & INP_FREED) { + INP_WUNLOCK(inp); + return (1); + } return (0); + } KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__)); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r290982 - in head/sys: net netipsec
Author: fabient Date: Tue Nov 17 14:39:33 2015 New Revision: 290982 URL: https://svnweb.freebsd.org/changeset/base/290982 Log: Implement the sadb_x_policy_priority field as it is done in Linux: lower priority policies are inserted first. Submitted by: Emeric PouponReviewed by: ae Sponsored by: Stormshield Modified: head/sys/net/pfkeyv2.h head/sys/netipsec/ipsec.h head/sys/netipsec/key.c Modified: head/sys/net/pfkeyv2.h == --- head/sys/net/pfkeyv2.h Tue Nov 17 14:22:56 2015(r290981) +++ head/sys/net/pfkeyv2.h Tue Nov 17 14:39:33 2015(r290982) @@ -225,7 +225,7 @@ struct sadb_x_policy { u_int8_t sadb_x_policy_dir; /* direction, see ipsec.h */ u_int8_t sadb_x_policy_reserved; u_int32_t sadb_x_policy_id; - u_int32_t sadb_x_policy_reserved2; + u_int32_t sadb_x_policy_priority; }; _Static_assert(sizeof(struct sadb_x_policy) == 16, "struct size mismatch"); Modified: head/sys/netipsec/ipsec.h == --- head/sys/netipsec/ipsec.h Tue Nov 17 14:22:56 2015(r290981) +++ head/sys/netipsec/ipsec.h Tue Nov 17 14:39:33 2015(r290982) @@ -92,6 +92,7 @@ struct secpolicy { u_int state; #defineIPSEC_SPSTATE_DEAD 0 #defineIPSEC_SPSTATE_ALIVE 1 + u_int32_t priority; /* priority of this policy */ u_int32_t id; /* It's unique number on the system. */ /* * lifetime handler. Modified: head/sys/netipsec/key.c == --- head/sys/netipsec/key.c Tue Nov 17 14:22:56 2015(r290981) +++ head/sys/netipsec/key.c Tue Nov 17 14:39:33 2015(r290982) @@ -473,7 +473,7 @@ static void key_porttosaddr(struct socka key_porttosaddr((struct sockaddr *)(saddr), (port)) static struct mbuf *key_setsadbxsa2(u_int8_t, u_int32_t, u_int32_t); static struct mbuf *key_setsadbxpolicy(u_int16_t, u_int8_t, - u_int32_t); + u_int32_t, u_int32_t); static struct seckey *key_dup_keymsg(const struct sadb_key *, u_int, struct malloc_type *); static struct seclifetime *key_dup_lifemsg(const struct sadb_lifetime *src, @@ -1209,6 +1209,29 @@ key_unlink(struct secpolicy *sp) } /* + * insert a secpolicy into the SP database. Lower priorities first + */ +static void +key_insertsp(struct secpolicy *newsp) +{ + struct secpolicy *sp; + + SPTREE_WLOCK(); + TAILQ_FOREACH(sp, _sptree[newsp->spidx.dir], chain) { + if (newsp->priority < sp->priority) { + TAILQ_INSERT_BEFORE(sp, newsp, chain); + goto done; + } + } + + TAILQ_INSERT_TAIL(_sptree[newsp->spidx.dir], newsp, chain); + +done: + newsp->state = IPSEC_SPSTATE_ALIVE; + SPTREE_WUNLOCK(); +} + +/* * Must be called after calling key_allocsp(). * For the packet with socket. */ @@ -1391,6 +1414,7 @@ key_msg2sp(struct sadb_x_policy *xpl0, s newsp->spidx.dir = xpl0->sadb_x_policy_dir; newsp->policy = xpl0->sadb_x_policy_type; + newsp->priority = xpl0->sadb_x_policy_priority; /* check policy */ switch (xpl0->sadb_x_policy_type) { @@ -1627,6 +1651,7 @@ key_sp2msg(struct secpolicy *sp) xpl->sadb_x_policy_type = sp->policy; xpl->sadb_x_policy_dir = sp->spidx.dir; xpl->sadb_x_policy_id = sp->id; + xpl->sadb_x_policy_priority = sp->priority; p = (caddr_t)xpl + sizeof(*xpl); /* if is the policy for ipsec ? */ @@ -1904,10 +1929,7 @@ key_spdadd(struct socket *so, struct mbu newsp->lifetime = lft ? lft->sadb_lifetime_addtime : 0; newsp->validtime = lft ? lft->sadb_lifetime_usetime : 0; - SPTREE_WLOCK(); - TAILQ_INSERT_TAIL(_sptree[newsp->spidx.dir], newsp, chain); - newsp->state = IPSEC_SPSTATE_ALIVE; - SPTREE_WUNLOCK(); + key_insertsp(newsp); /* delete the entry in spacqtree */ if (mhp->msg->sadb_msg_type == SADB_X_SPDUPDATE) { @@ -3744,7 +3766,7 @@ key_porttosaddr(struct sockaddr *sa, u_i * set data into sadb_x_policy */ static struct mbuf * -key_setsadbxpolicy(u_int16_t type, u_int8_t dir, u_int32_t id) +key_setsadbxpolicy(u_int16_t type, u_int8_t dir, u_int32_t id, u_int32_t priority) { struct mbuf *m; struct sadb_x_policy *p; @@ -3764,6 +3786,7 @@ key_setsadbxpolicy(u_int16_t type, u_int p->sadb_x_policy_type = type; p->sadb_x_policy_dir = dir; p->sadb_x_policy_id = id; + p->sadb_x_policy_priority = priority; return m; } @@ -6205,7 +6228,7 @@ key_acquire(const struct secasindex *sai /* set sadb_x_policy */ if (sp) { - m = key_setsadbxpolicy(sp->policy,
svn commit: r289023 - head/usr.sbin/pmcstat
Author: fabient Date: Thu Oct 8 09:46:35 2015 New Revision: 289023 URL: https://svnweb.freebsd.org/changeset/base/289023 Log: Fix for r288176 changes related to debug symbols move. Reviewed by: emaste Sponsored by: Stormshield Modified: head/usr.sbin/pmcstat/pmcstat_log.c Modified: head/usr.sbin/pmcstat/pmcstat_log.c == --- head/usr.sbin/pmcstat/pmcstat_log.c Thu Oct 8 08:55:34 2015 (r289022) +++ head/usr.sbin/pmcstat/pmcstat_log.c Thu Oct 8 09:46:35 2015 (r289023) @@ -966,21 +966,32 @@ pmcstat_image_addr2line(struct pmcstat_i char *funcname, size_t funcname_len) { static int addr2line_warn = 0; - unsigned l; char *sep, cmdline[PATH_MAX], imagepath[PATH_MAX]; + unsigned l; int fd; if (image->pi_addr2line == NULL) { - snprintf(imagepath, sizeof(imagepath), "%s%s.symbols", + /* Try default debug file location. */ + snprintf(imagepath, sizeof(imagepath), + "/usr/lib/debug/%s%s.debug", args.pa_fsroot, pmcstat_string_unintern(image->pi_fullpath)); fd = open(imagepath, O_RDONLY); if (fd < 0) { - snprintf(imagepath, sizeof(imagepath), "%s%s", + /* Old kernel symbol path. */ + snprintf(imagepath, sizeof(imagepath), "%s%s.symbols", args.pa_fsroot, pmcstat_string_unintern(image->pi_fullpath)); - } else + fd = open(imagepath, O_RDONLY); + if (fd < 0) { + snprintf(imagepath, sizeof(imagepath), "%s%s", + args.pa_fsroot, + pmcstat_string_unintern( + image->pi_fullpath)); + } + } + if (fd >= 0) close(fd); /* * New addr2line support recursive inline function with -i ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r289025 - head/sys/sys
Author: fabient Date: Thu Oct 8 10:00:41 2015 New Revision: 289025 URL: https://svnweb.freebsd.org/changeset/base/289025 Log: Fix r283120 which use class size larger than 8bits. The new mapping will restore binary compatibility with stable_10 but file generated since r283120 are broken. Reviewed by: jhb Sponsored by: Stormshield Modified: head/sys/sys/pmc.h Modified: head/sys/sys/pmc.h == --- head/sys/sys/pmc.h Thu Oct 8 09:54:33 2015(r289024) +++ head/sys/sys/pmc.h Thu Oct 8 10:00:41 2015(r289025) @@ -128,26 +128,26 @@ enum pmc_cputype { */ #define__PMC_CLASSES() \ - __PMC_CLASS(TSC,0x000, "CPU Timestamp counter")\ - __PMC_CLASS(K7, 0x100, "AMD K7 performance counters") \ - __PMC_CLASS(K8, 0x101, "AMD K8 performance counters") \ - __PMC_CLASS(P5, 0x102, "Intel Pentium counters") \ - __PMC_CLASS(P6, 0x103, "Intel Pentium Pro counters") \ - __PMC_CLASS(P4, 0x104, "Intel Pentium-IV counters")\ - __PMC_CLASS(IAF,0x105, "Intel Core2/Atom, fixed function") \ - __PMC_CLASS(IAP,0x106, "Intel Core...Atom, programmable") \ - __PMC_CLASS(UCF,0x107, "Intel Uncore fixed function") \ - __PMC_CLASS(UCP,0x108, "Intel Uncore programmable")\ - __PMC_CLASS(XSCALE, 0x200, "Intel XScale counters")\ - __PMC_CLASS(ARMV7, 0x201, "ARMv7")\ - __PMC_CLASS(ARMV8, 0x202, "ARMv8")\ - __PMC_CLASS(MIPS24K,0x300, "MIPS 24K") \ - __PMC_CLASS(OCTEON, 0x301, "Cavium Octeon")\ - __PMC_CLASS(MIPS74K,0x302, "MIPS 74K") \ - __PMC_CLASS(PPC7450,0x400, "Motorola MPC7450 class") \ - __PMC_CLASS(PPC970, 0x401, "IBM PowerPC 970 class")\ - __PMC_CLASS(E500, 0x402, "Freescale e500 class") \ - __PMC_CLASS(SOFT, 0x8000, "Software events") + __PMC_CLASS(TSC,0x00, "CPU Timestamp counter")\ + __PMC_CLASS(K7, 0x01, "AMD K7 performance counters") \ + __PMC_CLASS(K8, 0x02, "AMD K8 performance counters") \ + __PMC_CLASS(P5, 0x03, "Intel Pentium counters") \ + __PMC_CLASS(P6, 0x04, "Intel Pentium Pro counters") \ + __PMC_CLASS(P4, 0x05, "Intel Pentium-IV counters")\ + __PMC_CLASS(IAF,0x06, "Intel Core2/Atom, fixed function") \ + __PMC_CLASS(IAP,0x07, "Intel Core...Atom, programmable") \ + __PMC_CLASS(UCF,0x08, "Intel Uncore fixed function") \ + __PMC_CLASS(UCP,0x09, "Intel Uncore programmable")\ + __PMC_CLASS(XSCALE, 0x0A, "Intel XScale counters")\ + __PMC_CLASS(MIPS24K,0x0B, "MIPS 24K") \ + __PMC_CLASS(OCTEON, 0x0C, "Cavium Octeon")\ + __PMC_CLASS(PPC7450,0x0D, "Motorola MPC7450 class") \ + __PMC_CLASS(PPC970, 0x0E, "IBM PowerPC 970 class")\ + __PMC_CLASS(SOFT, 0x0F, "Software events") \ + __PMC_CLASS(ARMV7, 0x10, "ARMv7")\ + __PMC_CLASS(ARMV8, 0x11, "ARMv8")\ + __PMC_CLASS(MIPS74K,0x12, "MIPS 74K") \ + __PMC_CLASS(E500, 0x13, "Freescale e500 class") enum pmc_class { #undef __PMC_CLASS @@ -156,7 +156,7 @@ enum pmc_class { }; #definePMC_CLASS_FIRST PMC_CLASS_TSC -#definePMC_CLASS_LAST PMC_CLASS_SOFT +#definePMC_CLASS_LAST PMC_CLASS_E500 /* * A PMC can be in the following states: ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r289024 - head/sys/kern
Author: fabient Date: Thu Oct 8 09:54:33 2015 New Revision: 289024 URL: https://svnweb.freebsd.org/changeset/base/289024 Log: Fix r283998 that broke mapin events for hwpmc. Reviewed by: jhb Sponsored by: Stormshield Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c == --- head/sys/kern/vfs_vnops.c Thu Oct 8 09:46:35 2015(r289023) +++ head/sys/kern/vfs_vnops.c Thu Oct 8 09:54:33 2015(r289024) @@ -43,6 +43,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_hwpmc_hooks.h" + #include #include #include @@ -84,6 +86,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef HWPMC_HOOKS +#include +#endif + static fo_rdwr_t vn_read; static fo_rdwr_t vn_write; static fo_rdwr_t vn_io_fault; @@ -2461,7 +2467,7 @@ vn_mmap(struct file *fp, vm_map_t map, v /* Inform hwpmc(4) if an executable is being mapped. */ if (error == 0 && (prot & VM_PROT_EXECUTE) != 0) { pkm.pm_file = vp; - pkm.pm_address = (uintptr_t) addr; + pkm.pm_address = (uintptr_t) *addr; PMC_CALL_HOOK(td, PMC_FN_MMAP, (void *) ); } #endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r286890 - head/sys/dev/ichwd
Author: fabient Date: Tue Aug 18 14:54:29 2015 New Revision: 286890 URL: https://svnweb.freebsd.org/changeset/base/286890 Log: Add ichwd TCO version 3 support (Bay Trail / Rangeley...) Reviewed by: jhb Obtained from: Cas-well Sponsored by: Stormshield Modified: head/sys/dev/ichwd/ichwd.c head/sys/dev/ichwd/ichwd.h Modified: head/sys/dev/ichwd/ichwd.c == --- head/sys/dev/ichwd/ichwd.c Tue Aug 18 14:10:04 2015(r286889) +++ head/sys/dev/ichwd/ichwd.c Tue Aug 18 14:54:29 2015(r286890) @@ -53,6 +53,7 @@ * (document no. 252516-001) sections 9.10 and 9.11. * * ICH6/7/8 support by Takeharu KATO takeharu1...@ybb.ne.jp + * SoC PMC support by Denir Li denir...@cas-well.com */ #include sys/cdefs.h @@ -74,161 +75,216 @@ __FBSDID($FreeBSD$); #include dev/ichwd/ichwd.h static struct ichwd_device ichwd_devices[] = { - { DEVICEID_82801AA, Intel 82801AA watchdog timer,1 }, - { DEVICEID_82801AB, Intel 82801AB watchdog timer,1 }, - { DEVICEID_82801BA, Intel 82801BA watchdog timer,2 }, - { DEVICEID_82801BAM, Intel 82801BAM watchdog timer, 2 }, - { DEVICEID_82801CA, Intel 82801CA watchdog timer,3 }, - { DEVICEID_82801CAM, Intel 82801CAM watchdog timer, 3 }, - { DEVICEID_82801DB, Intel 82801DB watchdog timer,4 }, - { DEVICEID_82801DBM, Intel 82801DBM watchdog timer, 4 }, - { DEVICEID_82801E, Intel 82801E watchdog timer, 5 }, - { DEVICEID_82801EB, Intel 82801EB watchdog timer,5 }, - { DEVICEID_82801EBR, Intel 82801EB/ER watchdog timer, 5 }, - { DEVICEID_6300ESB, Intel 6300ESB watchdog timer,5 }, - { DEVICEID_82801FBR, Intel 82801FB/FR watchdog timer, 6 }, - { DEVICEID_ICH6M,Intel ICH6M watchdog timer, 6 }, - { DEVICEID_ICH6W,Intel ICH6W watchdog timer, 6 }, - { DEVICEID_ICH7, Intel ICH7 watchdog timer, 7 }, - { DEVICEID_ICH7DH, Intel ICH7DH watchdog timer, 7 }, - { DEVICEID_ICH7M,Intel ICH7M watchdog timer, 7 }, - { DEVICEID_ICH7MDH, Intel ICH7MDH watchdog timer,7 }, - { DEVICEID_NM10, Intel NM10 watchdog timer, 7 }, - { DEVICEID_ICH8, Intel ICH8 watchdog timer, 8 }, - { DEVICEID_ICH8DH, Intel ICH8DH watchdog timer, 8 }, - { DEVICEID_ICH8DO, Intel ICH8DO watchdog timer, 8 }, - { DEVICEID_ICH8M,Intel ICH8M watchdog timer, 8 }, - { DEVICEID_ICH8ME, Intel ICH8M-E watchdog timer,8 }, - { DEVICEID_63XXESB, Intel 63XXESB watchdog timer,8 }, - { DEVICEID_ICH9, Intel ICH9 watchdog timer, 9 }, - { DEVICEID_ICH9DH, Intel ICH9DH watchdog timer, 9 }, - { DEVICEID_ICH9DO, Intel ICH9DO watchdog timer, 9 }, - { DEVICEID_ICH9M,Intel ICH9M watchdog timer, 9 }, - { DEVICEID_ICH9ME, Intel ICH9M-E watchdog timer,9 }, - { DEVICEID_ICH9R,Intel ICH9R watchdog timer, 9 }, - { DEVICEID_ICH10,Intel ICH10 watchdog timer, 10 }, - { DEVICEID_ICH10D, Intel ICH10D watchdog timer, 10 }, - { DEVICEID_ICH10DO, Intel ICH10DO watchdog timer,10 }, - { DEVICEID_ICH10R, Intel ICH10R watchdog timer, 10 }, - { DEVICEID_PCH, Intel PCH watchdog timer,10 }, - { DEVICEID_PCHM, Intel PCH watchdog timer,10 }, - { DEVICEID_P55, Intel P55 watchdog timer,10 }, - { DEVICEID_PM55, Intel PM55 watchdog timer, 10 }, - { DEVICEID_H55, Intel H55 watchdog timer,10 }, - { DEVICEID_QM57, Intel QM57 watchdog timer, 10 }, - { DEVICEID_H57, Intel H57 watchdog timer,10 }, - { DEVICEID_HM55, Intel HM55 watchdog timer, 10 }, - { DEVICEID_Q57, Intel Q57 watchdog timer,10 }, - { DEVICEID_HM57, Intel HM57 watchdog timer, 10 }, - { DEVICEID_PCHMSFF, Intel PCHMSFF watchdog timer,10 }, - { DEVICEID_QS57, Intel QS57 watchdog timer, 10 }, - { DEVICEID_3400, Intel 3400 watchdog timer, 10 }, - { DEVICEID_3420, Intel 3420 watchdog timer, 10 }, - { DEVICEID_3450, Intel 3450 watchdog timer, 10 }, - { DEVICEID_CPT0, Intel Cougar Point watchdog timer, 10 }, - { DEVICEID_CPT1, Intel Cougar Point watchdog timer, 10 }, - { DEVICEID_CPT2, Intel Cougar Point watchdog timer, 10 }, - { DEVICEID_CPT3, Intel Cougar Point watchdog timer, 10 }, - { DEVICEID_CPT4, Intel Cougar Point watchdog timer, 10 }, - { DEVICEID_CPT5, Intel Cougar Point watchdog timer, 10 }, - { DEVICEID_CPT6, Intel Cougar Point watchdog timer, 10 }, - { DEVICEID_CPT7, Intel Cougar Point watchdog timer, 10 }, - {
svn commit: r280759 - head/sys/netinet
Author: fabient Date: Fri Mar 27 13:26:59 2015 New Revision: 280759 URL: https://svnweb.freebsd.org/changeset/base/280759 Log: On multi CPU systems, we may emit successive packets with the same id. Fix the race by using an atomic operation. Differential Revision:https://reviews.freebsd.org/D2141 Obtained from:emeric.pou...@stormshield.eu MFC after:1 week Sponsored by: Stormshield Modified: head/sys/netinet/ip_output.c head/sys/netinet/ip_var.h Modified: head/sys/netinet/ip_output.c == --- head/sys/netinet/ip_output.cFri Mar 27 12:45:20 2015 (r280758) +++ head/sys/netinet/ip_output.cFri Mar 27 13:26:59 2015 (r280759) @@ -91,7 +91,7 @@ __FBSDID($FreeBSD$); #include security/mac/mac_framework.h -VNET_DEFINE(u_short, ip_id); +VNET_DEFINE(uint32_t, ip_id); #ifdef MBUF_STRESS_TEST static int mbuf_frag_size = 0; Modified: head/sys/netinet/ip_var.h == --- head/sys/netinet/ip_var.h Fri Mar 27 12:45:20 2015(r280758) +++ head/sys/netinet/ip_var.h Fri Mar 27 13:26:59 2015(r280759) @@ -174,7 +174,7 @@ struct inpcb; struct route; struct sockopt; -VNET_DECLARE(u_short, ip_id); /* ip packet ctr, for ids */ +VNET_DECLARE(uint32_t, ip_id); /* ip packet ctr, for ids */ VNET_DECLARE(int, ip_defttl); /* default IP ttl */ VNET_DECLARE(int, ipforwarding); /* ip forwarding */ #ifdef IPSTEALTH @@ -228,7 +228,7 @@ struct in_ifaddr * void ip_savecontrol(struct inpcb *, struct mbuf **, struct ip *, struct mbuf *); void ip_slowtimo(void); -u_int16_t ip_randomid(void); +uint16_t ip_randomid(void); intrip_ctloutput(struct socket *, struct sockopt *); void rip_ctlinput(int, struct sockaddr *, void *); void rip_init(void); @@ -305,8 +305,18 @@ extern int (*ip_dn_io_ptr)(struct mbuf * VNET_DECLARE(int, ip_do_randomid); #defineV_ip_do_randomidVNET(ip_do_randomid) -#defineip_newid() ((V_ip_do_randomid != 0) ? ip_randomid() : \ - htons(V_ip_id++)) +static __inline uint16_t +ip_newid(void) +{ + uint16_t res; + + if (V_ip_do_randomid != 0) + return (ip_randomid()); + else { + res = atomic_fetchadd_32(V_ip_id, 1) 0x; + return (htons(res)); + } +} #endif /* _KERNEL */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r268359 - head/sys/dev/mge
Author: fabient Date: Mon Jul 7 08:22:39 2014 New Revision: 268359 URL: http://svnweb.freebsd.org/changeset/base/268359 Log: Optim and Fix for mge driver: - add missing rcvif in mbuf - add missing ipacket stat - remove uncessary mbuf copy on output path - fix deadlock of the TX engine in case of error Obtained from:NETASQ MFC after:2 weeks Modified: head/sys/dev/mge/if_mge.c Modified: head/sys/dev/mge/if_mge.c == --- head/sys/dev/mge/if_mge.c Mon Jul 7 06:37:14 2014(r268358) +++ head/sys/dev/mge/if_mge.c Mon Jul 7 08:22:39 2014(r268359) @@ -1140,6 +1140,8 @@ mge_intr_rx_locked(struct mge_softc *sc, mb-m_pkthdr.len -= 2; mb-m_data += 2; + mb-m_pkthdr.rcvif = ifp; + mge_offload_process_frame(ifp, mb, status, bufsize); @@ -1159,6 +1161,8 @@ mge_intr_rx_locked(struct mge_softc *sc, count -= 1; } + ifp-if_ipackets += rx_npkts; + return (rx_npkts); } @@ -1437,12 +1441,6 @@ mge_encap(struct mge_softc *sc, struct m ifp = sc-ifp; - /* Check for free descriptors */ - if (sc-tx_desc_used_count + 1 = MGE_TX_DESC_NUM) { - /* No free descriptors */ - return (-1); - } - /* Fetch unused map */ desc_no = sc-tx_desc_curr; dw = sc-mge_tx_desc[desc_no]; @@ -1451,9 +1449,16 @@ mge_encap(struct mge_softc *sc, struct m /* Create mapping in DMA memory */ error = bus_dmamap_load_mbuf_sg(sc-mge_tx_dtag, mapp, m0, segs, nsegs, BUS_DMA_NOWAIT); - if (error != 0 || nsegs != 1 ) { + if (error != 0) { + m_freem(m0); + return (error); + } + + /* Only one segment is supported. */ + if (nsegs != 1) { bus_dmamap_unload(sc-mge_tx_dtag, mapp); - return ((error != 0) ? error : -1); + m_freem(m0); + return (-1); } bus_dmamap_sync(sc-mge_tx_dtag, mapp, BUS_DMASYNC_PREWRITE); @@ -1553,15 +1558,33 @@ mge_start_locked(struct ifnet *ifp) if (m0 == NULL) break; - mtmp = m_defrag(m0, M_NOWAIT); - if (mtmp) - m0 = mtmp; + if (m0-m_pkthdr.csum_flags (CSUM_IP|CSUM_TCP|CSUM_UDP) || + m0-m_flags M_VLANTAG) { + if (M_WRITABLE(m0) == 0) { + mtmp = m_dup(m0, M_NOWAIT); + m_freem(m0); + if (mtmp == NULL) + continue; + m0 = mtmp; + } + } + /* The driver support only one DMA fragment. */ + if (m0-m_next != NULL) { + mtmp = m_defrag(m0, M_NOWAIT); + if (mtmp) + m0 = mtmp; + } - if (mge_encap(sc, m0)) { + /* Check for free descriptors */ + if (sc-tx_desc_used_count + 1 = MGE_TX_DESC_NUM) { IF_PREPEND(ifp-if_snd, m0); ifp-if_drv_flags |= IFF_DRV_OACTIVE; break; } + + if (mge_encap(sc, m0) != 0) + break; + queued++; BPF_MTAP(ifp, m0); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r253779 - in head: . share/man/man4 sys/amd64/conf sys/arm/conf sys/conf sys/dev/random sys/i386/conf sys/ia64/conf sys/mips/conf sys/modules sys/modules/random sys/pc98/conf sys/power
Le 29 juil. 2013 à 22:26, David E. O'Brien a écrit : Author: obrien Date: Mon Jul 29 20:26:27 2013 New Revision: 253779 URL: http://svnweb.freebsd.org/changeset/base/253779 Log: Decouple yarrow from random(4) device. * Make Yarrow an optional kernel component -- enabled by YARROW_RNG option. The files sha2.c, hash.c, randomdev_soft.c and yarrow.c comprise yarrow. * random(4) device doesn't really depend on rijndael-*. Yarrow, however, does. * Add random_adaptors.[ch] which is basically a store of random_adaptor's. random_adaptor is basically an adapter that plugs in to random(4). random_adaptor can only be plugged in to random(4) very early in bootup. Unplugging random_adaptor from random(4) is not supported, and is probably a bad idea anyway, due to potential loss of entropy pools. We currently have 3 random_adaptors: + yarrow + rdrand (ivy.c) + nehemeiah * Remove platform dependent logic from probe.c, and move it into corresponding registration routines of each random_adaptor provider. probe.c doesn't do anything other than picking a specific random_adaptor from a list of registered ones. * If the kernel doesn't have any random_adaptor adapters present then the creation of /dev/random is postponed until next random_adaptor is kldload'ed. * Fix randomdev_soft.c to refer to its own random_adaptor, instead of a system wide one. We need to have very good random by default. Even selecting HW random automatically is not very good. HW random is difficult to trust. Why not having a good default software random seeded by automatically detected HW random ? After that the user can choose to bypass the software random a feed directly by the HW random source. Submitted by: arthurm...@gmail.com, obrien Obtained from: Juniper Networks Reviewed by: obrien Modified: head/UPDATING head/share/man/man4/random.4 head/sys/amd64/conf/GENERIC head/sys/arm/conf/AC100 head/sys/arm/conf/ARMADAXP head/sys/arm/conf/ARNDALE head/sys/arm/conf/ATMEL head/sys/arm/conf/AVILA head/sys/arm/conf/BEAGLEBONE head/sys/arm/conf/BWCT head/sys/arm/conf/CAMBRIA head/sys/arm/conf/CNS11XXNAS head/sys/arm/conf/CRB head/sys/arm/conf/CUBIEBOARD head/sys/arm/conf/DB-78XXX head/sys/arm/conf/DB-88F5XXX head/sys/arm/conf/DB-88F6XXX head/sys/arm/conf/DOCKSTAR head/sys/arm/conf/DREAMPLUG-1001 head/sys/arm/conf/EA3250 head/sys/arm/conf/EB9200 head/sys/arm/conf/EFIKA_MX head/sys/arm/conf/EP80219 head/sys/arm/conf/ETHERNUT5 head/sys/arm/conf/GUMSTIX head/sys/arm/conf/HL200 head/sys/arm/conf/HL201 head/sys/arm/conf/IQ31244 head/sys/arm/conf/KB920X head/sys/arm/conf/LN2410SBC head/sys/arm/conf/NSLU head/sys/arm/conf/PANDABOARD head/sys/arm/conf/QILA9G20 head/sys/arm/conf/RPI-B head/sys/arm/conf/SAM9260EK head/sys/arm/conf/SAM9G20EK head/sys/arm/conf/SAM9X25EK head/sys/arm/conf/SHEEVAPLUG head/sys/arm/conf/SN9G45 head/sys/arm/conf/TS7800 head/sys/arm/conf/VERSATILEPB head/sys/arm/conf/ZEDBOARD head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options head/sys/dev/random/ivy.c head/sys/dev/random/nehemiah.c head/sys/dev/random/probe.c head/sys/dev/random/randomdev.c head/sys/dev/random/randomdev.h head/sys/dev/random/randomdev_soft.c head/sys/dev/random/randomdev_soft.h head/sys/dev/random/yarrow.c head/sys/i386/conf/GENERIC head/sys/i386/conf/XBOX head/sys/i386/conf/XEN head/sys/ia64/conf/GENERIC head/sys/mips/conf/AR71XX_BASE head/sys/mips/conf/AR724X_BASE head/sys/mips/conf/AR91XX_BASE head/sys/mips/conf/AR933X_BASE head/sys/mips/conf/BERI_TEMPLATE head/sys/mips/conf/DIR-825 head/sys/mips/conf/GXEMUL head/sys/mips/conf/OCTEON1 head/sys/mips/conf/PB92 head/sys/mips/conf/RT305X head/sys/mips/conf/XLR64 head/sys/mips/conf/XLRN32 head/sys/mips/conf/std.SWARM head/sys/mips/conf/std.XLP head/sys/modules/Makefile head/sys/modules/random/Makefile head/sys/pc98/conf/GENERIC head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/GENERIC64 head/sys/powerpc/conf/MPC85XX head/sys/powerpc/conf/WII head/sys/sparc64/conf/GENERIC head/tools/tools/sysdoc/sysdoc.sh head/tools/tools/sysdoc/tunables.mdoc Modified: head/UPDATING == --- head/UPDATING Mon Jul 29 19:50:30 2013(r253778) +++ head/UPDATING Mon Jul 29 20:26:27 2013(r253779) @@ -31,6 +31,19 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 disable the most expensive debugging functionality run ln -s 'abort:false,junk:false' /etc/malloc.conf.) +20130729: + random(4) and actual RNG implementations (aka, adaptors) have been + further decoupled. If you are running a custom kernel, you may + need to explicitly enable at least one RNG adaptor in your kernel + config. For example, to use Yarrow, add options YARROW_RNG to
svn commit: r247836 - in head/sys: dev/hwpmc kern sys
Author: fabient Date: Tue Mar 5 10:18:48 2013 New Revision: 247836 URL: http://svnweb.freebsd.org/changeset/base/247836 Log: Add a generic way to call per event allocate / release function. Reviewed by: mav MFC after:1 month Modified: head/sys/dev/hwpmc/hwpmc_soft.c head/sys/kern/kern_clock.c head/sys/sys/pmckern.h Modified: head/sys/dev/hwpmc/hwpmc_soft.c == --- head/sys/dev/hwpmc/hwpmc_soft.c Tue Mar 5 09:49:34 2013 (r247835) +++ head/sys/dev/hwpmc/hwpmc_soft.c Tue Mar 5 10:18:48 2013 (r247836) @@ -45,8 +45,6 @@ __FBSDID($FreeBSD$); #defineSOFT_CAPS (PMC_CAP_READ | PMC_CAP_WRITE | PMC_CAP_INTERRUPT | \ PMC_CAP_USER | PMC_CAP_SYSTEM) -PMC_SOFT_DECLARE( , , clock, prof); - struct soft_descr { struct pmc_descr pm_descr; /* base class */ }; @@ -126,9 +124,10 @@ soft_allocate_pmc(int cpu, int ri, struc if (ps == NULL) return (EINVAL); pmc_soft_ev_release(ps); + /* Module unload is protected by pmc SX lock. */ + if (ps-ps_alloc != NULL) + ps-ps_alloc(); - if (ev == pmc___clock_prof.ps_ev.pm_ev_code) - cpu_startprofclock(); return (0); } @@ -315,6 +314,8 @@ static int soft_release_pmc(int cpu, int ri, struct pmc *pmc) { struct pmc_hw *phw; + enum pmc_event ev; + struct pmc_soft *ps; (void) pmc; @@ -328,8 +329,16 @@ soft_release_pmc(int cpu, int ri, struct KASSERT(phw-phw_pmc == NULL, ([soft,%d] PHW pmc %p non-NULL, __LINE__, phw-phw_pmc)); - if (pmc-pm_event == pmc___clock_prof.ps_ev.pm_ev_code) - cpu_stopprofclock(); + ev = pmc-pm_event; + + /* Check if event is registered. */ + ps = pmc_soft_ev_acquire(ev); + KASSERT(ps != NULL, + ([soft,%d] unregistered event %d, __LINE__, ev)); + pmc_soft_ev_release(ps); + /* Module unload is protected by pmc SX lock. */ + if (ps-ps_release != NULL) + ps-ps_release(); return (0); } Modified: head/sys/kern/kern_clock.c == --- head/sys/kern/kern_clock.c Tue Mar 5 09:49:34 2013(r247835) +++ head/sys/kern/kern_clock.c Tue Mar 5 10:18:48 2013(r247836) @@ -78,7 +78,8 @@ __FBSDID($FreeBSD$); #include sys/pmckern.h PMC_SOFT_DEFINE( , , clock, hard); PMC_SOFT_DEFINE( , , clock, stat); -PMC_SOFT_DEFINE( , , clock, prof); +PMC_SOFT_DEFINE_EX( , , clock, prof, \ +cpu_startprofclock, cpu_stopprofclock); #endif #ifdef DEVICE_POLLING Modified: head/sys/sys/pmckern.h == --- head/sys/sys/pmckern.h Tue Mar 5 09:49:34 2013(r247835) +++ head/sys/sys/pmckern.h Tue Mar 5 10:18:48 2013(r247836) @@ -87,9 +87,9 @@ struct pmckern_soft { * Soft PMC. */ -#define PMC_SOFT_DEFINE(prov, mod, func, name) \ +#define PMC_SOFT_DEFINE_EX(prov, mod, func, name, alloc, release) \ struct pmc_soft pmc_##prov##_##mod##_##func##_##name = \ - { 0, { #prov _ #mod _ #func . #name, 0 } }; \ + { 0, alloc, release, { #prov _ #mod _ #func . #name, 0 } }; \ SYSINIT(pmc_##prov##_##mod##_##func##_##name##_init, SI_SUB_KDTRACE, \ SI_ORDER_SECOND + 1, pmc_soft_ev_register, \ pmc_##prov##_##mod##_##func##_##name ); \ @@ -97,6 +97,9 @@ struct pmckern_soft { SI_SUB_KDTRACE, SI_ORDER_SECOND + 1, pmc_soft_ev_deregister, \ pmc_##prov##_##mod##_##func##_##name ) +#define PMC_SOFT_DEFINE(prov, mod, func, name) \ + PMC_SOFT_DEFINE_EX(prov, mod, func, name, NULL, NULL) + #define PMC_SOFT_DECLARE(prov, mod, func, name) \ extern struct pmc_soft pmc_##prov##_##mod##_##func##_##name @@ -147,6 +150,8 @@ do { \ struct pmc_soft { int ps_running; + void(*ps_alloc)(void); + void(*ps_release)(void); struct pmc_dyn_event_descr ps_ev; }; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r240323 - head/tools/test/hwpmc
Author: fabient Date: Mon Sep 10 16:32:28 2012 New Revision: 240323 URL: http://svn.freebsd.org/changeset/base/240323 Log: Add SOFT as a possible section to exclude from counter list. Modified: head/tools/test/hwpmc/pmctest.py Modified: head/tools/test/hwpmc/pmctest.py == --- head/tools/test/hwpmc/pmctest.pyMon Sep 10 16:28:45 2012 (r240322) +++ head/tools/test/hwpmc/pmctest.pyMon Sep 10 16:32:28 2012 (r240323) @@ -53,7 +53,7 @@ from subprocess import PIPE # A list of strings that are not really counters, just # name tags that are output by pmccontrol -L -notcounter = [IAF, IAP, TSC, UNC, UCF, UCP] +notcounter = [IAF, IAP, TSC, UNC, UCF, UCP, SOFT ] def main(): ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r240203 - head/sys/dev/hwpmc
Author: fabient Date: Fri Sep 7 14:45:59 2012 New Revision: 240203 URL: http://svn.freebsd.org/changeset/base/240203 Log: Complete and merge the list between Sandy/Ivy bridge of events that can run on specific PMC. MFC after:1 month Modified: head/sys/dev/hwpmc/hwpmc_core.c Modified: head/sys/dev/hwpmc/hwpmc_core.c == --- head/sys/dev/hwpmc/hwpmc_core.c Fri Sep 7 14:10:22 2012 (r240202) +++ head/sys/dev/hwpmc/hwpmc_core.c Fri Sep 7 14:45:59 2012 (r240203) @@ -1695,36 +1695,29 @@ iap_event_westmere_ok_on_counter(enum pm } static int -iap_event_sandybridge_ok_on_counter(enum pmc_event pe, int ri) -{ - uint32_t mask; - - switch (pe) { - /* -* Events valid only on counter 2. -*/ - case PMC_EV_IAP_EVENT_48H_01H: - mask = 0x4; - break; - default: - mask = ~0; /* Any row index is ok. */ - } - - return (mask (1 ri)); -} - -static int -iap_event_ivybridge_ok_on_counter(enum pmc_event pe, int ri) +iap_event_sb_ib_ok_on_counter(enum pmc_event pe, int ri) { uint32_t mask; switch (pe) { - /* -* Events valid only on counter 2. -*/ + /* Events valid only on counter 0. */ + case PMC_EV_IAP_EVENT_B7H_01H: + mask = 0x1; + break; + /* Events valid only on counter 1. */ + case PMC_EV_IAP_EVENT_C0H_01H: + mask = 0x1; + break; + /* Events valid only on counter 2. */ case PMC_EV_IAP_EVENT_48H_01H: mask = 0x4; break; + /* Events valid only on counter 3. */ + case PMC_EV_IAP_EVENT_BBH_01H: + case PMC_EV_IAP_EVENT_CDH_01H: + case PMC_EV_IAP_EVENT_CDH_02H: + mask = 0x8; + break; default: mask = ~0; /* Any row index is ok. */ } @@ -1808,12 +1801,9 @@ iap_allocate_pmc(int cpu, int ri, struct if (iap_event_corei7_ok_on_counter(ev, ri) == 0) return (EINVAL); break; - case PMC_CPU_INTEL_IVYBRIDGE: - if (iap_event_ivybridge_ok_on_counter(ev, ri) == 0) - return (EINVAL); - break; case PMC_CPU_INTEL_SANDYBRIDGE: - if (iap_event_sandybridge_ok_on_counter(ev, ri) == 0) + case PMC_CPU_INTEL_IVYBRIDGE: + if (iap_event_sb_ib_ok_on_counter(ev, ri) == 0) return (EINVAL); break; case PMC_CPU_INTEL_WESTMERE: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r240164 - in head: lib/libpmc sys/dev/hwpmc sys/sys
)), + PMCMASK(REQ_OTHER, (1ULL 15)), + PMCMASK(RES_ANY,(1ULL 16)), + PMCMASK(RES_SUPPLIER_SUPP, (1ULL 17)), + PMCMASK(RES_SUPPLIER_LLC_HITM, (1ULL 18)), + PMCMASK(RES_SUPPLIER_LLC_HITE, (1ULL 19)), + PMCMASK(RES_SUPPLIER_LLC_HITS, (1ULL 20)), + PMCMASK(RES_SUPPLIER_LLC_HITF, (1ULL 21)), + PMCMASK(RES_SUPPLIER_LOCAL, (1ULL 22)), + PMCMASK(RES_SNOOP_SNPI_NONE,(1ULL 31)), + PMCMASK(RES_SNOOP_SNP_NO_NEEDED,(1ULL 32)), + PMCMASK(RES_SNOOP_SNP_MISS, (1ULL 33)), + PMCMASK(RES_SNOOP_HIT_NO_FWD, (1ULL 34)), + PMCMASK(RES_SNOOP_HIT_FWD, (1ULL 35)), + PMCMASK(RES_SNOOP_HITM, (1ULL 36)), + PMCMASK(RES_NON_DRAM, (1ULL 37)), + NULLMASK +}; + static int iap_allocate_pmc(enum pmc_event pe, char *ctrspec, struct pmc_op_pmcallocate *pmc_config) { char *e, *p, *q; - uint32_t cachestate, evmask, rsp; + uint64_t cachestate, evmask, rsp; int count, n; pmc_config-pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE | @@ -753,7 +793,13 @@ iap_allocate_pmc(enum pmc_event pe, char } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_COREI7 || cpu_info.pm_cputype == PMC_CPU_INTEL_WESTMERE) { if (KWPREFIXMATCH(p, IAP_KW_RSP =)) { - n = pmc_parse_mask(iap_rsp_mask, p, rsp); + n = pmc_parse_mask(iap_rsp_mask_i7_wm, p, rsp); + } else + return (-1); + } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_SANDYBRIDGE || + cpu_info.pm_cputype == PMC_CPU_INTEL_IVYBRIDGE) { + if (KWPREFIXMATCH(p, IAP_KW_RSP =)) { + n = pmc_parse_mask(iap_rsp_mask_sb_ib, p, rsp); } else return (-1); } else @@ -1072,7 +1118,8 @@ k8_allocate_pmc(enum pmc_event pe, char { char*e, *p, *q; int n; - uint32_tcount, evmask; + uint32_tcount; + uint64_tevmask; const struct pmc_masks *pm, *pmask; pmc_config-pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE); @@ -1554,7 +1601,8 @@ p4_allocate_pmc(enum pmc_event pe, char char*e, *p, *q; int count, has_tag, has_busreqtype, n; - uint32_t evmask, cccractivemask; + uint32_t cccractivemask; + uint64_t evmask; const struct pmc_masks *pm, *pmask; pmc_config-pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE); @@ -1982,7 +2030,7 @@ p6_allocate_pmc(enum pmc_event pe, char struct pmc_op_pmcallocate *pmc_config) { char *e, *p, *q; - uint32_t evmask; + uint64_t evmask; int count, n; const struct pmc_masks *pm, *pmask; @@ -2622,6 +2670,10 @@ pmc_event_names_of_class(enum pmc_class ev = corei7_event_table; count = PMC_EVENT_TABLE_SIZE(corei7); break; + case PMC_CPU_INTEL_IVYBRIDGE: + ev = ivybridge_event_table; + count = PMC_EVENT_TABLE_SIZE(ivybridge); + break; case PMC_CPU_INTEL_SANDYBRIDGE: ev = sandybridge_event_table; count = PMC_EVENT_TABLE_SIZE(sandybridge); @@ -2914,6 +2966,9 @@ pmc_init(void) pmc_class_table[n++] = corei7uc_class_table_descr; PMC_MDEP_INIT_INTEL_V2(corei7); break; + case PMC_CPU_INTEL_IVYBRIDGE: + PMC_MDEP_INIT_INTEL_V2(ivybridge); + break; case PMC_CPU_INTEL_SANDYBRIDGE: pmc_class_table[n++] = ucf_class_table_descr; pmc_class_table[n++] = sandybridgeuc_class_table_descr; @@ -3049,6 +3104,10 @@ _pmc_name_of_event(enum pmc_event pe, en ev = corei7_event_table; evfence = corei7_event_table + PMC_EVENT_TABLE_SIZE(corei7); break; + case PMC_CPU_INTEL_IVYBRIDGE: + ev = ivybridge_event_table; + evfence = ivybridge_event_table + PMC_EVENT_TABLE_SIZE(ivybridge); + break; case PMC_CPU_INTEL_SANDYBRIDGE: ev = sandybridge_event_table; evfence = sandybridge_event_table + PMC_EVENT_TABLE_SIZE(sandybridge); Added: head/lib/libpmc/pmc.ivybridge.3 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libpmc/pmc.ivybridge.3 Thu Sep 6 13:54:01 2012 (r240164) @@ -0,0 +1,880 @@ +.\ Copyright (c) 2012 Fabien Thomas. All rights reserved
Re: svn commit: r239105 - head/sys/dev/e1000
@@ -961,7 +961,15 @@ igb_mq_start(struct ifnet *ifp, struct m que = adapter-queues[i]; if (((txr-queue_status IGB_QUEUE_DEPLETED) == 0) IGB_TX_TRYLOCK(txr)) { - err = igb_mq_start_locked(ifp, txr, m); + struct mbuf *pm = NULL; + /* + ** Try to queue first to avoid + ** out-of-order delivery, but + ** settle for it if that fails + */ + if (m drbr_enqueue(ifp, txr-br, m)) + pm = m; + err = igb_mq_start_locked(ifp, txr, pm); IGB_TX_UNLOCK(txr); } else { Why not just enqueue / start with NULL ? err = drbr_enqueue(ifp, txr-br, m); igb_mq_start_locked(ifp, txr, NULL); It seems that in case the queue is full you will send out of order with the current patch. err = drbr_enqueue(ifp, txr-br, m); @@ -981,7 +989,7 @@ igb_mq_start_locked(struct ifnet *ifp, s IGB_TX_LOCK_ASSERT(txr); if (((ifp-if_drv_flags IFF_DRV_RUNNING) == 0) || - (txr-queue_status == IGB_QUEUE_DEPLETED) || + (txr-queue_status IGB_QUEUE_DEPLETED) || adapter-link_active == 0) { if (m != NULL) err = drbr_enqueue(ifp, txr-br, m);
svn commit: r237295 - head/sys/dev/viawd
Author: fabient Date: Wed Jun 20 09:01:44 2012 New Revision: 237295 URL: http://svn.freebsd.org/changeset/base/237295 Log: Fix viawd(4) that was only working as a module. Obtained from:jhb MFC after: 3 days Modified: head/sys/dev/viawd/viawd.c Modified: head/sys/dev/viawd/viawd.c == --- head/sys/dev/viawd/viawd.c Wed Jun 20 08:29:24 2012(r237294) +++ head/sys/dev/viawd/viawd.c Wed Jun 20 09:01:44 2012(r237295) @@ -168,14 +168,18 @@ viawd_attach(device_t dev) } /* Allocate I/O register space. */ - sc-wd_rid = 0; - sc-wd_res = bus_alloc_resource(dev, SYS_RES_MEMORY, sc-wd_rid, - pmbase, pmbase + VIAWD_MEM_LEN - 1, VIAWD_MEM_LEN, + sc-wd_rid = VIAWD_CONFIG_BASE; + sc-wd_res = bus_alloc_resource_any(sb_dev, SYS_RES_MEMORY, sc-wd_rid, RF_ACTIVE | RF_SHAREABLE); if (sc-wd_res == NULL) { device_printf(dev, Unable to map watchdog memory\n); goto fail; } + if (rman_get_size(sc-wd_res) VIAWD_MEM_LEN) { + device_printf(dev, Bad size for watchdog memory: %#x\n, + (unsigned)rman_get_size(sc-wd_res)); + goto fail; + } /* Check if watchdog fired last boot. */ reg = viawd_read_4(sc, VIAWD_MEM_CTRL); @@ -192,7 +196,7 @@ viawd_attach(device_t dev) return (0); fail: if (sc-wd_res != NULL) - bus_release_resource(dev, SYS_RES_MEMORY, + bus_release_resource(sb_dev, SYS_RES_MEMORY, sc-wd_rid, sc-wd_res); return (ENXIO); } @@ -224,7 +228,7 @@ viawd_detach(device_t dev) } if (sc-wd_res != NULL) - bus_release_resource(sc-dev, SYS_RES_MEMORY, + bus_release_resource(sc-sb_dev, SYS_RES_MEMORY, sc-wd_rid, sc-wd_res); return (0); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r237322 - head/sys/dev/xen/balloon
Author: fabient Date: Wed Jun 20 15:45:50 2012 New Revision: 237322 URL: http://svn.freebsd.org/changeset/base/237322 Log: Allow booting XENHVM kernel without Xen hypervisor. MFC after:3 days Modified: head/sys/dev/xen/balloon/balloon.c Modified: head/sys/dev/xen/balloon/balloon.c == --- head/sys/dev/xen/balloon/balloon.c Wed Jun 20 15:12:31 2012 (r237321) +++ head/sys/dev/xen/balloon/balloon.c Wed Jun 20 15:45:50 2012 (r237322) @@ -436,6 +436,9 @@ balloon_init_watcher(void *arg) { int err; + if (!is_running_on_xen()) + return; + err = xs_register_watch(target_watch); if (err) printf(Failed to set balloon watcher\n); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r236997 - in head/sys: arm/include dev/hwpmc
Author: fabient Date: Wed Jun 13 06:38:25 2012 New Revision: 236997 URL: http://svn.freebsd.org/changeset/base/236997 Log: Add ARM callchain support for hwpmc. Sponsored by: NETASQ MFC after:3 days Modified: head/sys/arm/include/pmc_mdep.h head/sys/dev/hwpmc/hwpmc_arm.c Modified: head/sys/arm/include/pmc_mdep.h == --- head/sys/arm/include/pmc_mdep.h Wed Jun 13 06:19:08 2012 (r236996) +++ head/sys/arm/include/pmc_mdep.h Wed Jun 13 06:38:25 2012 (r236997) @@ -50,9 +50,17 @@ union pmc_md_pmc { struct pmc_md_xscale_pmcpm_xscale; }; -#definePMC_TRAPFRAME_TO_PC(TF) ((TF)-tf_pc) -#definePMC_TRAPFRAME_TO_FP(TF) ((TF)-tf_usr_lr) -#definePMC_TRAPFRAME_TO_SP(TF) ((TF)-tf_usr_sp) +#definePMC_IN_KERNEL_STACK(S,START,END)\ + ((S) = (START) (S) (END)) +#definePMC_IN_KERNEL(va) (((va) = USRSTACK) \ + ((va) VM_MAX_KERNEL_ADDRESS)) + +#definePMC_IN_USERSPACE(va) ((va) = VM_MAXUSER_ADDRESS) + +#definePMC_TRAPFRAME_TO_PC(TF) ((TF)-tf_pc) +#definePMC_TRAPFRAME_TO_FP(TF) ((TF)-tf_r11) +#definePMC_TRAPFRAME_TO_SVC_SP(TF) ((TF)-tf_svc_sp) +#definePMC_TRAPFRAME_TO_USR_SP(TF) ((TF)-tf_usr_sp) /* Build a fake kernel trapframe from current instruction pointer. */ #define PMC_FAKE_TRAPFRAME(TF) \ Modified: head/sys/dev/hwpmc/hwpmc_arm.c == --- head/sys/dev/hwpmc/hwpmc_arm.c Wed Jun 13 06:19:08 2012 (r236996) +++ head/sys/dev/hwpmc/hwpmc_arm.c Wed Jun 13 06:38:25 2012 (r236997) @@ -30,10 +30,16 @@ __FBSDID($FreeBSD$); #include sys/param.h #include sys/pmc.h +#include sys/proc.h #include sys/systm.h -#include machine/pmc_mdep.h +#include machine/cpu.h #include machine/md_var.h +#include machine/pmc_mdep.h + +#include vm/vm.h +#include vm/vm_param.h +#include vm/pmap.h struct pmc_mdep * pmc_md_initialize() @@ -58,27 +64,101 @@ pmc_md_finalize(struct pmc_mdep *md) #endif } -static int -pmc_save_callchain(uintptr_t *cc, int maxsamples, -struct trapframe *tf) -{ - - *cc = PMC_TRAPFRAME_TO_PC(tf); - return (1); -} - int pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) { + uintptr_t pc, r, stackstart, stackend, fp; + struct thread *td; + int count; + + KASSERT(TRAPF_USERMODE(tf) == 0,([arm,%d] not a kernel backtrace, + __LINE__)); + + pc = PMC_TRAPFRAME_TO_PC(tf); + *cc++ = pc; + + if ((td = curthread) == NULL) + return (1); + + if (maxsamples = 1) + return (1); + + stackstart = (uintptr_t) td-td_kstack; + stackend = (uintptr_t) td-td_kstack + td-td_kstack_pages * PAGE_SIZE; + fp = PMC_TRAPFRAME_TO_FP(tf); + + if (!PMC_IN_KERNEL(pc) || + !PMC_IN_KERNEL_STACK(fp, stackstart, stackend)) + return (1); + + for (count = 1; count maxsamples; count++) { + /* Use saved lr as pc. */ + r = fp - sizeof(uintptr_t); + if (!PMC_IN_KERNEL_STACK(r, stackstart, stackend)) + break; + pc = *(uintptr_t *)r; + if (!PMC_IN_KERNEL(pc)) + break; + + *cc++ = pc; + + /* Switch to next frame up */ + r = fp - 3 * sizeof(uintptr_t); + if (!PMC_IN_KERNEL_STACK(r, stackstart, stackend)) + break; + fp = *(uintptr_t *)r; + if (!PMC_IN_KERNEL_STACK(fp, stackstart, stackend)) + break; + } - return pmc_save_callchain(cc, maxsamples, tf); + return (count); } int pmc_save_user_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) { + uintptr_t pc, r, oldfp, fp; + struct thread *td; + int count; + + KASSERT(TRAPF_USERMODE(tf), ([x86,%d] Not a user trap frame tf=%p, + __LINE__, (void *) tf)); + + pc = PMC_TRAPFRAME_TO_PC(tf); + *cc++ = pc; + + if ((td = curthread) == NULL) + return (1); + + if (maxsamples = 1) + return (1); + + oldfp = fp = PMC_TRAPFRAME_TO_FP(tf); + + if (!PMC_IN_USERSPACE(pc) || + !PMC_IN_USERSPACE(fp)) + return (1); + + for (count = 1; count maxsamples; count++) { + /* Use saved lr as pc. */ + r = fp - sizeof(uintptr_t); + if (copyin((void *)r, pc, sizeof(pc)) != 0) + break; + if (!PMC_IN_USERSPACE(pc)) + break; + + *cc++ = pc; + + /* Switch to next frame up */ + oldfp = fp; +
svn commit: r236669 - head/usr.sbin/pmcstat
Author: fabient Date: Wed Jun 6 08:58:31 2012 New Revision: 236669 URL: http://svn.freebsd.org/changeset/base/236669 Log: Remove spurious ARM symbols from lookup table. MFC after:3 days Modified: head/usr.sbin/pmcstat/pmcstat_log.c Modified: head/usr.sbin/pmcstat/pmcstat_log.c == --- head/usr.sbin/pmcstat/pmcstat_log.c Wed Jun 6 08:07:47 2012 (r236668) +++ head/usr.sbin/pmcstat/pmcstat_log.c Wed Jun 6 08:58:31 2012 (r236669) @@ -554,6 +554,14 @@ pmcstat_image_add_symbols(struct pmcstat if ((fnname = elf_strptr(e, sh-sh_link, sym.st_name)) == NULL) continue; +#ifdef __arm__ + /* Remove spurious ARM function name. */ + if (fnname[0] == '$' + (fnname[1] == 'a' || fnname[1] == 't' || + fnname[1] == 'd') + fnname[2] == '\0') + continue; +#endif symptr-ps_name = pmcstat_string_intern(fnname); symptr-ps_start = sym.st_value - image-pi_vaddr; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r235831 - in head/sys: arm/arm arm/include dev/hwpmc
Author: fabient Date: Wed May 23 13:23:40 2012 New Revision: 235831 URL: http://svn.freebsd.org/changeset/base/235831 Log: Soft PMC support for ARM. Callgraph is not captured, only current location. Sample system wide profiling: pmcstat -Sclock.hard -T Modified: head/sys/arm/arm/machdep.c head/sys/arm/include/pmc_mdep.h head/sys/dev/hwpmc/hwpmc_arm.c Modified: head/sys/arm/arm/machdep.c == --- head/sys/arm/arm/machdep.c Wed May 23 13:01:22 2012(r235830) +++ head/sys/arm/arm/machdep.c Wed May 23 13:23:40 2012(r235831) @@ -674,9 +674,9 @@ fake_preload_metadata(void) static uint32_t fake_preload[35]; fake_preload[i++] = MODINFO_NAME; - fake_preload[i++] = strlen(elf kernel) + 1; - strcpy((char*)fake_preload[i++], elf kernel); - i += 2; + fake_preload[i++] = strlen(kernel) + 1; + strcpy((char*)fake_preload[i++], kernel); + i += 1; fake_preload[i++] = MODINFO_TYPE; fake_preload[i++] = strlen(elf kernel) + 1; strcpy((char*)fake_preload[i++], elf kernel); Modified: head/sys/arm/include/pmc_mdep.h == --- head/sys/arm/include/pmc_mdep.h Wed May 23 13:01:22 2012 (r235830) +++ head/sys/arm/include/pmc_mdep.h Wed May 23 13:23:40 2012 (r235831) @@ -54,6 +54,12 @@ union pmc_md_pmc { #definePMC_TRAPFRAME_TO_FP(TF) ((TF)-tf_usr_lr) #definePMC_TRAPFRAME_TO_SP(TF) ((TF)-tf_usr_sp) +/* Build a fake kernel trapframe from current instruction pointer. */ +#define PMC_FAKE_TRAPFRAME(TF) \ + do {\ + __asm __volatile(mov %0, pc : =r ((TF)-tf_pc));\ + } while (0) + /* * Prototypes */ Modified: head/sys/dev/hwpmc/hwpmc_arm.c == --- head/sys/dev/hwpmc/hwpmc_arm.c Wed May 23 13:01:22 2012 (r235830) +++ head/sys/dev/hwpmc/hwpmc_arm.c Wed May 23 13:23:40 2012 (r235831) @@ -38,38 +38,47 @@ __FBSDID($FreeBSD$); struct pmc_mdep * pmc_md_initialize() { +#ifdef CPU_XSCALE_IXP425 if (cpu_class == CPU_CLASS_XSCALE) return pmc_xscale_initialize(); else +#endif return NULL; } void pmc_md_finalize(struct pmc_mdep *md) { +#ifdef CPU_XSCALE_IXP425 if (cpu_class == CPU_CLASS_XSCALE) pmc_xscale_finalize(md); else KASSERT(0, ([arm,%d] Unknown CPU Class 0x%x, __LINE__, cpu_class)); +#endif +} + +static int +pmc_save_callchain(uintptr_t *cc, int maxsamples, +struct trapframe *tf) +{ + + *cc = PMC_TRAPFRAME_TO_PC(tf); + return (1); } int pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) { - (void) cc; - (void) maxsamples; - (void) tf; - return (0); + + return pmc_save_callchain(cc, maxsamples, tf); } int pmc_save_user_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) { - (void) cc; - (void) maxsamples; - (void) tf; - return (0); + + return pmc_save_callchain(cc, maxsamples, tf); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r235229 - head/sys/dev/hwpmc
Author: fabient Date: Thu May 10 14:27:49 2012 New Revision: 235229 URL: http://svn.freebsd.org/changeset/base/235229 Log: Remove out of date KASSERT that fire with soft PMC. MFC after:1 week Modified: head/sys/dev/hwpmc/hwpmc_intel.c Modified: head/sys/dev/hwpmc/hwpmc_intel.c == --- head/sys/dev/hwpmc/hwpmc_intel.cThu May 10 13:30:42 2012 (r235228) +++ head/sys/dev/hwpmc/hwpmc_intel.cThu May 10 14:27:49 2012 (r235229) @@ -196,10 +196,6 @@ pmc_intel_initialize(void) case PMC_CPU_INTEL_PIV: error = pmc_p4_initialize(pmc_mdep, ncpus); - - KASSERT(pmc_mdep-pmd_npmc == TSC_NPMCS + P4_NPMCS, - ([intel,%d] incorrect npmc count %d, __LINE__, - pmc_mdep-pmd_npmc)); break; #endif @@ -214,10 +210,6 @@ pmc_intel_initialize(void) case PMC_CPU_INTEL_PIII: case PMC_CPU_INTEL_PM: error = pmc_p6_initialize(pmc_mdep, ncpus); - - KASSERT(pmc_mdep-pmd_npmc == TSC_NPMCS + P6_NPMCS, - ([intel,%d] incorrect npmc count %d, __LINE__, - pmc_mdep-pmd_npmc)); break; /* @@ -226,10 +218,6 @@ pmc_intel_initialize(void) case PMC_CPU_INTEL_P5: error = pmc_p5_initialize(pmc_mdep, ncpus); - - KASSERT(pmc_mdep-pmd_npmc == TSC_NPMCS + PENTIUM_NPMCS, - ([intel,%d] incorrect npmc count %d, __LINE__, - pmc_mdep-pmd_npmc)); break; #endif ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r234598 - head/sys/dev/hwpmc
Author: fabient Date: Mon Apr 23 08:58:01 2012 New Revision: 234598 URL: http://svn.freebsd.org/changeset/base/234598 Log: Fix class malloc init for mips and powerpc that was not converted by r233628. Found by: monthadar, adrian MFC after:1 week Modified: head/sys/dev/hwpmc/hwpmc_mips.c head/sys/dev/hwpmc/hwpmc_powerpc.c Modified: head/sys/dev/hwpmc/hwpmc_mips.c == --- head/sys/dev/hwpmc/hwpmc_mips.c Mon Apr 23 07:15:15 2012 (r234597) +++ head/sys/dev/hwpmc/hwpmc_mips.c Mon Apr 23 08:58:01 2012 (r234598) @@ -431,11 +431,9 @@ pmc_mips_initialize() M_WAITOK|M_ZERO); /* Just one class */ - pmc_mdep = malloc(sizeof(struct pmc_mdep) + sizeof(struct pmc_classdep), - M_PMC, M_WAITOK|M_ZERO); + pmc_mdep = pmc_mdep_alloc(1); pmc_mdep-pmd_cputype = mips_pmc_spec.ps_cputype; - pmc_mdep-pmd_nclass = 1; pcd = pmc_mdep-pmd_classdep[PMC_MDEP_CLASS_INDEX_MIPS]; pcd-pcd_caps = mips_pmc_spec.ps_capabilities; Modified: head/sys/dev/hwpmc/hwpmc_powerpc.c == --- head/sys/dev/hwpmc/hwpmc_powerpc.c Mon Apr 23 07:15:15 2012 (r234597) +++ head/sys/dev/hwpmc/hwpmc_powerpc.c Mon Apr 23 08:58:01 2012 (r234598) @@ -803,11 +803,9 @@ pmc_md_initialize() M_WAITOK|M_ZERO); /* Just one class */ - pmc_mdep = malloc(sizeof(struct pmc_mdep) + sizeof(struct pmc_classdep), - M_PMC, M_WAITOK|M_ZERO); + pmc_mdep = pmc_mdep_alloc(1); pmc_mdep-pmd_cputype = PMC_CPU_PPC_7450; - pmc_mdep-pmd_nclass = 1; pcd = pmc_mdep-pmd_classdep[PMC_MDEP_CLASS_INDEX_PPC7450]; pcd-pcd_caps = POWERPC_PMC_CAPS; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r233611 - head/usr.sbin/pmcstat
Author: fabient Date: Wed Mar 28 16:23:40 2012 New Revision: 233611 URL: http://svn.freebsd.org/changeset/base/233611 Log: - Support inlined location in calltree output. In case of multiple level of inlining all the locations are flattened. Require recent binutils/addr2line (head works or binutils from ports with the right $PATH order). - Multiple fixes in the calltree output (recursion case, ...) - Fix the calltree top view that previously hide some shared nodes. Tested with Kcachegrind(kdesdk4)/qcachegrind(head). Sponsored by: NETASQ Modified: head/usr.sbin/pmcstat/pmcpl_calltree.c head/usr.sbin/pmcstat/pmcstat_log.c Modified: head/usr.sbin/pmcstat/pmcpl_calltree.c == --- head/usr.sbin/pmcstat/pmcpl_calltree.c Wed Mar 28 14:16:15 2012 (r233610) +++ head/usr.sbin/pmcstat/pmcpl_calltree.c Wed Mar 28 16:23:40 2012 (r233611) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009, Fabien Thomas + * Copyright (c) 2012, Fabien Thomas * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -58,20 +58,18 @@ __FBSDID($FreeBSD$); #include pmcstat_top.h #include pmcpl_calltree.h -#define PMCPL_CT_GROWSIZE 4 - -static pmcstat_interned_string pmcpl_ct_prevfn; +#definePMCPL_CT_GROWSIZE 4 static int pmcstat_skiplink = 0; struct pmcpl_ct_node; /* Get the sample value for PMC a. */ -#define PMCPL_CT_SAMPLE(a, b) \ +#definePMCPL_CT_SAMPLE(a, b) \ ((a) (b)-npmcs ? (b)-sb[a] : 0) /* Get the sample value in percent related to rsamples. */ -#define PMCPL_CT_SAMPLEP(a, b) \ +#definePMCPL_CT_SAMPLEP(a, b) \ (PMCPL_CT_SAMPLE(a, b) * 100.0 / rsamples-sb[a]) struct pmcpl_ct_sample { @@ -95,10 +93,13 @@ struct pmcpl_ct_instr { * Each calltree node is tracked by a pmcpl_ct_node struct. */ struct pmcpl_ct_node { -#define PMCPL_PCT_TAG 0x0001 /* Loop detection. */ - uint32_tpct_flags; struct pmcstat_image*pct_image; uintfptr_t pct_func; + + struct pmcstat_symbol *pct_sym; + pmcstat_interned_string pct_ifl; + pmcstat_interned_string pct_ifn; + struct pmcpl_ct_sample pct_samples; int pct_narc; @@ -109,17 +110,25 @@ struct pmcpl_ct_node { int pct_ninstr; int pct_instr_c; struct pmcpl_ct_instr *pct_instr; + +#define PMCPL_PCT_ADDR 0 +#define PMCPL_PCT_NAME 1 + charpct_type; +#definePMCPL_PCT_WHITE 0 +#definePMCPL_PCT_GREY 1 +#definePMCPL_PCT_BLACK 2 + charpct_color; }; struct pmcpl_ct_node_hash { struct pmcpl_ct_node *pch_ctnode; - LIST_ENTRY(pmcpl_ct_node_hash) pch_next; + STAILQ_ENTRY(pmcpl_ct_node_hash) pch_next; }; struct pmcpl_ct_sample pmcpl_ct_callid; -#define PMCPL_CT_MAXCOLPMC_CALLCHAIN_DEPTH_MAX -#define PMCPL_CT_MAXLINE 1024/* TODO: dynamic. */ +#definePMCPL_CT_MAXCOL PMC_CALLCHAIN_DEPTH_MAX +#definePMCPL_CT_MAXLINE1024/* TODO: dynamic. */ struct pmcpl_ct_line { unsignedln_sum; @@ -127,12 +136,13 @@ struct pmcpl_ct_line { }; struct pmcpl_ct_line pmcpl_ct_topmax[PMCPL_CT_MAXLINE+1]; -struct pmcpl_ct_node *pmcpl_ct_topscreen[PMCPL_CT_MAXCOL+1][PMCPL_CT_MAXLINE+1]; +struct pmcpl_ct_node +*pmcpl_ct_topscreen[PMCPL_CT_MAXCOL+1][PMCPL_CT_MAXLINE+1]; /* * All nodes indexed by function/image name are placed in a hash table. */ -static LIST_HEAD(,pmcpl_ct_node_hash) pmcpl_ct_node_hash[PMCSTAT_NHASH]; +static STAILQ_HEAD(,pmcpl_ct_node_hash) pmcpl_ct_node_hash[PMCSTAT_NHASH]; /* * Root node for the graph. @@ -256,7 +266,8 @@ pmcpl_ct_instr_grow(int cursize, int *ma */ static void -pmcpl_ct_instr_add(struct pmcpl_ct_node *ct, int pmcin, uintfptr_t pc) +pmcpl_ct_instr_add(struct pmcpl_ct_node *ct, int pmcin, +uintfptr_t pc, unsigned v) { int i; struct pmcpl_ct_instr *in; @@ -265,7 +276,7 @@ pmcpl_ct_instr_add(struct pmcpl_ct_node if (ct-pct_instr[i].pctf_func == pc) { in = ct-pct_instr[i]; pmcpl_ct_samples_grow(in-pctf_samples); - in-pctf_samples.sb[pmcin]++; + in-pctf_samples.sb[pmcin] += v; return; } } @@ -275,7 +286,7 @@ pmcpl_ct_instr_add(struct pmcpl_ct_node in-pctf_func = pc; pmcpl_ct_samples_init(in-pctf_samples); pmcpl_ct_samples_grow(in-pctf_samples); - in-pctf_samples.sb[pmcin] = 1; + in-pctf_samples.sb[pmcin] = v; ct-pct_ninstr++; } @@ -284,19 +295,19 @@ pmcpl_ct_instr_add(struct pmcpl_ct_node */ static struct pmcpl_ct_node * -pmcpl_ct_node_allocate
svn commit: r233544 - head/sys/dev/hwpmc
Author: fabient Date: Tue Mar 27 14:02:22 2012 New Revision: 233544 URL: http://svn.freebsd.org/changeset/base/233544 Log: Fix random deadlock on pmcstat exit: - Exit the thread when soft shutdown is requested - Wakeup owner thread. Reproduced/tested by looping pmcstat measurement: pmcstat -S instructions -O/tmp/test ls MFC after:1 week Modified: head/sys/dev/hwpmc/hwpmc_logging.c Modified: head/sys/dev/hwpmc/hwpmc_logging.c == --- head/sys/dev/hwpmc/hwpmc_logging.c Tue Mar 27 14:01:09 2012 (r233543) +++ head/sys/dev/hwpmc/hwpmc_logging.c Tue Mar 27 14:02:22 2012 (r233544) @@ -285,6 +285,7 @@ pmclog_loop(void *arg) if ((lb = TAILQ_FIRST(po-po_logbuffers)) == NULL) { mtx_unlock_spin(po-po_mtx); + /* No more buffers and shutdown required. */ if (po-po_flags PMC_PO_SHUTDOWN) { mtx_unlock(pmc_kthread_mtx); /* @@ -293,6 +294,7 @@ pmclog_loop(void *arg) */ fo_close(po-po_file, curthread); mtx_lock(pmc_kthread_mtx); + break; } (void) msleep(po, pmc_kthread_mtx, PWAIT, @@ -355,6 +357,7 @@ pmclog_loop(void *arg) lb = NULL; } + wakeup_one(po-po_kthread); po-po_kthread = NULL; mtx_unlock(pmc_kthread_mtx); @@ -653,8 +656,7 @@ pmclog_deconfigure_log(struct pmc_owner ([pmclog,%d] po=%p no log file, __LINE__, po)); /* stop the kthread, this will reset the 'OWNS_LOGFILE' flag */ - if (po-po_kthread) - pmclog_stop_kthread(po); + pmclog_stop_kthread(po); KASSERT(po-po_kthread == NULL, ([pmclog,%d] po=%p kthread not stopped, __LINE__, po)); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r229469 - head/sys/dev/hwpmc
Author: fabient Date: Wed Jan 4 07:33:06 2012 New Revision: 229469 URL: http://svn.freebsd.org/changeset/base/229469 Log: Add missing MSR programming for some events. Submitted by: Davide Italiano davide.itali...@gmail.com MFC after:3 days Modified: head/sys/dev/hwpmc/hwpmc_uncore.c head/sys/dev/hwpmc/hwpmc_uncore.h head/sys/dev/hwpmc/pmc_events.h Modified: head/sys/dev/hwpmc/hwpmc_uncore.c == --- head/sys/dev/hwpmc/hwpmc_uncore.c Wed Jan 4 07:25:10 2012 (r229468) +++ head/sys/dev/hwpmc/hwpmc_uncore.c Wed Jan 4 07:33:06 2012 (r229469) @@ -545,8 +545,14 @@ static struct ucp_event_descr ucp_events UCPDESCR(0CH_01H, 0x0C, 0x01, UCP_F_FM | UCP_F_WM), UCPDESCR(0CH_02H, 0x0C, 0x02, UCP_F_FM | UCP_F_WM), -UCPDESCR(0CH_04H, 0x0C, 0x04, UCP_F_FM | UCP_F_WM), -UCPDESCR(0CH_08H, 0x0C, 0x08, UCP_F_FM | UCP_F_WM), +UCPDESCR(0CH_04H_E, 0x0C, 0x04, UCP_F_FM | UCP_F_WM), +UCPDESCR(0CH_04H_F, 0x0C, 0x04, UCP_F_FM | UCP_F_WM), +UCPDESCR(0CH_04H_M, 0x0C, 0x04, UCP_F_FM | UCP_F_WM), +UCPDESCR(0CH_04H_S, 0x0C, 0x04, UCP_F_FM | UCP_F_WM), +UCPDESCR(0CH_08H_E, 0x0C, 0x08, UCP_F_FM | UCP_F_WM), +UCPDESCR(0CH_08H_F, 0x0C, 0x08, UCP_F_FM | UCP_F_WM), +UCPDESCR(0CH_08H_M, 0x0C, 0x08, UCP_F_FM | UCP_F_WM), +UCPDESCR(0CH_08H_S, 0x0C, 0x08, UCP_F_FM | UCP_F_WM), UCPDESCR(20H_01H, 0x20, 0x01, UCP_F_FM | UCP_F_I7 | UCP_F_WM), UCPDESCR(20H_02H, 0x20, 0x02, UCP_F_FM | UCP_F_I7 | UCP_F_WM), @@ -965,6 +971,36 @@ ucp_start_pmc(int cpu, int ri) PMCDBG(MDP,STA,2, ucp-start/2 cpu=%d ri=%d evselmsr=0x%x evsel=0x%x, cpu, ri, UCP_EVSEL0 + ri, evsel); + /* Event specific configuration. */ + switch (pm-pm_event) { + case PMC_EV_UCP_EVENT_0CH_04H_E: + wrmsr(MSR_GQ_SNOOP_MESF,0x2); + break; + case PMC_EV_UCP_EVENT_0CH_04H_F: + wrmsr(MSR_GQ_SNOOP_MESF,0x8); + break; + case PMC_EV_UCP_EVENT_0CH_04H_M: + wrmsr(MSR_GQ_SNOOP_MESF,0x1); + break; + case PMC_EV_UCP_EVENT_0CH_04H_S: + wrmsr(MSR_GQ_SNOOP_MESF,0x4); + break; + case PMC_EV_UCP_EVENT_0CH_08H_E: + wrmsr(MSR_GQ_SNOOP_MESF,0x2); + break; + case PMC_EV_UCP_EVENT_0CH_08H_F: + wrmsr(MSR_GQ_SNOOP_MESF,0x8); + break; + case PMC_EV_UCP_EVENT_0CH_08H_M: + wrmsr(MSR_GQ_SNOOP_MESF,0x1); + break; + case PMC_EV_UCP_EVENT_0CH_08H_S: + wrmsr(MSR_GQ_SNOOP_MESF,0x4); + break; + default: + break; + } + wrmsr(UCP_EVSEL0 + ri, evsel); do { Modified: head/sys/dev/hwpmc/hwpmc_uncore.h == --- head/sys/dev/hwpmc/hwpmc_uncore.h Wed Jan 4 07:25:10 2012 (r229468) +++ head/sys/dev/hwpmc/hwpmc_uncore.h Wed Jan 4 07:33:06 2012 (r229469) @@ -87,11 +87,18 @@ struct pmc_md_ucp_op_pmcallocate { #defineUC_GLOBAL_CTRL 0x391 #defineUC_GLOBAL_OVF_CTRL 0x393 + #defineUC_GLOBAL_STATUS_FLAG_CLRCHG(1ULL 63) #defineUC_GLOBAL_STATUS_FLAG_OVFPMI(1ULL 61) #defineUC_GLOBAL_CTRL_FLAG_FRZ (1ULL 63) #defineUC_GLOBAL_CTRL_FLAG_ENPMICORE0 (1ULL 48) +/* + * Model specific registers. + */ + +#define MSR_GQ_SNOOP_MESF 0x301 + struct pmc_md_ucf_pmc { uint64_tpm_ucf_ctrl; }; Modified: head/sys/dev/hwpmc/pmc_events.h == --- head/sys/dev/hwpmc/pmc_events.h Wed Jan 4 07:25:10 2012 (r229468) +++ head/sys/dev/hwpmc/pmc_events.h Wed Jan 4 07:33:06 2012 (r229469) @@ -2388,8 +2388,14 @@ __PMC_EV(UCP, EVENT_0BH_10H) \ __PMC_EV(UCP, EVENT_0BH_1FH) \ __PMC_EV(UCP, EVENT_0CH_01H) \ __PMC_EV(UCP, EVENT_0CH_02H) \ -__PMC_EV(UCP, EVENT_0CH_04H) \ -__PMC_EV(UCP, EVENT_0CH_08H) \ +__PMC_EV(UCP, EVENT_0CH_04H_E) \ +__PMC_EV(UCP, EVENT_0CH_04H_F) \ +__PMC_EV(UCP, EVENT_0CH_04H_M) \ +__PMC_EV(UCP, EVENT_0CH_04H_S) \ +__PMC_EV(UCP, EVENT_0CH_08H_E) \ +__PMC_EV(UCP, EVENT_0CH_08H_F) \ +__PMC_EV(UCP, EVENT_0CH_08H_M) \ +__PMC_EV(UCP, EVENT_0CH_08H_S) \ __PMC_EV(UCP, EVENT_20H_01H) \ __PMC_EV(UCP, EVENT_20H_02H) \ __PMC_EV(UCP, EVENT_20H_04H) \ @@ -2789,8 +2795,14 @@ __PMC_EV_ALIAS(L3_LINES_OUT.F_STATE, U __PMC_EV_ALIAS(L3_LINES_OUT.ANY, UCP_EVENT_0BH_1FH) \
svn commit: r229470 - in head: lib/libpmc sys/dev/hwpmc
Author: fabient Date: Wed Jan 4 07:58:36 2012 New Revision: 229470 URL: http://svn.freebsd.org/changeset/base/229470 Log: Update PMC events from October 2011 Intel documentation. Submitted by: Davide Italiano davide.itali...@gmail.com MFC after:3 days Modified: head/lib/libpmc/pmc.corei7.3 head/sys/dev/hwpmc/hwpmc_core.c head/sys/dev/hwpmc/pmc_events.h Modified: head/lib/libpmc/pmc.corei7.3 == --- head/lib/libpmc/pmc.corei7.3Wed Jan 4 07:33:06 2012 (r229469) +++ head/lib/libpmc/pmc.corei7.3Wed Jan 4 07:58:36 2012 (r229470) @@ -200,10 +200,6 @@ Number of cache load STLB hits .Pq Event 08H , Umask 20H Number of DTLB cache load misses where the low part of the linear to physical address translation was missed. -.It Li DTLB_LOAD_MISSES.PDP_MISS -.Pq Event 08H , Umask 40H -Number of DTLB cache load misses where the high part of the linear to -physical address translation was missed. .It Li DTLB_LOAD_MISSES.LARGE_WALK_COMPLETED .Pq Event 08H , Umask 80H Counts number of completed large page walks due to load miss in the STLB. @@ -646,10 +642,6 @@ Counter 0, 1 only Counts all data reads and writes (speculated and retired) from cacheable memory, including locked operations. Counter 0, 1 only -.It Li L1D_PEND_MISS.LOAD_BUFFERS_FULL -.Pq Event 48H , Umask 02H -Counts cycles of L1 data cache load fill buffers full. -Counter 0, 1 only .It Li DTLB_MISSES.ANY .Pq Event 49H , Umask 01H Counts the number of misses in the STLB which causes a page walk. @@ -660,6 +652,12 @@ Counts number of misses in the STLB whic .Pq Event 49H , Umask 10H Counts the number of DTLB first level misses that hit in the second level TLB. This event is only relevant if the core contains multiple DTLB levels. +.It Li DTLB_MISSES.PDE_MISS +.Pq Event 49H , Umask 20H +Number of DTLB misses caused by low part of address, includes references to 2M pages because 2M pages do not use the PDE. +.It Li DTLB_MISSES.LARGE_WALK_COMPLETED +.Pq Event 49H , Umask 80H +Counts number of misses in the STLB which resulted in a completed page walk for large pages. .It Li LOAD_HIT_PRE .Pq Event 4CH , Umask 01H Counts load operations sent to the L1 data cache while a previous SSE @@ -1205,9 +1203,6 @@ The BPU clear leads to 2 cycle bubble in .Pq Event E8H , Umask 02H Counts late Branch Prediction Unit clears due to Most Recently Used conflicts. The PBU clear leads to a 3 cycle bubble in the Front End. -.It Li BPU_CLEARS.ANY -.Pq Event E8H , Umask 03H -Counts all BPU clears. .It Li L2_TRANSACTIONS.LOAD .Pq Event F0H , Umask 01H Counts L2 load operations due to HW prefetch or demand loads. Modified: head/sys/dev/hwpmc/hwpmc_core.c == --- head/sys/dev/hwpmc/hwpmc_core.c Wed Jan 4 07:33:06 2012 (r229469) +++ head/sys/dev/hwpmc/hwpmc_core.c Wed Jan 4 07:58:36 2012 (r229470) @@ -642,7 +642,7 @@ static struct iap_event_descr iap_events IAPDESCR(08H_09H, 0x08, 0x09, IAP_F_FM | IAP_F_CA), IAPDESCR(08H_10H, 0x08, 0x10, IAP_F_FM | IAP_F_I7 | IAP_F_WM), IAPDESCR(08H_20H, 0x08, 0x20, IAP_F_FM | IAP_F_I7 | IAP_F_WM), -IAPDESCR(08H_40H, 0x08, 0x40, IAP_F_FM | IAP_F_I7), +IAPDESCR(08H_40H, 0x08, 0x40, IAP_F_FM | IAP_F_I7O), IAPDESCR(08H_80H, 0x08, 0x80, IAP_F_FM | IAP_F_I7), IAPDESCR(09H_01H, 0x09, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7O), @@ -845,7 +845,7 @@ static struct iap_event_descr iap_events IAPDESCR(47H_00H, 0x47, 0x00, IAP_F_FM | IAP_F_ALLCPUSCORE2), IAPDESCR(48H_00H, 0x48, 0x00, IAP_F_FM | IAP_F_ALLCPUSCORE2), -IAPDESCR(48H_02H, 0x48, 0x02, IAP_F_FM | IAP_F_I7), +IAPDESCR(48H_02H, 0x48, 0x02, IAP_F_FM | IAP_F_I7O), IAPDESCR(49H_00H, 0x49, 0x00, IAP_F_FM | IAP_F_CC), IAPDESCR(49H_01H, 0x49, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | @@ -854,9 +854,9 @@ static struct iap_event_descr iap_events IAP_F_I7 | IAP_F_WM), IAPDESCR(49H_04H, 0x49, 0x04, IAP_F_FM | IAP_F_WM), IAPDESCR(49H_10H, 0x49, 0x10, IAP_F_FM | IAP_F_I7 | IAP_F_WM), -IAPDESCR(49H_20H, 0x49, 0x20, IAP_F_FM | IAP_F_I7O), +IAPDESCR(49H_20H, 0x49, 0x20, IAP_F_FM | IAP_F_I7), IAPDESCR(49H_40H, 0x49, 0x40, IAP_F_FM | IAP_F_I7O), -IAPDESCR(49H_80H, 0x49, 0x80, IAP_F_FM | IAP_F_WM | IAP_F_I7O), +IAPDESCR(49H_80H, 0x49, 0x80, IAP_F_FM | IAP_F_WM | IAP_F_I7), IAPDESCR(4BH_00H, 0x4B, 0x00, IAP_F_FM | IAP_F_ALLCPUSCORE2), IAPDESCR(4BH_01H, 0x4B, 0x01, IAP_F_FM | IAP_F_ALLCPUSCORE2 | IAP_F_I7O), @@ -1306,7 +1306,7 @@ static struct iap_event_descr iap_events IAPDESCR(E8H_01H, 0xE8, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM), IAPDESCR(E8H_02H, 0xE8, 0x02, IAP_F_FM | IAP_F_I7 | IAP_F_WM), -IAPDESCR(E8H_03H, 0xE8, 0x03, IAP_F_FM | IAP_F_I7), +IAPDESCR(E8H_03H, 0xE8, 0x03, IAP_F_FM | IAP_F_I7O), IAPDESCR(ECH_01H, 0xEC, 0x01,
svn commit: r228802 - head/sys/dev/viawd
Author: fabient Date: Thu Dec 22 15:13:32 2011 New Revision: 228802 URL: http://svn.freebsd.org/changeset/base/228802 Log: Correctly spell my email address. Modified: head/sys/dev/viawd/viawd.c head/sys/dev/viawd/viawd.h Modified: head/sys/dev/viawd/viawd.c == --- head/sys/dev/viawd/viawd.c Thu Dec 22 15:03:48 2011(r228801) +++ head/sys/dev/viawd/viawd.c Thu Dec 22 15:13:32 2011(r228802) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011 Fabien Thomas ftho...@freebsd.org + * Copyright (c) 2011 Fabien Thomas fabi...@freebsd.org * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/viawd/viawd.h == --- head/sys/dev/viawd/viawd.h Thu Dec 22 15:03:48 2011(r228801) +++ head/sys/dev/viawd/viawd.h Thu Dec 22 15:13:32 2011(r228802) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011 Fabien Thomas ftho...@freebsd.org + * Copyright (c) 2011 Fabien Thomas fabi...@freebsd.org * All rights reserved. * * Redistribution and use in source and binary forms, with or without ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228502 - head/sys/dev/viawd
Author: fabient Date: Wed Dec 14 15:39:51 2011 New Revision: 228502 URL: http://svn.freebsd.org/changeset/base/228502 Log: Rework the attachement to probe directly on isab(4). Depend on r228496. Requested by: jhb MFC after:1 month Modified: head/sys/dev/viawd/viawd.c head/sys/dev/viawd/viawd.h Modified: head/sys/dev/viawd/viawd.c == --- head/sys/dev/viawd/viawd.c Wed Dec 14 15:19:40 2011(r228501) +++ head/sys/dev/viawd/viawd.c Wed Dec 14 15:39:51 2011(r228502) @@ -42,10 +42,9 @@ __FBSDID($FreeBSD$); #include viawd.h -#define viawd_read_wd_4(sc, off) \ - bus_space_read_4((sc)-wd_bst, (sc)-wd_bsh, (off)) -#define viawd_write_wd_4(sc, off, val) \ - bus_space_write_4((sc)-wd_bst, (sc)-wd_bsh, (off), (val)) +#defineviawd_read_4(sc, off) bus_read_4((sc)-wd_res, (off)) +#defineviawd_write_4(sc, off, val) \ + bus_write_4((sc)-wd_res, (off), (val)) static struct viawd_device viawd_devices[] = { { DEVICEID_VT8251, VIA VT8251 watchdog timer }, @@ -58,37 +57,17 @@ static struct viawd_device viawd_devices static devclass_t viawd_devclass; -static device_t -viawd_find(struct viawd_device **id_p) -{ - struct viawd_device *id; - device_t sb_dev = NULL; - - /* Look for a supported VIA south bridge. */ - for (id = viawd_devices; id-desc != NULL; ++id) - if ((sb_dev = pci_find_device(VENDORID_VIA, id-device)) != NULL) - break; - - if (sb_dev == NULL) - return (NULL); - - if (id_p != NULL) - *id_p = id; - - return (sb_dev); -} - static void viawd_tmr_state(struct viawd_softc *sc, int enable) { uint32_t reg; - reg = viawd_read_wd_4(sc, VIAWD_MEM_CTRL); + reg = viawd_read_4(sc, VIAWD_MEM_CTRL); if (enable) reg |= VIAWD_MEM_CTRL_TRIGGER | VIAWD_MEM_CTRL_ENABLE; else reg = ~VIAWD_MEM_CTRL_ENABLE; - viawd_write_wd_4(sc, VIAWD_MEM_CTRL, reg); + viawd_write_4(sc, VIAWD_MEM_CTRL, reg); } static void @@ -101,7 +80,7 @@ viawd_tmr_set(struct viawd_softc *sc, un else if (timeout VIAWD_MEM_COUNT_MAX) timeout = VIAWD_MEM_COUNT_MAX; - viawd_write_wd_4(sc, VIAWD_MEM_COUNT, timeout); + viawd_write_4(sc, VIAWD_MEM_COUNT, timeout); sc-timeout = timeout; } @@ -127,35 +106,40 @@ viawd_event(void *arg, unsigned int cmd, viawd_tmr_state(sc, 0); } -static void -viawd_identify(driver_t *driver, device_t parent) +/* Look for a supported VIA south bridge. */ +static struct viawd_device * +viawd_find(device_t dev) { - device_t dev; - device_t sb_dev; - struct viawd_device *id_p; + struct viawd_device *id; - sb_dev = viawd_find(id_p); - if (sb_dev == NULL) - return; + if (pci_get_vendor(dev) != VENDORID_VIA) + return (NULL); + for (id = viawd_devices; id-desc != NULL; id++) + if (pci_get_device(dev) == id-device) + return (id); + return (NULL); +} - /* Good, add child to bus. */ - if ((dev = device_find_child(parent, driver-name, 0)) == NULL) - dev = BUS_ADD_CHILD(parent, 0, driver-name, 0); +static void +viawd_identify(driver_t *driver, device_t parent) +{ - if (dev == NULL) + if (viawd_find(parent) == NULL) return; - device_set_desc_copy(dev, id_p-desc); + if (device_find_child(parent, driver-name, -1) == NULL) + BUS_ADD_CHILD(parent, 0, driver-name, 0); } static int viawd_probe(device_t dev) { + struct viawd_device *id; - /* Do not claim some ISA PnP device by accident. */ - if (isa_get_logicalid(dev) != 0) - return (ENXIO); - return (0); + id = viawd_find(device_get_parent(dev)); + KASSERT(id != NULL, (parent should be a valid VIA SB)); + device_set_desc(dev, id-desc); + return (BUS_PROBE_GENERIC); } static int @@ -163,13 +147,12 @@ viawd_attach(device_t dev) { device_t sb_dev; struct viawd_softc *sc; - struct viawd_device *id_p; uint32_t pmbase, reg; sc = device_get_softc(dev); sc-dev = dev; - sb_dev = viawd_find(id_p); + sb_dev = device_get_parent(dev); if (sb_dev == NULL) { device_printf(dev, Can not find watchdog device.\n); goto fail; @@ -193,16 +176,14 @@ viawd_attach(device_t dev) device_printf(dev, Unable to map watchdog memory\n); goto fail; } - sc-wd_bst = rman_get_bustag(sc-wd_res); - sc-wd_bsh = rman_get_bushandle(sc-wd_res); /* Check if watchdog fired last boot. */ - reg = viawd_read_wd_4(sc, VIAWD_MEM_CTRL); + reg = viawd_read_4(sc, VIAWD_MEM_CTRL);
svn commit: r228431 - in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/viawd sys/i386/conf sys/modules sys/modules/viawd
Author: fabient Date: Mon Dec 12 09:50:33 2011 New Revision: 228431 URL: http://svn.freebsd.org/changeset/base/228431 Log: Add watchdog support for VIA south bridge chipset. Tested on VT8251, VX900 but CX700, VX800, VX855 should works. MFC after:1 month Sponsored by: NETASQ Added: head/share/man/man4/viawd.4 (contents, props changed) head/sys/dev/viawd/ head/sys/dev/viawd/viawd.c (contents, props changed) head/sys/dev/viawd/viawd.h (contents, props changed) head/sys/modules/viawd/ head/sys/modules/viawd/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/amd64/conf/NOTES head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/i386/conf/NOTES head/sys/modules/Makefile Modified: head/share/man/man4/Makefile == --- head/share/man/man4/MakefileMon Dec 12 07:46:10 2011 (r228430) +++ head/share/man/man4/MakefileMon Dec 12 09:50:33 2011 (r228431) @@ -499,6 +499,7 @@ MAN=aac.4 \ vga.4 \ vge.4 \ viapm.4 \ + ${_viawd.4} \ vinum.4 \ vkbd.4 \ vlan.4 \ @@ -711,6 +712,7 @@ _speaker.4= speaker.4 _spkr.4= spkr.4 _tpm.4=tpm.4 _urtw.4= urtw.4 +_viawd.4= viawd.4 _wpi.4=wpi.4 _xen.4=xen.4 Added: head/share/man/man4/viawd.4 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/viawd.4 Mon Dec 12 09:50:33 2011(r228431) @@ -0,0 +1,79 @@ +.\- +.\ Copyright (c) 2011 Fabien Thomas fabi...@freebsd.org +.\ All rights reserved. +.\ +.\ Redistribution and use in source and binary forms, with or without +.\ modification, are permitted provided that the following conditions +.\ are met: +.\ 1. Redistributions of source code must retain the above copyright +.\notice, this list of conditions and the following disclaimer. +.\ 2. Redistributions in binary form must reproduce the above copyright +.\notice, this list of conditions and the following disclaimer in the +.\documentation and/or other materials provided with the distribution. +.\ +.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS `AS IS'' AND +.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\ SUCH DAMAGE. +.\ +.\ $FreeBSD$ +.\ +.Dd December 7, 2011 +.Dt VIAWD 4 +.Os +.Sh NAME +.Nm viawd +.Nd device driver for VIA south bridge watchdog timer +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd device viawd +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +viawd_load=YES +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides +.Xr watchdog 4 +support for the watchdog interrupt timer present on +VIA south bridge chipset (VT8251, CX700, VX800, VX855, VX900). +.Pp +The VIA south bridge have a built-in watchdog timer, +which can be enabled and disabled by user's program and set between +1 to 1023 seconds. +.Pp +The +.Nm +driver when unloaded with running watchdog will reschedule the watchdog +to 5 minutes. +.Sh SEE ALSO +.Xr watchdog 4 , +.Xr watchdog 8 , +.Xr watchdogd 8 , +.Xr watchdog 9 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 10.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver and this manual page were written by +.An Fabien Thomas Aq fabi...@freebsd.org . Modified: head/sys/amd64/conf/NOTES == --- head/sys/amd64/conf/NOTES Mon Dec 12 07:46:10 2011(r228430) +++ head/sys/amd64/conf/NOTES Mon Dec 12 09:50:33 2011(r228431) @@ -458,6 +458,7 @@ device tpm # device ichwd device amdsbwd +device viawd # # Temperature sensors: Modified: head/sys/conf/files.amd64 == --- head/sys/conf/files.amd64 Mon Dec 12 07:46:10 2011(r228430) +++ head/sys/conf/files.amd64 Mon Dec 12 09:50:33 2011(r228431) @@ -260,6 +260,7 @@ dev/tpm/tpm.c optional
svn commit: r228436 - in head: sys/dev/cpuctl usr.sbin/cpucontrol
intel.c amd.c via.c .include bsd.prog.mk Modified: head/usr.sbin/cpucontrol/cpucontrol.c == --- head/usr.sbin/cpucontrol/cpucontrol.c Mon Dec 12 11:03:14 2011 (r228435) +++ head/usr.sbin/cpucontrol/cpucontrol.c Mon Dec 12 12:30:44 2011 (r228436) @@ -51,6 +51,7 @@ __FBSDID($FreeBSD$); #include cpucontrol.h #include amd.h #include intel.h +#include via.h intverbosity_level = 0; @@ -91,6 +92,7 @@ struct ucode_handler { } handlers[] = { { intel_probe, intel_update }, { amd_probe, amd_update }, + { via_probe, via_update }, }; #define NHANDLERS (sizeof(handlers) / sizeof(*handlers)) Added: head/usr.sbin/cpucontrol/via.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/cpucontrol/via.c Mon Dec 12 12:30:44 2011 (r228436) @@ -0,0 +1,222 @@ +/*- + * Copyright (c) 2011 Fabien Thomas fabi...@freebsd.org. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include sys/cdefs.h +__FBSDID($FreeBSD$); + +#include assert.h +#include stdio.h +#include stdlib.h +#include string.h +#include unistd.h +#include fcntl.h +#include err.h + +#include sys/types.h +#include sys/stat.h +#include sys/mman.h +#include sys/ioctl.h +#include sys/ioccom.h +#include sys/cpuctl.h + +#include machine/cpufunc.h +#include machine/specialreg.h + +#include cpucontrol.h +#include via.h + +int +via_probe(int fd) +{ + char vendor[13]; + int error; + cpuctl_cpuid_args_t idargs = { + .level = 0, + }; + + error = ioctl(fd, CPUCTL_CPUID, idargs); + if (error 0) { + WARN(0, ioctl()); + return (1); + } + ((uint32_t *)vendor)[0] = idargs.data[1]; + ((uint32_t *)vendor)[1] = idargs.data[3]; + ((uint32_t *)vendor)[2] = idargs.data[2]; + vendor[12] = '\0'; + if (strncmp(vendor, CENTAUR_VENDOR_ID, sizeof(CENTAUR_VENDOR_ID)) != 0) + return (1); + + /* TODO: detect Nano CPU. */ + return (0); +} + +void +via_update(const char *dev, const char *path) +{ + int fd, devfd; + struct stat st; + uint32_t *fw_image; + uint32_t sum; + unsigned int i; + size_t payload_size; + via_fw_header_t *fw_header; + uint32_t signature, flags; + int32_t revision; + void *fw_data; + size_t data_size, total_size; + cpuctl_msr_args_t msrargs = { + .msr = MSR_IA32_PLATFORM_ID, + }; + cpuctl_cpuid_args_t idargs = { + .level = 1,/* Signature. */ + }; + cpuctl_update_args_t args; + int error; + + assert(path); + assert(dev); + + fd = -1; + devfd = -1; + fw_image = MAP_FAILED; + devfd = open(dev, O_RDWR); + if (devfd 0) { + WARN(0, could not open %s for writing, dev); + return; + } + error = ioctl(devfd, CPUCTL_CPUID, idargs); + if (error 0) { + WARN(0, ioctl(%s), dev); + goto fail; + } + signature = idargs.data[0]; + error = ioctl(devfd, CPUCTL_RDMSR, msrargs); + if (error 0) { + WARN(0, ioctl(%s), dev); + goto fail; + } + + /* +* MSR_IA32_PLATFORM_ID contains flag in BCD in bits 52-50. +*/ + flags = 1 ((msrargs.data 50) 7); + msrargs.msr = MSR_BIOS_SIGN; + error = ioctl(devfd, CPUCTL_RDMSR, msrargs); + if (error 0) { + WARN(0, ioctl(%s), dev); + goto fail
svn commit: r228438 - head/sys/dev/hwpmc
Author: fabient Date: Mon Dec 12 13:12:55 2011 New Revision: 228438 URL: http://svn.freebsd.org/changeset/base/228438 Log: There's a small set of events on Nehalem, that are not supported in processors with CPUID signature 06_1AH, 06_1EH, and 06_1FH. Refuse to allocate them on unsupported model. Submitted by: Davide Italiano davide.itali...@gmail.com MFC after:1 month Modified: head/sys/dev/hwpmc/hwpmc_core.c Modified: head/sys/dev/hwpmc/hwpmc_core.c == --- head/sys/dev/hwpmc/hwpmc_core.c Mon Dec 12 12:33:38 2011 (r228437) +++ head/sys/dev/hwpmc/hwpmc_core.c Mon Dec 12 13:12:55 2011 (r228438) @@ -41,6 +41,7 @@ __FBSDID($FreeBSD$); #include machine/apicvar.h #include machine/cpu.h #include machine/cpufunc.h +#include machine/md_var.h #include machine/specialreg.h #defineCORE_CPUID_REQUEST 0xA @@ -1553,7 +1554,7 @@ static int iap_allocate_pmc(int cpu, int ri, struct pmc *pm, const struct pmc_op_pmcallocate *a) { - int n; + int n, model; enum pmc_event ev; struct iap_event_descr *ie; uint32_t c, caps, config, cpuflag, evsel, mask; @@ -1573,6 +1574,16 @@ iap_allocate_pmc(int cpu, int ri, struct if (iap_architectural_event_is_unsupported(ev)) return (EOPNOTSUPP); + /* +* A small number of events are not supported in all the +* processors based on a given microarchitecture. +*/ + if (ev == PMC_EV_IAP_EVENT_0FH_01H || ev == PMC_EV_IAP_EVENT_0FH_80H) { + model = ((cpu_id 0xF) 12) | ((cpu_id 0xF0) 4); + if (core_cputype == PMC_CPU_INTEL_COREI7 model != 0x2E) + return (EINVAL); + } + switch (core_cputype) { case PMC_CPU_INTEL_COREI7: if (iap_event_corei7_ok_on_counter(ev, ri) == 0) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228198 - head/sys/dev/hwpmc
Author: fabient Date: Fri Dec 2 10:02:49 2011 New Revision: 228198 URL: http://svn.freebsd.org/changeset/base/228198 Log: Update Westmere uncore event exception list. Submitted by: Davide Italiano davide italiano at gmail com MFC after:1 week Modified: head/sys/dev/hwpmc/hwpmc_core.c Modified: head/sys/dev/hwpmc/hwpmc_core.c == --- head/sys/dev/hwpmc/hwpmc_core.c Fri Dec 2 09:28:19 2011 (r228197) +++ head/sys/dev/hwpmc/hwpmc_core.c Fri Dec 2 10:02:49 2011 (r228198) @@ -1479,6 +1479,10 @@ iap_event_westmere_ok_on_counter(enum pm /* * Events valid only on counter 0. */ + case PMC_EV_IAP_EVENT_60H_01H: + case PMC_EV_IAP_EVENT_60H_02H: + case PMC_EV_IAP_EVENT_60H_04H: + case PMC_EV_IAP_EVENT_60H_08H: case PMC_EV_IAP_EVENT_B3H_01H: case PMC_EV_IAP_EVENT_B3H_02H: case PMC_EV_IAP_EVENT_B3H_04H: @@ -1488,6 +1492,10 @@ iap_event_westmere_ok_on_counter(enum pm /* * Events valid only on counter 0, 1. */ + case PMC_EV_IAP_EVENT_4CH_01H: + case PMC_EV_IAP_EVENT_4EH_01H: + case PMC_EV_IAP_EVENT_4EH_02H: + case PMC_EV_IAP_EVENT_4EH_04H: case PMC_EV_IAP_EVENT_51H_01H: case PMC_EV_IAP_EVENT_51H_02H: case PMC_EV_IAP_EVENT_51H_04H: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r227391 - head/contrib/gcc/config/arm
Author: fabient Date: Wed Nov 9 15:59:02 2011 New Revision: 227391 URL: http://svn.freebsd.org/changeset/base/227391 Log: Import gcc fix for -fstack-protector that produces segfaulting binaries on arm/armel. Related gcc bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35965 PR: 161128 MFC after: 1 week Modified: head/contrib/gcc/config/arm/arm.c Modified: head/contrib/gcc/config/arm/arm.c == --- head/contrib/gcc/config/arm/arm.c Wed Nov 9 15:21:48 2011 (r227390) +++ head/contrib/gcc/config/arm/arm.c Wed Nov 9 15:59:02 2011 (r227391) @@ -3217,7 +3217,8 @@ legitimize_pic_address (rtx orig, enum m gcc_assert (!no_new_pseudos); if (arm_pic_register != INVALID_REGNUM) { - cfun-machine-pic_reg = gen_rtx_REG (Pmode, arm_pic_register); + if (!cfun-machine-pic_reg) + cfun-machine-pic_reg = gen_rtx_REG (Pmode, arm_pic_register); /* Play games to avoid marking the function as needing pic if we are being called as part of the cost-estimation @@ -3229,7 +3230,8 @@ legitimize_pic_address (rtx orig, enum m { rtx seq; - cfun-machine-pic_reg = gen_reg_rtx (Pmode); + if (!cfun-machine-pic_reg) + cfun-machine-pic_reg = gen_reg_rtx (Pmode); /* Play games to avoid marking the function as needing pic if we are being called as part of the cost-estimation ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r226986 - head/usr.sbin/pmcstat
Author: fabient Date: Tue Nov 1 09:28:47 2011 New Revision: 226986 URL: http://svn.freebsd.org/changeset/base/226986 Log: Two bugs fixed: - Do not close stdout or stderr when redirecting to file. - Correctly handle error code to detect when no buffer available. MFC after:1 month Modified: head/usr.sbin/pmcstat/pmcstat.c Modified: head/usr.sbin/pmcstat/pmcstat.c == --- head/usr.sbin/pmcstat/pmcstat.c Tue Nov 1 08:57:49 2011 (r226985) +++ head/usr.sbin/pmcstat/pmcstat.c Tue Nov 1 09:28:47 2011 (r226986) @@ -796,7 +796,9 @@ main(int argc, char **argv) break; case 'o': /* outputfile */ - if (args.pa_printfile != NULL) + if (args.pa_printfile != NULL + args.pa_printfile != stdout + args.pa_printfile != stderr) (void) fclose(args.pa_printfile); if ((args.pa_printfile = fopen(optarg, w)) == NULL) errx(EX_OSERR, ERROR: cannot open \%s\ for @@ -1394,7 +1396,7 @@ main(int argc, char **argv) case EVFILT_TIMER: /* print out counting PMCs */ if ((args.pa_flags FLAG_DO_TOP) -pmc_flush_logfile() != ENOBUFS) +pmc_flush_logfile() == 0) do_read = 1; do_print = 1; break; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r226526 - head/sys/sys
Author: fabient Date: Wed Oct 19 07:16:57 2011 New Revision: 226526 URL: http://svn.freebsd.org/changeset/base/226526 Log: Add missing DEBUG define from r226514. Modified: head/sys/sys/pmc.h Modified: head/sys/sys/pmc.h == --- head/sys/sys/pmc.h Wed Oct 19 06:24:53 2011(r226525) +++ head/sys/sys/pmc.h Wed Oct 19 07:16:57 2011(r226526) @@ -1040,6 +1040,7 @@ extern struct pmc_debugflags pmc_debugfl #definePMC_DEBUG_MIN_SIO 9 /* schedule i/o */ #definePMC_DEBUG_MIN_FLS 10 /* flush */ #definePMC_DEBUG_MIN_SAM 11 /* sample */ +#definePMC_DEBUG_MIN_CLO 12 /* close */ #else #definePMCDBG(M,N,L,F,...) /* nothing */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r226514 - in head: lib/libpmc sys/dev/hwpmc sys/sys usr.sbin/pmcstat
Badly merged my patchset... Corrected with r226526. On Oct 18, 2011, at 6:23 PM, Bjoern A. Zeeb wrote: On 18. Oct 2011, at 15:25 , Fabien Thomas wrote: Author: fabient Date: Tue Oct 18 15:25:43 2011 New Revision: 226514 URL: http://svn.freebsd.org/changeset/base/226514 Log: Add a flush of the current PMC log buffer before displaying the next top. As the underlying block is 4KB if the PMC throughput is low the measurement will be reported on the next tick. pmcstat(8) use the modified flush API to reclaim current buffer before displaying next top. I get this for every LINT kernel at minimum: /scratch/tmp/bz/head.universe/sys/modules/hwpmc/../../dev/hwpmc/hwpmc_logging.c: In function 'pmclog_close': /scratch/tmp/bz/head.universe/sys/modules/hwpmc/../../dev/hwpmc/hwpmc_logging.c:738: error: 'PMC_DEBUG_MIN_CLO' undeclared (first use in this function) /scratch/tmp/bz/head.universe/sys/modules/hwpmc/../../dev/hwpmc/hwpmc_logging.c:738: error: (Each undeclared identifier is reported only once /scratch/tmp/bz/head.universe/sys/modules/hwpmc/../../dev/hwpmc/hwpmc_logging.c:738: error: for each function it appears in.) MFC after: 1 month Modified: head/lib/libpmc/libpmc.c head/lib/libpmc/pmc.3 head/lib/libpmc/pmc.h head/lib/libpmc/pmc_configure_logfile.3 head/sys/dev/hwpmc/hwpmc_logging.c head/sys/dev/hwpmc/hwpmc_mod.c head/sys/sys/pmc.h head/sys/sys/pmclog.h head/usr.sbin/pmcstat/pmcstat.c head/usr.sbin/pmcstat/pmcstat_log.c Modified: head/lib/libpmc/libpmc.c == --- head/lib/libpmc/libpmc.c Tue Oct 18 14:05:18 2011(r226513) +++ head/lib/libpmc/libpmc.c Tue Oct 18 15:25:43 2011(r226514) @@ -2596,6 +2596,12 @@ pmc_flush_logfile(void) } int +pmc_close_logfile(void) +{ +return (PMC_CALL(CLOSELOG,0)); +} + +int pmc_get_driver_stats(struct pmc_driverstats *ds) { struct pmc_op_getdriverstats gms; Modified: head/lib/libpmc/pmc.3 == --- head/lib/libpmc/pmc.3Tue Oct 18 14:05:18 2011(r226513) +++ head/lib/libpmc/pmc.3Tue Oct 18 15:25:43 2011(r226514) @@ -322,6 +322,10 @@ to write logged events to. Flush all pending log data in .Xr hwpmc 4 Ns Ap s buffers. +.It Fn pmc_close_logfile +Flush all pending log data and close +.Xr hwpmc 4 Ns Ap s +side of the stream. .It Fn pmc_writelog Append arbitrary user data to the current log file. .El Modified: head/lib/libpmc/pmc.h == --- head/lib/libpmc/pmc.hTue Oct 18 14:05:18 2011(r226513) +++ head/lib/libpmc/pmc.hTue Oct 18 15:25:43 2011(r226514) @@ -76,6 +76,7 @@ intpmc_attach(pmc_id_t _pmcid, pid_t _p int pmc_capabilities(pmc_id_t _pmc, uint32_t *_caps); int pmc_configure_logfile(int _fd); int pmc_flush_logfile(void); +int pmc_close_logfile(void); int pmc_detach(pmc_id_t _pmcid, pid_t _pid); int pmc_disable(int _cpu, int _pmc); int pmc_enable(int _cpu, int _pmc); Modified: head/lib/libpmc/pmc_configure_logfile.3 == --- head/lib/libpmc/pmc_configure_logfile.3 Tue Oct 18 14:05:18 2011 (r226513) +++ head/lib/libpmc/pmc_configure_logfile.3 Tue Oct 18 15:25:43 2011 (r226514) @@ -29,7 +29,8 @@ .Sh NAME .Nm pmc_configure_logfile , .Nm pmc_flush_logfile , -.Nm pmc_writelog +.Nm pmc_writelog , +.Nm pmc_close_logfile .Nd log file management .Sh LIBRARY .Lb libpmc @@ -41,6 +42,8 @@ .Fn pmc_flush_logfile void .Ft int .Fn pmc_writelog uint32_t userdata +.Ft int +.Fn pmc_close_logfile void .Sh DESCRIPTION The functions manage logging of .Xr hwpmc 4 @@ -72,6 +75,12 @@ Function will append a log entry containing the value of argument .Fa userdata to the log file. +.Pp +Function +.Fn pmc_close_logfile +will flush all pending log data and close +.Xr hwpmc 4 Ns Ap s +side of the stream. .Sh RETURN VALUES .Rv -std .Sh ERRORS Modified: head/sys/dev/hwpmc/hwpmc_logging.c == --- head/sys/dev/hwpmc/hwpmc_logging.c Tue Oct 18 14:05:18 2011 (r226513) +++ head/sys/dev/hwpmc/hwpmc_logging.c Tue Oct 18 15:25:43 2011 (r226514) @@ -238,7 +238,7 @@ pmclog_get_buffer(struct pmc_owner *po) static void pmclog_loop(void *arg) { -int error, last_buffer; +int error; struct pmc_owner *po; struct pmclog_buffer *lb; struct proc *p; @@ -253,7 +253,6 @@ pmclog_loop(void *arg) p = po-po_owner; td = curthread; mycred = td-td_ucred; -last_buffer = 0; PROC_LOCK(p); ownercred = crhold(p-p_ucred); @@ -286,14 +285,22 @@ pmclog_loop(void *arg) if ((lb = TAILQ_FIRST(po-po_logbuffers
svn commit: r226514 - in head: lib/libpmc sys/dev/hwpmc sys/sys usr.sbin/pmcstat
Author: fabient Date: Tue Oct 18 15:25:43 2011 New Revision: 226514 URL: http://svn.freebsd.org/changeset/base/226514 Log: Add a flush of the current PMC log buffer before displaying the next top. As the underlying block is 4KB if the PMC throughput is low the measurement will be reported on the next tick. pmcstat(8) use the modified flush API to reclaim current buffer before displaying next top. MFC after:1 month Modified: head/lib/libpmc/libpmc.c head/lib/libpmc/pmc.3 head/lib/libpmc/pmc.h head/lib/libpmc/pmc_configure_logfile.3 head/sys/dev/hwpmc/hwpmc_logging.c head/sys/dev/hwpmc/hwpmc_mod.c head/sys/sys/pmc.h head/sys/sys/pmclog.h head/usr.sbin/pmcstat/pmcstat.c head/usr.sbin/pmcstat/pmcstat_log.c Modified: head/lib/libpmc/libpmc.c == --- head/lib/libpmc/libpmc.cTue Oct 18 14:05:18 2011(r226513) +++ head/lib/libpmc/libpmc.cTue Oct 18 15:25:43 2011(r226514) @@ -2596,6 +2596,12 @@ pmc_flush_logfile(void) } int +pmc_close_logfile(void) +{ + return (PMC_CALL(CLOSELOG,0)); +} + +int pmc_get_driver_stats(struct pmc_driverstats *ds) { struct pmc_op_getdriverstats gms; Modified: head/lib/libpmc/pmc.3 == --- head/lib/libpmc/pmc.3 Tue Oct 18 14:05:18 2011(r226513) +++ head/lib/libpmc/pmc.3 Tue Oct 18 15:25:43 2011(r226514) @@ -322,6 +322,10 @@ to write logged events to. Flush all pending log data in .Xr hwpmc 4 Ns Ap s buffers. +.It Fn pmc_close_logfile +Flush all pending log data and close +.Xr hwpmc 4 Ns Ap s +side of the stream. .It Fn pmc_writelog Append arbitrary user data to the current log file. .El Modified: head/lib/libpmc/pmc.h == --- head/lib/libpmc/pmc.h Tue Oct 18 14:05:18 2011(r226513) +++ head/lib/libpmc/pmc.h Tue Oct 18 15:25:43 2011(r226514) @@ -76,6 +76,7 @@ int pmc_attach(pmc_id_t _pmcid, pid_t _p intpmc_capabilities(pmc_id_t _pmc, uint32_t *_caps); intpmc_configure_logfile(int _fd); intpmc_flush_logfile(void); +intpmc_close_logfile(void); intpmc_detach(pmc_id_t _pmcid, pid_t _pid); intpmc_disable(int _cpu, int _pmc); intpmc_enable(int _cpu, int _pmc); Modified: head/lib/libpmc/pmc_configure_logfile.3 == --- head/lib/libpmc/pmc_configure_logfile.3 Tue Oct 18 14:05:18 2011 (r226513) +++ head/lib/libpmc/pmc_configure_logfile.3 Tue Oct 18 15:25:43 2011 (r226514) @@ -29,7 +29,8 @@ .Sh NAME .Nm pmc_configure_logfile , .Nm pmc_flush_logfile , -.Nm pmc_writelog +.Nm pmc_writelog , +.Nm pmc_close_logfile .Nd log file management .Sh LIBRARY .Lb libpmc @@ -41,6 +42,8 @@ .Fn pmc_flush_logfile void .Ft int .Fn pmc_writelog uint32_t userdata +.Ft int +.Fn pmc_close_logfile void .Sh DESCRIPTION The functions manage logging of .Xr hwpmc 4 @@ -72,6 +75,12 @@ Function will append a log entry containing the value of argument .Fa userdata to the log file. +.Pp +Function +.Fn pmc_close_logfile +will flush all pending log data and close +.Xr hwpmc 4 Ns Ap s +side of the stream. .Sh RETURN VALUES .Rv -std .Sh ERRORS Modified: head/sys/dev/hwpmc/hwpmc_logging.c == --- head/sys/dev/hwpmc/hwpmc_logging.c Tue Oct 18 14:05:18 2011 (r226513) +++ head/sys/dev/hwpmc/hwpmc_logging.c Tue Oct 18 15:25:43 2011 (r226514) @@ -238,7 +238,7 @@ pmclog_get_buffer(struct pmc_owner *po) static void pmclog_loop(void *arg) { - int error, last_buffer; + int error; struct pmc_owner *po; struct pmclog_buffer *lb; struct proc *p; @@ -253,7 +253,6 @@ pmclog_loop(void *arg) p = po-po_owner; td = curthread; mycred = td-td_ucred; - last_buffer = 0; PROC_LOCK(p); ownercred = crhold(p-p_ucred); @@ -286,14 +285,22 @@ pmclog_loop(void *arg) if ((lb = TAILQ_FIRST(po-po_logbuffers)) == NULL) { mtx_unlock_spin(po-po_mtx); + if (po-po_flags PMC_PO_SHUTDOWN) { + mtx_unlock(pmc_kthread_mtx); + /* +* Close the file to get PMCLOG_EOF +* error in pmclog(3). +*/ + fo_close(po-po_file, curthread); + mtx_lock(pmc_kthread_mtx); + } + (void) msleep(po, pmc_kthread_mtx, PWAIT, pmcloop, 0);
Re: svn commit: r225405 - head/sys/dev/ixgbe
On Sep 5, 2011, at 7:54 PM, Qing Li wrote: Author: qingli Date: Mon Sep 5 17:54:19 2011 New Revision: 225405 URL: http://svn.freebsd.org/changeset/base/225405 Log: The maximum read size of incoming packets is done in 1024-byte increments. The current code was rounding down the maximum frame size instead of routing up, resulting in a read size of 1024 bytes, in the non-jumbo frame case, and splitting the packets across multiple mbufs. I'm not sure to understand the fix: if (adapter-max_frame_size = 2048) adapter-rx_mbuf_sz = MCLBYTES; else if (adapter-max_frame_size = 4096) adapter-rx_mbuf_sz = MJUMPAGESIZE; else if (adapter-max_frame_size = 9216) adapter-rx_mbuf_sz = MJUM9BYTES; else adapter-rx_mbuf_sz = MJUM16BYTES; Without the fix this resolve to bufsz = adapter-rx_mbuf_sz IXGBE_SRRCTL_BSIZEPKT_SHIFT; 2048 10 = 2 which seem correct regarding the definition: BSIZEPACKET: Receive Buffer Size for Packet Buffer. The value is in 1 KB resolution. Value can be from 1 KB to 16 KB. Default buffer size is 2 KB. This field should not be set to 0x0. This field should be greater or equal to 0x2 in queues where RSC is enabled. I've missed something? Consequently the above problem exposed another issue, which is when packets were splitted across multiple mbufs, and all of the mbufs in the chain have the M_PKTHDR flag set. Submitted by:original patch by Ray Ruvinskiy at BlueCoat dot com Reviewed by: jfv, kmacy, rwatson Approved by: re (rwatson) MFC after: 5 days Modified: head/sys/dev/ixgbe/ixgbe.c Modified: head/sys/dev/ixgbe/ixgbe.c == --- head/sys/dev/ixgbe/ixgbe.cMon Sep 5 17:45:24 2011 (r225404) +++ head/sys/dev/ixgbe/ixgbe.cMon Sep 5 17:54:19 2011 (r225405) @@ -3849,6 +3849,8 @@ fail: **/ #define IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT 2 +#define BSIZEPKT_ROUNDUP ((1IXGBE_SRRCTL_BSIZEPKT_SHIFT)-1) + static void ixgbe_initialize_receive_units(struct adapter *adapter) { @@ -3882,7 +3884,7 @@ ixgbe_initialize_receive_units(struct ad hlreg = ~IXGBE_HLREG0_JUMBOEN; IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg); - bufsz = adapter-rx_mbuf_sz IXGBE_SRRCTL_BSIZEPKT_SHIFT; + bufsz = (adapter-rx_mbuf_sz + BSIZEPKT_ROUNDUP) IXGBE_SRRCTL_BSIZEPKT_SHIFT; for (int i = 0; i adapter-num_queues; i++, rxr++) { u64 rdba = rxr-rxdma.dma_paddr; @@ -4300,9 +4302,10 @@ ixgbe_rxeof(struct ix_queue *que, int co sendmp = rbuf-fmp; rbuf-m_pack = rbuf-fmp = NULL; - if (sendmp != NULL) /* secondary frag */ + if (sendmp != NULL) { /* secondary frag */ + mp-m_flags = ~M_PKTHDR; sendmp-m_pkthdr.len += mp-m_len; - else { + } else { /* first desc of a non-ps chain */ sendmp = mp; sendmp-m_flags |= M_PKTHDR; -- Fabien Thomas ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r220194 - head/sys/netipsec
Author: fabient Date: Thu Mar 31 13:14:24 2011 New Revision: 220194 URL: http://svn.freebsd.org/changeset/base/220194 Log: Fix two SA refcount: - AH does not release the SA like in ESP/IPCOMP when handling EAGAIN - ipsec_process_done incorrectly release the SA. Reviewed by: vanhu MFC after:1 week Modified: head/sys/netipsec/ipsec_output.c head/sys/netipsec/xform_ah.c Modified: head/sys/netipsec/ipsec_output.c == --- head/sys/netipsec/ipsec_output.cThu Mar 31 13:06:51 2011 (r220193) +++ head/sys/netipsec/ipsec_output.cThu Mar 31 13:14:24 2011 (r220194) @@ -247,7 +247,6 @@ ipsec_process_done(struct mbuf *m, struc panic(ipsec_process_done); bad: m_freem(m); - KEY_FREESAV(sav); return (error); } Modified: head/sys/netipsec/xform_ah.c == --- head/sys/netipsec/xform_ah.cThu Mar 31 13:06:51 2011 (r220193) +++ head/sys/netipsec/xform_ah.cThu Mar 31 13:14:24 2011 (r220194) @@ -785,6 +785,7 @@ ah_input_cb(struct cryptop *crp) sav-tdb_cryptoid = crp-crp_sid; if (crp-crp_etype == EAGAIN) { + KEY_FREESAV(sav); error = crypto_dispatch(crp); return error; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r220198 - head/sys/kern
Author: fabient Date: Thu Mar 31 13:59:47 2011 New Revision: 220198 URL: http://svn.freebsd.org/changeset/base/220198 Log: Clearing the flag when preempting will let the preempted thread run too much time. This can finish in a scheduler deadlock with ping-pong between two threads. One sample of this is: - device lapic (to have a preemption point on critical_exit()) - options DEVICE_POLLING with HZ1499 (to have lapic freq = hardclock freq) - running a cpu intensive task (that does not enter the kernel) - only one CPU on SMP or no SMP. As requested by jhb@ 4BSD have received the same type of fix instead of propagating the flag to the new thread. Reviewed by: jhb, jeff MFC after:1 month Modified: head/sys/kern/sched_4bsd.c head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_4bsd.c == --- head/sys/kern/sched_4bsd.c Thu Mar 31 13:36:31 2011(r220197) +++ head/sys/kern/sched_4bsd.c Thu Mar 31 13:59:47 2011(r220198) @@ -940,13 +940,9 @@ sched_switch(struct thread *td, struct t if ((td-td_flags TDF_NOLOAD) == 0) sched_load_rem(); - if (newtd) { - MPASS(newtd-td_lock == sched_lock); - newtd-td_flags |= (td-td_flags TDF_NEEDRESCHED); - } - td-td_lastcpu = td-td_oncpu; - td-td_flags = ~TDF_NEEDRESCHED; + if (!(flags SW_PREEMPT)) + td-td_flags = ~TDF_NEEDRESCHED; td-td_owepreempt = 0; td-td_oncpu = NOCPU; Modified: head/sys/kern/sched_ule.c == --- head/sys/kern/sched_ule.c Thu Mar 31 13:36:31 2011(r220197) +++ head/sys/kern/sched_ule.c Thu Mar 31 13:59:47 2011(r220198) @@ -1783,7 +1783,8 @@ sched_switch(struct thread *td, struct t ts-ts_rltick = ticks; td-td_lastcpu = td-td_oncpu; td-td_oncpu = NOCPU; - td-td_flags = ~TDF_NEEDRESCHED; + if (!(flags SW_PREEMPT)) + td-td_flags = ~TDF_NEEDRESCHED; td-td_owepreempt = 0; tdq-tdq_switchcnt++; /* ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r220206 - head/sys/netipsec
Author: fabient Date: Thu Mar 31 15:23:32 2011 New Revision: 220206 URL: http://svn.freebsd.org/changeset/base/220206 Log: Optimisation in IPSEC(4): - Remove contention on ISR during the crypto operation by using rwlock(9). - Remove a second lookup of the SA in the callback. Gain on 6 cores CPU with SHA1/AES128 can be up to 30%. Reviewed by: vanhu MFC after:1 month Modified: head/sys/netipsec/ipsec.h head/sys/netipsec/key.c head/sys/netipsec/key.h head/sys/netipsec/xform.h head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c head/sys/netipsec/xform_ipcomp.c Modified: head/sys/netipsec/ipsec.h == --- head/sys/netipsec/ipsec.h Thu Mar 31 15:12:40 2011(r220205) +++ head/sys/netipsec/ipsec.h Thu Mar 31 15:23:32 2011(r220206) @@ -123,7 +123,7 @@ struct ipsecrequest { struct secasvar *sav; /* place holder of SA for use */ struct secpolicy *sp; /* back pointer to SP */ - struct mtx lock;/* to interlock updates */ + struct rwlock lock; /* to interlock updates */ }; /* @@ -132,11 +132,15 @@ struct ipsecrequest { * hard it is to remove this... */ #defineIPSECREQUEST_LOCK_INIT(_isr) \ - mtx_init((_isr)-lock, ipsec request, NULL, MTX_DEF | MTX_RECURSE) -#defineIPSECREQUEST_LOCK(_isr) mtx_lock((_isr)-lock) -#defineIPSECREQUEST_UNLOCK(_isr) mtx_unlock((_isr)-lock) -#defineIPSECREQUEST_LOCK_DESTROY(_isr) mtx_destroy((_isr)-lock) -#defineIPSECREQUEST_LOCK_ASSERT(_isr) mtx_assert((_isr)-lock, MA_OWNED) + rw_init_flags((_isr)-lock, ipsec request, RW_RECURSE) +#defineIPSECREQUEST_LOCK(_isr) rw_rlock((_isr)-lock) +#defineIPSECREQUEST_UNLOCK(_isr) rw_runlock((_isr)-lock) +#defineIPSECREQUEST_WLOCK(_isr)rw_wlock((_isr)-lock) +#defineIPSECREQUEST_WUNLOCK(_isr) rw_wunlock((_isr)-lock) +#defineIPSECREQUEST_UPGRADE(_isr) rw_try_upgrade((_isr)-lock) +#defineIPSECREQUEST_DOWNGRADE(_isr)rw_downgrade((_isr)-lock) +#defineIPSECREQUEST_LOCK_DESTROY(_isr) rw_destroy((_isr)-lock) +#defineIPSECREQUEST_LOCK_ASSERT(_isr) rw_assert((_isr)-lock, RA_LOCKED) /* security policy in PCB */ struct inpcbpolicy { Modified: head/sys/netipsec/key.c == --- head/sys/netipsec/key.c Thu Mar 31 15:12:40 2011(r220205) +++ head/sys/netipsec/key.c Thu Mar 31 15:23:32 2011(r220206) @@ -809,6 +809,7 @@ key_checkrequest(struct ipsecrequest *is { u_int level; int error; + struct secasvar *sav; IPSEC_ASSERT(isr != NULL, (null isr)); IPSEC_ASSERT(saidx != NULL, (null saidx)); @@ -826,45 +827,31 @@ key_checkrequest(struct ipsecrequest *is /* get current level */ level = ipsec_get_reqlevel(isr); -#if 0 - /* -* We do allocate new SA only if the state of SA in the holder is -* SADB_SASTATE_DEAD. The SA for outbound must be the oldest. -*/ - if (isr-sav != NULL) { - if (isr-sav-sah == NULL) - panic(%s: sah is null.\n, __func__); - if (isr-sav == (struct secasvar *)LIST_FIRST( - isr-sav-sah-savtree[SADB_SASTATE_DEAD])) { - KEY_FREESAV(isr-sav); - isr-sav = NULL; - } - } -#else + /* -* we free any SA stashed in the IPsec request because a different +* We check new SA in the IPsec request because a different * SA may be involved each time this request is checked, either * because new SAs are being configured, or this request is * associated with an unconnected datagram socket, or this request * is associated with a system default policy. * -* The operation may have negative impact to performance. We may -* want to check cached SA carefully, rather than picking new SA -* every time. -*/ - if (isr-sav != NULL) { - KEY_FREESAV(isr-sav); - isr-sav = NULL; - } -#endif - - /* -* new SA allocation if no SA found. * key_allocsa_policy should allocate the oldest SA available. * See key_do_allocsa_policy(), and draft-jenkins-ipsec-rekeying-03.txt. */ - if (isr-sav == NULL) - isr-sav = key_allocsa_policy(saidx); + sav = key_allocsa_policy(saidx); + if (sav != isr-sav) { + /* SA need to be updated. */ + if (!IPSECREQUEST_UPGRADE(isr)) { + /* Kick everyone off. */ + IPSECREQUEST_UNLOCK(isr); + IPSECREQUEST_WLOCK(isr); + } + if (isr-sav != NULL) +
Re: svn commit: r218583 - head/sys/dev/e1000
@@ -1937,6 +1937,10 @@ igb_local_timer(void *arg) goto timeout; out: callout_reset(adapter-timer, hz, igb_local_timer, adapter); +#ifndef DEVICE_POLLING + /* Fire off all queue interrupts - deadlock protection */ + E1000_WRITE_REG(adapter-hw, E1000_EICS, adapter-que_mask); +#endif return; It seems this one need a check on the polling runtime interface flag? Fabien ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r212224 - in head: lib/libpmc sys/dev/hwpmc
Author: fabient Date: Sun Sep 5 13:31:14 2010 New Revision: 212224 URL: http://svn.freebsd.org/changeset/base/212224 Log: Fix invalid class removal when IAF is not the last class. Keep IAF class with 0 PMC and change the alias in libpmc to IAP. MFC after:1 week Modified: head/lib/libpmc/libpmc.c head/sys/dev/hwpmc/hwpmc_core.c Modified: head/lib/libpmc/libpmc.c == --- head/lib/libpmc/libpmc.cSun Sep 5 06:16:04 2010(r212223) +++ head/lib/libpmc/libpmc.cSun Sep 5 13:31:14 2010(r212224) @@ -2695,7 +2695,8 @@ pmc_init(void) */ cpu_has_iaf_counters = 0; for (t = 0; t cpu_info.pm_nclass; t++) - if (cpu_info.pm_classes[t].pm_class == PMC_CLASS_IAF) + if (cpu_info.pm_classes[t].pm_class == PMC_CLASS_IAF + cpu_info.pm_classes[t].pm_num 0) cpu_has_iaf_counters = 1; #endif @@ -2708,9 +2709,8 @@ pmc_init(void) #definePMC_MDEP_INIT_INTEL_V2(C) do { \ PMC_MDEP_INIT(C); \ - if (cpu_has_iaf_counters) \ - pmc_class_table[n++] = iaf_class_table_descr; \ - else\ + pmc_class_table[n++] = iaf_class_table_descr; \ + if (!cpu_has_iaf_counters) \ pmc_mdep_event_aliases =\ C##_aliases_without_iaf;\ pmc_class_table[n] = C##_class_table_descr;\ Modified: head/sys/dev/hwpmc/hwpmc_core.c == --- head/sys/dev/hwpmc/hwpmc_core.c Sun Sep 5 06:16:04 2010 (r212223) +++ head/sys/dev/hwpmc/hwpmc_core.c Sun Sep 5 13:31:14 2010 (r212224) @@ -2234,21 +2234,8 @@ pmc_core_initialize(struct pmc_mdep *md, core_iaf_npmc = cpuid[CORE_CPUID_EDX] 0x1F; core_iaf_width = (cpuid[CORE_CPUID_EDX] 5) 0xFF; - if (core_iaf_npmc 0) { - iaf_initialize(md, maxcpu, core_iaf_npmc, - core_iaf_width); - core_pmcmask |= ((1ULL core_iaf_npmc) - 1) - IAF_OFFSET; - } else { - /* -* Adjust the number of classes exported to -* user space. -*/ - md-pmd_nclass--; - KASSERT(md-pmd_nclass == 2, - ([core,%d] unexpected nclass %d, __LINE__, - md-pmd_nclass)); - } + iaf_initialize(md, maxcpu, core_iaf_npmc, core_iaf_width); + core_pmcmask |= ((1ULL core_iaf_npmc) - 1) IAF_OFFSET; } PMCDBG(MDP,INI,1,core-init pmcmask=0x%jx iafri=%d, core_pmcmask, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r210794 - head/usr.sbin/pmcstat
Author: fabient Date: Tue Aug 3 09:23:53 2010 New Revision: 210794 URL: http://svn.freebsd.org/changeset/base/210794 Log: Allow file as a top source, it works with socket now. This will allow top monitoring using socket/ssh tunnelling of system without local symbols. client: pmcstat -R ip:port -T -r symbolspath monitored device: pmcstat -Sinstructions -O ip:port - Move the file read in the event loop - Initialize and clean log in all cases - Preserve global stats value during top refresh - Fix the rtld/line resolver that ignore '-r' prefix - Support socket for '-R' (server mode) - Display the statistics when exiting top mode Modified: head/usr.sbin/pmcstat/pmcstat.c head/usr.sbin/pmcstat/pmcstat_log.c Modified: head/usr.sbin/pmcstat/pmcstat.c == --- head/usr.sbin/pmcstat/pmcstat.c Tue Aug 3 09:21:13 2010 (r210793) +++ head/usr.sbin/pmcstat/pmcstat.c Tue Aug 3 09:23:53 2010 (r210794) @@ -169,8 +169,7 @@ pmcstat_cleanup(void) args.pa_logparser = NULL; } - if (args.pa_flags (FLAG_HAS_PIPE | FLAG_HAS_OUTPUT_LOGFILE)) - pmcstat_shutdown_logging(); + pmcstat_shutdown_logging(); } void @@ -559,7 +558,7 @@ main(int argc, char **argv) int do_print; size_t dummy; int graphdepth; - int pipefd[2]; + int pipefd[2], rfd; int use_cumulative_counts; short cf, cb; uint32_t cpumask; @@ -1001,11 +1000,6 @@ main(int argc, char **argv) (args.pa_flags FLAG_READ_LOGFILE) == 0) errx(EX_USAGE, ERROR: option -M is only used with -g/-R.); - /* -T is incompatible with -R (replay logfile is a TODO) */ - if ((args.pa_flags FLAG_DO_TOP) - (args.pa_flags FLAG_READ_LOGFILE)) - errx(EX_USAGE, ERROR: option -T is incompatible with -R.); - /* * Disallow textual output of sampling PMCs if counting PMCs * have also been asked for, mostly because the combined output @@ -1066,7 +1060,22 @@ main(int argc, char **argv) graphfilename); } - /* if we've been asked to process a log file, do that and exit */ + /* if we've been asked to process a log file, skip init */ + if ((args.pa_flags FLAG_READ_LOGFILE) == 0) { + if (pmc_init() 0) + err(EX_UNAVAILABLE, + ERROR: Initialization of the pmc(3) library failed); + + if ((npmc = pmc_npmc(0)) 0) /* assume all CPUs are identical */ + err(EX_OSERR, ERROR: Cannot determine the number of PMCs + on CPU %d, 0); + } + + /* Allocate a kqueue */ + if ((pmcstat_kq = kqueue()) 0) + err(EX_OSERR, ERROR: Cannot allocate kqueue); + + /* Setup the logfile as the source. */ if (args.pa_flags FLAG_READ_LOGFILE) { /* * Print the log in textual form if we haven't been @@ -1076,28 +1085,17 @@ main(int argc, char **argv) args.pa_flags |= FLAG_DO_PRINT; pmcstat_initialize_logging(); - args.pa_logfd = pmcstat_open_log(args.pa_inputpath, + rfd = pmcstat_open_log(args.pa_inputpath, PMCSTAT_OPEN_FOR_READ); - if ((args.pa_logparser = pmclog_open(args.pa_logfd)) == NULL) + if ((args.pa_logparser = pmclog_open(rfd)) == NULL) err(EX_OSERR, ERROR: Cannot create parser); - pmcstat_process_log(); - pmcstat_shutdown_logging(); - exit(EX_OK); + if (fcntl(rfd, F_SETFL, O_NONBLOCK) 0) + err(EX_OSERR, ERROR: fcntl(2) failed); + EV_SET(kev, rfd, EVFILT_READ, EV_ADD, + 0, 0, NULL); + if (kevent(pmcstat_kq, kev, 1, NULL, 0, NULL) 0) + err(EX_OSERR, ERROR: Cannot register kevent); } - - /* otherwise, we've been asked to collect data */ - if (pmc_init() 0) - err(EX_UNAVAILABLE, - ERROR: Initialization of the pmc(3) library failed); - - if ((npmc = pmc_npmc(0)) 0) /* assume all CPUs are identical */ - err(EX_OSERR, ERROR: Cannot determine the number of PMCs - on CPU %d, 0); - - /* Allocate a kqueue */ - if ((pmcstat_kq = kqueue()) 0) - err(EX_OSERR, ERROR: Cannot allocate kqueue); - /* * Configure the specified log file or setup a default log * consumer via a pipe. @@ -1140,6 +1138,7 @@ main(int argc, char **argv) (args.pa_flags FLAG_HAS_OUTPUT_LOGFILE); /* + if (args.pa_flags FLAG_READ_LOGFILE) { * Allocate PMCs. */ @@ -1272,10 +1271,8 @@ main(int argc, char
svn commit: r210797 - head/usr.sbin/pmcstat
Author: fabient Date: Tue Aug 3 13:46:25 2010 New Revision: 210797 URL: http://svn.freebsd.org/changeset/base/210797 Log: - Do not use the runtime mask when logfile is specified. - Revert the fix on rtld path that is not necessary. MFC after:1 week Modified: head/usr.sbin/pmcstat/pmcstat.c head/usr.sbin/pmcstat/pmcstat.h head/usr.sbin/pmcstat/pmcstat_log.c Modified: head/usr.sbin/pmcstat/pmcstat.c == --- head/usr.sbin/pmcstat/pmcstat.c Tue Aug 3 11:23:44 2010 (r210796) +++ head/usr.sbin/pmcstat/pmcstat.c Tue Aug 3 13:46:25 2010 (r210797) @@ -641,6 +641,7 @@ main(int argc, char **argv) else cpumask = pmcstat_get_cpumask(optarg); + args.pa_flags|= FLAGS_HAS_CPUMASK; args.pa_required |= FLAG_HAS_SYSTEM_PMCS; break; @@ -884,6 +885,13 @@ main(int argc, char **argv) args.pa_argc = (argc -= optind); args.pa_argv = (argv += optind); + /* If we read from logfile and no specified CPU mask use +* the maximum CPU count. +*/ + if ((args.pa_flags FLAG_READ_LOGFILE) + (args.pa_flags FLAGS_HAS_CPUMASK) == 0) + cpumask = 0x; + args.pa_cpumask = cpumask; /* For selecting CPUs using -R. */ if (argc) /* command line present */ Modified: head/usr.sbin/pmcstat/pmcstat.h == --- head/usr.sbin/pmcstat/pmcstat.h Tue Aug 3 11:23:44 2010 (r210796) +++ head/usr.sbin/pmcstat/pmcstat.h Tue Aug 3 13:46:25 2010 (r210797) @@ -51,6 +51,7 @@ #defineFLAG_DO_ANNOTATE0x8000 /* -m */ #defineFLAG_DO_TOP 0x0001 /* -T */ #defineFLAG_DO_ANALYSIS0x0002 /* -g or -G or -m or -T */ +#defineFLAGS_HAS_CPUMASK 0x0004 /* -c */ #defineDEFAULT_SAMPLE_COUNT65536 #defineDEFAULT_WAIT_INTERVAL 5.0 Modified: head/usr.sbin/pmcstat/pmcstat_log.c == --- head/usr.sbin/pmcstat/pmcstat_log.c Tue Aug 3 11:23:44 2010 (r210796) +++ head/usr.sbin/pmcstat/pmcstat_log.c Tue Aug 3 13:46:25 2010 (r210797) @@ -609,7 +609,7 @@ pmcstat_image_get_elf_params(struct pmcs GElf_Phdr ph; GElf_Shdr sh; enum pmcstat_image_type image_type; - char buffer[PATH_MAX], rtldpath[PATH_MAX]; + char buffer[PATH_MAX]; assert(image-pi_type == PMCSTAT_IMAGE_UNKNOWN); @@ -689,10 +689,9 @@ pmcstat_image_get_elf_params(struct pmcs buffer, elf_errmsg(-1)); goto done; } - snprintf(rtldpath, sizeof(rtldpath), %s%s, - args.pa_fsroot, elfbase + ph.p_offset); image-pi_dynlinkerpath = - pmcstat_string_intern(rtldpath); + pmcstat_string_intern(elfbase + + ph.p_offset); break; case PT_LOAD: if (ph.p_offset == 0) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r209611 - head/sys/dev/e1000
great! have you some plan to do it on ixgbe too ? fabien On 30 juin 2010, at 19:26, Jack F Vogel wrote: Author: jfv Date: Wed Jun 30 17:26:47 2010 New Revision: 209611 URL: http://svn.freebsd.org/changeset/base/209611 Log: SR-IOV support added to igb What this provides is support for the 'virtual function' interface that a FreeBSD VM may be assigned from a host like KVM on Linux, or newer versions of Xen with such support. When the guest is set up with the capability, a special limited function 82576 PCI device is present in its virtual PCI space, so with this driver installed in the guest that device will be detected and function nearly like the bare metal, as it were. The interface is only allowed a single queue in this configuration however initial performance tests have looked very good. Enjoy!! Modified: head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_igb.h Modified: head/sys/dev/e1000/if_igb.c == --- head/sys/dev/e1000/if_igb.c Wed Jun 30 17:20:33 2010 (r209610) +++ head/sys/dev/e1000/if_igb.c Wed Jun 30 17:26:47 2010 (r209611) @@ -99,7 +99,7 @@ int igb_display_debug_stats = 0; /* * Driver version: */ -char igb_driver_version[] = version - 1.9.6; +char igb_driver_version[] = version - 2.0.1; /* @@ -128,6 +128,7 @@ static igb_vendor_info_t igb_vendor_info PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_82576_QUAD_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_82576_VF,PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_82580_COPPER,PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_82580_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_82580_SERDES,PCI_ANY_ID, PCI_ANY_ID, 0}, @@ -226,7 +227,11 @@ static void igb_dma_free(struct adapter static intigb_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); static void igb_print_nvm_info(struct adapter *); static intigb_is_valid_ether_addr(u8 *); -static void igb_add_hw_stats(struct adapter *adapter); +static void igb_add_hw_stats(struct adapter *); + +static void igb_vf_init_stats(struct adapter *); +static void igb_update_vf_stats_counters(struct adapter *); + /* Management and WOL Support */ static void igb_init_manageability(struct adapter *); static void igb_release_manageability(struct adapter *); @@ -494,6 +499,17 @@ igb_attach(device_t dev) goto err_pci; } + /* Allocate the appropriate stats memory */ + if (adapter-hw.mac.type == e1000_vfadapt) { + adapter-stats = + (struct e1000_vf_stats *)malloc(sizeof \ + (struct e1000_vf_stats), M_DEVBUF, M_NOWAIT | M_ZERO); + igb_vf_init_stats(adapter); + } else + adapter-stats = + (struct e1000_hw_stats *)malloc(sizeof \ + (struct e1000_hw_stats), M_DEVBUF, M_NOWAIT | M_ZERO); + /* ** Start from a known state, this is ** important in reading the nvm and @@ -1788,30 +1804,39 @@ static void igb_set_promisc(struct adapter *adapter) { struct ifnet*ifp = adapter-ifp; - uint32_treg_rctl; + struct e1000_hw *hw = adapter-hw; + u32 reg; - reg_rctl = E1000_READ_REG(adapter-hw, E1000_RCTL); + if (hw-mac.type == e1000_vfadapt) { + e1000_promisc_set_vf(hw, e1000_promisc_enabled); + return; + } + reg = E1000_READ_REG(hw, E1000_RCTL); if (ifp-if_flags IFF_PROMISC) { - reg_rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); - E1000_WRITE_REG(adapter-hw, E1000_RCTL, reg_rctl); + reg |= (E1000_RCTL_UPE | E1000_RCTL_MPE); + E1000_WRITE_REG(hw, E1000_RCTL, reg); } else if (ifp-if_flags IFF_ALLMULTI) { - reg_rctl |= E1000_RCTL_MPE; - reg_rctl = ~E1000_RCTL_UPE; - E1000_WRITE_REG(adapter-hw, E1000_RCTL, reg_rctl); + reg |= E1000_RCTL_MPE; + reg = ~E1000_RCTL_UPE; + E1000_WRITE_REG(hw, E1000_RCTL, reg); } } static void igb_disable_promisc(struct adapter *adapter) { - uint32_treg_rctl; - - reg_rctl = E1000_READ_REG(adapter-hw, E1000_RCTL); + struct e1000_hw *hw = adapter-hw; + u32 reg; - reg_rctl = (~E1000_RCTL_UPE); - reg_rctl = (~E1000_RCTL_MPE); - E1000_WRITE_REG(adapter-hw, E1000_RCTL, reg_rctl); + if (hw-mac.type == e1000_vfadapt) { + e1000_promisc_set_vf(hw,
svn commit: r209196 - head/sys/sys
Author: fabient Date: Tue Jun 15 09:12:31 2010 New Revision: 209196 URL: http://svn.freebsd.org/changeset/base/209196 Log: Set the comment at the right place for PMC uncore classes. Submitted by: rstone MFC after: 1 month Modified: head/sys/sys/pmc.h Modified: head/sys/sys/pmc.h == --- head/sys/sys/pmc.h Tue Jun 15 08:58:16 2010(r209195) +++ head/sys/sys/pmc.h Tue Jun 15 09:12:31 2010(r209196) @@ -110,10 +110,10 @@ enum pmc_cputype { __PMC_CLASS(P6) /* Intel Pentium Pro counters */\ __PMC_CLASS(P4) /* Intel Pentium-IV counters */ \ __PMC_CLASS(IAF)/* Intel Core2/Atom, fixed function */ \ - __PMC_CLASS(IAP)/* Intel Core...Atom, programmable */ \ - __PMC_CLASS(UCF)/* Intel Uncore programmable */ \ - __PMC_CLASS(UCP)/* Intel Uncore fixed function */ \ - __PMC_CLASS(XSCALE) /* Intel XScale counters */ \ + __PMC_CLASS(IAP)/* Intel Core...Atom, programmable */ \ + __PMC_CLASS(UCF)/* Intel Uncore fixed function */ \ + __PMC_CLASS(UCP)/* Intel Uncore programmable */ \ + __PMC_CLASS(XSCALE) /* Intel XScale counters */ \ __PMC_CLASS(MIPS24K)/* MIPS 24K */ enum pmc_class { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r208858 - head/usr.sbin/pmcstat
Author: fabient Date: Sat Jun 5 22:57:53 2010 New Revision: 208858 URL: http://svn.freebsd.org/changeset/base/208858 Log: Fix warnings found by Coverity. Found with: Coverity Prevent(tm) MFC after:1 month Modified: head/usr.sbin/pmcstat/pmcpl_calltree.c head/usr.sbin/pmcstat/pmcstat.c head/usr.sbin/pmcstat/pmcstat_log.c Modified: head/usr.sbin/pmcstat/pmcpl_calltree.c == --- head/usr.sbin/pmcstat/pmcpl_calltree.c Sat Jun 5 21:39:52 2010 (r208857) +++ head/usr.sbin/pmcstat/pmcpl_calltree.c Sat Jun 5 22:57:53 2010 (r208858) @@ -896,10 +896,12 @@ pmcpl_ct_node_printchild(struct pmcpl_ct /* Call address, line, sample. */ addr = ct-pct_image-pi_vaddr + ct-pct_func; line = 0; - pmcstat_image_addr2line(ct-pct_image, addr, sourcefile, + if (pmcstat_image_addr2line(ct-pct_image, addr, sourcefile, sizeof(sourcefile), line, - funcname, sizeof(funcname)); - fprintf(args.pa_graphfile, %p %u, (void *)addr, line); + funcname, sizeof(funcname))) + fprintf(args.pa_graphfile, %p %u, (void *)addr, line); + else + fprintf(args.pa_graphfile, * *); } else fprintf(args.pa_graphfile, * *); Modified: head/usr.sbin/pmcstat/pmcstat.c == --- head/usr.sbin/pmcstat/pmcstat.c Sat Jun 5 21:39:52 2010 (r208857) +++ head/usr.sbin/pmcstat/pmcstat.c Sat Jun 5 22:57:53 2010 (r208858) @@ -292,7 +292,8 @@ pmcstat_find_targets(const char *spec) 0, nproc)) == NULL) err(EX_OSERR, ERROR: Cannot get process list: %s, kvm_geterr(pmcstat_kvm)); - } + } else + nproc = 0; if ((rv = regcomp(reg, spec, REG_EXTENDED|REG_NOSUB)) != 0) { regerror(rv, reg, errbuf, sizeof(errbuf)); Modified: head/usr.sbin/pmcstat/pmcstat_log.c == --- head/usr.sbin/pmcstat/pmcstat_log.c Sat Jun 5 21:39:52 2010 (r208857) +++ head/usr.sbin/pmcstat/pmcstat_log.c Sat Jun 5 22:57:53 2010 (r208858) @@ -1957,6 +1957,7 @@ pmcstat_keypress_log(void) case 'q': wprintw(w, exiting...); ret = 1; + break; default: if (plugins[args.pa_plugin].pl_topkeypress != NULL) if (plugins[args.pa_plugin].pl_topkeypress(c, w)) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r208860 - head/lib/libpmc
Author: fabient Date: Sat Jun 5 23:00:02 2010 New Revision: 208860 URL: http://svn.freebsd.org/changeset/base/208860 Log: Fix memory leak on error. Found with: Coverity Prevent(tm) MFC after:1 month Modified: head/lib/libpmc/pmclog.c Modified: head/lib/libpmc/pmclog.c == --- head/lib/libpmc/pmclog.cSat Jun 5 22:59:37 2010(r208859) +++ head/lib/libpmc/pmclog.cSat Jun 5 23:00:02 2010(r208860) @@ -549,8 +549,10 @@ pmclog_open(int fd) /* allocate space for a work area */ if (ps-ps_fd != PMCLOG_FD_NONE) { - if ((ps-ps_buffer = malloc(PMCLOG_BUFFER_SIZE)) == NULL) + if ((ps-ps_buffer = malloc(PMCLOG_BUFFER_SIZE)) == NULL) { + free(ps); return NULL; + } } return ps; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r208861 - in head/sys: dev/hwpmc sys
Author: fabient Date: Sat Jun 5 23:05:08 2010 New Revision: 208861 URL: http://svn.freebsd.org/changeset/base/208861 Log: Convert pm_runcount to int to correctly check for negative value. Remove uncessary check for error. Found with: Coverity Prevent(tm) MFC after:1 month Modified: head/sys/dev/hwpmc/hwpmc_mod.c head/sys/sys/pmc.h Modified: head/sys/dev/hwpmc/hwpmc_mod.c == --- head/sys/dev/hwpmc/hwpmc_mod.c Sat Jun 5 23:00:02 2010 (r208860) +++ head/sys/dev/hwpmc/hwpmc_mod.c Sat Jun 5 23:05:08 2010 (r208861) @@ -1248,7 +1248,7 @@ pmc_process_csw_in(struct thread *td) continue; /* increment PMC runcount */ - atomic_add_rel_32(pm-pm_runcount, 1); + atomic_add_rel_int(pm-pm_runcount, 1); /* configure the HWPMC we are going to use. */ pcd = pmc_ri_to_classdep(md, ri, adjri); @@ -1387,7 +1387,7 @@ pmc_process_csw_out(struct thread *td) pcd-pcd_stop_pmc(cpu, adjri); /* reduce this PMC's runcount */ - atomic_subtract_rel_32(pm-pm_runcount, 1); + atomic_subtract_rel_int(pm-pm_runcount, 1); /* * If this PMC is associated with this process, @@ -3252,9 +3252,6 @@ pmc_syscall_handler(struct thread *td, v } } - if (error) - break; - /* * Look for valid values for 'pm_flags' */ @@ -4045,7 +4042,7 @@ pmc_process_interrupt(int cpu, struct pm ([pmc,%d] pm=%p runcount %d, __LINE__, (void *) pm, pm-pm_runcount)); - atomic_add_rel_32(pm-pm_runcount, 1); /* hold onto PMC */ + atomic_add_rel_int(pm-pm_runcount, 1);/* hold onto PMC */ ps-ps_pmc = pm; if ((td = curthread) td-td_proc) ps-ps_pid = td-td_proc-p_pid; @@ -4246,7 +4243,7 @@ pmc_process_samples(int cpu) entrydone: ps-ps_nsamples = 0;/* mark entry as free */ - atomic_subtract_rel_32(pm-pm_runcount, 1); + atomic_subtract_rel_int(pm-pm_runcount, 1); /* increment read pointer, modulo sample size */ if (++ps == psb-ps_fence) @@ -4418,7 +4415,7 @@ pmc_process_exit(void *arg __unused, str mtx_pool_unlock_spin(pmc_mtxpool, pm); } - atomic_subtract_rel_32(pm-pm_runcount,1); + atomic_subtract_rel_int(pm-pm_runcount,1); KASSERT((int) pm-pm_runcount = 0, ([pmc,%d] runcount is %d, __LINE__, ri)); Modified: head/sys/sys/pmc.h == --- head/sys/sys/pmc.h Sat Jun 5 23:00:02 2010(r208860) +++ head/sys/sys/pmc.h Sat Jun 5 23:05:08 2010(r208861) @@ -680,7 +680,7 @@ struct pmc { enum pmc_event pm_event; /* event being measured */ uint32_tpm_flags; /* additional flags PMC_F_... */ struct pmc_owner *pm_owner; /* owner thread state */ - uint32_tpm_runcount;/* #cpus currently on */ + int pm_runcount;/* #cpus currently on */ enum pmc_state pm_state; /* current PMC state */ /* ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r207761 - in head/sys: dev/bce dev/mxge sys
Author: fabient Date: Fri May 7 22:09:17 2010 New Revision: 207761 URL: http://svn.freebsd.org/changeset/base/207761 Log: Add a fastpath to allocate from packet zone when using m_getjcl. This will add support for packet zone for at least igb and ixgbe and will avoid to check for that in bce and mxge. MFC after: 1 week Modified: head/sys/dev/bce/if_bce.c head/sys/dev/mxge/if_mxge.c head/sys/sys/mbuf.h Modified: head/sys/dev/bce/if_bce.c == --- head/sys/dev/bce/if_bce.c Fri May 7 21:48:51 2010(r207760) +++ head/sys/dev/bce/if_bce.c Fri May 7 22:09:17 2010(r207761) @@ -5059,11 +5059,8 @@ bce_get_rx_buf(struct bce_softc *sc, str #ifdef BCE_JUMBO_HDRSPLIT MGETHDR(m_new, M_DONTWAIT, MT_DATA); #else - if (sc-rx_bd_mbuf_alloc_size = MCLBYTES) - m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - else - m_new = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, - sc-rx_bd_mbuf_alloc_size); + m_new = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, + sc-rx_bd_mbuf_alloc_size); #endif if (m_new == NULL) { Modified: head/sys/dev/mxge/if_mxge.c == --- head/sys/dev/mxge/if_mxge.c Fri May 7 21:48:51 2010(r207760) +++ head/sys/dev/mxge/if_mxge.c Fri May 7 22:09:17 2010(r207761) @@ -2400,10 +2400,7 @@ mxge_get_buf_big(struct mxge_slice_state mxge_rx_ring_t *rx = ss-rx_big; int cnt, err, i; - if (rx-cl_size == MCLBYTES) - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - else - m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, rx-cl_size); + m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, rx-cl_size); if (m == NULL) { rx-alloc_fail++; err = ENOBUFS; Modified: head/sys/sys/mbuf.h == --- head/sys/sys/mbuf.h Fri May 7 21:48:51 2010(r207760) +++ head/sys/sys/mbuf.h Fri May 7 22:09:17 2010(r207761) @@ -523,6 +523,9 @@ m_getjcl(int how, short type, int flags, struct mbuf *m, *n; uma_zone_t zone; + if (size == MCLBYTES) + return m_getcl(how, type, flags); + args.flags = flags; args.type = type; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r206994 - head/usr.sbin/pmcstat
Author: fabient Date: Wed Apr 21 11:50:13 2010 New Revision: 206994 URL: http://svn.freebsd.org/changeset/base/206994 Log: Apply threshold filter to root node in calltree view. MFC after: 3days Modified: head/usr.sbin/pmcstat/pmcpl_calltree.c Modified: head/usr.sbin/pmcstat/pmcpl_calltree.c == --- head/usr.sbin/pmcstat/pmcpl_calltree.c Wed Apr 21 11:28:13 2010 (r206993) +++ head/usr.sbin/pmcstat/pmcpl_calltree.c Wed Apr 21 11:50:13 2010 (r206994) @@ -499,9 +499,10 @@ void pmcpl_ct_topdisplay(void) { int i, x, y, pmcin; - struct pmcpl_ct_sample rsamples; + struct pmcpl_ct_sample r, *rsamples; - pmcpl_ct_samples_root(rsamples); + rsamples = r; + pmcpl_ct_samples_root(rsamples); PMCSTAT_PRINTW(%-10.10s %s\n, IMAGE, CALLTREE); @@ -524,16 +525,20 @@ pmcpl_ct_topdisplay(void) if (PMCPL_CT_SAMPLE(pmcin, pmcpl_ct_root-pct_arc[i].pcta_samples) == 0) continue; + if (PMCPL_CT_SAMPLEP(pmcin, + pmcpl_ct_root-pct_arc[i].pcta_samples) = + pmcstat_threshold) + continue; if (pmcpl_ct_node_dumptop(pmcin, pmcpl_ct_root-pct_arc[i].pcta_child, - rsamples, x, y, pmcstat_displayheight - 2)) { + rsamples, x, y, pmcstat_displayheight - 2)) { break; } } - pmcpl_ct_node_printtop(rsamples, pmcin, y); + pmcpl_ct_node_printtop(rsamples, pmcin, y); } - pmcpl_ct_samples_free(rsamples); + pmcpl_ct_samples_free(rsamples); } /* ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r206684 - head/sys/dev/hwpmc
Author: fabient Date: Thu Apr 15 19:45:03 2010 New Revision: 206684 URL: http://svn.freebsd.org/changeset/base/206684 Log: - Fix a typo OFFCORE_REQUESTS.ANY.RFO is B0H10H and not 80H10H. - Enable missing PARTIAL_ADDRESS_ALIAS for Core i7. MFC after: 3 days Modified: head/sys/dev/hwpmc/hwpmc_core.c head/sys/dev/hwpmc/pmc_events.h Modified: head/sys/dev/hwpmc/hwpmc_core.c == --- head/sys/dev/hwpmc/hwpmc_core.c Thu Apr 15 19:31:21 2010 (r206683) +++ head/sys/dev/hwpmc/hwpmc_core.c Thu Apr 15 19:45:03 2010 (r206684) @@ -603,7 +603,7 @@ static struct iap_event_descr iap_events IAPDESCR(06H_0FH, 0x06, 0x0F, IAP_F_FM | IAP_F_I7O), IAPDESCR(07H_00H, 0x07, 0x00, IAP_F_FM | IAP_F_CC | IAP_F_CC2), -IAPDESCR(07H_01H, 0x07, 0x01, IAP_F_FM | IAP_F_ALLCPUSCORE2 | IAP_F_WM), +IAPDESCR(07H_01H, 0x07, 0x01, IAP_F_FM | IAP_F_ALLCPUSCORE2 | IAP_F_I7 | IAP_F_WM), IAPDESCR(07H_02H, 0x07, 0x02, IAP_F_FM | IAP_F_ALLCPUSCORE2), IAPDESCR(07H_03H, 0x07, 0x03, IAP_F_FM | IAP_F_ALLCPUSCORE2), IAPDESCR(07H_06H, 0x07, 0x06, IAP_F_FM | IAP_F_CA), @@ -1053,6 +1053,7 @@ static struct iap_event_descr iap_events IAPDESCR(B0H_02H, 0xB0, 0x02, IAP_F_FM | IAP_F_WM | IAP_F_I7O), IAPDESCR(B0H_04H, 0xB0, 0x04, IAP_F_FM | IAP_F_WM | IAP_F_I7O), IAPDESCR(B0H_08H, 0xB0, 0x08, IAP_F_FM | IAP_F_WM | IAP_F_I7O), +IAPDESCR(B0H_10H, 0xB0, 0x10, IAP_F_FM | IAP_F_WM | IAP_F_I7O), IAPDESCR(B0H_20H, 0xB0, 0x20, IAP_F_FM | IAP_F_I7O), IAPDESCR(B0H_40H, 0xB0, 0x40, IAP_F_FM | IAP_F_I7 | IAP_F_WM), IAPDESCR(B0H_80H, 0xB0, 0x80, IAP_F_FM | IAP_F_CA | IAP_F_WM | IAP_F_I7O), Modified: head/sys/dev/hwpmc/pmc_events.h == --- head/sys/dev/hwpmc/pmc_events.h Thu Apr 15 19:31:21 2010 (r206683) +++ head/sys/dev/hwpmc/pmc_events.h Thu Apr 15 19:45:03 2010 (r206684) @@ -2207,7 +2207,7 @@ __PMC_EV_ALIAS(OFFCORE_REQUESTS.DEMAND. __PMC_EV_ALIAS(OFFCORE_REQUESTS.DEMAND.READ_CODE, IAP_EVENT_B0H_02H) \ __PMC_EV_ALIAS(OFFCORE_REQUESTS.DEMAND.RFO, IAP_EVENT_B0H_04H) \ __PMC_EV_ALIAS(OFFCORE_REQUESTS.ANY.READ, IAP_EVENT_B0H_08H) \ -__PMC_EV_ALIAS(OFFCORE_REQUESTS.ANY.RFO, IAP_EVENT_80H_10H) \ +__PMC_EV_ALIAS(OFFCORE_REQUESTS.ANY.RFO, IAP_EVENT_B0H_10H) \ __PMC_EV_ALIAS(OFFCORE_REQUESTS.L1D_WRITEBACK, IAP_EVENT_B0H_40H)\ __PMC_EV_ALIAS(OFFCORE_REQUESTS.ANY, IAP_EVENT_B0H_80H) \ __PMC_EV_ALIAS(UOPS_EXECUTED.PORT0, IAP_EVENT_B1H_01H) \ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r206635 - head/usr.sbin/pmcstat
Author: fabient Date: Wed Apr 14 21:53:27 2010 New Revision: 206635 URL: http://svn.freebsd.org/changeset/base/206635 Log: Move fatal error at the right place. Fix exit from top mode when checking if PMC is available. MFC after: 3 days Modified: head/usr.sbin/pmcstat/pmcpl_callgraph.c head/usr.sbin/pmcstat/pmcpl_gprof.c head/usr.sbin/pmcstat/pmcstat_log.c Modified: head/usr.sbin/pmcstat/pmcpl_callgraph.c == --- head/usr.sbin/pmcstat/pmcpl_callgraph.c Wed Apr 14 21:46:22 2010 (r206634) +++ head/usr.sbin/pmcstat/pmcpl_callgraph.c Wed Apr 14 21:53:27 2010 (r206635) @@ -581,6 +581,8 @@ pmcpl_cg_topdisplay(void) struct pmcstat_pmcrecord *pmcr; pmcr = pmcstat_pmcindex_to_pmcr(pmcstat_pmcinfilter); + if (!pmcr) + err(EX_SOFTWARE, ERROR: invalid pmcindex); /* * We pull out all callgraph nodes in the top-level hash table Modified: head/usr.sbin/pmcstat/pmcpl_gprof.c == --- head/usr.sbin/pmcstat/pmcpl_gprof.c Wed Apr 14 21:46:22 2010 (r206634) +++ head/usr.sbin/pmcstat/pmcpl_gprof.c Wed Apr 14 21:53:27 2010 (r206635) @@ -171,6 +171,8 @@ pmcstat_gmon_create_name(const char *sam char fullpath[PATH_MAX]; pmcname = pmcstat_pmcid_to_name(pmcid); + if (!pmcname) + err(EX_SOFTWARE, ERROR: cannot find pmcid); (void) snprintf(fullpath, sizeof(fullpath), %s/%s/%s, samplesdir, pmcname, Modified: head/usr.sbin/pmcstat/pmcstat_log.c == --- head/usr.sbin/pmcstat/pmcstat_log.c Wed Apr 14 21:46:22 2010 (r206634) +++ head/usr.sbin/pmcstat/pmcstat_log.c Wed Apr 14 21:53:27 2010 (r206635) @@ -1050,7 +1050,6 @@ pmcstat_pmcid_to_name(pmc_id_t pmcid) if (pr-pr_pmcid == pmcid) return (pmcstat_string_unintern(pr-pr_pmcname)); - err(EX_SOFTWARE, ERROR: cannot find pmcid); return NULL; } @@ -1083,7 +1082,6 @@ pmcstat_pmcindex_to_pmcr(int pmcin) if (pr-pr_pmcin == pmcin) return pr; - err(EX_SOFTWARE, ERROR: invalid pmcindex); return NULL; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r206089 - in head: lib/libpmc sys/amd64/include sys/conf sys/dev/hwpmc sys/i386/include sys/modules/hwpmc sys/sys
); + count = strtol(q, e, 0); + if (e == q || *e != '\0') + return (-1); + pmc_config-pm_caps |= PMC_CAP_THRESHOLD; + pmc_config-pm_md.pm_ucp.pm_ucp_config |= + UCP_CMASK(count); + } else if (KWMATCH(p, UCP_KW_EDGE)) { + pmc_config-pm_caps |= PMC_CAP_EDGE; + } else if (KWMATCH(p, UCP_KW_INV)) { + pmc_config-pm_caps |= PMC_CAP_INVERT; + } else + return (-1); + + if (n 0) /* Parsing failed. */ + return (-1); + } return (0); } @@ -2392,6 +2507,31 @@ pmc_event_names_of_class(enum pmc_class ev = corei7_event_table; count = PMC_EVENT_TABLE_SIZE(corei7); break; + case PMC_CPU_INTEL_WESTMERE: + ev = westmere_event_table; + count = PMC_EVENT_TABLE_SIZE(westmere); + break; + } + break; + case PMC_CLASS_UCF: + ev = ucf_event_table; + count = PMC_EVENT_TABLE_SIZE(ucf); + break; + case PMC_CLASS_UCP: + /* +* Return the most appropriate set of event name +* spellings for the current CPU. +*/ + switch (cpu_info.pm_cputype) { + default: + case PMC_CPU_INTEL_COREI7: + ev = corei7uc_event_table; + count = PMC_EVENT_TABLE_SIZE(corei7uc); + break; + case PMC_CPU_INTEL_WESTMERE: + ev = westmereuc_event_table; + count = PMC_EVENT_TABLE_SIZE(westmereuc); + break; } break; case PMC_CLASS_TSC: @@ -2605,8 +2745,15 @@ pmc_init(void) PMC_MDEP_INIT_INTEL_V2(core2); break; case PMC_CPU_INTEL_COREI7: + pmc_class_table[n++] = ucf_class_table_descr; + pmc_class_table[n++] = corei7uc_class_table_descr; PMC_MDEP_INIT_INTEL_V2(corei7); break; + case PMC_CPU_INTEL_WESTMERE: + pmc_class_table[n++] = ucf_class_table_descr; + pmc_class_table[n++] = westmereuc_class_table_descr; + PMC_MDEP_INIT_INTEL_V2(westmere); + break; case PMC_CPU_INTEL_PIV: PMC_MDEP_INIT(p4); pmc_class_table[n] = p4_class_table_descr; @@ -2719,10 +2866,30 @@ _pmc_name_of_event(enum pmc_event pe, en ev = corei7_event_table; evfence = corei7_event_table + PMC_EVENT_TABLE_SIZE(corei7); break; + case PMC_CPU_INTEL_WESTMERE: + ev = westmere_event_table; + evfence = westmere_event_table + PMC_EVENT_TABLE_SIZE(westmere); + break; + default:/* Unknown CPU type. */ + break; + } + } else if (pe = PMC_EV_UCF_FIRST pe = PMC_EV_UCF_LAST) { + ev = ucf_event_table; + evfence = ucf_event_table + PMC_EVENT_TABLE_SIZE(ucf); + } else if (pe = PMC_EV_UCP_FIRST pe = PMC_EV_UCP_LAST) { + switch (cpu) { + case PMC_CPU_INTEL_COREI7: + ev = corei7uc_event_table; + evfence = corei7uc_event_table + PMC_EVENT_TABLE_SIZE(corei7uc); + break; + case PMC_CPU_INTEL_WESTMERE: + ev = westmereuc_event_table; + evfence = westmereuc_event_table + PMC_EVENT_TABLE_SIZE(westmereuc); + break; default:/* Unknown CPU type. */ break; } - } if (pe = PMC_EV_K7_FIRST pe = PMC_EV_K7_LAST) { + } else if (pe = PMC_EV_K7_FIRST pe = PMC_EV_K7_LAST) { ev = k7_event_table; evfence = k7_event_table + PMC_EVENT_TABLE_SIZE(k7); } else if (pe = PMC_EV_K8_FIRST pe = PMC_EV_K8_LAST) { Added: head/lib/libpmc/pmc.corei7.3 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libpmc/pmc.corei7.3Fri Apr 2 13:23:49 2010 (r206089) @@ -0,0 +1,1581 @@ +.\ Copyright (c) 2010 Fabien Thomas. All rights reserved. +.\ +.\ Redistribution and use in source and binary forms, with or without +.\ modification, are permitted provided that the following conditions +.\ are met: +.\ 1. Redistributions of source code must retain the above copyright +.\notice, this list of conditions and the following
svn commit: r205998 - head/sys/dev/hwpmc
Author: fabient Date: Wed Mar 31 20:00:44 2010 New Revision: 205998 URL: http://svn.freebsd.org/changeset/base/205998 Log: If there is multiple PMCs for the same interrupt ignore new post. This will indirectly fix a bug where the thread will be pinned forever if the assert is not compiled. MFC after: 3days Modified: head/sys/dev/hwpmc/hwpmc_mod.c Modified: head/sys/dev/hwpmc/hwpmc_mod.c == --- head/sys/dev/hwpmc/hwpmc_mod.c Wed Mar 31 18:37:00 2010 (r205997) +++ head/sys/dev/hwpmc/hwpmc_mod.c Wed Mar 31 20:00:44 2010 (r205998) @@ -3972,9 +3972,11 @@ pmc_post_callchain_callback(void) td = curthread; - KASSERT((td-td_pflags TDP_CALLCHAIN) == 0, - ([pmc,%d] thread %p already marked for callchain capture, - __LINE__, (void *) td)); + /* +* If there is multiple PMCs for the same interrupt ignore new post +*/ + if (td-td_pflags TDP_CALLCHAIN) + return; /* * Mark this thread as needing callchain capture. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r205809 - head/usr.sbin/pmcstat
Author: fabient Date: Sun Mar 28 22:46:56 2010 New Revision: 205809 URL: http://svn.freebsd.org/changeset/base/205809 Log: Wait for pmc name in the log before displaying data. This will solve an abort in case of low throughput PMCs. MFC after: 3days Modified: head/usr.sbin/pmcstat/pmcstat_log.c Modified: head/usr.sbin/pmcstat/pmcstat_log.c == --- head/usr.sbin/pmcstat/pmcstat_log.c Sun Mar 28 22:30:14 2010 (r205808) +++ head/usr.sbin/pmcstat/pmcstat_log.c Sun Mar 28 22:46:56 2010 (r205809) @@ -1049,7 +1049,6 @@ pmcstat_pmcindex_to_name(int pmcin) if (pr-pr_pmcin == pmcin) return pmcstat_string_unintern(pr-pr_pmcname); - err(EX_SOFTWARE, ERROR: cannot find pmcid name); return NULL; } @@ -1789,19 +1788,23 @@ static void pmcstat_refresh_top(void) { char pmcname[40]; + const char *s; /* If in pause mode do not refresh display. */ if (pmcstat_pause) return; + /* Wait until PMC pop in the log. */ + s = pmcstat_pmcindex_to_name(pmcstat_pmcinfilter); + if (s == NULL) + return; + /* Format PMC name. */ if (pmcstat_mergepmc) - snprintf(pmcname, sizeof(pmcname), [%s], - pmcstat_pmcindex_to_name(pmcstat_pmcinfilter)); + snprintf(pmcname, sizeof(pmcname), [%s], s); else snprintf(pmcname, sizeof(pmcname), %s.%d, - pmcstat_pmcindex_to_name(pmcstat_pmcinfilter), - pmcstat_pmcinfilter); + s, pmcstat_pmcinfilter); PMCSTAT_PRINTBEGIN(); PMCSTAT_PRINTW(PMC: %s Samples: %u processed, %u invalid\n\n, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r205693 - head/usr.sbin/pmcstat
Author: fabient Date: Fri Mar 26 14:29:57 2010 New Revision: 205693 URL: http://svn.freebsd.org/changeset/base/205693 Log: Do not overflow the term in the case of multi-line display. MFC after: 3days Modified: head/usr.sbin/pmcstat/pmcpl_calltree.c Modified: head/usr.sbin/pmcstat/pmcpl_calltree.c == --- head/usr.sbin/pmcstat/pmcpl_calltree.c Fri Mar 26 14:08:21 2010 (r205692) +++ head/usr.sbin/pmcstat/pmcpl_calltree.c Fri Mar 26 14:29:57 2010 (r205693) @@ -366,7 +366,7 @@ pmcpl_ct_node_cleartag(void) static int pmcpl_ct_node_dumptop(int pmcin, struct pmcpl_ct_node *ct, -struct pmcpl_ct_sample *rsamples, int x, int *y) +struct pmcpl_ct_sample *rsamples, int x, int *y, int maxy) { int i; @@ -387,7 +387,7 @@ pmcpl_ct_node_dumptop(int pmcin, struct if (ct-pct_narc == 0) { pmcpl_ct_topscreen[x+1][*y] = NULL; if (*y = PMCPL_CT_MAXLINE || - *y = pmcstat_displayheight) + *y = maxy) return 1; *y = *y + 1; for (i=0; i x; i++) @@ -407,7 +407,7 @@ pmcpl_ct_node_dumptop(int pmcin, struct ct-pct_arc[i].pcta_samples) pmcstat_threshold) { if (pmcpl_ct_node_dumptop(pmcin, ct-pct_arc[i].pcta_child, - rsamples, x+1, y)) + rsamples, x+1, y, maxy)) return 1; } } @@ -472,6 +472,9 @@ pmcpl_ct_node_printtop(struct pmcpl_ct_s /* Check for line wrap. */ width += ns_len + is_len + vs_len + 1; if (width = pmcstat_displaywidth) { + maxy--; + if (y = maxy) + break; PMCSTAT_PRINTW(\n%*s, indentwidth, space); width = indentwidth + ns_len + is_len + vs_len; } @@ -515,7 +518,7 @@ pmcpl_ct_topdisplay(void) for (i = 0; i pmcpl_ct_root-pct_narc; i++) { if (pmcpl_ct_node_dumptop(pmcin, pmcpl_ct_root-pct_arc[i].pcta_child, - rsamples, x, y)) { + rsamples, x, y, pmcstat_displayheight - 2)) { break; } } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r204783 - head/usr.sbin/pmcstat
Author: fabient Date: Fri Mar 5 23:08:19 2010 New Revision: 204783 URL: http://svn.freebsd.org/changeset/base/204783 Log: Bug fixed: - no display on serial terminal in top mode. - display alignment for continuation string. - correct invalid value used for display limit. MFC after:3 days Modified: head/usr.sbin/pmcstat/pmcpl_callgraph.c head/usr.sbin/pmcstat/pmcpl_calltree.c head/usr.sbin/pmcstat/pmcstat.c Modified: head/usr.sbin/pmcstat/pmcpl_callgraph.c == --- head/usr.sbin/pmcstat/pmcpl_callgraph.c Fri Mar 5 23:03:20 2010 (r204782) +++ head/usr.sbin/pmcstat/pmcpl_callgraph.c Fri Mar 5 23:08:19 2010 (r204783) @@ -550,7 +550,7 @@ pmcstat_cgnode_topprint(struct pmcstat_c len = ns_len + vs_len + 1; if (width - len 0) { - PMCSTAT_PRINTW(...); + PMCSTAT_PRINTW( ...); break; } width -= len; Modified: head/usr.sbin/pmcstat/pmcpl_calltree.c == --- head/usr.sbin/pmcstat/pmcpl_calltree.c Fri Mar 5 23:03:20 2010 (r204782) +++ head/usr.sbin/pmcstat/pmcpl_calltree.c Fri Mar 5 23:08:19 2010 (r204783) @@ -387,7 +387,7 @@ pmcpl_ct_node_dumptop(int pmcin, struct if (ct-pct_narc == 0) { pmcpl_ct_topscreen[x+1][*y] = NULL; if (*y = PMCPL_CT_MAXLINE || - *y = pmcstat_displaywidth) + *y = pmcstat_displayheight) return 1; *y = *y + 1; for (i=0; i x; i++) Modified: head/usr.sbin/pmcstat/pmcstat.c == --- head/usr.sbin/pmcstat/pmcstat.c Fri Mar 5 23:03:20 2010 (r204782) +++ head/usr.sbin/pmcstat/pmcstat.c Fri Mar 5 23:08:19 2010 (r204783) @@ -1311,6 +1311,9 @@ main(int argc, char **argv) intrflush(stdscr, FALSE); keypad(stdscr, TRUE); clear(); + /* Get terminal width / height with ncurses. */ + getmaxyx(stdscr, pmcstat_displayheight, pmcstat_displaywidth); + pmcstat_displayheight--; pmcstat_displaywidth--; atexit(pmcstat_topexit); } } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org