svn commit: r332877 - head/usr.sbin/syslogd
Author: delphij Date: Mon Apr 23 07:15:49 2018 New Revision: 332877 URL: https://svnweb.freebsd.org/changeset/base/332877 Log: Correct size for allocation and bzero of fdsr. MFC after:2 weeks Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Sun Apr 22 23:51:24 2018 (r332876) +++ head/usr.sbin/syslogd/syslogd.c Mon Apr 23 07:15:49 2018 (r332877) @@ -744,7 +744,7 @@ main(int argc, char *argv[]) fdsrmax = sl->sl_socket; } fdsr = (fd_set *)calloc(howmany(fdsrmax+1, NFDBITS), - sizeof(fd_mask)); + sizeof(*fdsr)); if (fdsr == NULL) errx(1, "calloc fd_set"); @@ -763,7 +763,7 @@ main(int argc, char *argv[]) } bzero(fdsr, howmany(fdsrmax+1, NFDBITS) * - sizeof(fd_mask)); + sizeof(*fdsr)); STAILQ_FOREACH(sl, &shead, next) { if (sl->sl_socket != -1 && sl->sl_recv != 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: r332879 - head/sys/kern
Author: mjg Date: Mon Apr 23 07:52:10 2018 New Revision: 332879 URL: https://svnweb.freebsd.org/changeset/base/332879 Log: lockf: skip the hard work in lf_purgelocks if possible Tested by: pho Modified: head/sys/kern/kern_lockf.c Modified: head/sys/kern/kern_lockf.c == --- head/sys/kern/kern_lockf.c Mon Apr 23 07:51:19 2018(r332878) +++ head/sys/kern/kern_lockf.c Mon Apr 23 07:52:10 2018(r332879) @@ -777,6 +777,12 @@ lf_purgelocks(struct vnode *vp, struct lockf **statep) return; } *statep = NULL; + if (LIST_EMPTY(&state->ls_active) && state->ls_threads == 0) { + KASSERT(LIST_EMPTY(&state->ls_pending), + ("freeing state with pending locks")); + VI_UNLOCK(vp); + goto out_free; + } state->ls_threads++; VI_UNLOCK(vp); @@ -823,6 +829,7 @@ lf_purgelocks(struct vnode *vp, struct lockf **statep) LIST_REMOVE(lock, lf_link); lf_free_lock(lock); } +out_free: sx_xlock(&lf_lock_states_lock); LIST_REMOVE(state, ls_link); sx_xunlock(&lf_lock_states_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: r332880 - head/sys/kern
Author: mjg Date: Mon Apr 23 07:52:56 2018 New Revision: 332880 URL: https://svnweb.freebsd.org/changeset/base/332880 Log: lockf: perform wakeup onlly when there is anybody waiting Tested by: pho Modified: head/sys/kern/kern_lockf.c Modified: head/sys/kern/kern_lockf.c == --- head/sys/kern/kern_lockf.c Mon Apr 23 07:52:10 2018(r332879) +++ head/sys/kern/kern_lockf.c Mon Apr 23 07:52:56 2018(r332880) @@ -724,10 +724,11 @@ retry_setlock: VI_LOCK(vp); state->ls_threads--; - wakeup(state); if (LIST_EMPTY(&state->ls_active) && state->ls_threads == 0) { KASSERT(LIST_EMPTY(&state->ls_pending), ("freeable state with pending locks")); + } else { + wakeup(state); } VI_UNLOCK(vp); ___ 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: r332881 - head/sys/kern
Author: mjg Date: Mon Apr 23 07:54:02 2018 New Revision: 332881 URL: https://svnweb.freebsd.org/changeset/base/332881 Log: lockf: skip locking the graph if not necessary (common case) Tested by: pho Modified: head/sys/kern/kern_lockf.c Modified: head/sys/kern/kern_lockf.c == --- head/sys/kern/kern_lockf.c Mon Apr 23 07:52:56 2018(r332880) +++ head/sys/kern/kern_lockf.c Mon Apr 23 07:54:02 2018(r332881) @@ -1053,6 +1053,12 @@ lf_add_incoming(struct lockf *state, struct lockf_entr struct lockf_entry *overlap; int error; + sx_assert(&state->ls_lock, SX_XLOCKED); + if (LIST_EMPTY(&state->ls_pending)) + return (0); + + error = 0; + sx_xlock(&lf_owner_graph_lock); LIST_FOREACH(overlap, &state->ls_pending, lf_link) { if (!lf_blocks(lock, overlap)) continue; @@ -1070,10 +1076,11 @@ lf_add_incoming(struct lockf *state, struct lockf_entr */ if (error) { lf_remove_incoming(lock); - return (error); + break; } } - return (0); + sx_xunlock(&lf_owner_graph_lock); + return (error); } /* @@ -1509,9 +1516,7 @@ lf_setlock(struct lockf *state, struct lockf_entry *lo * edges from any currently pending lock that the new lock * would block. */ - sx_xlock(&lf_owner_graph_lock); error = lf_add_incoming(state, lock); - sx_xunlock(&lf_owner_graph_lock); if (error) { #ifdef LOCKF_DEBUG if (lockf_debug & 1) @@ -1840,9 +1845,7 @@ lf_split(struct lockf *state, struct lockf_entry *lock splitlock->lf_start = lock2->lf_end + 1; LIST_INIT(&splitlock->lf_outedges); LIST_INIT(&splitlock->lf_inedges); - sx_xlock(&lf_owner_graph_lock); lf_add_incoming(state, splitlock); - sx_xunlock(&lf_owner_graph_lock); lf_set_end(state, lock1, lock2->lf_start - 1, granted); ___ 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: r332878 - head/sys/kern
Author: mjg Date: Mon Apr 23 07:51:19 2018 New Revision: 332878 URL: https://svnweb.freebsd.org/changeset/base/332878 Log: lockf: free state only when recycling the vnode This avoids malloc/free cycles when locking/unlocking the vnode when nobody is contending. Tested by:pho Modified: head/sys/kern/kern_lockf.c Modified: head/sys/kern/kern_lockf.c == --- head/sys/kern/kern_lockf.c Mon Apr 23 07:15:49 2018(r332877) +++ head/sys/kern/kern_lockf.c Mon Apr 23 07:51:19 2018(r332878) @@ -412,7 +412,7 @@ int lf_advlockasync(struct vop_advlockasync_args *ap, struct lockf **statep, u_quad_t size) { - struct lockf *state, *freestate = NULL; + struct lockf *state; struct flock *fl = ap->a_fl; struct lockf_entry *lock; struct vnode *vp = ap->a_vp; @@ -721,38 +721,17 @@ retry_setlock: #endif sx_xunlock(&state->ls_lock); - /* -* If we have removed the last active lock on the vnode and -* this is the last thread that was in-progress, we can free -* the state structure. We update the caller's pointer inside -* the vnode interlock but call free outside. -* -* XXX alternatively, keep the state structure around until -* the filesystem recycles - requires a callback from the -* filesystem. -*/ VI_LOCK(vp); state->ls_threads--; wakeup(state); if (LIST_EMPTY(&state->ls_active) && state->ls_threads == 0) { KASSERT(LIST_EMPTY(&state->ls_pending), - ("freeing state with pending locks")); - freestate = state; - *statep = NULL; + ("freeable state with pending locks")); } VI_UNLOCK(vp); - if (freestate != NULL) { - sx_xlock(&lf_lock_states_lock); - LIST_REMOVE(freestate, ls_link); - sx_xunlock(&lf_lock_states_lock); - sx_destroy(&freestate->ls_lock); - free(freestate, M_LOCKF); - freestate = NULL; - } - if (error == EDOOFUS) { KASSERT(ap->a_op == F_SETLK, ("EDOOFUS")); goto retry_setlock; @@ -793,62 +772,62 @@ lf_purgelocks(struct vnode *vp, struct lockf **statep) KASSERT(vp->v_iflag & VI_DOOMED, ("lf_purgelocks: vp %p has not vgone yet", vp)); state = *statep; - if (state) { - *statep = NULL; - state->ls_threads++; + if (state == NULL) { VI_UNLOCK(vp); + return; + } + *statep = NULL; + state->ls_threads++; + VI_UNLOCK(vp); - sx_xlock(&state->ls_lock); - sx_xlock(&lf_owner_graph_lock); - LIST_FOREACH_SAFE(lock, &state->ls_pending, lf_link, nlock) { - LIST_REMOVE(lock, lf_link); - lf_remove_outgoing(lock); - lf_remove_incoming(lock); + sx_xlock(&state->ls_lock); + sx_xlock(&lf_owner_graph_lock); + LIST_FOREACH_SAFE(lock, &state->ls_pending, lf_link, nlock) { + LIST_REMOVE(lock, lf_link); + lf_remove_outgoing(lock); + lf_remove_incoming(lock); - /* -* If its an async lock, we can just free it -* here, otherwise we let the sleeping thread -* free it. -*/ - if (lock->lf_async_task) { - lf_free_lock(lock); - } else { - lock->lf_flags |= F_INTR; - wakeup(lock); - } - } - sx_xunlock(&lf_owner_graph_lock); - sx_xunlock(&state->ls_lock); - /* -* Wait for all other threads, sleeping and otherwise -* to leave. +* If its an async lock, we can just free it +* here, otherwise we let the sleeping thread +* free it. */ - VI_LOCK(vp); - while (state->ls_threads > 1) - msleep(state, VI_MTX(vp), 0, "purgelocks", 0); - VI_UNLOCK(vp); - - /* -* We can just free all the active locks since they -* will have no dependencies (we removed them all -* above). We don't need to bother locking since we -* are the last thread using this state structure. -*/ - KASSERT(LIST_EMPTY(&state->ls_pending), - ("lock pending for %p", state)); - LIST_FOREACH_SAFE(lock, &state->ls_active, lf_link, nlock) { - LIST_REMOVE(lock, lf_link); +
svn commit: r332882 - head/sys/kern
Author: mjg Date: Mon Apr 23 08:23:10 2018 New Revision: 332882 URL: https://svnweb.freebsd.org/changeset/base/332882 Log: lockf: add per-chain locks to the owner hash This combined with previous changes significantly depessimizes the behaviour under contentnion. In particular the lock1_processes test (locking/unlocking separate files) from the will-it-scale suite was executed with 128 concurrency on a 4-socket Broadwell with 128 hardware threads. Operations/second (lock+unlock) go from ~75 to ~4500 (6000%) For reference single-process is ~168 (i.e. on stock kernel the resulting perf is less than *half* of the single-threaded run), Note this still does not really scale all that well as the locks were just bolted on top of the current implementation. Significant room for improvement is still here. In particular the top performance fluctuates depending on the extent of false sharing in given run (which extends beyond the file). Added chain+lock pairs were not padded w.r.t. cacheline size. One big ticket item is the hash used for spreading threads: it used to be the process pid (which basically serialized all threaded ops). Temporarily the vnode addr was slapped in instead. Tested by: pho Modified: head/sys/kern/kern_lockf.c Modified: head/sys/kern/kern_lockf.c == --- head/sys/kern/kern_lockf.c Mon Apr 23 07:54:02 2018(r332881) +++ head/sys/kern/kern_lockf.c Mon Apr 23 08:23:10 2018(r332882) @@ -188,7 +188,6 @@ static void lf_print_owner(struct lock_owner *); * Locks: * (s) locked by state->ls_lock * (S) locked by lf_lock_states_lock - * (l) locked by lf_lock_owners_lock * (g) locked by lf_owner_graph_lock * (c) const until freeing */ @@ -201,15 +200,20 @@ struct lock_owner { caddr_t lo_id; /* (c) Id value passed to lf_advlock */ pid_t lo_pid; /* (c) Process Id of the lock owner */ int lo_sysid; /* (c) System Id of the lock owner */ + int lo_hash;/* (c) Used to lock the appropriate chain */ struct owner_vertex *lo_vertex; /* (g) entry in deadlock graph */ }; LIST_HEAD(lock_owner_list, lock_owner); +struct lock_owner_chain { + struct sx lock; + struct lock_owner_list list; +}; + static struct sx lf_lock_states_lock; static struct lockf_list lf_lock_states; /* (S) */ -static struct sx lf_lock_owners_lock; -static struct lock_owner_list lf_lock_owners[LOCK_OWNER_HASH_SIZE]; /* (l) */ +static struct lock_owner_chain lf_lock_owners[LOCK_OWNER_HASH_SIZE]; /* * Structures for deadlock detection. @@ -283,9 +287,10 @@ lf_init(void *dummy) sx_init(&lf_lock_states_lock, "lock states lock"); LIST_INIT(&lf_lock_states); - sx_init(&lf_lock_owners_lock, "lock owners lock"); - for (i = 0; i < LOCK_OWNER_HASH_SIZE; i++) - LIST_INIT(&lf_lock_owners[i]); + for (i = 0; i < LOCK_OWNER_HASH_SIZE; i++) { + sx_init(&lf_lock_owners[i].lock, "lock owners lock"); + LIST_INIT(&lf_lock_owners[i].list); + } sx_init(&lf_owner_graph_lock, "owner graph lock"); graph_init(&lf_owner_graph); @@ -342,9 +347,9 @@ lf_alloc_lock(struct lock_owner *lo) printf("Allocated lock %p\n", lf); #endif if (lo) { - sx_xlock(&lf_lock_owners_lock); + sx_xlock(&lf_lock_owners[lo->lo_hash].lock); lo->lo_refs++; - sx_xunlock(&lf_lock_owners_lock); + sx_xunlock(&lf_lock_owners[lo->lo_hash].lock); lf->lf_owner = lo; } @@ -354,6 +359,7 @@ lf_alloc_lock(struct lock_owner *lo) static int lf_free_lock(struct lockf_entry *lock) { + struct sx *chainlock; KASSERT(lock->lf_refs > 0, ("lockf_entry negative ref count %p", lock)); if (--lock->lf_refs > 0) @@ -369,7 +375,8 @@ lf_free_lock(struct lockf_entry *lock) ("freeing lock with dependencies")); KASSERT(LIST_EMPTY(&lock->lf_inedges), ("freeing lock with dependants")); - sx_xlock(&lf_lock_owners_lock); + chainlock = &lf_lock_owners[lo->lo_hash].lock; + sx_xlock(chainlock); KASSERT(lo->lo_refs > 0, ("lock owner refcount")); lo->lo_refs--; if (lo->lo_refs == 0) { @@ -391,7 +398,7 @@ lf_free_lock(struct lockf_entry *lock) printf("Freed lock owner %p\n", lo); #endif } - sx_unlock(&lf_lock_owners_lock); + sx_unlock(chainlock); } if ((lock->lf_flags & F_REMOTE) && lock->lf_vnode) { vrele(lock->lf_vnode); @@ -494,8 +501,8 @@ retry_setlock:
svn commit: r332885 - in head/sys: conf dev/flash
Author: br Date: Mon Apr 23 10:35:00 2018 New Revision: 332885 URL: https://svnweb.freebsd.org/changeset/base/332885 Log: Add driver for Cadence Quad SPI Flash Controller found on Intel® Arria® 10 SoC. Cadence Quad SPI Flash is not generic SPI controller, but SPI flash controller, so don't use spibus here, instead provide quad spi flash interface. Since it is not on spibus, then mx25l flash device driver is not usable here, so provide new n25q flash device driver with quad spi flash interface. Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D10245 Added: head/sys/dev/flash/cqspi.c (contents, props changed) head/sys/dev/flash/cqspi.h (contents, props changed) head/sys/dev/flash/n25q.c (contents, props changed) head/sys/dev/flash/qspi_if.m (contents, props changed) Modified: head/sys/conf/files head/sys/dev/flash/mx25lreg.h Modified: head/sys/conf/files == --- head/sys/conf/files Mon Apr 23 09:01:25 2018(r332884) +++ head/sys/conf/files Mon Apr 23 10:35:00 2018(r332885) @@ -1762,7 +1762,7 @@ dev/fdt/fdt_clock_if.moptional fdt fdt_clock dev/fdt/fdt_common.c optional fdt dev/fdt/fdt_pinctrl.c optional fdt fdt_pinctrl dev/fdt/fdt_pinctrl_if.m optional fdt fdt_pinctrl -dev/fdt/fdt_slicer.c optional fdt cfi | fdt nand | fdt mx25l +dev/fdt/fdt_slicer.c optional fdt cfi | fdt nand | fdt mx25l | fdt n25q dev/fdt/fdt_static_dtb.S optional fdt fdt_dtb_static \ dependency "fdt_dtb_file" dev/fdt/simplebus.coptional fdt @@ -1781,7 +1781,10 @@ dev/firewire/if_fwip.c optional fwip dev/firewire/sbp.c optional sbp dev/firewire/sbp_targ.coptional sbp_targ dev/flash/at45d.c optional at45d +dev/flash/cqspi.c optional cqspi dev/flash/mx25l.c optional mx25l +dev/flash/n25q.c optional n25q +dev/flash/qspi_if.moptional cqspi | n25q dev/fxp/if_fxp.c optional fxp dev/fxp/inphy.coptional fxp dev/gem/if_gem.c optional gem @@ -3672,7 +3675,7 @@ geom/geom_disk.c standard geom/geom_dump.c standard geom/geom_event.c standard geom/geom_fox.coptional geom_fox -geom/geom_flashmap.c optional fdt cfi | fdt nand | fdt mx25l | mmcsd +geom/geom_flashmap.c optional fdt cfi | fdt nand | fdt mx25l | mmcsd | fdt n25q geom/geom_io.c standard geom/geom_kern.c standard geom/geom_map.coptional geom_map Added: head/sys/dev/flash/cqspi.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/flash/cqspi.c Mon Apr 23 10:35:00 2018(r332885) @@ -0,0 +1,768 @@ +/*- + * Copyright (c) 2017-2018 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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. + */ + +/* + * Cadence Quad SPI Flash Controller driver. + * 4B-addressing mode supported only. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#includ
svn commit: r332886 - head/sys/netinet6
Author: ae Date: Mon Apr 23 12:20:07 2018 New Revision: 332886 URL: https://svnweb.freebsd.org/changeset/base/332886 Log: icmp6_reflect() sends ICMPv6 message with new IPv6 header. So, it is considered as originated by our host packet. And thus rcvif should be NULL, since it is used by ipfw(4) to determine that packet was originated from this host. Some of icmp6_reflect() consumers reuse mbuf and m_pkthdr without resetting rcvif pointer. To avoid this always reset m_pkthdr.rcvif pointer to NULL in icmp6_reflect(). Also remove such line and comment describing this from icmp6_error(), since it does not longer matters. PR: 227674 Reported by: eugen MFC after:1 week Modified: head/sys/netinet6/icmp6.c Modified: head/sys/netinet6/icmp6.c == --- head/sys/netinet6/icmp6.c Mon Apr 23 10:35:00 2018(r332885) +++ head/sys/netinet6/icmp6.c Mon Apr 23 12:20:07 2018(r332886) @@ -383,15 +383,6 @@ icmp6_error(struct mbuf *m, int type, int code, int pa icmp6->icmp6_code = code; icmp6->icmp6_pptr = htonl((u_int32_t)param); - /* -* icmp6_reflect() is designed to be in the input path. -* icmp6_error() can be called from both input and output path, -* and if we are in output path rcvif could contain bogus value. -* clear m->m_pkthdr.rcvif for safety, we should have enough scope -* information in ip header (nip6). -*/ - m->m_pkthdr.rcvif = NULL; - ICMP6STAT_INC(icp6s_outhist[type]); icmp6_reflect(m, sizeof(struct ip6_hdr)); /* header order: IPv6 - ICMPv6 */ @@ -2183,7 +2174,7 @@ icmp6_reflect(struct mbuf *m, size_t off) */ m->m_flags &= ~(M_BCAST|M_MCAST); - + m->m_pkthdr.rcvif = NULL; ip6_output(m, NULL, NULL, 0, NULL, &outif, NULL); if (outif) icmp6_ifoutstat_inc(outif, type, 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"
svn commit: r332887 - in head/sys: arm/conf dts/arm
Author: br Date: Mon Apr 23 12:23:05 2018 New Revision: 332887 URL: https://svnweb.freebsd.org/changeset/base/332887 Log: Enable ARM PL330 DMA engine and Cadence Quad SPI flash controller on Intel Arria 10 SoC boards. Tested on Intel Arria 10 SoC Development Kit. Sponsored by: DARPA, AFRL Modified: head/sys/arm/conf/SOCFPGA head/sys/dts/arm/socfpga_arria10_socdk_sdmmc.dts Modified: head/sys/arm/conf/SOCFPGA == --- head/sys/arm/conf/SOCFPGA Mon Apr 23 12:20:07 2018(r332886) +++ head/sys/arm/conf/SOCFPGA Mon Apr 23 12:23:05 2018(r332887) @@ -47,6 +47,10 @@ options INTRNG # ARM MPCore timer device mpcore_timer +# DMA support +device xdma +device pl330 + # MMC/SD/SDIO Card slot support device mmc # mmc/sd bus device mmcsd # mmc/sd flash cards @@ -80,6 +84,8 @@ deviceiicbus # SPI device spibus +device cqspi +device n25q # Ethernet device ether Modified: head/sys/dts/arm/socfpga_arria10_socdk_sdmmc.dts == --- head/sys/dts/arm/socfpga_arria10_socdk_sdmmc.dtsMon Apr 23 12:20:07 2018(r332886) +++ head/sys/dts/arm/socfpga_arria10_socdk_sdmmc.dtsMon Apr 23 12:23:05 2018(r332887) @@ -84,3 +84,37 @@ &usb0 { dr_mode = "host"; }; + +&qspi { + status = "okay"; + + dmas = <&pdma 24>, <&pdma 25>; + dma-names = "tx", "rx"; + + flash0: n25q00@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "n25q00aa"; + reg = <0>; + spi-max-frequency = <1>; + + m25p,fast-read; + cdns,page-size = <256>; + cdns,block-size = <16>; + cdns,read-delay = <4>; + cdns,tshsl-ns = <50>; + cdns,tsd2d-ns = <50>; + cdns,tchsh-ns = <4>; + cdns,tslch-ns = <4>; + + partition@qspi-boot { + label = "boot"; + reg = <0x0 0x272>; + }; + + partition@qspi-rootfs { + label = "rootfs"; + reg = <0x272 0x58E>; + }; + }; +}; ___ 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: r330834 - head/sys/dev/vt/hw/vga
On Tue, Mar 13, 2018 at 09:38:54AM +, Roger Pau Monné wrote: > Author: royger > Date: Tue Mar 13 09:38:53 2018 > New Revision: 330834 > URL: https://svnweb.freebsd.org/changeset/base/330834 > > Log: > vt_vga: check if VGA is available from ACPI FADT table > > On x86 the IA-PC Boot Flags in the FADT can signal whether VGA is > available or not. > > Sponsored by: Citrix systems R&D > Reviewed by:marcel > Differential revision: https://reviews.freebsd.org/D14397 > > Modified: > head/sys/dev/vt/hw/vga/vt_vga.c Hi, Running the latest vm snapshots on bhyve, /dev/ttyv[0-b] devices are not created leading to getty spamming the console: Apr 23 13:28:49 freebsd getty[710]: open /dev/ttyv6: No such file or directory Apr 23 13:28:49 freebsd getty[709]: open /dev/ttyv1: No such file or directory Apr 23 13:28:49 freebsd getty[715]: open /dev/ttyv5: No such file or directory Apr 23 13:28:49 freebsd getty[713]: open /dev/ttyv7: No such file or directory Tracking through snapshots the change is somewhere between: good ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/VM-IMAGES/12.0-CURRENT/amd64/20180307/ bad ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/VM-IMAGES/12.0-CURRENT/amd64/20180315/ reverting r330834 returns to the old behaviour. - [tj] ___ 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: r330834 - head/sys/dev/vt/hw/vga
On Mon, Apr 23, 2018 at 7:43 AM, Tom Jones wrote: > On Tue, Mar 13, 2018 at 09:38:54AM +, Roger Pau Monné wrote: > > Author: royger > > Date: Tue Mar 13 09:38:53 2018 > > New Revision: 330834 > > URL: https://svnweb.freebsd.org/changeset/base/330834 > > > > Log: > > vt_vga: check if VGA is available from ACPI FADT table > > > > On x86 the IA-PC Boot Flags in the FADT can signal whether VGA is > > available or not. > > > > Sponsored by: Citrix systems R&D > > Reviewed by:marcel > > Differential revision: https://reviews.freebsd.org/D14397 > > > > Modified: > > head/sys/dev/vt/hw/vga/vt_vga.c > > Hi, > > Running the latest vm snapshots on bhyve, /dev/ttyv[0-b] devices are not > created leading to getty spamming the console: > > Apr 23 13:28:49 freebsd getty[710]: open /dev/ttyv6: No such file or > directory > Apr 23 13:28:49 freebsd getty[709]: open /dev/ttyv1: No such file or > directory > Apr 23 13:28:49 freebsd getty[715]: open /dev/ttyv5: No such file or > directory > Apr 23 13:28:49 freebsd getty[713]: open /dev/ttyv7: No such file or > directory > > Tracking through snapshots the change is somewhere between: > > good ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/VM-IMAGES/ > 12.0-CURRENT/amd64/20180307/ > bad ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/VM-IMAGES/ > 12.0-CURRENT/amd64/20180315/ > > reverting r330834 returns to the old behaviour. > You need to change /etc/ttys to have 'onifexists' or 'off' for those devices. There was a change to init/getty to support pluggable TTYs that is causing it. Historically, there was no 'onifexists' so init/getty basically stopped looking at a device that wasn't there. Now we have TTYs that we want to present a getty on come and go, we need to adapt. Warner ___ 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: r330834 - head/sys/dev/vt/hw/vga
On Mon, Apr 23, 2018 at 8:52 AM, Warner Losh wrote: > > > On Mon, Apr 23, 2018 at 7:43 AM, Tom Jones wrote: > >> On Tue, Mar 13, 2018 at 09:38:54AM +, Roger Pau Monné wrote: >> > Author: royger >> > Date: Tue Mar 13 09:38:53 2018 >> > New Revision: 330834 >> > URL: https://svnweb.freebsd.org/changeset/base/330834 >> > >> > Log: >> > vt_vga: check if VGA is available from ACPI FADT table >> > >> > On x86 the IA-PC Boot Flags in the FADT can signal whether VGA is >> > available or not. >> > >> > Sponsored by: Citrix systems R&D >> > Reviewed by:marcel >> > Differential revision: https://reviews.freebsd.org/D14397 >> > >> > Modified: >> > head/sys/dev/vt/hw/vga/vt_vga.c >> >> Hi, >> >> Running the latest vm snapshots on bhyve, /dev/ttyv[0-b] devices are not >> created leading to getty spamming the console: >> >> Apr 23 13:28:49 freebsd getty[710]: open /dev/ttyv6: No such file or >> directory >> Apr 23 13:28:49 freebsd getty[709]: open /dev/ttyv1: No such file or >> directory >> Apr 23 13:28:49 freebsd getty[715]: open /dev/ttyv5: No such file or >> directory >> Apr 23 13:28:49 freebsd getty[713]: open /dev/ttyv7: No such file or >> directory >> >> Tracking through snapshots the change is somewhere between: >> >> good ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/VM-IMAGES/12.0- >> CURRENT/amd64/20180307/ >> bad ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/VM-IMAGES/12.0- >> CURRENT/amd64/20180315/ >> >> reverting r330834 returns to the old behaviour. >> > > You need to change /etc/ttys to have 'onifexists' or 'off' for those > devices. There was a change to init/getty to support pluggable TTYs that is > causing it. Historically, there was no 'onifexists' so init/getty basically > stopped looking at a device that wasn't there. Now we have TTYs that we > want to present a getty on come and go, we need to adapt. > https://reviews.freebsd.org/D15169 fixes the problem. Warner ___ 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: r332860 - head/sys/kern
Hi Mark, Let me start by saying that I appreciate your well-reasoned response. (I think) I understand your reasoning, I appreciate your well-explained argument, and I respect your opinion. I just wanted to make that clear up front. On Sun, Apr 22, 2018 at 1:11 PM, Mark Johnston wrote: > > > All too often, my ability to debug assertion violations is hindered because > > the system trips over yet another assertion while dumping the core. If we > > skip the assertion, nothing bad happens. (The post-panic debugging code > > already needs to deal with systems that are inconsistent, and it does a > > pretty good job at it.) > > I think we make a decent effort to fix such problems as they arise, but > you are declaring defeat on behalf of everyone. Did you make some effort > to fix or report these issues before resorting to the more drastic > measure taken here? We try to report or fix them as they arise. However, you don't know there is a problem until you actually run into it. And, you don't run into the problem until you can't get a core dump due to the assertion. (And, with elusive problems, it isn't always easy to duplicate them. So, fixing the assertion is sometimes "too late".) > > On the other hand, I really am not sure what you are worried might happen > > if we skip checking assertions after we've already panic'd. As far as I can > > tell, the likely worst case is that we hit a true panic of some kind. In > > that case, we're no worse off than before. > > > > I think the one obvious exception is when we're purposely trying to > > validate the post-panic debugging code. In that case, you can change the > > sysctl/tunable to enable troubleshooting. > > What about a user whose test system panics and fails to dump? With > assertions enabled, a developer has a better chance of spotting the > problem. Now we need at least one extra round trip to the user to > diagnose the problem, which may not be readily reproducible in the first > place. That's true. However, this is equally true in the other direction: Prior to this change, when a user tripped over an assertion and was unable to get a coredump due to a second post-panic assertion, it took (at least) another round-trip to get a coredump. First, without the capability to ignore assertions after a panic (introduced by this commit), you would need to fix the actual assertion to enable the user to get a coredump. At minimum, I think this change has value in that case. This change gives you a mechanism to get a coredump without requiring that you fix the assertion and get the user to recompile with the patch. But, moreover, if we change the default back to panic'ing on a second assertion, we will hamper our ability to get usable reports about elusive bugs. If we leave the default "as is", it won't take an extra round-trip to tell the user how to get a coredump. If we change the default (or, perhaps more correctly, "restore the prior default"), we will still need a second round-trip to get coredumps. That makes it tough to chase elusive bugs. > > I would honestly appreciate someone explaining the dangers in disabling a > > response to assertion violations after we've already panic'd and are simply > > trying to troubleshoot, because they are not obvious to me. But, I could > > simply be missing them. > > The assertions help identify code that is being executed during a dump > when it shouldn't be. In general we rely on users to opt in to running > INVARIANTS kernels because developers don't catch every single bug. With > this change it's harder to be confident in the kernel dump code. (Or in > any post-panic debugging code for that matter.) I can appreciate that. I am generally skeptical of the value of assertions in general-use code after a panic, since we already know the system is in an inconsistent/unexpected state. And, it is hard to predict all the various ways it could possibly be broken. However, I do recognize that there is code which specifically is written to run post-panic, and which has assertions which SHOULD be true, even after a panic. > I dislike the change and would prefer the default to be inverted. At the > very least I think we should print the assertion message rather than > returning silently from kassert_panic(). I still think this change has value (as described above). I can understand the argument for changing the default. In fact, after thinking about your email, I'm leaning towards doing that. But, I want to ponder it more today. If we leave the default alone, I agree we should print the assertion message (albeit with some rate limit). Jonathan ___ 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: r332860 - head/sys/kern
On Mon, Apr 23, 2018 at 9:12 AM, Jonathan T. Looney wrote: > > If we leave the default alone, I agree we should print the assertion > message (albeit with some rate limit). > We should print the first N asserts we hit during a kernel panic core dump, then stop. I'd suggest N should be 10 or 20. For me, the only asserts that have value during a panic are the ones that prevent bad things from happening. The only bad thing that really can happen is either wedging the machine, so we don't finish the dump (watchdogs solve that) or writing to a naughty place (defined as not within the bounds of a swap partition). I'm having a hard time seeing in what actual value assertions that aren't related to either of these areas buy us. Warner ___ 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: r332890 - head/sys/dev/sound/pci/hda
Author: sbruno Date: Mon Apr 23 16:38:27 2018 New Revision: 332890 URL: https://svnweb.freebsd.org/changeset/base/332890 Log: hda(4) - add quirk for Dell XPS9560 audio gleaned and massages from linux https://github.com/freebsd/freebsd/pull/137 Submitted by: K Staring MFC after:3 days Relnotes: yes Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c head/sys/dev/sound/pci/hda/hdac.h Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c == --- head/sys/dev/sound/pci/hda/hdaa_patches.c Mon Apr 23 14:22:16 2018 (r332889) +++ head/sys/dev/sound/pci/hda/hdaa_patches.c Mon Apr 23 16:38:27 2018 (r332890) @@ -410,6 +410,15 @@ hdac_pin_patch(struct hdaa_widget *w) patch = "as=1 seq=15"; break; } + } else if (id == HDA_CODEC_ALC298 && subid == DELL_XPS9560_SUBVENDOR) { + switch (nid) { + case 24: + config = 0x01a1913c; + break; + case 26: + config = 0x01a1913d; + break; + } } if (patch != NULL) Modified: head/sys/dev/sound/pci/hda/hdac.h == --- head/sys/dev/sound/pci/hda/hdac.h Mon Apr 23 14:22:16 2018 (r332889) +++ head/sys/dev/sound/pci/hda/hdac.h Mon Apr 23 16:38:27 2018 (r332890) @@ -201,6 +201,7 @@ #define DELL_I1300_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x01c9) #define DELL_XPSM1210_SUBVENDORHDA_MODEL_CONSTRUCT(DELL, 0x01d7) #define DELL_OPLX745_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x01da) +#define DELL_XPS9560_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x07be) #define DELL_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x) /* Clevo */ ___ 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: r332891 - head/sys/arm/include
Author: jhb Date: Mon Apr 23 16:50:37 2018 New Revision: 332891 URL: https://svnweb.freebsd.org/changeset/base/332891 Log: Fix some harmless type mismatches in the ARM atomic_cmpset implementations. The return value of atomic_cmpset() and atomic_fcmpset() is an int (which is really a bool) that has the values 0 or 1. Some of the inlines were using the type being operated on (e.g. uint32_t) as either the return type of the function, or the type of a local 'ret' variable used to hold the return value. Fix all of these to just use plain 'int'. Due to C promotion rules and the fact that the value can only be 0 or 1, these should all be harmless. Reviewed by: imp (only the v4 ones) MFC after:1 week Differential Revision:https://reviews.freebsd.org/D15147 Modified: head/sys/arm/include/atomic-v4.h head/sys/arm/include/atomic-v6.h Modified: head/sys/arm/include/atomic-v4.h == --- head/sys/arm/include/atomic-v4.hMon Apr 23 16:38:27 2018 (r332890) +++ head/sys/arm/include/atomic-v4.hMon Apr 23 16:50:37 2018 (r332891) @@ -115,7 +115,7 @@ atomic_clear_64(volatile uint64_t *address, uint64_t c static __inline int atomic_fcmpset_32(volatile u_int32_t *p, volatile u_int32_t *cmpval, volatile u_int32_t newval) { - u_int32_t ret; + int ret; __with_interrupts_disabled( { @@ -134,7 +134,7 @@ atomic_fcmpset_32(volatile u_int32_t *p, volatile u_in static __inline int atomic_fcmpset_64(volatile u_int64_t *p, volatile u_int64_t *cmpval, volatile u_int64_t newval) { - u_int64_t ret; + int ret; __with_interrupts_disabled( { @@ -149,7 +149,7 @@ atomic_fcmpset_64(volatile u_int64_t *p, volatile u_in return (ret); } -static __inline u_int32_t +static __inline int atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_int32_t newval) { int ret; @@ -166,7 +166,7 @@ atomic_cmpset_32(volatile u_int32_t *p, volatile u_int return (ret); } -static __inline u_int64_t +static __inline int atomic_cmpset_64(volatile u_int64_t *p, volatile u_int64_t cmpval, volatile u_int64_t newval) { int ret; @@ -296,7 +296,7 @@ atomic_clear_32(volatile uint32_t *address, uint32_t c } -static __inline u_int32_t +static __inline int atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_int32_t newval) { int done, ras_start = ARM_RAS_START; Modified: head/sys/arm/include/atomic-v6.h == --- head/sys/arm/include/atomic-v6.hMon Apr 23 16:38:27 2018 (r332890) +++ head/sys/arm/include/atomic-v6.hMon Apr 23 16:50:37 2018 (r332891) @@ -209,7 +209,7 @@ atomic_fcmpset_32(volatile uint32_t *p, uint32_t *cmpv return (!ret); } -static __inline uint64_t +static __inline int atomic_fcmpset_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval) { uint64_t tmp; @@ -235,7 +235,7 @@ atomic_fcmpset_64(volatile uint64_t *p, uint64_t *cmpv return (!ret); } -static __inline u_long +static __inline int atomic_fcmpset_long(volatile u_long *p, u_long *cmpval, u_long newval) { @@ -243,38 +243,38 @@ atomic_fcmpset_long(volatile u_long *p, u_long *cmpval (uint32_t *)cmpval, newval)); } -static __inline uint64_t +static __inline int atomic_fcmpset_acq_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval) { - uint64_t ret; + int ret; ret = atomic_fcmpset_64(p, cmpval, newval); dmb(); return (ret); } -static __inline u_long +static __inline int atomic_fcmpset_acq_long(volatile u_long *p, u_long *cmpval, u_long newval) { - u_long ret; + int ret; ret = atomic_fcmpset_long(p, cmpval, newval); dmb(); return (ret); } -static __inline uint32_t +static __inline int atomic_fcmpset_acq_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) { - uint32_t ret; + int ret; ret = atomic_fcmpset_32(p, cmpval, newval); dmb(); return (ret); } -static __inline uint32_t +static __inline int atomic_fcmpset_rel_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) { @@ -282,7 +282,7 @@ atomic_fcmpset_rel_32(volatile uint32_t *p, uint32_t * return (atomic_fcmpset_32(p, cmpval, newval)); } -static __inline uint64_t +static __inline int atomic_fcmpset_rel_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval) { @@ -290,7 +290,7 @@ atomic_fcmpset_rel_64(volatile uint64_t *p, uint64_t * return (atomic_fcmpset_64(p, cmpval, newval)); } -static __inline u_long +static __inline int atomic_fcmpset_rel_long(volatile u_long *p, u_long *cmpval, u_long newval) { @@ -298,10 +298,10 @@ atomic_fcmpset_rel_long(volatile u_long *p, u_long *cm return (atomic_fcmpse
svn commit: r332892 - head/sys/arm/include
Author: jhb Date: Mon Apr 23 17:00:15 2018 New Revision: 332892 URL: https://svnweb.freebsd.org/changeset/base/332892 Log: Implement 32-bit atomic_fcmpset() in userland for armv4/v5. - Add an implementation of atomic_fcmpset_32() using RAS for armv4/v5. This fixes recent world breakage due to use of atomic_fcmpset() in userland. - While here, be more careful to not expose wrapper macros for 64-bit atomic_*cmpset to userland for armv4/v5 as only 32-bit cmpset is implemented. This has been reviewed, but not runtime-tested, but should fix the arm.arm and arm.armeb worlds that have been broken for a while. Reviewed by: imp MFC after:1 month Differential Revision:https://reviews.freebsd.org/D15147 Modified: head/sys/arm/include/atomic-v4.h Modified: head/sys/arm/include/atomic-v4.h == --- head/sys/arm/include/atomic-v4.hMon Apr 23 16:50:37 2018 (r332891) +++ head/sys/arm/include/atomic-v4.hMon Apr 23 17:00:15 2018 (r332892) @@ -321,6 +321,33 @@ atomic_cmpset_32(volatile u_int32_t *p, volatile u_int return (done); } +static __inline int +atomic_fcmpset_32(volatile u_int32_t *p, volatile u_int32_t *cmpval, volatile u_int32_t newval) +{ + int done, oldval, ras_start = ARM_RAS_START; + + __asm __volatile("1:\n" + "adr%1, 1b\n" + "str%1, [%0]\n" + "adr%1, 2f\n" + "str%1, [%0, #4]\n" + "ldr%1, [%2]\n" + "ldr%5, [%3]\n" + "cmp%1, %5\n" + "streq %4, [%2]\n" + "2:\n" + "mov%5, #0\n" + "str%5, [%0]\n" + "mov%5, #0x\n" + "str%5, [%0, #4]\n" + "strne %1, [%3]\n" + "moveq %1, #1\n" + "movne %1, #0\n" + : "+r" (ras_start), "=r" (done) ,"+r" (p) + , "+r" (cmpval), "+r" (newval), "+r" (oldval) : : "cc", "memory"); + return (done); +} + static __inline uint32_t atomic_fetchadd_32(volatile uint32_t *p, uint32_t v) { @@ -409,14 +436,18 @@ atomic_swap_32(volatile u_int32_t *p, u_int32_t v) #define atomic_fcmpset_rel_32 atomic_fcmpset_32 #define atomic_fcmpset_acq_32 atomic_fcmpset_32 +#ifdef _KERNEL #define atomic_fcmpset_rel_64 atomic_fcmpset_64 #define atomic_fcmpset_acq_64 atomic_fcmpset_64 +#endif #define atomic_fcmpset_acq_longatomic_fcmpset_long #define atomic_fcmpset_rel_longatomic_fcmpset_long #define atomic_cmpset_rel_32 atomic_cmpset_32 #define atomic_cmpset_acq_32 atomic_cmpset_32 +#ifdef _KERNEL #define atomic_cmpset_rel_64 atomic_cmpset_64 #define atomic_cmpset_acq_64 atomic_cmpset_64 +#endif #define atomic_set_rel_32 atomic_set_32 #define atomic_set_acq_32 atomic_set_32 #define atomic_clear_rel_32atomic_clear_32 @@ -463,8 +494,6 @@ atomic_cmpset_long(volatile u_long *dst, u_long old, u return (atomic_cmpset_32((volatile uint32_t *)dst, old, newe)); } -#ifdef _KERNEL -/* atomic_fcmpset_32 is only defined for the kernel */ static __inline u_long atomic_fcmpset_long(volatile u_long *dst, u_long *old, u_long newe) { @@ -472,7 +501,6 @@ atomic_fcmpset_long(volatile u_long *dst, u_long *old, return (atomic_fcmpset_32((volatile uint32_t *)dst, (uint32_t *)old, newe)); } -#endif static __inline u_long atomic_fetchadd_long(volatile u_long *p, u_long v) ___ 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: r332860 - head/sys/kern
On Mon, Apr 23, 2018 at 11:12:32AM -0400, Jonathan T. Looney wrote: > Hi Mark, > > Let me start by saying that I appreciate your well-reasoned response. (I > think) I understand your reasoning, I appreciate your well-explained > argument, and I respect your opinion. I just wanted to make that clear up > front. > > On Sun, Apr 22, 2018 at 1:11 PM, Mark Johnston wrote: > > > > > All too often, my ability to debug assertion violations is hindered > because > > > the system trips over yet another assertion while dumping the core. If > we > > > skip the assertion, nothing bad happens. (The post-panic debugging code > > > already needs to deal with systems that are inconsistent, and it does a > > > pretty good job at it.) > > > > I think we make a decent effort to fix such problems as they arise, but > > you are declaring defeat on behalf of everyone. Did you make some effort > > to fix or report these issues before resorting to the more drastic > > measure taken here? > > We try to report or fix them as they arise. However, you don't know there > is a problem until you actually run into it. And, you don't run into the > problem until you can't get a core dump due to the assertion. > > (And, with elusive problems, it isn't always easy to duplicate them. So, > fixing the assertion is sometimes "too late".) Sure, this is true. But unless it's a problem in practice it's obviously preferable to keep assertions enabled. Kernel dumping itself is a fundamentally unreliable mechanism, but it works well enough to be useful. I basically never see problems with post-panic assertion failures, and I test the kernel dump code a fair bit. Isilon exercises that code quite a lot as well without any problems that I'm aware of, and I can't think of any reports of such assertion failures that weren't quickly fixed. So I'm wondering what problems exist in your specific environment that we might instead address surgically. (I could very well be wrong about how widespread post-panic assertion failures are. We've had problems of this sort before, e.g., with the updated DRM graphics drivers, where the code to grab the console after a panic didn't work properly. There, the bandaid was to just disable that specific mechanism.) > > > On the other hand, I really am not sure what you are worried might > happen > > > if we skip checking assertions after we've already panic'd. As far as I > can > > > tell, the likely worst case is that we hit a true panic of some kind. In > > > that case, we're no worse off than before. > > > > > > I think the one obvious exception is when we're purposely trying to > > > validate the post-panic debugging code. In that case, you can change the > > > sysctl/tunable to enable troubleshooting. > > > > What about a user whose test system panics and fails to dump? With > > assertions enabled, a developer has a better chance of spotting the > > problem. Now we need at least one extra round trip to the user to > > diagnose the problem, which may not be readily reproducible in the first > > place. > > That's true. However, this is equally true in the other direction: Prior to > this change, when a user tripped over an assertion and was unable to get a > coredump due to a second post-panic assertion, it took (at least) another > round-trip to get a coredump. > > First, without the capability to ignore assertions after a panic > (introduced by this commit), you would need to fix the actual assertion to > enable the user to get a coredump. At minimum, I think this change has > value in that case. This change gives you a mechanism to get a coredump > without requiring that you fix the assertion and get the user to recompile > with the patch. > > But, moreover, if we change the default back to panic'ing on a second > assertion, we will hamper our ability to get usable reports about elusive > bugs. If we leave the default "as is", it won't take an extra round-trip to > tell the user how to get a coredump. If we change the default (or, perhaps > more correctly, "restore the prior default"), we will still need a second > round-trip to get coredumps. That makes it tough to chase elusive bugs. I agree with what you're saying. I'm thinking more of the long-term effects of this change and am concerned that it increases the potential for actual bugs to appear in the kernel dump code paths. Those types of bugs are often quite tricky to track down from a single instance, and can cause dumps to fail. If that starts to happen, we're basically back to where we started. ___ 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: r332893 - head/sys/compat/linux
Author: emaste Date: Mon Apr 23 18:33:26 2018 New Revision: 332893 URL: https://svnweb.freebsd.org/changeset/base/332893 Log: Map FreeBSD EDOOFUS to Linux EINVAL Previously EDOOFUS mapped to EBUSY. EINVAL seems more appropriate. Discussed with: cem MFC after:1 week Sponsored by: Turing Robotic Industries Inc. Modified: head/sys/compat/linux/linux_errno.inc Modified: head/sys/compat/linux/linux_errno.inc == --- head/sys/compat/linux/linux_errno.inc Mon Apr 23 17:00:15 2018 (r332892) +++ head/sys/compat/linux/linux_errno.inc Mon Apr 23 18:33:26 2018 (r332893) @@ -132,7 +132,7 @@ const int linux_errtbl[ELAST + 1] = { -125, -84, -61, - -16,/* EDOOFUS -> EBUSY */ + -22,/* EDOOFUS -> EINVAL */ -74, -72, ___ 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: r332894 - in head: cddl/lib/libdtrace sys/kern sys/netinet sys/netinet6 sys/sys
Author: sbruno Date: Mon Apr 23 19:51:00 2018 New Revision: 332894 URL: https://svnweb.freebsd.org/changeset/base/332894 Log: Load balance sockets with new SO_REUSEPORT_LB option This patch adds a new socket option, SO_REUSEPORT_LB, which allow multiple programs or threads to bind to the same port and incoming connections will be load balanced using a hash function. Most of the code was copied from a similar patch for DragonflyBSD. However, in DragonflyBSD, load balancing is a global on/off setting and can not be set per socket. This patch allows for simultaneous use of both the current SO_REUSEPORT and the new SO_REUSEPORT_LB options on the same system. Required changes to structures Globally change so_options from 16 to 32 bit value to allow for more options. Add hashtable in pcbinfo to hold all SO_REUSEPORT_LB sockets. Limitations As DragonflyBSD, a load balance group is limited to 256 pcbs (256 programs or threads sharing the same socket). Submitted by: Johannes Lundberg Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D11003 Modified: head/cddl/lib/libdtrace/tcp.d head/sys/kern/uipc_debug.c head/sys/kern/uipc_socket.c head/sys/netinet/in_pcb.c head/sys/netinet/in_pcb.h head/sys/netinet/ip_output.c head/sys/netinet/tcp_subr.c head/sys/netinet/udp_usrreq.c head/sys/netinet6/in6_pcb.c head/sys/netinet6/in6_src.c head/sys/netinet6/ip6_output.c head/sys/netinet6/udp6_usrreq.c head/sys/sys/socket.h head/sys/sys/socketvar.h Modified: head/cddl/lib/libdtrace/tcp.d == --- head/cddl/lib/libdtrace/tcp.d Mon Apr 23 18:33:26 2018 (r332893) +++ head/cddl/lib/libdtrace/tcp.d Mon Apr 23 19:51:00 2018 (r332894) @@ -192,12 +192,12 @@ translator tcpsinfo_t < struct tcpcb *p > { tcps_rport =p == NULL ? 0 : ntohs(p->t_inpcb->inp_inc.inc_ie.ie_fport); tcps_laddr =p == NULL ? 0 : p->t_inpcb->inp_vflag == INP_IPV4 ? - inet_ntoa(&p->t_inpcb->inp_inc.inc_ie.ie_dependladdr.ie46_local.ia46_addr4.s_addr) : - inet_ntoa6(&p->t_inpcb->inp_inc.inc_ie.ie_dependladdr.ie6_local); + inet_ntoa(&p->t_inpcb->inp_inc.inc_ie.ie_dependladdr.id46_addr.ia46_addr4.s_addr) : + inet_ntoa6(&p->t_inpcb->inp_inc.inc_ie.ie_dependladdr.id6_addr); tcps_raddr =p == NULL ? 0 : p->t_inpcb->inp_vflag == INP_IPV4 ? - inet_ntoa(&p->t_inpcb->inp_inc.inc_ie.ie_dependfaddr.ie46_foreign.ia46_addr4.s_addr) : - inet_ntoa6(&p->t_inpcb->inp_inc.inc_ie.ie_dependfaddr.ie6_foreign); + inet_ntoa(&p->t_inpcb->inp_inc.inc_ie.ie_dependfaddr.id46_addr.ia46_addr4.s_addr) : + inet_ntoa6(&p->t_inpcb->inp_inc.inc_ie.ie_dependfaddr.id6_addr); tcps_state =p == NULL ? -1 : p->t_state; tcps_iss = p == NULL ? 0 : p->iss; tcps_irs = p == NULL ? 0 : p->irs; Modified: head/sys/kern/uipc_debug.c == --- head/sys/kern/uipc_debug.c Mon Apr 23 18:33:26 2018(r332893) +++ head/sys/kern/uipc_debug.c Mon Apr 23 19:51:00 2018(r332894) @@ -77,7 +77,7 @@ db_print_sotype(short so_type) } static void -db_print_sooptions(short so_options) +db_print_sooptions(int so_options) { int comma; @@ -120,6 +120,10 @@ db_print_sooptions(short so_options) } if (so_options & SO_REUSEPORT) { db_printf("%sSO_REUSEPORT", comma ? ", " : ""); + comma = 1; + } + if (so_options & SO_REUSEPORT_LB) { + db_printf("%sSO_REUSEPORT_LB", comma ? ", " : ""); comma = 1; } if (so_options & SO_TIMESTAMP) { Modified: head/sys/kern/uipc_socket.c == --- head/sys/kern/uipc_socket.c Mon Apr 23 18:33:26 2018(r332893) +++ head/sys/kern/uipc_socket.c Mon Apr 23 19:51:00 2018(r332894) @@ -1057,6 +1057,100 @@ sofree(struct socket *so) } /* + * Let socket in same load balance group (same port and address) + * inherit pending sockets of the closing socket. + * + * "so_inh" will inherit sockets from "so" + */ +void +soinherit(struct socket *so, struct socket *so_inh) +{ + TAILQ_HEAD(, socket) comp, incomp; + struct socket *sp, *head, *head_inh; + int qlen, incqlen; + + KASSERT(so->so_options & SO_ACCEPTCONN, + ("so does not accept connection")); + KASSERT(so_inh->so_options & SO_ACCEPTCONN, + ("so_inh does not accept connection")); + + +restart: + SOCK_LOCK(so); + if ((head = so->so_listen) != NULL && + __predict_false(SOLISTEN_TRYLOCK(head) == 0)) { + SOCK_UNLOCK(so); + goto restart
svn commit: r332895 - in head: lib/libifconfig sbin/etherswitchcfg sbin/ifconfig sys/net
Author: brooks Date: Mon Apr 23 21:10:33 2018 New Revision: 332895 URL: https://svnweb.freebsd.org/changeset/base/332895 Log: Finish removing FDDI and tokenring media support. This fixes media display for 802.11 wireless devices. Software outside the base system that uses these media types and defines should use #ifdef IFM_FDDI or IFM_TOKEN to include or remove support. Reported by: zeising Reviewed by: emaste, kib, zeising Tested by:zeising Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D15170 Modified: head/lib/libifconfig/libifconfig_media.c head/sbin/etherswitchcfg/ifmedia.c head/sbin/ifconfig/ifmedia.c head/sys/net/if_media.c head/sys/net/if_media.h Modified: head/lib/libifconfig/libifconfig_media.c == --- head/lib/libifconfig/libifconfig_media.cMon Apr 23 19:51:00 2018 (r332894) +++ head/lib/libifconfig/libifconfig_media.cMon Apr 23 21:10:33 2018 (r332895) @@ -77,15 +77,6 @@ static struct ifmedia_description ifm_subtype_ethernet static struct ifmedia_description ifm_subtype_ethernet_option_descriptions[] = IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS; -static struct ifmedia_description ifm_subtype_tokenring_descriptions[] = -IFM_SUBTYPE_TOKENRING_DESCRIPTIONS; - -static struct ifmedia_description ifm_subtype_tokenring_aliases[] = -IFM_SUBTYPE_TOKENRING_ALIASES; - -static struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] = -IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS; - static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] = IFM_SUBTYPE_IEEE80211_DESCRIPTIONS; @@ -155,24 +146,6 @@ static struct ifmedia_type_to_subtype ifmedia_types_to { &ifm_shared_option_descriptions[0],0 }, { &ifm_shared_option_aliases[0], 1 }, { &ifm_subtype_ethernet_option_descriptions[0], 0 }, - { NULL, 0 }, - }, - { - { NULL, 0 }, - }, - }, - { - { - { &ifm_subtype_shared_descriptions[0], 0 }, - { &ifm_subtype_shared_aliases[0],1 }, - { &ifm_subtype_tokenring_descriptions[0],0 }, - { &ifm_subtype_tokenring_aliases[0], 1 }, - { NULL, 0 }, - }, - { - { &ifm_shared_option_descriptions[0],0 }, - { &ifm_shared_option_aliases[0], 1 }, - { &ifm_subtype_tokenring_option_descriptions[0], 0 }, { NULL, 0 }, }, { Modified: head/sbin/etherswitchcfg/ifmedia.c == --- head/sbin/etherswitchcfg/ifmedia.c Mon Apr 23 19:51:00 2018 (r332894) +++ head/sbin/etherswitchcfg/ifmedia.c Mon Apr 23 21:10:33 2018 (r332895) @@ -363,15 +363,6 @@ static struct ifmedia_description ifm_subtype_ethernet static struct ifmedia_description ifm_subtype_ethernet_option_descriptions[] = IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS; -static struct ifmedia_description ifm_subtype_tokenring_descriptions[] = -IFM_SUBTYPE_TOKENRING_DESCRIPTIONS; - -static struct ifmedia_description ifm_subtype_tokenring_aliases[] = -IFM_SUBTYPE_TOKENRING_ALIASES; - -static struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] = -IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS; - static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] = IFM_SUBTYPE_IEEE80211_DESCRIPTIONS; @@ -437,24 +428,6 @@ static struct ifmedia_type_to_subtype ifmedia_types_to { &ifm_shared_option_descriptions[0], 0 }, { &ifm_shared_option_aliases[0], 1 }, { &ifm_subtype_ethernet_option_descriptions[0], 0 }, - { NULL, 0 }, - }, - { - { NULL, 0 }, - }, - }, - { - { - { &ifm_subtype_shared_descriptions[0], 0 }, - { &ifm_subtype_shared_aliases[0], 1 }, - { &ifm_subtype_tokenring_descriptions[0], 0 }, - { &ifm_subtype_tokenring_aliases[0], 1 }, - { NULL, 0 }, - }, - { - { &ifm_shared_option_descriptions[0], 0 }, - { &ifm_shared_option_aliases[0], 1 }, - { &ifm_subtyp
Re: svn commit: r332489 - in head: gnu/usr.bin/gdb/kgdb sys/conf sys/dev/dcons sys/dev/hyperv/vmbus/i386 sys/dev/ppc sys/dev/syscons sys/i386/conf sys/i386/i386 sys/i386/include sys/i386/include/pc sy
On Sun, 22 Apr 2018 23:51:03 +0300 Konstantin Belousov wrote: > On Sun, Apr 22, 2018 at 10:26:14PM +0300, Konstantin Belousov wrote: >> On Sun, Apr 22, 2018 at 09:06:56PM +0200, Tijl Coosemans wrote: >>> Could this have broken the linux futex syscall? I have a linux program >>> that gets stuck in linux_sys_futex and becomes unkillable. Note that the >>> routines in sys/i386/linux/linux_support.s try to do atomic operations on >>> user space addresses. >> >> Yes, it is quite possible. I will try to look next week. > > Try this. I only compile-tested it as a module. Yes, this fixes it. That was quick, thanks! ___ 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: r332874 - head/share/misc
On Sunday, April 22, 2018 09:27:59 PM Rebecca Cran wrote: > Author: bcran > Date: Sun Apr 22 21:27:59 2018 > New Revision: 332874 > URL: https://svnweb.freebsd.org/changeset/base/332874 > > Log: > Update committers-src.dot to show the mentorship arrangement for myself: > eadler has agreed to mentor me. > > Modified: > head/share/misc/committers-src.dot > > Modified: head/share/misc/committers-src.dot > == > --- head/share/misc/committers-src.dotSun Apr 22 20:47:16 2018 > (r332873) > +++ head/share/misc/committers-src.dotSun Apr 22 21:27:59 2018 > (r332874) > @@ -476,6 +476,8 @@ dwmalone -> fanf > dwmalone -> peadar > dwmalone -> snb > > +eadler -> bcran > + > ed -> dim > ed -> gavin > ed -> jilles > @@ -751,7 +753,6 @@ rpaulo -> jmmv > rpaulo -> lidl > rpaulo -> ngie > > -rrs -> bcran > rrs -> jchandra > rrs -> tuexen It's probably ok to leave Randall's line in place here. This file documents the historical state rather than the current state so that one can see the developers "family tree" as it were and it is not unusual for a developer to have multiple mentors either. -- John Baldwin ___ 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: r332860 - head/sys/kern
On Monday, April 23, 2018 02:00:24 PM Mark Johnston wrote: > On Mon, Apr 23, 2018 at 11:12:32AM -0400, Jonathan T. Looney wrote: > > Hi Mark, > > > > Let me start by saying that I appreciate your well-reasoned response. (I > > think) I understand your reasoning, I appreciate your well-explained > > argument, and I respect your opinion. I just wanted to make that clear up > > front. > > > > On Sun, Apr 22, 2018 at 1:11 PM, Mark Johnston wrote: > > > > > > > All too often, my ability to debug assertion violations is hindered > > because > > > > the system trips over yet another assertion while dumping the core. If > > we > > > > skip the assertion, nothing bad happens. (The post-panic debugging code > > > > already needs to deal with systems that are inconsistent, and it does a > > > > pretty good job at it.) > > > > > > I think we make a decent effort to fix such problems as they arise, but > > > you are declaring defeat on behalf of everyone. Did you make some effort > > > to fix or report these issues before resorting to the more drastic > > > measure taken here? > > > > We try to report or fix them as they arise. However, you don't know there > > is a problem until you actually run into it. And, you don't run into the > > problem until you can't get a core dump due to the assertion. > > > > (And, with elusive problems, it isn't always easy to duplicate them. So, > > fixing the assertion is sometimes "too late".) > > Sure, this is true. But unless it's a problem in practice it's obviously > preferable to keep assertions enabled. Kernel dumping itself is a > fundamentally unreliable mechanism, but it works well enough to be > useful. I basically never see problems with post-panic assertion > failures, and I test the kernel dump code a fair bit. Isilon exercises > that code quite a lot as well without any problems that I'm aware of, > and I can't think of any reports of such assertion failures that weren't > quickly fixed. So I'm wondering what problems exist in your specific > environment that we might instead address surgically. > > (I could very well be wrong about how widespread post-panic assertion > failures are. We've had problems of this sort before, e.g., with the > updated DRM graphics drivers, where the code to grab the console after a > panic didn't work properly. There, the bandaid was to just disable that > specific mechanism.) I think this is actually a key question. In my experience to date I have not encountered a large number of post-panic assertion failures. Given that we already break all locks and disable assertions for locks I'd be curious which assertions are actually failing. My inclination given my experiences to date would be to explicitly ignore those as we do for locking if it is constrained set rather than blacklisting all of them. However, I would be most interested in seeing some examples of assertions that are failing. -- John Baldwin ___ 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: r332896 - head/sys/kern
Author: mjg Date: Mon Apr 23 22:28:49 2018 New Revision: 332896 URL: https://svnweb.freebsd.org/changeset/base/332896 Log: malloc: stop reading the subzone if MALLOC_DEBUG_MAXZONES == 1 (the default) malloc was showing at the top of profile during while running microbenchmarks. #define DTMALLOC_PROBE_MAX 2 struct malloc_type_internal { uint32_tmti_probes[DTMALLOC_PROBE_MAX]; u_char mti_zone; struct malloc_type_statsmti_stats[MAXCPU]; }; Reading mti_zone it wastes a cacheline to hold mti_probes + mti_zone (which we know is 0) + part of malloc stats of the first cpu which on top induces false-sharing. In particular will-it-scale lock1_processes -t 128 -s 10: before: average:45879692 after: average:51655596 Note the counters can be padded but the right fix is to move them to counter(9), leaving the struct read-only after creation (modulo dtrace probes). Modified: head/sys/kern/kern_malloc.c Modified: head/sys/kern/kern_malloc.c == --- head/sys/kern/kern_malloc.c Mon Apr 23 21:10:33 2018(r332895) +++ head/sys/kern/kern_malloc.c Mon Apr 23 22:28:49 2018(r332896) @@ -296,22 +296,49 @@ SYSCTL_UINT(_debug_malloc, OID_AUTO, zone_offset, CTLF &zone_offset, 0, "Separate malloc types by examining the " "Nth character in the malloc type short description."); -static u_int -mtp_get_subzone(const char *desc) +static void +mtp_set_subzone(struct malloc_type *mtp) { + struct malloc_type_internal *mtip; + const char *desc; size_t len; u_int val; + mtip = mtp->ks_handle; + desc = mtp->ks_shortdesc; if (desc == NULL || (len = strlen(desc)) == 0) - return (0); - val = desc[zone_offset % len]; - return (val % numzones); + val = 0; + else + val = desc[zone_offset % len]; + mtip->mti_zone = (val % numzones); } + +static inline u_int +mtp_get_subzone(struct malloc_type *mtp) +{ + struct malloc_type_internal *mtip; + + mtip = mtp->ks_handle; + + KASSERT(mtip->mti_zone < numzones, + ("mti_zone %u out of range %d", + mtip->mti_zone, numzones)); + return (mtip->mti_zone); +} #elif MALLOC_DEBUG_MAXZONES == 0 #error "MALLOC_DEBUG_MAXZONES must be positive." #else +static void +mtp_set_subzone(struct malloc_type *mtp) +{ + struct malloc_type_internal *mtip; + + mtip = mtp->ks_handle; + mtip->mti_zone = 0; +} + static inline u_int -mtp_get_subzone(const char *desc) +mtp_get_subzone(struct malloc_type *mtp) { return (0); @@ -521,7 +548,6 @@ void * malloc(size_t size, struct malloc_type *mtp, int flags) { int indx; - struct malloc_type_internal *mtip; caddr_t va; uma_zone_t zone; #if defined(DEBUG_REDZONE) @@ -534,14 +560,10 @@ malloc(size_t size, struct malloc_type *mtp, int flags #endif if (size <= kmem_zmax) { - mtip = mtp->ks_handle; if (size & KMEM_ZMASK) size = (size & ~KMEM_ZMASK) + KMEM_ZBASE; indx = kmemsize[size >> KMEM_ZSHIFT]; - KASSERT(mtip->mti_zone < numzones, - ("mti_zone %u out of range %d", - mtip->mti_zone, numzones)); - zone = kmemzones[indx].kz_zone[mtip->mti_zone]; + zone = kmemzones[indx].kz_zone[mtp_get_subzone(mtp)]; #ifdef MALLOC_PROFILE krequests[size >> KMEM_ZSHIFT]++; #endif @@ -571,7 +593,6 @@ malloc_domain(size_t size, struct malloc_type *mtp, in int flags) { int indx; - struct malloc_type_internal *mtip; caddr_t va; uma_zone_t zone; #if defined(DEBUG_REDZONE) @@ -583,14 +604,10 @@ malloc_domain(size_t size, struct malloc_type *mtp, in return (va); #endif if (size <= kmem_zmax) { - mtip = mtp->ks_handle; if (size & KMEM_ZMASK) size = (size & ~KMEM_ZMASK) + KMEM_ZBASE; indx = kmemsize[size >> KMEM_ZSHIFT]; - KASSERT(mtip->mti_zone < numzones, - ("mti_zone %u out of range %d", - mtip->mti_zone, numzones)); - zone = kmemzones[indx].kz_zone[mtip->mti_zone]; + zone = kmemzones[indx].kz_zone[mtp_get_subzone(mtp)]; #ifdef MALLOC_PROFILE krequests[size >> KMEM_ZSHIFT]++; #endif @@ -973,7 +990,7 @@ malloc_init(void *data) mtip = uma_zalloc(mt_zone, M_WAITOK | M_ZERO); mtp->ks_handle = mtip; - mtip->mti_zone = mtp_get_subzone(mtp->ks_shortdesc); + mtp_set_subzone(mtp); mtx_lock(&malloc_mtx); mtp->ks_next = kmemstatistics; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mai
svn commit: r332897 - head/sys/dev/nvme
Author: imp Date: Mon Apr 23 22:30:17 2018 New Revision: 332897 URL: https://svnweb.freebsd.org/changeset/base/332897 Log: Migrate to make_dev_s interface to populate /dev/nvmeX entries Submitted by: Michael Hordijk Differential Revision: https://reviews.freebsd.org/D15162 Modified: head/sys/dev/nvme/nvme_ns.c Modified: head/sys/dev/nvme/nvme_ns.c == --- head/sys/dev/nvme/nvme_ns.c Mon Apr 23 22:28:49 2018(r332896) +++ head/sys/dev/nvme/nvme_ns.c Mon Apr 23 22:30:17 2018(r332897) @@ -494,7 +494,9 @@ int nvme_ns_construct(struct nvme_namespace *ns, uint32_t id, struct nvme_controller *ctrlr) { + struct make_dev_argsmd_args; struct nvme_completion_poll_status status; + int res; int unit; uint16_toncs; uint8_t dsm; @@ -590,15 +592,20 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t */ unit = device_get_unit(ctrlr->dev) * NVME_MAX_NAMESPACES + ns->id - 1; - ns->cdev = make_dev_credf(0, &nvme_ns_cdevsw, unit, - NULL, UID_ROOT, GID_WHEEL, 0600, "nvme%dns%d", + make_dev_args_init(&md_args); + md_args.mda_devsw = &nvme_ns_cdevsw; + md_args.mda_unit = unit; + md_args.mda_mode = 0600; + res = make_dev_s(&md_args, &ns->cdev, "nvme%dns%d", device_get_unit(ctrlr->dev), ns->id); + if (res != 0) + return (ENXIO); + #ifdef NVME_UNMAPPED_BIO_SUPPORT ns->cdev->si_flags |= SI_UNMAPPED; #endif - if (ns->cdev != NULL) - ns->cdev->si_drv1 = ns; + ns->cdev->si_drv1 = ns; return (0); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r332898 - head/contrib/llvm/lib/Target/X86
Author: dim Date: Mon Apr 23 23:07:57 2018 New Revision: 332898 URL: https://svnweb.freebsd.org/changeset/base/332898 Log: Pull in r329771 from upstream llvm trunk (by Craig Topper): [X86] In X86FlagsCopyLowering, when rewriting a memory setcc we need to emit an explicit MOV8mr instruction. Previously the code only knew how to handle setcc to a register. This should fix a crash in the chromium build. This fixes various assertion failures while building ports targeting i386: * www/firefox: isReg() && "This is not a register operand!" * www/iridium, www/qt5-webengine: (I.atEnd() || std::next(I) == def_instr_end()) && "getVRegDef assumes a single definition or no definition" * devel/powerpc64-gcc: FromReg != ToReg && "Cannot replace a reg with itself" Reported by: jbeich PR: 225330, 227686, 227698, 227699 MFC after:1 week X-MFC-With: r332833 Modified: head/contrib/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp Modified: head/contrib/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp == --- head/contrib/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp Mon Apr 23 22:30:17 2018(r332897) +++ head/contrib/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp Mon Apr 23 23:07:57 2018(r332898) @@ -770,8 +770,27 @@ void X86FlagsCopyLoweringPass::rewriteSetCC(MachineBas if (!CondReg) CondReg = promoteCondToReg(TestMBB, TestPos, TestLoc, Cond); - // Rewriting this is trivial: we just replace the register and remove the - // setcc. - MRI->replaceRegWith(SetCCI.getOperand(0).getReg(), CondReg); + // Rewriting a register def is trivial: we just replace the register and + // remove the setcc. + if (!SetCCI.mayStore()) { +assert(SetCCI.getOperand(0).isReg() && + "Cannot have a non-register defined operand to SETcc!"); +MRI->replaceRegWith(SetCCI.getOperand(0).getReg(), CondReg); +SetCCI.eraseFromParent(); +return; + } + + // Otherwise, we need to emit a store. + auto MIB = BuildMI(*SetCCI.getParent(), SetCCI.getIterator(), + SetCCI.getDebugLoc(), TII->get(X86::MOV8mr)); + // Copy the address operands. + for (int i = 0; i < X86::AddrNumOperands; ++i) +MIB.add(SetCCI.getOperand(i)); + + MIB.addReg(CondReg); + + MIB->setMemRefs(SetCCI.memoperands_begin(), SetCCI.memoperands_end()); + SetCCI.eraseFromParent(); + 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"
svn commit: r332900 - in head/sys: cddl/dev/sdt kern sys
Author: mjg Date: Tue Apr 24 01:04:10 2018 New Revision: 332900 URL: https://svnweb.freebsd.org/changeset/base/332900 Log: lockstat: track lockstat just like sdt probes In particular flip the frequently tested var to bool. Modified: head/sys/cddl/dev/sdt/sdt.c head/sys/kern/kern_lockstat.c head/sys/sys/lockstat.h Modified: head/sys/cddl/dev/sdt/sdt.c == --- head/sys/cddl/dev/sdt/sdt.c Tue Apr 24 00:47:17 2018(r332899) +++ head/sys/cddl/dev/sdt/sdt.c Tue Apr 24 01:04:10 2018(r332900) @@ -77,6 +77,7 @@ static void sdt_kld_unload_try(void *, struct linker_f static MALLOC_DEFINE(M_SDT, "SDT", "DTrace SDT providers"); static int sdt_probes_enabled_count; +static int lockstat_enabled_count; static dtrace_pattr_t sdt_attr = { { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, @@ -208,8 +209,11 @@ sdt_enable(void *arg __unused, dtrace_id_t id, void *p probe->id = id; probe->sdtp_lf->nenabled++; - if (strcmp(probe->prov->name, "lockstat") == 0) - lockstat_enabled++; + if (strcmp(probe->prov->name, "lockstat") == 0) { + lockstat_enabled_count++; + if (lockstat_enabled_count == 1) + lockstat_enabled = true; + } sdt_probes_enabled_count++; if (sdt_probes_enabled_count == 1) sdt_probes_enabled = true; @@ -225,8 +229,11 @@ sdt_disable(void *arg __unused, dtrace_id_t id, void * sdt_probes_enabled_count--; if (sdt_probes_enabled_count == 0) sdt_probes_enabled = false; - if (strcmp(probe->prov->name, "lockstat") == 0) - lockstat_enabled--; + if (strcmp(probe->prov->name, "lockstat") == 0) { + lockstat_enabled_count--; + if (lockstat_enabled_count == 0) + lockstat_enabled = false; + } probe->id = 0; probe->sdtp_lf->nenabled--; } Modified: head/sys/kern/kern_lockstat.c == --- head/sys/kern/kern_lockstat.c Tue Apr 24 00:47:17 2018 (r332899) +++ head/sys/kern/kern_lockstat.c Tue Apr 24 01:04:10 2018 (r332900) @@ -64,7 +64,7 @@ SDT_PROBE_DEFINE1(lockstat, , , sx__downgrade, "struct SDT_PROBE_DEFINE2(lockstat, , , thread__spin, "struct mtx *", "uint64_t"); -volatile int __read_frequently lockstat_enabled; +volatile bool __read_frequently lockstat_enabled; uint64_t lockstat_nsecs(struct lock_object *lo) Modified: head/sys/sys/lockstat.h == --- head/sys/sys/lockstat.h Tue Apr 24 00:47:17 2018(r332899) +++ head/sys/sys/lockstat.h Tue Apr 24 01:04:10 2018(r332900) @@ -70,7 +70,7 @@ SDT_PROBE_DECLARE(lockstat, , , thread__spin); #defineLOCKSTAT_WRITER 0 #defineLOCKSTAT_READER 1 -extern volatile int lockstat_enabled; +extern volatile bool lockstat_enabled; #ifdef KDTRACE_HOOKS ___ 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: r332901 - in head/sys: cddl/dev/dtmalloc kern
Author: mjg Date: Tue Apr 24 01:06:20 2018 New Revision: 332901 URL: https://svnweb.freebsd.org/changeset/base/332901 Log: dtrace: depessimize dtmalloc when dtrace is active Each malloc/free was testing dtrace_malloc_enabled and forcing extra reads from the malloc type struct to see if perhaps a dtmalloc probe was on. Treat it like lockstat and sdt: have a global bolean. Modified: head/sys/cddl/dev/dtmalloc/dtmalloc.c head/sys/kern/kern_malloc.c Modified: head/sys/cddl/dev/dtmalloc/dtmalloc.c == --- head/sys/cddl/dev/dtmalloc/dtmalloc.c Tue Apr 24 01:04:10 2018 (r332900) +++ head/sys/cddl/dev/dtmalloc/dtmalloc.c Tue Apr 24 01:06:20 2018 (r332901) @@ -36,6 +36,9 @@ #include #include +extern bool dtrace_malloc_enabled; +static uint32_t dtrace_malloc_enabled_count; + static d_open_tdtmalloc_open; static int dtmalloc_unload(void); static voiddtmalloc_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *); @@ -152,6 +155,9 @@ dtmalloc_enable(void *arg, dtrace_id_t id, void *parg) { uint32_t *p = parg; *p = id; + dtrace_malloc_enabled_count++; + if (dtrace_malloc_enabled_count == 1) + dtrace_malloc_enabled = true; } static void @@ -159,6 +165,9 @@ dtmalloc_disable(void *arg, dtrace_id_t id, void *parg { uint32_t *p = parg; *p = 0; + dtrace_malloc_enabled_count--; + if (dtrace_malloc_enabled_count == 0) + dtrace_malloc_enabled = false; } static void Modified: head/sys/kern/kern_malloc.c == --- head/sys/kern/kern_malloc.c Tue Apr 24 01:04:10 2018(r332900) +++ head/sys/kern/kern_malloc.c Tue Apr 24 01:06:20 2018(r332901) @@ -93,7 +93,8 @@ __FBSDID("$FreeBSD$"); #ifdef KDTRACE_HOOKS #include -dtrace_malloc_probe_func_t dtrace_malloc_probe; +bool __read_frequently dtrace_malloc_enabled; +dtrace_malloc_probe_func_t __read_mostly dtrace_malloc_probe; #endif #if defined(INVARIANTS) || defined(MALLOC_MAKE_FAILURES) ||\ @@ -376,7 +377,7 @@ malloc_type_zone_allocated(struct malloc_type *mtp, un mtsp->mts_size |= 1 << zindx; #ifdef KDTRACE_HOOKS - if (dtrace_malloc_probe != NULL) { + if (__predict_false(dtrace_malloc_enabled)) { uint32_t probe_id = mtip->mti_probes[DTMALLOC_PROBE_MALLOC]; if (probe_id != 0) (dtrace_malloc_probe)(probe_id, @@ -415,7 +416,7 @@ malloc_type_freed(struct malloc_type *mtp, unsigned lo mtsp->mts_numfrees++; #ifdef KDTRACE_HOOKS - if (dtrace_malloc_probe != NULL) { + if (__predict_false(dtrace_malloc_enabled)) { uint32_t probe_id = mtip->mti_probes[DTMALLOC_PROBE_FREE]; if (probe_id != 0) (dtrace_malloc_probe)(probe_id, ___ 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: r332902 - head/usr.sbin/pwd_mkdb
Author: emaste Date: Tue Apr 24 01:22:57 2018 New Revision: 332902 URL: https://svnweb.freebsd.org/changeset/base/332902 Log: pwd_mkdb: default to network (big) endian hash order For cross-architecture reproducibility. The db(3) functions work with hashes of either endianness, and the current (v4) version password db entries already store integers in network order. Do so with the hash as well so that identical password databases can be created on big- and little-endian hosts. The -B and -L flags exist to set the endianness for legacy (v3) entries when the -l flag is used, and they will still control hash endianness (at least until the backwards compatibility infrastructure is removed). MFC after:1 week Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/pwd_mkdb/pwd_mkdb.c Modified: head/usr.sbin/pwd_mkdb/pwd_mkdb.c == --- head/usr.sbin/pwd_mkdb/pwd_mkdb.c Tue Apr 24 01:06:20 2018 (r332901) +++ head/usr.sbin/pwd_mkdb/pwd_mkdb.c Tue Apr 24 01:22:57 2018 (r332902) @@ -77,7 +77,7 @@ static HASHINFO openinfo = { 256,/* nelem */ 2048 * 1024,/* cachesize */ NULL, /* hash() */ - BYTE_ORDER /* lorder */ + BIG_ENDIAN /* lorder */ }; static enum state { FILE_INSECURE, FILE_SECURE, FILE_ORIG } clean; ___ 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: r332905 - head/usr.sbin/camdd
Author: delphij Date: Tue Apr 24 04:07:51 2018 New Revision: 332905 URL: https://svnweb.freebsd.org/changeset/base/332905 Log: Use calloc() instead of malloc+bzero. Reviewed by: ken, emaste MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D15166 Modified: head/usr.sbin/camdd/camdd.c Modified: head/usr.sbin/camdd/camdd.c == --- head/usr.sbin/camdd/camdd.c Tue Apr 24 03:07:49 2018(r332904) +++ head/usr.sbin/camdd/camdd.c Tue Apr 24 04:07:51 2018(r332905) @@ -596,14 +596,12 @@ camdd_alloc_dev(camdd_dev_type dev_type, struct kevent size_t ke_size; int retval = 0; - dev = malloc(sizeof(*dev)); + dev = calloc(1, sizeof(*dev)); if (dev == NULL) { warn("%s: unable to malloc %zu bytes", __func__, sizeof(*dev)); goto bailout; } - bzero(dev, sizeof(*dev)); - dev->dev_type = dev_type; dev->io_timeout = timeout; dev->retry_count = retry_count; @@ -636,12 +634,11 @@ camdd_alloc_dev(camdd_dev_type dev_type, struct kevent } ke_size = sizeof(struct kevent) * (num_ke + 4); - ke = malloc(ke_size); + ke = calloc(1, ke_size); if (ke == NULL) { warn("%s: unable to malloc %zu bytes", __func__, ke_size); goto bailout; } - bzero(ke, ke_size); if (num_ke > 0) bcopy(new_ke, ke, num_ke * sizeof(struct kevent)); @@ -688,13 +685,12 @@ camdd_alloc_buf(struct camdd_dev *dev, camdd_buf_type break; } - buf = malloc(sizeof(*buf)); + buf = calloc(1, sizeof(*buf)); if (buf == NULL) { warn("unable to allocate %zu bytes", sizeof(*buf)); goto bailout_error; } - bzero(buf, sizeof(*buf)); buf->buf_type = buf_type; buf->dev = dev; switch (buf_type) { ___ 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: r332906 - head/tests/sys/kern
Author: jhb Date: Tue Apr 24 05:20:16 2018 New Revision: 332906 URL: https://svnweb.freebsd.org/changeset/base/332906 Log: Extend support for ptrace() tests using breakpoints. - Use a single list of platforms to define HAVE_BREAKPOINT for platforms that expose a functional breakpoint() inline to userland. Replace existing lists of platform tests with HAVE_BREAKPOINT instead. - Add support for advancing PC past a breakpoint inserted via breakpoint() to support the existing ptrace__PT_CONTINUE_different_thread test on non-x86 platforms (x86 advances the PC past the breakpoint instruction, but other platforms do not). This is implemented by defining a new SKIP_BREAK macro which accepts a pointer to a 'struct reg' as its sole argument and modifies the contents to advance the PC. The intention is to use it in between PT_GETREGS and PT_SETREGS. Tested on:amd64, i386, mips (after adding a breakpoint() to mips) MFC after:1 month Modified: head/tests/sys/kern/ptrace_test.c Modified: head/tests/sys/kern/ptrace_test.c == --- head/tests/sys/kern/ptrace_test.c Tue Apr 24 04:07:51 2018 (r332905) +++ head/tests/sys/kern/ptrace_test.c Tue Apr 24 05:20:16 2018 (r332906) @@ -52,6 +52,27 @@ __FBSDID("$FreeBSD$"); #include /* + * Architectures with a user-visible breakpoint(). + */ +#if defined(__amd64__) || defined(__i386__) || defined(__sparc64__) +#defineHAVE_BREAKPOINT +#endif + +/* + * Adjust PC to skip over a breakpoint when stopped for a breakpoint trap. + */ +#ifdef HAVE_BREAKPOINT +#if defined(__amd64__) || defined(__i386__) +#defineSKIP_BREAK(reg) +#elif defined(__sparc64__) +#defineSKIP_BREAK(reg) do { \ + (reg)->r_tpc = (reg)->r_tnpc + 4; \ + (reg)->r_tnpc += 8; \ +} while (0) +#endif +#endif + +/* * A variant of ATF_REQUIRE that is suitable for use in child * processes. This only works if the parent process is tripped up by * the early exit and fails some requirement itself. @@ -1688,12 +1709,8 @@ ATF_TC_BODY(ptrace__ptrace_vfork_follow, tc) ATF_REQUIRE(errno == ECHILD); } +#ifdef HAVE_BREAKPOINT /* - * XXX: There's nothing inherently platform specific about this test, however a - * userspace visible breakpoint() is a prerequisite. - */ - #if defined(__amd64__) || defined(__i386__) || defined(__sparc64__) -/* * Verify that no more events are reported after PT_KILL except for the * process exit when stopped due to a breakpoint trap. */ @@ -1738,7 +1755,7 @@ ATF_TC_BODY(ptrace__PT_KILL_breakpoint, tc) ATF_REQUIRE(wpid == -1); ATF_REQUIRE(errno == ECHILD); } -#endif /* defined(__amd64__) || defined(__i386__) || defined(__sparc64__) */ +#endif /* HAVE_BREAKPOINT */ /* * Verify that no more events are reported after PT_KILL except for the @@ -3468,11 +3485,7 @@ ATF_TC_BODY(ptrace__PT_STEP_with_signal, tc) ATF_REQUIRE(errno == ECHILD); } -#if defined(__amd64__) || defined(__i386__) -/* - * Only x86 both define breakpoint() and have a PC after breakpoint so - * that restarting doesn't retrigger the breakpoint. - */ +#if defined(HAVE_BREAKPOINT) && defined(SKIP_BREAK) static void * continue_thread(void *arg __unused) { @@ -3506,6 +3519,7 @@ ATF_TC_BODY(ptrace__PT_CONTINUE_different_thread, tc) pid_t fpid, wpid; lwpid_t lwps[2]; bool hit_break[2]; + struct reg reg; int i, j, status; ATF_REQUIRE((fpid = fork()) != -1); @@ -3579,6 +3593,9 @@ ATF_TC_BODY(ptrace__PT_CONTINUE_different_thread, tc) else i = 1; hit_break[i] = true; + ATF_REQUIRE(ptrace(PT_GETREGS, pl.pl_lwpid, (caddr_t)®, 0) != -1); + SKIP_BREAK(®); + ATF_REQUIRE(ptrace(PT_SETREGS, pl.pl_lwpid, (caddr_t)®, 0) != -1); /* * Resume both threads but pass the other thread's LWPID to @@ -3616,6 +3633,11 @@ ATF_TC_BODY(ptrace__PT_CONTINUE_different_thread, tc) ATF_REQUIRE_MSG(!hit_break[i], "double breakpoint event"); hit_break[i] = true; + ATF_REQUIRE(ptrace(PT_GETREGS, pl.pl_lwpid, (caddr_t)®, + 0) != -1); + SKIP_BREAK(®); + ATF_REQUIRE(ptrace(PT_SETREGS, pl.pl_lwpid, (caddr_t)®, + 0) != -1); } ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); @@ -3663,7 +3685,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, ptrace__event_mask); ATF_TP_ADD_TC(tp, ptrace__ptrace_vfork); ATF_TP_ADD_TC(tp, ptrace__ptrace_vfork_follow); -#if defined(__amd64__) || defined(__i386__) || defined(__sparc64__) +#ifdef HAVE_BREAK
svn commit: r332907 - in head: sys/mips/include tests/sys/kern
Author: jhb Date: Tue Apr 24 05:26:28 2018 New Revision: 332907 URL: https://svnweb.freebsd.org/changeset/base/332907 Log: Expose breakpoint() to userland from on MIPS. Enable ptrace() tests using breakpoint on MIPS as well. Tested on:mips64 MFC after:1 month Modified: head/sys/mips/include/cpufunc.h head/tests/sys/kern/ptrace_test.c Modified: head/sys/mips/include/cpufunc.h == --- head/sys/mips/include/cpufunc.h Tue Apr 24 05:20:16 2018 (r332906) +++ head/sys/mips/include/cpufunc.h Tue Apr 24 05:26:28 2018 (r332907) @@ -108,6 +108,12 @@ mips_wbflush(void) #endif } +static __inline void +breakpoint(void) +{ + __asm __volatile ("break"); +} + #ifdef _KERNEL /* * XXX @@ -363,12 +369,6 @@ get_intr_mask(void) { return (mips_rd_status() & MIPS_SR_INT_MASK); -} - -static __inline void -breakpoint(void) -{ - __asm __volatile ("break"); } #if defined(__GNUC__) && !defined(__mips_o32) Modified: head/tests/sys/kern/ptrace_test.c == --- head/tests/sys/kern/ptrace_test.c Tue Apr 24 05:20:16 2018 (r332906) +++ head/tests/sys/kern/ptrace_test.c Tue Apr 24 05:26:28 2018 (r332907) @@ -54,7 +54,8 @@ __FBSDID("$FreeBSD$"); /* * Architectures with a user-visible breakpoint(). */ -#if defined(__amd64__) || defined(__i386__) || defined(__sparc64__) +#if defined(__amd64__) || defined(__i386__) || defined(__mips__) || \ +defined(__sparc64__) #defineHAVE_BREAKPOINT #endif @@ -64,6 +65,8 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_BREAKPOINT #if defined(__amd64__) || defined(__i386__) #defineSKIP_BREAK(reg) +#elif defined(__mips__) +#defineSKIP_BREAK(reg) ((reg)->r_regs[PC] += 4) #elif defined(__sparc64__) #defineSKIP_BREAK(reg) do { \ (reg)->r_tpc = (reg)->r_tnpc + 4; \ ___ 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: r332908 - head/tests/sys/kern
Author: jhb Date: Tue Apr 24 05:30:05 2018 New Revision: 332908 URL: https://svnweb.freebsd.org/changeset/base/332908 Log: Add two tests for TRAP_* signal codes for SIGTRAP. - ptrace__breakpoint_siginfo tests that a SIGTRAP for a software breakpoint in userland triggers a SIGTRAP with a signal code of TRAP_BRKPT. - ptrace__step_siginfo tests that a SIGTRAP reported for a step after stepping via PT_STEP or PT_SETSTEP has a signal code of TRAP_TRACE. Modified: head/tests/sys/kern/ptrace_test.c Modified: head/tests/sys/kern/ptrace_test.c == --- head/tests/sys/kern/ptrace_test.c Tue Apr 24 05:26:28 2018 (r332907) +++ head/tests/sys/kern/ptrace_test.c Tue Apr 24 05:30:05 2018 (r332908) @@ -3488,6 +3488,110 @@ ATF_TC_BODY(ptrace__PT_STEP_with_signal, tc) ATF_REQUIRE(errno == ECHILD); } +#ifdef HAVE_BREAKPOINT +/* + * Verify that a SIGTRAP event with the TRAP_BRKPT code is reported + * for a breakpoint trap. + */ +ATF_TC_WITHOUT_HEAD(ptrace__breakpoint_siginfo); +ATF_TC_BODY(ptrace__breakpoint_siginfo, tc) +{ + struct ptrace_lwpinfo pl; + pid_t fpid, wpid; + int status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + breakpoint(); + exit(1); + } + + /* The first wait() should report the stop from SIGSTOP. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + /* Continue the child ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* The second wait() should report hitting the breakpoint. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & PL_FLAG_SI) != 0); + ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP); + ATF_REQUIRE(pl.pl_siginfo.si_code == TRAP_BRKPT); + + /* Kill the child process. */ + ATF_REQUIRE(ptrace(PT_KILL, fpid, 0, 0) == 0); + + /* The last wait() should report the SIGKILL. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSIGNALED(status)); + ATF_REQUIRE(WTERMSIG(status) == SIGKILL); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} +#endif /* HAVE_BREAKPOINT */ + +/* + * Verify that a SIGTRAP event with the TRAP_TRACE code is reported + * for a single-step trap from PT_STEP. + */ +ATF_TC_WITHOUT_HEAD(ptrace__step_siginfo); +ATF_TC_BODY(ptrace__step_siginfo, tc) +{ + struct ptrace_lwpinfo pl; + pid_t fpid, wpid; + int status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + exit(1); + } + + /* The first wait() should report the stop from SIGSTOP. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + /* Step the child ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_STEP, fpid, (caddr_t)1, 0) == 0); + + /* The second wait() should report a single-step trap. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & PL_FLAG_SI) != 0); + ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP); + ATF_REQUIRE(pl.pl_siginfo.si_code == TRAP_TRACE); + + /* Continue the child process. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* The last event should be for the child process's exit. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 1); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} + #if defined(HAVE_BREAKPOINT) && defined(SKIP_BREAK) static void * continue_thread(void *arg __unused) @@ -3713,6 +3817,10 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, ptrace__event_mask_sigkill_discard); ATF_TP_ADD_TC(tp, ptrace__PT_ATTACH_with_SBDRY_thread); ATF_TP_ADD_TC(tp, ptrace__PT_STEP_with_signal); +#ifdef HAVE_BREAKPOINT + ATF_TP_ADD_TC(tp, ptrace__breakpoint_siginfo); +#endif + ATF_TP_ADD_TC(tp, ptrace__step_siginfo); #if defined(HAVE_BREAKPOINT) && defined(SKIP_BREAK) ATF_TP_ADD_TC(tp, ptrace__PT_CONTINUE_different_thread); #endif
svn commit: r332909 - head/sys/mips/mips
Author: jhb Date: Tue Apr 24 05:33:17 2018 New Revision: 332909 URL: https://svnweb.freebsd.org/changeset/base/332909 Log: Report proper signal codes for SIGTRAP traps on MIPS. - Use TRAP_TRACE for traps after stepping via PT_STEP. - Use TRAP_BRKPT for software breakpoint traps and watchpoint traps. This was tested via the recently added siginfo ptrace() tests. PT_STEP on MIPS has several bugs that prevent it from working yet, but this does fix the ptrace__breakpoint_siginfo test on MIPS. Modified: head/sys/mips/mips/trap.c Modified: head/sys/mips/mips/trap.c == --- head/sys/mips/mips/trap.c Tue Apr 24 05:30:05 2018(r332908) +++ head/sys/mips/mips/trap.c Tue Apr 24 05:33:17 2018(r332909) @@ -840,6 +840,7 @@ dofault: if (td->td_md.md_ss_addr != va || instr != MIPS_BREAK_SSTEP) { i = SIGTRAP; + ucode = TRAP_BRKPT; addr = trapframe->pc; break; } @@ -851,6 +852,7 @@ dofault: */ addr = trapframe->pc; i = SIGTRAP; + ucode = TRAP_TRACE; break; } @@ -865,6 +867,7 @@ dofault: va += sizeof(int); printf("watch exception @ %p\n", (void *)va); i = SIGTRAP; + ucode = TRAP_BRKPT; addr = va; break; } ___ 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: r332910 - head/sys/mips/mips
Author: jhb Date: Tue Apr 24 05:42:10 2018 New Revision: 332910 URL: https://svnweb.freebsd.org/changeset/base/332910 Log: Relock PROC_LOCK before one failure case in ptrace_single_step(). The MIPS ptrace_single_step() unlocks the PROC_LOCK while reading and writing instructions from userland. One failure case was not reacquiring the lock before returning. Modified: head/sys/mips/mips/pm_machdep.c Modified: head/sys/mips/mips/pm_machdep.c == --- head/sys/mips/mips/pm_machdep.c Tue Apr 24 05:33:17 2018 (r332909) +++ head/sys/mips/mips/pm_machdep.c Tue Apr 24 05:42:10 2018 (r332910) @@ -260,6 +260,7 @@ ptrace_single_step(struct thread *td) if (td->td_md.md_ss_addr) { printf("SS %s (%d): breakpoint already set at %x (va %x)\n", p->p_comm, p->p_pid, td->td_md.md_ss_addr, va); /* XXX */ + PROC_LOCK(p); return (EFAULT); } td->td_md.md_ss_addr = va; ___ 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: r332911 - head/sys/kern
Author: mjg Date: Tue Apr 24 06:10:36 2018 New Revision: 332911 URL: https://svnweb.freebsd.org/changeset/base/332911 Log: lockf: change the owner hash from pid to vnode-based This adds a bit missed due to the patch split, see r332882 Tested by:pho Modified: head/sys/kern/kern_lockf.c Modified: head/sys/kern/kern_lockf.c == --- head/sys/kern/kern_lockf.c Tue Apr 24 05:42:10 2018(r332910) +++ head/sys/kern/kern_lockf.c Tue Apr 24 06:10:36 2018(r332911) @@ -105,7 +105,7 @@ struct owner_graph; #define SELF 0x1 #define OTHERS 0x2 static void lf_init(void *); -static int lf_hash_owner(caddr_t, struct flock *, int); +static int lf_hash_owner(caddr_t, struct vnode *, struct flock *, int); static int lf_owner_matches(struct lock_owner *, caddr_t, struct flock *, int); static struct lockf_entry * @@ -301,7 +301,7 @@ SYSINIT(lf_init, SI_SUB_LOCK, SI_ORDER_FIRST, lf_init, * Generate a hash value for a lock owner. */ static int -lf_hash_owner(caddr_t id, struct flock *fl, int flags) +lf_hash_owner(caddr_t id, struct vnode *vp, struct flock *fl, int flags) { uint32_t h; @@ -311,9 +311,7 @@ lf_hash_owner(caddr_t id, struct flock *fl, int flags) } else if (flags & F_FLOCK) { h = ((uintptr_t) id) >> 7; } else { - struct proc *p = (struct proc *) id; - h = HASHSTEP(0, p->p_pid); - h = HASHSTEP(h, 0); + h = ((uintptr_t) vp) >> 7; } return (h % LOCK_OWNER_HASH_SIZE); @@ -500,7 +498,7 @@ retry_setlock: * Map our arguments to an existing lock owner or create one * if this is the first time we have seen this owner. */ - hash = lf_hash_owner(id, fl, flags); + hash = lf_hash_owner(id, vp, fl, flags); sx_xlock(&lf_lock_owners[hash].lock); LIST_FOREACH(lo, &lf_lock_owners[hash].list, lo_link) if (lf_owner_matches(lo, id, fl, 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"