svn commit: r333570 - head/sys/cddl/dev/dtrace/aarch64
Author: markj Date: Sat May 12 15:35:26 2018 New Revision: 333570 URL: https://svnweb.freebsd.org/changeset/base/333570 Log: DTrace aarch64: Avoid calling unwind_frame() in the probe context. unwind_frame() may be instrumented by FBT, leading to recursion into dtrace_probe(). Manually inline unwind_frame() as we do with stack unwinding code for other architectures. Submitted by: Domagoj Stolfa Reviewed by: manu MFC after:1 week Sponsored by: DARPA / AFRL Differential Revision:https://reviews.freebsd.org/D15359 Modified: head/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c Modified: head/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c == --- head/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c Sat May 12 15:34:35 2018(r333569) +++ head/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c Sat May 12 15:35:26 2018(r333570) @@ -70,7 +70,7 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, in { struct unwind_state state; int scp_offset; - register_t sp; + register_t sp, fp; int depth; depth = 0; @@ -88,11 +88,15 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, in state.pc = (uint64_t)dtrace_getpcstack; while (depth < pcstack_limit) { - if (unwind_frame(&state)) - break; - if (!INKERNEL(state.pc) || !INKERNEL(state.fp)) break; + + fp = state.fp; + state.sp = fp + 0x10; + /* FP to previous frame (X29) */ + state.fp = *(register_t *)(fp); + /* LR (X30) */ + state.pc = *(register_t *)(fp + 8) - 4; /* * NB: Unlike some other architectures, we don't need to ___ 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: r333581 - head/sys/vm
Author: markj Date: Sun May 13 13:00:59 2018 New Revision: 333581 URL: https://svnweb.freebsd.org/changeset/base/333581 Log: Get rid of vm_pageout_page_queued(). vm_page_queue(), added in r333256, generalizes vm_pageout_page_queued(), so use it instead. No functional change intended. Reviewed by: kib Differential Revision:https://reviews.freebsd.org/D15402 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cSun May 13 12:42:53 2018(r333580) +++ head/sys/vm/vm_pageout.cSun May 13 13:00:59 2018(r333581) @@ -252,32 +252,16 @@ vm_pageout_end_scan(struct scan_state *ss) } /* - * Ensure that the page has not been dequeued after a pageout batch was - * collected. See vm_page_dequeue_complete(). - */ -static inline bool -vm_pageout_page_queued(vm_page_t m, int queue) -{ - - vm_page_assert_locked(m); - - if ((m->aflags & PGA_DEQUEUE) != 0) - return (false); - atomic_thread_fence_acq(); - return (m->queue == queue); -} - -/* * Add a small number of queued pages to a batch queue for later processing * without the corresponding queue lock held. The caller must have enqueued a * marker page at the desired start point for the scan. Pages will be * physically dequeued if the caller so requests. Otherwise, the returned * batch may contain marker pages, and it is up to the caller to handle them. * - * When processing the batch queue, vm_pageout_page_queued() must be used to - * determine whether the page was logically dequeued by another thread. Once - * this check is performed, the page lock guarantees that the page will not be - * disassociated from the queue. + * When processing the batch queue, vm_page_queue() must be used to + * determine whether the page has been logically dequeued by another thread. + * Once this check is performed, the page lock guarantees that the page will + * not be disassociated from the queue. */ static __always_inline void vm_pageout_collect_batch(struct scan_state *ss, const bool dequeue) @@ -751,7 +735,7 @@ recheck: * The page may have been disassociated from the queue * while locks were dropped. */ - if (!vm_pageout_page_queued(m, queue)) + if (vm_page_queue(m) != queue) continue; /* @@ -1262,7 +1246,7 @@ recheck: * The page may have been disassociated from the queue * while locks were dropped. */ - if (!vm_pageout_page_queued(m, PQ_INACTIVE)) { + if (vm_page_queue(m) != PQ_INACTIVE) { addl_page_shortage++; continue; } @@ -1542,7 +1526,7 @@ act_scan: * The page may have been disassociated from the queue * while locks were dropped. */ - if (!vm_pageout_page_queued(m, PQ_ACTIVE)) + if (vm_page_queue(m) != PQ_ACTIVE) continue; /* ___ 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: r333345 - head/sys/dev/e1000
On Tue, May 08, 2018 at 01:39:45AM +, Matt Macy wrote: > Author: mmacy > Date: Tue May 8 01:39:45 2018 > New Revision: 45 > URL: https://svnweb.freebsd.org/changeset/base/45 > > Log: > Sleep rather than spin in e1000 when doing long running config operations. > > With r333218 it is now possible for drivers to use an sx lock and thus > sleep while > waiting on long running operations rather than DELAY(). > > Reported by:gallatin > Reviewed by:sbruno > Approved by:sbruno > MFC after: 1 month > Sponsored by: Limelight Networks > Differential Revision: https://reviews.freebsd.org/D14984 This commit causes igb to fail to attach to one of the ports on an I210: igb0@pci0:5:0:0:class=0x02 card=0x153315d9 chip=0x15338086 rev=0x03 hdr=0x00 vendor = 'Intel Corporation' device = 'I210 Gigabit Network Connection' class = network subclass = ethernet igb1@pci0:6:0:0:class=0x02 card=0x153315d9 chip=0x15338086 rev=0x03 hdr=0x00 vendor = 'Intel Corporation' device = 'I210 Gigabit Network Connection' class = network subclass = ethernet In the dmesg I see: igb0: port 0xd000-0xd01f mem 0xf830-0xf837,0xf838-0xf8383fff irq 18 at device 0.0 numa-domain 0 on pci6 igb0: attach_pre capping queues at 4 igb0: Setup of Shared code failed, error -2 igb0: IFDI_ATTACH_PRE failed 6 device_attach: igb0 attach returned 6 pcib7: irq 19 at device 28.3 numa-domain 0 on pci1 pci7: numa-domain 0 on pcib7 igb0: port 0xc000-0xc01f mem 0xf820-0xf827,0xf828-0xf8283fff irq 19 at device 0.0 numa-domain 0 on pci7 igb0: attach_pre capping queues at 4 igb0: using 1024 tx descriptors and 1024 rx descriptors igb0: msix_init qsets capped at 4 igb0: pxm cpus: 8 queue msgs: 4 admincnt: 1 igb0: using 4 rx queues 4 tx queues igb0: Using MSIX interrupts with 5 vectors igb0: allocated for 4 tx_queues igb0: allocated for 4 rx_queues ___ 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: r333702 - head/sys/netinet/netdump
Author: markj Date: Thu May 17 04:08:57 2018 New Revision: 333702 URL: https://svnweb.freebsd.org/changeset/base/333702 Log: Fix netdump configuration when VIMAGE is enabled. We need to set the current vnet before iterating over the global interface list. Because the dump device may only be set from the host, only proceed with configuration if the thread belongs to the default vnet. [1] Also fix a resource leak that occurs if the priv_check() in set_dumper() fails. Reported by: mmacy, sbruno [1] Reviewed by: sbruno X-MFC with: r333283 Differential Revision:https://reviews.freebsd.org/D15449 Modified: head/sys/netinet/netdump/netdump_client.c Modified: head/sys/netinet/netdump/netdump_client.c == --- head/sys/netinet/netdump/netdump_client.c Thu May 17 03:19:31 2018 (r333701) +++ head/sys/netinet/netdump/netdump_client.c Thu May 17 04:08:57 2018 (r333702) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -88,7 +89,7 @@ __FBSDID("$FreeBSD$"); static int netdump_arp_gw(void); static void netdump_cleanup(void); -static int netdump_configure(struct netdump_conf *); +static int netdump_configure(struct netdump_conf *, struct thread *); static int netdump_dumper(void *priv __unused, void *virtual, vm_offset_t physical __unused, off_t offset, size_t length); static int netdump_ether_output(struct mbuf *m, struct ifnet *ifp, @@ -1058,10 +1059,15 @@ static struct cdevsw netdump_cdevsw = { static struct cdev *netdump_cdev; static int -netdump_configure(struct netdump_conf *conf) +netdump_configure(struct netdump_conf *conf, struct thread *td) { struct ifnet *ifp; + CURVNET_SET(TD_TO_VNET(td)); + if (!IS_DEFAULT_VNET(curvnet)) { + CURVNET_RESTORE(); + return (EINVAL); + } IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (strcmp(ifp->if_xname, conf->ndc_iface) == 0) @@ -1069,6 +1075,7 @@ netdump_configure(struct netdump_conf *conf) } /* XXX ref */ IFNET_RUNLOCK_NOSLEEP(); + CURVNET_RESTORE(); if (ifp == NULL) return (ENOENT); @@ -1170,13 +1177,15 @@ netdump_ioctl(struct cdev *dev __unused, u_long cmd, c if (kda->kda_enable == 0) { if (nd_enabled) { error = clear_dumper(td); - if (error == 0) + if (error == 0) { nd_enabled = 0; + netdump_mbuf_drain(); + } } break; } - error = netdump_configure(conf); + error = netdump_configure(conf, td); if (error != 0) break; @@ -1212,8 +1221,10 @@ netdump_ioctl(struct cdev *dev __unused, u_long cmd, c explicit_bzero(encryptedkey, kda->kda_encryptedkeysize); free(encryptedkey, M_TEMP); } - if (error != 0) + if (error != 0) { nd_enabled = 0; + netdump_mbuf_drain(); + } break; default: error = EINVAL; @@ -1268,7 +1279,7 @@ netdump_modevent(module_t mod __unused, int what, void } /* Ignore errors; we print a message to the console. */ - (void)netdump_configure(&conf); + (void)netdump_configure(&conf, curthread); } break; case MOD_UNLOAD: ___ 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: r333703 - head/sys/vm
Author: markj Date: Thu May 17 04:27:08 2018 New Revision: 333703 URL: https://svnweb.freebsd.org/changeset/base/333703 Log: Fix a race in vm_page_pagequeue_lockptr(). The value of m->queue must be cached after comparing it with PQ_NONE, since it may be concurrently changing. Reported by: glebius Reviewed by: jeff Differential Revision:https://reviews.freebsd.org/D15462 Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.c == --- head/sys/vm/vm_page.c Thu May 17 04:08:57 2018(r333702) +++ head/sys/vm/vm_page.c Thu May 17 04:27:08 2018(r333703) @@ -3088,10 +3088,11 @@ vm_page_pagequeue(vm_page_t m) static struct mtx * vm_page_pagequeue_lockptr(vm_page_t m) { + uint8_t queue; - if (m->queue == PQ_NONE) + if ((queue = m->queue) == PQ_NONE) return (NULL); - return (&vm_page_pagequeue(m)->pq_mutex); + return (&vm_pagequeue_domain(m)->vmd_pagequeues[queue].pq_mutex); } static inline void Modified: head/sys/vm/vm_page.h == --- head/sys/vm/vm_page.h Thu May 17 04:08:57 2018(r333702) +++ head/sys/vm/vm_page.h Thu May 17 04:27:08 2018(r333703) @@ -208,7 +208,7 @@ struct vm_page { uint16_t flags; /* page PG_* flags (P) */ uint8_t aflags; /* access is atomic */ uint8_t oflags; /* page VPO_* flags (O) */ - uint8_t queue; /* page queue index (Q) */ + volatile uint8_t queue; /* page queue index (Q) */ int8_t psind; /* pagesizes[] index (O) */ int8_t segind; /* vm_phys segment index (C) */ uint8_t order; /* index of the buddy queue (F) */ ___ 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: r333703 - head/sys/vm
On Thu, May 17, 2018 at 10:07:34AM -0700, Conrad Meyer wrote: > On Wed, May 16, 2018 at 9:27 PM, Mark Johnston wrote: > > Author: markj > > Date: Thu May 17 04:27:08 2018 > > New Revision: 333703 > > URL: https://svnweb.freebsd.org/changeset/base/333703 > > > > Log: > > Fix a race in vm_page_pagequeue_lockptr(). > > > > The value of m->queue must be cached after comparing it with PQ_NONE, > > since it may be concurrently changing. > > > > Reported by: glebius > > What were the symptoms of this issue? The test plan in the linked > phabricator revision says: > > "Gleb reported seeing panics as a result of the use of a bogus index > into the pagequeue array, and also reported that this patch fixed the > panics." > > So an attempt to lock pagequeues[PQ_NONE=255].pq_mutex, which is > either something later in the vm_domain object, or bogus memory? One > of the mtx asserts trips? I think it was "mtx_lock() of spin mutex"; I didn't get a lot of details. I failed to note in the commit message that this race was introduced in r332974. ___ 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: r333754 - head/share/man/man4
Author: markj Date: Thu May 17 19:06:44 2018 New Revision: 333754 URL: https://svnweb.freebsd.org/changeset/base/333754 Log: Remove a reference to NETDUMP_DEBUG, and document sysctls. NETDUMP_DEBUG was removed and replaced with a sysctl which enables debug output without requiring a recompile. Modified: head/share/man/man4/netdump.4 Modified: head/share/man/man4/netdump.4 == --- head/share/man/man4/netdump.4 Thu May 17 18:59:12 2018 (r333753) +++ head/share/man/man4/netdump.4 Thu May 17 19:06:44 2018 (r333754) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 4, 2018 +.Dd May 17, 2018 .Dt NETDUMP 4 .Os .Sh NAME @@ -36,11 +36,6 @@ your kernel configuration file: .Bd -ragged -offset indent .Cd "options NETDUMP" .Ed -.Pp -Debug output can be enabled by adding the following line: -.Bd -ragged -offset indent -.Cd "options NETDUMP_DEBUG" -.Ed .Sh DESCRIPTION netdump is a UDP-based protocol for transmitting kernel dumps to a remote host. A netdump client is a panicking kernel, and a netdump server is a host @@ -112,6 +107,30 @@ The following network drivers support netdump: .Xr mlx4en 4 , .Xr re 4 , .Xr vtnet 4 . +.Sh SYSCTL VARIABLES +The following variables are available as both +.Xr sysctl 8 +variables and +.Xr loader 8 +variables: +.Bl -tag -width "indent" +.It Va net.netdump.debug +Control debug message verbosity. +Debug messages are disabled by default, but are useful when troubleshooting +or when developing driver support. +.It Va net.netdump.path +Specify a path relative to the server's dump directory in which to store +the dump. +For example, if the +.Nm +server is configured to store dumps in +.Pa /var/crash , +a path of +.Dq foo +will cause the server to attempt to store dumps from the client in +.Pa /var/crash/foo . +The server will not automatically create the relative directory. +.El .Sh SEE ALSO .Xr decryptcore 8 , .Xr dumpon 8 , ___ 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: r333799 - head/sys/vm
Author: markj Date: Fri May 18 16:59:58 2018 New Revision: 333799 URL: https://svnweb.freebsd.org/changeset/base/333799 Log: Don't increment addl_page_shortage for wired pages. Such pages are dequeued as they're encountered during the inactive queue scan, so by the time we get to the active queue scan, they should have already been subtracted from the inactive queue length. Reviewed by: alc Differential Revision:https://reviews.freebsd.org/D15479 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cFri May 18 16:19:45 2018(r333798) +++ head/sys/vm/vm_pageout.cFri May 18 16:59:58 2018(r333799) @@ -1201,7 +1201,7 @@ vm_pageout_scan(struct vm_domain *vmd, int pass, int s } /* -* The addl_page_shortage is the number of temporarily +* The addl_page_shortage is an estimate of the number of temporarily * stuck pages in the inactive queue. In other words, the * number of pages from the inactive count that should be * discounted in setting the target for the active queue scan. @@ -1275,7 +1275,6 @@ recheck: goto reinsert; } if (m->wire_count != 0) { - addl_page_shortage++; vm_page_dequeue_deferred(m); continue; } ___ 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: r333872 - head/cddl/contrib/opensolaris/tools/ctf/cvt
On Sat, May 19, 2018 at 11:00:22AM -0700, Matthew Macy wrote: > On Sat, May 19, 2018 at 4:49 AM, Ed Maste wrote: > > On 19 May 2018 at 02:31, Matt Macy wrote: > >> Author: mmacy > >> Date: Sat May 19 06:31:17 2018 > >> New Revision: 333872 > >> URL: https://svnweb.freebsd.org/changeset/base/333872 > >> > >> Log: > >> ctfconvert: silence useless enum has too many values warning > > > > I agree it's reasonable to silence this warning as it is not > > actionable for almost everyone who encounters it. It does indicate a > > real problem in our tool chain though and I added an entry to > > https://wiki.freebsd.org/DTraceTODO. > > Conrad brought up the need to change the CTF ABI on IRC. This will > involve an on-disk format change which he and I believe to be > acceptable, but perhaps interoperability with other operating systems > is still considered important. I don't really think it's important. The main consideration is the toolchain. We use illumos as an upstream, which is pretty inactive at this point. Joyent's illumos fork has put a lot of work into the CTF toolchain, and OpenBSD has made some progress towards an ISC-licensed ctfconvert utility. I'd like to import the latter, since the permissive license means that we can use it in DDB. It requires more work because of some missing functionality, though. At some point I think we'd like to pursue one of these two upstreams, so it becomes a question of whether they're amenable to modifying the CTF binary format (and there are some other limitations that ought to be fixed in the process), and if not, whether it's painful to maintain the local modifications needed to support large enums. ___ 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: r333890 - in head/sys: amd64/conf arm64/conf i386/conf powerpc/conf sparc64/conf
Author: markj Date: Sat May 19 19:53:23 2018 New Revision: 333890 URL: https://svnweb.freebsd.org/changeset/base/333890 Log: Enable kernel dump features in GENERIC for most platforms. This turns on support for kernel dump encryption and compression, and netdump. arm and mips platforms are omitted for now, since they are more constrained and don't benefit as much from these features. Reviewed by: cem, manu, rgrimes Tested by:manu (arm64) Relnotes: yes Differential Revision:https://reviews.freebsd.org/D15465 Modified: head/sys/amd64/conf/GENERIC head/sys/arm64/conf/GENERIC head/sys/i386/conf/GENERIC head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/GENERIC64 head/sys/sparc64/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC == --- head/sys/amd64/conf/GENERIC Sat May 19 19:46:57 2018(r333889) +++ head/sys/amd64/conf/GENERIC Sat May 19 19:53:23 2018(r333890) @@ -99,6 +99,12 @@ options WITNESS # Enable checks to detect deadlocks optionsWITNESS_SKIPSPIN# Don't run witness on spinlocks for speed optionsMALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones +# Kernel dump features. +optionsEKCD# Support for encrypted kernel dumps +optionsGZIO# gzip-compressed kernel and user dumps +optionsZSTDIO # zstd-compressed kernel and user dumps +optionsNETDUMP # netdump(4) client support + # Make an SMP-capable kernel by default optionsSMP # Symmetric MultiProcessor Kernel optionsEARLY_AP_STARTUP Modified: head/sys/arm64/conf/GENERIC == --- head/sys/arm64/conf/GENERIC Sat May 19 19:46:57 2018(r333889) +++ head/sys/arm64/conf/GENERIC Sat May 19 19:53:23 2018(r333890) @@ -93,6 +93,12 @@ options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) optionsALT_BREAK_TO_DEBUGGER # Enter debugger on keyboard escape sequence optionsUSB_DEBUG # enable debug msgs +# Kernel dump features. +optionsEKCD# Support for encrypted kernel dumps +optionsGZIO# gzip-compressed kernel and user dumps +optionsZSTDIO # zstd-compressed kernel and user dumps +optionsNETDUMP # netdump(4) client support + # SoC support optionsSOC_ALLWINNER_A64 optionsSOC_ALLWINNER_H5 Modified: head/sys/i386/conf/GENERIC == --- head/sys/i386/conf/GENERIC Sat May 19 19:46:57 2018(r333889) +++ head/sys/i386/conf/GENERIC Sat May 19 19:53:23 2018(r333890) @@ -95,6 +95,12 @@ options WITNESS # Enable checks to detect deadlocks optionsWITNESS_SKIPSPIN# Don't run witness on spinlocks for speed optionsMALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones +# Kernel dump features. +optionsEKCD# Support for encrypted kernel dumps +optionsGZIO# gzip-compressed kernel and user dumps +optionsZSTDIO # zstd-compressed kernel and user dumps +optionsNETDUMP # netdump(4) client support + # To make an SMP kernel, the next two lines are needed optionsSMP # Symmetric MultiProcessor Kernel device apic# I/O APIC Modified: head/sys/powerpc/conf/GENERIC == --- head/sys/powerpc/conf/GENERIC Sat May 19 19:46:57 2018 (r333889) +++ head/sys/powerpc/conf/GENERIC Sat May 19 19:53:23 2018 (r333890) @@ -98,6 +98,12 @@ options WITNESS #Enable checks to detect deadlocks optionsWITNESS_SKIPSPIN#Don't run witness on spinlocks for speed optionsMALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones +# Kernel dump features. +optionsEKCD# Support for encrypted kernel dumps +optionsGZIO# gzip-compressed kernel and user dumps +optionsZSTDIO # zstd-compressed kernel and user dumps +optionsNETDUMP # netdump(4) client support + # Make an SMP-capable kernel by default optionsSMP # Symmetric MultiProcessor Kernel Modified: head/sys/powerpc/conf/GENERIC64 == --- head/sys/powerpc/conf/GENERIC64 Sat May 19 19:46:57 2018 (r333889) +++ head/sys/powerpc/conf/GENERIC64 Sat May 19 19:53:23 2018 (r333890) @@ -95,6 +95,12 @@ options WITNESS #En
svn commit: r333903 - head/sys/vm
Author: markj Date: Sat May 19 23:49:13 2018 New Revision: 333903 URL: https://svnweb.freebsd.org/changeset/base/333903 Log: Use the canonical check for reservation support. Modified: head/sys/vm/vm_domainset.c Modified: head/sys/vm/vm_domainset.c == --- head/sys/vm/vm_domainset.c Sat May 19 23:19:24 2018(r333902) +++ head/sys/vm/vm_domainset.c Sat May 19 23:49:13 2018(r333903) @@ -81,7 +81,7 @@ vm_domainset_iter_init(struct vm_domainset_iter *di, s } di->di_policy = di->di_domain->ds_policy; if (di->di_policy == DOMAINSET_POLICY_INTERLEAVE) { -#ifdef VM_LEVEL_0_ORDER +#if VM_NRESERVLEVEL > 0 if (vm_object_reserv(obj)) { /* * Color the pindex so we end up on the correct @@ -89,9 +89,8 @@ vm_domainset_iter_init(struct vm_domainset_iter *di, s */ pindex += obj->pg_color; pindex >>= VM_LEVEL_0_ORDER; - } - else -#endif + } else +#endif pindex /= vm_domainset_default_stride; /* * Offset pindex so the first page of each object does ___ 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: r333872 - head/cddl/contrib/opensolaris/tools/ctf/cvt
On Sun, May 20, 2018 at 10:59:20AM +, Alexey Dokuchaev wrote: > On Sat, May 19, 2018 at 03:44:37PM -0400, Mark Johnston wrote: > > ... > > I don't really think it's important. The main consideration is the > > toolchain. We use illumos as an upstream, which is pretty inactive at > > this point. Joyent's illumos fork has put a lot of work into the CTF > > toolchain, and OpenBSD has made some progress towards an ISC-licensed > > ctfconvert utility. I'd like to import the latter, since the permissive > > license means that we can use it in DDB. It requires more work because > > of some missing functionality, though. > > > > At some point I think we'd like to pursue one of these two upstreams, > > Quick reality check question: why aren't *we* (FreeBSD) upstream, since > Sun was killed by Oracle and we're more alive than illumos and OpenBSD? Most of the non-trivial commits to the CTF toolchain in the past several years were done by me, and they were just bug fixes. AFAIK no one is actively working on improving the CTF toolchain in FreeBSD. The Joyent fork has lots of improvements and cleanups that make the code easier to maintain and more useful (for instance, librarifying ctfmerge(1)), and OpenBSD's ctfconv(1) replaces both ctfconvert(1) and ctfmerge(1), and is simpler. My point was merely that anyone seeking to overhaul the CTF toolchain in FreeBSD should consider rebasing on one of these two potential upstreams. ___ 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: r333983 - head/sys/kern
Author: markj Date: Mon May 21 16:03:51 2018 New Revision: 333983 URL: https://svnweb.freebsd.org/changeset/base/333983 Log: Don't pass a section cookie to CK for non-preemptible epoch sections. They're only useful when multiple threads may share an epoch record, and that can't happen with non-preemptible sections. Reviewed by: mmacy Differential Revision:https://reviews.freebsd.org/D15507 Modified: head/sys/kern/subr_epoch.c Modified: head/sys/kern/subr_epoch.c == --- head/sys/kern/subr_epoch.c Mon May 21 15:06:19 2018(r333982) +++ head/sys/kern/subr_epoch.c Mon May 21 16:03:51 2018(r333983) @@ -298,18 +298,15 @@ void epoch_enter(epoch_t epoch) { ck_epoch_record_t *record; - ck_epoch_section_t *section; struct thread *td; MPASS(cold || epoch != NULL); - section = NULL; td = curthread; - critical_enter(); - if (__predict_true(td->td_epochnest++ == 0)) - section = (ck_epoch_section_t*)&td->td_epoch_section; + critical_enter(); + td->td_epochnest++; record = &epoch->e_pcpu[curcpu]->eps_record.er_record; - ck_epoch_begin(record, section); + ck_epoch_begin(record, NULL); } void @@ -339,16 +336,12 @@ void epoch_exit(epoch_t epoch) { ck_epoch_record_t *record; - ck_epoch_section_t *section; struct thread *td; - section = NULL; td = curthread; - MPASS(td->td_critnest); - if (__predict_true(td->td_epochnest-- == 1)) - section = (ck_epoch_section_t*)&td->td_epoch_section; + td->td_epochnest--; record = &epoch->e_pcpu[curcpu]->eps_record.er_record; - ck_epoch_end(record, section); + ck_epoch_end(record, NULL); critical_exit(); } ___ 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: r334049 - head/sys/net
Author: markj Date: Tue May 22 15:35:38 2018 New Revision: 334049 URL: https://svnweb.freebsd.org/changeset/base/334049 Log: Simplify lagg_input(). No functional change intended. MFC after:2 weeks Modified: head/sys/net/if_lagg.c head/sys/net/if_lagg.h Modified: head/sys/net/if_lagg.c == --- head/sys/net/if_lagg.c Tue May 22 15:13:25 2018(r334048) +++ head/sys/net/if_lagg.c Tue May 22 15:35:38 2018(r334049) @@ -1680,7 +1680,7 @@ lagg_input(struct ifnet *ifp, struct mbuf *m) LAGG_RLOCK(); if ((scifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || - (lp->lp_flags & LAGG_PORT_DISABLED) || + lp->lp_detaching != 0 || sc->sc_proto == LAGG_PROTO_NONE) { LAGG_RUNLOCK(); m_freem(m); @@ -1689,17 +1689,10 @@ lagg_input(struct ifnet *ifp, struct mbuf *m) ETHER_BPF_MTAP(scifp, m); - if (lp->lp_detaching != 0) { + m = lagg_proto_input(sc, lp, m); + if (m != NULL && (scifp->if_flags & IFF_MONITOR) != 0) { m_freem(m); m = NULL; - } else - m = lagg_proto_input(sc, lp, m); - - if (m != NULL) { - if (scifp->if_flags & IFF_MONITOR) { - m_freem(m); - m = NULL; - } } LAGG_RUNLOCK(); Modified: head/sys/net/if_lagg.h == --- head/sys/net/if_lagg.h Tue May 22 15:13:25 2018(r334048) +++ head/sys/net/if_lagg.h Tue May 22 15:35:38 2018(r334049) @@ -42,9 +42,8 @@ #defineLAGG_PORT_ACTIVE0x0004 /* port is active */ #defineLAGG_PORT_COLLECTING0x0008 /* port is receiving frames */ #defineLAGG_PORT_DISTRIBUTING 0x0010 /* port is sending frames */ -#defineLAGG_PORT_DISABLED 0x0020 /* port is disabled */ #defineLAGG_PORT_BITS "\20\01MASTER\02STACK\03ACTIVE\04COLLECTING" \ - "\05DISTRIBUTING\06DISABLED" + "\05DISTRIBUTING" /* Supported lagg PROTOs */ typedef enum { ___ 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: r334050 - head/sys/dev/cpuctl
Author: markj Date: Tue May 22 15:38:51 2018 New Revision: 334050 URL: https://svnweb.freebsd.org/changeset/base/334050 Log: Flush caches before initiating a microcode update on Intel CPUs. This apparently works around issues with updates of certain Broadwell CPUs. Reviewed by: emaste, kib, sbruno MFC after:3 days Differential Revision:https://reviews.freebsd.org/D15520 Modified: head/sys/dev/cpuctl/cpuctl.c Modified: head/sys/dev/cpuctl/cpuctl.c == --- head/sys/dev/cpuctl/cpuctl.cTue May 22 15:35:38 2018 (r334049) +++ head/sys/dev/cpuctl/cpuctl.cTue May 22 15:38:51 2018 (r334050) @@ -367,8 +367,10 @@ update_intel(int cpu, cpuctl_update_args_t *args, stru rdmsr_safe(MSR_BIOS_SIGN, &rev0); /* Get current microcode revision. */ /* -* Perform update. +* Perform update. Flush caches first to work around seeingly +* undocumented errata applying to some Broadwell CPUs. */ + wbinvd(); wrmsr_safe(MSR_BIOS_UPDT_TRIG, (uintptr_t)(ptr)); wrmsr_safe(MSR_BIOS_SIGN, 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"
svn commit: r334051 - head/sys/dev/cpuctl
Author: markj Date: Tue May 22 15:49:23 2018 New Revision: 334051 URL: https://svnweb.freebsd.org/changeset/base/334051 Log: Typo. Reported by: rgrimes, vangyzen X-MFC with: r334050 Modified: head/sys/dev/cpuctl/cpuctl.c Modified: head/sys/dev/cpuctl/cpuctl.c == --- head/sys/dev/cpuctl/cpuctl.cTue May 22 15:38:51 2018 (r334050) +++ head/sys/dev/cpuctl/cpuctl.cTue May 22 15:49:23 2018 (r334051) @@ -367,7 +367,7 @@ update_intel(int cpu, cpuctl_update_args_t *args, stru rdmsr_safe(MSR_BIOS_SIGN, &rev0); /* Get current microcode revision. */ /* -* Perform update. Flush caches first to work around seeingly +* Perform update. Flush caches first to work around seemingly * undocumented errata applying to some Broadwell CPUs. */ wbinvd(); ___ 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: r334055 - head/sys/netinet/netdump
Author: markj Date: Tue May 22 16:01:56 2018 New Revision: 334055 URL: https://svnweb.freebsd.org/changeset/base/334055 Log: Initialize the dumper struct before calling set_dumper(). Fields owned by the generic code were being left uninitialized, causing problems in clear_dumper() if an error occurred. Coverity CID: 1391200 X-MFC with: r333283 Modified: head/sys/netinet/netdump/netdump_client.c Modified: head/sys/netinet/netdump/netdump_client.c == --- head/sys/netinet/netdump/netdump_client.c Tue May 22 15:54:25 2018 (r334054) +++ head/sys/netinet/netdump/netdump_client.c Tue May 22 16:01:56 2018 (r334055) @@ -1204,6 +1204,7 @@ netdump_ioctl(struct cdev *dev __unused, u_long cmd, c } } + memset(&dumper, 0, sizeof(dumper)); dumper.dumper_start = netdump_start; dumper.dumper_hdr = netdump_write_headers; dumper.dumper = netdump_dumper; ___ 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: r334057 - head/sys/vm
Author: markj Date: Tue May 22 16:19:48 2018 New Revision: 334057 URL: https://svnweb.freebsd.org/changeset/base/334057 Log: Ensure that "m" is initialized in vm_page_alloc_freelist_domain(). While here, remove a superfluous comment. Coverity CID: 1383559 MFC after:3 days Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c == --- head/sys/vm/vm_page.c Tue May 22 16:03:41 2018(r334056) +++ head/sys/vm/vm_page.c Tue May 22 16:19:48 2018(r334057) @@ -2191,9 +2191,7 @@ vm_page_alloc_freelist_domain(int domain, int freelist vm_page_t m; u_int flags; - /* -* Do not allocate reserved pages unless the req has asked for it. -*/ + m = NULL; vmd = VM_DOMAIN(domain); again: if (vm_domain_allocate(vmd, req, 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: r334060 - head/sys/sys
Author: markj Date: Tue May 22 16:33:09 2018 New Revision: 334060 URL: https://svnweb.freebsd.org/changeset/base/334060 Log: Fix the definition of td_startzero after r333466. Modified: head/sys/sys/proc.h Modified: head/sys/sys/proc.h == --- head/sys/sys/proc.h Tue May 22 16:32:34 2018(r334059) +++ head/sys/sys/proc.h Tue May 22 16:33:09 2018(r334060) @@ -254,8 +254,8 @@ struct thread { u_char td_lend_user_pri; /* (t) Lend user pri. */ /* Cleared during fork1() */ -#definetd_startzero td_flags - u_char td_epochnest; /* (k) Private thread epoch nest counter */ +#definetd_startzero td_epochnest + u_char td_epochnest; /* (k) Epoch nest counter. */ int td_flags; /* (t) TDF_* flags. */ int td_inhibitors; /* (t) Why can not run. */ int td_pflags; /* (k) Private thread (TDP_*) flags. */ ___ 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: r334100 - head/share/man/man9
Author: markj Date: Wed May 23 15:26:56 2018 New Revision: 334100 URL: https://svnweb.freebsd.org/changeset/base/334100 Log: Document the return value of sbuf_bcat(9). MFC after:1 week Modified: head/share/man/man9/sbuf.9 Modified: head/share/man/man9/sbuf.9 == --- head/share/man/man9/sbuf.9 Wed May 23 15:22:58 2018(r334099) +++ head/share/man/man9/sbuf.9 Wed May 23 15:26:56 2018(r334100) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 17, 2017 +.Dd May 23, 2018 .Dt SBUF 9 .Os .Sh NAME @@ -624,6 +624,7 @@ function returns \-1 if was invalid, and zero otherwise. .Pp The +.Fn sbuf_bcat , .Fn sbuf_cat , .Fn sbuf_cpy , .Fn sbuf_printf , ___ 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: r334101 - head/sys/arm64/include
Author: markj Date: Wed May 23 15:43:35 2018 New Revision: 334101 URL: https://svnweb.freebsd.org/changeset/base/334101 Log: Add GET_STACK_USAGE() for arm64. Its absence meant that GEOM direct dispatch was disabled (the service routines check the current thread's stack usage to determine whether to hand off the request to a dedicated thread), and this change is sufficient to enable direct dispatch by default. Reviewed by: allanjude MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D15527 Modified: head/sys/arm64/include/proc.h Modified: head/sys/arm64/include/proc.h == --- head/sys/arm64/include/proc.h Wed May 23 15:26:56 2018 (r334100) +++ head/sys/arm64/include/proc.h Wed May 23 15:43:35 2018 (r334101) @@ -54,4 +54,18 @@ struct syscall_args { int narg; }; +#ifdef _KERNEL + +#include + +#defineGET_STACK_USAGE(total, used) do { \ + struct thread *td = curthread; \ + (total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \ + (used) = (char *)td->td_kstack +\ + td->td_kstack_pages * PAGE_SIZE - \ + (char *)&td;\ +} while (0) + +#endif + #endif /* !_MACHINE_PROC_H_ */ ___ 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: r334105 - head/lib/libmd
Author: markj Date: Wed May 23 17:01:28 2018 New Revision: 334105 URL: https://svnweb.freebsd.org/changeset/base/334105 Log: Revert r334090. It causes the 32bit compat build of libmd to fail with: libmd/rmd160c.c:86:9: error: 'ripemd160_block' macro redefined #define ripemd160_block ripemd160_block_x86 ^ libmd/ripemd.h:122:9: note: previous definition is here #define ripemd160_block _libmd_ripemd160_block Modified: head/lib/libmd/Makefile head/lib/libmd/mdXhl.c Modified: head/lib/libmd/Makefile == --- head/lib/libmd/Makefile Wed May 23 17:00:05 2018(r334104) +++ head/lib/libmd/Makefile Wed May 23 17:01:28 2018(r334105) @@ -15,7 +15,7 @@ SRCS= md4c.c md5c.c md4hl.c md5hl.c \ INCS= md4.h md5.h ripemd.h sha.h sha256.h sha384.h sha512.h sha512t.h \ skein.h skein_port.h skein_freebsd.h skein_iv.h -WARNS?=1 +WARNS?=0 MAN+= md4.3 md5.3 ripemd.3 sha.3 sha256.3 sha512.3 skein.3 MLINKS+=md4.3 MD4Init.3 md4.3 MD4Update.3 md4.3 MD4Final.3 Modified: head/lib/libmd/mdXhl.c == --- head/lib/libmd/mdXhl.c Wed May 23 17:00:05 2018(r334104) +++ head/lib/libmd/mdXhl.c Wed May 23 17:01:28 2018(r334105) @@ -54,7 +54,8 @@ MDXFdChunk(int fd, char *buf, off_t ofs, off_t len) { unsigned char buffer[16*1024]; MDX_CTX ctx; - int readrv; + struct stat stbuf; + int readrv, e; off_t remain; if (len < 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"
svn commit: r334154 - head/sys/vm
Author: markj Date: Thu May 24 14:16:22 2018 New Revision: 334154 URL: https://svnweb.freebsd.org/changeset/base/334154 Log: Split the active and inactive queue scans into separate subroutines. The scans are largely independent, so this helps make the code marginally neater, and makes it easier to incorporate feedback from the active queue scan into the page daemon control loop. Improve some comments while here. No functional change intended. Reviewed by: alc, kib Differential Revision:https://reviews.freebsd.org/D15490 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cThu May 24 14:01:22 2018(r334153) +++ head/sys/vm/vm_pageout.cThu May 24 14:16:22 2018(r334154) @@ -124,7 +124,6 @@ static void vm_pageout(void); static void vm_pageout_init(void); static int vm_pageout_clean(vm_page_t m, int *numpagedout); static int vm_pageout_cluster(vm_page_t m); -static bool vm_pageout_scan(struct vm_domain *vmd, int pass, int shortage); static void vm_pageout_mightbe_oom(struct vm_domain *vmd, int page_shortage, int starting_page_shortage); @@ -1108,7 +1107,193 @@ dolaundry: } } +/* + * Compute the number of pages we want to try to move from the + * active queue to either the inactive or laundry queue. + * + * When scanning active pages, we make clean pages count more heavily + * towards the page shortage than dirty pages. This is because dirty + * pages must be laundered before they can be reused and thus have less + * utility when attempting to quickly alleviate a shortage. However, + * this weighting also causes the scan to deactivate dirty pages more + * aggressively, improving the effectiveness of clustering and + * ensuring that they can eventually be reused. + */ static int +vm_pageout_scan_active_target(struct vm_domain *vmd) +{ + int shortage; + + shortage = vmd->vmd_inactive_target + vm_paging_target(vmd) - + (vmd->vmd_pagequeues[PQ_INACTIVE].pq_cnt + + vmd->vmd_pagequeues[PQ_LAUNDRY].pq_cnt / act_scan_laundry_weight); + shortage *= act_scan_laundry_weight; + return (shortage); +} + +/* + * Scan the active queue. If there is no shortage of inactive pages, scan a + * small portion of the queue in order to maintain quasi-LRU. + */ +static void +vm_pageout_scan_active(struct vm_domain *vmd, int page_shortage) +{ + struct scan_state ss; + struct mtx *mtx; + vm_page_t m, marker; + struct vm_pagequeue *pq; + long min_scan; + int act_delta, max_scan, scan_tick; + + marker = &vmd->vmd_markers[PQ_ACTIVE]; + pq = &vmd->vmd_pagequeues[PQ_ACTIVE]; + vm_pagequeue_lock(pq); + + /* +* If we're just idle polling attempt to visit every +* active page within 'update_period' seconds. +*/ + scan_tick = ticks; + if (vm_pageout_update_period != 0) { + min_scan = pq->pq_cnt; + min_scan *= scan_tick - vmd->vmd_last_active_scan; + min_scan /= hz * vm_pageout_update_period; + } else + min_scan = 0; + if (min_scan > 0 || (page_shortage > 0 && pq->pq_cnt > 0)) + vmd->vmd_last_active_scan = scan_tick; + + /* +* Scan the active queue for pages that can be deactivated. Update +* the per-page activity counter and use it to identify deactivation +* candidates. Held pages may be deactivated. +* +* To avoid requeuing each page that remains in the active queue, we +* implement the CLOCK algorithm. To maintain consistency in the +* generic page queue code, pages are inserted at the tail of the +* active queue. We thus use two hands, represented by marker pages: +* scans begin at the first hand, which precedes the second hand in +* the queue. When the two hands meet, they are moved back to the +* head and tail of the queue, respectively, and scanning resumes. +*/ + max_scan = page_shortage > 0 ? pq->pq_cnt : min_scan; + mtx = NULL; +act_scan: + vm_pageout_init_scan(&ss, pq, marker, &vmd->vmd_clock[0], max_scan); + while ((m = vm_pageout_next(&ss, false)) != NULL) { + if (__predict_false(m == &vmd->vmd_clock[1])) { + vm_pagequeue_lock(pq); + TAILQ_REMOVE(&pq->pq_pl, &vmd->vmd_clock[0], plinks.q); + TAILQ_REMOVE(&pq->pq_pl, &vmd->vmd_clock[1], plinks.q); + TAILQ_INSERT_HEAD(&pq->pq_pl, &vmd->vmd_clock[0], + plinks.q); + TAILQ_INSERT_TAIL(&pq->pq_pl, &vmd->vmd_clock[1], + plinks.q); + max_scan -= ss.scanned; + vm_pageout_end_scan(&ss); + goto act_scan; +
svn commit: r334179 - head/sys/vm
Author: markj Date: Thu May 24 20:26:37 2018 New Revision: 334179 URL: https://svnweb.freebsd.org/changeset/base/334179 Log: Update r334154 with review feedback from D15490. An old revision was committed by accident. Differential Revision:https://reviews.freebsd.org/D15490 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cThu May 24 18:53:29 2018(r334178) +++ head/sys/vm/vm_pageout.cThu May 24 20:26:37 2018(r334179) @@ -,16 +,16 @@ dolaundry: * Compute the number of pages we want to try to move from the * active queue to either the inactive or laundry queue. * - * When scanning active pages, we make clean pages count more heavily - * towards the page shortage than dirty pages. This is because dirty - * pages must be laundered before they can be reused and thus have less - * utility when attempting to quickly alleviate a shortage. However, - * this weighting also causes the scan to deactivate dirty pages more - * aggressively, improving the effectiveness of clustering and - * ensuring that they can eventually be reused. + * When scanning active pages during a shortage, we make clean pages + * count more heavily towards the page shortage than dirty pages. + * This is because dirty pages must be laundered before they can be + * reused and thus have less utility when attempting to quickly + * alleviate a free page shortage. However, this weighting also + * causes the scan to deactivate dirty pages more aggressively, + * improving the effectiveness of clustering. */ static int -vm_pageout_scan_active_target(struct vm_domain *vmd) +vm_pageout_active_target(struct vm_domain *vmd) { int shortage; @@ -1169,12 +1169,12 @@ vm_pageout_scan_active(struct vm_domain *vmd, int page * candidates. Held pages may be deactivated. * * To avoid requeuing each page that remains in the active queue, we -* implement the CLOCK algorithm. To maintain consistency in the -* generic page queue code, pages are inserted at the tail of the -* active queue. We thus use two hands, represented by marker pages: -* scans begin at the first hand, which precedes the second hand in -* the queue. When the two hands meet, they are moved back to the -* head and tail of the queue, respectively, and scanning resumes. +* implement the CLOCK algorithm. To keep the implementation of the +* enqueue operation consistent for all page queues, we use two hands, +* represented by marker pages. Scans begin at the first hand, which +* precedes the second hand in the queue. When the two hands meet, +* they are moved back to the head and tail of the queue, respectively, +* and scanning resumes. */ max_scan = page_shortage > 0 ? pq->pq_cnt : min_scan; mtx = NULL; @@ -1254,9 +1254,12 @@ act_scan: * through the inactive queue before moving to the * laundry queues. This gives them some extra time to * be reactivated, potentially avoiding an expensive -* pageout. During a page shortage, the inactive queue -* is necessarily small, so we may move dirty pages -* directly to the laundry queue. +* pageout. However, during a page shortage, the +* inactive queue is necessarily small, and so dirty +* pages would only spend a trivial amount of time in +* the inactive queue. Therefore, we might as well +* place them directly in the laundry queue to reduce +* queuing overhead. */ if (page_shortage <= 0) vm_page_deactivate(m); @@ -1941,7 +1944,7 @@ vm_pageout_worker(void *arg) * indicates that we must aggressively deactivate pages to avoid * a shortfall. */ - shortage = vm_pageout_scan_active_target(vmd) + addl_shortage; + shortage = vm_pageout_active_target(vmd) + addl_shortage; vm_pageout_scan_active(vmd, shortage); /* ___ 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: r334118 - in head/sys: compat/linprocfs compat/linux compat/linuxkpi/common/include/linux dev/mlx5/mlx5_ib dev/wtap net net/altq netinet netinet/netdump netinet6 netpfil/pf nfs ofed/dr
On Wed, May 23, 2018 at 09:02:15PM +, Matt Macy wrote: > Author: mmacy > Date: Wed May 23 21:02:14 2018 > New Revision: 334118 > URL: https://svnweb.freebsd.org/changeset/base/334118 > > Log: > UDP: further performance improvements on tx > > Cumulative throughput while running 64 > netperf -H $DUT -t UDP_STREAM -- -m 1 > on a 2x8x2 SKL went from 1.1Mpps to 2.5Mpps > > Single stream throughput increases from 910kpps to 1.18Mpps > > Baseline: > https://people.freebsd.org/~mmacy/2018.05.11/udpsender2.svg > > - Protect read access to global ifnet list with epoch > https://people.freebsd.org/~mmacy/2018.05.11/udpsender3.svg > > - Protect short lived ifaddr references with epoch > https://people.freebsd.org/~mmacy/2018.05.11/udpsender4.svg > > - Convert if_afdata read lock path to epoch > https://people.freebsd.org/~mmacy/2018.05.11/udpsender5.svg After this change I can panic an INVARIANTS kernel like so. There is a freed ifaddr lingering on the lo0 ifnet's address list. # ifconfig lo0 127.0.0.2 # ifconfig lo0 -alias 127.0.0.2 # netstat -rn Routing tables Fatal trap 9: general protection fault while in kernel mode cpuid = 1; apic id = 01 instruction pointer = 0x20:0x80605219 stack pointer = 0x28:0xfe4692e0 frame pointer = 0x28:0xfe4693d0 code segment= base 0x0, limit 0xf, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags= interrupt enabled, resume, IOPL = 0 current process = 735 (netstat) trap number = 9 panic: general protection fault cpuid = 1 time = 1527266002 Uptime: 1m42s Dumping 216 out of 4079 MB:..8%..15%..23%..37%..45%..52%..67%..74%..82%..97% Dump complete Consoles: userboot ___ 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: r334339 - head/sbin/savecore
Author: markj Date: Tue May 29 16:04:53 2018 New Revision: 334339 URL: https://svnweb.freebsd.org/changeset/base/334339 Log: The extension for zstd-compressed files is ".zst". Reported by: manu Modified: head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.c == --- head/sbin/savecore/savecore.c Tue May 29 16:03:53 2018 (r334338) +++ head/sbin/savecore/savecore.c Tue May 29 16:04:53 2018 (r334339) @@ -305,7 +305,7 @@ symlinks_remove(void) (void)unlink("key.last"); (void)unlink("vmcore.last"); (void)unlink("vmcore.last.gz"); - (void)unlink("vmcore.last.zstd"); + (void)unlink("vmcore.last.zst"); (void)unlink("vmcore_encrypted.last"); (void)unlink("vmcore_encrypted.last.gz"); (void)unlink("textdump.tar.last"); ___ 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: r334389 - head/sys/vm
Author: markj Date: Wed May 30 16:48:48 2018 New Revision: 334389 URL: https://svnweb.freebsd.org/changeset/base/334389 Log: Typo. PR: 228533 Submitted by: Jakub Piecuch MFC after:1 week Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c == --- head/sys/vm/vm_fault.c Wed May 30 15:51:48 2018(r334388) +++ head/sys/vm/vm_fault.c Wed May 30 16:48:48 2018(r334389) @@ -1671,7 +1671,7 @@ vm_fault_copy_entry(vm_map_t dst_map, vm_map_t src_map * range, copying each page from the source object to the * destination object. Since the source is wired, those pages * must exist. In contrast, the destination is pageable. -* Since the destination object does share any backing storage +* Since the destination object doesn't share any backing storage * with the source object, all of its pages must be dirtied, * regardless of whether they can be written. */ ___ 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: r334504 - head/lib/libc/sys
Author: markj Date: Fri Jun 1 23:40:43 2018 New Revision: 334504 URL: https://svnweb.freebsd.org/changeset/base/334504 Log: Remove an inaccuracy from mincore.2. Super pages are supported on non-x86 architectures, so just remove the incorrect note. While here, change terminology to be consistent with mmap.2. MFC after:1 week Modified: head/lib/libc/sys/mincore.2 Modified: head/lib/libc/sys/mincore.2 == --- head/lib/libc/sys/mincore.2 Fri Jun 1 22:57:19 2018(r334503) +++ head/lib/libc/sys/mincore.2 Fri Jun 1 23:40:43 2018(r334504) @@ -28,7 +28,7 @@ .\"@(#)mincore.2 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd January 17, 2003 +.Dd June 1, 2018 .Dt MINCORE 2 .Os .Sh NAME @@ -73,7 +73,9 @@ Page has been referenced. .It Dv MINCORE_MODIFIED_OTHER Page has been modified. .It Dv MINCORE_SUPER -Page is part of a "super" page. (only i386 & amd64) +Page is part of a large +.Pq Dq super +page. .El .Pp The information returned by ___ 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: r334505 - in head/lib/libc: aarch64 riscv
Author: markj Date: Fri Jun 1 23:42:10 2018 New Revision: 334505 URL: https://svnweb.freebsd.org/changeset/base/334505 Log: Don't export _end on arm64 and riscv. These platforms don't support brk() and sbrk(), which are the reason for exporting _end in the first place. MFC after:1 week Modified: head/lib/libc/aarch64/Symbol.map head/lib/libc/riscv/Symbol.map Modified: head/lib/libc/aarch64/Symbol.map == --- head/lib/libc/aarch64/Symbol.mapFri Jun 1 23:40:43 2018 (r334504) +++ head/lib/libc/aarch64/Symbol.mapFri Jun 1 23:42:10 2018 (r334505) @@ -33,6 +33,5 @@ FBSD_1.0 { FBSDprivate_1.0 { _set_tp; - _end; __makecontext; }; Modified: head/lib/libc/riscv/Symbol.map == --- head/lib/libc/riscv/Symbol.map Fri Jun 1 23:40:43 2018 (r334504) +++ head/lib/libc/riscv/Symbol.map Fri Jun 1 23:42:10 2018 (r334505) @@ -33,6 +33,5 @@ FBSD_1.0 { FBSDprivate_1.0 { _set_tp; - _end; __makecontext; }; ___ 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: r334506 - head/sys/kern
Author: markj Date: Fri Jun 1 23:49:32 2018 New Revision: 334506 URL: https://svnweb.freebsd.org/changeset/base/334506 Log: Avoid completing I/O when dumping core after a panic. Filesystem or pager completion callbacks are generally non-functional after a panic and may trigger deadlocks if invoked in this context (e.g., by attempting to destroying a buffer mapping). To avoid this situation, short-circuit I/O completion in biodone(). Reviewed by: imp Discussed with: mav MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D15592 Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Fri Jun 1 23:42:10 2018(r334505) +++ head/sys/kern/vfs_bio.c Fri Jun 1 23:49:32 2018(r334506) @@ -4310,6 +4310,8 @@ allocbuf(struct buf *bp, int size) extern int inflight_transient_maps; +static struct bio_queue nondump_bios; + void biodone(struct bio *bp) { @@ -4318,6 +4320,17 @@ biodone(struct bio *bp) vm_offset_t start, end; biotrack(bp, __func__); + + /* +* Avoid completing I/O when dumping after a panic since that may +* result in a deadlock in the filesystem or pager code. Note that +* this doesn't affect dumps that were started manually since we aim +* to keep the system usable after it has been resumed. +*/ + if (__predict_false(dumping && SCHEDULER_STOPPED())) { + TAILQ_INSERT_HEAD(&nondump_bios, bp, bio_queue); + return; + } if ((bp->bio_flags & BIO_TRANSIENT_MAPPING) != 0) { bp->bio_flags &= ~BIO_TRANSIENT_MAPPING; bp->bio_flags |= BIO_UNMAPPED; ___ 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: r334508 - head/sys/vm
Author: markj Date: Sat Jun 2 00:01:07 2018 New Revision: 334508 URL: https://svnweb.freebsd.org/changeset/base/334508 Log: Remove the "pass" variable from the page daemon control loop. It serves little purpose after r308474 and r329882. As a side effect, the removal fixes a bug in r329882 which caused the page daemon to periodically invoke lowmem handlers even in the absence of memory pressure. Reviewed by: jeff Differential Revision:https://reviews.freebsd.org/D15491 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cFri Jun 1 23:50:51 2018(r334507) +++ head/sys/vm/vm_pageout.cSat Jun 2 00:01:07 2018(r334508) @@ -1352,7 +1352,7 @@ vm_pageout_reinsert_inactive(struct scan_state *ss, st * target. */ static int -vm_pageout_scan_inactive(struct vm_domain *vmd, int pass, int shortage, +vm_pageout_scan_inactive(struct vm_domain *vmd, int shortage, int *addl_shortage) { struct scan_state ss; @@ -1366,25 +1366,6 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int pa bool obj_locked; /* -* If we need to reclaim memory ask kernel caches to return -* some. We rate limit to avoid thrashing. -*/ - if (vmd == VM_DOMAIN(0) && pass > 0 && - (time_uptime - lowmem_uptime) >= lowmem_period) { - /* -* Decrease registered cache sizes. -*/ - SDT_PROBE0(vm, , , vm__lowmem_scan); - EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_PAGES); - /* -* We do this explicitly after the caches have been -* drained above. -*/ - uma_reclaim(); - lowmem_uptime = time_uptime; - } - - /* * The addl_page_shortage is an estimate of the number of temporarily * stuck pages in the inactive queue. In other words, the * number of pages from the inactive count that should be @@ -1393,16 +1374,13 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int pa addl_page_shortage = 0; /* -* Calculate the number of pages that we want to free. This number -* can be negative if many pages are freed between the wakeup call to -* the page daemon and this calculation. +* vmd_pageout_deficit counts the number of pages requested in +* allocations that failed because of a free page shortage. We assume +* that the allocations will be reattempted and thus include the deficit +* in our scan target. */ - if (pass > 0) { - deficit = atomic_readandclear_int(&vmd->vmd_pageout_deficit); - page_shortage = shortage + deficit; - } else - page_shortage = deficit = 0; - starting_page_shortage = page_shortage; + deficit = atomic_readandclear_int(&vmd->vmd_pageout_deficit); + starting_page_shortage = page_shortage = shortage + deficit; mtx = NULL; obj_locked = false; @@ -1638,8 +1616,7 @@ reinsert: /* * Reclaim pages by swapping out idle processes, if configured to do so. */ - if (pass > 0) - vm_swapout_run_idle(); + vm_swapout_run_idle(); /* * See the description of addl_page_shortage above. @@ -1870,15 +1847,35 @@ vm_pageout_oom(int shortage) } static void +vm_pageout_lowmem(struct vm_domain *vmd) +{ + + if (vmd == VM_DOMAIN(0) && + time_uptime - lowmem_uptime >= lowmem_period) { + /* +* Decrease registered cache sizes. +*/ + SDT_PROBE0(vm, , , vm__lowmem_scan); + EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_PAGES); + + /* +* We do this explicitly after the caches have been +* drained above. +*/ + uma_reclaim(); + lowmem_uptime = time_uptime; + } +} + +static void vm_pageout_worker(void *arg) { struct vm_domain *vmd; - int addl_shortage, domain, pass, shortage; + int addl_shortage, domain, shortage; bool target_met; domain = (uintptr_t)arg; vmd = VM_DOMAIN(domain); - pass = 0; shortage = 0; target_met = true; @@ -1896,6 +1893,7 @@ vm_pageout_worker(void *arg) */ while (TRUE) { vm_domain_pageout_lock(vmd); + /* * We need to clear wanted before we check the limits. This * prevents races with wakers who will check wanted after they @@ -1908,12 +1906,12 @@ vm_pageout_worker(void *arg) */ if (vm_paging_needed(vmd, vmd->vmd_free_count)) { /* -* Yes, the scan failed to free enough
svn commit: r334616 - head/sys/dev/acpica
Author: markj Date: Mon Jun 4 14:56:02 2018 New Revision: 334616 URL: https://svnweb.freebsd.org/changeset/base/334616 Log: Fix the NUMA build for non-x86 platforms. acpi_map_pxm_to_vm_domainid() is currently implemented only on x86. MFC after:1 week Modified: head/sys/dev/acpica/acpi.c Modified: head/sys/dev/acpica/acpi.c == --- head/sys/dev/acpica/acpi.c Mon Jun 4 14:42:13 2018(r334615) +++ head/sys/dev/acpica/acpi.c Mon Jun 4 14:56:02 2018(r334616) @@ -1090,6 +1090,7 @@ static int acpi_parse_pxm(device_t dev) { #ifdef NUMA +#if defined(__i386__) || defined(__amd64__) ACPI_HANDLE handle; ACPI_STATUS status; int pxm; @@ -1102,6 +1103,7 @@ acpi_parse_pxm(device_t dev) return (acpi_map_pxm_to_vm_domainid(pxm)); if (status == AE_NOT_FOUND) return (-2); +#endif #endif return (-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: r334622 - head/sys/vm
Author: markj Date: Mon Jun 4 16:46:36 2018 New Revision: 334622 URL: https://svnweb.freebsd.org/changeset/base/334622 Log: Correct the description of vm_pageout_scan_inactive() after r334508. Reported by: alc Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cMon Jun 4 16:28:06 2018(r334621) +++ head/sys/vm/vm_pageout.cMon Jun 4 16:46:36 2018(r334622) @@ -1347,9 +1347,8 @@ vm_pageout_reinsert_inactive(struct scan_state *ss, st } /* - * Attempt to reclaim the requested number of pages. Returns true if pass was - * zero or enough pages were freed by the inactive queue scan to meet the - * target. + * Attempt to reclaim the requested number of pages from the inactive queue. + * Returns true if the shortage was addressed. */ static int vm_pageout_scan_inactive(struct vm_domain *vmd, int shortage, ___ 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: r334626 - in head: lib/libc/amd64 lib/libc/amd64/sys lib/libc/arm lib/libc/arm/sys lib/libc/i386 lib/libc/i386/sys lib/libc/mips lib/libc/mips/sys lib/libc/powerpc lib/libc/powerpc/sys ...
/Makefile.inc Mon Jun 4 19:35:15 2018 (r334626) @@ -17,8 +17,7 @@ # While historically machine dependent, all architectures have the following # declarations in common: # -NOASM= break.o \ - exit.o \ +NOASM= exit.o \ getlogin.o \ sstk.o \ yield.o @@ -45,6 +44,7 @@ SRCS+= getdirentries.c NOASM+= getdirentries.o PSEUDO+= _getdirentries.o +SRCS+= brk.c SRCS+= pipe.c SRCS+= vadvise.c Modified: head/lib/libc/sys/brk.2 == --- head/lib/libc/sys/brk.2 Mon Jun 4 18:51:06 2018(r334625) +++ head/lib/libc/sys/brk.2 Mon Jun 4 19:35:15 2018(r334626) @@ -28,7 +28,7 @@ .\" @(#)brk.2 8.4 (Berkeley) 5/1/95 .\" $FreeBSD$ .\" -.Dd May 24, 2018 +.Dd June 2, 2018 .Dt BRK 2 .Os .Sh NAME @@ -183,3 +183,8 @@ is sometimes used to monitor heap use by calling with The result is unlikely to reflect actual utilization in combination with an .Xr mmap 2 based malloc. +.Pp +.Fn brk +and +.Fn sbrk +are not thread-safe. Added: head/lib/libc/sys/brk.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/sys/brk.c Mon Jun 4 19:35:15 2018(r334626) @@ -0,0 +1,107 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Mark Johnston + * + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +void *__sys_break(char *nsize); + +static uintptr_t curbrk, minbrk; +static int curbrk_initted; + +static int +initbrk(void) +{ + void *newbrk; + + if (!curbrk_initted) { + newbrk = __sys_break(NULL); + if (newbrk == (void *)-1) + return (-1); + curbrk = minbrk = (uintptr_t)newbrk; + curbrk_initted = 1; + } + return (0); +} + +static void * +mvbrk(void *addr) +{ + uintptr_t oldbrk; + + if ((uintptr_t)addr < minbrk) { + /* Emulate legacy error handling in the syscall. */ + errno = EINVAL; + return ((void *)-1); + } + if (__sys_break(addr) == (void *)-1) + return ((void *)-1); + oldbrk = curbrk; + curbrk = (uintptr_t)addr; + return ((void *)oldbrk); +} + +int +brk(const void *addr) +{ + + if (initbrk() == -1) + return (-1); + if ((uintptr_t)addr < minbrk) + addr = (void *)minbrk; + return (mvbrk(__DECONST(void *, addr)) == (void *)-1 ? -1 : 0); +} + +int +_brk(const void *addr) +{ + + if (initbrk() == -1) + return (-1); + return (mvbrk(__DECONST(void *, addr)) == (void *)-1 ? -1 : 0); +} + +void * +sbrk(intptr_t incr) +{ + + if (initbrk() == -1) + return ((void *)-1); + if ((incr > 0 && curbrk + incr < curbrk) || + (incr < 0 && curbrk + incr > curbrk)) { + /* Emulate legacy error handling in the syscall. */ + errno = EINVAL; + return ((void *)-1); + } + return (mvbrk((void *)(curbrk + incr))); +} Modified: head/lib/libc/tests/sys/Makefile == --- head/lib/libc/tests/sys/MakefileMon Jun 4 18:51:06 2018 (r334625) +++ head/lib/libc/tests/sys/MakefileMon Jun 4 19:35:15 2018 (r334626) @@ -4,6 +4,7 @@ PACKAGE=tests .include +ATF_TESTS_C+= brk_test
svn commit: r334627 - in head/sys: compat/freebsd32 kern
Author: markj Date: Mon Jun 4 19:36:47 2018 New Revision: 334627 URL: https://svnweb.freebsd.org/changeset/base/334627 Log: Regen after r334626. Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/kern/systrace_args.c Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c == --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Mon Jun 4 19:35:15 2018(r334626) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Mon Jun 4 19:36:47 2018(r334627) @@ -8889,7 +8889,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char * /* obreak */ case 17: if (ndx == 0 || ndx == 1) - p = "int"; + p = "caddr_t"; break; /* getpid */ case 20: Modified: head/sys/kern/systrace_args.c == --- head/sys/kern/systrace_args.c Mon Jun 4 19:35:15 2018 (r334626) +++ head/sys/kern/systrace_args.c Mon Jun 4 19:36:47 2018 (r334627) @@ -8838,7 +8838,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char * /* obreak */ case 17: if (ndx == 0 || ndx == 1) - p = "int"; + p = "caddr_t"; break; /* getpid */ case 20: ___ 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: r334653 - head/lib/libc/tests/sys
Author: markj Date: Tue Jun 5 13:06:06 2018 New Revision: 334653 URL: https://svnweb.freebsd.org/changeset/base/334653 Log: Don't build brk_test on platforms that don't support brk(). X-MFC with: r334626 Modified: head/lib/libc/tests/sys/Makefile Modified: head/lib/libc/tests/sys/Makefile == --- head/lib/libc/tests/sys/MakefileTue Jun 5 12:00:55 2018 (r334652) +++ head/lib/libc/tests/sys/MakefileTue Jun 5 13:06:06 2018 (r334653) @@ -4,7 +4,9 @@ PACKAGE=tests .include +.if ${MACHINE_CPUARCH} != "aarch64" && ${MACHINE_CPUARCH} != "riscv" ATF_TESTS_C+= brk_test +.endif ATF_TESTS_C+= queue_test # TODO: clone, lwp_create, lwp_ctl, posix_fadvise, recvmmsg, ___ 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: r334626 - in head: lib/libc/amd64 lib/libc/amd64/sys lib/libc/arm lib/libc/arm/sys lib/libc/i386 lib/libc/i386/sys lib/libc/mips lib/libc/mips/sys lib/libc/powerpc lib/libc/powerpc/sys
On Tue, Jun 05, 2018 at 03:50:12PM +0800, Ganbold Tsagaankhuu wrote: > On Tue, Jun 5, 2018 at 3:35 AM, Mark Johnston wrote: > > > Author: markj > > Date: Mon Jun 4 19:35:15 2018 > > New Revision: 334626 > > URL: https://svnweb.freebsd.org/changeset/base/334626 > > > > Log: > > Reimplement brk() and sbrk() to avoid the use of _end. > > > > Previously, libc.so would initialize its notion of the break address > > using _end, a special symbol emitted by the static linker following > > the bss section. Compatibility issues between lld and ld.bfd could > > cause the wrong definition of _end (libc.so's definition rather than > > that of the executable) to be used, breaking the brk()/sbrk() > > interface. > > > > Avoid this problem and future interoperability issues by simply not > > relying on _end. Instead, modify the break() system call to return > > the kernel's view of the current break address, and have libc > > initialize its state using an extra syscall upon the first use of the > > interface. As a side effect, this appears to fix brk()/sbrk() usage > > in executables run with rtld direct exec, since the kernel and libc.so > > no longer maintain separate views of the process' break address. > > > > > Maybe it is not really related, or I'm doing something wrong, but when I > try to run release.sh script on FreeBSD 11.0-RELEASE-p9 to build pine64 > image, it stops with error: r334653 should fix that, sorry. ___ 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: r334616 - head/sys/dev/acpica
On Thu, Jun 07, 2018 at 09:54:01AM -0400, John Baldwin wrote: > On 6/4/18 10:56 AM, Mark Johnston wrote: > > Author: markj > > Date: Mon Jun 4 14:56:02 2018 > > New Revision: 334616 > > URL: https://svnweb.freebsd.org/changeset/base/334616 > > > > Log: > > Fix the NUMA build for non-x86 platforms. > > > > acpi_map_pxm_to_vm_domainid() is currently implemented only on x86. > > > > MFC after:1 week > > It seems that non-x86 platforms that support NUMA should implement > this function instead. The SRAT table is not x86-specific and ACPI > platforms implementing NUMA will need to provide an SRAT parser to > describe the memory layout to VM and to map _PXM values to the > VM domain values assigned by that mapping. Indeed, this was a small step towards lifting some of the code in x86/acpica/srat.c into the generic driver for use on arm64. In my case I'm looking a ThunderX, which exposes NUMA locality info in both the ofw device tree and the SRAT table. I'm looking at ofw first, and in the meantime I just needed a buildable options NUMA kernel. ___ 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: r334708 - head/sys/kern
On Wed, Jun 06, 2018 at 05:03:11PM +0300, Konstantin Belousov wrote: > On Wed, Jun 06, 2018 at 12:57:12PM +, Justin Hibbits wrote: > > Author: jhibbits > > Date: Wed Jun 6 12:57:11 2018 > > New Revision: 334708 > > URL: https://svnweb.freebsd.org/changeset/base/334708 > > > > Log: > > Add a memory barrier after taking a reference on the vnode holdcnt in > > _vhold > > > > This is needed to avoid a race between the VNASSERT() below, and another > > thread updating the VI_FREE flag, on weakly-ordered architectures. > > > > On a 72-thread POWER9, without this barrier a 'make -j72 buildworld' would > > panic on the assert regularly. > > > > It may be possible to use a weaker barrier, and I'll investigate that once > > all stability issues are worked out on POWER9. > > > > Modified: > > head/sys/kern/vfs_subr.c > > > > Modified: head/sys/kern/vfs_subr.c > > == > > --- head/sys/kern/vfs_subr.cWed Jun 6 10:46:24 2018 > > (r334707) > > +++ head/sys/kern/vfs_subr.cWed Jun 6 12:57:11 2018 > > (r334708) > > @@ -2807,6 +2807,9 @@ _vhold(struct vnode *vp, bool locked) > > CTR2(KTR_VFS, "%s: vp %p", __func__, vp); > > if (!locked) { > > if (refcount_acquire_if_not_zero(&vp->v_holdcnt)) { > > +#if !defined(__amd64__) && !defined(__i386__) > > + mb(); > > +#endif > > VNASSERT((vp->v_iflag & VI_FREE) == 0, vp, > > ("_vhold: vnode with holdcnt is free")); > > return; > First, mb() must not be used in the FreeBSD code at all. > Look at atomic_thread_fenceXXX(9) KPI. > > Second, you need the reciprocal fence between clearing of VI_FREE and > refcount_acquire(), otherwise the added barrier is nop. Most likely, > you got away with it because there is a mutex unlock between clearing > of VI_FREE and acquire, which release semantic you abused. I note that vnlru_free_locked() clears VI_FREE and increments v_holdcnt without an intervening release fence. At this point the caller has not purged the vnode from the name cache, so it seems possible that the panicking thread observed the two stores out of order. In particular, it seems to me that the patch below is necessary, but possibly (probably?) not sufficient: > Does the fence needed for the non-invariants case ? > > Fourth, doesn't v_usecount has the same issues WRT inactivation ? diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 286a871c3631..c97a8ba63612 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1018,6 +1018,7 @@ vnlru_free_locked(int count, struct vfsops *mnt_op) */ freevnodes--; vp->v_iflag &= ~VI_FREE; + atomic_thread_fence_rel(); refcount_acquire(&vp->v_holdcnt); mtx_unlock(&vnode_free_list_mtx); @@ -2807,9 +2808,7 @@ _vhold(struct vnode *vp, bool locked) CTR2(KTR_VFS, "%s: vp %p", __func__, vp); if (!locked) { if (refcount_acquire_if_not_zero(&vp->v_holdcnt)) { -#if !defined(__amd64__) && !defined(__i386__) - mb(); -#endif + atomic_thread_fence_acq(); VNASSERT((vp->v_iflag & VI_FREE) == 0, vp, ("_vhold: vnode with holdcnt is free")); return; ___ 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: r334827 - in head/sys: amd64/amd64 arm/arm dev/hwpmc i386/i386 kern mips/atheros mips/cavium powerpc/powerpc sys
On Fri, Jun 08, 2018 at 04:58:03AM +, Matt Macy wrote: > Author: mmacy > Date: Fri Jun 8 04:58:03 2018 > New Revision: 334827 > URL: https://svnweb.freebsd.org/changeset/base/334827 > > Log: > hwpmc: simplify calling convention for hwpmc interrupt handling > > pmc_process_interrupt takes 5 arguments when only 3 are needed. > cpu is always available in curcpu and inuserspace can always be > derived from the passed trapframe. > > While facially a reasonable cleanup this change was motivated > by the need to workaround a compiler bug. What is the compiler bug? Do you have disassembly of the subroutines in question? > > core2_intr(cpu, tf) -> > pmc_process_interrupt(cpu, ring, pmc, tf, inuserspace) -> > pmc_add_sample(cpu, ring, pm, tf, inuserspace) > > In the process of optimizing the tail call the tf pointer was getting > clobbered: > > (kgdb) up > at /storage/mmacy/devel/freebsd/sys/dev/hwpmc/hwpmc_mod.c:4709 > 4709pmc_save_kernel_callchain(ps->ps_pc, > (kgdb) up > 1205error = pmc_process_interrupt(cpu, PMC_HR, pm, tf, > > resulting in a crash in pmc_save_kernel_callchain. ___ 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: r334827 - in head/sys: amd64/amd64 arm/arm dev/hwpmc i386/i386 kern mips/atheros mips/cavium powerpc/powerpc sys
On Fri, Jun 08, 2018 at 09:07:53AM -0700, Matthew Macy wrote: > On Fri, Jun 8, 2018 at 07:35 Mark Johnston wrote: > > > On Fri, Jun 08, 2018 at 04:58:03AM +, Matt Macy wrote: > > > Author: mmacy > > > Date: Fri Jun 8 04:58:03 2018 > > > New Revision: 334827 > > > URL: https://svnweb.freebsd.org/changeset/base/334827 > > > > > > Log: > > > hwpmc: simplify calling convention for hwpmc interrupt handling > > > > > > pmc_process_interrupt takes 5 arguments when only 3 are needed. > > > cpu is always available in curcpu and inuserspace can always be > > > derived from the passed trapframe. > > > > > > While facially a reasonable cleanup this change was motivated > > > by the need to workaround a compiler bug. > > > > What is the compiler bug? Do you have disassembly of the subroutines in > > question? > > > > We talked about this online. Not in any more detail than is present in the commit message. > How would that help without engaging in a huge > diversion in to the toolchain? If you can provide C code and point to the bug in the disassembly, that should be enough for an LLVM bug report. I don't think that's a huge diversion. > There is nothing wrong with the C code so I > resorted to a voodoo fix to get hwpmc working again. If you're volunteering > mjg or I or you can disassemble the code prior to my change. I'll volunteer to look at the disassembly, sure. "Nothing wrong with the C code" isn't the bar for claiming a compiler bug though. The fact that our NMI handler isn't re-entrant can lead to subtle problems. If while executing the NMI handler we hit a dtrace probe or DDB breakpoint, the iret executed upon return to the handler will re-enable NMIs. Then, if a second NMI arrives before the handler for the first has returned, the trapframe will be clobbered. Did you rule out an issue like this? ___ 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: r334846 - head/share/man/man4
Author: markj Date: Fri Jun 8 17:55:06 2018 New Revision: 334846 URL: https://svnweb.freebsd.org/changeset/base/334846 Log: Correct the list of supported drivers. - bnxt(4) is supported via iflib. - mlx4en(4) support has not yet been committed. Modified: head/share/man/man4/netdump.4 Modified: head/share/man/man4/netdump.4 == --- head/share/man/man4/netdump.4 Fri Jun 8 17:41:49 2018 (r334845) +++ head/share/man/man4/netdump.4 Fri Jun 8 17:55:06 2018 (r334846) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 17, 2018 +.Dd June 8, 2018 .Dt NETDUMP 4 .Os .Sh NAME @@ -99,12 +99,12 @@ message to the server. The following network drivers support netdump: .Xr alc 4 , .Xr bge 4 , +.Xr bnxt 4 , .Xr bxe 4 , .Xr cxgb 4 , .Xr em 4 , .Xr igb 4 , .Xr ix 4 , -.Xr mlx4en 4 , .Xr re 4 , .Xr vtnet 4 . .Sh SYSCTL VARIABLES ___ 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: r334708 - head/sys/kern
On Fri, Jun 08, 2018 at 08:37:55PM +0300, Konstantin Belousov wrote: > On Thu, Jun 07, 2018 at 11:02:29PM -0700, Ryan Libby wrote: > > On Thu, Jun 7, 2018 at 10:03 PM, Mateusz Guzik wrote: > > > Checking it without any locks is perfectly valid in this case. It is done > > > after v_holdcnt gets bumped from a non-zero value. So at that time it > > > is at least two. Of course that result is stale as an arbitrary number of > > > other threads could have bumped and dropped the ref past that point. > > > The minimum value is 1 since we hold the ref. But this means the > > > vnode must not be on the free list and that's what the assertion is > > > verifying. > > > > > > The problem is indeed lack of ordering against the code clearing the > > > flag for the case where 2 threads to vhold and one does the 0->1 > > > transition. > > > > > > That said, the fence is required for the assertion to work. > > > > > > > Yeah, I agree with this logic. What I mean is that reordering between > > v_holdcnt 0->1 and v_iflag is normally settled by the release and > > acquisition of the vnode interlock, which we are supposed to hold for > > v_*i*flag. A quick scan seems to show all of the checks of VI_FREE that > > are not asserts do hold the vnode interlock. So, I'm just saying that I > > don't think the possible reordering affects them. > But do we know that only VI_FREE checks are affected ? > > My concern is that users of _vhold() rely on seeing up to date state of the > vnode, and VI_FREE is only an example of the problem. Most likely, the > code which fetched the vnode pointer before _vhold() call, should guarantee > visibility. Wouldn't this be a problem only if we permit lockless accesses of vnode state outside of _vhold() and other vnode subroutines? The current protocol requires that the interlock be held, and this synchronizes with code which performs 0->1 and 1->0 transitions of the hold count. If this requirement is relaxed in the future, then fences would indeed be needed. ___ 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: r334883 - head/cddl/contrib/opensolaris/tools/ctf/cvt
Author: markj Date: Sat Jun 9 15:10:49 2018 New Revision: 334883 URL: https://svnweb.freebsd.org/changeset/base/334883 Log: Don't process DWARF generated from non-C/C++ code. ctfconvert(1) is not designed to handle DWARF generated from such code, and will generally fail in non-obvious ways. Use an explicit check to help catch such potential failures. Reported by: Johannes Lundberg MFC after:2 weeks Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c == --- head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c Sat Jun 9 15:10:39 2018(r334882) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c Sat Jun 9 15:10:49 2018(r334883) @@ -1901,7 +1901,7 @@ should_have_dwarf(Elf *elf) int dw_read(tdata_t *td, Elf *elf, char *filename __unused) { - Dwarf_Unsigned abboff, hdrlen, nxthdr; + Dwarf_Unsigned abboff, hdrlen, lang, nxthdr; Dwarf_Half vers, addrsz, offsz; Dwarf_Die cu = 0; Dwarf_Die child = 0; @@ -1941,8 +1941,8 @@ dw_read(tdata_t *td, Elf *elf, char *filename __unused } if ((rc = dwarf_next_cu_header_b(dw.dw_dw, &hdrlen, &vers, &abboff, - &addrsz, &offsz, NULL, &nxthdr, &dw.dw_err)) != DW_DLV_OK) { - if (dw.dw_err.err_error == DW_DLE_NO_ENTRY) + &addrsz, &offsz, NULL, &nxthdr, &dw.dw_err)) != DW_DLV_OK) { + if (dw.dw_err.err_error == DW_DLE_NO_ENTRY) exit(0); else terminate("rc = %d %s\n", rc, dwarf_errmsg(dw.dw_err)); @@ -1971,6 +1971,25 @@ dw_read(tdata_t *td, Elf *elf, char *filename __unused debug(1, "DWARF emitter: %s\n", prod); free(prod); } + + if (dwarf_attrval_unsigned(cu, DW_AT_language, &lang, &dw.dw_err) == 0) + switch (lang) { + case DW_LANG_C: + case DW_LANG_C89: + case DW_LANG_C99: + case DW_LANG_C11: + case DW_LANG_C_plus_plus: + case DW_LANG_C_plus_plus_03: + case DW_LANG_C_plus_plus_11: + case DW_LANG_C_plus_plus_14: + break; + default: + terminate("file contains DWARF for unsupported " + "language %d", lang); + } + else + warning("die %llu: failed to get language attribute: %s\n", + die_off(&dw, cu), dwarf_errmsg(dw.dw_err)); if ((dw.dw_cuname = die_name(&dw, cu)) != NULL) { char *base = xstrdup(basename(dw.dw_cuname)); ___ 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: r334881 - head/contrib/elftoolchain/libdwarf
Author: markj Date: Sat Jun 9 14:50:38 2018 New Revision: 334881 URL: https://svnweb.freebsd.org/changeset/base/334881 Log: Add DW_LANG_* definitions from DWARF 4 and 5. Reviewed by: emaste MFC after:1 week Differential Revision:https://reviews.freebsd.org/D15712 Modified: head/contrib/elftoolchain/libdwarf/dwarf.h head/contrib/elftoolchain/libdwarf/dwarf_dump.c Modified: head/contrib/elftoolchain/libdwarf/dwarf.h == --- head/contrib/elftoolchain/libdwarf/dwarf.h Sat Jun 9 14:47:49 2018 (r334880) +++ head/contrib/elftoolchain/libdwarf/dwarf.h Sat Jun 9 14:50:38 2018 (r334881) @@ -523,6 +523,24 @@ #define DW_LANG_ObjC_plus_plus 0x0011 #define DW_LANG_UPC0x0012 #define DW_LANG_D 0x0013 +#define DW_LANG_Python 0x0014 +#define DW_LANG_OpenCL 0x0015 +#define DW_LANG_Go 0x0016 +#define DW_LANG_Modula30x0017 +#define DW_LANG_Haskell0x0018 +#define DW_LANG_C_plus_plus_03 0x0019 +#define DW_LANG_C_plus_plus_11 0x001a +#define DW_LANG_OCaml 0x001b +#define DW_LANG_Rust 0x001c +#define DW_LANG_C110x001d +#define DW_LANG_Swift 0x001e +#define DW_LANG_Julia 0x001f +#define DW_LANG_Dylan 0x0020 +#define DW_LANG_C_plus_plus_14 0x0021 +#define DW_LANG_Fortran03 0x0022 +#define DW_LANG_Fortran08 0x0023 +#define DW_LANG_RenderScript 0x0024 +#define DW_LANG_BLISS 0x0025 #define DW_LANG_lo_user0x8000 #define DW_LANG_Mips_Assembler 0x8001 #define DW_LANG_hi_user0x Modified: head/contrib/elftoolchain/libdwarf/dwarf_dump.c == --- head/contrib/elftoolchain/libdwarf/dwarf_dump.c Sat Jun 9 14:47:49 2018(r334880) +++ head/contrib/elftoolchain/libdwarf/dwarf_dump.c Sat Jun 9 14:50:38 2018(r334881) @@ -788,6 +788,42 @@ dwarf_get_LANG_name(unsigned lang, const char **s) *s = "DW_LANG_UPC"; break; case DW_LANG_D: *s = "DW_LANG_D"; break; + case DW_LANG_Python: + *s = "DW_LANG_Python"; break; + case DW_LANG_OpenCL: + *s = "DW_LANG_OpenCL"; break; + case DW_LANG_Go: + *s = "DW_LANG_Go"; break; + case DW_LANG_Modula3: + *s = "DW_LANG_Modula3"; break; + case DW_LANG_Haskell: + *s = "DW_LANG_Haskell"; break; + case DW_LANG_C_plus_plus_03: + *s = "DW_LANG_C_plus_plus_03"; break; + case DW_LANG_C_plus_plus_11: + *s = "DW_LANG_C_plus_plus_11"; break; + case DW_LANG_OCaml: + *s = "DW_LANG_OCaml"; break; + case DW_LANG_Rust: + *s = "DW_LANG_Rust"; break; + case DW_LANG_C11: + *s = "DW_LANG_C11"; break; + case DW_LANG_Swift: + *s = "DW_LANG_Swift"; break; + case DW_LANG_Julia: + *s = "DW_LANG_Julia"; break; + case DW_LANG_Dylan: + *s = "DW_LANG_Dylan"; break; + case DW_LANG_C_plus_plus_14: + *s = "DW_LANG_C_plus_plus_14"; break; + case DW_LANG_Fortran03: + *s = "DW_LANG_Fortran03"; break; + case DW_LANG_Fortran08: + *s = "DW_LANG_Fortran08"; break; + case DW_LANG_RenderScript: + *s = "DW_LANG_RenderScript"; break; + case DW_LANG_BLISS: + *s = "DW_LANG_BLISS"; break; case DW_LANG_lo_user: *s = "DW_LANG_lo_user"; break; case DW_LANG_Mips_Assembler: ___ 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: r334827 - in head/sys: amd64/amd64 arm/arm dev/hwpmc i386/i386 kern mips/atheros mips/cavium powerpc/powerpc sys
On Sat, Jun 09, 2018 at 08:11:15AM -0400, John Baldwin wrote: > On 6/8/18 12:34 PM, Matthew Macy wrote: > >> The fact that our NMI handler isn't re-entrant can lead to subtle > >> problems. If while executing the NMI handler we hit a dtrace > >> probe or DDB breakpoint, the iret executed upon return to the handler > >> will re-enable NMIs. Then, if a second NMI arrives before the handler > >> for the first has returned, the trapframe will be clobbered. Did you > >> rule out an issue like this? > > > > No, but it happened instantly on all CPUs an a non-debug kernel 100% > > of the time after I changed pmc_process_interrupt earlier this week. > > My voodoo fix now avoids it. What you're describing sounds episodic > > and doesn't sound like it would be fixed / worked around by my change. > > OTOH, a compiler bug will crop up in other places. It is best to run > it to ground. Can you describe what the bug was in more detail? > It would probably not be hard to come up with something you can run > creduce against to get down to a test case. If you do that, the > LLVM folks are quite helpful and able at fixing the issue which fixes > it in more places than just here. The bug is the rdtscp() intrinsic added in r334746 is wrong. It was just copied from rdtsc(), but unlike rdtsc, rdtscp clobbers rcx, which is the register containing the tf pointer. ___ 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: r334883 - head/cddl/contrib/opensolaris/tools/ctf/cvt
On Sat, Jun 09, 2018 at 07:35:00PM +0200, O. Hartmann wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA512 > > Am Sat, 9 Jun 2018 15:10:49 +0000 (UTC) > Mark Johnston schrieb: > > > Author: markj > > Date: Sat Jun 9 15:10:49 2018 > > New Revision: 334883 > > URL: https://svnweb.freebsd.org/changeset/base/334883 > > > > Log: > > Don't process DWARF generated from non-C/C++ code. > > > > ctfconvert(1) is not designed to handle DWARF generated from such code, > > and will generally fail in non-obvious ways. Use an explicit check to > > help catch such potential failures. > > > > Reported by: Johannes Lundberg > > MFC after:2 weeks > > > > Modified: > > head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c > > > > Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c > > == > > --- head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c Sat Jun 9 > > 15:10:39 > > 2018(r334882) +++ > > head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c > > Sat Jun 9 15:10:49 2018(r334883) @@ -1901,7 +1901,7 @@ > > should_have_dwarf(Elf > > *elf) int > > dw_read(tdata_t *td, Elf *elf, char *filename __unused) > > { > > - Dwarf_Unsigned abboff, hdrlen, nxthdr; > > + Dwarf_Unsigned abboff, hdrlen, lang, nxthdr; > > Dwarf_Half vers, addrsz, offsz; > > Dwarf_Die cu = 0; > > Dwarf_Die child = 0; > > @@ -1941,8 +1941,8 @@ dw_read(tdata_t *td, Elf *elf, char *filename __unused > > } > > > > if ((rc = dwarf_next_cu_header_b(dw.dw_dw, &hdrlen, &vers, &abboff, > > - &addrsz, &offsz, NULL, &nxthdr, &dw.dw_err)) != DW_DLV_OK) { > > - if (dw.dw_err.err_error == DW_DLE_NO_ENTRY) > > + &addrsz, &offsz, NULL, &nxthdr, &dw.dw_err)) != DW_DLV_OK) { > > + if (dw.dw_err.err_error == DW_DLE_NO_ENTRY) > > exit(0); > > else > > terminate("rc = %d %s\n", rc, dwarf_errmsg(dw.dw_err)); > > @@ -1971,6 +1971,25 @@ dw_read(tdata_t *td, Elf *elf, char *filename > > __unused > > debug(1, "DWARF emitter: %s\n", prod); > > free(prod); > > } > > + > > + if (dwarf_attrval_unsigned(cu, DW_AT_language, &lang, &dw.dw_err) == 0) > > + switch (lang) { > > + case DW_LANG_C: > > + case DW_LANG_C89: > > + case DW_LANG_C99: > > + case DW_LANG_C11: > > + case DW_LANG_C_plus_plus: > > + case DW_LANG_C_plus_plus_03: > > + case DW_LANG_C_plus_plus_11: > > + case DW_LANG_C_plus_plus_14: > > + break; > > + default: > > + terminate("file contains DWARF for unsupported " > > + "language %d", lang); > > + } > > + else > > + warning("die %llu: failed to get language attribute: %s\n", > > + die_off(&dw, cu), dwarf_errmsg(dw.dw_err)); > > > > if ((dw.dw_cuname = die_name(&dw, cu)) != NULL) { > > char *base = xstrdup(basename(dw.dw_cuname)); > > ___ > > 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" > This commit makes buildworld (WITH_META_MODE) failing: I added these identifiers in r334881, and the CI build is passing. Might this be a problem with META_MODE? > [...] > ===> cddl/usr.bin/ctfconvert (obj,all,install) > Building > /usr/obj/usr/src/amd64.amd64/tmp/obj-tools/cddl/usr.bin/ctfconvert/dwarf.o > - --- dwarf.o --- > /usr/src/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1980:8: error: use of > undeclared > identifier 'DW_LANG_C11' case DW_LANG_C11: > ^ > /usr/src/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1982:8: error: use of > undeclared > identifier 'DW_LANG_C_plus_plus_03' case DW_LANG_C_plus_plus_03: > ^ > /usr/src/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1983:8: error: use of > undeclared > identifier 'DW_LANG_C_plus_plus_11' case DW_LANG_C_plus_plus_11: > ^ > /usr/src/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1984:8: error: use of > undeclared > identifier 'DW_LANG_C_plus_plus_14' case DW_LANG_C_plus_plus_14: > ^ > 4 errors generated. > *** [dwarf.o] Error code 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"
Re: svn commit: r334883 - head/cddl/contrib/opensolaris/tools/ctf/cvt
On Sat, Jun 09, 2018 at 01:56:18PM -0400, Bryan Drewery wrote: > On 6/9/18 1:39 PM, Mark Johnston wrote: > > On Sat, Jun 09, 2018 at 07:35:00PM +0200, O. Hartmann wrote: > >> -BEGIN PGP SIGNED MESSAGE- > >> Hash: SHA512 > >> > >> Am Sat, 9 Jun 2018 15:10:49 + (UTC) > >> Mark Johnston schrieb: > >> > >>> Author: markj > >>> Date: Sat Jun 9 15:10:49 2018 > >>> New Revision: 334883 > >>> URL: https://svnweb.freebsd.org/changeset/base/334883 > >>> > >>> Log: > >>> Don't process DWARF generated from non-C/C++ code. > >>> > >>> ctfconvert(1) is not designed to handle DWARF generated from such code, > >>> and will generally fail in non-obvious ways. Use an explicit check to > >>> help catch such potential failures. > >>> > >>> Reported by:Johannes Lundberg > >>> MFC after: 2 weeks > >>> > >>> Modified: > >>> head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c > >>> > >>> Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c > >>> == > >>> --- head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c Sat Jun 9 > >>> 15:10:39 > >>> 2018 (r334882) +++ > >>> head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c > >>> Sat Jun 9 15:10:49 2018 (r334883) @@ -1901,7 +1901,7 @@ > >>> should_have_dwarf(Elf > >>> *elf) int > >>> dw_read(tdata_t *td, Elf *elf, char *filename __unused) > >>> { > >>> - Dwarf_Unsigned abboff, hdrlen, nxthdr; > >>> + Dwarf_Unsigned abboff, hdrlen, lang, nxthdr; > >>> Dwarf_Half vers, addrsz, offsz; > >>> Dwarf_Die cu = 0; > >>> Dwarf_Die child = 0; > >>> @@ -1941,8 +1941,8 @@ dw_read(tdata_t *td, Elf *elf, char *filename > >>> __unused > >>> } > >>> > >>> if ((rc = dwarf_next_cu_header_b(dw.dw_dw, &hdrlen, &vers, &abboff, > >>> - &addrsz, &offsz, NULL, &nxthdr, &dw.dw_err)) != DW_DLV_OK) { > >>> - if (dw.dw_err.err_error == DW_DLE_NO_ENTRY) > >>> + &addrsz, &offsz, NULL, &nxthdr, &dw.dw_err)) != DW_DLV_OK) { > >>> + if (dw.dw_err.err_error == DW_DLE_NO_ENTRY) > >>> exit(0); > >>> else > >>> terminate("rc = %d %s\n", rc, dwarf_errmsg(dw.dw_err)); > >>> @@ -1971,6 +1971,25 @@ dw_read(tdata_t *td, Elf *elf, char *filename > >>> __unused > >>> debug(1, "DWARF emitter: %s\n", prod); > >>> free(prod); > >>> } > >>> + > >>> + if (dwarf_attrval_unsigned(cu, DW_AT_language, &lang, &dw.dw_err) == 0) > >>> + switch (lang) { > >>> + case DW_LANG_C: > >>> + case DW_LANG_C89: > >>> + case DW_LANG_C99: > >>> + case DW_LANG_C11: > >>> + case DW_LANG_C_plus_plus: > >>> + case DW_LANG_C_plus_plus_03: > >>> + case DW_LANG_C_plus_plus_11: > >>> + case DW_LANG_C_plus_plus_14: > >>> + break; > >>> + default: > >>> + terminate("file contains DWARF for unsupported " > >>> + "language %d", lang); > >>> + } > >>> + else > >>> + warning("die %llu: failed to get language attribute: %s\n", > >>> + die_off(&dw, cu), dwarf_errmsg(dw.dw_err)); > >>> > >>> if ((dw.dw_cuname = die_name(&dw, cu)) != NULL) { > >>> char *base = xstrdup(basename(dw.dw_cuname)); > >>> ___ > >>> 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" > >> This commit makes buildworld (WITH_META_MODE) failing: > > > > I added these identifiers in r334881, and the CI build is passing. Might > > this be a problem with META_MODE? > > > >> [...] > >> ===> cddl/usr.bin/ctfconvert (obj,all,install) > >> Building > >> /usr/obj/usr/src/amd64.amd64/tmp/obj-tools/cddl/usr.bin/ctfconvert/dwarf.o > > obj-tools means it is trying to build a HOST NATIVE version of this. > Where are these defined? In this case they need to be defined in > /usr/include already unless the build has -I.CURDIR/somewhere/to/headers > instead. The definitions are in contrib/elftoolchain/libdwarf/dwarf.h. Indeed, the ctfconvert makefile doesn't explicitly add libdwarf to the include path. I'm surprised that this is necessary though - do I need to modify the BOOTSTRAPPING check for _elftoolchain_libs in Makefile.inc1? ___ 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: r334890 - in head/sys: amd64/include i386/include
Author: markj Date: Sat Jun 9 18:31:19 2018 New Revision: 334890 URL: https://svnweb.freebsd.org/changeset/base/334890 Log: Tell the compiler that rdtscp clobbers %ecx. Modified: head/sys/amd64/include/cpufunc.h head/sys/i386/include/cpufunc.h Modified: head/sys/amd64/include/cpufunc.h == --- head/sys/amd64/include/cpufunc.hSat Jun 9 18:11:46 2018 (r334889) +++ head/sys/amd64/include/cpufunc.hSat Jun 9 18:31:19 2018 (r334890) @@ -391,7 +391,7 @@ rdtscp(void) { uint32_t low, high; - __asm __volatile("rdtscp" : "=a" (low), "=d" (high)); + __asm __volatile("rdtscp" : "=a" (low), "=d" (high) : : "ecx"); return (low | ((uint64_t)high << 32)); } Modified: head/sys/i386/include/cpufunc.h == --- head/sys/i386/include/cpufunc.h Sat Jun 9 18:11:46 2018 (r334889) +++ head/sys/i386/include/cpufunc.h Sat Jun 9 18:31:19 2018 (r334890) @@ -373,7 +373,7 @@ rdtscp(void) { uint64_t rv; - __asm __volatile("rdtscp" : "=A" (rv)); + __asm __volatile("rdtscp" : "=A" (rv) : : "ecx"); return (rv); } ___ 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: r334892 - in head: . sys/sys
Author: markj Date: Sat Jun 9 20:01:03 2018 New Revision: 334892 URL: https://svnweb.freebsd.org/changeset/base/334892 Log: Bump __FreeBSD_version after r334881 and force libdwarf to be rebuilt. Reported by: O. Hartmann Reviewed by: bdrewery Modified: head/Makefile.inc1 head/sys/sys/param.h Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Sat Jun 9 19:51:09 2018(r334891) +++ head/Makefile.inc1 Sat Jun 9 20:01:03 2018(r334892) @@ -1843,7 +1843,8 @@ update: .PHONY # ELF Tool Chain libraries are needed for ELF tools and dtrace tools. # r296685 fix cross-endian objcopy # r310724 fixed PR 215350, a crash in libdwarf with objects built by GCC 6.2. -.if ${BOOTSTRAPPING} < 1200020 +# r334881 added libdwarf constants used by ctfconvert. +.if ${BOOTSTRAPPING} < 1200067 _elftoolchain_libs= lib/libelf lib/libdwarf .endif Modified: head/sys/sys/param.h == --- head/sys/sys/param.hSat Jun 9 19:51:09 2018(r334891) +++ head/sys/sys/param.hSat Jun 9 20:01:03 2018(r334892) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200066 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200067 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, ___ 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: r334883 - head/cddl/contrib/opensolaris/tools/ctf/cvt
On Sat, Jun 09, 2018 at 08:37:14PM +0200, O. Hartmann wrote: > I started on one of the faster boxes with a make cleanworld and tried then to > rebuild > world and kernel. It ends up at the very same error for me. I believe r334892 will fix the problem, please give it a try. Sorry for the breakage. ___ 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: r334929 - in head: . sys/sys
On Sun, Jun 10, 2018 at 06:38:48PM +, Eitan Adler wrote: > Author: eadler > Date: Sun Jun 10 18:38:48 2018 > New Revision: 334929 > URL: https://svnweb.freebsd.org/changeset/base/334929 > > Log: > include: remove sys/capability.h > > This file has only generated a warning for the last 18 months. Its > existence at this point only serves to confuse software looking for > POSIX.1e capabilities and produce actionless warnings. Don't you need an exp-run to make this claim? > Deleted: > head/sys/sys/capability.h > Modified: > head/ObsoleteFiles.inc ___ 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: r334959 - head/sys/dev/hwpmc
Author: markj Date: Mon Jun 11 16:27:09 2018 New Revision: 334959 URL: https://svnweb.freebsd.org/changeset/base/334959 Log: Use the cached curthread reference in pmc_process_interrupt(). Fix indentation while here. Modified: head/sys/dev/hwpmc/hwpmc_mod.c Modified: head/sys/dev/hwpmc/hwpmc_mod.c == --- head/sys/dev/hwpmc/hwpmc_mod.c Mon Jun 11 16:26:33 2018 (r334958) +++ head/sys/dev/hwpmc/hwpmc_mod.c Mon Jun 11 16:27:09 2018 (r334959) @@ -4748,9 +4748,9 @@ pmc_process_interrupt(int ring, struct pmc *pm, struct td = curthread; if ((pm->pm_flags & PMC_F_USERCALLCHAIN) && -(td->td_proc->p_flag & P_KPROC) == 0 && - !TRAPF_USERMODE(tf)) { - atomic_add_int(&curthread->td_pmcpend, 1); + (td->td_proc->p_flag & P_KPROC) == 0 && + !TRAPF_USERMODE(tf)) { + atomic_add_int(&td->td_pmcpend, 1); return (pmc_add_sample(PMC_UR, pm, tf)); } return (pmc_add_sample(ring, pm, tf)); ___ 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: r334961 - head/cddl/contrib/opensolaris/tools/ctf/cvt
Author: markj Date: Mon Jun 11 16:33:36 2018 New Revision: 334961 URL: https://svnweb.freebsd.org/changeset/base/334961 Log: Process CUs with a language attribute of DW_LANG_Mips_Assembler. At the moment ctfconvert(1) does not do much with such CUs, but that may not be true in the future, and we run ctfconvert on several assembly files during the build. X-MFC with: r334883 Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c == --- head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c Mon Jun 11 16:31:42 2018(r334960) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c Mon Jun 11 16:33:36 2018(r334961) @@ -1982,10 +1982,11 @@ dw_read(tdata_t *td, Elf *elf, char *filename __unused case DW_LANG_C_plus_plus_03: case DW_LANG_C_plus_plus_11: case DW_LANG_C_plus_plus_14: + case DW_LANG_Mips_Assembler: break; default: terminate("file contains DWARF for unsupported " - "language %d", lang); + "language %#x", lang); } else warning("die %llu: failed to get language attribute: %s\n", ___ 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: r334960 - head/sys/kern
On Mon, Jun 11, 2018 at 04:31:43PM +, Matt Macy wrote: > Author: mmacy > Date: Mon Jun 11 16:31:42 2018 > New Revision: 334960 > URL: https://svnweb.freebsd.org/changeset/base/334960 > > Log: > soreceive_stream: correctly handle edge cases > > - non NULL controlp is not an error, returning EINVAL > would cause X forwarding to fail > > - MSG_PEEK and MSG_WAITALL are fairly exceptional, but we still > want to handle them - punt to soreceive_generic > > Modified: > head/sys/kern/uipc_socket.c > > Modified: head/sys/kern/uipc_socket.c > == > --- head/sys/kern/uipc_socket.c Mon Jun 11 16:27:09 2018 > (r334959) > +++ head/sys/kern/uipc_socket.c Mon Jun 11 16:31:42 2018 > (r334960) > @@ -2162,7 +2162,6 @@ release: > > /* > * Optimized version of soreceive() for stream (TCP) sockets. > - * XXXAO: (MSG_WAITALL | MSG_PEEK) isn't properly handled. > */ > int > soreceive_stream(struct socket *so, struct sockaddr **psa, struct uio *uio, > @@ -2177,12 +2176,14 @@ soreceive_stream(struct socket *so, struct sockaddr ** > return (EINVAL); > if (psa != NULL) > *psa = NULL; > - if (controlp != NULL) > - return (EINVAL); > if (flagsp != NULL) > flags = *flagsp &~ MSG_EOR; > else > flags = 0; > + if (flags & (MSG_PEEK|MSG_WAITALL)) > + return (soreceive_generic(so, psa, uio, mp0, controlp, flagsp)); > + if (controlp != NULL) > + *controlp = NULL; Now soreceive_stream() contains dead code to handle MSG_WAITALL, and a bunch of always-true checks for both flags. Changes to this code should be reviewed. ___ 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: r334046 - head/tools/tools/intel-ucode-split
On Wed, Jun 13, 2018 at 01:46:34AM +0200, Oliver Pinter wrote: > On Wednesday, June 13, 2018, Ed Maste wrote: > > > On Tue, 12 Jun 2018 at 18:17, Sean Bruno wrote: > > > > > > On 06/12/18 16:05, Oliver Pinter wrote: > > > > On 5/22/18, Ed Maste wrote: > > > >> Author: emaste > > > >> Date: Tue May 22 14:35:33 2018 > > > >> New Revision: 334046 > > > >> URL: https://svnweb.freebsd.org/changeset/base/334046 > > > >> > > > >> Log: > > > >> intel-ucode-split: add -n flag to skip creating output files > > > >> > > > >> Sponsored by: The FreeBSD Foundation > > > >> > > > >> Modified: > > > >> head/tools/tools/intel-ucode-split/intel-ucode-split.c > > > > > > > > Hi! > > > > > > > > Could you please MFC the intel-ucode-split related commits to > > 11-STABLE? > > > > > > > > Thanks, > > > > op > > > > > > Do you need it in base for some reason? This code is already in the > > > devcpu-data port and is used when the port is built. Its not needed for > > > anything AFAIK. > > > > Indeed, the real use in FreeBSD is via the devcpu-data port; I > > committed it to src/tools/ for collaboration and testing. I'll merge > > it to stable/11 if it will be useful for someone, but am curious about > > the use case. > > > > > I'm considering to write an in kernel microcode update facility, based on > firmware(9), and in first idea it would be nice during the generation of > firmware modules. FWIW, I'm working on this for 12.0 and was planning to describe my proposal on -arch in the next couple of weeks. For my purposes at least, firmware(9) isn't suitable. We'd like to ensure that updates are applied before the kernel does CPU identification, and that happens quite early during boot. This places some constraints on the implementation which exclude firmware(9). ___ 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: r334046 - head/tools/tools/intel-ucode-split
On Sat, Jun 16, 2018 at 06:25:03PM -0700, Eitan Adler wrote: > On 13 June 2018 at 07:07, Mark Johnston wrote: > > On Wed, Jun 13, 2018 at 01:46:34AM +0200, Oliver Pinter wrote: > >> On Wednesday, June 13, 2018, Ed Maste wrote: > >> > >> > On Tue, 12 Jun 2018 at 18:17, Sean Bruno wrote: > >> > > > >> > > On 06/12/18 16:05, Oliver Pinter wrote: > >> > > > On 5/22/18, Ed Maste wrote: > >> > > >> Author: emaste > >> > > >> Date: Tue May 22 14:35:33 2018 > >> > > >> New Revision: 334046 > >> > > >> URL: https://svnweb.freebsd.org/changeset/base/334046 > >> > > >> > >> > > >> Log: > >> > > >> intel-ucode-split: add -n flag to skip creating output files > >> > > >> > >> > > >> Sponsored by: The FreeBSD Foundation > >> > > >> > >> > > >> Modified: > >> > > >> head/tools/tools/intel-ucode-split/intel-ucode-split.c > >> > > > > >> > > > Hi! > >> > > > > >> > > > Could you please MFC the intel-ucode-split related commits to > >> > 11-STABLE? > >> > > > > >> > > > Thanks, > >> > > > op > >> > > > >> > > Do you need it in base for some reason? This code is already in the > >> > > devcpu-data port and is used when the port is built. Its not needed > >> > > for > >> > > anything AFAIK. > >> > > >> > Indeed, the real use in FreeBSD is via the devcpu-data port; I > >> > committed it to src/tools/ for collaboration and testing. I'll merge > >> > it to stable/11 if it will be useful for someone, but am curious about > >> > the use case. > >> > > >> > >> > >> I'm considering to write an in kernel microcode update facility, based on > >> firmware(9), and in first idea it would be nice during the generation of > >> firmware modules. > > > > FWIW, I'm working on this for 12.0 and was planning to describe my > > proposal on -arch in the next couple of weeks. For my purposes at > > least, firmware(9) isn't suitable. We'd like to ensure that updates are > > applied before the kernel does CPU identification, and that happens > > quite early during boot. This places some constraints on the > > implementation which exclude firmware(9). > > Naive question, knowing nothing about firmware(9), but why can't it be > enhanced to work that early? It seems there might be other use-cases > for very-early-boot firmware application. The constraint means that almost none of the standard kernel APIs (e.g., malloc()) are usable at the time that the update is to be applied. It doesn't seem practical to me to try and implement firmware(9)'s abstractions under such limitations. Further, because microcode updating is an platform-specific operation, in this case it's preferable to tie the implementation to that platform's code. ___ 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: r334046 - head/tools/tools/intel-ucode-split
On Sun, Jun 17, 2018 at 02:50:44PM +0200, Oliver Pinter wrote: > On Sunday, June 17, 2018, Mark Johnston wrote: > > > On Sat, Jun 16, 2018 at 06:25:03PM -0700, Eitan Adler wrote: > > > On 13 June 2018 at 07:07, Mark Johnston wrote: > > > > On Wed, Jun 13, 2018 at 01:46:34AM +0200, Oliver Pinter wrote: > > > >> I'm considering to write an in kernel microcode update facility, > > based on > > > >> firmware(9), and in first idea it would be nice during the generation > > of > > > >> firmware modules. > > > > > > > > FWIW, I'm working on this for 12.0 and was planning to describe my > > > > proposal on -arch in the next couple of weeks. For my purposes at > > > > least, firmware(9) isn't suitable. We'd like to ensure that updates > > are > > > > applied before the kernel does CPU identification, and that happens > > > > quite early during boot. This places some constraints on the > > > > implementation which exclude firmware(9). > > > > > > Naive question, knowing nothing about firmware(9), but why can't it be > > > enhanced to work that early? It seems there might be other use-cases > > > for very-early-boot firmware application. > > > > The constraint means that almost none of the standard kernel APIs (e.g., > > malloc()) are usable at the time that the update is to be applied. It > > doesn't seem practical to me to try and implement firmware(9)'s > > abstractions under such limitations. Further, because microcode > > updating is an platform-specific operation, in this case it's preferable > > to tie the implementation to that platform's code. > > > How do you plan to put the firmware into memory? Preload it with the loader > or compile into kernel module or with somehow early fs access from kernel? > > Or instead of updating the microcode from kernel, do the whole process from > the loader? > This will be problematic in resume case. The loader can be instructed to load arbitrary files into memory before beginning execution of the kernel. Currently, my plan is to check for a loaded microcode file early in the MD startup code, and apply the update if one is present. This will be done following a resume as well. ___ 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: r335580 - in head/sys: amd64/amd64 arm64/arm64
Author: markj Date: Sat Jun 23 10:41:52 2018 New Revision: 335580 URL: https://svnweb.freebsd.org/changeset/base/335580 Log: Re-count available PV entries after reclaiming a PV chunk. The call to reclaim_pv_chunk() in reserve_pv_entries() may free a PV chunk with free entries belonging to the current pmap. In this case we must account for the free entries that were reclaimed, or reserve_pv_entries() may return without having reserved the requested number of entries. Reviewed by: alc, kib Tested by:pho (previous version) MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D15911 Modified: head/sys/amd64/amd64/pmap.c head/sys/arm64/arm64/pmap.c Modified: head/sys/amd64/amd64/pmap.c == --- head/sys/amd64/amd64/pmap.c Sat Jun 23 08:10:09 2018(r335579) +++ head/sys/amd64/amd64/pmap.c Sat Jun 23 10:41:52 2018(r335580) @@ -3539,8 +3539,9 @@ reserve_pv_entries(pmap_t pmap, int needed, struct rwl { struct pch new_tail; struct pv_chunk *pc; - int avail, free; vm_page_t m; + int avail, free; + bool reclaimed; PMAP_LOCK_ASSERT(pmap, MA_OWNED); KASSERT(lockp != NULL, ("reserve_pv_entries: lockp is NULL")); @@ -3568,13 +3569,14 @@ retry: if (avail >= needed) break; } - for (; avail < needed; avail += _NPCPV) { + for (reclaimed = false; avail < needed; avail += _NPCPV) { m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); if (m == NULL) { m = reclaim_pv_chunk(pmap, lockp); if (m == NULL) goto retry; + reclaimed = true; } PV_STAT(atomic_add_int(&pc_chunk_count, 1)); PV_STAT(atomic_add_int(&pc_chunk_allocs, 1)); @@ -3587,6 +3589,14 @@ retry: TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); TAILQ_INSERT_TAIL(&new_tail, pc, pc_lru); PV_STAT(atomic_add_int(&pv_entry_spare, _NPCPV)); + + /* +* The reclaim might have freed a chunk from the current pmap. +* If that chunk contained available entries, we need to +* re-count the number of available entries. +*/ + if (reclaimed) + goto retry; } if (!TAILQ_EMPTY(&new_tail)) { mtx_lock(&pv_chunks_mutex); Modified: head/sys/arm64/arm64/pmap.c == --- head/sys/arm64/arm64/pmap.c Sat Jun 23 08:10:09 2018(r335579) +++ head/sys/arm64/arm64/pmap.c Sat Jun 23 10:41:52 2018(r335580) @@ -2083,8 +2083,9 @@ reserve_pv_entries(pmap_t pmap, int needed, struct rwl { struct pch new_tail; struct pv_chunk *pc; - int avail, free; vm_page_t m; + int avail, free; + bool reclaimed; PMAP_LOCK_ASSERT(pmap, MA_OWNED); KASSERT(lockp != NULL, ("reserve_pv_entries: lockp is NULL")); @@ -2107,13 +2108,14 @@ retry: if (avail >= needed) break; } - for (; avail < needed; avail += _NPCPV) { + for (reclaimed = false; avail < needed; avail += _NPCPV) { m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); if (m == NULL) { m = reclaim_pv_chunk(pmap, lockp); if (m == NULL) goto retry; + reclaimed = true; } PV_STAT(atomic_add_int(&pc_chunk_count, 1)); PV_STAT(atomic_add_int(&pc_chunk_allocs, 1)); @@ -2126,6 +2128,14 @@ retry: TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); TAILQ_INSERT_TAIL(&new_tail, pc, pc_lru); PV_STAT(atomic_add_int(&pv_entry_spare, _NPCPV)); + + /* +* The reclaim might have freed a chunk from the current pmap. +* If that chunk contained available entries, we need to +* re-count the number of available entries. +*/ + if (reclaimed) + goto retry; } if (!TAILQ_EMPTY(&new_tail)) { mtx_lock(&pv_chunks_mutex); ___ 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: r326286 - head/sys/cddl/dev/dtrace
On Mon, Nov 27, 2017 at 11:28:07AM -0800, John Baldwin wrote: > On Monday, November 27, 2017 06:42:23 PM Mark Johnston wrote: > > Author: markj > > Date: Mon Nov 27 18:42:23 2017 > > New Revision: 326286 > > URL: https://svnweb.freebsd.org/changeset/base/326286 > > > > Log: > > Don't use pcpu_find() to determine if a CPU ID is valid. > > > > This addresses assertion failures after r326218. > > I'd perhaps rather revert the assertion as per my other mail? I considered waiting for a resolution of that thread, but it seems to me that using CPU_FOREACH()/CPU_ABSENT() is more idiomatic anyway? We already use CPU_FOREACH() in a few places in dtrace.c, and dtrace_ioctl.c is meant to be a fork of the ioctl handler from illumos, i.e., we shouldn't make much effort to avoid diverging from upstream. ___ 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: r326367 - head/sys/vm
Author: markj Date: Wed Nov 29 14:34:05 2017 New Revision: 326367 URL: https://svnweb.freebsd.org/changeset/base/326367 Log: Remove some comments that became incorrect with r325530. Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c == --- head/sys/vm/vm_page.c Wed Nov 29 14:25:17 2017(r326366) +++ head/sys/vm/vm_page.c Wed Nov 29 14:34:05 2017(r326367) @@ -1593,8 +1593,6 @@ vm_page_rename(vm_page_t m, vm_object_t new_object, vm * VM_ALLOC_SBUSY shared busy the allocated page * VM_ALLOC_WIRED wire the allocated page * VM_ALLOC_ZERO prefer a zeroed page - * - * This routine may not sleep. */ vm_page_t vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req) @@ -1831,8 +1829,6 @@ again: * VM_ALLOC_SBUSY shared busy the allocated page * VM_ALLOC_WIRED wire the allocated page * VM_ALLOC_ZERO prefer a zeroed page - * - * This routine may not sleep. */ vm_page_t vm_page_alloc_contig(vm_object_t object, vm_pindex_t pindex, int req, @@ -2045,8 +2041,6 @@ vm_page_alloc_check(vm_page_t m) * intends to allocate * VM_ALLOC_WIRED wire the allocated page * VM_ALLOC_ZERO prefer a zeroed page - * - * This routine may not sleep. */ vm_page_t vm_page_alloc_freelist(int flind, int req) ___ 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: r326371 - head/sys/vm
Author: markj Date: Wed Nov 29 19:47:09 2017 New Revision: 326371 URL: https://svnweb.freebsd.org/changeset/base/326371 Log: Verify the object/vnode association after vget() in vm_pageout_clean(). It's theoretically possible for the vnode and object to be disassociated while locks are dropped around the vget() call, in which case we shouldn't proceed with laundering. Noted and reviewed by:kib MFC after:1 week Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cWed Nov 29 18:21:17 2017(r326370) +++ head/sys/vm/vm_pageout.cWed Nov 29 19:47:09 2017(r326371) @@ -647,7 +647,17 @@ vm_pageout_clean(vm_page_t m, int *numpagedout) goto unlock_mp; } VM_OBJECT_WLOCK(object); + + /* +* Ensure that the object and vnode were not disassociated +* while locks were dropped. +*/ + if (vp->v_object != object) { + error = ENOENT; + goto unlock_all; + } vm_page_lock(m); + /* * While the object and page were unlocked, the page * may have been: ___ 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: r326409 - head/sys/geom/mirror
Author: markj Date: Thu Nov 30 20:36:29 2017 New Revision: 326409 URL: https://svnweb.freebsd.org/changeset/base/326409 Log: Update gmirror metadata less frequently when synchronizing. We periodically record synchronization progress in the metadata block of the disk being synchronized; this allows an interrupted synchronization to be resumed. However, the frequency of these updates heavily pessimized synchronization time on some media. This change modifies gmirror to update metadata based on a time period, and adds a sysctl to control that period. The default value results in a much lower update frequency and increases the completion time for an interrupted rebuild only marginally. Reported by: Andre Albsmeier MFC after:3 weeks Modified: head/sys/geom/mirror/g_mirror.c head/sys/geom/mirror/g_mirror.h Modified: head/sys/geom/mirror/g_mirror.c == --- head/sys/geom/mirror/g_mirror.c Thu Nov 30 20:33:45 2017 (r326408) +++ head/sys/geom/mirror/g_mirror.c Thu Nov 30 20:36:29 2017 (r326409) @@ -71,6 +71,10 @@ SYSCTL_UINT(_kern_geom_mirror, OID_AUTO, disconnect_on static u_int g_mirror_syncreqs = 2; SYSCTL_UINT(_kern_geom_mirror, OID_AUTO, sync_requests, CTLFLAG_RDTUN, &g_mirror_syncreqs, 0, "Parallel synchronization I/O requests."); +static u_int g_mirror_sync_period = 5; +SYSCTL_UINT(_kern_geom_mirror, OID_AUTO, sync_update_period, CTLFLAG_RWTUN, +&g_mirror_sync_period, 0, +"Metadata update period during synchroniztion, in seconds"); #defineMSLEEP(ident, mtx, priority, wmesg, timeout)do { \ G_MIRROR_DEBUG(4, "%s: Sleeping %p.", __func__, (ident)); \ @@ -465,6 +469,7 @@ g_mirror_init_disk(struct g_mirror_softc *sc, struct g disk->d_sync.ds_consumer = NULL; disk->d_sync.ds_offset = md->md_sync_offset; disk->d_sync.ds_offset_done = md->md_sync_offset; + disk->d_sync.ds_update_ts = time_uptime; disk->d_genid = md->md_genid; disk->d_sync.ds_syncid = md->md_syncid; if (errorp != NULL) @@ -1459,10 +1464,11 @@ g_mirror_sync_request(struct bio *bp) if (bp != NULL && bp->bio_offset < offset) offset = bp->bio_offset; } - if (sync->ds_offset_done + (MAXPHYS * 100) < offset) { - /* Update offset_done on every 100 blocks. */ + if (g_mirror_sync_period > 0 && + time_uptime - sync->ds_update_ts > g_mirror_sync_period) { sync->ds_offset_done = offset; g_mirror_update_metadata(disk); + sync->ds_update_ts = time_uptime; } return; } Modified: head/sys/geom/mirror/g_mirror.h == --- head/sys/geom/mirror/g_mirror.h Thu Nov 30 20:33:45 2017 (r326408) +++ head/sys/geom/mirror/g_mirror.h Thu Nov 30 20:36:29 2017 (r326409) @@ -110,6 +110,7 @@ struct g_mirror_disk_sync { off_t ds_offset;/* Offset of next request to send. */ off_t ds_offset_done; /* Offset of already synchronized region. */ + time_tds_update_ts; /* Time of last metadata update. */ u_int ds_syncid;/* Disk's synchronization ID. */ u_int ds_inflight; /* Number of in-flight sync requests. */ struct bio **ds_bios; /* BIOs for synchronization I/O. */ ___ 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: r326410 - head/sbin/geom/class/mirror
Author: markj Date: Thu Nov 30 20:37:12 2017 New Revision: 326410 URL: https://svnweb.freebsd.org/changeset/base/326410 Log: Document gmirror sysctls. MFC after:2 weeks Modified: head/sbin/geom/class/mirror/gmirror.8 Modified: head/sbin/geom/class/mirror/gmirror.8 == --- head/sbin/geom/class/mirror/gmirror.8 Thu Nov 30 20:36:29 2017 (r326409) +++ head/sbin/geom/class/mirror/gmirror.8 Thu Nov 30 20:37:12 2017 (r326410) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 27, 2016 +.Dd November 30, 2017 .Dt GMIRROR 8 .Os .Sh NAME @@ -179,7 +179,7 @@ Defaults to 4096 bytes. Clear metadata on the given providers. .It Cm create Similar to -.Cm label, +.Cm label , but creates mirror without storing on-disk metadata in last sector. This special "manual" operation mode assumes some external control to manage mirror detection after reboot, device hot-plug and other external events. @@ -337,6 +337,45 @@ gmirror deactivate data da1 dd if=/dev/da1 of=/backup/data.img bs=1m gmirror activate data da1 .Ed +.Sh SYSCTL VARIABLES +The following +.Xr sysctl 8 +variables can be used to configure behavior for all mirrors. +.Bl -tag -width indent +.It Va kern.geom.mirror.debug +Control the verbosity of kernel logging related to mirrors. +A value larger than 0 will enable debug logging. +.It Va kern.geom.mirror.timeout +The amount of time, in seconds, to wait for all copies of a mirror to +appear before starting the mirror. +Disks that appear after the mirror has been started are not automatically +added to the mirror. +.It Va kern.geom.mirror.idletime +The amount of time, in seconds, which must elapse after the last write to +a mirror before that mirror is marked clean. +Clean mirrors do not need to be synchronized after a power failure or +system crash. +A small value may result in frequent overwrites of the disks' metadata +sectors, and thus may reduce the longevity of the disks. +.It Va kern.geom.mirror.disconnect_on_failure +Determine whether a disk is automatically removed from its mirror when an +I/O request to that disk fails. +.It Va kern.geom.mirror.sync_requests +The number of parallel I/O requests used while synchronizing a mirror. +This parameter may only be configured as a +.Xr loader.conf 5 +tunable. +.It Va kern.geom.mirror.sync_update_period +The period, in seconds, at which a synchronizing mirror's metadata is +updated. +Periodic updates are used to record a synchronization's progress so that +an interrupted synchronization may be resumed starting at the recorded +offset, rather than at the beginning. +A smaller value results in more accurate progress tracking, but also +increases the number of non-sequential writes to the disk being synchronized. +If the sysctl value is 0, no updates are performed until the synchronization +is complete. +.El .Sh NOTES Doing kernel dumps to .Nm @@ -382,6 +421,7 @@ there. .Xr mount 8 , .Xr newfs 8 , .Xr savecore 8 , +.Xr sysctl 8 , .Xr umount 8 .Sh HISTORY The @@ -394,7 +434,3 @@ utility appeared in There should be a way to change a component's priority inside a running mirror. .Pp There should be a section with an implementation description. -.Pp -Documentation for sysctls -.Va kern.geom.mirror.* -is missing. ___ 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: r326438 - head/sys/kern
Author: markj Date: Fri Dec 1 22:51:02 2017 New Revision: 326438 URL: https://svnweb.freebsd.org/changeset/base/326438 Log: Plug a name cache lock leak. Reviewed by: mjg MFC after:1 week Sponsored by: Dell EMC Isilon Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c == --- head/sys/kern/vfs_cache.c Fri Dec 1 22:48:20 2017(r326437) +++ head/sys/kern/vfs_cache.c Fri Dec 1 22:51:02 2017(r326438) @@ -1162,6 +1162,8 @@ retry_dotdot: SDT_PROBE3(vfs, namecache, lookup, miss, dvp, "..", NULL); mtx_unlock(dvlp); + if (dvlp2 != NULL) + mtx_unlock(dvlp2); return (0); } if ((ncp->nc_flag & NCF_ISDOTDOT) != 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"
svn commit: r326498 - in head: . cddl/contrib/opensolaris/lib/libdtrace/common lib/libproc lib/libproc/tests
Author: markj Date: Sun Dec 3 16:50:16 2017 New Revision: 326498 URL: https://svnweb.freebsd.org/changeset/base/326498 Log: Add an envp argument to proc_create(). This is needed to support dtrace's -x setenv option. MFC after:2 weeks Modified: head/ObsoleteFiles.inc head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c head/lib/libproc/Makefile head/lib/libproc/libproc.h head/lib/libproc/proc_create.c head/lib/libproc/tests/proc_test.c Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Sun Dec 3 13:52:35 2017(r326497) +++ head/ObsoleteFiles.inc Sun Dec 3 16:50:16 2017(r326498) @@ -38,6 +38,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20171203: libproc version bump +OLD_LIBS+=usr/lib/libproc.so.4 +OLD_LIBS+=usr/lib32/libproc.so.4 # 20171203: new clang import which bumps version from 5.0.0 to 5.0.1. OLD_FILES+=usr/lib/clang/5.0.0/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/5.0.0/include/sanitizer/asan_interface.h Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c == --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.cSun Dec 3 13:52:35 2017(r326497) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.cSun Dec 3 16:50:16 2017(r326498) @@ -967,7 +967,7 @@ dt_proc_create(dtrace_hdl_t *dtp, const char *file, ch #ifdef illumos if ((dpr->dpr_proc = Pcreate(file, argv, &err, NULL, 0)) == NULL) { #else - if ((err = proc_create(file, argv, pcf, child_arg, + if ((err = proc_create(file, argv, NULL, pcf, child_arg, &dpr->dpr_proc)) != 0) { #endif return (dt_proc_error(dtp, dpr, Modified: head/lib/libproc/Makefile == --- head/lib/libproc/Makefile Sun Dec 3 13:52:35 2017(r326497) +++ head/lib/libproc/Makefile Sun Dec 3 16:50:16 2017(r326498) @@ -37,7 +37,7 @@ CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libc CFLAGS+= -DNO_CTF .endif -SHLIB_MAJOR= 4 +SHLIB_MAJOR= 5 MAN= Modified: head/lib/libproc/libproc.h == --- head/lib/libproc/libproc.h Sun Dec 3 13:52:35 2017(r326497) +++ head/lib/libproc/libproc.h Sun Dec 3 16:50:16 2017(r326498) @@ -142,8 +142,8 @@ int proc_addr2sym(struct proc_handle *, uintptr_t, cha intproc_attach(pid_t pid, int flags, struct proc_handle **pphdl); intproc_continue(struct proc_handle *); intproc_clearflags(struct proc_handle *, int); -intproc_create(const char *, char * const *, proc_child_func *, void *, - struct proc_handle **); +intproc_create(const char *, char * const *, char * const *, + proc_child_func *, void *, struct proc_handle **); intproc_detach(struct proc_handle *, int); intproc_getflags(struct proc_handle *); intproc_name2sym(struct proc_handle *, const char *, const char *, Modified: head/lib/libproc/proc_create.c == --- head/lib/libproc/proc_create.c Sun Dec 3 13:52:35 2017 (r326497) +++ head/lib/libproc/proc_create.c Sun Dec 3 16:50:16 2017 (r326498) @@ -176,9 +176,10 @@ out: } int -proc_create(const char *file, char * const *argv, proc_child_func *pcf, -void *child_arg, struct proc_handle **pphdl) +proc_create(const char *file, char * const *argv, char * const *envp, +proc_child_func *pcf, void *child_arg, struct proc_handle **pphdl) { + extern char * const *environ; struct proc_handle *phdl; int error, status; pid_t pid; @@ -189,8 +190,7 @@ proc_create(const char *file, char * const *argv, proc error = 0; phdl = NULL; - /* Fork a new process. */ - if ((pid = vfork()) == -1) + if ((pid = fork()) == -1) error = errno; else if (pid == 0) { /* The child expects to be traced. */ @@ -200,18 +200,14 @@ proc_create(const char *file, char * const *argv, proc if (pcf != NULL) (*pcf)(child_arg); - /* Execute the specified file: */ + if (envp != NULL) + environ = envp; + execvp(file, argv); - /* Couldn't execute the file. */ _exit(2); /* NOTREACHED */ } else { - /* The parent owns the process handle. */ - error = proc_init(pid, 0, PS_IDLE, &phdl); - if (error != 0) - goto bad; - /* Wait for the child process to stop. */ if (waitpid(pid, &status, WUNTRA
svn commit: r326499 - in head: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env cddl/contrib/opensolaris/lib/libdtrace/common cddl/usr.sbin/dtrace/tests/common cddl/usr.sbin/dtrace/tests/com...
Author: markj Date: Sun Dec 3 16:57:28 2017 New Revision: 326499 URL: https://svnweb.freebsd.org/changeset/base/326499 Log: Complete support for dtrace's -x setenv option. This allows one to override the environment for processes created with dtrace -c. By default, the environment is inherited. This support was originally merged from illumos in r249367 but was lost when the commit was later reverted and then brought back piecemeal. Reported by: Samuel Lepetit MFC after:2 weeks Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/err.D_PRAGMA_OPTSET.setfromscript.d (contents, props changed) head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/err.D_PRAGMA_OPTSET.unsetfromscript.d (contents, props changed) head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/tst.ld_nolazyload.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/tst.ld_nolazyload.ksh.out head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/tst.setenv1.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/tst.setenv1.ksh.out head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/tst.setenv2.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/tst.setenv2.ksh.out head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/tst.unsetenv1.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/tst.unsetenv1.ksh.out (contents, props changed) head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/tst.unsetenv2.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/tst.unsetenv2.ksh.out Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.h head/cddl/usr.sbin/dtrace/tests/common/Makefile head/cddl/usr.sbin/dtrace/tests/common/probes/Makefile head/cddl/usr.sbin/dtrace/tests/common/speculation/Makefile head/etc/mtree/BSD.tests.dist Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/err.D_PRAGMA_OPTSET.setfromscript.d == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/err.D_PRAGMA_OPTSET.setfromscript.d Sun Dec 3 16:57:28 2017(r326499) @@ -0,0 +1,25 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +#pragma D option setenv=balloon=something_bad_happens + +BEGIN +{ + exit(0); +} Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/err.D_PRAGMA_OPTSET.unsetfromscript.d == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/err.D_PRAGMA_OPTSET.unsetfromscript.d Sun Dec 3 16:57:28 2017(r326499) @@ -0,0 +1,25 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +#pragma D option unsetenv=rectalexambot + +BEGIN +{ + exit(0); +} Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/tst.ld_nolazyload.ksh == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/tst.ld_nolazyload.ksh Sun Dec 3 16:57:28 2017(r326499) @@ -0,0 +1,33 @@ +# +# CDDL HEADER START +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.o
svn commit: r326502 - in head: . share/man/man7
Author: markj Date: Sun Dec 3 20:36:36 2017 New Revision: 326502 URL: https://svnweb.freebsd.org/changeset/base/326502 Log: Document the sys/boot -> stand move in hier.7 and the top-level README. Reviewed by: imp Differential Revision:https://reviews.freebsd.org/D13353 Modified: head/README head/README.md head/share/man/man7/hier.7 Modified: head/README == --- head/README Sun Dec 3 19:26:14 2017(r326501) +++ head/README Sun Dec 3 20:36:36 2017(r326502) @@ -66,6 +66,8 @@ secureCryptographic libraries and commands. share Shared resources. +stand Boot loader sources. + sysKernel sources. tests Regression tests which can be run by Kyua. See tests/README Modified: head/README.md == --- head/README.md Sun Dec 3 19:26:14 2017(r326501) +++ head/README.md Sun Dec 3 20:36:36 2017(r326502) @@ -68,6 +68,8 @@ secureCryptographic libraries and commands. share Shared resources. +stand Boot loader sources. + sysKernel sources. tests Regression tests which can be run by Kyua. See tests/README Modified: head/share/man/man7/hier.7 == --- head/share/man/man7/hier.7 Sun Dec 3 19:26:14 2017(r326501) +++ head/share/man/man7/hier.7 Sun Dec 3 20:36:36 2017(r326502) @@ -28,7 +28,7 @@ .\"@(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd November 16, 2017 +.Dd December 3, 2017 .Dt HIER 7 .Os .Sh NAME @@ -644,6 +644,8 @@ build directory for files in .It Pa share/ source for files in .Pa /usr/share +.It Pa stand/ +boot loader source code .It Pa sys/ kernel source code .Bl -tag -width "opencrypto/" -compact ___ 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: r326626 - head/lib/libproc
Author: markj Date: Wed Dec 6 17:52:01 2017 New Revision: 326626 URL: https://svnweb.freebsd.org/changeset/base/326626 Log: Use a global extern declaration to appease gcc. Reported by: gjb X-MFC with: r326498 Modified: head/lib/libproc/proc_create.c Modified: head/lib/libproc/proc_create.c == --- head/lib/libproc/proc_create.c Wed Dec 6 17:50:10 2017 (r326625) +++ head/lib/libproc/proc_create.c Wed Dec 6 17:52:01 2017 (r326626) @@ -47,6 +47,8 @@ __FBSDID("$FreeBSD$"); #include "_libproc.h" +extern char * const *environ; + static int getelfclass(int); static int proc_init(pid_t, int, int, struct proc_handle **); @@ -179,7 +181,6 @@ int proc_create(const char *file, char * const *argv, char * const *envp, proc_child_func *pcf, void *child_arg, struct proc_handle **pphdl) { - extern char * const *environ; struct proc_handle *phdl; int error, status; pid_t pid; ___ 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: r326629 - head/sys/vm
Author: markj Date: Wed Dec 6 18:36:54 2017 New Revision: 326629 URL: https://svnweb.freebsd.org/changeset/base/326629 Log: Use unique wait messages in the page daemon control loop. Discussed with: alc MFC after:1 week Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cWed Dec 6 18:11:56 2017(r326628) +++ head/sys/vm/vm_pageout.cWed Dec 6 18:36:54 2017(r326629) @@ -1818,7 +1818,7 @@ vm_pageout_worker(void *arg) */ mtx_unlock(&vm_page_queue_free_mtx); if (pass >= 1) - pause("psleep", hz / VM_INACT_SCAN_RATE); + pause("pwait", hz / VM_INACT_SCAN_RATE); pass++; } else { /* ___ 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: r326658 - head/lib/libefivar
Author: markj Date: Thu Dec 7 15:16:17 2017 New Revision: 326658 URL: https://svnweb.freebsd.org/changeset/base/326658 Log: Ensure that "out" is initialized in all error paths. Reported by: gcc Reviewed by: cem Differential Revision:https://reviews.freebsd.org/D13402 Modified: head/lib/libefivar/efivar-dp-xlate.c Modified: head/lib/libefivar/efivar-dp-xlate.c == --- head/lib/libefivar/efivar-dp-xlate.cThu Dec 7 09:05:34 2017 (r326657) +++ head/lib/libefivar/efivar-dp-xlate.cThu Dec 7 15:16:17 2017 (r326658) @@ -529,7 +529,7 @@ build_dp(const char *efimedia, const char *relpath, ef { char *fp, *dptxt = NULL; int rv = 0; - efidp out; + efidp out = NULL; size_t len; fp = path_to_file_dp(relpath); ___ 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: r326664 - head/sys/vm
Author: markj Date: Thu Dec 7 19:38:09 2017 New Revision: 326664 URL: https://svnweb.freebsd.org/changeset/base/326664 Log: Fix the UMA reclaim worker after r326347. atomic_set_*() sets a bit in the target memory location, so atomic_set_int(&uma_reclaim_needed, 0) does not do what it looks like it does. PR: 224080 Reviewed by: jeff, kib Differential Revision:https://reviews.freebsd.org/D13412 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Thu Dec 7 18:04:48 2017(r326663) +++ head/sys/vm/uma_core.c Thu Dec 7 19:38:09 2017(r326664) @@ -3177,7 +3177,7 @@ uma_reclaim_worker(void *arg __unused) EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_KMEM); sx_xlock(&uma_drain_lock); uma_reclaim_locked(true); - atomic_set_int(&uma_reclaim_needed, 0); + uma_reclaim_needed = 0; sx_xunlock(&uma_drain_lock); /* Don't fire more than once per-second. */ pause("umarclslp", hz); ___ 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: r326671 - head/stand/i386/gptzfsboot
Author: markj Date: Thu Dec 7 22:11:23 2017 New Revision: 326671 URL: https://svnweb.freebsd.org/changeset/base/326671 Log: Avoid setting -Wno-tentative-definition-incomplete-type with gcc. No version of gcc that I've tried accepts this flag. Reviewed by: imp Differential Revision:https://reviews.freebsd.org/D13415 Modified: head/stand/i386/gptzfsboot/Makefile Modified: head/stand/i386/gptzfsboot/Makefile == --- head/stand/i386/gptzfsboot/Makefile Thu Dec 7 20:41:23 2017 (r326670) +++ head/stand/i386/gptzfsboot/Makefile Thu Dec 7 22:11:23 2017 (r326671) @@ -39,12 +39,9 @@ CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ -Winline -Wno-pointer-sign -NO_WCAST_ALIGN= +CFLAGS.clang+= -Wno-tentative-definition-incomplete-type -.if ${COMPILER_TYPE} == "clang" || \ -(${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201) -CFLAGS+= -Wno-tentative-definition-incomplete-type -.endif +NO_WCAST_ALIGN= .if ${MACHINE} == "amd64" LIBZFSBOOT=${BOOTOBJ}/zfs32/libzfsboot.a ___ 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: r326705 - head/cddl/usr.sbin/dtrace/tests/common/env
Author: markj Date: Fri Dec 8 19:26:25 2017 New Revision: 326705 URL: https://svnweb.freebsd.org/changeset/base/326705 Log: Actually add the -x setenv test Makefile, missed in r326499. X-MFC with: r326499 Added: head/cddl/usr.sbin/dtrace/tests/common/env/ head/cddl/usr.sbin/dtrace/tests/common/env/Makefile (contents, props changed) Added: head/cddl/usr.sbin/dtrace/tests/common/env/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/usr.sbin/dtrace/tests/common/env/Makefile Fri Dec 8 19:26:25 2017(r326705) @@ -0,0 +1,30 @@ +# $FreeBSD$ + +# +# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh. +# + +PACKAGE= tests + +${PACKAGE}FILES= \ + err.D_PRAGMA_OPTSET.setfromscript.d \ + err.D_PRAGMA_OPTSET.unsetfromscript.d \ + tst.ld_nolazyload.ksh \ + tst.ld_nolazyload.ksh.out \ + tst.setenv1.ksh \ + tst.setenv1.ksh.out \ + tst.setenv2.ksh \ + tst.setenv2.ksh.out \ + tst.unsetenv1.ksh \ + tst.unsetenv1.ksh.out \ + tst.unsetenv2.ksh \ + tst.unsetenv2.ksh.out \ + +TESTEXES= \ + + +CFILES= \ + + + +.include "../../dtrace.test.mk" ___ 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: r326731 - head/sys/ufs/ffs
Author: markj Date: Sat Dec 9 15:44:30 2017 New Revision: 326731 URL: https://svnweb.freebsd.org/changeset/base/326731 Log: Provide a sysctl to force synchronous initialization of inode blocks. FFS performs asynchronous inode initialization, using a barrier write to ensure that the inode block is written before the corresponding cylinder group header update. Some GEOMs do not appear to handle BIO_ORDERED correctly, meaning that the barrier write may not work as intended. The sysctl allows one to work around this problem at the cost of expensive file creation on new filesystems. The default behaviour is unchanged. Reviewed by: kib, mckusick MFC after:1 weeks Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D13428 Modified: head/sys/ufs/ffs/ffs_alloc.c Modified: head/sys/ufs/ffs/ffs_alloc.c == --- head/sys/ufs/ffs/ffs_alloc.cSat Dec 9 15:34:40 2017 (r326730) +++ head/sys/ufs/ffs/ffs_alloc.cSat Dec 9 15:44:30 2017 (r326731) @@ -1958,6 +1958,16 @@ getinobuf(struct inode *ip, u_int cg, u_int32_t cginob } /* + * Synchronous inode initialization is needed only when barrier writes do not + * work as advertised, and will impose a heavy cost on file creation in a newly + * created filesystem. + */ +static int doasyncinodeinit = 1; +SYSCTL_INT(_vfs_ffs, OID_AUTO, doasyncinodeinit, CTLFLAG_RWTUN, +&doasyncinodeinit, 0, +"Perform inode block initialization using asynchronous writes"); + +/* * Determine whether an inode can be allocated. * * Check to see if an inode is available, and if it is, @@ -2065,6 +2075,7 @@ gotit: dp2->di_gen = arc4random(); dp2++; } + /* * Rather than adding a soft updates dependency to ensure * that the new inode block is written before it is claimed @@ -2074,7 +2085,10 @@ gotit: * written. The barrier write should only slow down bulk * loading of newly created filesystems. */ - babarrierwrite(ibp); + if (doasyncinodeinit) + babarrierwrite(ibp); + else + bwrite(ibp); /* * After the inode block is written, try to update the ___ 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: r326732 - head/sys/vm
Author: markj Date: Sat Dec 9 15:47:26 2017 New Revision: 326732 URL: https://svnweb.freebsd.org/changeset/base/326732 Log: Fix the act_scan_laundry_weight mechanism. r292392 modified the active queue scan to weigh clean pages differently from dirty pages when attempting to meet the inactive queue target. When r306706 was merged into the PQ_LAUNDRY branch, this mechanism was broken. Fix it by scalaing the correct page shortage variable. Reviewed by: alc, kib MFC after:1 week Differential Revision:https://reviews.freebsd.org/D13423 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cSat Dec 9 15:44:30 2017(r326731) +++ head/sys/vm/vm_pageout.cSat Dec 9 15:47:26 2017(r326732) @@ -1393,7 +1393,7 @@ drop_page: inactq_shortage = vm_cnt.v_inactive_target - (vm_cnt.v_inactive_count + vm_cnt.v_laundry_count / act_scan_laundry_weight) + vm_paging_target() + deficit + addl_page_shortage; - page_shortage *= act_scan_laundry_weight; + inactq_shortage *= act_scan_laundry_weight; pq = &vmd->vmd_pagequeues[PQ_ACTIVE]; vm_pagequeue_lock(pq); ___ 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: r326731 - head/sys/ufs/ffs
On Sat, Dec 09, 2017 at 08:03:37PM +0200, Andriy Gapon wrote: > On 09/12/2017 17:44, Mark Johnston wrote: > > Some GEOMs do not appear to handle BIO_ORDERED correctly, meaning that the > > Nitpick: this should be "geoms" or, even better, "GEOM classes" :-) Ok. :) > > barrier write may not work as intended. > Could the loss of BIO_ORDERED in g_duplicate_bio() contribute to the problem > with those GEOM classes? It does look like a bug that g_duplicate_bio() doesn't preserve that flag. However, the issue I was looking at was in gmirror: when a mirror is being synchronized, gmirror will delay writes that collide with an active synchronization request. However, subsequent writes which do not collide are passed directly to the mirrors, so an ordering violation is possible. I plan to fix this. I haven't checked, but graid might have a similar issue. I also noticed that gsched doesn't take BIO_ORDERED into account when sorting requests. Isilon has an I/O scheduler which has this problem too. ___ 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: r326731 - head/sys/ufs/ffs
On Sat, Dec 09, 2017 at 07:36:59PM -0700, Warner Losh wrote: > On Sat, Dec 9, 2017 at 11:03 AM, Andriy Gapon wrote: > > > On 09/12/2017 17:44, Mark Johnston wrote: > > > Some GEOMs do not appear to handle BIO_ORDERED correctly, meaning that > > the > > > barrier write may not work as intended. > > > There's a few places we send down a BIO_ORDERED BIO_FLUSH command > (see softdep_synchronize for one). Will those matter? Some classes have separate handling for BIO_FLUSH, so it depends. I think gmirror's handling is buggy independent of BIO_ORDERED: g_mirror_start() sends BIO_FLUSH commands directly to the mirrors, while reads and writes are queued for handling by the gmirror worker thread. So as far as I can tell, a BIO_WRITE which arrives at the gmirror provider before a BIO_FLUSH might be sent to the mirrors after that BIO_FLUSH. I would expect BIO_FLUSH to implicitly have something like release semantics, i.e., a BIO_FLUSH shouldn't be reordered with a BIO_WRITE that preceded it. But I might be misunderstanding. > As I've noted elsewhere: I'd really like to kill BIO_ORDERED since it has > too many icky effects (and BIO_FLUSH + BIO_ORDERED isn't guaranteed to do, > well, anything since it can turn into a NOP in a number of places. Plus > many of the implementations of BIO_ORDERED assume the drive is like SCSI > and you just set the right tag to make it 'ordered'. For ATA we issue a non > NCQ command, which is a full drain of outstanding commands, send this > command, then start them again which really shuts down the parallelism we > implemented NCQ for :(. We do similar for NVME which is even worse. There > we have multiple submission queues in the hardware. To simulated it, we do > a similar drain, but that's going to get in the way as we move to NUMA and > systems where we try to do the I/O entirely on one CPU (both submission and > completion) and ordered I/O is guaranteed lock contention. Independent of this, it doesn't really look like we have any way of handling write errors when dependencies are enforced using BIO_ORDERED. In the case of the babarrierwrite() consumer in FFS, what happens if the inode block write fails due to a transient error, but the following CG update succeeds? ___ 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: r326770 - head/sys/vm
Author: markj Date: Mon Dec 11 15:33:24 2017 New Revision: 326770 URL: https://svnweb.freebsd.org/changeset/base/326770 Log: Use a dedicated counter for inactive queue scans. The laundry thread keeps track of the number of inactive queue scans performed by the page daemon, and was previously using the v_pdwakeups counter to count them. However, in some cases the inactive queue may be scanned multiple times after a single wakeup, so it's more accurate to use a dedicated counter. Reviewed by: alc, kib (previous version) MFC after:1 week Differential Revision:https://reviews.freebsd.org/D13422 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cMon Dec 11 14:54:42 2017(r326769) +++ head/sys/vm/vm_pageout.cMon Dec 11 15:33:24 2017(r326770) @@ -159,6 +159,7 @@ static enum { VM_LAUNDRY_BACKGROUND, VM_LAUNDRY_SHORTFALL } vm_laundry_request = VM_LAUNDRY_IDLE; +static int vm_inactq_scans; static int vm_pageout_update_period; static int disable_swap_pageouts; @@ -961,7 +962,7 @@ vm_pageout_laundry_worker(void *arg) struct vm_domain *domain; struct vm_pagequeue *pq; uint64_t nclean, ndirty; - u_int last_launder, wakeups; + u_int inactq_scans, last_launder; int domidx, last_target, launder, shortfall, shortfall_cycle, target; bool in_shortfall; @@ -975,6 +976,7 @@ vm_pageout_laundry_worker(void *arg) in_shortfall = false; shortfall_cycle = 0; target = 0; + inactq_scans = 0; last_launder = 0; /* @@ -993,7 +995,6 @@ vm_pageout_laundry_worker(void *arg) KASSERT(shortfall_cycle >= 0, ("negative cycle %d", shortfall_cycle)); launder = 0; - wakeups = VM_CNT_FETCH(v_pdwakeups); /* * First determine whether we need to launder pages to meet a @@ -1017,7 +1018,7 @@ vm_pageout_laundry_worker(void *arg) target = 0; goto trybackground; } - last_launder = wakeups; + last_launder = inactq_scans; launder = target / shortfall_cycle--; goto dolaundry; @@ -1034,29 +1035,29 @@ vm_pageout_laundry_worker(void *arg) * * The background laundering threshold is not a constant. * Instead, it is a slowly growing function of the number of -* page daemon wakeups since the last laundering. Thus, as the +* page daemon scans since the last laundering. Thus, as the * ratio of dirty to clean inactive pages grows, the amount of * memory pressure required to trigger laundering decreases. */ trybackground: nclean = vm_cnt.v_inactive_count + vm_cnt.v_free_count; ndirty = vm_cnt.v_laundry_count; - if (target == 0 && wakeups != last_launder && - ndirty * isqrt(wakeups - last_launder) >= nclean) { + if (target == 0 && inactq_scans != last_launder && + ndirty * isqrt(inactq_scans - last_launder) >= nclean) { target = vm_background_launder_target; } /* * We have a non-zero background laundering target. If we've * laundered up to our maximum without observing a page daemon -* wakeup, just stop. This is a safety belt that ensures we +* request, just stop. This is a safety belt that ensures we * don't launder an excessive amount if memory pressure is low * and the ratio of dirty to clean pages is large. Otherwise, * proceed at the background laundering rate. */ if (target > 0) { - if (wakeups != last_launder) { - last_launder = wakeups; + if (inactq_scans != last_launder) { + last_launder = inactq_scans; last_target = target; } else if (last_target - target >= vm_background_launder_max * PAGE_SIZE / 1024) { @@ -1104,6 +1105,7 @@ dolaundry: if (target == 0) vm_laundry_request = VM_LAUNDRY_IDLE; + inactq_scans = vm_inactq_scans; vm_pagequeue_unlock(pq); } } @@ -1349,12 +1351,16 @@ drop_page: * need to launder more aggressively. If PQ_LAUNDRY is empty and no * swap devices are configured, the laundry thread has no work to do, so * don't bother waking it up. +* +* The laundry thread uses the nu
svn commit: r326774 - in head/sys: amd64/amd64 cddl/contrib/opensolaris/uts/common/sys cddl/contrib/opensolaris/uts/intel/dtrace cddl/contrib/opensolaris/uts/powerpc/dtrace i386/i386 powerpc/powerp...
Author: markj Date: Mon Dec 11 19:21:39 2017 New Revision: 326774 URL: https://svnweb.freebsd.org/changeset/base/326774 Log: Pass the trap frame to fasttrap hooks. The DTrace fasttrap entry points expect a struct reg containing the register values of the calling thread. Perform the conversion in fasttrap rather than in the trap handler: this reduces the number of ifdefs and avoids wasting stack space for traps that don't involve DTrace. MFC after:2 weeks Modified: head/sys/amd64/amd64/trap.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c head/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c head/sys/i386/i386/trap.c head/sys/powerpc/powerpc/trap.c head/sys/sys/dtrace_bsd.h Modified: head/sys/amd64/amd64/trap.c == --- head/sys/amd64/amd64/trap.c Mon Dec 11 18:04:04 2017(r326773) +++ head/sys/amd64/amd64/trap.c Mon Dec 11 19:21:39 2017(r326774) @@ -164,9 +164,6 @@ SYSCTL_INT(_machdep, OID_AUTO, uprintf_signal, CTLFLAG void trap(struct trapframe *frame) { -#ifdef KDTRACE_HOOKS - struct reg regs; -#endif ksiginfo_t ksi; struct thread *td; struct proc *p; @@ -278,9 +275,8 @@ trap(struct trapframe *frame) enable_intr(); #ifdef KDTRACE_HOOKS if (type == T_BPTFLT) { - fill_frame_regs(frame, ®s); if (dtrace_pid_probe_ptr != NULL && - dtrace_pid_probe_ptr(®s) == 0) + dtrace_pid_probe_ptr(frame) == 0) return; } #endif @@ -406,9 +402,8 @@ trap(struct trapframe *frame) #ifdef KDTRACE_HOOKS case T_DTRACE_RET: enable_intr(); - fill_frame_regs(frame, ®s); if (dtrace_return_probe_ptr != NULL) - dtrace_return_probe_ptr(®s); + dtrace_return_probe_ptr(frame); return; #endif } Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h == --- head/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.hMon Dec 11 18:04:04 2017(r326773) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.hMon Dec 11 19:21:39 2017(r326774) @@ -221,9 +221,9 @@ extern int fasttrap_tracepoint_init(proc_t *, fasttrap extern int fasttrap_tracepoint_install(proc_t *, fasttrap_tracepoint_t *); extern int fasttrap_tracepoint_remove(proc_t *, fasttrap_tracepoint_t *); -struct reg; -extern int fasttrap_pid_probe(struct reg *); -extern int fasttrap_return_probe(struct reg *); +struct trapframe; +extern int fasttrap_pid_probe(struct trapframe *); +extern int fasttrap_return_probe(struct trapframe *); extern uint64_t fasttrap_pid_getarg(void *, dtrace_id_t, void *, int, int); extern uint64_t fasttrap_usdt_getarg(void *, dtrace_id_t, void *, int, int); Modified: head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c == --- head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Mon Dec 11 18:04:04 2017(r326773) +++ head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Mon Dec 11 19:21:39 2017(r326774) @@ -961,14 +961,12 @@ fasttrap_do_seg(fasttrap_tracepoint_t *tp, struct reg } int -fasttrap_pid_probe(struct reg *rp) +fasttrap_pid_probe(struct trapframe *tf) { - proc_t *p = curproc; -#ifndef illumos + struct reg reg, *rp; + proc_t *p = curproc, *pp; struct rm_priotracker tracker; - proc_t *pp; -#endif - uintptr_t pc = rp->r_rip - 1; + uintptr_t pc; uintptr_t new_pc = 0; fasttrap_bucket_t *bucket; #ifdef illumos @@ -979,6 +977,11 @@ fasttrap_pid_probe(struct reg *rp) dtrace_icookie_t cookie; uint_t is_enabled = 0; + fill_frame_regs(tf, ®); + rp = ® + + pc = rp->r_rip - 1; + /* * It's possible that a user (in a veritable orgy of bad planning) * could redirect this thread's flow of control before it reached the @@ -1783,12 +1786,16 @@ done: } int -fasttrap_return_probe(struct reg *rp) +fasttrap_return_probe(struct trapframe *tf) { + struct reg reg, *rp; proc_t *p = curproc; uintptr_t pc = curthread->t_dtrace_pc; uintptr_t npc = curthread->t_dtrace_npc; + fill_frame_regs(tf, ®); + rp = ® + curthread->t_dtrace_pc = 0; curthread->t_dtrace_npc = 0; curthread->t_dtrace_scrpc = 0; @@ -1808,9 +1815,7 @@ fasttrap_retur
svn commit: r326796 - head/sys/geom/mirror
Author: markj Date: Tue Dec 12 17:24:30 2017 New Revision: 326796 URL: https://svnweb.freebsd.org/changeset/base/326796 Log: Decrement sc_writes when BIO_DELETE requests complete. Otherwise a gmirror that has received a BIO_DELETE request will never be marked clean (unless sc_writes overflows). MFC after:1 week Sponsored by: Dell EMC Isilon Modified: head/sys/geom/mirror/g_mirror.c Modified: head/sys/geom/mirror/g_mirror.c == --- head/sys/geom/mirror/g_mirror.c Tue Dec 12 12:59:04 2017 (r326795) +++ head/sys/geom/mirror/g_mirror.c Tue Dec 12 17:24:30 2017 (r326796) @@ -937,7 +937,7 @@ g_mirror_regular_request(struct bio *bp) pbp = bp->bio_parent; sc = pbp->bio_to->private; bp->bio_from->index--; - if (bp->bio_cmd == BIO_WRITE) + if (bp->bio_cmd == BIO_WRITE || bp->bio_cmd == BIO_DELETE) sc->sc_writes--; disk = bp->bio_from->private; if (disk == 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"
svn commit: r326797 - head/sys/geom/mirror
Author: markj Date: Tue Dec 12 17:25:25 2017 New Revision: 326797 URL: https://svnweb.freebsd.org/changeset/base/326797 Log: Give g_mirror_event_get() a more accurate name. MFC after:1 week Sponsored by: Dell EMC Isilon Modified: head/sys/geom/mirror/g_mirror.c Modified: head/sys/geom/mirror/g_mirror.c == --- head/sys/geom/mirror/g_mirror.c Tue Dec 12 17:24:30 2017 (r326796) +++ head/sys/geom/mirror/g_mirror.c Tue Dec 12 17:25:25 2017 (r326797) @@ -219,7 +219,7 @@ g_mirror_event_send(void *arg, int state, int flags) } static struct g_mirror_event * -g_mirror_event_get(struct g_mirror_softc *sc) +g_mirror_event_first(struct g_mirror_softc *sc) { struct g_mirror_event *ep; @@ -555,7 +555,7 @@ g_mirror_destroy_device(struct g_mirror_softc *sc) g_mirror_update_metadata(disk); g_mirror_destroy_disk(disk); } - while ((ep = g_mirror_event_get(sc)) != NULL) { + while ((ep = g_mirror_event_first(sc)) != NULL) { g_mirror_event_remove(sc, ep); if ((ep->e_flags & G_MIRROR_EVENT_DONTWAIT) != 0) g_mirror_event_free(ep); @@ -1877,7 +1877,7 @@ g_mirror_worker(void *arg) * First take a look at events. * This is important to handle events before any I/O requests. */ - ep = g_mirror_event_get(sc); + ep = g_mirror_event_first(sc); if (ep != NULL) { g_mirror_event_remove(sc, ep); if ((ep->e_flags & G_MIRROR_EVENT_DEVICE) != 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"
svn commit: r326798 - head/sys/geom/mirror
Author: markj Date: Tue Dec 12 17:29:34 2017 New Revision: 326798 URL: https://svnweb.freebsd.org/changeset/base/326798 Log: Address a possible lost wakeup for gmirror events. g_mirror_event_send() acquires the I/O queue lock to deliver a wakeup to the worker thread, and this is done after enqueuing the event. So it's sufficient to check the event queue before atomically releasing the queue lock and going to sleep. MFC after:1 week Sponsored by: Dell EMC Isilon Modified: head/sys/geom/mirror/g_mirror.c Modified: head/sys/geom/mirror/g_mirror.c == --- head/sys/geom/mirror/g_mirror.c Tue Dec 12 17:25:25 2017 (r326797) +++ head/sys/geom/mirror/g_mirror.c Tue Dec 12 17:29:34 2017 (r326798) @@ -1945,16 +1945,9 @@ g_mirror_worker(void *arg) continue; } } + if (g_mirror_event_first(sc) != NULL) + continue; sx_xunlock(&sc->sc_lock); - /* -* XXX: We can miss an event here, because an event -* can be added without sx-device-lock and without -* mtx-queue-lock. Maybe I should just stop using -* dedicated mutex for events synchronization and -* stick with the queue lock? -* The event will hang here until next I/O request -* or next event is received. -*/ MSLEEP(sc, &sc->sc_queue_mtx, PRIBIO | PDROP, "m:w1", timeout * hz); sx_xlock(&sc->sc_lock); ___ 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: r326811 - head/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace
Author: markj Date: Tue Dec 12 20:41:11 2017 New Revision: 326811 URL: https://svnweb.freebsd.org/changeset/base/326811 Log: Correct initialization of pc on powerpc. PR: 224293 Submitted by: Breno Leitao X-MFC with: r326774 Pointy hat: markj Modified: head/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c Modified: head/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c == --- head/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c Tue Dec 12 20:28:54 2017(r326810) +++ head/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c Tue Dec 12 20:41:11 2017(r326811) @@ -333,7 +333,7 @@ fasttrap_pid_probe(struct trapframe *frame) struct reg reg, *rp; struct rm_priotracker tracker; proc_t *p = curproc; - uintptr_t pc = rp->pc; + uintptr_t pc; uintptr_t new_pc = 0; fasttrap_bucket_t *bucket; fasttrap_tracepoint_t *tp, tp_local; @@ -343,6 +343,7 @@ fasttrap_pid_probe(struct trapframe *frame) fill_regs(curthread, ®); rp = ® + pc = rp->pc; /* * It's possible that a user (in a veritable orgy of bad planning) ___ 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: r326813 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace
Author: markj Date: Tue Dec 12 22:08:34 2017 New Revision: 326813 URL: https://svnweb.freebsd.org/changeset/base/326813 Log: MFV r326785: 8880 improve DTrace error checking illumos/illumos-gate@2cf374268f3e1c9e9be6367466b183d27632583a https://github.com/illumos/illumos-gate/commit/2cf374268f3e1c9e9be6367466b183d27632583a https://www.illumos.org/issues/8880 Reviewed by: Tim Kordas Reviewed by: Bryan Cantrill Reviewed by: Richard Lowe Approved by: Dan McDonald Author: Jerry Jelinek MFC after:1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c == --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cTue Dec 12 22:06:22 2017(r326812) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cTue Dec 12 22:08:34 2017(r326813) @@ -13929,6 +13929,7 @@ dtrace_dof_relocate(dof_hdr_t *dof, dof_sec_t *sec, ui uint64_t udaddr) { uintptr_t daddr = (uintptr_t)dof; + uintptr_t ts_end; dof_relohdr_t *dofr = (dof_relohdr_t *)(uintptr_t)(daddr + sec->dofs_offset); dof_sec_t *ss, *rs, *ts; @@ -13944,6 +13945,7 @@ dtrace_dof_relocate(dof_hdr_t *dof, dof_sec_t *sec, ui ss = dtrace_dof_sect(dof, DOF_SECT_STRTAB, dofr->dofr_strtab); rs = dtrace_dof_sect(dof, DOF_SECT_RELTAB, dofr->dofr_relsec); ts = dtrace_dof_sect(dof, DOF_SECT_NONE, dofr->dofr_tgtsec); + ts_end = (uintptr_t)ts + sizeof (dof_sec_t); if (ss == NULL || rs == NULL || ts == NULL) return (-1); /* dtrace_dof_error() has been called already */ @@ -13967,6 +13969,11 @@ dtrace_dof_relocate(dof_hdr_t *dof, dof_sec_t *sec, ui case DOF_RELO_DOFREL: if (r->dofr_offset >= ts->dofs_size || r->dofr_offset + sizeof (uint64_t) > ts->dofs_size) { + dtrace_dof_error(dof, "bad relocation offset"); + return (-1); + } + + if (taddr >= (uintptr_t)ts && taddr < ts_end) { dtrace_dof_error(dof, "bad relocation offset"); return (-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: r326852 - head/usr.bin/vmstat
Author: markj Date: Thu Dec 14 15:40:03 2017 New Revision: 326852 URL: https://svnweb.freebsd.org/changeset/base/326852 Log: Re-add spaces lost in r326436. X-MFC with: r326436 Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c == --- head/usr.bin/vmstat/vmstat.cThu Dec 14 13:41:11 2017 (r326851) +++ head/usr.bin/vmstat/vmstat.cThu Dec 14 15:40:03 2017 (r326852) @@ -1041,15 +1041,15 @@ dosum(void) sum.v_vnodepgsout); xo_emit("{:page-daemon-wakeups/%9u} {N:page daemon wakeups}\n", sum.v_pdwakeups); - xo_emit("{:page-daemon-pages/%9u} {N:pages examined by the page" + xo_emit("{:page-daemon-pages/%9u} {N:pages examined by the page " "daemon}\n", sum.v_pdpages); - xo_emit("{:page-reclamation-shortfalls/%9u} {N:clean page reclamation" + xo_emit("{:page-reclamation-shortfalls/%9u} {N:clean page reclamation " "shortfalls}\n", sum.v_pdshortfalls); xo_emit("{:reactivated/%9u} {N:pages reactivated by the page daemon}\n", sum.v_reactivated); xo_emit("{:copy-on-write-faults/%9u} {N:copy-on-write faults}\n", sum.v_cow_faults); - xo_emit("{:copy-on-write-optimized-faults/%9u} {N:copy-on-write" + xo_emit("{:copy-on-write-optimized-faults/%9u} {N:copy-on-write " "optimized faults}\n", sum.v_cow_optim); xo_emit("{:zero-fill-pages/%9u} {N:zero fill pages zeroed}\n", sum.v_zfod); @@ -1061,7 +1061,7 @@ dosum(void) sum.v_vm_faults); xo_emit("{:faults-requiring-io/%9u} {N:page faults requiring I\\/O}\n", sum.v_io_faults); - xo_emit("{:faults-from-thread-creation/%9u} {N:pages affected by" + xo_emit("{:faults-from-thread-creation/%9u} {N:pages affected by " "kernel thread creation}\n", sum.v_kthreadpages); xo_emit("{:faults-from-fork/%9u} {N:pages affected by fork}()\n", sum.v_forkpages); ___ 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: r326861 - in head/tests/sys/geom/class: . mirror
Author: markj Date: Thu Dec 14 22:11:35 2017 New Revision: 326861 URL: https://svnweb.freebsd.org/changeset/base/326861 Log: Add some basic tests for gmirror read and write error handling. MFC after:2 weeks Sponsored by: Dell EMC Isilon Added: head/tests/sys/geom/class/mirror/10_test.sh (contents, props changed) head/tests/sys/geom/class/mirror/11_test.sh (contents, props changed) head/tests/sys/geom/class/mirror/12_test.sh (contents, props changed) head/tests/sys/geom/class/mirror/13_test.sh (contents, props changed) Modified: head/tests/sys/geom/class/geom_subr.sh head/tests/sys/geom/class/mirror/Makefile Modified: head/tests/sys/geom/class/geom_subr.sh == --- head/tests/sys/geom/class/geom_subr.sh Thu Dec 14 20:48:50 2017 (r326860) +++ head/tests/sys/geom/class/geom_subr.sh Thu Dec 14 22:11:35 2017 (r326861) @@ -20,6 +20,16 @@ attach_md() echo $test_md } +detach_md() +{ + local test_md unit + + test_md=$1 + unit=${test_md#md} + mdconfig -d -u $unit || exit + sed -i '' "/^${test_md}$/d" $TEST_MDS_FILE || exit +} + geom_test_cleanup() { local test_md @@ -38,6 +48,7 @@ if [ $(id -u) -ne 0 ]; then echo '1..0 # SKIP tests must be run as root' exit 0 fi + # If the geom class isn't already loaded, try loading it. if ! kldstat -q -m g_${class}; then if ! geom ${class} load; then Added: head/tests/sys/geom/class/mirror/10_test.sh == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/mirror/10_test.sh Thu Dec 14 22:11:35 2017 (r326861) @@ -0,0 +1,69 @@ +#!/bin/sh +# $FreeBSD$ + +# Test handling of read errors. + +. $(dirname $0)/conf.sh + +echo 1..3 + +set -e + +ddbs=2048 +regreadfp="debug.fail_point.g_mirror_regular_request_read" +m1=$(mktemp $base.XX) +m2=$(mktemp $base.XX) + +dd if=/dev/random of=$m1 bs=$ddbs count=1024 >/dev/null 2>&1 +dd if=/dev/zero of=$m2 bs=$ddbs count=1024 >/dev/null 2>&1 + +us0=$(attach_md -t vnode -f $m1) +us1=$(attach_md -t vnode -f $m2) + +gmirror label $name /dev/$us0 +gmirror insert $name /dev/$us1 +devwait +syncwait + +tmp1=$(mktemp $base.XX) +tmp2=$(mktemp $base.XX) + +EIO=5 +# gmirror should retry a failed read from the other mirror. +sysctl ${regreadfp}="1*return(${EIO})" +dd if=/dev/mirror/$name of=$tmp1 iseek=256 bs=$ddbs count=1 >/dev/null 2>&1 +dd if=/dev/$us1 of=$tmp2 iseek=256 bs=$ddbs count=1 >/dev/null 2>&1 +sysctl ${regreadfp}='off' + +if cmp -s $tmp1 $tmp2; then + echo "ok 1" +else + echo "not ok 1" +fi + +# Make sure that one of the mirrors was marked broken. +genid1=$(gmirror dump /dev/$us0 | awk '/^[[:space:]]*genid: /{print $2}') +genid2=$(gmirror dump /dev/$us1 | awk '/^[[:space:]]*genid: /{print $2}') +if [ $genid1 -eq $(($genid2 + 1)) -o $genid2 -eq $(($genid1 + 1)) ]; then + echo "ok 2" +else + echo "not ok 2" +fi + +# Force a retaste of the disconnected component. +if [ $(gmirror status -s $name | awk '{print $3}') = $us0 ]; then + detach_md $us1 + us1=$(attach_md -t vnode -f $m2) +else + detach_md $us0 + us0=$(attach_md -t vnode -f $m1) +fi + +# Make sure that the component wasn't re-added to the gmirror. +if [ $(gmirror status -s $name | wc -l) -eq 1 ]; then + echo "ok 3" +else + echo "not ok 3" +fi + +rm -f $m1 $m2 $tmp1 $tmp2 Added: head/tests/sys/geom/class/mirror/11_test.sh == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/mirror/11_test.sh Thu Dec 14 22:11:35 2017 (r326861) @@ -0,0 +1,84 @@ +#!/bin/sh +# $FreeBSD$ + +# Test handling of read errors. + +. $(dirname $0)/conf.sh + +echo 1..4 + +set -e + +ddbs=2048 +regreadfp="debug.fail_point.g_mirror_regular_request_read" +m1=$(mktemp $base.XX) +m2=$(mktemp $base.XX) + +dd if=/dev/random of=$m1 bs=$ddbs count=1024 >/dev/null 2>&1 +dd if=/dev/zero of=$m2 bs=$ddbs count=1024 >/dev/null 2>&1 + +us0=$(attach_md -t vnode -f $m1) +us1=$(attach_md -t vnode -f $m2) + +gmirror label $name /dev/$us0 +gmirror insert $name /dev/$us1 +devwait +syncwait + +tmp1=$(mktemp $base.XX) +tmp2=$(mktemp $base.XX) + +ENXIO=6 +# gmirror has special handling for ENXIO. It does not mark the failed component +# as broken, allowing it to rejoin the mirror automatically when it appears. +sysctl ${regreadfp}="1*return(${ENXIO})" +dd if=/dev/mirror/$name of=$tmp1 iseek=512 bs=$ddbs count=1 >/dev/null 2>&1 +dd if=/dev/$us1 of=$tmp2 iseek=512 bs=$ddbs count=1 >/dev/null 2>&1 +sysctl ${regreadfp}='off' + +if cmp -s $tmp1 $tmp2; then + echo "ok 1" +else + echo "not ok 1" +fi + +# Verify that the genids still match after ENXIO. +genid1=$(gmirror dump /dev/$us0 |
svn commit: r326862 - head/tests/sys/geom/class/mirror
Author: markj Date: Thu Dec 14 22:14:07 2017 New Revision: 326862 URL: https://svnweb.freebsd.org/changeset/base/326862 Log: Make indentation consistent with other tests, and use syncwait. MFC after:2 weeks Sponsored by: Dell EMC Isilon Modified: head/tests/sys/geom/class/mirror/8_test.sh head/tests/sys/geom/class/mirror/9_test.sh Modified: head/tests/sys/geom/class/mirror/8_test.sh == --- head/tests/sys/geom/class/mirror/8_test.sh Thu Dec 14 22:11:35 2017 (r326861) +++ head/tests/sys/geom/class/mirror/8_test.sh Thu Dec 14 22:14:07 2017 (r326862) @@ -35,9 +35,7 @@ devwait # This will take kern.geom.mirror.timeout seco # Re-attach the second mirror and wait for it to synchronize. us1=$(attach_md -t vnode -f $m2) || exit 1 -while [ $(gmirror status $name | grep ACTIVE | wc -l) -ne 2 ]; do -sleep 1 -done +syncwait # Verify the two mirrors are identical. Destroy the gmirror first so that # the mirror metadata is wiped; otherwise the metadata blocks will fail @@ -45,9 +43,9 @@ done # command instead. gmirror destroy $name if cmp -s ${m1} ${m2}; then -echo "ok 1" + echo "ok 1" else -echo "not ok 1" + echo "not ok 1" fi rm -f $m1 $m2 Modified: head/tests/sys/geom/class/mirror/9_test.sh == --- head/tests/sys/geom/class/mirror/9_test.sh Thu Dec 14 22:11:35 2017 (r326861) +++ head/tests/sys/geom/class/mirror/9_test.sh Thu Dec 14 22:14:07 2017 (r326862) @@ -33,9 +33,7 @@ sysctl debug.fail_point.g_mirror_metadata_write='off' # Replace the broken mirror, and then stop the gmirror. gmirror forget $name || exit 1 gmirror insert $name /dev/$us2 || exit 1 -while [ $(gmirror status $name | grep ACTIVE | wc -l) -ne 2 ]; do -sleep 1 -done +syncwait gmirror stop $name || exit 1 # Restart the gmirror on the original two mirrors. One of them is broken, @@ -49,14 +47,12 @@ dd if=/dev/random of=/dev/mirror/$name bs=$ddbs count= # the metadata blocks will fail the comparison. It would be nice to do this # with a "gmirror verify" command instead. gmirror activate $name /dev/$us2 || exit 1 -while [ $(gmirror status $name | grep ACTIVE | wc -l) -ne 2 ]; do -sleep 1 -done +syncwait gmirror destroy $name || exit 1 if cmp -s $m1 $m3; then -echo "ok 1" + echo "ok 1" else -echo "not ok 1" + echo "not ok 1" fi rm -f $m1 $m2 $m3 ___ 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: r326863 - head/tests/sys/geom/class/mirror
Author: markj Date: Thu Dec 14 22:15:46 2017 New Revision: 326863 URL: https://svnweb.freebsd.org/changeset/base/326863 Log: Belatedly add syncwait. X-MFC with: r326861 Modified: head/tests/sys/geom/class/mirror/conf.sh Modified: head/tests/sys/geom/class/mirror/conf.sh == --- head/tests/sys/geom/class/mirror/conf.shThu Dec 14 22:14:07 2017 (r326862) +++ head/tests/sys/geom/class/mirror/conf.shThu Dec 14 22:15:46 2017 (r326863) @@ -12,4 +12,11 @@ gmirror_test_cleanup() } trap gmirror_test_cleanup ABRT EXIT INT TERM +syncwait() +{ + while $(gmirror status -s $name | grep -q SYNCHRONIZING); do + sleep 0.1; + done +} + . `dirname $0`/../geom_subr.sh ___ 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: r326877 - head/tests/sys/geom/class/nop
Author: markj Date: Fri Dec 15 17:10:51 2017 New Revision: 326877 URL: https://svnweb.freebsd.org/changeset/base/326877 Log: Skip gnop tests if the corresponding kernel module isn't available. Reviewed by: asomers MFC after:1 week Differential Revision:https://reviews.freebsd.org/D13500 Modified: head/tests/sys/geom/class/nop/nop_test.sh Modified: head/tests/sys/geom/class/nop/nop_test.sh == --- head/tests/sys/geom/class/nop/nop_test.sh Fri Dec 15 12:37:32 2017 (r326876) +++ head/tests/sys/geom/class/nop/nop_test.sh Fri Dec 15 17:10:51 2017 (r326877) @@ -36,6 +36,7 @@ diskinfo_head() } diskinfo_body() { + load_gnop us=$(alloc_md) atf_check gnop create /dev/${us} md_secsize=$(diskinfo ${us} | cut -wf 2) @@ -62,6 +63,7 @@ io_head() } io_body() { + load_gnop us=$(alloc_md) atf_check gnop create /dev/${us} @@ -87,6 +89,7 @@ size_head() } size_body() { + load_gnop us=$(alloc_md) for mediasize in 65536 524288 1048576; do atf_check gnop create -s ${mediasize} /dev/${us} @@ -111,6 +114,7 @@ stripesize_head() } stripesize_body() { + load_gnop us=$(alloc_md) for ss in 512 1024 2048 4096 8192; do for sofs in `seq 0 512 ${ss}`; do @@ -163,4 +167,11 @@ common_cleanup() rm ${PLAINFILES} fi true +} + +load_gnop() +{ + if ! kldstat -q -m g_nop; then + geom nop load || atf_skip "could not load module for geom nop" + fi } ___ 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: r326878 - head/cddl/usr.sbin/dtrace/tests/tools
Author: markj Date: Fri Dec 15 18:09:23 2017 New Revision: 326878 URL: https://svnweb.freebsd.org/changeset/base/326878 Log: Mark uctf/err.user64mode.ksh as EXFAIL for now. MFC after:1 week Modified: head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Modified: head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh == --- head/cddl/usr.sbin/dtrace/tests/tools/exclude.shFri Dec 15 17:10:51 2017(r326877) +++ head/cddl/usr.sbin/dtrace/tests/tools/exclude.shFri Dec 15 18:09:23 2017(r326878) @@ -166,6 +166,9 @@ exclude EXFAIL common/vars/tst.ucaller.ksh exclude EXFAIL common/scripting/tst.projid.ksh exclude EXFAIL common/scripting/tst.taskid.ksh +# Depends on tst.chasestrings.exe being ELF32. See r326181 and r326285. +exclude EXFAIL common/uctf/err.user64mode.ksh + # This test expects its test program to be installed without CTF data, but # the rest of the programs for this feature need CTF data. Not yet sure how # to build that. ___ 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: r326881 - head/sys/geom/mirror
Author: markj Date: Fri Dec 15 19:03:03 2017 New Revision: 326881 URL: https://svnweb.freebsd.org/changeset/base/326881 Log: Typo. MFC after:1 week Modified: head/sys/geom/mirror/g_mirror.c Modified: head/sys/geom/mirror/g_mirror.c == --- head/sys/geom/mirror/g_mirror.c Fri Dec 15 18:58:21 2017 (r326880) +++ head/sys/geom/mirror/g_mirror.c Fri Dec 15 19:03:03 2017 (r326881) @@ -74,7 +74,7 @@ SYSCTL_UINT(_kern_geom_mirror, OID_AUTO, sync_requests static u_int g_mirror_sync_period = 5; SYSCTL_UINT(_kern_geom_mirror, OID_AUTO, sync_update_period, CTLFLAG_RWTUN, &g_mirror_sync_period, 0, -"Metadata update period during synchroniztion, in seconds"); +"Metadata update period during synchronization, in seconds"); #defineMSLEEP(ident, mtx, priority, wmesg, timeout)do { \ G_MIRROR_DEBUG(4, "%s: Sleeping %p.", __func__, (ident)); \ ___ 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: r326882 - head/sys/geom/mirror
Author: markj Date: Fri Dec 15 19:14:21 2017 New Revision: 326882 URL: https://svnweb.freebsd.org/changeset/base/326882 Log: Give a couple of predication functions a bool return type. No functional change intended. MFC after:1 week Sponsored by: Dell EMC Isilon Modified: head/sys/geom/mirror/g_mirror.c Modified: head/sys/geom/mirror/g_mirror.c == --- head/sys/geom/mirror/g_mirror.c Fri Dec 15 19:03:03 2017 (r326881) +++ head/sys/geom/mirror/g_mirror.c Fri Dec 15 19:14:21 2017 (r326882) @@ -1204,7 +1204,7 @@ g_mirror_start(struct bio *bp) * Return TRUE if the given request is colliding with a in-progress * synchronization request. */ -static int +static bool g_mirror_sync_collision(struct g_mirror_softc *sc, struct bio *bp) { struct g_mirror_disk *disk; @@ -1213,7 +1213,7 @@ g_mirror_sync_collision(struct g_mirror_softc *sc, str u_int i; if (sc->sc_sync.ds_ndisks == 0) - return (0); + return (false); rstart = bp->bio_offset; rend = bp->bio_offset + bp->bio_length; LIST_FOREACH(disk, &sc->sc_disks, d_next) { @@ -1226,33 +1226,33 @@ g_mirror_sync_collision(struct g_mirror_softc *sc, str sstart = sbp->bio_offset; send = sbp->bio_offset + sbp->bio_length; if (rend > sstart && rstart < send) - return (1); + return (true); } } - return (0); + return (false); } /* * Return TRUE if the given sync request is colliding with a in-progress regular * request. */ -static int +static bool g_mirror_regular_collision(struct g_mirror_softc *sc, struct bio *sbp) { off_t rstart, rend, sstart, send; struct bio *bp; if (sc->sc_sync.ds_ndisks == 0) - return (0); + return (false); sstart = sbp->bio_offset; send = sbp->bio_offset + sbp->bio_length; TAILQ_FOREACH(bp, &sc->sc_inflight.queue, bio_queue) { rstart = bp->bio_offset; rend = bp->bio_offset + bp->bio_length; if (rend > sstart && rstart < send) - return (1); + return (true); } - return (0); + return (false); } /* ___ 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: r326882 - head/sys/geom/mirror
On Fri, Dec 15, 2017 at 07:14:21PM +, Mark Johnston wrote: > Author: markj > Date: Fri Dec 15 19:14:21 2017 > New Revision: 326882 > URL: https://svnweb.freebsd.org/changeset/base/326882 > > Log: > Give a couple of predication functions a bool return type. (I meant to write "predicate.") ___ 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: r326912 - head/usr.sbin/makefs
Author: markj Date: Sat Dec 16 20:19:00 2017 New Revision: 326912 URL: https://svnweb.freebsd.org/changeset/base/326912 Log: Fix a logic bug in makefs lazy inode initialization. We may need to initialize multiple inode blocks before writing a given inode. makefs(8) was only initializing a single block at a time, so certain inode allocation patterns could lead to a situation where it wrote an inode to an uninitialized block. That inode might be clobbered by a later initialization, resulting in a filesystem image containing directory entries that point to a seemingly unused inode. Reviewed by: imp MFC after:1 week Differential Revision:https://reviews.freebsd.org/D13505 Modified: head/usr.sbin/makefs/ffs.c Modified: head/usr.sbin/makefs/ffs.c == --- head/usr.sbin/makefs/ffs.c Sat Dec 16 19:40:28 2017(r326911) +++ head/usr.sbin/makefs/ffs.c Sat Dec 16 20:19:00 2017(r326912) @@ -1130,7 +1130,7 @@ ffs_write_inode(union dinode *dp, uint32_t ino, const * Initialize inode blocks on the fly for UFS2. */ initediblk = ufs_rw32(cgp->cg_initediblk, fsopts->needswap); - if (ffs_opts->version == 2 && cgino + INOPB(fs) > initediblk && + while (ffs_opts->version == 2 && cgino + INOPB(fs) > initediblk && initediblk < ufs_rw32(cgp->cg_niblk, fsopts->needswap)) { memset(buf, 0, fs->fs_bsize); dip = (struct ufs2_dinode *)buf; ___ 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: r326919 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: markj Date: Sun Dec 17 18:21:40 2017 New Revision: 326919 URL: https://svnweb.freebsd.org/changeset/base/326919 Log: Unregister the ARC lowmem event handler earlier in arc_fini(). Otherwise a poorly timed lowmem event may attempt to acquire a destroyed lock. Unregister the handler before destroying the ARC reclaim thread. Reported by: gjb MFC after:1 week Differential Revision:https://reviews.freebsd.org/D13480 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Dec 17 06:00:49 2017(r326918) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Dec 17 18:21:40 2017(r326919) @@ -6619,6 +6619,11 @@ arc_init(void) void arc_fini(void) { +#ifdef _KERNEL + if (arc_event_lowmem != NULL) + EVENTHANDLER_DEREGISTER(vm_lowmem, arc_event_lowmem); +#endif + mutex_enter(&arc_reclaim_lock); arc_reclaim_thread_exit = B_TRUE; /* @@ -6664,11 +6669,6 @@ arc_fini(void) buf_fini(); ASSERT0(arc_loaned_bytes); - -#ifdef _KERNEL - if (arc_event_lowmem != NULL) - EVENTHANDLER_DEREGISTER(vm_lowmem, arc_event_lowmem); -#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"
Re: svn commit: r326643 - head/sys/cam
On Wed, Dec 06, 2017 at 11:05:07PM +, Warner Losh wrote: > Author: imp > Date: Wed Dec 6 23:05:07 2017 > New Revision: 326643 > URL: https://svnweb.freebsd.org/changeset/base/326643 > > Log: > Make cam_periph_runccb be safe to call when we can only do polling. > > Sponsored by: Netflix > Differential Revision: https://reviews.freebsd.org/D13388 > > Modified: > head/sys/cam/cam_periph.c > head/sys/cam/cam_xpt.c > head/sys/cam/cam_xpt.h > > Modified: head/sys/cam/cam_periph.c > == > --- head/sys/cam/cam_periph.c Wed Dec 6 23:03:34 2017(r326642) > +++ head/sys/cam/cam_periph.c Wed Dec 6 23:05:07 2017(r326643) > @@ -1160,7 +1160,11 @@ cam_periph_runccb(union ccb *ccb, > struct bintime *starttime; > struct bintime ltime; > int error; > - > + bool sched_stopped; > + struct mtx *periph_mtx; > + struct cam_periph *periph; > + uint32_t timeout = 1; > + > starttime = NULL; > xpt_path_assert(ccb->ccb_h.path, MA_OWNED); > KASSERT((ccb->ccb_h.flags & CAM_UNLOCKED) == 0, > @@ -1180,21 +1184,47 @@ cam_periph_runccb(union ccb *ccb, > devstat_start_transaction(ds, starttime); > } > > + sched_stopped = SCHEDULER_STOPPED(); It looks like this regresses DDB's "dump" command: while SCHEDULER_STOPPED() will be true after a panic, it is not true after breaking into DDB from the console. pho@ reported the following issue: db:0:allt> call doadump Dumping 2234 out of 65426 MB:panic: sleepq_add: td 0xf80003a48000 to sleep on wchan 0xfeb36ce8 with sleeping prohibited cpuid = 18 time = 1513582125 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfeb36940 vpanic() at vpanic+0x19c/frame 0xfeb369c0 kassert_panic() at kassert_panic+0x126/frame 0xfeb36a30 sleepq_add() at sleepq_add+0x34d/frame 0xfeb36a80 _sleep() at _sleep+0x26c/frame 0xfeb36b20 cam_periph_runccb() at cam_periph_runccb+0x17d/frame 0xfeb36c80 dadump() at dadump+0x12a/frame 0xfeb36ef0 dump_append() at dump_append+0xa5/frame 0xfeb36f10 blk_write() at blk_write+0x28b/frame 0xfeb36f50 minidumpsys() at minidumpsys+0x959/frame 0xfeb37010 ... Wouldn't it be more correct to predicate on "dumping" rather than SCHEDULER_STOPPED()? ___ 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: r326935 - in head/sys/cddl/dev/dtrace: amd64 i386
Author: markj Date: Mon Dec 18 17:26:24 2017 New Revision: 326935 URL: https://svnweb.freebsd.org/changeset/base/326935 Log: Avoid CPU migration in dtrace_gethrtime() on x86. dtrace_gethrtime() may be called outside of probe context, and in particular, from the DTRACEIOC_BUFSNAP handler. Disable interrupts rather than using sched_pin() to help ensure that we don't call any external functions when in probe context. PR: 218452 MFC after:1 week Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c == --- head/sys/cddl/dev/dtrace/amd64/dtrace_subr.cMon Dec 18 17:17:07 2017(r326934) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_subr.cMon Dec 18 17:26:24 2017(r326935) @@ -353,11 +353,11 @@ SYSINIT(dtrace_gethrtime_init, SI_SUB_SMP, SI_ORDER_AN * Returns nanoseconds since boot. */ uint64_t -dtrace_gethrtime() +dtrace_gethrtime(void) { uint64_t tsc; - uint32_t lo; - uint32_t hi; + uint32_t lo, hi; + register_t rflags; /* * We split TSC value into lower and higher 32-bit halves and separately @@ -365,7 +365,10 @@ dtrace_gethrtime() * (see nsec_scale calculations) taking into account 32-bit shift of * the higher half and finally add. */ + rflags = intr_disable(); tsc = rdtsc() - tsc_skew[curcpu]; + intr_restore(rflags); + lo = tsc; hi = tsc >> 32; return (((lo * nsec_scale) >> SCALE_SHIFT) + Modified: head/sys/cddl/dev/dtrace/i386/dtrace_subr.c == --- head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Mon Dec 18 17:17:07 2017 (r326934) +++ head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Mon Dec 18 17:26:24 2017 (r326935) @@ -355,11 +355,11 @@ SYSINIT(dtrace_gethrtime_init, SI_SUB_SMP, SI_ORDER_AN * Returns nanoseconds since boot. */ uint64_t -dtrace_gethrtime() +dtrace_gethrtime(void) { uint64_t tsc; - uint32_t lo; - uint32_t hi; + uint32_t lo, hi; + register_t eflags; /* * We split TSC value into lower and higher 32-bit halves and separately @@ -367,7 +367,10 @@ dtrace_gethrtime() * (see nsec_scale calculations) taking into account 32-bit shift of * the higher half and finally add. */ + eflags = intr_disable(); tsc = rdtsc() - tsc_skew[curcpu]; + intr_restore(eflags); + lo = tsc; hi = tsc >> 32; return (((lo * nsec_scale) >> SCALE_SHIFT) + ___ 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: r326983 - head/sys/geom/mirror
Author: markj Date: Tue Dec 19 17:13:04 2017 New Revision: 326983 URL: https://svnweb.freebsd.org/changeset/base/326983 Log: Avoid using bioq_* in gmirror. gmirror does not perform any sorting of I/O requests, so the bioq API doesn't provide any advantages over plain TAILQs. The API also does not provide operations needed by an upcoming change. No functional change intended. The diff shrinks the geom_mirror.ko text and the gmirror softc slightly. Tested by:pho (part of a larger patch) MFC after:1 week Sponsored by: Dell EMC Isilon Modified: head/sys/geom/mirror/g_mirror.c head/sys/geom/mirror/g_mirror.h Modified: head/sys/geom/mirror/g_mirror.c == --- head/sys/geom/mirror/g_mirror.c Tue Dec 19 17:07:50 2017 (r326982) +++ head/sys/geom/mirror/g_mirror.c Tue Dec 19 17:13:04 2017 (r326983) @@ -307,7 +307,7 @@ g_mirror_nrequests(struct g_mirror_softc *sc, struct g u_int nreqs = 0; mtx_lock(&sc->sc_queue_mtx); - TAILQ_FOREACH(bp, &sc->sc_queue.queue, bio_queue) { + TAILQ_FOREACH(bp, &sc->sc_queue, bio_queue) { if (bp->bio_from == cp) nreqs++; } @@ -920,7 +920,7 @@ g_mirror_done(struct bio *bp) sc = bp->bio_from->geom->softc; bp->bio_cflags = G_MIRROR_BIO_FLAG_REGULAR; mtx_lock(&sc->sc_queue_mtx); - bioq_insert_tail(&sc->sc_queue, bp); + TAILQ_INSERT_TAIL(&sc->sc_queue, bp, bio_queue); mtx_unlock(&sc->sc_queue_mtx); wakeup(sc); } @@ -965,7 +965,7 @@ g_mirror_regular_request(struct bio *bp) pbp->bio_completed = pbp->bio_length; if (pbp->bio_cmd == BIO_WRITE || pbp->bio_cmd == BIO_DELETE) { - bioq_remove(&sc->sc_inflight, pbp); + TAILQ_REMOVE(&sc->sc_inflight, pbp, bio_queue); /* Release delayed sync requests if possible. */ g_mirror_sync_release(sc); } @@ -1020,7 +1020,7 @@ g_mirror_regular_request(struct bio *bp) else { pbp->bio_error = 0; mtx_lock(&sc->sc_queue_mtx); - bioq_insert_tail(&sc->sc_queue, pbp); + TAILQ_INSERT_TAIL(&sc->sc_queue, pbp, bio_queue); mtx_unlock(&sc->sc_queue_mtx); G_MIRROR_DEBUG(4, "%s: Waking up %p.", __func__, sc); wakeup(sc); @@ -1040,7 +1040,7 @@ g_mirror_regular_request(struct bio *bp) pbp->bio_error = 0; pbp->bio_completed = pbp->bio_length; } - bioq_remove(&sc->sc_inflight, pbp); + TAILQ_REMOVE(&sc->sc_inflight, pbp, bio_queue); /* Release delayed sync requests if possible. */ g_mirror_sync_release(sc); g_io_deliver(pbp, pbp->bio_error); @@ -1060,7 +1060,7 @@ g_mirror_sync_done(struct bio *bp) sc = bp->bio_from->geom->softc; bp->bio_cflags = G_MIRROR_BIO_FLAG_SYNC; mtx_lock(&sc->sc_queue_mtx); - bioq_insert_tail(&sc->sc_queue, bp); + TAILQ_INSERT_TAIL(&sc->sc_queue, bp, bio_queue); mtx_unlock(&sc->sc_queue_mtx); wakeup(sc); } @@ -1117,30 +1117,33 @@ g_mirror_kernel_dump(struct bio *bp) static void g_mirror_flush(struct g_mirror_softc *sc, struct bio *bp) { - struct bio_queue_head queue; + struct bio_queue queue; struct g_mirror_disk *disk; struct g_consumer *cp; struct bio *cbp; - bioq_init(&queue); + TAILQ_INIT(&queue); LIST_FOREACH(disk, &sc->sc_disks, d_next) { if (disk->d_state != G_MIRROR_DISK_STATE_ACTIVE) continue; cbp = g_clone_bio(bp); if (cbp == NULL) { - while ((cbp = bioq_takefirst(&queue)) != NULL) + while ((cbp = TAILQ_FIRST(&queue)) != NULL) { + TAILQ_REMOVE(&queue, cbp, bio_queue); g_destroy_bio(cbp); + } if (bp->bio_error == 0) bp->bio_error = ENOMEM; g_io_deliver(bp, bp->bio_error); return; } - bioq_insert_tail(&queue, cbp); + TAILQ_INSERT_TAIL(&queue, cbp, bio_queue); cbp->bio_done = g_mirror_flush_done; cbp->bio_caller1 = disk; cbp->bio_to = disk->d_consumer->provider; } - while ((cbp = bioq_takefirst(&queue)) != NULL) { + while ((cbp = TAILQ_FIRST(&queue)) != NULL) { + TAILQ_REMOVE(&queue, cbp, bio_queue); G_M
Re: svn commit: r327031 - in head/sys: conf dev/ixgbe modules/ix modules/ixv
On Wed, Dec 20, 2017 at 06:15:06PM +, Eric Joyner wrote: > Author: erj > Date: Wed Dec 20 18:15:06 2017 > New Revision: 327031 > URL: https://svnweb.freebsd.org/changeset/base/327031 > > Log: > ixgbe(4): Convert driver to use iflib > > Initial update to the ixgbe PF and VF drivers to support the iflib > interface. > > The PF driver version is bumped to 4.0.0, and the VF driver version is > bumped to 2.0.0. > > Special thanks to sbruno@ for the support in helping make this conversion > happen. > > Submitted by: Jeb Cramer , Krzysztof Galazka > (Chris) , Piotr Pietruszewski > > Reviewed by:sbruno@, shurd@, #IntelNetworking > Tested by: Jeffrey Pieper , Sergey Kozlov > > Sponsored by: Limelight Networks, Intel Corporation > Differential Revision: https://reviews.freebsd.org/D11727 This seems to have broken at least the i386 kernel build. Could you please take a look? https://ci.freebsd.org/job/FreeBSD-head-i386-build/5330/console ___ 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"