From owner-svn-src-head@freebsd.org Sun Aug 4 04:51:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA616C4D7F; Sun, 4 Aug 2019 04:51:32 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 461T505Qx7z46Wh; Sun, 4 Aug 2019 04:51:32 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9DB37261BE; Sun, 4 Aug 2019 04:51:32 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x744pWV2070494; Sun, 4 Aug 2019 04:51:32 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x744pWTN070493; Sun, 4 Aug 2019 04:51:32 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908040451.x744pWTN070493@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 4 Aug 2019 04:51:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350566 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 350566 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Aug 2019 04:51:32 -0000 Author: delphij Date: Sun Aug 4 04:51:32 2019 New Revision: 350566 URL: https://svnweb.freebsd.org/changeset/base/350566 Log: There is no need to explicitly add zlib, we already have it in sys/conf/files. Modified: head/share/man/man4/mxge.4 Modified: head/share/man/man4/mxge.4 ============================================================================== --- head/share/man/man4/mxge.4 Sun Aug 4 01:18:50 2019 (r350565) +++ head/share/man/man4/mxge.4 Sun Aug 4 04:51:32 2019 (r350566) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 2, 2019 +.Dd February 13, 2008 .Dt MXGE 4 .Os .Sh NAME @@ -43,7 +43,6 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "device firmware" -.Cd "device zlib" .Cd "device mxge" .Ed .Pp From owner-svn-src-head@freebsd.org Sun Aug 4 12:47:35 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8339A92F5; Sun, 4 Aug 2019 12:47:35 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 461gfH5s0Nz4Ttr; Sun, 4 Aug 2019 12:47:35 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A70623963; Sun, 4 Aug 2019 12:47:35 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x74ClZnJ057238; Sun, 4 Aug 2019 12:47:35 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x74ClZIa057237; Sun, 4 Aug 2019 12:47:35 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908041247.x74ClZIa057237@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 4 Aug 2019 12:47:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350567 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 350567 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Aug 2019 12:47:36 -0000 Author: cy Date: Sun Aug 4 12:47:35 2019 New Revision: 350567 URL: https://svnweb.freebsd.org/changeset/base/350567 Log: Returning an uninitialized error is a bad thing. MFC after: 3 days Modified: head/sys/contrib/ipfilter/netinet/mlfk_ipl.c Modified: head/sys/contrib/ipfilter/netinet/mlfk_ipl.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/mlfk_ipl.c Sun Aug 4 04:51:32 2019 (r350566) +++ head/sys/contrib/ipfilter/netinet/mlfk_ipl.c Sun Aug 4 12:47:35 2019 (r350567) @@ -310,7 +310,7 @@ ipf_modunload() printf("%s unloaded\n", ipfilter_version); - return error; + return (0); } From owner-svn-src-head@freebsd.org Sun Aug 4 12:47:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 46D1FA9308; Sun, 4 Aug 2019 12:47:39 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 461gfM195jz4Tv2; Sun, 4 Aug 2019 12:47:39 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A7E43964; Sun, 4 Aug 2019 12:47:39 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x74Clc6s057287; Sun, 4 Aug 2019 12:47:38 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x74ClcGO057283; Sun, 4 Aug 2019 12:47:38 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908041247.x74ClcGO057283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 4 Aug 2019 12:47:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350568 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 350568 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Aug 2019 12:47:39 -0000 Author: cy Date: Sun Aug 4 12:47:38 2019 New Revision: 350568 URL: https://svnweb.freebsd.org/changeset/base/350568 Log: Resolve ipfilter kld unload issues related to VNET jails. When the ipfilter kld is loaded, used within VNET jail, and unloaded, then subsequent loading, use, and unloading of another packet filters will cause the subsequently loaded netpfil kld's to panic. The scenario is as follows: cd /usr/tests/sys/netpfil/common kldunload ipl kldunload pfsync kldunload ipfw kyua test pass_block kldload ipl kyua test pass_block kldunload ipl kldload pfsync kyua test pass_block kldunload pfsync -- page fault panic occurs here -- Reported by: "Ahsan Barkati" via kp@ Discussed with: kp@ Tested by: kp@ MFC after: 3 days Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c head/sys/contrib/ipfilter/netinet/mlfk_ipl.c Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sun Aug 4 12:47:35 2019 (r350567) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sun Aug 4 12:47:38 2019 (r350568) @@ -100,7 +100,10 @@ VNET_DEFINE(ipf_main_softc_t, ipfmain) = { # include # include -static eventhandler_tag ipf_arrivetag, ipf_departtag; +VNET_DEFINE_STATIC(eventhandler_tag, ipf_arrivetag); +VNET_DEFINE_STATIC(eventhandler_tag, ipf_departtag); +#define V_ipf_arrivetag VNET(ipf_arrivetag) +#define V_ipf_departtag VNET(ipf_departtag) #if 0 /* * Disable the "cloner" event handler; we are getting interface @@ -110,7 +113,8 @@ static eventhandler_tag ipf_arrivetag, ipf_departtag; * If it turns out to be needed, well need a dedicated event handler * for it to deal with the ifc and the correct vnet. */ -static eventhandler_tag ipf_clonetag; +VNET_DEFINE_STATIC(eventhandler_tag, ipf_clonetag); +#define V_ipf_clonetag VNET(ipf_clonetag) #endif static void ipf_ifevent(void *arg, struct ifnet *ifp); @@ -1383,14 +1387,14 @@ int ipf_pfil_hook(void) { void ipf_event_reg(void) { - ipf_arrivetag = EVENTHANDLER_REGISTER(ifnet_arrival_event, \ + V_ipf_arrivetag = EVENTHANDLER_REGISTER(ifnet_arrival_event, \ ipf_ifevent, NULL, \ EVENTHANDLER_PRI_ANY); - ipf_departtag = EVENTHANDLER_REGISTER(ifnet_departure_event, \ + V_ipf_departtag = EVENTHANDLER_REGISTER(ifnet_departure_event, \ ipf_ifevent, NULL, \ EVENTHANDLER_PRI_ANY); #if 0 - ipf_clonetag = EVENTHANDLER_REGISTER(if_clone_event, ipf_ifevent, \ + V_ipf_clonetag = EVENTHANDLER_REGISTER(if_clone_event, ipf_ifevent, \ NULL, EVENTHANDLER_PRI_ANY); #endif } @@ -1398,15 +1402,15 @@ ipf_event_reg(void) void ipf_event_dereg(void) { - if (ipf_arrivetag != NULL) { - EVENTHANDLER_DEREGISTER(ifnet_arrival_event, ipf_arrivetag); + if (V_ipf_arrivetag != NULL) { + EVENTHANDLER_DEREGISTER(ifnet_arrival_event, V_ipf_arrivetag); } - if (ipf_departtag != NULL) { - EVENTHANDLER_DEREGISTER(ifnet_departure_event, ipf_departtag); + if (V_ipf_departtag != NULL) { + EVENTHANDLER_DEREGISTER(ifnet_departure_event, V_ipf_departtag); } #if 0 - if (ipf_clonetag != NULL) { - EVENTHANDLER_DEREGISTER(if_clone_event, ipf_clonetag); + if (V_ipf_clonetag != NULL) { + EVENTHANDLER_DEREGISTER(if_clone_event, V_ipf_clonetag); } #endif } Modified: head/sys/contrib/ipfilter/netinet/mlfk_ipl.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/mlfk_ipl.c Sun Aug 4 12:47:35 2019 (r350567) +++ head/sys/contrib/ipfilter/netinet/mlfk_ipl.c Sun Aug 4 12:47:38 2019 (r350568) @@ -283,6 +283,10 @@ vnet_ipf_uninit(void) V_ipfmain.ipf_running = -2; ipf_destroy_all(&V_ipfmain); + if (!IS_DEFAULT_VNET(curvnet)) { + ipf_event_dereg(); + (void)ipf_pfil_unhook(); + } } } VNET_SYSUNINIT(vnet_ipf_uninit, SI_SUB_PROTO_FIREWALL, SI_ORDER_THIRD, From owner-svn-src-head@freebsd.org Sun Aug 4 19:25:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0704BAFEAD; Sun, 4 Aug 2019 19:25:24 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 461rTH62F1z3JZ6; Sun, 4 Aug 2019 19:25:23 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD5A78254; Sun, 4 Aug 2019 19:25:23 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x74JPN5r096057; Sun, 4 Aug 2019 19:25:23 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x74JPNYU096056; Sun, 4 Aug 2019 19:25:23 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908041925.x74JPNYU096056@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 4 Aug 2019 19:25:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350569 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 350569 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Aug 2019 19:25:24 -0000 Author: jhibbits Date: Sun Aug 4 19:25:23 2019 New Revision: 350569 URL: https://svnweb.freebsd.org/changeset/base/350569 Log: powerpc: Enable the BUS_DMA_NOCACHE flag handling The flag handling was committed commented out 7 years ago. It works, and is needed for LinuxKPI-based DRM drivers. Also mark a local as potentially unusable, as it's only really used when KTR is enabled. Submitted by: mmacy Modified: head/sys/powerpc/powerpc/busdma_machdep.c Modified: head/sys/powerpc/powerpc/busdma_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/busdma_machdep.c Sun Aug 4 12:47:38 2019 (r350568) +++ head/sys/powerpc/powerpc/busdma_machdep.c Sun Aug 4 19:25:23 2019 (r350569) @@ -350,7 +350,7 @@ bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain) int bus_dma_tag_destroy(bus_dma_tag_t dmat) { - bus_dma_tag_t dmat_copy; + bus_dma_tag_t dmat_copy __unused; int error; error = 0; @@ -515,11 +515,9 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int if (flags & BUS_DMA_ZERO) mflags |= M_ZERO; -#ifdef NOTYET if (flags & BUS_DMA_NOCACHE) attr = VM_MEMATTR_UNCACHEABLE; else -#endif attr = VM_MEMATTR_DEFAULT; /* From owner-svn-src-head@freebsd.org Sun Aug 4 19:28:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 08E66B0008; Sun, 4 Aug 2019 19:28:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 461rXY07jjz3JnV; Sun, 4 Aug 2019 19:28:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D73298264; Sun, 4 Aug 2019 19:28:12 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x74JSCrY096264; Sun, 4 Aug 2019 19:28:12 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x74JSBab096255; Sun, 4 Aug 2019 19:28:11 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908041928.x74JSBab096255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 4 Aug 2019 19:28:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350570 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src dev/ofw dev/pci kern sys X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src dev/ofw dev/pci kern sys X-SVN-Commit-Revision: 350570 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Aug 2019 19:28:13 -0000 Author: jhibbits Date: Sun Aug 4 19:28:10 2019 New Revision: 350570 URL: https://svnweb.freebsd.org/changeset/base/350570 Log: Add necessary bits for Linux KPI to work correctly on powerpc PowerPC, and possibly other architectures, use different address ranges for PCI space vs physical address space, which is only mapped at resource activation time, when the BAR gets written. The DRM kernel modules do not activate the rman resources, soas not to waste KVA, instead only mapping parts of the PCI memory at a time. This introduces a BUS_TRANSLATE_RESOURCE() method, implemented in the Open Firmware/FDT PCI driver, to perform this necessary translation without activating the resource. In addition to system KPI changes, LinuxKPI is updated to handle a big-endian host, by adding proper endian swaps to the I/O functions. Submitted by: mmacy Reported by: hselasky Differential Revision: https://reviews.freebsd.org/D21096 Modified: head/sys/compat/linuxkpi/common/include/linux/gfp.h head/sys/compat/linuxkpi/common/include/linux/io.h head/sys/compat/linuxkpi/common/include/linux/pci.h head/sys/compat/linuxkpi/common/src/linux_pci.c head/sys/dev/ofw/ofwpci.c head/sys/dev/pci/vga_pci.c head/sys/kern/bus_if.m head/sys/kern/subr_bus.c head/sys/sys/bus.h Modified: head/sys/compat/linuxkpi/common/include/linux/gfp.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/gfp.h Sun Aug 4 19:25:23 2019 (r350569) +++ head/sys/compat/linuxkpi/common/include/linux/gfp.h Sun Aug 4 19:28:10 2019 (r350570) @@ -56,6 +56,7 @@ #define __GFP_IO 0 #define __GFP_NO_KSWAPD 0 +#define __GFP_KSWAPD_RECLAIM 0 #define __GFP_WAIT M_WAITOK #define __GFP_DMA32 (1U << 24) /* LinuxKPI only */ #define __GFP_BITS_SHIFT 25 Modified: head/sys/compat/linuxkpi/common/include/linux/io.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/io.h Sun Aug 4 19:25:23 2019 (r350569) +++ head/sys/compat/linuxkpi/common/include/linux/io.h Sun Aug 4 19:28:10 2019 (r350570) @@ -42,6 +42,32 @@ * XXX This is all x86 specific. It should be bus space access. */ + +/* rmb and wmb are declared in machine/atomic.h, so should be included first. */ +#ifndef __io_br +#define __io_br() __compiler_membar() +#endif + +#ifndef __io_ar +#ifdef rmb +#define __io_ar() rmb() +#else +#define __io_ar() __compiler_membar() +#endif +#endif + +#ifndef __io_bw +#ifdef wmb +#define __io_bw() wmb() +#else +#define __io_bw() __compiler_membar() +#endif +#endif + +#ifndef __io_aw +#define __io_aw() __compiler_membar() +#endif + /* Access MMIO registers atomically without barriers and byte swapping. */ static inline uint8_t @@ -112,9 +138,9 @@ readb(const volatile void *addr) { uint8_t v; - __compiler_membar(); + __io_br(); v = *(const volatile uint8_t *)addr; - __compiler_membar(); + __io_ar(); return (v); } #define readb(addr) readb(addr) @@ -123,9 +149,9 @@ readb(const volatile void *addr) static inline void writeb(uint8_t v, volatile void *addr) { - __compiler_membar(); + __io_bw(); *(volatile uint8_t *)addr = v; - __compiler_membar(); + __io_aw(); } #define writeb(v, addr) writeb(v, addr) @@ -135,9 +161,9 @@ readw(const volatile void *addr) { uint16_t v; - __compiler_membar(); - v = *(const volatile uint16_t *)addr; - __compiler_membar(); + __io_br(); + v = le16toh(__raw_readw(addr)); + __io_ar(); return (v); } #define readw(addr) readw(addr) @@ -146,9 +172,9 @@ readw(const volatile void *addr) static inline void writew(uint16_t v, volatile void *addr) { - __compiler_membar(); - *(volatile uint16_t *)addr = v; - __compiler_membar(); + __io_bw(); + __raw_writew(htole16(v), addr); + __io_aw(); } #define writew(v, addr) writew(v, addr) @@ -158,9 +184,9 @@ readl(const volatile void *addr) { uint32_t v; - __compiler_membar(); - v = *(const volatile uint32_t *)addr; - __compiler_membar(); + __io_br(); + v = le32toh(__raw_readl(addr)); + __io_ar(); return (v); } #define readl(addr) readl(addr) @@ -169,9 +195,9 @@ readl(const volatile void *addr) static inline void writel(uint32_t v, volatile void *addr) { - __compiler_membar(); - *(volatile uint32_t *)addr = v; - __compiler_membar(); + __io_bw(); + __raw_writel(htole32(v), addr); + __io_aw(); } #define writel(v, addr) writel(v, addr) @@ -183,9 +209,9 @@ readq(const volatile void *addr) { uint64_t v; - __compiler_membar(); - v = *(const volatile uint64_t *)addr; - __compiler_membar(); + __io_br(); + v = le64toh(__raw_readq(addr)); + __io_ar(); return (v); } #define readq(addr) readq(addr) @@ -193,9 +219,9 @@ readq(const volatile void *addr) static inline void writeq(uint64_t v, volatile void *addr) { - __compiler_membar(); - *(volatile uint64_t *)addr = v; - __compiler_membar(); + __io_bw(); + __raw_writeq(htole64(v), addr); + __io_aw(); } #define writeq(v, addr) writeq(v, addr) #endif @@ -206,7 +232,7 @@ writeq(uint64_t v, volatile void *addr) static inline uint8_t readb_relaxed(const volatile void *addr) { - return (*(const volatile uint8_t *)addr); + return (__raw_readb(addr)); } #define readb_relaxed(addr) readb_relaxed(addr) @@ -214,7 +240,7 @@ readb_relaxed(const volatile void *addr) static inline void writeb_relaxed(uint8_t v, volatile void *addr) { - *(volatile uint8_t *)addr = v; + __raw_writeb(v, addr); } #define writeb_relaxed(v, addr) writeb_relaxed(v, addr) @@ -222,7 +248,7 @@ writeb_relaxed(uint8_t v, volatile void *addr) static inline uint16_t readw_relaxed(const volatile void *addr) { - return (*(const volatile uint16_t *)addr); + return (le16toh(__raw_readw(addr))); } #define readw_relaxed(addr) readw_relaxed(addr) @@ -230,7 +256,7 @@ readw_relaxed(const volatile void *addr) static inline void writew_relaxed(uint16_t v, volatile void *addr) { - *(volatile uint16_t *)addr = v; + __raw_writew(htole16(v), addr); } #define writew_relaxed(v, addr) writew_relaxed(v, addr) @@ -238,7 +264,7 @@ writew_relaxed(uint16_t v, volatile void *addr) static inline uint32_t readl_relaxed(const volatile void *addr) { - return (*(const volatile uint32_t *)addr); + return (le32toh(__raw_readl(addr))); } #define readl_relaxed(addr) readl_relaxed(addr) @@ -246,7 +272,7 @@ readl_relaxed(const volatile void *addr) static inline void writel_relaxed(uint32_t v, volatile void *addr) { - *(volatile uint32_t *)addr = v; + __raw_writel(htole32(v), addr); } #define writel_relaxed(v, addr) writel_relaxed(v, addr) @@ -256,14 +282,14 @@ writel_relaxed(uint32_t v, volatile void *addr) static inline uint64_t readq_relaxed(const volatile void *addr) { - return (*(const volatile uint64_t *)addr); + return (le64toh(__raw_readq(addr))); } #define readq_relaxed(addr) readq_relaxed(addr) static inline void writeq_relaxed(uint64_t v, volatile void *addr) { - *(volatile uint64_t *)addr = v; + __raw_writeq(htole64(v), addr); } #define writeq_relaxed(v, addr) writeq_relaxed(v, addr) #endif @@ -290,7 +316,13 @@ ioread16(const volatile void *addr) static inline uint16_t ioread16be(const volatile void *addr) { - return (bswap16(readw(addr))); + uint16_t v; + + __io_br(); + v = (be16toh(__raw_readw(addr))); + __io_ar(); + + return (v); } #define ioread16be(addr) ioread16be(addr) @@ -306,7 +338,13 @@ ioread32(const volatile void *addr) static inline uint32_t ioread32be(const volatile void *addr) { - return (bswap32(readl(addr))); + uint32_t v; + + __io_br(); + v = (be32toh(__raw_readl(addr))); + __io_ar(); + + return (v); } #define ioread32be(addr) ioread32be(addr) @@ -338,7 +376,9 @@ iowrite32(uint32_t v, volatile void *addr) static inline void iowrite32be(uint32_t v, volatile void *addr) { - writel(bswap32(v), addr); + __io_bw(); + __raw_writel(htobe32(v), addr); + __io_aw(); } #define iowrite32be(v, addr) iowrite32be(v, addr) Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/pci.h Sun Aug 4 19:25:23 2019 (r350569) +++ head/sys/compat/linuxkpi/common/include/linux/pci.h Sun Aug 4 19:28:10 2019 (r350570) @@ -205,6 +205,7 @@ struct pci_driver { struct pci_bus { struct pci_dev *self; + int domain; int number; }; @@ -270,26 +271,6 @@ linux_pci_find_irq_dev(unsigned int irq) return (found); } -static inline unsigned long -pci_resource_start(struct pci_dev *pdev, int bar) -{ - struct resource_list_entry *rle; - - if ((rle = linux_pci_get_bar(pdev, bar)) == NULL) - return (0); - return rle->start; -} - -static inline unsigned long -pci_resource_len(struct pci_dev *pdev, int bar) -{ - struct resource_list_entry *rle; - - if ((rle = linux_pci_get_bar(pdev, bar)) == NULL) - return (0); - return rle->count; -} - static inline int pci_resource_type(struct pci_dev *pdev, int bar) { @@ -447,6 +428,9 @@ pci_disable_msix(struct pci_dev *pdev) pdev->dev.msix_max = 0; } +unsigned long pci_resource_start(struct pci_dev *pdev, int bar); +unsigned long pci_resource_len(struct pci_dev *pdev, int bar); + static inline bus_addr_t pci_bus_address(struct pci_dev *pdev, int bar) { @@ -633,7 +617,7 @@ static inline void pci_disable_sriov(struct pci_dev *d /* XXX This should not be necessary. */ #define pcix_set_mmrbc(d, v) 0 #define pcix_get_max_mmrbc(d) 0 -#define pcie_set_readrq(d, v) 0 +#define pcie_set_readrq(d, v) pci_set_max_read_req(&(d)->dev, (v)) #define PCI_DMA_BIDIRECTIONAL 0 #define PCI_DMA_TODEVICE 1 Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_pci.c Sun Aug 4 19:25:23 2019 (r350569) +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Sun Aug 4 19:28:10 2019 (r350570) @@ -29,12 +29,12 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include #include -#include #include #include #include @@ -209,7 +209,6 @@ linux_pci_attach(device_t dev) struct pci_driver *pdrv; const struct pci_device_id *id; device_t parent; - devclass_t devclass; int error; linux_set_current(curthread); @@ -218,7 +217,6 @@ linux_pci_attach(device_t dev) pdev = device_get_softc(dev); parent = device_get_parent(dev); - devclass = device_get_devclass(parent); if (pdrv->isdrm) { dinfo = device_get_ivars(parent); device_set_ivars(dev, dinfo); @@ -254,6 +252,7 @@ linux_pci_attach(device_t dev) pbus = malloc(sizeof(*pbus), M_DEVBUF, M_WAITOK | M_ZERO); pbus->self = pdev; pbus->number = pci_get_bus(dev); + pbus->domain = pci_get_domain(dev); pdev->bus = pbus; spin_lock(&pci_lock); @@ -386,6 +385,36 @@ linux_pci_register_driver(struct pci_driver *pdrv) return (-ENXIO); pdrv->isdrm = false; return (_linux_pci_register_driver(pdrv, dc)); +} + +unsigned long +pci_resource_start(struct pci_dev *pdev, int bar) +{ + struct resource_list_entry *rle; + unsigned long newstart; + device_t dev; + + if ((rle = linux_pci_get_bar(pdev, bar)) == NULL) + return (0); + dev = pci_find_dbsf(pdev->bus->domain, pdev->bus->number, + PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); + MPASS(dev != NULL); + if (BUS_TRANSLATE_RESOURCE(dev, rle->type, rle->start, &newstart)) { + device_printf(pdev->dev.bsddev, "translate of %#lx failed\n", + rle->start); + return (0); + } + return (newstart); +} + +unsigned long +pci_resource_len(struct pci_dev *pdev, int bar) +{ + struct resource_list_entry *rle; + + if ((rle = linux_pci_get_bar(pdev, bar)) == NULL) + return (0); + return (rle->count); } int Modified: head/sys/dev/ofw/ofwpci.c ============================================================================== --- head/sys/dev/ofw/ofwpci.c Sun Aug 4 19:25:23 2019 (r350569) +++ head/sys/dev/ofw/ofwpci.c Sun Aug 4 19:28:10 2019 (r350570) @@ -76,6 +76,8 @@ static int ofw_pci_deactivate_resource(device_t, devic struct resource *); static int ofw_pci_adjust_resource(device_t, device_t, int, struct resource *, rman_res_t, rman_res_t); +static int ofw_pci_translate_resource(device_t bus, int type, + rman_res_t start, rman_res_t *newstart); #ifdef __powerpc__ static bus_space_tag_t ofw_pci_bus_get_bus_tag(device_t, device_t); @@ -116,6 +118,7 @@ static device_method_t ofw_pci_methods[] = { DEVMETHOD(bus_activate_resource, ofw_pci_activate_resource), DEVMETHOD(bus_deactivate_resource, ofw_pci_deactivate_resource), DEVMETHOD(bus_adjust_resource, ofw_pci_adjust_resource), + DEVMETHOD(bus_translate_resource, ofw_pci_translate_resource), #ifdef __powerpc__ DEVMETHOD(bus_get_bus_tag, ofw_pci_bus_get_bus_tag), #endif @@ -476,6 +479,45 @@ ofw_pci_release_resource(device_t bus, device_t child, return (error); } return (rman_release_resource(res)); +} + +static int +ofw_pci_translate_resource(device_t bus, int type, rman_res_t start, + rman_res_t *newstart) +{ + struct ofw_pci_softc *sc; + struct ofw_pci_range *rp; + int space; + + sc = device_get_softc(bus); + + /* + * Map this through the ranges list + */ + for (rp = sc->sc_range; rp < sc->sc_range + sc->sc_nrange && + rp->pci_hi != 0; rp++) { + if (start < rp->pci || start >= rp->pci + rp->size) + continue; + + switch (rp->pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) { + case OFW_PCI_PHYS_HI_SPACE_IO: + space = SYS_RES_IOPORT; + break; + case OFW_PCI_PHYS_HI_SPACE_MEM32: + case OFW_PCI_PHYS_HI_SPACE_MEM64: + space = SYS_RES_MEMORY; + break; + default: + space = -1; + } + + if (type == space) { + start += (rp->host - rp->pci); + break; + } + } + *newstart = start; + return (0); } static int Modified: head/sys/dev/pci/vga_pci.c ============================================================================== --- head/sys/dev/pci/vga_pci.c Sun Aug 4 19:25:23 2019 (r350569) +++ head/sys/dev/pci/vga_pci.c Sun Aug 4 19:28:10 2019 (r350570) @@ -142,11 +142,35 @@ vga_pci_is_boot_display(device_t dev) return (1); } +static void +vga_pci_reset(device_t dev) +{ + int ps; + /* + * FLR is unsupported on GPUs so attempt a power-management reset by cycling + * the device in/out of D3 state. + * PCI spec says we can only go into D3 state from D0 state. + * Transition from D[12] into D0 before going to D3 state. + */ + ps = pci_get_powerstate(dev); + if (ps != PCI_POWERSTATE_D0 && ps != PCI_POWERSTATE_D3) + pci_set_powerstate(dev, PCI_POWERSTATE_D0); + if (pci_get_powerstate(dev) != PCI_POWERSTATE_D3) + pci_set_powerstate(dev, PCI_POWERSTATE_D3); + pci_set_powerstate(dev, ps); +} + + void * vga_pci_map_bios(device_t dev, size_t *size) { - int rid; + struct vga_resource *vr; struct resource *res; + device_t pcib; + uint32_t rom_addr; + uint16_t config; + volatile char *bios; + int i, rid, found; #if defined(__amd64__) || defined(__i386__) if (vga_pci_is_boot_display(dev)) { @@ -164,21 +188,96 @@ vga_pci_map_bios(device_t dev, size_t *size) } #endif - rid = PCIR_BIOS; + pcib = device_get_parent(device_get_parent(dev)); + if (device_get_devclass(device_get_parent(pcib)) == + devclass_find("pci")) { + /* + * The parent bridge is a PCI-to-PCI bridge: check the + * value of the "VGA Enable" bit. + */ + config = pci_read_config(pcib, PCIR_BRIDGECTL_1, 2); + if ((config & PCIB_BCR_VGA_ENABLE) == 0) { + config |= PCIB_BCR_VGA_ENABLE; + pci_write_config(pcib, PCIR_BRIDGECTL_1, config, 2); + } + } + + switch(pci_read_config(dev, PCIR_HDRTYPE, 1)) { + case PCIM_HDRTYPE_BRIDGE: + rid = PCIR_BIOS_1; + break; + case PCIM_HDRTYPE_CARDBUS: + rid = 0; + break; + default: + rid = PCIR_BIOS; + break; + } + if (rid == 0) + return (NULL); res = vga_pci_alloc_resource(dev, NULL, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE); + if (res == NULL) { + device_printf(dev, "vga_pci_alloc_resource failed\n"); return (NULL); } + bios = rman_get_virtual(res); + *size = rman_get_size(res); + for (found = i = 0; i < hz; i++) { + found = (bios[0] == 0x55 && bios[1] == 0xaa); + if (found) + break; + pause("vgabios", 1); + } + if (found) + return (__DEVOLATILE(void *, bios)); + if (bootverbose) + device_printf(dev, "initial ROM mapping failed -- resetting\n"); + /* + * Enable ROM decode + */ + vga_pci_reset(dev); + rom_addr = pci_read_config(dev, rid, 4); + rom_addr &= 0x7ff; + rom_addr |= rman_get_start(res) | 0x1; + pci_write_config(dev, rid, rom_addr, 4); + vr = lookup_res(device_get_softc(dev), rid); + vga_pci_release_resource(dev, NULL, SYS_RES_MEMORY, rid, + vr->vr_res); + + /* + * re-allocate + */ + res = vga_pci_alloc_resource(dev, NULL, SYS_RES_MEMORY, &rid, 0, + ~0, 1, RF_ACTIVE); + if (res == NULL) { + device_printf(dev, "vga_pci_alloc_resource failed\n"); + return (NULL); + } + bios = rman_get_virtual(res); *size = rman_get_size(res); - return (rman_get_virtual(res)); + for (found = i = 0; i < 3*hz; i++) { + found = (bios[0] == 0x55 && bios[1] == 0xaa); + if (found) + break; + pause("vgabios", 1); + } + if (found) + return (__DEVOLATILE(void *, bios)); + device_printf(dev, "ROM mapping failed\n"); + vr = lookup_res(device_get_softc(dev), rid); + vga_pci_release_resource(dev, NULL, SYS_RES_MEMORY, rid, + vr->vr_res); + return (NULL); } void vga_pci_unmap_bios(device_t dev, void *bios) { struct vga_resource *vr; + int rid; if (bios == NULL) { return; @@ -192,16 +291,28 @@ vga_pci_unmap_bios(device_t dev, void *bios) return; } #endif - + switch(pci_read_config(dev, PCIR_HDRTYPE, 1)) { + case PCIM_HDRTYPE_BRIDGE: + rid = PCIR_BIOS_1; + break; + case PCIM_HDRTYPE_CARDBUS: + rid = 0; + break; + default: + rid = PCIR_BIOS; + break; + } + if (rid == 0) + return; /* * Look up the PCIR_BIOS resource in our softc. It should match * the address we returned previously. */ - vr = lookup_res(device_get_softc(dev), PCIR_BIOS); + vr = lookup_res(device_get_softc(dev), rid); KASSERT(vr->vr_res != NULL, ("vga_pci_unmap_bios: bios not mapped")); KASSERT(rman_get_virtual(vr->vr_res) == bios, ("vga_pci_unmap_bios: mismatch")); - vga_pci_release_resource(dev, NULL, SYS_RES_MEMORY, PCIR_BIOS, + vga_pci_release_resource(dev, NULL, SYS_RES_MEMORY, rid, vr->vr_res); } Modified: head/sys/kern/bus_if.m ============================================================================== --- head/sys/kern/bus_if.m Sun Aug 4 19:25:23 2019 (r350569) +++ head/sys/kern/bus_if.m Sun Aug 4 19:28:10 2019 (r350570) @@ -76,6 +76,18 @@ CODE { { return (0); } + + static int + null_translate_resource(device_t bus, int type, rman_res_t start, + rman_res_t *newstart) + { + if (device_get_parent(bus) != NULL) + return (BUS_TRANSLATE_RESOURCE(device_get_parent(bus), + type, start, newstart)); + + *newstart = start; + return (0); + } }; /** @@ -405,6 +417,23 @@ METHOD int adjust_resource { rman_res_t _start; rman_res_t _end; }; + + +/** + * @brief translate a resource value + * + * + * @param _dev the device associated with the resource + * @param _type the type of resource + * @param _start the starting address of the resource range + * @param _newstart the new starting address of the resource range + */ +METHOD int translate_resource { + device_t _dev; + int _type; + rman_res_t _start; + rman_res_t *_newstart; +} DEFAULT null_translate_resource; /** * @brief Release a resource Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Sun Aug 4 19:25:23 2019 (r350569) +++ head/sys/kern/subr_bus.c Sun Aug 4 19:28:10 2019 (r350570) @@ -3971,7 +3971,6 @@ bus_helper_reset_prepare(device_t dev, int flags) return (0); } - /** * @brief Helper function for implementing BUS_PRINT_CHILD(). * Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Sun Aug 4 19:25:23 2019 (r350569) +++ head/sys/sys/bus.h Sun Aug 4 19:28:10 2019 (r350570) @@ -434,6 +434,8 @@ struct resource * bus_generic_alloc_resource(device_t bus, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); +int bus_generic_translate_resource(device_t dev, int type, rman_res_t start, + rman_res_t *newstart); int bus_generic_attach(device_t dev); int bus_generic_bind_intr(device_t dev, device_t child, struct resource *irq, int cpu); From owner-svn-src-head@freebsd.org Sun Aug 4 19:47:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 66C63B055B; Sun, 4 Aug 2019 19:47:03 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 461ryH21PCz3KZ9; Sun, 4 Aug 2019 19:47:03 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2282485F3; Sun, 4 Aug 2019 19:47:03 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x74Jl2V8008692; Sun, 4 Aug 2019 19:47:02 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x74Jl20R008691; Sun, 4 Aug 2019 19:47:02 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908041947.x74Jl20R008691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 4 Aug 2019 19:47:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350571 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 350571 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Aug 2019 19:47:03 -0000 Author: jhibbits Date: Sun Aug 4 19:47:02 2019 New Revision: 350571 URL: https://svnweb.freebsd.org/changeset/base/350571 Log: Fix the build after r350570. Signed char cannot compare to values above 0x7f. Use unsigned instead. Modified: head/sys/dev/pci/vga_pci.c Modified: head/sys/dev/pci/vga_pci.c ============================================================================== --- head/sys/dev/pci/vga_pci.c Sun Aug 4 19:28:10 2019 (r350570) +++ head/sys/dev/pci/vga_pci.c Sun Aug 4 19:47:02 2019 (r350571) @@ -169,7 +169,7 @@ vga_pci_map_bios(device_t dev, size_t *size) device_t pcib; uint32_t rom_addr; uint16_t config; - volatile char *bios; + volatile unsigned char *bios; int i, rid, found; #if defined(__amd64__) || defined(__i386__) From owner-svn-src-head@freebsd.org Sun Aug 4 19:55:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 922DAB077D; Sun, 4 Aug 2019 19:55:44 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 461s8J3Lj3z3L0K; Sun, 4 Aug 2019 19:55:44 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 54C6687D3; Sun, 4 Aug 2019 19:55:44 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x74Jtirq014409; Sun, 4 Aug 2019 19:55:44 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x74Jti2j014408; Sun, 4 Aug 2019 19:55:44 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908041955.x74Jti2j014408@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 4 Aug 2019 19:55:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350572 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 350572 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Aug 2019 19:55:44 -0000 Author: jhibbits Date: Sun Aug 4 19:55:43 2019 New Revision: 350572 URL: https://svnweb.freebsd.org/changeset/base/350572 Log: Fix 32-bit build post-r350570 The error message prints a rman_res_t, which is an uintmax_t. Explicitly cast, just for future-proofing, and use the correct format. Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_pci.c Sun Aug 4 19:47:02 2019 (r350571) +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Sun Aug 4 19:55:43 2019 (r350572) @@ -400,8 +400,8 @@ pci_resource_start(struct pci_dev *pdev, int bar) PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); MPASS(dev != NULL); if (BUS_TRANSLATE_RESOURCE(dev, rle->type, rle->start, &newstart)) { - device_printf(pdev->dev.bsddev, "translate of %#lx failed\n", - rle->start); + device_printf(pdev->dev.bsddev, "translate of %#jx failed\n", + (uintmax_t)rle->start); return (0); } return (newstart); From owner-svn-src-head@freebsd.org Sun Aug 4 20:00:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9EF78B084C; Sun, 4 Aug 2019 20:00:40 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 461sG03lckz3L8p; Sun, 4 Aug 2019 20:00:40 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 629D587E1; Sun, 4 Aug 2019 20:00:40 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x74K0erG014744; Sun, 4 Aug 2019 20:00:40 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x74K0efw014743; Sun, 4 Aug 2019 20:00:40 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908042000.x74K0efw014743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 4 Aug 2019 20:00:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350573 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 350573 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Aug 2019 20:00:40 -0000 Author: jhibbits Date: Sun Aug 4 20:00:39 2019 New Revision: 350573 URL: https://svnweb.freebsd.org/changeset/base/350573 Log: Fix 32-bit build again, post r350570. Missed this part with my testing as well. Pass the right type to BUS_TRANSLATE_RESOURCE(). Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_pci.c Sun Aug 4 19:55:43 2019 (r350572) +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Sun Aug 4 20:00:39 2019 (r350573) @@ -391,7 +391,7 @@ unsigned long pci_resource_start(struct pci_dev *pdev, int bar) { struct resource_list_entry *rle; - unsigned long newstart; + rman_res_t newstart; device_t dev; if ((rle = linux_pci_get_bar(pdev, bar)) == NULL) From owner-svn-src-head@freebsd.org Sun Aug 4 21:43:35 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB535B3308; Sun, 4 Aug 2019 21:43:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 461vXl4zCsz3RJ3; Sun, 4 Aug 2019 21:43:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C62D9C84; Sun, 4 Aug 2019 21:43:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x74LhZm9080306; Sun, 4 Aug 2019 21:43:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x74LhZvJ080304; Sun, 4 Aug 2019 21:43:35 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908042143.x74LhZvJ080304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 4 Aug 2019 21:43:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350575 - in head/libexec/rtld-elf: amd64 i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/libexec/rtld-elf: amd64 i386 X-SVN-Commit-Revision: 350575 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Aug 2019 21:43:35 -0000 Author: kib Date: Sun Aug 4 21:43:34 2019 New Revision: 350575 URL: https://svnweb.freebsd.org/changeset/base/350575 Log: rtld-elf: Remove x86 elf_rtld.x linker scripts. First, amd64 version of the script cannot work at least due to the wrong architecture specification. Second, kernel can activate shared objects for long time, due to PIE support. It seems the intent was to allow ld-elf.so.1 to be build and used as an executable. Since we have direct exec mode implemented for dso ld-elf.so.1, the non-functional and commented out scripts can be finally removed. Sponsored by: The FreeBSD Foundation MFC after: 1 week Deleted: head/libexec/rtld-elf/amd64/elf_rtld.x head/libexec/rtld-elf/i386/elf_rtld.x Modified: head/libexec/rtld-elf/amd64/Makefile.inc head/libexec/rtld-elf/i386/Makefile.inc Modified: head/libexec/rtld-elf/amd64/Makefile.inc ============================================================================== --- head/libexec/rtld-elf/amd64/Makefile.inc Sun Aug 4 20:40:47 2019 (r350574) +++ head/libexec/rtld-elf/amd64/Makefile.inc Sun Aug 4 21:43:34 2019 (r350575) @@ -1,6 +1,3 @@ # $FreeBSD$ CFLAGS+= ${CFLAGS_NO_SIMD} -msoft-float -# Uncomment this to build the dynamic linker as an executable instead -# of a shared library: -#LDSCRIPT= ${.CURDIR}/${MACHINE_CPUARCH}/elf_rtld.x Modified: head/libexec/rtld-elf/i386/Makefile.inc ============================================================================== --- head/libexec/rtld-elf/i386/Makefile.inc Sun Aug 4 20:40:47 2019 (r350574) +++ head/libexec/rtld-elf/i386/Makefile.inc Sun Aug 4 21:43:34 2019 (r350575) @@ -1,6 +1,3 @@ # $FreeBSD$ CFLAGS+= ${CFLAGS_NO_SIMD} -msoft-float -# Uncomment this to build the dynamic linker as an executable instead -# of a shared library: -#LDSCRIPT= ${.CURDIR}/${MACHINE_CPUARCH}/elf_rtld.x From owner-svn-src-head@freebsd.org Mon Aug 5 00:08:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C8378B584D; Mon, 5 Aug 2019 00:08:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 461ylt4TY2z42TZ; Mon, 5 Aug 2019 00:08:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 772A9B577; Mon, 5 Aug 2019 00:08:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7508Qc3063402; Mon, 5 Aug 2019 00:08:26 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7508Q0M063401; Mon, 5 Aug 2019 00:08:26 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201908050008.x7508Q0M063401@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 5 Aug 2019 00:08:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350576 - head/sbin/ipfw X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sbin/ipfw X-SVN-Commit-Revision: 350576 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 00:08:26 -0000 Author: kevans Date: Mon Aug 5 00:08:25 2019 New Revision: 350576 URL: https://svnweb.freebsd.org/changeset/base/350576 Log: ipfw: fix jail option after r348215 r348215 changed jail_getid(3) to validate passed-in jids as active jails (as the function is documented to return -1 if the jail does not exist). This broke the jail option (in some cases?) as the jail historically hasn't needed to exist at the time of rule parsing; jids will get stored and later applied. Fix this caller to attempt to parse *av as a number first and just use it as-is to match historical behavior. jail_getid(3) must still be used in order for name arguments to work, but it's strictly a fallback in case we weren't given a number. Reported and tested by: Ari Suutari Reviewed by: ae MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D21128 Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Sun Aug 4 21:43:34 2019 (r350575) +++ head/sbin/ipfw/ipfw2.c Mon Aug 5 00:08:25 2019 (r350576) @@ -4674,12 +4674,27 @@ read_options: case TOK_JAIL: NEED1("jail requires argument"); { + char *end; int jid; cmd->opcode = O_JAIL; - jid = jail_getid(*av); - if (jid < 0) - errx(EX_DATAERR, "%s", jail_errmsg); + /* + * If av is a number, then we'll just pass it as-is. If + * it's a name, try to resolve that to a jid. + * + * We save the jail_getid(3) call for a fallback because + * it entails an unconditional trip to the kernel to + * either validate a jid or resolve a name to a jid. + * This specific token doesn't currently require a + * jid to be an active jail, so we save a transition + * by simply using a number that we're given. + */ + jid = strtoul(*av, &end, 10); + if (*end != '\0') { + jid = jail_getid(*av); + if (jid < 0) + errx(EX_DATAERR, "%s", jail_errmsg); + } cmd32->d[0] = (uint32_t)jid; cmd->len |= F_INSN_SIZE(ipfw_insn_u32); av++; From owner-svn-src-head@freebsd.org Mon Aug 5 01:02:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C43B5B69DB for ; Mon, 5 Aug 2019 01:02:37 +0000 (UTC) (envelope-from rex234@pentalogue.nzxc.xyz) Received: from mx.pentalogue.nzxc.xyz (mx.pentalogue.nzxc.xyz [167.99.121.214]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 461zyP0jLwz44f3 for ; Mon, 5 Aug 2019 01:02:36 +0000 (UTC) (envelope-from rex234@pentalogue.nzxc.xyz) Received: from mx.pentalogue.nzxc.xyz (mx.pentalogue.nzxc.xyz [127.0.0.1]) by mx.pentalogue.nzxc.xyz (Postfix) with ESMTP id 461zpp18pfz22V5 for ; Mon, 5 Aug 2019 00:56:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= pentalogue.nzxc.xyz; h=content-transfer-encoding:content-type :content-type:mime-version:message-id:x-mailer:user-agent :reply-to:list-unsubscribe:subject:subject:to:from:from:date :date; s=dkim; t=1564966561; x=1567558562; bh=YG5FhopQymhS5Dgim1 9k6+8LRQske8QKgos2H30TOW4=; b=BoQM3IIK3CHpvi6Hfu4wCmiV1691H3bbsy R17BSu9hqY/OKu3a9F5AH5n6nJpvF6PrzE91OmJ45DW+ZByyCF2n9cR9E2J7gglG q4n9VBs335Yd5yKNeHA7QWn4gaTJPXm8eeWRIe+MW4sgLjp88+1ZCVPiic3GJAiE tp9aI0S3I= X-Virus-Scanned: Debian amavisd-new at mx.pentalogue.nzxc.xyz Received: from mx.pentalogue.nzxc.xyz ([127.0.0.1]) by mx.pentalogue.nzxc.xyz (mx.pentalogue.nzxc.xyz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SyP4YlAyaU6s for ; Mon, 5 Aug 2019 00:56:01 +0000 (UTC) Received: from [127.0.0.1] (mx.pentalogue.nzxc.xyz [127.0.0.1]) by mx.pentalogue.nzxc.xyz (Postfix) with ESMTP id 461zn96YVGz228p for ; Mon, 5 Aug 2019 00:54:37 +0000 (UTC) Date: Mon, 5 Aug 2019 01:54:37 +0100 From: =?UTF-8?Q?Anony=CA=8Dous=20H=C9=91cker?= To: svn-src-head@freebsd.org Subject: =?UTF-8?Q?Th=CE=AFs=20is=20my=20FINAL=20WARNING=20Svn=20Src=20Head!?= Reply-To: User-Agent: CodeIgniter X-Sender: rex234@pentalogue.nzxc.xyz X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: <5d477e4dcb7a7@pentalogue.nzxc.xyz> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 461zyP0jLwz44f3 X-Spamd-Bar: ++++++++++++++ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=pentalogue.nzxc.xyz header.s=dkim header.b=BoQM3IIK; dmarc=none; spf=pass (mx1.freebsd.org: domain of rex234@pentalogue.nzxc.xyz designates 167.99.121.214 as permitted sender) smtp.mailfrom=rex234@pentalogue.nzxc.xyz X-Spamd-Result: default: False [14.96 / 15.00]; HAS_REPLYTO(0.00)[rex234@pentalogue.nzxc.xyz]; XM_UA_NO_VERSION(0.01)[]; R_SPF_ALLOW(0.00)[+mx:c]; MV_CASE(0.50)[]; TO_DN_NONE(0.00)[]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[pentalogue.nzxc.xyz:+]; LEAKED_PASSWORD_SCAM_VALIDATED(0.00)[3G6stTQ8E3pbzZxaBCypjvuKisYmyRprxC]; HAS_X_PRIO_THREE(0.00)[3]; SUBJECT_ENDS_EXCLAIM(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:14061, ipnet:167.99.112.0/20, country:US]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; ABUSE_SURBL(5.50)[nzxc.xyz.multi.surbl.org]; R_DKIM_ALLOW(0.00)[pentalogue.nzxc.xyz:s=dkim]; LEAKED_PASSWORD_SCAM(7.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(0.76)[0.762,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[nzxc.xyz]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; BAD_REP_POLICIES(0.10)[]; NEURAL_SPAM_MEDIUM(1.00)[0.998,0]; IP_SCORE(0.20)[asn: 14061(1.04), country: US(-0.05)]; GREYLIST(0.00)[pass,body] X-Spam: Yes X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 01:02:37 -0000 FINAL WARNING svn-src-head@freebsd.org! You have the final chance to save your social life - I am not kidding!! I give you the last 72 houɼs to make the Ƿayment before I send the vίdeo with your ʍasturbation to all your friends and associates. The last time you visited a erotίc website with young teens, you downloaded and automatically installed the Şpy software that I created. My program has turned on your cɑmera and recorded the act of your ʍasturbation and the vίdeo you were watching while ʍasturbating. My software also downloaded email contact list and a list of your Facebook friends from your device. I have both the - Svn Src Head.mp4 - with your ʍasturbation and a file with all your contacts on my hard drive. You are very Ƿerverted! If you want me to delete both files and keep your secret, you must send me the Bitcoin Ƿayment. I give you last 72 houɼs to transƒer the funds.. If you don't know how to Ƿay with Bitcoin, visit Google and search - how to buy bitcoin. Send 2,000 USD (0.1838962 BTC) to this Bitcoin address immediately: 3G6stTQ8E3pbzZxaBCypjvuKisYmyRprxC (copy and paste) 1 BTC = 10,965 USD right now, so send exactly 0.1838962 BTC to the address above. Do not try to cheat me! As soon as you open this Email I will know you opened it. This Bitcoin address is linked to you only, so I will know if you sent the correct amount. When you Ƿay in full, I will remove both files and deactivate my software. If you don't send the Ƿayment, I will send your ʍasturbation vίdeo to all your friend and associates from your contact list that I downloaded. Here are the Ƿayment details again: Send 0.1838962 BTC to this Bitcoin address: ---------------------------------------- 0.1838962 BTC to 3G6stTQ8E3pbzZxaBCypjvuKisYmyRprxC (copy and paste) ---------------------------------------- You саn visit the polίce but nobody will help you. I know what I am doing. I don't live in your country and I know how to stay anonymous. Don't try to deceive me - I will know immediately - my Şpysoft is recording all the websites you visit and all keys you press. If you do - I will send this ugly recording to everyone you know, including your family! Don't cheat me! Don't forget the shame and if you ignore this message your life will be ruined. I am waiting for your Bitcoin Ƿayment. Anonymous Hɑcker P.S. If you need more time to buy and send BTC, open your notepad and write - 48H++ - and save. This way you can contact me. I will consider giving you another 48 houɼs before I send the vίdeo to your contacts, but only when I see you are really trying to buy bitcoin. ((((((((((((((((((((((((((((((((((((((((((((( We are Anonymous. We are legion. We do not forgive. We do not forget. Expect us. )))))))))))))))))))))))))))))))))))))))))))))) From owner-svn-src-head@freebsd.org Mon Aug 5 01:37:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2313AB6EFB; Mon, 5 Aug 2019 01:37:19 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4620kQ6wzzz45T2; Mon, 5 Aug 2019 01:37:18 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B58B3C6E6; Mon, 5 Aug 2019 01:37:18 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x751bIuH016435; Mon, 5 Aug 2019 01:37:18 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x751bII0016433; Mon, 5 Aug 2019 01:37:18 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908050137.x751bII0016433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Mon, 5 Aug 2019 01:37:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350578 - in head/sys/powerpc: ofw powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys/powerpc: ofw powerpc X-SVN-Commit-Revision: 350578 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 01:37:19 -0000 Author: jhibbits Date: Mon Aug 5 01:37:18 2019 New Revision: 350578 URL: https://svnweb.freebsd.org/changeset/base/350578 Log: powerpc: Get 32-bit AIM building with secure-PLT The last few changes needed before 32-bit AIM builds with secure-PLT with base GCC. Because ofwcall32.S and swtch32.S were branching to the GOT it could not use secure PLT. Modified: head/sys/powerpc/ofw/ofwcall32.S head/sys/powerpc/powerpc/swtch32.S Modified: head/sys/powerpc/ofw/ofwcall32.S ============================================================================== --- head/sys/powerpc/ofw/ofwcall32.S Mon Aug 5 00:32:57 2019 (r350577) +++ head/sys/powerpc/ofw/ofwcall32.S Mon Aug 5 01:37:18 2019 (r350578) @@ -67,8 +67,11 @@ ASENTRY(ofwcall) mfmsr %r6 /* GOT pointer in r7 */ - bl _GLOBAL_OFFSET_TABLE_@local-4 + bl 1f +1: mflr %r7 + addis %r7,%r7,(_GLOBAL_OFFSET_TABLE_-1b)@ha + addi %r7,%r7,(_GLOBAL_OFFSET_TABLE_-1b)@l /* read client interface handler */ lwz %r4,openfirmware_entry@got(%r7) @@ -129,8 +132,11 @@ ASENTRY(rtascall) stw %r0,4(%r1) /* GOT pointer in r7 */ - bl _GLOBAL_OFFSET_TABLE_@local-4 + bl 1f +1: mflr %r7 + addis %r7,%r7,(_GLOBAL_OFFSET_TABLE_-1b)@ha + addi %r7,%r7,(_GLOBAL_OFFSET_TABLE_-1b)@l /* Record the old MSR to real-mode-accessible area */ mfmsr %r0 @@ -152,8 +158,11 @@ ASENTRY(rtascall) bctrl /* GOT pointer in r7 */ - bl _GLOBAL_OFFSET_TABLE_@local-4 + bl 1f +1: mflr %r7 + addis %r7,%r7,(_GLOBAL_OFFSET_TABLE_-1b)@ha + addi %r7,%r7,(_GLOBAL_OFFSET_TABLE_-1b)@l /* Now set the MSR back */ lwz %r6,rtas_regsave@got(%r7) Modified: head/sys/powerpc/powerpc/swtch32.S ============================================================================== --- head/sys/powerpc/powerpc/swtch32.S Mon Aug 5 00:32:57 2019 (r350577) +++ head/sys/powerpc/powerpc/swtch32.S Mon Aug 5 01:37:18 2019 (r350578) @@ -124,8 +124,11 @@ ENTRY(cpu_switch) cpu_switchin: #if defined(SMP) && defined(SCHED_ULE) /* Wait for the new thread to become unblocked */ - bl _GLOBAL_OFFSET_TABLE_@local-4 + bl 1f +1: mflr %r6 + addis %r6,%r6,(_GLOBAL_OFFSET_TABLE_-1b)@ha + addi %r6,%r6,(_GLOBAL_OFFSET_TABLE_-1b)@l lwz %r6,blocked_lock@got(%r6) blocked_loop: lwz %r7,TD_LOCK(%r2) From owner-svn-src-head@freebsd.org Mon Aug 5 02:44:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 68DF3B7F9F; Mon, 5 Aug 2019 02:44:05 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4622CT28Gqz47wJ; Mon, 5 Aug 2019 02:44:05 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B66CD34D; Mon, 5 Aug 2019 02:44:05 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x752i5ak057132; Mon, 5 Aug 2019 02:44:05 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x752i5tG057131; Mon, 5 Aug 2019 02:44:05 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201908050244.x752i5tG057131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Mon, 5 Aug 2019 02:44:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350579 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 350579 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 02:44:05 -0000 Author: alc Date: Mon Aug 5 02:44:04 2019 New Revision: 350579 URL: https://svnweb.freebsd.org/changeset/base/350579 Log: Enable superpage promotion within the kernel pmap. Reviewed by: markj X-MFC after: r350004 Differential Revision: https://reviews.freebsd.org/D21149 Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Mon Aug 5 01:37:18 2019 (r350578) +++ head/sys/arm64/arm64/pmap.c Mon Aug 5 02:44:04 2019 (r350579) @@ -3425,8 +3425,7 @@ validate: } #if VM_NRESERVLEVEL > 0 - if (pmap != pmap_kernel() && - (mpte == NULL || mpte->wire_count == NL3PG) && + if ((mpte == NULL || mpte->wire_count == NL3PG) && pmap_ps_enabled(pmap) && (m->flags & PG_FICTITIOUS) == 0 && vm_reserv_level_iffullpop(m) == 0) { From owner-svn-src-head@freebsd.org Mon Aug 5 06:01:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E7B6BA9B6; Mon, 5 Aug 2019 06:01:30 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4626bG1pQHz4Gb0; Mon, 5 Aug 2019 06:01:30 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20681F76C; Mon, 5 Aug 2019 06:01:30 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7561Upp071944; Mon, 5 Aug 2019 06:01:30 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7561T26071943; Mon, 5 Aug 2019 06:01:29 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908050601.x7561T26071943@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 5 Aug 2019 06:01:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350581 - head X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 350581 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 06:01:30 -0000 Author: delphij Date: Mon Aug 5 06:01:29 2019 New Revision: 350581 URL: https://svnweb.freebsd.org/changeset/base/350581 Log: Remove obsolete header file. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Mon Aug 5 02:52:57 2019 (r350580) +++ head/ObsoleteFiles.inc Mon Aug 5 06:01:29 2019 (r350581) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20190729: gzip'ed a.out support removed +OLD_FILES+=usr/include/sys/inflate.h # 20190722: cap_random(3) removed OLD_FILES+=lib/casper/libcap_random.so.1 OLD_FILES+=usr/include/casper/cap_random.h From owner-svn-src-head@freebsd.org Mon Aug 5 09:49:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95676BF3EB; Mon, 5 Aug 2019 09:49:25 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462CfF3RJtz4Rs8; Mon, 5 Aug 2019 09:49:25 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5789719F0A; Mon, 5 Aug 2019 09:49:25 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x759nPrr008660; Mon, 5 Aug 2019 09:49:25 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x759nP0j008659; Mon, 5 Aug 2019 09:49:25 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201908050949.x759nP0j008659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 5 Aug 2019 09:49:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350584 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 350584 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 09:49:25 -0000 Author: bz Date: Mon Aug 5 09:49:24 2019 New Revision: 350584 URL: https://svnweb.freebsd.org/changeset/base/350584 Log: frag6.c: re-order functions within file Re-order functions within the file in preparation for an upcoming code simplification. No functional changes. MFC after: 3 months Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Mon Aug 5 07:50:25 2019 (r350583) +++ head/sys/netinet6/frag6.c Mon Aug 5 09:49:24 2019 (r350584) @@ -183,46 +183,78 @@ SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGBUCKETSIZE, /* - * Initialise reassembly queue and fragment identifier. + * Remove the IPv6 fragmentation header from the mbuf. */ -static void -frag6_change(void *tag) +int +ip6_deletefraghdr(struct mbuf *m, int offset, int wait) { - VNET_ITERATOR_DECL(vnet_iter); + struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + struct mbuf *t; - ip6_maxfrags = IP6_MAXFRAGS; - VNET_LIST_RLOCK_NOSLEEP(); - VNET_FOREACH(vnet_iter) { - CURVNET_SET(vnet_iter); - V_ip6_maxfragpackets = IP6_MAXFRAGPACKETS; - frag6_set_bucketsize(); - CURVNET_RESTORE(); + /* Delete frag6 header. */ + if (m->m_len >= offset + sizeof(struct ip6_frag)) { + /* This is the only possible case with !PULLDOWN_TEST. */ + bcopy(ip6, (char *)ip6 + sizeof(struct ip6_frag), + offset); + m->m_data += sizeof(struct ip6_frag); + m->m_len -= sizeof(struct ip6_frag); + } else { + /* This comes with no copy if the boundary is on cluster. */ + if ((t = m_split(m, offset, wait)) == NULL) + return (ENOMEM); + m_adj(t, sizeof(struct ip6_frag)); + m_cat(m, t); } - VNET_LIST_RUNLOCK_NOSLEEP(); + + m->m_flags |= M_FRAGMENTED; + return (0); } -void -frag6_init(void) +/* + * Free a fragment reassembly header and all + * associated datagrams. + */ +static void +frag6_freef(struct ip6q *q6, uint32_t bucket) { - struct ip6q *q6; - int i; + struct ip6asfrag *af6, *down6; - V_ip6_maxfragpackets = IP6_MAXFRAGPACKETS; - frag6_set_bucketsize(); - for (i = 0; i < IP6REASS_NHASH; i++) { - q6 = IP6Q_HEAD(i); - q6->ip6q_next = q6->ip6q_prev = q6; - mtx_init(&V_ip6q[i].lock, "ip6qlock", NULL, MTX_DEF); - V_ip6q[i].count = 0; - } - V_ip6q_hashseed = arc4random(); - V_ip6_maxfragsperpacket = 64; - if (!IS_DEFAULT_VNET(curvnet)) - return; + IP6Q_LOCK_ASSERT(bucket); - ip6_maxfrags = IP6_MAXFRAGS; - EVENTHANDLER_REGISTER(nmbclusters_change, - frag6_change, NULL, EVENTHANDLER_PRI_ANY); + for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; + af6 = down6) { + struct mbuf *m = IP6_REASS_MBUF(af6); + + down6 = af6->ip6af_down; + frag6_deq(af6, bucket); + + /* + * Return ICMP time exceeded error for the 1st fragment. + * Just free other fragments. + */ + if (af6->ip6af_off == 0) { + struct ip6_hdr *ip6; + + /* adjust pointer */ + ip6 = mtod(m, struct ip6_hdr *); + + /* restore source and destination addresses */ + ip6->ip6_src = q6->ip6q_src; + ip6->ip6_dst = q6->ip6q_dst; + + icmp6_error(m, ICMP6_TIME_EXCEEDED, + ICMP6_TIME_EXCEED_REASSEMBLY, 0); + } else + m_freem(m); + free(af6, M_FRAG6); + } + frag6_remque(q6, bucket); + atomic_subtract_int(&frag6_nfrags, q6->ip6q_nfrag); +#ifdef MAC + mac_ip6q_destroy(q6); +#endif + free(q6, M_FRAG6); + atomic_subtract_int(&V_frag6_nfragpackets, 1); } /* @@ -716,110 +748,6 @@ insert: } /* - * Free a fragment reassembly header and all - * associated datagrams. - */ -static void -frag6_freef(struct ip6q *q6, uint32_t bucket) -{ - struct ip6asfrag *af6, *down6; - - IP6Q_LOCK_ASSERT(bucket); - - for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; - af6 = down6) { - struct mbuf *m = IP6_REASS_MBUF(af6); - - down6 = af6->ip6af_down; - frag6_deq(af6, bucket); - - /* - * Return ICMP time exceeded error for the 1st fragment. - * Just free other fragments. - */ - if (af6->ip6af_off == 0) { - struct ip6_hdr *ip6; - - /* adjust pointer */ - ip6 = mtod(m, struct ip6_hdr *); - - /* restore source and destination addresses */ - ip6->ip6_src = q6->ip6q_src; - ip6->ip6_dst = q6->ip6q_dst; - - icmp6_error(m, ICMP6_TIME_EXCEEDED, - ICMP6_TIME_EXCEED_REASSEMBLY, 0); - } else - m_freem(m); - free(af6, M_FRAG6); - } - frag6_remque(q6, bucket); - atomic_subtract_int(&frag6_nfrags, q6->ip6q_nfrag); -#ifdef MAC - mac_ip6q_destroy(q6); -#endif - free(q6, M_FRAG6); - atomic_subtract_int(&V_frag6_nfragpackets, 1); -} - -/* - * Put an ip fragment on a reassembly chain. - * Like insque, but pointers in middle of structure. - */ -static void -frag6_enq(struct ip6asfrag *af6, struct ip6asfrag *up6, - uint32_t bucket __unused) -{ - - IP6Q_LOCK_ASSERT(bucket); - - af6->ip6af_up = up6; - af6->ip6af_down = up6->ip6af_down; - up6->ip6af_down->ip6af_up = af6; - up6->ip6af_down = af6; -} - -/* - * To frag6_enq as remque is to insque. - */ -static void -frag6_deq(struct ip6asfrag *af6, uint32_t bucket __unused) -{ - - IP6Q_LOCK_ASSERT(bucket); - - af6->ip6af_up->ip6af_down = af6->ip6af_down; - af6->ip6af_down->ip6af_up = af6->ip6af_up; -} - -static void -frag6_insque_head(struct ip6q *new, struct ip6q *old, uint32_t bucket) -{ - - IP6Q_LOCK_ASSERT(bucket); - KASSERT(IP6Q_HEAD(bucket) == old, - ("%s: attempt to insert at head of wrong bucket" - " (bucket=%u, old=%p)", __func__, bucket, old)); - - new->ip6q_prev = old; - new->ip6q_next = old->ip6q_next; - old->ip6q_next->ip6q_prev= new; - old->ip6q_next = new; - V_ip6q[bucket].count++; -} - -static void -frag6_remque(struct ip6q *p6, uint32_t bucket) -{ - - IP6Q_LOCK_ASSERT(bucket); - - p6->ip6q_prev->ip6q_next = p6->ip6q_next; - p6->ip6q_next->ip6q_prev = p6->ip6q_prev; - V_ip6q[bucket].count--; -} - -/* * IPv6 reassembling timer processing; * if a timer expires on a reassembly * queue, discard it. @@ -900,7 +828,50 @@ frag6_slowtimo(void) VNET_LIST_RUNLOCK_NOSLEEP(); } +static void +frag6_change(void *tag) +{ + VNET_ITERATOR_DECL(vnet_iter); + + ip6_maxfrags = IP6_MAXFRAGS; + VNET_LIST_RLOCK_NOSLEEP(); + VNET_FOREACH(vnet_iter) { + CURVNET_SET(vnet_iter); + V_ip6_maxfragpackets = IP6_MAXFRAGPACKETS; + frag6_set_bucketsize(); + CURVNET_RESTORE(); + } + VNET_LIST_RUNLOCK_NOSLEEP(); +} + /* + * Initialise reassembly queue and fragment identifier. + */ +void +frag6_init(void) +{ + struct ip6q *q6; + int i; + + V_ip6_maxfragpackets = IP6_MAXFRAGPACKETS; + frag6_set_bucketsize(); + for (i = 0; i < IP6REASS_NHASH; i++) { + q6 = IP6Q_HEAD(i); + q6->ip6q_next = q6->ip6q_prev = q6; + mtx_init(&V_ip6q[i].lock, "ip6qlock", NULL, MTX_DEF); + V_ip6q[i].count = 0; + } + V_ip6q_hashseed = arc4random(); + V_ip6_maxfragsperpacket = 64; + if (!IS_DEFAULT_VNET(curvnet)) + return; + + ip6_maxfrags = IP6_MAXFRAGS; + EVENTHANDLER_REGISTER(nmbclusters_change, + frag6_change, NULL, EVENTHANDLER_PRI_ANY); +} + +/* * Drain off all datagram fragments. */ void @@ -929,27 +900,59 @@ frag6_drain(void) VNET_LIST_RUNLOCK_NOSLEEP(); } -int -ip6_deletefraghdr(struct mbuf *m, int offset, int wait) +/* + * Put an ip fragment on a reassembly chain. + * Like insque, but pointers in middle of structure. + */ +static void +frag6_enq(struct ip6asfrag *af6, struct ip6asfrag *up6, + uint32_t bucket __unused) { - struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); - struct mbuf *t; - /* Delete frag6 header. */ - if (m->m_len >= offset + sizeof(struct ip6_frag)) { - /* This is the only possible case with !PULLDOWN_TEST. */ - bcopy(ip6, (char *)ip6 + sizeof(struct ip6_frag), - offset); - m->m_data += sizeof(struct ip6_frag); - m->m_len -= sizeof(struct ip6_frag); - } else { - /* This comes with no copy if the boundary is on cluster. */ - if ((t = m_split(m, offset, wait)) == NULL) - return (ENOMEM); - m_adj(t, sizeof(struct ip6_frag)); - m_cat(m, t); - } + IP6Q_LOCK_ASSERT(bucket); - m->m_flags |= M_FRAGMENTED; - return (0); + af6->ip6af_up = up6; + af6->ip6af_down = up6->ip6af_down; + up6->ip6af_down->ip6af_up = af6; + up6->ip6af_down = af6; +} + +/* + * To frag6_enq as remque is to insque. + */ +static void +frag6_deq(struct ip6asfrag *af6, uint32_t bucket __unused) +{ + + IP6Q_LOCK_ASSERT(bucket); + + af6->ip6af_up->ip6af_down = af6->ip6af_down; + af6->ip6af_down->ip6af_up = af6->ip6af_up; +} + +static void +frag6_insque_head(struct ip6q *new, struct ip6q *old, uint32_t bucket) +{ + + IP6Q_LOCK_ASSERT(bucket); + KASSERT(IP6Q_HEAD(bucket) == old, + ("%s: attempt to insert at head of wrong bucket" + " (bucket=%u, old=%p)", __func__, bucket, old)); + + new->ip6q_prev = old; + new->ip6q_next = old->ip6q_next; + old->ip6q_next->ip6q_prev= new; + old->ip6q_next = new; + V_ip6q[bucket].count++; +} + +static void +frag6_remque(struct ip6q *p6, uint32_t bucket) +{ + + IP6Q_LOCK_ASSERT(bucket); + + p6->ip6q_prev->ip6q_next = p6->ip6q_next; + p6->ip6q_next->ip6q_prev = p6->ip6q_prev; + V_ip6q[bucket].count--; } From owner-svn-src-head@freebsd.org Mon Aug 5 11:01:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EF940C07A0; Mon, 5 Aug 2019 11:01:12 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462FF466jHz4W7g; Mon, 5 Aug 2019 11:01:12 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B40C31ACC5; Mon, 5 Aug 2019 11:01:12 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x75B1CkN053955; Mon, 5 Aug 2019 11:01:12 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x75B1CUL053954; Mon, 5 Aug 2019 11:01:12 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201908051101.x75B1CUL053954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 5 Aug 2019 11:01:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350585 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 350585 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 11:01:13 -0000 Author: bz Date: Mon Aug 5 11:01:12 2019 New Revision: 350585 URL: https://svnweb.freebsd.org/changeset/base/350585 Log: frag6.c: rename ip6q[] to ipq6b[] and consistently use "bucket" The hash buckets array is called ip6q. The data structure ip6q is a description of different object, the one the array holds these days (since r337776). To clear some of this confusion, rename the array to ip6qb. When iterating over all buckets or addressing them directly, we use at least the variables i, hash, and bucket. To keep the terminology consistent use the variable name "bucket" and always make it an uint32_t and not sometimes an int. No functional behaviour changes intended. MFC after: 3 months Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Mon Aug 5 09:49:24 2019 (r350584) +++ head/sys/netinet6/frag6.c Mon Aug 5 11:01:12 2019 (r350585) @@ -107,16 +107,16 @@ VNET_DEFINE_STATIC(int, ip6_maxfragsperpacket); #define V_ip6_maxfragsperpacket VNET(ip6_maxfragsperpacket) /* Per-VNET reassembly queue buckets. */ -VNET_DEFINE_STATIC(struct ip6qbucket, ip6q[IP6REASS_NHASH]); -VNET_DEFINE_STATIC(uint32_t, ip6q_hashseed); -#define V_ip6q VNET(ip6q) -#define V_ip6q_hashseed VNET(ip6q_hashseed) +VNET_DEFINE_STATIC(struct ip6qbucket, ip6qb[IP6REASS_NHASH]); +VNET_DEFINE_STATIC(uint32_t, ip6qb_hashseed); +#define V_ip6qb VNET(ip6qb) +#define V_ip6qb_hashseed VNET(ip6qb_hashseed) -#define IP6Q_LOCK(i) mtx_lock(&V_ip6q[(i)].lock) -#define IP6Q_TRYLOCK(i) mtx_trylock(&V_ip6q[(i)].lock) -#define IP6Q_LOCK_ASSERT(i) mtx_assert(&V_ip6q[(i)].lock, MA_OWNED) -#define IP6Q_UNLOCK(i) mtx_unlock(&V_ip6q[(i)].lock) -#define IP6Q_HEAD(i) (&V_ip6q[(i)].ip6q) +#define IP6QB_LOCK(_b) mtx_lock(&V_ip6qb[(_b)].lock) +#define IP6QB_TRYLOCK(_b) mtx_trylock(&V_ip6qb[(_b)].lock) +#define IP6QB_LOCK_ASSERT(_b) mtx_assert(&V_ip6qb[(_b)].lock, MA_OWNED) +#define IP6QB_UNLOCK(_b) mtx_unlock(&V_ip6qb[(_b)].lock) +#define IP6QB_HEAD(_b) (&V_ip6qb[(_b)].ip6q) /* * By default, limit the number of IP6 fragments across all reassembly @@ -219,7 +219,7 @@ frag6_freef(struct ip6q *q6, uint32_t bucket) { struct ip6asfrag *af6, *down6; - IP6Q_LOCK_ASSERT(bucket); + IP6QB_LOCK_ASSERT(bucket); for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; af6 = down6) { @@ -303,7 +303,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) int fragoff, frgpartlen; /* must be larger than u_int16_t */ uint32_t hashkey[(sizeof(struct in6_addr) * 2 + sizeof(ip6f->ip6f_ident)) / sizeof(uint32_t)]; - uint32_t hash, *hashkeyp; + uint32_t bucket, *hashkeyp; struct ifnet *dstifp; u_int8_t ecn, ecn0; #ifdef RSS @@ -384,10 +384,10 @@ frag6_input(struct mbuf **mp, int *offp, int proto) memcpy(hashkeyp, &ip6->ip6_dst, sizeof(struct in6_addr)); hashkeyp += sizeof(struct in6_addr) / sizeof(*hashkeyp); *hashkeyp = ip6f->ip6f_ident; - hash = jenkins_hash32(hashkey, nitems(hashkey), V_ip6q_hashseed); - hash &= IP6REASS_HMASK; - head = IP6Q_HEAD(hash); - IP6Q_LOCK(hash); + bucket = jenkins_hash32(hashkey, nitems(hashkey), V_ip6qb_hashseed); + bucket &= IP6REASS_HMASK; + head = IP6QB_HEAD(bucket); + IP6QB_LOCK(bucket); /* * Enforce upper bound on number of fragments. @@ -424,7 +424,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) */ if (V_ip6_maxfragpackets < 0) ; - else if (V_ip6q[hash].count >= V_ip6_maxfragbucketsize || + else if (V_ip6qb[bucket].count >= V_ip6_maxfragbucketsize || atomic_load_int(&V_frag6_nfragpackets) >= (u_int)V_ip6_maxfragpackets) goto dropfrag; @@ -440,7 +440,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) } mac_ip6q_create(m, q6); #endif - frag6_insque_head(q6, head, hash); + frag6_insque_head(q6, head, bucket); /* ip6q_nxt will be filled afterwards, from 1st fragment */ q6->ip6q_down = q6->ip6q_up = (struct ip6asfrag *)q6; @@ -480,14 +480,14 @@ frag6_input(struct mbuf **mp, int *offp, int proto) icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, offset - sizeof(struct ip6_frag) + offsetof(struct ip6_frag, ip6f_offlg)); - IP6Q_UNLOCK(hash); + IP6QB_UNLOCK(bucket); return (IPPROTO_DONE); } } else if (fragoff + frgpartlen > IPV6_MAXPACKET) { icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, offset - sizeof(struct ip6_frag) + offsetof(struct ip6_frag, ip6f_offlg)); - IP6Q_UNLOCK(hash); + IP6QB_UNLOCK(bucket); return (IPPROTO_DONE); } /* @@ -506,7 +506,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) int erroff = af6->ip6af_offset; /* dequeue the fragment. */ - frag6_deq(af6, hash); + frag6_deq(af6, bucket); free(af6, M_FRAG6); /* adjust pointer. */ @@ -609,7 +609,7 @@ insert: * Move to front of packet queue, as we are * the most recently active fragmented packet. */ - frag6_enq(ip6af, af6->ip6af_up, hash); + frag6_enq(ip6af, af6->ip6af_up, bucket); atomic_add_int(&frag6_nfrags, 1); q6->ip6q_nfrag++; next = 0; @@ -618,9 +618,9 @@ insert: if (af6->ip6af_off != next) { if (q6->ip6q_nfrag > V_ip6_maxfragsperpacket) { IP6STAT_ADD(ip6s_fragdropped, q6->ip6q_nfrag); - frag6_freef(q6, hash); + frag6_freef(q6, bucket); } - IP6Q_UNLOCK(hash); + IP6QB_UNLOCK(bucket); return IPPROTO_DONE; } next += af6->ip6af_frglen; @@ -628,9 +628,9 @@ insert: if (af6->ip6af_up->ip6af_mff) { if (q6->ip6q_nfrag > V_ip6_maxfragsperpacket) { IP6STAT_ADD(ip6s_fragdropped, q6->ip6q_nfrag); - frag6_freef(q6, hash); + frag6_freef(q6, bucket); } - IP6Q_UNLOCK(hash); + IP6QB_UNLOCK(bucket); return IPPROTO_DONE; } @@ -640,7 +640,7 @@ insert: ip6af = q6->ip6q_down; t = m = IP6_REASS_MBUF(ip6af); af6 = ip6af->ip6af_down; - frag6_deq(ip6af, hash); + frag6_deq(ip6af, bucket); while (af6 != (struct ip6asfrag *)q6) { m->m_pkthdr.csum_flags &= IP6_REASS_MBUF(af6)->m_pkthdr.csum_flags; @@ -648,7 +648,7 @@ insert: IP6_REASS_MBUF(af6)->m_pkthdr.csum_data; af6dwn = af6->ip6af_down; - frag6_deq(af6, hash); + frag6_deq(af6, bucket); while (t->m_next) t = t->m_next; m_adj(IP6_REASS_MBUF(af6), af6->ip6af_offset); @@ -672,7 +672,7 @@ insert: nxt = q6->ip6q_nxt; if (ip6_deletefraghdr(m, offset, M_NOWAIT) != 0) { - frag6_remque(q6, hash); + frag6_remque(q6, bucket); atomic_subtract_int(&frag6_nfrags, q6->ip6q_nfrag); #ifdef MAC mac_ip6q_destroy(q6); @@ -689,7 +689,7 @@ insert: m_copyback(m, ip6_get_prevhdr(m, offset), sizeof(uint8_t), (caddr_t)&nxt); - frag6_remque(q6, hash); + frag6_remque(q6, bucket); atomic_subtract_int(&frag6_nfrags, q6->ip6q_nfrag); #ifdef MAC mac_ip6q_reassemble(q6, m); @@ -718,7 +718,7 @@ insert: m_tag_prepend(m, mtag); #endif - IP6Q_UNLOCK(hash); + IP6QB_UNLOCK(bucket); IP6STAT_INC(ip6s_reassembled); in6_ifstat_inc(dstifp, ifs6_reass_ok); @@ -740,7 +740,7 @@ insert: return nxt; dropfrag: - IP6Q_UNLOCK(hash); + IP6QB_UNLOCK(bucket); in6_ifstat_inc(dstifp, ifs6_reass_fail); IP6STAT_INC(ip6s_fragdropped); m_freem(m); @@ -757,21 +757,21 @@ frag6_slowtimo(void) { VNET_ITERATOR_DECL(vnet_iter); struct ip6q *head, *q6; - int i; + uint32_t bucket; VNET_LIST_RLOCK_NOSLEEP(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); - for (i = 0; i < IP6REASS_NHASH; i++) { - IP6Q_LOCK(i); - head = IP6Q_HEAD(i); + for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { + IP6QB_LOCK(bucket); + head = IP6QB_HEAD(bucket); q6 = head->ip6q_next; if (q6 == NULL) { /* * XXXJTL: This should never happen. This * should turn into an assertion. */ - IP6Q_UNLOCK(i); + IP6QB_UNLOCK(bucket); continue; } while (q6 != head) { @@ -781,7 +781,7 @@ frag6_slowtimo(void) IP6STAT_ADD(ip6s_fragtimeout, q6->ip6q_prev->ip6q_nfrag); /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ - frag6_freef(q6->ip6q_prev, i); + frag6_freef(q6->ip6q_prev, bucket); } } /* @@ -795,33 +795,33 @@ frag6_slowtimo(void) */ while ((V_ip6_maxfragpackets == 0 || (V_ip6_maxfragpackets > 0 && - V_ip6q[i].count > V_ip6_maxfragbucketsize)) && + V_ip6qb[bucket].count > V_ip6_maxfragbucketsize)) && head->ip6q_prev != head) { IP6STAT_ADD(ip6s_fragoverflow, q6->ip6q_prev->ip6q_nfrag); /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ - frag6_freef(head->ip6q_prev, i); + frag6_freef(head->ip6q_prev, bucket); } - IP6Q_UNLOCK(i); + IP6QB_UNLOCK(bucket); } /* * If we are still over the maximum number of fragmented * packets, drain off enough to get down to the new limit. */ - i = 0; + bucket = 0; while (V_ip6_maxfragpackets >= 0 && atomic_load_int(&V_frag6_nfragpackets) > (u_int)V_ip6_maxfragpackets) { - IP6Q_LOCK(i); - head = IP6Q_HEAD(i); + IP6QB_LOCK(bucket); + head = IP6QB_HEAD(bucket); if (head->ip6q_prev != head) { IP6STAT_ADD(ip6s_fragoverflow, q6->ip6q_prev->ip6q_nfrag); /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ - frag6_freef(head->ip6q_prev, i); + frag6_freef(head->ip6q_prev, bucket); } - IP6Q_UNLOCK(i); - i = (i + 1) % IP6REASS_NHASH; + IP6QB_UNLOCK(bucket); + bucket = (bucket + 1) % IP6REASS_NHASH; } CURVNET_RESTORE(); } @@ -851,17 +851,17 @@ void frag6_init(void) { struct ip6q *q6; - int i; + uint32_t bucket; V_ip6_maxfragpackets = IP6_MAXFRAGPACKETS; frag6_set_bucketsize(); - for (i = 0; i < IP6REASS_NHASH; i++) { - q6 = IP6Q_HEAD(i); + for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { + q6 = IP6QB_HEAD(bucket); q6->ip6q_next = q6->ip6q_prev = q6; - mtx_init(&V_ip6q[i].lock, "ip6qlock", NULL, MTX_DEF); - V_ip6q[i].count = 0; + mtx_init(&V_ip6qb[bucket].lock, "ip6qlock", NULL, MTX_DEF); + V_ip6qb[bucket].count = 0; } - V_ip6q_hashseed = arc4random(); + V_ip6qb_hashseed = arc4random(); V_ip6_maxfragsperpacket = 64; if (!IS_DEFAULT_VNET(curvnet)) return; @@ -879,21 +879,21 @@ frag6_drain(void) { VNET_ITERATOR_DECL(vnet_iter); struct ip6q *head; - int i; + uint32_t bucket; VNET_LIST_RLOCK_NOSLEEP(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); - for (i = 0; i < IP6REASS_NHASH; i++) { - if (IP6Q_TRYLOCK(i) == 0) + for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { + if (IP6QB_TRYLOCK(bucket) == 0) continue; - head = IP6Q_HEAD(i); + head = IP6QB_HEAD(bucket); while (head->ip6q_next != head) { IP6STAT_INC(ip6s_fragdropped); /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ - frag6_freef(head->ip6q_next, i); + frag6_freef(head->ip6q_next, bucket); } - IP6Q_UNLOCK(i); + IP6QB_UNLOCK(bucket); } CURVNET_RESTORE(); } @@ -909,7 +909,7 @@ frag6_enq(struct ip6asfrag *af6, struct ip6asfrag *up6 uint32_t bucket __unused) { - IP6Q_LOCK_ASSERT(bucket); + IP6QB_LOCK_ASSERT(bucket); af6->ip6af_up = up6; af6->ip6af_down = up6->ip6af_down; @@ -924,7 +924,7 @@ static void frag6_deq(struct ip6asfrag *af6, uint32_t bucket __unused) { - IP6Q_LOCK_ASSERT(bucket); + IP6QB_LOCK_ASSERT(bucket); af6->ip6af_up->ip6af_down = af6->ip6af_down; af6->ip6af_down->ip6af_up = af6->ip6af_up; @@ -934,8 +934,8 @@ static void frag6_insque_head(struct ip6q *new, struct ip6q *old, uint32_t bucket) { - IP6Q_LOCK_ASSERT(bucket); - KASSERT(IP6Q_HEAD(bucket) == old, + IP6QB_LOCK_ASSERT(bucket); + KASSERT(IP6QB_HEAD(bucket) == old, ("%s: attempt to insert at head of wrong bucket" " (bucket=%u, old=%p)", __func__, bucket, old)); @@ -943,16 +943,16 @@ frag6_insque_head(struct ip6q *new, struct ip6q *old, new->ip6q_next = old->ip6q_next; old->ip6q_next->ip6q_prev= new; old->ip6q_next = new; - V_ip6q[bucket].count++; + V_ip6qb[bucket].count++; } static void frag6_remque(struct ip6q *p6, uint32_t bucket) { - IP6Q_LOCK_ASSERT(bucket); + IP6QB_LOCK_ASSERT(bucket); p6->ip6q_prev->ip6q_next = p6->ip6q_next; p6->ip6q_next->ip6q_prev = p6->ip6q_prev; - V_ip6q[bucket].count--; + V_ip6qb[bucket].count--; } From owner-svn-src-head@freebsd.org Mon Aug 5 11:47:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27737C133D; Mon, 5 Aug 2019 11:47:36 +0000 (UTC) (envelope-from thj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462GGc0GYsz4YD3; Mon, 5 Aug 2019 11:47:36 +0000 (UTC) (envelope-from thj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E07C01B48C; Mon, 5 Aug 2019 11:47:35 +0000 (UTC) (envelope-from thj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x75BlZGa080876; Mon, 5 Aug 2019 11:47:35 GMT (envelope-from thj@FreeBSD.org) Received: (from thj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x75BlY1U080870; Mon, 5 Aug 2019 11:47:34 GMT (envelope-from thj@FreeBSD.org) Message-Id: <201908051147.x75BlY1U080870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: thj set sender to thj@FreeBSD.org using -f From: Tom Jones Date: Mon, 5 Aug 2019 11:47:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350586 - in head: etc/mtree tests/sys/netpfil tests/sys/netpfil/common X-SVN-Group: head X-SVN-Commit-Author: thj X-SVN-Commit-Paths: in head: etc/mtree tests/sys/netpfil tests/sys/netpfil/common X-SVN-Commit-Revision: 350586 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 11:47:36 -0000 Author: thj Date: Mon Aug 5 11:47:34 2019 New Revision: 350586 URL: https://svnweb.freebsd.org/changeset/base/350586 Log: Add common firewall test suite Add a common test suite for the firewalls included in the base system. The test suite allows common test infrastructure to test pf, ipfw and ipf firewalls from test files containing the setup for all three firewalls. Add the pass block test for pf, ipfw and ipf. The pass block test checks the allow/deny functionality of the firewalls tested. Submitted by: Ahsan Barkati Sponsored by: Google, Inc. (GSoC 2019) Reviewed by: kp Approved by: bz (co-mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D21065 Added: head/tests/sys/netpfil/common/ head/tests/sys/netpfil/common/Makefile (contents, props changed) head/tests/sys/netpfil/common/pass_block.sh (contents, props changed) head/tests/sys/netpfil/common/runner.subr (contents, props changed) head/tests/sys/netpfil/common/utils.subr (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/tests/sys/netpfil/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Mon Aug 5 11:01:12 2019 (r350585) +++ head/etc/mtree/BSD.tests.dist Mon Aug 5 11:47:34 2019 (r350586) @@ -793,6 +793,8 @@ netmap .. netpfil + common + .. pf ioctl .. Modified: head/tests/sys/netpfil/Makefile ============================================================================== --- head/tests/sys/netpfil/Makefile Mon Aug 5 11:01:12 2019 (r350585) +++ head/tests/sys/netpfil/Makefile Mon Aug 5 11:47:34 2019 (r350586) @@ -5,7 +5,8 @@ TESTSDIR= ${TESTSBASE}/sys/netpfil .if ${MK_PF} != "no" -TESTS_SUBDIRS+= pf +TESTS_SUBDIRS+= pf \ + common .endif .include Added: head/tests/sys/netpfil/common/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netpfil/common/Makefile Mon Aug 5 11:47:34 2019 (r350586) @@ -0,0 +1,13 @@ +# $FreeBSD$ + +PACKAGE= tests + +TESTSDIR= ${TESTSBASE}/sys/netpfil/common + + +ATF_TESTS_SH+= pass_block \ + +${PACKAGE}FILES+= utils.subr \ + runner.subr + +.include Added: head/tests/sys/netpfil/common/pass_block.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netpfil/common/pass_block.sh Mon Aug 5 11:47:34 2019 (r350586) @@ -0,0 +1,129 @@ +#- +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2019 Ahsan Barkati +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +. $(atf_get_srcdir)/utils.subr +. $(atf_get_srcdir)/runner.subr + +v4_head() +{ + atf_set require.user root +} + +v4_body() +{ + firewall=$1 + firewall_init $firewall + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.1/24 up + vnet_mkjail iron ${epair}b + jexec iron ifconfig ${epair}b 192.0.2.2/24 up + + # Block All + firewall_config "iron" ${firewall} \ + "pf" \ + "block in" \ + "ipfw" \ + "ipfw -q add 100 deny all from any to any" \ + "ipf" \ + "block in all" + + atf_check -s exit:2 -o ignore ping -c 1 -t 1 192.0.2.2 + + # Pass All + firewall_config "iron" ${firewall} \ + "pf" \ + "pass in" \ + "ipfw" \ + "ipfw -q add 100 allow all from any to any" \ + "ipf" \ + "pass in all" + + atf_check -s exit:0 -o ignore ping -c 1 -t 1 192.0.2.2 +} + +v4_cleanup() +{ + firewall=$1 + firewall_cleanup $firewall +} + +v6_head() +{ + atf_set require.user root +} + +v6_body() +{ + firewall=$1 + firewall_init $firewall + + epair=$(vnet_mkepair) + ifconfig ${epair}a inet6 fd7a:803f:cc4b::1/64 up no_dad + + vnet_mkjail iron ${epair}b + jexec iron ifconfig ${epair}b inet6 fd7a:803f:cc4b::2/64 up no_dad + + # Block All + firewall_config "iron" ${firewall} \ + "pf" \ + "block in" \ + "ipfw" \ + "ipfw -q add 100 deny all from any to any" \ + "ipf" \ + "block in all" + + atf_check -s exit:2 -o ignore ping6 -c 1 -x 1 fd7a:803f:cc4b::2 + + # Pass All + firewall_config "iron" ${firewall} \ + "pf" \ + "pass in" \ + "ipfw" \ + "ipfw -q add 100 allow all from any to any" \ + "ipf" \ + "pass in all" + + atf_check -s exit:0 -o ignore ping6 -c 1 -x 1 fd7a:803f:cc4b::2 +} + +v6_cleanup() +{ + firewall=$1 + firewall_cleanup $firewall +} + +setup_tests "v4" \ + "pf" \ + "ipfw" \ + "ipf" \ + "v6" \ + "pf" \ + "ipfw" \ + "ipf" \ No newline at end of file Added: head/tests/sys/netpfil/common/runner.subr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netpfil/common/runner.subr Mon Aug 5 11:47:34 2019 (r350586) @@ -0,0 +1,67 @@ +#- +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2019 Ahsan Barkati +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +. $(atf_get_srcdir)/utils.subr + +setup_tests() +{ + tests="" + while [ $# -gt 0 ]; do + if [ $(is_firewall $1) -eq 1 ]; then + fw=$1 + shift + if [ -z "${testcase}" ]; then + echo "no testcase passed to setup_test" + return + fi + atf_test_case "${fw}_${testcase}" "cleanup" + eval "${fw}_${testcase}_head(){ ${testcase}_head; }" + eval "${fw}_${testcase}_body(){ ${testcase}_body $fw; }" + eval "${fw}_${testcase}_cleanup(){ ${testcase}_cleanup $fw; }" + tests="$tests ${fw}_${testcase}" + else + testcase=$1 + shift + fi + done + init_testcases "$tests" +} + + +init_testcases() +{ + args="$@" + atf_init_test_cases() + { + for testcase in $args; + do + atf_add_test_case "$testcase" + done + } +} \ No newline at end of file Added: head/tests/sys/netpfil/common/utils.subr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netpfil/common/utils.subr Mon Aug 5 11:47:34 2019 (r350586) @@ -0,0 +1,113 @@ +#- +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2019 Ahsan Barkati +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +. $(atf_get_srcdir)/../../common/vnet.subr + +firewall_config() +{ + jname=$1 + shift + fw=$1 + shift + + while [ $# -gt 0 ]; do + if [ $(is_firewall $fw) -eq 1 ]; then + current_fw="$1" + shift + filename=${current_fw}.rule + cwd=$(pwd) + if [ -f ${current_fw}.rule ]; then + rm ${current_fw}.rule + fi + fi + rule=$1 + echo $rule >> $filename + shift + done + + if [ ${fw} == "ipfw" ]; then + jexec ${jname} ipfw -q -f flush + jexec ${jname} /bin/sh $cwd/ipfw.rule + elif [ ${fw} == "pf" ]; then + jexec ${jname} pfctl -e + jexec ${jname} pfctl -F all + jexec ${jname} pfctl -f $cwd/pf.rule + elif [ ${fw} == "ipf" ]; then + jexec ${jname} ipf -E + jexec ${jname} ipf -Fa -f $cwd/ipf.rule + elif [ ${fw} == "ipfnat" ]; then + jexec ${jname} service ipfilter start + jexec ${jname} ipnat -CF -f $cwd/ipfnat.rule + else + atf_fail "$fw is not a valid firewall to configure" + fi +} + +firewall_cleanup() +{ + firewall=$1 + echo "Cleaning $firewall" + vnet_cleanup +} + +firewall_init() +{ + firewall=$1 + vnet_init + + if [ ${firewall} == "ipfw" ]; then + if ! kldstat -q -m ipfw; then + atf_skip "This test requires ipfw" + fi + elif [ ${firewall} == "pf" ]; then + if [ ! -c /dev/pf ]; then + atf_skip "This test requires pf" + fi + elif [ ${firewall} == "ipf" ]; then + if ! kldstat -q -m ipfilter; then + atf_skip "This test requires ipf" + fi + elif [ ${firewall} == "ipfnat" ]; then + if ! kldstat -q -m ipfw_nat; then + atf_skip "This test requires ipfw_nat" + fi + else + atf_fail "$fw is not a valid firewall to initialize" + fi + +} + +is_firewall() +{ + if [ "$1" = "pf" -o "$1" = "ipfw" -o "$1" = "ipf" -o "$1" = "ipfnat" ]; then + echo 1 + else + echo 0 + fi +} \ No newline at end of file From owner-svn-src-head@freebsd.org Mon Aug 5 13:22:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 585F5C3806; Mon, 5 Aug 2019 13:22:03 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462JMb1l2Lz4f2V; Mon, 5 Aug 2019 13:22:03 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D78C1C607; Mon, 5 Aug 2019 13:22:03 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x75DM2Aw035636; Mon, 5 Aug 2019 13:22:02 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x75DM2Ua035635; Mon, 5 Aug 2019 13:22:02 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201908051322.x75DM2Ua035635@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Mon, 5 Aug 2019 13:22:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350587 - head/libexec/rtld-elf/powerpc64 X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/libexec/rtld-elf/powerpc64 X-SVN-Commit-Revision: 350587 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 13:22:03 -0000 Author: luporl Date: Mon Aug 5 13:22:02 2019 New Revision: 350587 URL: https://svnweb.freebsd.org/changeset/base/350587 Log: [PPC64] Fix rtld direct exec mode Instead of restoring the saved values of argc, argv and envp, these must be loaded from the stack that _rtld() modifies. This fixes rtld direct exec mode. E.g.: /libexec/ld-elf.so.1 /bin/ls Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D21131 Modified: head/libexec/rtld-elf/powerpc64/rtld_start.S Modified: head/libexec/rtld-elf/powerpc64/rtld_start.S ============================================================================== --- head/libexec/rtld-elf/powerpc64/rtld_start.S Mon Aug 5 11:47:34 2019 (r350586) +++ head/libexec/rtld-elf/powerpc64/rtld_start.S Mon Aug 5 13:22:02 2019 (r350587) @@ -38,9 +38,12 @@ _ENTRY(_rtld_start) stdu %r1,-144(%r1) /* 16-byte aligned stack for reg saves + exit_proc & obj _rtld args + backchain & lrsave stack frame */ - std %r3,96(%r1) /* argc */ + + /* Save and restore only initial argv, because _rtld will modify + * argv and envp if invoked explicitly, making it necessary to + * load the (possibly) adjusted values from the stack. + */ std %r4,104(%r1) /* argv */ - std %r5,112(%r1) /* envp */ /* std %r6,120(%r1) *//* obj (always 0) */ /* std %r7,128(%r1) *//* cleanup (always 0) */ std %r8,136(%r1) /* ps_strings */ @@ -94,9 +97,14 @@ _ENTRY(_rtld_start) /* * Restore args, with new obj/exit proc */ - ld %r3,96(%r1) /* argc */ - ld %r4,104(%r1) /* argv */ - ld %r5,112(%r1) /* envp */ + ld %r4,104(%r1) /* argv */ + ld %r3,-8(%r4) /* argc */ + + /* envp = argv + argc + 1 */ + addi %r5,%r3,1 + sldi %r5,%r5,3 /* x8 */ + add %r5,%r4,%r5 + ld %r6,120(%r1) /* obj */ ld %r7,128(%r1) /* exit proc */ ld %r8,136(%r1) /* ps_strings */ From owner-svn-src-head@freebsd.org Mon Aug 5 13:22:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE442C380C; Mon, 5 Aug 2019 13:22:16 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462JMr49nXz4f7Q; Mon, 5 Aug 2019 13:22:16 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 711721C61B; Mon, 5 Aug 2019 13:22:16 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x75DMGm2036410; Mon, 5 Aug 2019 13:22:16 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x75DMF1v036404; Mon, 5 Aug 2019 13:22:15 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201908051322.x75DMF1v036404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 5 Aug 2019 13:22:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350588 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 350588 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 13:22:16 -0000 Author: tuexen Date: Mon Aug 5 13:22:15 2019 New Revision: 350588 URL: https://svnweb.freebsd.org/changeset/base/350588 Log: Improve consistency. No functional change. MFC after: 3 days Modified: head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_os_bsd.h head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_usrreq.c head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_asconf.c ============================================================================== --- head/sys/netinet/sctp_asconf.c Mon Aug 5 13:22:02 2019 (r350587) +++ head/sys/netinet/sctp_asconf.c Mon Aug 5 13:22:15 2019 (r350588) @@ -1957,7 +1957,7 @@ sctp_addr_mgmt_assoc(struct sctp_inpcb *inp, struct sc /* invalid if we are a v6 only endpoint */ if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) && - SCTP_IPV6_V6ONLY(&inp->ip_inp.inp)) + SCTP_IPV6_V6ONLY(inp)) return; sin = &ifa->address.sin; @@ -2030,9 +2030,8 @@ sctp_asconf_iterator_ep(struct sctp_inpcb *inp, void * case AF_INET: { /* invalid if we are a v6 only endpoint */ - if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) && - SCTP_IPV6_V6ONLY(&inp->ip_inp.inp)) { + SCTP_IPV6_V6ONLY(inp)) { cnt_invalid++; if (asc->cnt == cnt_invalid) return (1); @@ -2147,7 +2146,7 @@ sctp_asconf_iterator_stcb(struct sctp_inpcb *inp, stru /* invalid if we are a v6 only endpoint */ if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) && - SCTP_IPV6_V6ONLY(&inp->ip_inp.inp)) + SCTP_IPV6_V6ONLY(inp)) continue; sin = &ifa->address.sin; @@ -2164,7 +2163,7 @@ sctp_asconf_iterator_stcb(struct sctp_inpcb *inp, stru continue; } if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) && - SCTP_IPV6_V6ONLY(&inp->ip_inp.inp)) { + SCTP_IPV6_V6ONLY(inp)) { cnt_invalid++; if (asc->cnt == cnt_invalid) return; Modified: head/sys/netinet/sctp_os_bsd.h ============================================================================== --- head/sys/netinet/sctp_os_bsd.h Mon Aug 5 13:22:02 2019 (r350587) +++ head/sys/netinet/sctp_os_bsd.h Mon Aug 5 13:22:15 2019 (r350588) @@ -365,10 +365,10 @@ typedef struct callout sctp_os_timer_t; */ /* get the v6 hop limit */ -#define SCTP_GET_HLIM(inp, ro) in6_selecthlim((struct inpcb *)&inp->ip_inp.inp, (ro ? (ro->ro_rt ? (ro->ro_rt->rt_ifp) : (NULL)) : (NULL))); +#define SCTP_GET_HLIM(inp, ro) in6_selecthlim(&inp->ip_inp.inp, (ro ? (ro->ro_rt ? (ro->ro_rt->rt_ifp) : (NULL)) : (NULL))); /* is the endpoint v6only? */ -#define SCTP_IPV6_V6ONLY(inp) (((struct inpcb *)inp)->inp_flags & IN6P_IPV6_V6ONLY) +#define SCTP_IPV6_V6ONLY(sctp_inpcb) ((sctp_inpcb)->ip_inp.inp.inp_flags & IN6P_IPV6_V6ONLY) /* is the socket non-blocking? */ #define SCTP_SO_IS_NBIO(so) ((so)->so_state & SS_NBIO) #define SCTP_SET_SO_NBIO(so) ((so)->so_state |= SS_NBIO) Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Mon Aug 5 13:22:02 2019 (r350587) +++ head/sys/netinet/sctp_pcb.c Mon Aug 5 13:22:15 2019 (r350588) @@ -2845,7 +2845,7 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *ad struct sockaddr_in *sin; /* IPV6_V6ONLY socket? */ - if (SCTP_IPV6_V6ONLY(ip_inp)) { + if (SCTP_IPV6_V6ONLY(inp)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL); return (EINVAL); } @@ -3643,8 +3643,9 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, #ifdef INET6 - if (ip_pcb->inp_vflag & INP_IPV6) - ip6_freepcbopts(((struct inpcb *)inp)->in6p_outputopts); + if (ip_pcb->inp_vflag & INP_IPV6) { + ip6_freepcbopts(ip_pcb->in6p_outputopts); + } #endif /* INET6 */ ip_pcb->inp_vflag = 0; /* free up authentication fields */ Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Mon Aug 5 13:22:02 2019 (r350587) +++ head/sys/netinet/sctp_usrreq.c Mon Aug 5 13:22:15 2019 (r350588) @@ -1412,7 +1412,6 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb } if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) && (num_v4 > 0)) { - if (SCTP_IPV6_V6ONLY(inp)) { /* * if IPV6_V6ONLY flag, ignore connections destined @@ -6931,14 +6930,14 @@ sctp_connect(struct socket *so, struct sockaddr *addr, #ifdef INET case AF_INET: { - struct sockaddr_in *sinp; + struct sockaddr_in *sin; if (addr->sa_len != sizeof(struct sockaddr_in)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (EINVAL); } - sinp = (struct sockaddr_in *)addr; - if (p != NULL && (error = prison_remote_ip4(p->td_ucred, &sinp->sin_addr)) != 0) { + sin = (struct sockaddr_in *)addr; + if (p != NULL && (error = prison_remote_ip4(p->td_ucred, &sin->sin_addr)) != 0) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error); return (error); } Modified: head/sys/netinet6/sctp6_usrreq.c ============================================================================== --- head/sys/netinet6/sctp6_usrreq.c Mon Aug 5 13:22:02 2019 (r350587) +++ head/sys/netinet6/sctp6_usrreq.c Mon Aug 5 13:22:15 2019 (r350588) @@ -592,7 +592,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s } inp->ip_inp.inp.inp_vflag &= ~INP_IPV4; inp->ip_inp.inp.inp_vflag |= INP_IPV6; - if ((addr != NULL) && (SCTP_IPV6_V6ONLY(&inp->ip_inp.inp) == 0)) { + if ((addr != NULL) && (SCTP_IPV6_V6ONLY(inp) == 0)) { switch (addr->sa_family) { #ifdef INET case AF_INET: From owner-svn-src-head@freebsd.org Mon Aug 5 13:28:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 993C8C39C4; Mon, 5 Aug 2019 13:28:22 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462JVt3Chlz4fjF; Mon, 5 Aug 2019 13:28:22 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5030B1C666; Mon, 5 Aug 2019 13:28:22 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x75DSMjC041697; Mon, 5 Aug 2019 13:28:22 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x75DSMDW041696; Mon, 5 Aug 2019 13:28:22 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201908051328.x75DSMDW041696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Mon, 5 Aug 2019 13:28:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350589 - head/tools/build/mk X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/tools/build/mk X-SVN-Commit-Revision: 350589 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 13:28:22 -0000 Author: luporl Date: Mon Aug 5 13:28:21 2019 New Revision: 350589 URL: https://svnweb.freebsd.org/changeset/base/350589 Log: [PPC64] Don't mark ld.bfd as obsolete PowerPC64 still needs ld.bfd for 32-bit binaries/libraries. This will be needed when ELFv2 becomes default, but there is no harm in committing it already. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D21136 Modified: head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Mon Aug 5 13:22:15 2019 (r350588) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Mon Aug 5 13:28:21 2019 (r350589) @@ -437,7 +437,8 @@ OLD_FILES+=usr/share/man/man7/ldint.7.gz OLD_FILES+=usr/share/man/man7/binutils.7.gz .endif .endif -.if !defined(WITH_PORT_BASE_BINUTILS) +# powerpc64 still needs ld.bfd for 32-bit binaries/libraries +.if !defined(WITH_PORT_BASE_BINUTILS) && ${TARGET_ARCH} != "powerpc64" .if ${MK_BINUTILS} == no || ${MK_LLD_IS_LD} == yes OLD_FILES+=usr/bin/ld.bfd .endif From owner-svn-src-head@freebsd.org Mon Aug 5 15:56:45 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D93D0C665E; Mon, 5 Aug 2019 15:56:45 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462Mp568GXz3LRh; Mon, 5 Aug 2019 15:56:45 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 962DF1E160; Mon, 5 Aug 2019 15:56:45 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x75Fuj1K032279; Mon, 5 Aug 2019 15:56:45 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x75FuiIX032274; Mon, 5 Aug 2019 15:56:44 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201908051556.x75FuiIX032274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 5 Aug 2019 15:56:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350591 - in head: share/man/man4 sys/conf sys/dev/iicbus sys/modules/i2c sys/modules/i2c/ads111x X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head: share/man/man4 sys/conf sys/dev/iicbus sys/modules/i2c sys/modules/i2c/ads111x X-SVN-Commit-Revision: 350591 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 15:56:45 -0000 Author: ian Date: Mon Aug 5 15:56:44 2019 New Revision: 350591 URL: https://svnweb.freebsd.org/changeset/base/350591 Log: Add a driver for Texas Instruments ADS101x/ADS111x i2c ADC chips. Instances of the device can be configured using hints or FDT data. Interfaces to reconfigure the chip and extract voltage measurements from it are available via sysctl(8). Added: head/share/man/man4/ads111x.4 (contents, props changed) head/sys/dev/iicbus/ads111x.c (contents, props changed) head/sys/modules/i2c/ads111x/ head/sys/modules/i2c/ads111x/Makefile (contents, props changed) Modified: head/sys/conf/NOTES head/sys/conf/files head/sys/modules/i2c/Makefile Added: head/share/man/man4/ads111x.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/ads111x.4 Mon Aug 5 15:56:44 2019 (r350591) @@ -0,0 +1,240 @@ +.\" +.\" Copyright (c) 2019 Ian Lepore +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd August 5, 2019 +.Dt ADS1115 4 +.Os +.Sh NAME +.Nm ads1115 +.Nd driver for ADS101x and ADS111x i2c analog to digital converters +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device ads1115" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +ads1115_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the ADS101x/ADS111x family of analog +to digital converter (ADC) devices. +The supported devices are all similar to each other, varying in +features such as resolution and number of input channels. +The devices offer a number of configuration options which can be +set via hints, FDT data, and +.Xr sysctl 8 . +.Pp +.Xr Sysctl 8 +provides access to the voltage measurements made by the device. +Each time the +.Va dev.ads1115...voltage +variable is accessed for a given channel, the driver switches the +chip's internal mux to choose the right input pins for that channel, +directs it to make a single measurement, and returns the measured value +in microvolts. +The amount of time required to make the measurement is a function +of the sampling rate configured for the device. +While device is directed to make a single measurement, it still averages +the input values for the same amount of time as it would to emit one +sample if it were in continuous mode. +For example, if the sample rate were configured as 125 samples per +second, a single measurement would require 8 milliseconds. +.Pp +For devices that support multiple input pins, the device datasheet +describes mux settings to control how those pins are interpeted when +making either single-ended or differential measurements. +There are eight possible ways to combine the inputs from the four pins. +The +.Nm +driver models that by creating a separate output channel for each of +the eight combinations. +To make a measurement on a given pin or pair of pins, you simply access +the voltage variable for the channel number that corresponds the mux +setting number (0 through 7) shown in the datasheet. +When the driver is configured with hints or FDT data, it creates +sysctl variables for just the channels specified in the config data. +When there is no channel config data, it creates all eight possible +channels so that you can access whichever one(s) you need. +.Pp +For devices that include an +.Va alert +output pin, the +.Nm +driver does not directly support the pin in terms of sensing or +acting on changes in the pin state. +However, you may connect the pin to a gpio input or fan controller +or other external device, and use the driver's sysctl variables to +configure behavior and threshold values for the pin. +The driver avoids perturbing your settings as it does other +manipulations to the config register. +.Sh SYSCTL VARIABLES +Sysctl variables are used to access the voltage measurements, and to +change the configuration of the channels. +All writeable variables may also be set as +.Xr loader 8 +tunables. +Channel numbers in these sysctl variables range from 0 through 7. +.Bl -tag -width indent +.It Va dev.ads1115..config +Provides access to the configuration register bits that control the +alert pin configuration. +Other bits which are controlled by the driver are masked out, and +cannot be viewed or changed using this variable. +.It Va dev.ads1115..lo_thresh +Sets the low threshold for activating the alert pin. +.It Va dev.ads1115..hi_thresh +Sets the high threshold for activating the alert pin. +.It Va dev.ads1115...rate_index +Sets the sample rate for the channel. +The device datasheet documents eight available sample rates, chosen +by setting a value of 0 through 7 into the corresponding control +register bits. +This variable sets the value used for those bits when making a +measurement on the given channel. +.Pp +Because measurements are always made in single-shot mode, think of +this variable as controlling the averaging time for a single sample; +the time to make a measurement is 1 / samplerate. +.It Va dev.ads1115...gain_index +Sets the programmable gain amplifier for the channel on devices +which have an internal amplifier. +The device datasheet documents eight available gain values, chosen +by setting a value of 0 through 7 into the corresponding control +register bits. +This variable sets the value used for those bits when making a +measurement on the given channel. +.It Va dev.ads1115...voltage +Reading this variable causes the device to make a measurement on +the corresponding input pin(s) and return the voltage in microvolts. +.Pp +Note that this variable does not appear when you list multiple +sysctl variables -- you must access it specifically by name, because +accessing it triggers device I/O. +.El +.Sh HARDWARE +The +.Nm +driver provides support for the following devices: +.Pp +.Bl -column -compact -offset indent "XXXXXXXX" "XXXXXXXX" +.It ADS1013 Ta ADS1113 +.It ADS1014 Ta ADS1114 +.It ADS1015 Ta ADS1115 +.El +.Sh FDT CONFIGURATION +On an +.Xr fdt 4 +based system, the +.Nm +device is defined as a slave device subnode +of the i2c bus controller node. +All properties documented in the +.Va ads1115.txt +bindings document can be used with the +.Nm +device. +.Pp +The following properties are required in the +.Nm +device subnode: +.Bl -tag -width indent +.It Va compatible +One of the following: +.Bl -column -compact -offset indent ".Dq ti,ads1013" ".Dq ti,ads1113" +.It Dq ti,ads1013 Ta Dq ti,ads1113 +.It Dq ti,ads1014 Ta Dq ti,ads1114 +.It Dq ti,ads1015 Ta Dq ti,ads1115 +.El +.It Va reg +I2c slave address of device. +.El +.Pp +Specific channels can be configured by adding child nodes to the +.Nm +node, as described in the standard ads1115.txt bindings document. +If no channels are configured, sysctl variables will be created +for all possible channels supported by the device type, otherwise +only the specified channels are created. +.Ss Example including channel configuration +.Bd -unfilled -offset indent +adc@48 { + compatible = "ti,ads1115"; + reg = <0x48>; + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + channel@6 { + reg = <6>; + ti,gain = <3>; + ti,datarate = <4>; + }; + channel@7 { + reg = <7>; + ti,gain = <1>; + ti,datarate = <7>; + }; +}; +.Ed +.Sh HINTS CONFIGURATION +On a +.Xr device.hints 5 +based system, such as +.Li MIPS , +these values are configurable for +.Nm : +.Bl -tag -width indent +.It Va hint.ads1115..at +The iicbus instance the +.Nm +instance is attached to. +.It Va hint.ads1115...gain_index +The amplifier gain, as described above for the sysctl variable +.Va dev.ads1115...gain_index . +.It Va hint.ads1115...rate_index +The sample rate, as described above for the sysctl variable +.Va dev.ads1115...rate_index . +.El +.Pp +If no channels are configured, sysctl variables will be created +for all possible channels supported by the device type, otherwise +only the specified channels are created. +.Sh SEE ALSO +.Xr fdt 4 , +.Xr sysctl 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 13.0 . Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Mon Aug 5 15:24:05 2019 (r350590) +++ head/sys/conf/NOTES Mon Aug 5 15:56:44 2019 (r350591) @@ -2422,6 +2422,7 @@ device iicoc # OpenCores I2C controller support # I2C peripheral devices # device ad7418 # Analog Devices temp and voltage sensor +device ads111x # Texas Instruments ADS101x and ADS111x ADCs device ds1307 # Dallas DS1307 RTC and compatible device ds13rtc # All Dallas/Maxim ds13xx chips device ds1672 # Dallas DS1672 RTC Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Aug 5 15:24:05 2019 (r350590) +++ head/sys/conf/files Mon Aug 5 15:56:44 2019 (r350591) @@ -1761,6 +1761,7 @@ dev/ida/ida.c optional ida dev/ida/ida_disk.c optional ida dev/ida/ida_pci.c optional ida pci dev/iicbus/ad7418.c optional ad7418 +dev/iicbus/ads111x.c optional ads111x dev/iicbus/ds1307.c optional ds1307 dev/iicbus/ds13rtc.c optional ds13rtc | ds133x | ds1374 dev/iicbus/ds1672.c optional ds1672 Added: head/sys/dev/iicbus/ads111x.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/ads111x.c Mon Aug 5 15:56:44 2019 (r350591) @@ -0,0 +1,582 @@ +/*- + * Copyright (c) 2019 Ian Lepore. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Driver for Texas Instruments ADS101x and ADS111x family i2c ADC chips. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef FDT +#include +#include +#endif + +#include +#include + +#include "iicbus_if.h" + +/* + * Chip registers, bit definitions, shifting and masking values. + */ +#define ADS111x_CONV 0 /* Reg 0: Latest sample (ro) */ + +#define ADS111x_CONF 1 /* Reg 1: Config (rw) */ +#define ADS111x_CONF_OS_SHIFT 15 /* Operational state */ +#define ADS111x_CONF_MUX_SHIFT 12 /* Input mux setting */ +#define ADS111x_CONF_GAIN_SHIFT 9 /* Programmable gain amp */ +#define ADS111x_CONF_MODE_SHIFT 8 /* Operational mode */ +#define ADS111x_CONF_RATE_SHIFT 5 /* Sample rate */ + +#define ADS111x_LOTHRESH 2 /* Compare lo threshold (rw) */ + +#define ADS111x_HITHRESH 3 /* Compare hi threshold (rw) */ + +/* + * On config write, the operational-state bit starts a measurement, on read it + * indicates when the measurement process is complete/idle. + */ +#define ADS111x_CONF_MEASURE (1u << ADS111x_CONF_OS_SHIFT) +#define ADS111x_CONF_IDLE (1u << ADS111x_CONF_OS_SHIFT) + +/* + * The default values for config items that are not per-channel. Mostly, this + * turns off the comparator on chips that have that feature, because this driver + * doesn't support it directly. However, the user is allowed to enable the + * comparator and we'll leave it alone if they do. That allows them connect the + * alert pin to something and use the feature without any help from this driver. + */ +#define ADS111x_CONF_DEFAULT (1 << ADS111x_CONF_MODE_SHIFT) +#define ADS111x_CONF_USERMASK 0x001f + +/* + * Per-channel defaults. The chip only has one control register, and we load + * per-channel values into it every time we make a measurement on that channel. + * These are the default values for the control register from the datasheet, for + * values we maintain on a per-channel basis. + */ +#define DEFAULT_GAINIDX 2 +#define DEFAULT_RATEIDX 4 + +/* + * Full-scale ranges for each available amplifier setting, in microvolts. The + * ADS1x13 chips are fixed-range, the other chips contain a programmable gain + * amplifier, and the full scale range is based on the amplifier setting. + */ +static const u_int fixedranges[8] = { + 2048000, 2048000, 2048000, 2048000, 2048000, 2048000, 2048000, 2048000, +}; +static const u_int gainranges[8] = { + 6144000, 4096000, 2048000, 1024000, 512000, 256000, 256000, 256000, +}; + +/* The highest value for the ADS101x chip is 0x7ff0, for ADS111x it's 0x7fff. */ +#define ADS101x_RANGEDIV ((1 << 15) - 15) +#define ADS111x_RANGEDIV ((1 << 15) - 1) + +/* Samples per second; varies based on chip type. */ +static const u_int rates101x[8] = {128, 250, 490, 920, 1600, 2400, 3300, 3300}; +static const u_int rates111x[8] = { 8, 16, 32, 64, 128, 250, 475, 860}; + +struct ads111x_channel { + u_int gainidx; /* Amplifier (full-scale range) config index */ + u_int rateidx; /* Samples per second config index */ + bool configured; /* Channel has been configured */ +}; + +#define ADS111x_MAX_CHANNELS 8 + +struct ads111x_chipinfo { + const char *name; + const u_int *rangetab; + const u_int *ratetab; + u_int numchan; + int rangediv; +}; + +static struct ads111x_chipinfo ads111x_chip_infos[] = { + { "ADS1013", fixedranges, rates101x, 1, ADS101x_RANGEDIV }, + { "ADS1014", gainranges, rates101x, 1, ADS101x_RANGEDIV }, + { "ADS1015", gainranges, rates101x, 8, ADS101x_RANGEDIV }, + { "ADS1113", fixedranges, rates111x, 1, ADS111x_RANGEDIV }, + { "ADS1114", gainranges, rates111x, 1, ADS111x_RANGEDIV }, + { "ADS1115", gainranges, rates111x, 8, ADS111x_RANGEDIV }, +}; + +#ifdef FDT +static struct ofw_compat_data compat_data[] = { + {"ti,ads1013", (uintptr_t)&ads111x_chip_infos[0]}, + {"ti,ads1014", (uintptr_t)&ads111x_chip_infos[1]}, + {"ti,ads1015", (uintptr_t)&ads111x_chip_infos[2]}, + {"ti,ads1113", (uintptr_t)&ads111x_chip_infos[3]}, + {"ti,ads1114", (uintptr_t)&ads111x_chip_infos[4]}, + {"ti,ads1115", (uintptr_t)&ads111x_chip_infos[5]}, + {NULL, (uintptr_t)NULL}, +}; +IICBUS_FDT_PNP_INFO(compat_data); +#endif + +struct ads111x_softc { + device_t dev; + struct sx lock; + int addr; + int cfgword; + const struct ads111x_chipinfo + *chipinfo; + struct ads111x_channel + channels[ADS111x_MAX_CHANNELS]; +}; + +static int +ads111x_write_2(struct ads111x_softc *sc, int reg, int val) +{ + uint8_t data[2]; + + be16enc(data, val); + + return (iic2errno(iicdev_writeto(sc->dev, reg, data, 2, IIC_WAIT))); +} + +static int +ads111x_read_2(struct ads111x_softc *sc, int reg, int *val) +{ + int err; + uint8_t data[2]; + + err = iic2errno(iicdev_readfrom(sc->dev, reg, data, 2, IIC_WAIT)); + if (err == 0) + *val = (int16_t)be16dec(data); + + return (err); +} + +static int +ads111x_sample_voltage(struct ads111x_softc *sc, int channum, int *voltage) +{ + struct ads111x_channel *chan; + int err, cfgword, convword, rate, waitns; + int64_t fsrange; + + chan = &sc->channels[channum]; + + /* Ask the chip to do a one-shot measurement of the given channel. */ + cfgword = sc->cfgword | + (1 << ADS111x_CONF_OS_SHIFT) | + (channum << ADS111x_CONF_MUX_SHIFT) | + (chan->gainidx << ADS111x_CONF_GAIN_SHIFT) | + (chan->rateidx << ADS111x_CONF_RATE_SHIFT); + if ((err = ads111x_write_2(sc, ADS111x_CONF, cfgword)) != 0) + return (err); + + /* + * Calculate how long it will take to make the measurement at the + * current sampling rate (round up), and sleep at least that long. + */ + rate = sc->chipinfo->ratetab[chan->rateidx]; + waitns = (1000000000 + rate - 1) / rate; + err = pause_sbt("ads111x", nstosbt(waitns), 0, C_PREL(2)); + if (err != 0 && err != EWOULDBLOCK) + return (err); + +#if 0 + /* + * Sanity-check that the measurement is complete. Not enabled by + * default because checking wastes 200-800us just in moving the status + * command and result across the i2c bus, which could double the time it + * takes to get one measurement. Unlike most i2c slaves, this device + * does not auto-increment the register number on reads, so we can't + * read both status and measurement in one operation. + */ + if ((err = ads111x_read_2(sc, ADS111x_CONF, &cfgword)) != 0) + return (err); + if (!(cfgword & ADS111x_CONF_IDLE)) + return (EIO); +#endif + + /* Retrieve the sample and convert it to microvolts. */ + if ((err = ads111x_read_2(sc, ADS111x_CONV, &convword)) != 0) + return (err); + fsrange = sc->chipinfo->rangetab[chan->gainidx]; + *voltage = (int)((convword * fsrange ) / sc->chipinfo->rangediv); + + return (err); +} + +static int +ads111x_sysctl_gainidx(SYSCTL_HANDLER_ARGS) +{ + struct ads111x_softc *sc; + int chan, err, gainidx; + + sc = arg1; + chan = arg2; + + gainidx = sc->channels[chan].gainidx; + err = sysctl_handle_int(oidp, &gainidx, 0, req); + if (err != 0 || req->newptr == NULL) + return (err); + if (gainidx < 0 || gainidx > 7) + return (EINVAL); + sx_xlock(&sc->lock); + sc->channels[chan].gainidx = gainidx; + sx_xunlock(&sc->lock); + + return (err); +} + +static int +ads111x_sysctl_rateidx(SYSCTL_HANDLER_ARGS) +{ + struct ads111x_softc *sc; + int chan, err, rateidx; + + sc = arg1; + chan = arg2; + + rateidx = sc->channels[chan].rateidx; + err = sysctl_handle_int(oidp, &rateidx, 0, req); + if (err != 0 || req->newptr == NULL) + return (err); + if (rateidx < 0 || rateidx > 7) + return (EINVAL); + sx_xlock(&sc->lock); + sc->channels[chan].rateidx = rateidx; + sx_xunlock(&sc->lock); + + return (err); +} + +static int +ads111x_sysctl_voltage(SYSCTL_HANDLER_ARGS) +{ + struct ads111x_softc *sc; + int chan, err, voltage; + + sc = arg1; + chan = arg2; + + if (req->oldptr != NULL) { + sx_xlock(&sc->lock); + err = ads111x_sample_voltage(sc, chan, &voltage); + sx_xunlock(&sc->lock); + if (err != 0) { + device_printf(sc->dev, + "conversion read failed, error %d\n", err); + return (err); + } + } + err = sysctl_handle_int(oidp, &voltage, 0, req); + return (err); +} + +static int +ads111x_sysctl_config(SYSCTL_HANDLER_ARGS) +{ + struct ads111x_softc *sc; + int config, err; + + sc = arg1; + config = sc->cfgword & ADS111x_CONF_USERMASK; + err = sysctl_handle_int(oidp, &config, 0, req); + if (err != 0 || req->newptr == NULL) + return (err); + sx_xlock(&sc->lock); + sc->cfgword = config & ADS111x_CONF_USERMASK; + err = ads111x_write_2(sc, ADS111x_CONF, sc->cfgword); + sx_xunlock(&sc->lock); + + return (err); +} +static int +ads111x_sysctl_lothresh(SYSCTL_HANDLER_ARGS) +{ + struct ads111x_softc *sc; + int thresh, err; + + sc = arg1; + if ((err = ads111x_read_2(sc, ADS111x_LOTHRESH, &thresh)) != 0) + return (err); + err = sysctl_handle_int(oidp, &thresh, 0, req); + if (err != 0 || req->newptr == NULL) + return (err); + sx_xlock(&sc->lock); + err = ads111x_write_2(sc, ADS111x_CONF, thresh); + sx_xunlock(&sc->lock); + + return (err); +} + +static int +ads111x_sysctl_hithresh(SYSCTL_HANDLER_ARGS) +{ + struct ads111x_softc *sc; + int thresh, err; + + sc = arg1; + if ((err = ads111x_read_2(sc, ADS111x_HITHRESH, &thresh)) != 0) + return (err); + err = sysctl_handle_int(oidp, &thresh, 0, req); + if (err != 0 || req->newptr == NULL) + return (err); + sx_xlock(&sc->lock); + err = ads111x_write_2(sc, ADS111x_CONF, thresh); + sx_xunlock(&sc->lock); + + return (err); +} + +static void +ads111x_setup_channel(struct ads111x_softc *sc, int chan, int gainidx, int rateidx) +{ + struct ads111x_channel *c; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *chantree, *devtree; + char chanstr[4]; + + c = &sc->channels[chan]; + c->gainidx = gainidx; + c->rateidx = rateidx; + + /* + * If setting up the channel for the first time, create channel's + * sysctl entries. We might have already configured the channel if + * config data for it exists in both FDT and hints. + */ + + if (c->configured) + return; + + ctx = device_get_sysctl_ctx(sc->dev); + devtree = device_get_sysctl_tree(sc->dev); + snprintf(chanstr, sizeof(chanstr), "%d", chan); + chantree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(devtree), OID_AUTO, + chanstr, CTLFLAG_RD, NULL, "channel data"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(chantree), OID_AUTO, + "gain_index", CTLTYPE_INT | CTLFLAG_RWTUN, sc, chan, + ads111x_sysctl_gainidx, "I", "programmable gain amp setting, 0-7"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(chantree), OID_AUTO, + "rate_index", CTLTYPE_INT | CTLFLAG_RWTUN, sc, chan, + ads111x_sysctl_rateidx, "I", "sample rate setting, 0-7"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(chantree), OID_AUTO, + "voltage", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_SKIP, sc, chan, + ads111x_sysctl_voltage, "I", "sampled voltage in microvolts"); + + c->configured = true; +} + +static void +ads111x_add_channels(struct ads111x_softc *sc) +{ + const char *name; + uint32_t chan, gainidx, num_added, rateidx, unit; + bool found; + +#ifdef FDT + phandle_t child, node; + + /* Configure any channels that have FDT data. */ + num_added = 0; + node = ofw_bus_get_node(sc->dev); + for (child = OF_child(node); child != 0; child = OF_peer(child)) { + if (OF_getencprop(child, "reg", &chan, sizeof(chan)) == -1) + continue; + if (chan >= ADS111x_MAX_CHANNELS) + continue; + gainidx = DEFAULT_GAINIDX; + rateidx = DEFAULT_RATEIDX; + OF_getencprop(child, "ti,gain", &gainidx, sizeof(gainidx)); + OF_getencprop(child, "ti,datarate", &rateidx, sizeof(rateidx)); + ads111x_setup_channel(sc, chan, gainidx, rateidx); + ++num_added; + } +#else + num_added = 0; +#endif + + /* Configure any channels that have hint data. */ + name = device_get_name(sc->dev); + unit = device_get_unit(sc->dev); + for (chan = 0; chan < sc->chipinfo->numchan; ++chan) { + found = false; + gainidx = DEFAULT_GAINIDX; + rateidx = DEFAULT_RATEIDX; + if (resource_int_value(name, unit, "gain_index", &gainidx) == 0) + found = true; + if (resource_int_value(name, unit, "rate_index", &gainidx) == 0) + found = true; + if (found) { + ads111x_setup_channel(sc, chan, gainidx, rateidx); + ++num_added; + } + } + + /* If any channels were configured via FDT or hints, we're done. */ + if (num_added > 0) + return; + + /* + * No channel config; add all possible channels using default values, + * and let the user configure the ones they want on the fly via sysctl. + */ + for (chan = 0; chan < sc->chipinfo->numchan; ++chan) { + gainidx = DEFAULT_GAINIDX; + rateidx = DEFAULT_RATEIDX; + ads111x_setup_channel(sc, chan, gainidx, rateidx); + } +} + +static const struct ads111x_chipinfo * +ads111x_find_chipinfo(device_t dev) +{ + const struct ads111x_chipinfo *info; + const char *chiptype; + int i; + +#ifdef FDT + if (ofw_bus_status_okay(dev)) { + info = (struct ads111x_chipinfo*) + ofw_bus_search_compatible(dev, compat_data)->ocd_data; + if (info != NULL) + return (info); + } +#endif + + /* For hinted devices, we must be told the chip type. */ + chiptype = NULL; + resource_string_value(device_get_name(dev), device_get_unit(dev), + "type", &chiptype); + if (chiptype != NULL) { + for (i = 0; i < nitems(ads111x_chip_infos); ++i) { + info = &ads111x_chip_infos[i]; + if (strcasecmp(chiptype, info->name) == 0) + return (info); + } + } + return (NULL); +} + +static int +ads111x_probe(device_t dev) +{ + const struct ads111x_chipinfo *info; + + info = ads111x_find_chipinfo(dev); + if (info != NULL) { + device_set_desc(dev, info->name); + return (BUS_PROBE_DEFAULT); + } + + return (ENXIO); +} + +static int +ads111x_attach(device_t dev) +{ + struct ads111x_softc *sc; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree; + int err; + + sc = device_get_softc(dev); + sc->dev = dev; + sc->addr = iicbus_get_addr(dev); + sc->cfgword = ADS111x_CONF_DEFAULT; + + sc->chipinfo = ads111x_find_chipinfo(sc->dev); + if (sc->chipinfo == NULL) { + device_printf(dev, + "cannot get chipinfo (but it worked during probe)"); + return (ENXIO); + } + + /* Set the default chip config. */ + if ((err = ads111x_write_2(sc, ADS111x_CONF, sc->cfgword)) != 0) { + device_printf(dev, "cannot write chip config register\n"); + return (err); + } + + /* Add the sysctl handler to set the chip configuration register. */ + ctx = device_get_sysctl_ctx(dev); + tree = device_get_sysctl_tree(dev); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "config", CTLTYPE_INT | CTLFLAG_RWTUN, sc, 0, + ads111x_sysctl_config, "I", "configuration register word"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "lo_thresh", CTLTYPE_INT | CTLFLAG_RWTUN, sc, 0, + ads111x_sysctl_lothresh, "I", "comparator low threshold"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "hi_thresh", CTLTYPE_INT | CTLFLAG_RWTUN, sc, 0, + ads111x_sysctl_hithresh, "I", "comparator high threshold"); + + /* Set up channels based on metadata or default config. */ + ads111x_add_channels(sc); + + sx_init(&sc->lock, "ads111x"); + + return (0); +} + +static int +ads111x_detach(device_t dev) +{ + struct ads111x_softc *sc; + + sc = device_get_softc(dev); + + sx_destroy(&sc->lock); + return (0); +} + +static device_method_t ads111x_methods[] = { + DEVMETHOD(device_probe, ads111x_probe), + DEVMETHOD(device_attach, ads111x_attach), + DEVMETHOD(device_detach, ads111x_detach), + + DEVMETHOD_END, +}; + +static driver_t ads111x_driver = { + "ads111x", + ads111x_methods, + sizeof(struct ads111x_softc), +}; +static devclass_t ads111x_devclass; + +DRIVER_MODULE(ads111x, iicbus, ads111x_driver, ads111x_devclass, NULL, NULL); +MODULE_VERSION(ads111x, 1); +MODULE_DEPEND(ads111x, iicbus, 1, 1, 1); Modified: head/sys/modules/i2c/Makefile ============================================================================== --- head/sys/modules/i2c/Makefile Mon Aug 5 15:24:05 2019 (r350590) +++ head/sys/modules/i2c/Makefile Mon Aug 5 15:56:44 2019 (r350591) @@ -1,6 +1,7 @@ # $FreeBSD$ SUBDIR = \ + ads111x \ controllers \ cyapa \ ds1307 \ Added: head/sys/modules/i2c/ads111x/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/i2c/ads111x/Makefile Mon Aug 5 15:56:44 2019 (r350591) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/iicbus + +KMOD= ads111x +SRCS= ads111x.c + +SRCS+= \ + bus_if.h \ + device_if.h \ + iicbus_if.h \ + ofw_bus_if.h \ + opt_platform.h \ + +.include From owner-svn-src-head@freebsd.org Mon Aug 5 17:36:02 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 98ACFA8E8C; Mon, 5 Aug 2019 17:36:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462Q0f389xz3yfD; Mon, 5 Aug 2019 17:36:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2FF061F367; Mon, 5 Aug 2019 17:36:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x75Ha2SZ092382; Mon, 5 Aug 2019 17:36:02 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x75Ha1a4092377; Mon, 5 Aug 2019 17:36:01 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908051736.x75Ha1a4092377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 5 Aug 2019 17:36:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350599 - in head: sbin/nvmecontrol sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head: sbin/nvmecontrol sys/dev/nvme X-SVN-Commit-Revision: 350599 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 17:36:02 -0000 Author: mav Date: Mon Aug 5 17:36:00 2019 New Revision: 350599 URL: https://svnweb.freebsd.org/changeset/base/350599 Log: Add `nvmecontrol resv` to handle NVMe reservations. NVMe reservations are quite alike to SCSI persistent reservations and can be used in clustered setups with shared multiport storage. MFC after: 10 days Relnotes: yes Sponsored by: iXsystems, Inc. Added: head/sbin/nvmecontrol/resv.c (contents, props changed) Modified: head/sbin/nvmecontrol/Makefile head/sbin/nvmecontrol/nvmecontrol.8 head/sbin/nvmecontrol/sanitize.c head/sys/dev/nvme/nvme.h Modified: head/sbin/nvmecontrol/Makefile ============================================================================== --- head/sbin/nvmecontrol/Makefile Mon Aug 5 17:32:16 2019 (r350598) +++ head/sbin/nvmecontrol/Makefile Mon Aug 5 17:36:00 2019 (r350599) @@ -4,7 +4,7 @@ PACKAGE=runtime PROG= nvmecontrol SRCS= comnd.c nvmecontrol.c SRCS+= devlist.c firmware.c format.c identify.c logpage.c ns.c nsid.c -SRCS+= perftest.c power.c reset.c sanitize.c +SRCS+= perftest.c power.c reset.c resv.c sanitize.c #SRCS+= passthru.c SRCS+= identify_ext.c nvme_util.c nc_util.c MAN= nvmecontrol.8 Modified: head/sbin/nvmecontrol/nvmecontrol.8 ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.8 Mon Aug 5 17:32:16 2019 (r350598) +++ head/sbin/nvmecontrol/nvmecontrol.8 Mon Aug 5 17:36:00 2019 (r350599) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 3, 2019 +.Dd August 5, 2019 .Dt NVMECONTROL 8 .Os .Sh NAME @@ -121,6 +121,33 @@ .Aq device id .Aq namespace id .Nm +.Ic resv acquire +.Aq Fl c Ar crkey +.Op Fl p Ar prkey +.Aq Fl t Ar rtype +.Aq Fl a Ar racqa +.Aq namespace id +.Nm +.Ic resv register +.Op Fl c Ar crkey +.Aq Fl k Ar nrkey +.Aq Fl r Ar rrega +.Op Fl i Ar iekey +.Op Fl p Ar cptpl +.Aq namespace id +.Nm +.Ic resv release +.Aq Fl c Ar crkey +.Aq Fl t Ar rtype +.Aq Fl a Ar rrela +.Aq namespace id +.Nm +.Ic resv report +.Op Fl e +.Op Fl v +.Op Fl x +.Aq namespace id +.Nm .Ic firmware .Op Fl s Ar slot .Op Fl f Ar path_to_firmware @@ -140,9 +167,9 @@ .Ic sanitize .Aq Fl a Ar sanact .Op Fl c Ar owpass +.Op Fl d .Op Fl p Ar ovrpat .Op Fl r -.Op Fl D .Op Fl I .Op Fl U .Aq device id @@ -223,6 +250,96 @@ will set Retain Asynchronous Event. Various namespace management commands. If namespace management is supported by device, allow list, create and delete namespaces, list, attach and detach controllers to namespaces. +.Ss resv acquire +Acquire or preempt namespace reservation, using specified parameters: +.Bl -tag -width 6n +.It Fl a +Acquire action: +.Bl -tag -compact -width 6n +.It Dv 0 +Acquire +.It Dv 1 +Preempt +.It Dv 2 +Preempt and abort +.El +.It Fl c +Current reservation key. +.It Fl p +Preempt reservation key. +.It Fl t +Reservation type: +.Bl -tag -compact -width 6n +.It Dv 1 +Write Exclusive +.It Dv 2 +Exclusive Access +.It Dv 3 +Write Exclusive - Registrants Only +.It Dv 4 +Exclusive Access - Registrants Only +.It Dv 5 +Write Exclusive - All Registrants +.It Dv 6 +Exclusive Access - All Registrants +.El +.El +.Ss resv register +Register, unregister or replace reservation key, using specified parameters: +.Bl -tag -width 6n +.It Fl c +Current reservation key. +.It Fl k +New reservation key. +.It Fl r +Register action: +.Bl -tag -compact -width 6n +.It Dv 0 +Register +.It Dv 1 +Unregister +.It Dv 2 +Replace +.El +.It Fl i +Ignore Existing Key +.It Fl p +Change Persist Through Power Loss State: +.Bl -tag -compact -width 6n +.It Dv 0 +No change to PTPL state +.It Dv 2 +Set PTPL state to ‘0’. +Reservations are released and registrants are cleared on a power on. +.It Dv 3 +Set PTPL state to ‘1’. +Reservations and registrants persist across a power loss. +.El +.El +.Ss resv release +Release or clear reservation, using specified parameters: +.Bl -tag -width 6n +.It Fl c +Current reservation key. +.It Fl t +Reservation type. +.It Fl a +Release action: +.Bl -tag -compact -width 6n +.It Dv 0 +Release +.It Dv 1 +Clean +.El +.El +.Ss resv report +Print reservation status, using specified parameters: +.Bl -tag -width 6n +.It Fl x +Print reservation status in hex. +.It Fl e +Use Extended Data Structure. +.El .Ss format Format either specified namespace, or all namespaces of specified controller, using specified parameters: @@ -281,7 +398,7 @@ The number of passes when performing an operation. Valid values are between 1 and 16. The default is 1. -.It Fl D +.It Fl d No Deallocate After Sanitize. .It Fl I When performing an Added: head/sbin/nvmecontrol/resv.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/nvmecontrol/resv.c Mon Aug 5 17:36:00 2019 (r350599) @@ -0,0 +1,442 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (C) 2019 Alexander Motin + * + * 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, + * without modification, immediately at the beginning of the file. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "nvmecontrol.h" + +/* Tables for command line parsing */ + +static cmd_fn_t resv; +static cmd_fn_t resvacquire; +static cmd_fn_t resvregister; +static cmd_fn_t resvrelease; +static cmd_fn_t resvreport; + +#define NONE 0xffffffffu +#define NONE64 0xffffffffffffffffull +#define OPT(l, s, t, opt, addr, desc) { l, s, t, &opt.addr, desc } +#define OPT_END { NULL, 0, arg_none, NULL, NULL } + +static struct cmd resv_cmd = { + .name = "resv", + .fn = resv, + .descr = "Reservation commands", + .ctx_size = 0, + .opts = NULL, + .args = NULL, +}; + +CMD_COMMAND(resv_cmd); + +static struct acquire_options { + uint64_t crkey; + uint64_t prkey; + uint8_t rtype; + uint8_t racqa; + const char *dev; +} acquire_opt = { + .crkey = 0, + .prkey = 0, + .rtype = 0, + .racqa = 0, + .dev = NULL, +}; + +static const struct opts acquire_opts[] = { + OPT("crkey", 'c', arg_uint64, acquire_opt, crkey, + "Current Reservation Key"), + OPT("prkey", 'p', arg_uint64, acquire_opt, prkey, + "Preempt Reservation Key"), + OPT("rtype", 't', arg_uint8, acquire_opt, rtype, + "Reservation Type"), + OPT("racqa", 'a', arg_uint8, acquire_opt, racqa, + "Acquire Action (0=acq, 1=pre, 2=pre+ab)"), + { NULL, 0, arg_none, NULL, NULL } +}; + +static const struct args acquire_args[] = { + { arg_string, &acquire_opt.dev, "namespace-id" }, + { arg_none, NULL, NULL }, +}; + +static struct cmd acquire_cmd = { + .name = "acquire", + .fn = resvacquire, + .descr = "Acquire/preempt reservation", + .ctx_size = sizeof(acquire_opt), + .opts = acquire_opts, + .args = acquire_args, +}; + +CMD_SUBCOMMAND(resv_cmd, acquire_cmd); + +static struct register_options { + uint64_t crkey; + uint64_t nrkey; + uint8_t rrega; + bool iekey; + uint8_t cptpl; + const char *dev; +} register_opt = { + .crkey = 0, + .nrkey = 0, + .rrega = 0, + .iekey = false, + .cptpl = 0, + .dev = NULL, +}; + +static const struct opts register_opts[] = { + OPT("crkey", 'c', arg_uint64, register_opt, crkey, + "Current Reservation Key"), + OPT("nrkey", 'k', arg_uint64, register_opt, nrkey, + "New Reservation Key"), + OPT("rrega", 'r', arg_uint8, register_opt, rrega, + "Register Action (0=reg, 1=unreg, 2=replace)"), + OPT("iekey", 'i', arg_none, register_opt, iekey, + "Ignore Existing Key"), + OPT("cptpl", 'p', arg_uint8, register_opt, cptpl, + "Change Persist Through Power Loss State"), + { NULL, 0, arg_none, NULL, NULL } +}; + +static const struct args register_args[] = { + { arg_string, ®ister_opt.dev, "namespace-id" }, + { arg_none, NULL, NULL }, +}; + +static struct cmd register_cmd = { + .name = "register", + .fn = resvregister, + .descr = "Register/unregister reservation", + .ctx_size = sizeof(register_opt), + .opts = register_opts, + .args = register_args, +}; + +CMD_SUBCOMMAND(resv_cmd, register_cmd); + +static struct release_options { + uint64_t crkey; + uint8_t rtype; + uint8_t rrela; + const char *dev; +} release_opt = { + .crkey = 0, + .rtype = 0, + .rrela = 0, + .dev = NULL, +}; + +static const struct opts release_opts[] = { + OPT("crkey", 'c', arg_uint64, release_opt, crkey, + "Current Reservation Key"), + OPT("rtype", 't', arg_uint8, release_opt, rtype, + "Reservation Type"), + OPT("rrela", 'a', arg_uint8, release_opt, rrela, + "Release Action (0=release, 1=clear)"), + { NULL, 0, arg_none, NULL, NULL } +}; + +static const struct args release_args[] = { + { arg_string, &release_opt.dev, "namespace-id" }, + { arg_none, NULL, NULL }, +}; + +static struct cmd release_cmd = { + .name = "release", + .fn = resvrelease, + .descr = "Release/clear reservation", + .ctx_size = sizeof(release_opt), + .opts = release_opts, + .args = release_args, +}; + +CMD_SUBCOMMAND(resv_cmd, release_cmd); + +static struct report_options { + bool hex; + bool verbose; + bool eds; + const char *dev; +} report_opt = { + .hex = false, + .verbose = false, + .eds = false, + .dev = NULL, +}; + +static const struct opts report_opts[] = { + OPT("hex", 'x', arg_none, report_opt, hex, + "Print reservation status in hex"), + OPT("verbose", 'v', arg_none, report_opt, verbose, + "More verbosity"), + OPT("eds", 'e', arg_none, report_opt, eds, + "Extended Data Structure"), + { NULL, 0, arg_none, NULL, NULL } +}; + +static const struct args report_args[] = { + { arg_string, &report_opt.dev, "namespace-id" }, + { arg_none, NULL, NULL }, +}; + +static struct cmd report_cmd = { + .name = "report", + .fn = resvreport, + .descr = "Print reservation status", + .ctx_size = sizeof(report_opt), + .opts = report_opts, + .args = report_args, +}; + +CMD_SUBCOMMAND(resv_cmd, report_cmd); + +/* handles NVME_OPC_RESERVATION_* NVM commands */ + +static void +resvacquire(const struct cmd *f, int argc, char *argv[]) +{ + struct nvme_pt_command pt; + uint64_t data[2]; + int fd; + uint32_t nsid; + + if (arg_parse(argc, argv, f)) + return; + open_dev(acquire_opt.dev, &fd, 1, 1); + get_nsid(fd, NULL, &nsid); + if (nsid == 0) { + fprintf(stderr, "This command require namespace-id\n"); + arg_help(argc, argv, f); + } + + data[0] = htole64(acquire_opt.crkey); + data[1] = htole64(acquire_opt.prkey); + + memset(&pt, 0, sizeof(pt)); + pt.cmd.opc = NVME_OPC_RESERVATION_ACQUIRE; + pt.cmd.cdw10 = htole32((acquire_opt.racqa & 7) | + (acquire_opt.rtype << 8)); + pt.buf = &data; + pt.len = sizeof(data); + pt.is_read = 0; + + if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) + err(1, "acquire request failed"); + + if (nvme_completion_is_error(&pt.cpl)) + errx(1, "acquire request returned error"); + + close(fd); + exit(0); +} + +static void +resvregister(const struct cmd *f, int argc, char *argv[]) +{ + struct nvme_pt_command pt; + uint64_t data[2]; + int fd; + uint32_t nsid; + + if (arg_parse(argc, argv, f)) + return; + open_dev(register_opt.dev, &fd, 1, 1); + get_nsid(fd, NULL, &nsid); + if (nsid == 0) { + fprintf(stderr, "This command require namespace-id\n"); + arg_help(argc, argv, f); + } + + data[0] = htole64(register_opt.crkey); + data[1] = htole64(register_opt.nrkey); + + memset(&pt, 0, sizeof(pt)); + pt.cmd.opc = NVME_OPC_RESERVATION_REGISTER; + pt.cmd.cdw10 = htole32((register_opt.rrega & 7) | + (register_opt.iekey << 3) | (register_opt.cptpl << 30)); + pt.buf = &data; + pt.len = sizeof(data); + pt.is_read = 0; + + if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) + err(1, "register request failed"); + + if (nvme_completion_is_error(&pt.cpl)) + errx(1, "register request returned error"); + + close(fd); + exit(0); +} + +static void +resvrelease(const struct cmd *f, int argc, char *argv[]) +{ + struct nvme_pt_command pt; + uint64_t data[1]; + int fd; + uint32_t nsid; + + if (arg_parse(argc, argv, f)) + return; + open_dev(release_opt.dev, &fd, 1, 1); + get_nsid(fd, NULL, &nsid); + if (nsid == 0) { + fprintf(stderr, "This command require namespace-id\n"); + arg_help(argc, argv, f); + } + + data[0] = htole64(release_opt.crkey); + + memset(&pt, 0, sizeof(pt)); + pt.cmd.opc = NVME_OPC_RESERVATION_RELEASE; + pt.cmd.cdw10 = htole32((release_opt.rrela & 7) | + (release_opt.rtype << 8)); + pt.buf = &data; + pt.len = sizeof(data); + pt.is_read = 0; + + if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) + err(1, "release request failed"); + + if (nvme_completion_is_error(&pt.cpl)) + errx(1, "release request returned error"); + + close(fd); + exit(0); +} + +static void +resvreport(const struct cmd *f, int argc, char *argv[]) +{ + struct nvme_pt_command pt; + struct nvme_resv_status *s; + struct nvme_resv_status_ext *e; + uint8_t data[4096]; + int fd; + u_int i, n; + uint32_t nsid; + + if (arg_parse(argc, argv, f)) + return; + open_dev(report_opt.dev, &fd, 1, 1); + get_nsid(fd, NULL, &nsid); + if (nsid == 0) { + fprintf(stderr, "This command require namespace-id\n"); + arg_help(argc, argv, f); + } + + bzero(data, sizeof(data)); + memset(&pt, 0, sizeof(pt)); + pt.cmd.opc = NVME_OPC_RESERVATION_REPORT; + pt.cmd.cdw10 = htole32(sizeof(data) / 4 - 1); + pt.cmd.cdw11 = htole32(report_opt.eds); /* EDS */ + pt.buf = &data; + pt.len = sizeof(data); + pt.is_read = 1; + + if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) + err(1, "report request failed"); + + if (nvme_completion_is_error(&pt.cpl)) + errx(1, "report request returned error"); + + close(fd); + + if (report_opt.eds) + nvme_resv_status_ext_swapbytes((void *)data, sizeof(data)); + else + nvme_resv_status_swapbytes((void *)data, sizeof(data)); + + if (report_opt.hex) { + i = sizeof(data); + if (!report_opt.verbose) { + for (; i > 64; i--) { + if (data[i - 1] != 0) + break; + } + } + print_hex(&data, i); + exit(0); + } + + s = (struct nvme_resv_status *)data; + n = (s->regctl[1] << 8) | s->regctl[0]; + printf("Generation: %u\n", s->gen); + printf("Reservation Type: %u\n", s->rtype); + printf("Number of Registered Controllers: %u\n", n); + printf("Persist Through Power Loss State: %u\n", s->ptpls); + if (report_opt.eds) { + e = (struct nvme_resv_status_ext *)data; + n = MIN(n, (sizeof(data) - sizeof(e)) / sizeof(e->ctrlr[0])); + for (i = 0; i < n; i++) { + printf("Controller ID: 0x%04x\n", + e->ctrlr[i].ctrlr_id); + printf(" Reservation Status: %u\n", + e->ctrlr[i].rcsts); + printf(" Reservation Key: 0x%08jx\n", + e->ctrlr[i].rkey); + printf(" Host Identifier: 0x%08jx%08jx\n", + e->ctrlr[i].hostid[0], e->ctrlr[i].hostid[1]); + } + } else { + n = MIN(n, (sizeof(data) - sizeof(s)) / sizeof(s->ctrlr[0])); + for (i = 0; i < n; i++) { + printf("Controller ID: 0x%04x\n", + s->ctrlr[i].ctrlr_id); + printf(" Reservation Status: %u\n", + s->ctrlr[i].rcsts); + printf(" Host Identifier: 0x%08jx\n", + s->ctrlr[i].hostid); + printf(" Reservation Key: 0x%08jx\n", + s->ctrlr[i].rkey); + } + } + exit(0); +} + +static void +resv(const struct cmd *nf __unused, int argc, char *argv[]) +{ + + cmd_dispatch(argc, argv, &resv_cmd); +} Modified: head/sbin/nvmecontrol/sanitize.c ============================================================================== --- head/sbin/nvmecontrol/sanitize.c Mon Aug 5 17:32:16 2019 (r350598) +++ head/sbin/nvmecontrol/sanitize.c Mon Aug 5 17:36:00 2019 (r350599) @@ -71,7 +71,7 @@ static const struct opts sanitize_opts[] = { #define OPT(l, s, t, opt, addr, desc) { l, s, t, &opt.addr, desc } OPT("ause", 'U', arg_none, opt, ause, "Allow Unrestricted Sanitize Exit"), - OPT("ndas", 'D', arg_none, opt, ndas, + OPT("ndas", 'd', arg_none, opt, ndas, "No Deallocate After Sanitize"), OPT("oipbp", 'I', arg_none, opt, oipbp, "Overwrite Invert Pattern Between Passes"), Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Mon Aug 5 17:32:16 2019 (r350598) +++ head/sys/dev/nvme/nvme.h Mon Aug 5 17:36:00 2019 (r350599) @@ -1401,6 +1401,56 @@ struct intel_log_temp_stats _Static_assert(sizeof(struct intel_log_temp_stats) == 13 * 8, "bad size for intel_log_temp_stats"); +struct nvme_resv_reg_ctrlr +{ + uint16_t ctrlr_id; /* Controller ID */ + uint8_t rcsts; /* Reservation Status */ + uint8_t reserved3[5]; + uint64_t hostid; /* Host Identifier */ + uint64_t rkey; /* Reservation Key */ +} __packed __aligned(4); + +_Static_assert(sizeof(struct nvme_resv_reg_ctrlr) == 24, "bad size for nvme_resv_reg_ctrlr"); + +struct nvme_resv_reg_ctrlr_ext +{ + uint16_t ctrlr_id; /* Controller ID */ + uint8_t rcsts; /* Reservation Status */ + uint8_t reserved3[5]; + uint64_t rkey; /* Reservation Key */ + uint64_t hostid[2]; /* Host Identifier */ + uint8_t reserved32[32]; +} __packed __aligned(4); + +_Static_assert(sizeof(struct nvme_resv_reg_ctrlr_ext) == 64, "bad size for nvme_resv_reg_ctrlr_ext"); + +struct nvme_resv_status +{ + uint32_t gen; /* Generation */ + uint8_t rtype; /* Reservation Type */ + uint8_t regctl[2]; /* Number of Registered Controllers */ + uint8_t reserved7[2]; + uint8_t ptpls; /* Persist Through Power Loss State */ + uint8_t reserved10[14]; + struct nvme_resv_reg_ctrlr ctrlr[0]; +} __packed __aligned(4); + +_Static_assert(sizeof(struct nvme_resv_status) == 24, "bad size for nvme_resv_status"); + +struct nvme_resv_status_ext +{ + uint32_t gen; /* Generation */ + uint8_t rtype; /* Reservation Type */ + uint8_t regctl[2]; /* Number of Registered Controllers */ + uint8_t reserved7[2]; + uint8_t ptpls; /* Persist Through Power Loss State */ + uint8_t reserved10[14]; + uint8_t reserved24[40]; + struct nvme_resv_reg_ctrlr_ext ctrlr[0]; +} __packed __aligned(4); + +_Static_assert(sizeof(struct nvme_resv_status_ext) == 64, "bad size for nvme_resv_status_ext"); + #define NVME_TEST_MAX_THREADS 128 struct nvme_io_test { @@ -1859,6 +1909,36 @@ void intel_log_temp_stats_swapbytes(struct intel_log_t s->max_oper_temp = le64toh(s->max_oper_temp); s->min_oper_temp = le64toh(s->min_oper_temp); s->est_offset = le64toh(s->est_offset); +} + +static inline +void nvme_resv_status_swapbytes(struct nvme_resv_status *s, size_t size) +{ + u_int i, n; + + s->gen = le32toh(s->gen); + n = (s->regctl[1] << 8) | s->regctl[0]; + n = MIN(n, (size - sizeof(s)) / sizeof(s->ctrlr[0])); + for (i = 0; i < n; i++) { + s->ctrlr[i].ctrlr_id = le16toh(s->ctrlr[i].ctrlr_id); + s->ctrlr[i].hostid = le64toh(s->ctrlr[i].hostid); + s->ctrlr[i].rkey = le64toh(s->ctrlr[i].rkey); + } +} + +static inline +void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s, size_t size) +{ + u_int i, n; + + s->gen = le32toh(s->gen); + n = (s->regctl[1] << 8) | s->regctl[0]; + n = MIN(n, (size - sizeof(s)) / sizeof(s->ctrlr[0])); + for (i = 0; i < n; i++) { + s->ctrlr[i].ctrlr_id = le16toh(s->ctrlr[i].ctrlr_id); + s->ctrlr[i].rkey = le64toh(s->ctrlr[i].rkey); + nvme_le128toh((void *)s->ctrlr[i].hostid); + } } #endif /* __NVME_H__ */ From owner-svn-src-head@freebsd.org Mon Aug 5 19:16:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC57FAADCA; Mon, 5 Aug 2019 19:16:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462SDf457rz45Kc; Mon, 5 Aug 2019 19:16:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69AEB20587; Mon, 5 Aug 2019 19:16:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x75JGYCO051758; Mon, 5 Aug 2019 19:16:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x75JGYcS051757; Mon, 5 Aug 2019 19:16:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908051916.x75JGYcS051757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 5 Aug 2019 19:16:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350607 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 350607 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 19:16:34 -0000 Author: kib Date: Mon Aug 5 19:16:33 2019 New Revision: 350607 URL: https://svnweb.freebsd.org/changeset/base/350607 Log: Fix mis-merge Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/kern_exec.c Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Mon Aug 5 18:59:53 2019 (r350606) +++ head/sys/kern/kern_exec.c Mon Aug 5 19:16:33 2019 (r350607) @@ -1128,7 +1128,9 @@ exec_new_vmspace(struct image_params *imgp, struct sys } else { ssiz = maxssiz; } - imgp->eff_stack_sz = ssiz; + imgp->eff_stack_sz = lim_cur(curthread, RLIMIT_STACK); + if (ssiz < imgp->eff_stack_sz) + imgp->eff_stack_sz = ssiz; stack_addr = sv->sv_usrstack - ssiz; error = vm_map_stack(map, stack_addr, (vm_size_t)ssiz, obj != NULL && imgp->stack_prot != 0 ? imgp->stack_prot : From owner-svn-src-head@freebsd.org Mon Aug 5 19:19:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 00D10AAEC9; Mon, 5 Aug 2019 19:19:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 462SHm6FTwz45cx; Mon, 5 Aug 2019 19:19:16 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x75JJ1bP021224 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 5 Aug 2019 22:19:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x75JJ1bP021224 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x75JJ10f021223; Mon, 5 Aug 2019 22:19:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 5 Aug 2019 22:19:01 +0300 From: Konstantin Belousov To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r350607 - head/sys/kern Message-ID: <20190805191901.GB2731@kib.kiev.ua> References: <201908051916.x75JGYcS051757@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201908051916.x75JGYcS051757@repo.freebsd.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 462SHm6FTwz45cx X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-1.99 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.991,0]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; TO_DN_NONE(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; IP_SCORE_FREEMAIL(0.00)[]; IP_SCORE(0.00)[ip: (-2.52), ipnet: 2001:470::/32(-4.51), asn: 6939(-2.90), country: US(-0.05)]; NEURAL_HAM_SHORT(-1.00)[-0.997,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 19:19:18 -0000 On Mon, Aug 05, 2019 at 07:16:34PM +0000, Konstantin Belousov wrote: > Author: kib > Date: Mon Aug 5 19:16:33 2019 > New Revision: 350607 > URL: https://svnweb.freebsd.org/changeset/base/350607 > > Log: > Fix mis-merge This should have been: Account for the stack limit when calculating effective stack size. > > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > > Modified: > head/sys/kern/kern_exec.c > > Modified: head/sys/kern/kern_exec.c > ============================================================================== > --- head/sys/kern/kern_exec.c Mon Aug 5 18:59:53 2019 (r350606) > +++ head/sys/kern/kern_exec.c Mon Aug 5 19:16:33 2019 (r350607) > @@ -1128,7 +1128,9 @@ exec_new_vmspace(struct image_params *imgp, struct sys > } else { > ssiz = maxssiz; > } > - imgp->eff_stack_sz = ssiz; > + imgp->eff_stack_sz = lim_cur(curthread, RLIMIT_STACK); > + if (ssiz < imgp->eff_stack_sz) > + imgp->eff_stack_sz = ssiz; > stack_addr = sv->sv_usrstack - ssiz; > error = vm_map_stack(map, stack_addr, (vm_size_t)ssiz, > obj != NULL && imgp->stack_prot != 0 ? imgp->stack_prot : From owner-svn-src-head@freebsd.org Mon Aug 5 19:19:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3E8FAAECC; Mon, 5 Aug 2019 19:19:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462SHx6Cblz45j9; Mon, 5 Aug 2019 19:19:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B79FD2058B; Mon, 5 Aug 2019 19:19:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x75JJPse052320; Mon, 5 Aug 2019 19:19:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x75JJPPO052319; Mon, 5 Aug 2019 19:19:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908051919.x75JJPPO052319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 5 Aug 2019 19:19:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350608 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 350608 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 19:19:26 -0000 Author: kib Date: Mon Aug 5 19:19:25 2019 New Revision: 350608 URL: https://svnweb.freebsd.org/changeset/base/350608 Log: Fix mis-merge. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Mon Aug 5 19:16:33 2019 (r350607) +++ head/sys/kern/imgact_elf.c Mon Aug 5 19:19:25 2019 (r350608) @@ -2741,7 +2741,6 @@ __elfN(stackgap)(struct image_params *imgp, u_long *st if (pct > 50) pct = 50; range = imgp->eff_stack_sz * pct / 100; - range *= pct; arc4rand(&rbase, sizeof(rbase), 0); gap = rbase % range; gap &= ~(sizeof(u_long) - 1); From owner-svn-src-head@freebsd.org Mon Aug 5 19:30:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3DD4FAB562; Mon, 5 Aug 2019 19:30:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462SXj0m8vz46mj; Mon, 5 Aug 2019 19:30:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF9C020755; Mon, 5 Aug 2019 19:30:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x75JUSma058609; Mon, 5 Aug 2019 19:30:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x75JUSr2058608; Mon, 5 Aug 2019 19:30:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908051930.x75JUSr2058608@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 5 Aug 2019 19:30:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350609 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 350609 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 19:30:29 -0000 Author: mav Date: Mon Aug 5 19:30:28 2019 New Revision: 350609 URL: https://svnweb.freebsd.org/changeset/base/350609 Log: Fix alignment issue r350599. MFC after: 10 days Modified: head/sbin/nvmecontrol/resv.c Modified: head/sbin/nvmecontrol/resv.c ============================================================================== --- head/sbin/nvmecontrol/resv.c Mon Aug 5 19:19:25 2019 (r350608) +++ head/sbin/nvmecontrol/resv.c Mon Aug 5 19:30:28 2019 (r350609) @@ -351,7 +351,7 @@ resvreport(const struct cmd *f, int argc, char *argv[] struct nvme_pt_command pt; struct nvme_resv_status *s; struct nvme_resv_status_ext *e; - uint8_t data[4096]; + uint8_t data[4096] __aligned(4); int fd; u_int i, n; uint32_t nsid; From owner-svn-src-head@freebsd.org Mon Aug 5 19:59:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D47FFABCE9; Mon, 5 Aug 2019 19:59:23 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462TB35GFDz486P; Mon, 5 Aug 2019 19:59:23 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9652420CA3; Mon, 5 Aug 2019 19:59:23 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x75JxNg5076486; Mon, 5 Aug 2019 19:59:23 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x75JxNIm076485; Mon, 5 Aug 2019 19:59:23 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201908051959.x75JxNIm076485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Mon, 5 Aug 2019 19:59:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350610 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 350610 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 19:59:23 -0000 Author: oshogbo Date: Mon Aug 5 19:59:23 2019 New Revision: 350610 URL: https://svnweb.freebsd.org/changeset/base/350610 Log: exit1: postpone clearing P_TRACED flag until the proctree lock is acquired In case of the process being debugged. The P_TRACED is cleared very early, which would make procdesc_close() not calling proc_clear_orphan(). That would result in the debugged process can not be able to collect status of the process with process descriptor. Reviewed by: markj, kib Tested by: pho MFC after: 1 month Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Mon Aug 5 19:30:28 2019 (r350609) +++ head/sys/kern/kern_exit.c Mon Aug 5 19:59:23 2019 (r350610) @@ -355,7 +355,6 @@ exit1(struct thread *td, int rval, int signo) */ PROC_LOCK(p); stopprofclock(p); - p->p_flag &= ~(P_TRACED | P_PPWAIT | P_PPTRACE); p->p_ptevents = 0; /* @@ -458,6 +457,9 @@ exit1(struct thread *td, int rval, int signo) sx_xunlock(&allproc_lock); sx_xlock(&proctree_lock); + PROC_LOCK(p); + p->p_flag &= ~(P_TRACED | P_PPWAIT | P_PPTRACE); + PROC_UNLOCK(p); /* * Reparent all children processes: From owner-svn-src-head@freebsd.org Mon Aug 5 20:11:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F688AC258; Mon, 5 Aug 2019 20:11:58 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462TSZ13JQz4962; Mon, 5 Aug 2019 20:11:58 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 05C1C20FF0; Mon, 5 Aug 2019 20:11:58 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x75KBvCd087717; Mon, 5 Aug 2019 20:11:57 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x75KBvot087715; Mon, 5 Aug 2019 20:11:57 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201908052011.x75KBvot087715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Mon, 5 Aug 2019 20:11:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350611 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 350611 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 20:11:58 -0000 Author: oshogbo Date: Mon Aug 5 20:11:57 2019 New Revision: 350611 URL: https://svnweb.freebsd.org/changeset/base/350611 Log: proc: introduce the proc_add_orphan function This API allows adding the process to its parent orphan list. Reviewed by: kib, markj MFC after: 1 month Modified: head/sys/kern/kern_exit.c head/sys/sys/proc.h Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Mon Aug 5 19:59:23 2019 (r350610) +++ head/sys/kern/kern_exit.c Mon Aug 5 20:11:57 2019 (r350611) @@ -1355,6 +1355,24 @@ loop_locked: goto loop; } +void +proc_add_orphan(struct proc *child, struct proc *parent) +{ + + sx_assert(&proctree_lock, SX_XLOCKED); + KASSERT((child->p_flag & P_TRACED) != 0, + ("proc_add_orphan: not traced")); + + if (LIST_EMPTY(&parent->p_orphans)) { + child->p_treeflag |= P_TREE_FIRST_ORPHAN; + LIST_INSERT_HEAD(&parent->p_orphans, child, p_orphan); + } else { + LIST_INSERT_AFTER(LIST_FIRST(&parent->p_orphans), + child, p_orphan); + } + child->p_treeflag |= P_TREE_ORPHANED; +} + /* * Make process 'parent' the new parent of process 'child'. * Must be called with an exclusive hold of proctree lock. @@ -1375,16 +1393,8 @@ proc_reparent(struct proc *child, struct proc *parent, LIST_INSERT_HEAD(&parent->p_children, child, p_sibling); proc_clear_orphan(child); - if (child->p_flag & P_TRACED) { - if (LIST_EMPTY(&child->p_pptr->p_orphans)) { - child->p_treeflag |= P_TREE_FIRST_ORPHAN; - LIST_INSERT_HEAD(&child->p_pptr->p_orphans, child, - p_orphan); - } else { - LIST_INSERT_AFTER(LIST_FIRST(&child->p_pptr->p_orphans), - child, p_orphan); - } - child->p_treeflag |= P_TREE_ORPHANED; + if ((child->p_flag & P_TRACED) != 0) { + proc_add_orphan(child, child->p_pptr); } child->p_pptr = parent; Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Mon Aug 5 19:59:23 2019 (r350610) +++ head/sys/sys/proc.h Mon Aug 5 20:11:57 2019 (r350611) @@ -1069,6 +1069,7 @@ void proc_linkup(struct proc *p, struct thread *td); struct proc *proc_realparent(struct proc *child); void proc_reap(struct thread *td, struct proc *p, int *status, int options); void proc_reparent(struct proc *child, struct proc *newparent, bool set_oppid); +void proc_add_orphan(struct proc *child, struct proc *parent); void proc_set_traced(struct proc *p, bool stop); void proc_wkilled(struct proc *p); struct pstats *pstats_alloc(void); From owner-svn-src-head@freebsd.org Mon Aug 5 20:15:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B402AC3CC; Mon, 5 Aug 2019 20:15:47 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462TXy6zWcz49Js; Mon, 5 Aug 2019 20:15:46 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD0412102E; Mon, 5 Aug 2019 20:15:46 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x75KFkjD088669; Mon, 5 Aug 2019 20:15:46 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x75KFk2R088667; Mon, 5 Aug 2019 20:15:46 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201908052015.x75KFk2R088667@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Mon, 5 Aug 2019 20:15:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350612 - in head: sys/kern tests/sys/kern X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: in head: sys/kern tests/sys/kern X-SVN-Commit-Revision: 350612 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 20:15:47 -0000 Author: oshogbo Date: Mon Aug 5 20:15:46 2019 New Revision: 350612 URL: https://svnweb.freebsd.org/changeset/base/350612 Log: procdesc: fix reparenting when the debugger is attached The process is reparented to the debugger while it is attached. B B / ----> | A A D Every time when the process is reparented, it is added to the orphan list of the previous parent: A->orphan = B D->orphan = NULL When the A process will close the process descriptor to the B process, the B process will be reparented to the init process. B B - init | ----> A D A D A->orphan = B D->orphan = B In this scenario, the B process is in the orphan list of A and D. When the last process descriptor is closed instead of reparenting it to the reaper let it stay with the debugger process and set our previews parent to the reaper. Add test case for this situation. Notice that without this patch the kernel will crash with this test case: panic: orphan 0xfffff8000e990530 of 0xfffff8000e990000 has unexpected oppid 1 Reviewed by: markj, kib MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D20361 Modified: head/sys/kern/sys_procdesc.c head/tests/sys/kern/ptrace_test.c Modified: head/sys/kern/sys_procdesc.c ============================================================================== --- head/sys/kern/sys_procdesc.c Mon Aug 5 20:11:57 2019 (r350611) +++ head/sys/kern/sys_procdesc.c Mon Aug 5 20:15:46 2019 (r350612) @@ -416,7 +416,13 @@ procdesc_close(struct file *fp, struct thread *td) * terminate with prejudice. */ p->p_sigparent = SIGCHLD; - proc_reparent(p, p->p_reaper, true); + if ((p->p_flag & P_TRACED) == 0) { + proc_reparent(p, p->p_reaper, true); + } else { + clear_orphan(p); + p->p_oppid = p->p_reaper->p_pid; + proc_add_orphan(p, p->p_reaper); + } if ((pd->pd_flags & PDF_DAEMON) == 0) kern_psignal(p, SIGKILL); PROC_UNLOCK(p); Modified: head/tests/sys/kern/ptrace_test.c ============================================================================== --- head/tests/sys/kern/ptrace_test.c Mon Aug 5 20:11:57 2019 (r350611) +++ head/tests/sys/kern/ptrace_test.c Mon Aug 5 20:15:46 2019 (r350612) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -4075,6 +4076,60 @@ ATF_TC_BODY(ptrace__syscall_args, tc) ATF_REQUIRE(errno == ECHILD); } +/* + * Verify that when the process is traced that it isn't reparent + * to the init process when we close all process descriptors. + */ +ATF_TC(ptrace__proc_reparent); +ATF_TC_HEAD(ptrace__proc_reparent, tc) +{ + + atf_tc_set_md_var(tc, "timeout", "2"); +} +ATF_TC_BODY(ptrace__proc_reparent, tc) +{ + pid_t traced, debuger, wpid; + int pd, status; + + traced = pdfork(&pd, 0); + ATF_REQUIRE(traced >= 0); + if (traced == 0) { + raise(SIGSTOP); + exit(0); + } + ATF_REQUIRE(pd >= 0); + + debuger = fork(); + ATF_REQUIRE(debuger >= 0); + if (debuger == 0) { + /* The traced process is reparented to debuger. */ + ATF_REQUIRE(ptrace(PT_ATTACH, traced, 0, 0) == 0); + wpid = waitpid(traced, &status, 0); + ATF_REQUIRE(wpid == traced); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + ATF_REQUIRE(close(pd) == 0); + ATF_REQUIRE(ptrace(PT_DETACH, traced, (caddr_t)1, 0) == 0); + + /* We closed pd so we should not have any child. */ + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); + + exit(0); + } + + ATF_REQUIRE(close(pd) == 0); + wpid = waitpid(debuger, &status, 0); + ATF_REQUIRE(wpid == debuger); + ATF_REQUIRE(WEXITSTATUS(status) == 0); + + /* Check if we still have any child. */ + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} + ATF_TP_ADD_TCS(tp) { @@ -4137,6 +4192,7 @@ ATF_TP_ADD_TCS(tp) #endif ATF_TP_ADD_TC(tp, ptrace__PT_LWPINFO_stale_siginfo); ATF_TP_ADD_TC(tp, ptrace__syscall_args); + ATF_TP_ADD_TC(tp, ptrace__proc_reparent); return (atf_no_error()); } From owner-svn-src-head@freebsd.org Mon Aug 5 20:20:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BA5AAC4D1; Mon, 5 Aug 2019 20:20:15 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462Tf70ky2z49bg; Mon, 5 Aug 2019 20:20:15 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF1E321044; Mon, 5 Aug 2019 20:20:14 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x75KKERG089043; Mon, 5 Aug 2019 20:20:14 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x75KKElk089042; Mon, 5 Aug 2019 20:20:14 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201908052020.x75KKElk089042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Mon, 5 Aug 2019 20:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350614 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 350614 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 20:20:15 -0000 Author: oshogbo Date: Mon Aug 5 20:20:14 2019 New Revision: 350614 URL: https://svnweb.freebsd.org/changeset/base/350614 Log: exit1: fix style nits MFC after: 1 month Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Mon Aug 5 20:19:38 2019 (r350613) +++ head/sys/kern/kern_exit.c Mon Aug 5 20:20:14 2019 (r350614) @@ -475,7 +475,7 @@ exit1(struct thread *td, int rval, int signo) PROC_LOCK(q); q->p_sigparent = SIGCHLD; - if (!(q->p_flag & P_TRACED)) { + if ((q->p_flag & P_TRACED) == 0) { proc_reparent(q, q->p_reaper, true); if (q->p_state == PRS_ZOMBIE) { /* From owner-svn-src-head@freebsd.org Mon Aug 5 20:26:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0991AC8A3; Mon, 5 Aug 2019 20:26:01 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462Tmn67tPz4BXN; Mon, 5 Aug 2019 20:26:01 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5AC22121D; Mon, 5 Aug 2019 20:26:01 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x75KQ1AE094796; Mon, 5 Aug 2019 20:26:01 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x75KQ1UU094795; Mon, 5 Aug 2019 20:26:01 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201908052026.x75KQ1UU094795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Mon, 5 Aug 2019 20:26:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350616 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 350616 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 20:26:02 -0000 Author: oshogbo Date: Mon Aug 5 20:26:01 2019 New Revision: 350616 URL: https://svnweb.freebsd.org/changeset/base/350616 Log: process: style We don't need to check if the parent is already set. This is done already in the proc_reparent. No functional behaviour changes intended. MFC after: 1 month Modified: head/sys/kern/sys_process.c Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Mon Aug 5 20:21:35 2019 (r350615) +++ head/sys/kern/sys_process.c Mon Aug 5 20:26:01 2019 (r350616) @@ -958,9 +958,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi * on a "detach". */ proc_set_traced(p, true); - if (p->p_pptr != td->td_proc) { - proc_reparent(p, td->td_proc, false); - } + proc_reparent(p, td->td_proc, false); CTR2(KTR_PTRACE, "PT_ATTACH: pid %d, oppid %d", p->p_pid, p->p_oppid); @@ -1109,7 +1107,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi p->p_pid, psr->sr_error, psr->sr_retval[0], psr->sr_retval[1]); break; - + case PT_STEP: case PT_CONTINUE: case PT_TO_SCE: @@ -1219,8 +1217,8 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi sendsig: MPASS(proctree_locked == 0); - - /* + + /* * Clear the pending event for the thread that just * reported its event (p_xthread). This may not be * the thread passed to PT_CONTINUE, PT_STEP, etc. if From owner-svn-src-head@freebsd.org Mon Aug 5 20:31:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7DF8DACED6; Mon, 5 Aug 2019 20:31:18 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462Ttt2pZsz4C9R; Mon, 5 Aug 2019 20:31:18 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 420D02136D; Mon, 5 Aug 2019 20:31:18 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x75KVIQj098445; Mon, 5 Aug 2019 20:31:18 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x75KVIO4098444; Mon, 5 Aug 2019 20:31:18 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201908052031.x75KVIO4098444@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Mon, 5 Aug 2019 20:31:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350617 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 350617 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 20:31:18 -0000 Author: oshogbo Date: Mon Aug 5 20:31:17 2019 New Revision: 350617 URL: https://svnweb.freebsd.org/changeset/base/350617 Log: procdesc: fix the function name I changed name of the function r350429 and forgot to update the r350612 patch. Reported by: jenkins MFC after: 1 month Modified: head/sys/kern/sys_procdesc.c Modified: head/sys/kern/sys_procdesc.c ============================================================================== --- head/sys/kern/sys_procdesc.c Mon Aug 5 20:26:01 2019 (r350616) +++ head/sys/kern/sys_procdesc.c Mon Aug 5 20:31:17 2019 (r350617) @@ -419,7 +419,7 @@ procdesc_close(struct file *fp, struct thread *td) if ((p->p_flag & P_TRACED) == 0) { proc_reparent(p, p->p_reaper, true); } else { - clear_orphan(p); + proc_clear_orphan(p); p->p_oppid = p->p_reaper->p_pid; proc_add_orphan(p, p->p_reaper); } From owner-svn-src-head@freebsd.org Mon Aug 5 21:39:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E36D1AE3B7; Mon, 5 Aug 2019 21:39:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462WQ34WM6z4Gfb; Mon, 5 Aug 2019 21:39:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 779F421EBC; Mon, 5 Aug 2019 21:39:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x75LdtjP037379; Mon, 5 Aug 2019 21:39:55 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x75Ldtph037378; Mon, 5 Aug 2019 21:39:55 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201908052139.x75Ldtph037378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 5 Aug 2019 21:39:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350618 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 350618 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 21:39:56 -0000 Author: jhb Date: Mon Aug 5 21:39:55 2019 New Revision: 350618 URL: https://svnweb.freebsd.org/changeset/base/350618 Log: Validate guest-supplied length of headers for TSO transmit requests. When transmitting a large TCP packet, the final transmit descriptor includes the length of the protocol headers to be duplicated on each segment. The device model was trusting the guest-supplied value without validating it. A value of zero would result in the guest being able to indirect a garbage pointer on the stack to overwrite arbitrary memory in the bhyve process. A value that was non-zero but too small for the requested parameters resulted in the device model reading and writing values beyond the end of the on-stack buffer used to hold the template header. To fix, validate the supplied length and drop requests to transmit packets that would overflow the header buffer. While here, initialize the header pointer to NULL as a preventive measure so that any access to an unallocated template header crashes they hypervisor deterministically. While here, only read the TCP sequence number if the packet being split is a TCP packet. The e1000 logic supports a segmentation of UDP frames, and while UDP segmentation requires this part of the header to be valid (so there is no buffer overflow), only reading the field when needed is cleaner. admbugs: 918 Reported by: Reno Robert Reviewed by: markj Approved by: so Security: CVE-2019-5609 Modified: head/usr.sbin/bhyve/pci_e82545.c Modified: head/usr.sbin/bhyve/pci_e82545.c ============================================================================== --- head/usr.sbin/bhyve/pci_e82545.c Mon Aug 5 20:31:17 2019 (r350617) +++ head/usr.sbin/bhyve/pci_e82545.c Mon Aug 5 21:39:55 2019 (r350618) @@ -1080,8 +1080,9 @@ e82545_transmit(struct e82545_softc *sc, uint16_t head struct ck_info ckinfo[2]; struct iovec *iov; union e1000_tx_udesc *dsc; - int desc, dtype, len, ntype, iovcnt, tlen, hdrlen, vlen, tcp, tso; + int desc, dtype, len, ntype, iovcnt, tlen, tcp, tso; int mss, paylen, seg, tiovcnt, left, now, nleft, nnow, pv, pvoff; + unsigned hdrlen, vlen; uint32_t tcpsum, tcpseq; uint16_t ipcs, tcpcs, ipid, ohead; @@ -1225,6 +1226,68 @@ e82545_transmit(struct e82545_softc *sc, uint16_t head } else { /* In case of TSO header length provided by software. */ hdrlen = sc->esc_txctx.tcp_seg_setup.fields.hdr_len; + + /* + * Cap the header length at 240 based on 7.2.4.5 of + * the Intel 82576EB (Rev 2.63) datasheet. + */ + if (hdrlen > 240) { + WPRINTF("TSO hdrlen too large: %d\r\n", hdrlen); + goto done; + } + + /* + * If VLAN insertion is requested, ensure the header + * at least holds the amount of data copied during + * VLAN insertion below. + * + * XXX: Realistic packets will include a full Ethernet + * header before the IP header at ckinfo[0].ck_start, + * but this check is sufficient to prevent + * out-of-bounds access below. + */ + if (vlen != 0 && hdrlen < ETHER_ADDR_LEN*2) { + WPRINTF("TSO hdrlen too small for vlan insertion " + "(%d vs %d) -- dropped\r\n", hdrlen, + ETHER_ADDR_LEN*2); + goto done; + } + + /* + * Ensure that the header length covers the used fields + * in the IP and TCP headers as well as the IP and TCP + * checksums. The following fields are accessed below: + * + * Header | Field | Offset | Length + * -------+-------+--------+------- + * IPv4 | len | 2 | 2 + * IPv4 | ID | 4 | 2 + * IPv6 | len | 4 | 2 + * TCP | seq # | 4 | 4 + * TCP | flags | 13 | 1 + * UDP | len | 4 | 4 + */ + if (hdrlen < ckinfo[0].ck_start + 6 || + hdrlen < ckinfo[0].ck_off + 2) { + WPRINTF("TSO hdrlen too small for IP fields (%d) " + "-- dropped\r\n", hdrlen); + goto done; + } + if (sc->esc_txctx.cmd_and_length & E1000_TXD_CMD_TCP) { + if (hdrlen < ckinfo[1].ck_start + 14 || + (ckinfo[1].ck_valid && + hdrlen < ckinfo[1].ck_off + 2)) { + WPRINTF("TSO hdrlen too small for TCP fields " + "(%d) -- dropped\r\n", hdrlen); + goto done; + } + } else { + if (hdrlen < ckinfo[1].ck_start + 8) { + WPRINTF("TSO hdrlen too small for UDP fields " + "(%d) -- dropped\r\n", hdrlen); + goto done; + } + } } /* Allocate, fill and prepend writable header vector. */ @@ -1246,7 +1309,8 @@ e82545_transmit(struct e82545_softc *sc, uint16_t head iovcnt++; iov->iov_base = hdr; iov->iov_len = hdrlen; - } + } else + hdr = NULL; /* Insert VLAN tag. */ if (vlen != 0) { @@ -1288,7 +1352,9 @@ e82545_transmit(struct e82545_softc *sc, uint16_t head DPRINTF("tx %s segmentation offload %d+%d/%d bytes %d iovs\r\n", tcp ? "TCP" : "UDP", hdrlen, paylen, mss, iovcnt); ipid = ntohs(*(uint16_t *)&hdr[ckinfo[0].ck_start + 4]); - tcpseq = ntohl(*(uint32_t *)&hdr[ckinfo[1].ck_start + 4]); + tcpseq = 0; + if (tcp) + tcpseq = ntohl(*(uint32_t *)&hdr[ckinfo[1].ck_start + 4]); ipcs = *(uint16_t *)&hdr[ckinfo[0].ck_off]; tcpcs = 0; if (ckinfo[1].ck_valid) /* Save partial pseudo-header checksum. */ From owner-svn-src-head@freebsd.org Mon Aug 5 22:59:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01491AFD58; Mon, 5 Aug 2019 22:59:36 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462Y9z6HPcz4LPp; Mon, 5 Aug 2019 22:59:35 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B52B422CFB; Mon, 5 Aug 2019 22:59:35 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x75MxZgH084702; Mon, 5 Aug 2019 22:59:35 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x75MxZ6U084701; Mon, 5 Aug 2019 22:59:35 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201908052259.x75MxZ6U084701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Mon, 5 Aug 2019 22:59:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350620 - head/contrib/netbsd-tests/lib/libpthread X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/contrib/netbsd-tests/lib/libpthread X-SVN-Commit-Revision: 350620 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2019 22:59:36 -0000 Author: vangyzen Date: Mon Aug 5 22:59:35 2019 New Revision: 350620 URL: https://svnweb.freebsd.org/changeset/base/350620 Log: Relax time constraint in pthread_cond_timedwait unit test pthread_cond_timedwait() should wait _at least_ until the timeout, but it might appear to wait longer due to system activity and scheduling. The test ignored fractional seconds when comparing the actual and expected timeouts, so it allowed anywhere between zero and one extra second of wait time. Zero is a bit unreasonable. Compare fractional seconds so we always allow up to one extra second. Reviewed by: ngie MFC after: 1 week Sponsored by: Dell EMC Isilon Modified: head/contrib/netbsd-tests/lib/libpthread/t_condwait.c Modified: head/contrib/netbsd-tests/lib/libpthread/t_condwait.c ============================================================================== --- head/contrib/netbsd-tests/lib/libpthread/t_condwait.c Mon Aug 5 22:04:16 2019 (r350619) +++ head/contrib/netbsd-tests/lib/libpthread/t_condwait.c Mon Aug 5 22:59:35 2019 (r350620) @@ -51,6 +51,9 @@ static void * run(void *param) { struct timespec ts, to, te; +#ifdef __FreeBSD__ + struct timespec tw; +#endif clockid_t clck; pthread_condattr_t attr; pthread_cond_t cond; @@ -91,7 +94,15 @@ run(void *param) /* Loose upper limit because of qemu timing bugs */ ATF_REQUIRE(to_seconds < WAITTIME * 2.5); } else { +#ifdef __FreeBSD__ + tw.tv_sec = WAITTIME; + tw.tv_nsec = 0; + ATF_REQUIRE(timespeccmp(&to, &tw, >=)); + tw.tv_sec++; + ATF_REQUIRE(timespeccmp(&to, &tw, <=)); +#else ATF_REQUIRE_EQ(to.tv_sec, WAITTIME); +#endif } break; default: From owner-svn-src-head@freebsd.org Tue Aug 6 01:13:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EAFA0B1FE3; Tue, 6 Aug 2019 01:13:20 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 462c8J54gQz4S1d; Tue, 6 Aug 2019 01:13:20 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id x761DIqh017377 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 5 Aug 2019 18:13:18 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x761DHRA017376; Mon, 5 Aug 2019 18:13:18 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Mon, 5 Aug 2019 18:13:17 -0700 From: Gleb Smirnoff To: Cy Schubert Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349929 - head/sys/contrib/ipfilter/netinet Message-ID: <20190806011317.GG1398@FreeBSD.org> References: <201907120159.x6C1x9go013298@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201907120159.x6C1x9go013298@repo.freebsd.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-Rspamd-Queue-Id: 462c8J54gQz4S1d X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.38 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.85)[-0.853,0]; NEURAL_HAM_SHORT(-0.53)[-0.525,0]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 01:13:21 -0000 Hi, On Fri, Jul 12, 2019 at 01:59:09AM +0000, Cy Schubert wrote: C> Log: C> Move the new ipf_pcksum6() function from ip_fil_freebsd.c to fil.c. C> The reason for this is that ipftest(8), which still works on FreeBSD-11, C> fails to link to it, breaking stable/11 builds. C> C> ipftest(8) was broken (segfault) sometime during the FreeBSD-12 cycle. C> glebius@ suggested we disable building it until I can get around to C> fixing it. Hence this was not caught in -current. C> C> The intention is to fix ipftest(8) as it is used by the netbsd-tests C> (imported by ngie@ many moons ago) for regression testing. AFAIR, maintaining ipftest always was a PITA, as it wants to compile lots of kernel code into a userland utility. Of course, once disabled it will bitrot very quickly. I'd suggest to achive functionality of ipftest in a different way. Add a new ioctl() to the pfil(9), that will read a packet from the userland and match it against a given pfil head and report the result. This will make a universal tool for packet against ruleset checking for all existing firewalls, including ipfw and pf. Let's call it pfiltest utility. It can also be a part of existing pfilctl, invoked as "pfilctl test". The second missing bit of functionality is that ipftest can test against not the running ruleset, but some other ruleset. This can be achieved by adding multiple ruleset feature into existing firewalls. The pfil(9) already has notion of ruleset names, but so far ipfw, pf and ipf provide only "default". Once a firewall is able to make alternative rulesets, we can match this functionality: ipftest would install temporary ruleset, don't connect it to any head, run the new ioctl() on it, then destroy the ruleset. I'm sorry to come with a suggestion but can't contribute any time into it. -- Gleb Smirnoff From owner-svn-src-head@freebsd.org Tue Aug 6 02:06:56 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3B64CB2EAC; Tue, 6 Aug 2019 02:06:56 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 462dL64xx4z4Tpl; Tue, 6 Aug 2019 02:06:54 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id uosDhsCgsSrVcuosEhgkXV; Mon, 05 Aug 2019 20:06:51 -0600 X-Authority-Analysis: v=2.3 cv=L5ZjvNb8 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=FmdZ9Uzk2mMA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=ZkAF0KX_x8muuJWAYVIA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id EA3771E8; Mon, 5 Aug 2019 19:06:48 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x7626mIc053398; Mon, 5 Aug 2019 19:06:48 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x7626mkb053395; Mon, 5 Aug 2019 19:06:48 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201908060206.x7626mkb053395@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Gleb Smirnoff cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349929 - head/sys/contrib/ipfilter/netinet In-reply-to: <20190806011317.GG1398@FreeBSD.org> References: <201907120159.x6C1x9go013298@repo.freebsd.org> <20190806011317.GG1398@FreeBSD.org> Comments: In-reply-to Gleb Smirnoff message dated "Mon, 05 Aug 2019 18:13:17 -0700." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 05 Aug 2019 19:06:48 -0700 X-CMAE-Envelope: MS4wfMNMasMsZncm6imcKeyvj8GbMMulbgvhoy4z6xSN81gtn/BFI+DDuKZ7JCDj8XyZcMs84veR4U1m5OpMad8hIHa5De9wNsSjPswBjiVdLsz/k5gaSPAR CzdVr+vQG2joYyIFcnlGFLbL0gaDMYwXIv52xJnCkJ6jzlZ+1eu7uU2DzVWwyWdne1uwm60dyj3KDm1R4BCXCqujCwNw5OUtYKFyHsDi4FGwHiOn3QVBi5hg E9okz9f0kj5I3xjAn8/GWDwxec8DDPVG9BnATEBiizFq+udHY4QJHqZu0SYmG0a9DlrwESIUrvAInsqCPX2jPQ== X-Rspamd-Queue-Id: 462dL64xx4z4Tpl X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.136.139) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-3.90 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; IP_SCORE(-2.30)[ip: (-5.76), ipnet: 64.59.128.0/20(-3.18), asn: 6327(-2.48), country: CA(-0.09)]; NEURAL_HAM_SHORT(-1.00)[-0.999,0]; RCVD_IN_DNSWL_NONE(0.00)[139.136.59.64.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 02:06:56 -0000 In message <20190806011317.GG1398@FreeBSD.org>, Gleb Smirnoff writes: > Hi, > > On Fri, Jul 12, 2019 at 01:59:09AM +0000, Cy Schubert wrote: > C> Log: > C> Move the new ipf_pcksum6() function from ip_fil_freebsd.c to fil.c. > C> The reason for this is that ipftest(8), which still works on FreeBSD-11, > C> fails to link to it, breaking stable/11 builds. > C> > C> ipftest(8) was broken (segfault) sometime during the FreeBSD-12 cycle. > C> glebius@ suggested we disable building it until I can get around to > C> fixing it. Hence this was not caught in -current. > C> > C> The intention is to fix ipftest(8) as it is used by the netbsd-tests > C> (imported by ngie@ many moons ago) for regression testing. > > AFAIR, maintaining ipftest always was a PITA, as it wants to compile > lots of kernel code into a userland utility. Of course, once disabled > it will bitrot very quickly. > > I'd suggest to achive functionality of ipftest in a different way. Add > a new ioctl() to the pfil(9), that will read a packet from the userland > and match it against a given pfil head and report the result. This will > make a universal tool for packet against ruleset checking for all existing > firewalls, including ipfw and pf. Let's call it pfiltest utility. It can > also be a part of existing pfilctl, invoked as "pfilctl test". This would make firewall testing more consistent. The approach currently used by SoC project uses VNET jails. An ioctl() to inject packets into pfil(9) is intriguing. ipftest(8) uses pcap file for testing, providing serially reproducible input. OTOH, a userland utility can be rebuilt at will without affecting the running system. A person could test yet to be implemented changes without affecting the currently running packet filter. Still this is an interesting idea. When I was an MVS systems programmer I had developed extensions to the JES2 job entry subsystem. MVS allowed for a primary and secondary subsystem allowing the primary to process jobs while the secondary could be used for testing or other purposes. In a similar vein, possibly having a primary and secondary pfil(9) to which alternate packet filters could attach for would allow for testing without the disruption of kldload/kldunload of the primary packet filters or even worse, reboot. (And reboots for the sake of testing are annoying for the impatient.) Anticipating the next point, why not a VM? Again, time. > > The second missing bit of functionality is that ipftest can test against > not the running ruleset, but some other ruleset. This can be achieved by > adding multiple ruleset feature into existing firewalls. The pfil(9) already > has notion of ruleset names, but so far ipfw, pf and ipf provide only "defaul > t". ipfilter already uses a active and inactive rulesets. Best practice is to clear and load new rules into the inactive ruleset and switch it to active. If it causes problems, switch back. One could extend this functionality to multiple rulesets or map the active/inactive rulesets back to pfil(9). > Once a firewall is able to make alternative rulesets, we can match this > functionality: ipftest would install temporary ruleset, don't connect it > to any head, run the new ioctl() on it, then destroy the ruleset. > > I'm sorry to come with a suggestion but can't contribute any time into it. Thanks for giving me more things to ponder. Lastly, in defense of ipftest, the NetBSD tests that ngie@ imported uses ipftest, as do our friends at NetBSD. If anything I'd like to at least maintain the same UI such that sharing of scripts, tests, and ideas would still be possible. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Tue Aug 6 03:54:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A811B5287; Tue, 6 Aug 2019 03:54:28 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462gkD358hz4ZF1; Tue, 6 Aug 2019 03:54:28 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 472BB26348; Tue, 6 Aug 2019 03:54:28 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x763sSCn066516; Tue, 6 Aug 2019 03:54:28 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x763sRBZ066514; Tue, 6 Aug 2019 03:54:27 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908060354.x763sRBZ066514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 6 Aug 2019 03:54:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350624 - in head/sys/dev: amdsmn amdtemp X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys/dev: amdsmn amdtemp X-SVN-Commit-Revision: 350624 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 03:54:28 -0000 Author: cem Date: Tue Aug 6 03:54:27 2019 New Revision: 350624 URL: https://svnweb.freebsd.org/changeset/base/350624 Log: amdtemp(4), amdsmn(4): Attach to Ryzen 3 (Zen 2) hostbridges PR: 239607 Reported by: "drclaw" Modified: head/sys/dev/amdsmn/amdsmn.c head/sys/dev/amdtemp/amdtemp.c Modified: head/sys/dev/amdsmn/amdsmn.c ============================================================================== --- head/sys/dev/amdsmn/amdsmn.c Tue Aug 6 03:49:40 2019 (r350623) +++ head/sys/dev/amdsmn/amdsmn.c Tue Aug 6 03:54:27 2019 (r350624) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #define PCI_DEVICE_ID_AMD_15H_M60H_ROOT 0x1576 #define PCI_DEVICE_ID_AMD_17H_ROOT 0x1450 #define PCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0 +#define PCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480 struct pciid; struct amdsmn_softc { @@ -87,6 +88,12 @@ static const struct pciid { { .amdsmn_vendorid = CPU_VENDOR_AMD, .amdsmn_deviceid = PCI_DEVICE_ID_AMD_17H_M10H_ROOT, + .amdsmn_addr_reg = F17H_SMN_ADDR_REG, + .amdsmn_data_reg = F17H_SMN_DATA_REG, + }, + { + .amdsmn_vendorid = CPU_VENDOR_AMD, + .amdsmn_deviceid = PCI_DEVICE_ID_AMD_17H_M30H_ROOT, .amdsmn_addr_reg = F17H_SMN_ADDR_REG, .amdsmn_data_reg = F17H_SMN_DATA_REG, }, Modified: head/sys/dev/amdtemp/amdtemp.c ============================================================================== --- head/sys/dev/amdtemp/amdtemp.c Tue Aug 6 03:49:40 2019 (r350623) +++ head/sys/dev/amdtemp/amdtemp.c Tue Aug 6 03:54:27 2019 (r350624) @@ -96,6 +96,7 @@ struct amdtemp_softc { #define DEVICEID_AMD_MISC16_M30H 0x1583 #define DEVICEID_AMD_HOSTB17H_ROOT 0x1450 #define DEVICEID_AMD_HOSTB17H_M10H_ROOT 0x15d0 +#define DEVICEID_AMD_HOSTB17H_M30H_ROOT 0x1480 static const struct amdtemp_product { uint16_t amdtemp_vendorid; @@ -118,6 +119,7 @@ static const struct amdtemp_product { { VENDORID_AMD, DEVICEID_AMD_MISC16_M30H, true }, { VENDORID_AMD, DEVICEID_AMD_HOSTB17H_ROOT, false }, { VENDORID_AMD, DEVICEID_AMD_HOSTB17H_M10H_ROOT, false }, + { VENDORID_AMD, DEVICEID_AMD_HOSTB17H_M30H_ROOT, false }, }; /* From owner-svn-src-head@freebsd.org Tue Aug 6 03:16:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3F36B47DE; Tue, 6 Aug 2019 03:16:06 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462fsy4XCPz4XsF; Tue, 6 Aug 2019 03:16:06 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 647E625C38; Tue, 6 Aug 2019 03:16:06 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x763G6Kd043140; Tue, 6 Aug 2019 03:16:06 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x763G6la043139; Tue, 6 Aug 2019 03:16:06 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908060316.x763G6la043139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 6 Aug 2019 03:16:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350622 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 350622 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 03:16:06 -0000 Author: jhibbits Date: Tue Aug 6 03:16:06 2019 New Revision: 350622 URL: https://svnweb.freebsd.org/changeset/base/350622 Log: powerpc/pmap: Simplify Book-E 64-bit page table management There is no need for the 64-bit pmap to have a fixed number of page table buffers. Since the 64-bit pmap has a DMAP, we can effectively have user page tables limited only by total RAM size. Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Tue Aug 6 00:50:25 2019 (r350621) +++ head/sys/powerpc/booke/pmap.c Tue Aug 6 03:16:06 2019 (r350622) @@ -59,8 +59,7 @@ * 0xc000_0000_0000_0000 - 0xcfff_ffff_ffff_ffff : kernel reserved * 0xc000_0000_0000_0000 - endkernel-1 : kernel code & data * endkernel - msgbufp-1 : flat device tree - * msgbufp - ptbl_bufs-1 : message buffer - * ptbl_bufs - kernel_pdir-1 : kernel page tables + * msgbufp - kernel_pdir-1 : message buffer * kernel_pdir - kernel_pp2d-1 : kernel page directory * kernel_pp2d - . : kernel pointers to page directory * pmap_zero_copy_min - crashdumpmap-1 : reserved for page zero/copy @@ -262,11 +261,6 @@ static int pv_entry_count = 0, pv_entry_max = 0, pv_en #define PMAP_SHPGPERPROC 200 #endif -static void ptbl_init(void); -static struct ptbl_buf *ptbl_buf_alloc(void); -static void ptbl_buf_free(struct ptbl_buf *); -static void ptbl_free_pmap_ptbl(pmap_t, pte_t *); - #ifdef __powerpc64__ static pte_t *ptbl_alloc(mmu_t, pmap_t, pte_t **, unsigned int, boolean_t); @@ -274,6 +268,11 @@ static void ptbl_free(mmu_t, pmap_t, pte_t **, unsigne static void ptbl_hold(mmu_t, pmap_t, pte_t **, unsigned int); static int ptbl_unhold(mmu_t, pmap_t, vm_offset_t); #else +static void ptbl_init(void); +static struct ptbl_buf *ptbl_buf_alloc(void); +static void ptbl_buf_free(struct ptbl_buf *); +static void ptbl_free_pmap_ptbl(pmap_t, pte_t *); + static pte_t *ptbl_alloc(mmu_t, pmap_t, unsigned int, boolean_t); static void ptbl_free(mmu_t, pmap_t, unsigned int); static void ptbl_hold(mmu_t, pmap_t, unsigned int); @@ -293,18 +292,15 @@ static void pv_remove(pmap_t, vm_offset_t, vm_page_t); static void booke_pmap_init_qpages(void); -/* Number of kva ptbl buffers, each covering one ptbl (PTBL_PAGES). */ -#ifdef __powerpc64__ -#define PTBL_BUFS (16UL * 16 * 16) -#else -#define PTBL_BUFS (128 * 16) -#endif - struct ptbl_buf { TAILQ_ENTRY(ptbl_buf) link; /* list link */ vm_offset_t kva; /* va of mapping */ }; +#ifndef __powerpc64__ +/* Number of kva ptbl buffers, each covering one ptbl (PTBL_PAGES). */ +#define PTBL_BUFS (128 * 16) + /* ptbl free list and a lock used for access synchronization. */ static TAILQ_HEAD(, ptbl_buf) ptbl_buf_freelist; static struct mtx ptbl_buf_freelist_lock; @@ -314,6 +310,7 @@ static vm_offset_t ptbl_buf_pool_vabase; /* Pointer to ptbl_buf structures. */ static struct ptbl_buf *ptbl_bufs; +#endif #ifdef SMP extern tlb_entry_t __boot_tlb1[]; @@ -574,63 +571,8 @@ tlb1_get_tlbconf(void) static void ptbl_init(void) { - int i; - - mtx_init(&ptbl_buf_freelist_lock, "ptbl bufs lock", NULL, MTX_DEF); - TAILQ_INIT(&ptbl_buf_freelist); - - for (i = 0; i < PTBL_BUFS; i++) { - ptbl_bufs[i].kva = ptbl_buf_pool_vabase + - i * MAX(PTBL_PAGES,PDIR_PAGES) * PAGE_SIZE; - TAILQ_INSERT_TAIL(&ptbl_buf_freelist, &ptbl_bufs[i], link); - } } -/* Get an sf_buf from the freelist. */ -static struct ptbl_buf * -ptbl_buf_alloc(void) -{ - struct ptbl_buf *buf; - - mtx_lock(&ptbl_buf_freelist_lock); - buf = TAILQ_FIRST(&ptbl_buf_freelist); - if (buf != NULL) - TAILQ_REMOVE(&ptbl_buf_freelist, buf, link); - mtx_unlock(&ptbl_buf_freelist_lock); - - return (buf); -} - -/* Return ptbl buff to free pool. */ -static void -ptbl_buf_free(struct ptbl_buf *buf) -{ - mtx_lock(&ptbl_buf_freelist_lock); - TAILQ_INSERT_TAIL(&ptbl_buf_freelist, buf, link); - mtx_unlock(&ptbl_buf_freelist_lock); -} - -/* - * Search the list of allocated ptbl bufs and find on list of allocated ptbls - */ -static void -ptbl_free_pmap_ptbl(pmap_t pmap, pte_t * ptbl) -{ - struct ptbl_buf *pbuf; - - TAILQ_FOREACH(pbuf, &pmap->pm_ptbl_list, link) { - if (pbuf->kva == (vm_offset_t) ptbl) { - /* Remove from pmap ptbl buf list. */ - TAILQ_REMOVE(&pmap->pm_ptbl_list, pbuf, link); - - /* Free corresponding ptbl buf. */ - ptbl_buf_free(pbuf); - - break; - } - } -} - /* Get a pointer to a PTE in a page table. */ static __inline pte_t * pte_find(mmu_t mmu, pmap_t pmap, vm_offset_t va) @@ -648,25 +590,36 @@ pte_find(mmu_t mmu, pmap_t pmap, vm_offset_t va) } /* - * Search the list of allocated pdir bufs and find on list of allocated pdirs + * allocate a page of pointers to page directories, do not preallocate the + * page tables */ -static void -ptbl_free_pmap_pdir(mmu_t mmu, pmap_t pmap, pte_t ** pdir) +static pte_t ** +pdir_alloc(mmu_t mmu, pmap_t pmap, unsigned int pp2d_idx, bool nosleep) { - struct ptbl_buf *pbuf; + vm_page_t m; + pte_t **pdir; + int req; - TAILQ_FOREACH(pbuf, &pmap->pm_pdir_list, link) { - if (pbuf->kva == (vm_offset_t) pdir) { - /* Remove from pmap ptbl buf list. */ - TAILQ_REMOVE(&pmap->pm_pdir_list, pbuf, link); + KASSERT((pdir[pdir_idx] == NULL), + ("%s: valid pdir entry exists!", __func__)); - /* Free corresponding pdir buf. */ - ptbl_buf_free(pbuf); - - break; + req = VM_ALLOC_NOOBJ | VM_ALLOC_WIRED; + while ((m = vm_page_alloc(NULL, pp2d_idx, req)) == NULL) { + PMAP_UNLOCK(pmap); + if (nosleep) { + return (NULL); } + vm_wait(NULL); + PMAP_LOCK(pmap); } + + /* Zero whole ptbl. */ + pdir = (pte_t **)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); + bzero(pdir, PAGE_SIZE); + + return (pdir); } + /* Free pdir pages and invalidate pdir entry. */ static void pdir_free(mmu_t mmu, pmap_t pmap, unsigned int pp2d_idx) @@ -675,7 +628,6 @@ pdir_free(mmu_t mmu, pmap_t pmap, unsigned int pp2d_id vm_paddr_t pa; vm_offset_t va; vm_page_t m; - int i; pdir = pmap->pm_pp2d[pp2d_idx]; @@ -683,16 +635,10 @@ pdir_free(mmu_t mmu, pmap_t pmap, unsigned int pp2d_id pmap->pm_pp2d[pp2d_idx] = NULL; - for (i = 0; i < PDIR_PAGES; i++) { - va = ((vm_offset_t) pdir + (i * PAGE_SIZE)); - pa = pte_vatopa(mmu, kernel_pmap, va); - m = PHYS_TO_VM_PAGE(pa); - vm_page_free_zero(m); - vm_wire_sub(1); - pmap_kremove(va); - } - - ptbl_free_pmap_pdir(mmu, pmap, pdir); + va = (vm_offset_t) pdir; + pa = DMAP_TO_PHYS(va); + m = PHYS_TO_VM_PAGE(pa); + vm_page_free_zero(m); } /* @@ -707,30 +653,20 @@ pdir_unhold(mmu_t mmu, pmap_t pmap, u_int pp2d_idx) pte_t **pdir; vm_paddr_t pa; vm_page_t m; - int i; KASSERT((pmap != kernel_pmap), ("pdir_unhold: unholding kernel pdir!")); pdir = pmap->pm_pp2d[pp2d_idx]; - KASSERT(((vm_offset_t) pdir >= VM_MIN_KERNEL_ADDRESS), - ("pdir_unhold: non kva pdir")); - /* decrement hold count */ - for (i = 0; i < PDIR_PAGES; i++) { - pa = pte_vatopa(mmu, kernel_pmap, - (vm_offset_t) pdir + (i * PAGE_SIZE)); - m = PHYS_TO_VM_PAGE(pa); - m->wire_count--; - } + pa = DMAP_TO_PHYS((vm_offset_t) pdir); + m = PHYS_TO_VM_PAGE(pa); /* - * Free pdir pages if there are no dir entries in this pdir. - * wire_count has the same value for all ptbl pages, so check the - * last page. + * Free pdir page if there are no dir entries in this pdir. */ - if (m->wire_count == 0) { + if (vm_page_unwire_noq(m)) { pdir_free(mmu, pmap, pp2d_idx); return (1); } @@ -744,21 +680,15 @@ pdir_unhold(mmu_t mmu, pmap_t pmap, u_int pp2d_idx) static void pdir_hold(mmu_t mmu, pmap_t pmap, pte_t ** pdir) { - vm_paddr_t pa; vm_page_t m; - int i; KASSERT((pmap != kernel_pmap), ("pdir_hold: holding kernel pdir!")); KASSERT((pdir != NULL), ("pdir_hold: null pdir")); - for (i = 0; i < PDIR_PAGES; i++) { - pa = pte_vatopa(mmu, kernel_pmap, - (vm_offset_t) pdir + (i * PAGE_SIZE)); - m = PHYS_TO_VM_PAGE(pa); - m->wire_count++; - } + m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pdir)); + vm_page_wire(m); } /* Allocate page table. */ @@ -766,51 +696,29 @@ static pte_t * ptbl_alloc(mmu_t mmu, pmap_t pmap, pte_t ** pdir, unsigned int pdir_idx, boolean_t nosleep) { - vm_page_t mtbl [PTBL_PAGES]; vm_page_t m; - struct ptbl_buf *pbuf; - unsigned int pidx; pte_t *ptbl; - int i, j; int req; KASSERT((pdir[pdir_idx] == NULL), ("%s: valid ptbl entry exists!", __func__)); - pbuf = ptbl_buf_alloc(); - if (pbuf == NULL) - panic("%s: couldn't alloc kernel virtual memory", __func__); - - ptbl = (pte_t *) pbuf->kva; - - for (i = 0; i < PTBL_PAGES; i++) { - pidx = (PTBL_PAGES * pdir_idx) + i; - req = VM_ALLOC_NOOBJ | VM_ALLOC_WIRED; - while ((m = vm_page_alloc(NULL, pidx, req)) == NULL) { - PMAP_UNLOCK(pmap); - rw_wunlock(&pvh_global_lock); - if (nosleep) { - ptbl_free_pmap_ptbl(pmap, ptbl); - for (j = 0; j < i; j++) - vm_page_free(mtbl[j]); - vm_wire_sub(i); - return (NULL); - } - vm_wait(NULL); - rw_wlock(&pvh_global_lock); - PMAP_LOCK(pmap); + req = VM_ALLOC_NOOBJ | VM_ALLOC_WIRED; + while ((m = vm_page_alloc(NULL, pdir_idx, req)) == NULL) { + PMAP_UNLOCK(pmap); + rw_wunlock(&pvh_global_lock); + if (nosleep) { + return (NULL); } - mtbl[i] = m; + vm_wait(NULL); + rw_wlock(&pvh_global_lock); + PMAP_LOCK(pmap); } - /* Mapin allocated pages into kernel_pmap. */ - mmu_booke_qenter(mmu, (vm_offset_t) ptbl, mtbl, PTBL_PAGES); /* Zero whole ptbl. */ - bzero((caddr_t) ptbl, PTBL_PAGES * PAGE_SIZE); + ptbl = (pte_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); + bzero(ptbl, PAGE_SIZE); - /* Add pbuf to the pmap ptbl bufs list. */ - TAILQ_INSERT_TAIL(&pmap->pm_ptbl_list, pbuf, link); - return (ptbl); } @@ -822,7 +730,6 @@ ptbl_free(mmu_t mmu, pmap_t pmap, pte_t ** pdir, unsig vm_paddr_t pa; vm_offset_t va; vm_page_t m; - int i; ptbl = pdir[pdir_idx]; @@ -830,16 +737,10 @@ ptbl_free(mmu_t mmu, pmap_t pmap, pte_t ** pdir, unsig pdir[pdir_idx] = NULL; - for (i = 0; i < PTBL_PAGES; i++) { - va = ((vm_offset_t) ptbl + (i * PAGE_SIZE)); - pa = pte_vatopa(mmu, kernel_pmap, va); - m = PHYS_TO_VM_PAGE(pa); - vm_page_free_zero(m); - vm_wire_sub(1); - pmap_kremove(va); - } - - ptbl_free_pmap_ptbl(pmap, ptbl); + va = (vm_offset_t) ptbl; + pa = DMAP_TO_PHYS(va); + m = PHYS_TO_VM_PAGE(pa); + vm_page_free_zero(m); } /* @@ -852,12 +753,10 @@ static int ptbl_unhold(mmu_t mmu, pmap_t pmap, vm_offset_t va) { pte_t *ptbl; - vm_paddr_t pa; vm_page_t m; u_int pp2d_idx; pte_t **pdir; u_int pdir_idx; - int i; pp2d_idx = PP2D_IDX(va); pdir_idx = PDIR_IDX(va); @@ -868,30 +767,15 @@ ptbl_unhold(mmu_t mmu, pmap_t pmap, vm_offset_t va) pdir = pmap->pm_pp2d[pp2d_idx]; ptbl = pdir[pdir_idx]; - KASSERT(((vm_offset_t) ptbl >= VM_MIN_KERNEL_ADDRESS), - ("ptbl_unhold: non kva ptbl")); - /* decrement hold count */ - for (i = 0; i < PTBL_PAGES; i++) { - pa = pte_vatopa(mmu, kernel_pmap, - (vm_offset_t) ptbl + (i * PAGE_SIZE)); - m = PHYS_TO_VM_PAGE(pa); - m->wire_count--; - } + m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t) ptbl)); /* * Free ptbl pages if there are no pte entries in this ptbl. * wire_count has the same value for all ptbl pages, so check the * last page. */ - if (m->wire_count == 0) { - /* A pair of indirect entries might point to this ptbl page */ -#if 0 - tlb_flush_entry(pmap, va & ~((2UL * PAGE_SIZE_1M) - 1), - TLB_SIZE_1M, MAS6_SIND); - tlb_flush_entry(pmap, (va & ~((2UL * PAGE_SIZE_1M) - 1)) | PAGE_SIZE_1M, - TLB_SIZE_1M, MAS6_SIND); -#endif + if (vm_page_unwire_noq(m)) { ptbl_free(mmu, pmap, pdir, pdir_idx); pdir_unhold(mmu, pmap, pp2d_idx); return (1); @@ -906,10 +790,8 @@ ptbl_unhold(mmu_t mmu, pmap_t pmap, vm_offset_t va) static void ptbl_hold(mmu_t mmu, pmap_t pmap, pte_t ** pdir, unsigned int pdir_idx) { - vm_paddr_t pa; pte_t *ptbl; vm_page_t m; - int i; KASSERT((pmap != kernel_pmap), ("ptbl_hold: holding kernel ptbl!")); @@ -918,12 +800,8 @@ ptbl_hold(mmu_t mmu, pmap_t pmap, pte_t ** pdir, unsig KASSERT((ptbl != NULL), ("ptbl_hold: null ptbl")); - for (i = 0; i < PTBL_PAGES; i++) { - pa = pte_vatopa(mmu, kernel_pmap, - (vm_offset_t) ptbl + (i * PAGE_SIZE)); - m = PHYS_TO_VM_PAGE(pa); - m->wire_count++; - } + m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t) ptbl)); + vm_page_wire(m); } #else @@ -1328,51 +1206,6 @@ pte_remove(mmu_t mmu, pmap_t pmap, vm_offset_t va, u_i } /* - * allocate a page of pointers to page directories, do not preallocate the - * page tables - */ -static pte_t ** -pdir_alloc(mmu_t mmu, pmap_t pmap, unsigned int pp2d_idx, bool nosleep) -{ - vm_page_t mtbl [PDIR_PAGES]; - vm_page_t m; - struct ptbl_buf *pbuf; - pte_t **pdir; - unsigned int pidx; - int i; - int req; - - pbuf = ptbl_buf_alloc(); - - if (pbuf == NULL) - panic("%s: couldn't alloc kernel virtual memory", __func__); - - /* Allocate pdir pages, this will sleep! */ - for (i = 0; i < PDIR_PAGES; i++) { - pidx = (PDIR_PAGES * pp2d_idx) + i; - req = VM_ALLOC_NOOBJ | VM_ALLOC_WIRED; - while ((m = vm_page_alloc(NULL, pidx, req)) == NULL) { - PMAP_UNLOCK(pmap); - vm_wait(NULL); - PMAP_LOCK(pmap); - } - mtbl[i] = m; - } - - /* Mapin allocated pages into kernel_pmap. */ - pdir = (pte_t **) pbuf->kva; - pmap_qenter((vm_offset_t) pdir, mtbl, PDIR_PAGES); - - /* Zero whole pdir. */ - bzero((caddr_t) pdir, PDIR_PAGES * PAGE_SIZE); - - /* Add pdir to the pmap pdir bufs list. */ - TAILQ_INSERT_TAIL(&pmap->pm_pdir_list, pbuf, link); - - return pdir; -} - -/* * Insert PTE for a given page and virtual address. */ static int @@ -1485,8 +1318,8 @@ kernel_pte_alloc(vm_offset_t data_end, vm_offset_t add for (j = PDIR_IDX(va + (i * PAGE_SIZE * PDIR_NENTRIES * PTBL_NENTRIES)); j < PDIR_NENTRIES; j++) { kernel_pmap->pm_pp2d[i + PP2D_IDX(va)][j] = - (pte_t *)(pdir + (kernel_pdirs * PAGE_SIZE * PDIR_PAGES) + - (((i * PDIR_NENTRIES) + j) * PAGE_SIZE * PTBL_PAGES)); + (pte_t *)(pdir + (kernel_pdirs * PAGE_SIZE) + + (((i * PDIR_NENTRIES) + j) * PAGE_SIZE)); } } @@ -1764,6 +1597,7 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o data_end = round_page(data_end); +#ifndef __powerpc64__ /* Allocate space for ptbl_bufs. */ ptbl_bufs = (struct ptbl_buf *)data_end; data_end += sizeof(struct ptbl_buf) * PTBL_BUFS; @@ -1771,6 +1605,7 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o (uintptr_t)ptbl_bufs, data_end); data_end = round_page(data_end); +#endif /* Allocate PTE tables for kernel KVA. */ kernel_pdir = data_end; @@ -1799,12 +1634,12 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o * all range up to the currently calculated 'data_end' is covered. */ dpcpu_init(dpcpu, 0); - memset((void *)ptbl_bufs, 0, sizeof(struct ptbl_buf) * PTBL_SIZE); #ifdef __powerpc64__ memset((void *)kernel_pdir, 0, kernel_pdirs * PDIR_PAGES * PAGE_SIZE + kernel_ptbls * PTBL_PAGES * PAGE_SIZE); #else + memset((void *)ptbl_bufs, 0, sizeof(struct ptbl_buf) * PTBL_SIZE); memset((void *)kernel_pdir, 0, kernel_ptbls * PTBL_PAGES * PAGE_SIZE); #endif @@ -1829,11 +1664,13 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o mtx_init(&zero_page_mutex, "mmu_booke_zero_page", NULL, MTX_DEF); mtx_init(©_page_mutex, "mmu_booke_copy_page", NULL, MTX_DEF); +#ifndef __powerpc64__ /* Allocate KVA space for ptbl bufs. */ ptbl_buf_pool_vabase = virtual_avail; virtual_avail += PTBL_BUFS * PTBL_PAGES * PAGE_SIZE; debugf("ptbl_buf_pool_vabase = 0x%"PRI0ptrX" end = 0x%"PRI0ptrX"\n", ptbl_buf_pool_vabase, virtual_avail); +#endif /* Calculate corresponding physical addresses for the kernel region. */ phys_kernelend = kernload + kernsize; From owner-svn-src-head@freebsd.org Tue Aug 6 03:49:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC9A0B5089; Tue, 6 Aug 2019 03:49:40 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462gch5W11z4YvM; Tue, 6 Aug 2019 03:49:40 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9EABA26191; Tue, 6 Aug 2019 03:49:40 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x763neFV060895; Tue, 6 Aug 2019 03:49:40 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x763neNw060894; Tue, 6 Aug 2019 03:49:40 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908060349.x763neNw060894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 6 Aug 2019 03:49:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350623 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 350623 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 03:49:40 -0000 Author: jhibbits Date: Tue Aug 6 03:49:40 2019 New Revision: 350623 URL: https://svnweb.freebsd.org/changeset/base/350623 Log: Fix build from r350622 It helps if my local kernel build has INVARIANTS. Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Tue Aug 6 03:16:06 2019 (r350622) +++ head/sys/powerpc/booke/pmap.c Tue Aug 6 03:49:40 2019 (r350623) @@ -600,7 +600,7 @@ pdir_alloc(mmu_t mmu, pmap_t pmap, unsigned int pp2d_i pte_t **pdir; int req; - KASSERT((pdir[pdir_idx] == NULL), + KASSERT((pdir[pp2d_idx] == NULL), ("%s: valid pdir entry exists!", __func__)); req = VM_ALLOC_NOOBJ | VM_ALLOC_WIRED; From owner-svn-src-head@freebsd.org Tue Aug 6 08:33:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B7A68BC831; Tue, 6 Aug 2019 08:33:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462nw24H5Mz3K50; Tue, 6 Aug 2019 08:33:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 748D62951A; Tue, 6 Aug 2019 08:33:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x768XMjl031480; Tue, 6 Aug 2019 08:33:22 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x768XMJX031478; Tue, 6 Aug 2019 08:33:22 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201908060833.x768XMJX031478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 6 Aug 2019 08:33:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350625 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 350625 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 08:33:22 -0000 Author: tuexen Date: Tue Aug 6 08:33:21 2019 New Revision: 350625 URL: https://svnweb.freebsd.org/changeset/base/350625 Log: Fix build issues for the userland stack on Raspbian. Modified: head/sys/netinet/sctp_output.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Tue Aug 6 03:54:27 2019 (r350624) +++ head/sys/netinet/sctp_output.c Tue Aug 6 08:33:21 2019 (r350625) @@ -12534,7 +12534,7 @@ sctp_lower_sosend(struct socket *so, struct thread *p ) { - ssize_t sndlen = 0, max_len; + ssize_t sndlen = 0, max_len, local_add_more; int error, len; struct mbuf *top = NULL; int queue_only = 0, queue_only_for_init = 0; @@ -12556,7 +12556,6 @@ sctp_lower_sosend(struct socket *so, int got_all_of_the_send = 0; int hold_tcblock = 0; int non_blocking = 0; - uint32_t local_add_more; ssize_t local_soresv = 0; uint16_t port; uint16_t sinfo_flags; @@ -12860,7 +12859,7 @@ sctp_lower_sosend(struct socket *so, free_cnt_applied = 1; if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NO_FRAGMENT)) { - if (sndlen > asoc->smallest_mtu) { + if (sndlen > (ssize_t)asoc->smallest_mtu) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EMSGSIZE); error = EMSGSIZE; goto out_unlocked; @@ -12888,7 +12887,7 @@ sctp_lower_sosend(struct socket *so, if ((SCTP_SB_LIMIT_SND(so) < (amount + inqueue_bytes + stcb->asoc.sb_send_resv)) || (stcb->asoc.chunks_on_out_queue >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue))) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EWOULDBLOCK); - if (sndlen > SCTP_SB_LIMIT_SND(so)) + if (sndlen > (ssize_t)SCTP_SB_LIMIT_SND(so)) error = EMSGSIZE; else error = EWOULDBLOCK; @@ -13070,7 +13069,7 @@ sctp_lower_sosend(struct socket *so, /* Unless E_EOR mode is on, we must make a send FIT in one call. */ if ((user_marks_eor == 0) && - (sndlen > SCTP_SB_LIMIT_SND(stcb->sctp_socket))) { + (sndlen > (ssize_t)SCTP_SB_LIMIT_SND(stcb->sctp_socket))) { /* It will NEVER fit */ SCTP_LTRACE_ERR_RET(NULL, stcb, net, SCTP_FROM_SCTP_OUTPUT, EMSGSIZE); error = EMSGSIZE; @@ -13087,20 +13086,20 @@ sctp_lower_sosend(struct socket *so, } if (user_marks_eor) { - local_add_more = min(SCTP_SB_LIMIT_SND(so), SCTP_BASE_SYSCTL(sctp_add_more_threshold)); + local_add_more = (ssize_t)min(SCTP_SB_LIMIT_SND(so), SCTP_BASE_SYSCTL(sctp_add_more_threshold)); } else { /*- * For non-eeor the whole message must fit in * the socket send buffer. */ - local_add_more = (uint32_t)sndlen; + local_add_more = sndlen; } len = 0; if (non_blocking) { goto skip_preblock; } if (((max_len <= local_add_more) && - (SCTP_SB_LIMIT_SND(so) >= local_add_more)) || + ((ssize_t)SCTP_SB_LIMIT_SND(so) >= local_add_more)) || (max_len == 0) || ((stcb->asoc.chunks_on_out_queue + stcb->asoc.stream_queue_cnt) >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue))) { /* No room right now ! */ @@ -13108,7 +13107,7 @@ sctp_lower_sosend(struct socket *so, inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * SCTP_DATA_CHUNK_OVERHEAD(stcb)); while ((SCTP_SB_LIMIT_SND(so) < (inqueue_bytes + local_add_more)) || ((stcb->asoc.stream_queue_cnt + stcb->asoc.chunks_on_out_queue) >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue))) { - SCTPDBG(SCTP_DEBUG_OUTPUT1, "pre_block limit:%u <(inq:%d + %d) || (%d+%d > %d)\n", + SCTPDBG(SCTP_DEBUG_OUTPUT1, "pre_block limit:%u <(inq:%d + %zd) || (%d+%d > %d)\n", (unsigned int)SCTP_SB_LIMIT_SND(so), inqueue_bytes, local_add_more, @@ -13241,7 +13240,7 @@ skip_preblock: else max_len = 0; - if ((max_len > SCTP_BASE_SYSCTL(sctp_add_more_threshold)) || + if ((max_len > (ssize_t)SCTP_BASE_SYSCTL(sctp_add_more_threshold)) || (max_len && (SCTP_SB_LIMIT_SND(so) < SCTP_BASE_SYSCTL(sctp_add_more_threshold))) || (uio->uio_resid && (uio->uio_resid <= max_len))) { sndout = 0; Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Tue Aug 6 03:54:27 2019 (r350624) +++ head/sys/netinet/sctputil.c Tue Aug 6 08:33:21 2019 (r350625) @@ -5930,7 +5930,7 @@ get_more_data: } if ((uio->uio_resid == 0) || ((in_eeor_mode) && - (copied_so_far >= (uint32_t)max(so->so_rcv.sb_lowat, 1)))) { + (copied_so_far >= max(so->so_rcv.sb_lowat, 1)))) { goto release; } /* From owner-svn-src-head@freebsd.org Tue Aug 6 11:26:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 580ADBFC74; Tue, 6 Aug 2019 11:26:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462slq1VXGz3wtX; Tue, 6 Aug 2019 11:26:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 10C0C2B3D8; Tue, 6 Aug 2019 11:26:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76BQUq2033067; Tue, 6 Aug 2019 11:26:30 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76BQUZ6033065; Tue, 6 Aug 2019 11:26:30 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201908061126.x76BQUZ6033065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 6 Aug 2019 11:26:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350627 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 350627 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 11:26:31 -0000 Author: tuexen Date: Tue Aug 6 11:26:30 2019 New Revision: 350627 URL: https://svnweb.freebsd.org/changeset/base/350627 Log: Reference the RFC instead of the internet draft. MFC after: 1 week Sponsored by: Netflix, Inc. Modified: head/share/man/man4/cc_newreno.4 head/share/man/man4/mod_cc.4 Modified: head/share/man/man4/cc_newreno.4 ============================================================================== --- head/share/man/man4/cc_newreno.4 Tue Aug 6 10:29:19 2019 (r350626) +++ head/share/man/man4/cc_newreno.4 Tue Aug 6 11:26:30 2019 (r350627) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 19, 2018 +.Dd August 6, 2019 .Dt CC_NEWRENO 4 .Os .Sh NAME @@ -117,10 +117,7 @@ Default is 80. .%A "Grenville Armitage" .%A "Gorry Fairhurst" .%T "TCP Alternative Backoff with ECN (ABE)" -.%R "internet draft" -.%D "February 2018" -.%N "draft-ietf-tcpm-alternativebackoff-ecn" -.%O "work in progress" +.%O "RFC 8511" .Re .Sh ACKNOWLEDGEMENTS Development and testing of this software were made possible in part by grants Modified: head/share/man/man4/mod_cc.4 ============================================================================== --- head/share/man/man4/mod_cc.4 Tue Aug 6 10:29:19 2019 (r350626) +++ head/share/man/man4/mod_cc.4 Tue Aug 6 11:26:30 2019 (r350627) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 19, 2018 +.Dd August 6, 2019 .Dt MOD_CC 4 .Os .Sh NAME @@ -84,7 +84,7 @@ one of the names listed by the .Va net.inet.tcp.cc.available MIB variable. .It Va abe -Enable support for draft-ietf-tcpm-alternativebackoff-ecn, +Enable support for RFC 8511, which alters the window decrease factor applied to the congestion window in response to an ECN congestion signal. Refer to individual congestion control man pages to determine if they implement From owner-svn-src-head@freebsd.org Tue Aug 6 13:09:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 783AFC1C75; Tue, 6 Aug 2019 13:09:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462w2T2ZYSz41f4; Tue, 6 Aug 2019 13:09:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A1A82C597; Tue, 6 Aug 2019 13:09:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76D9LmH091858; Tue, 6 Aug 2019 13:09:21 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76D9LX4091857; Tue, 6 Aug 2019 13:09:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201908061309.x76D9LX4091857@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 6 Aug 2019 13:09:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350630 - head/sys/dev/oce X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/dev/oce X-SVN-Commit-Revision: 350630 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 13:09:21 -0000 Author: kevans Date: Tue Aug 6 13:09:20 2019 New Revision: 350630 URL: https://svnweb.freebsd.org/changeset/base/350630 Log: oce(4): potential out of bounds access before vector validation Submitted by: Augustin Cavalier Obtained from: Haiku (ec2b89264cfc63e05e611cce82cc449197403aa4) MFC after: 3 days Modified: head/sys/dev/oce/oce_if.c Modified: head/sys/dev/oce/oce_if.c ============================================================================== --- head/sys/dev/oce/oce_if.c Tue Aug 6 12:19:09 2019 (r350629) +++ head/sys/dev/oce/oce_if.c Tue Aug 6 13:09:20 2019 (r350630) @@ -836,11 +836,13 @@ oce_fast_isr(void *arg) static int oce_alloc_intr(POCE_SOFTC sc, int vector, void (*isr) (void *arg, int pending)) { - POCE_INTR_INFO ii = &sc->intrs[vector]; + POCE_INTR_INFO ii; int rc = 0, rr; if (vector >= OCE_MAX_EQ) return (EINVAL); + + ii = &sc->intrs[vector]; /* Set the resource id for the interrupt. * MSIx is vector + 1 for the resource id, From owner-svn-src-head@freebsd.org Tue Aug 6 17:05:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0EADC5DC7; Tue, 6 Aug 2019 17:05:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4631HV5pH3z4DCm; Tue, 6 Aug 2019 17:05:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8D9D2F117; Tue, 6 Aug 2019 17:05:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76H5woC037480; Tue, 6 Aug 2019 17:05:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76H5wZU037479; Tue, 6 Aug 2019 17:05:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908061705.x76H5wZU037479@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 6 Aug 2019 17:05:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350640 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 350640 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 17:05:59 -0000 Author: kib Date: Tue Aug 6 17:05:58 2019 New Revision: 350640 URL: https://svnweb.freebsd.org/changeset/base/350640 Log: Provide the list of knobs related to mitigations. Discussed with: bjk, emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D21087 Modified: head/share/man/man7/security.7 Modified: head/share/man/man7/security.7 ============================================================================== --- head/share/man/man7/security.7 Tue Aug 6 16:53:25 2019 (r350639) +++ head/share/man/man7/security.7 Tue Aug 6 17:05:58 2019 (r350640) @@ -1,5 +1,10 @@ .\" Copyright (C) 1998 Matthew Dillon. All rights reserved. +.\" Copyright (c) 2019 The FreeBSD Foundation, Inc. .\" +.\" Parts of this documentation were written by +.\" Konstantin Belousov under sponsorship +.\" from the FreeBSD Foundation. +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -23,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 25, 2013 +.Dd July 27, 2019 .Dt SECURITY 7 .Os .Sh NAME @@ -941,12 +946,125 @@ option that SSH allows in its .Pa authorized_keys file to make the key only usable to entities logging in from specific machines. +.Sh KNOBS AND TWEAKS +.Fx +provides several knobs and tweak handles that make some introspection +information access more restricted. +Some people consider this as improving system security, so the knobs are +briefly listed there, together with controls which enable some mitigations +of the hardware state leaks. +.Bl -tag -width security.bsd.unprivileged_proc_debug +.It Dv security.bsd.see_other_uids +Controls visibility of processes owned by different uid. +The knob directly affects the +.Dv kern.proc +sysctls filtering of data, which results in restricted output from +utilities like +.Xr ps 1 . +.It Dv security.bsd.see_other_gids +Same, for processes owned by different gid. +.It Dv security.bsd.see_jail_proc +Same, for processes belonging to a jail. +.It Dv security.bsd.conservative_signals +When enabled, unprivileged users are only allowed to send job control +and usual termination signals like +.Dv SIGKILL , +.Dv SIGINT , +and +.Dv SIGTERM , +to the processes executing programs with changed uids. +.It Dv security.bsd.unprivileged_proc_debug +Controls availability of the process debugging facilities to non-root users. +See also +.Xr proccontrol 1 +mode +.Dv trace . +.It Dv vm.pmap.pti +Tunable, amd64-only. +Enables mode of operation of virtual memory system where usermode page +tables are sanitized to prevent so-called Meltdown information leak on +some Intel CPUs. +By default, the system detects whether the CPU needs the workaround, +and enables it automatically. +See also +.Xr proccontrol 1 +mode +.Dv kpti . +.It Dv hw.mds_disable +amd64 and i386. +Controls Microarchitectural Data Sampling hardware information leak +mitigation. +.It Dv hw.spec_store_bypass_disable +amd64 and i386. +Controls Speculative Store Bypass hardware information leak mitigation. +.It Dv hw.ibrs_disable +amd64 and i386. +Controls Indirect Branch Restricted Speculation hardware information leak +mitigation. +.It Dv machdep.syscall_ret_l1d_flush +amd64. +Controls force-flush of L1D cache on return from syscalls which report +errors other than +.Ev EEXIST , +.Ev EAGAIN , +.Ev EXDEV , +.Ev ENOENT , +.Ev ENOTCONN , +and +.Ev EINPROGRESS . +This is mostly a paranoid setting added to prevent hypothetical exploitation +of unknown gadgets for unknown hardware issues. +The error codes exclusion list is composed of the most common errors which +typically occurs on normal system operation. +.It Dv machdep.nmi_flush_l1d_sw +amd64. +Controls force-flush of L1D cache on NMI; +this provides software assist for bhyve mitigation of L1 terminal fault +hardware information leak. +.It Dv hw.vmm.vmx.l1d_flush +amd64. +Controls the mitigation of L1 Terminal Fault in bhyve hypervisor. +.It Dv kern.elf32.aslr.enable +Controls system-global Address Space Layour Randomization (ASLR) for +normal non-PIE (Position Independent Executable) 32bit binaries. +See also +.Xr proccontrol 1 +mode +.Dv aslr , +also affected by the per-image control note flag. +.It Dv kern.elf32.aslr.pie_enable +Controls system-global Address Space Layout Randomization for +position-independent (PIE) 32bit binaries. +.It Dv kern.elf32.aslr.honor_sbrk +Makes ASLR less aggressive and more compatible with old binaries +relying on the sbrk area. +.It Dv kern.elf32.aslr.aslr_stack_gap +If ASLR is enabled for a binary, a non-zero value creates a randomized +stack gap between strings and the end of the aux vector. +The value is the maximum percentage of main stack to waste on the gap. +Cannot be greater than 50, i.e., at most half of the stack. +.It Dv kern.elf64.aslr.enable +64bit binaries ASLR control. +.It Dv kern.elf64.aslr.pie_enable +64bit PIE binaries ASLR control. +.It Dv kern.elf64.aslr.honor_sbrk +64bit binaries ASLR sbrk compatibility control. +.It Dv kern.elf32.aslr.aslr_stack_gap +Controls stack gap for 64bit binaries. +.It Dv kern.elf32.nxstack +Enables non-executable stack for 32bit processes. +Enabled by default if supported by hardware and corresponding binary. +.It Dv kern.elf64.nxstack +Enables non-executable stack for 64bit processes. +.El .Sh SEE ALSO .Xr chflags 1 , .Xr find 1 , .Xr md5 1 , .Xr netstat 1 , .Xr openssl 1 , +.Xr proccontrol 1 , +.Xr ps 1 , .Xr ssh 1 , .Xr xdm 1 Pq Pa ports/x11/xorg-clients , .Xr group 5 , From owner-svn-src-head@freebsd.org Tue Aug 6 10:29:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 71158BEA4D; Tue, 6 Aug 2019 10:29:20 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462rTr2G8tz3PYr; Tue, 6 Aug 2019 10:29:20 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B4642A91F; Tue, 6 Aug 2019 10:29:20 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76ATKiR097722; Tue, 6 Aug 2019 10:29:20 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76ATK0E097721; Tue, 6 Aug 2019 10:29:20 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201908061029.x76ATK0E097721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 6 Aug 2019 10:29:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350626 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 350626 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 10:29:20 -0000 Author: tuexen Date: Tue Aug 6 10:29:19 2019 New Revision: 350626 URL: https://svnweb.freebsd.org/changeset/base/350626 Log: Fix a locking issue in sctp_accept. PR: 238520 Reported by: pho@ MFC after: 1 week Modified: head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Tue Aug 6 08:33:21 2019 (r350625) +++ head/sys/netinet/sctp_usrreq.c Tue Aug 6 10:29:19 2019 (r350626) @@ -7226,28 +7226,56 @@ sctp_accept(struct socket *so, struct sockaddr **addr) SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (ECONNRESET); } - SCTP_INP_RLOCK(inp); + SCTP_INP_WLOCK(inp); if (inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) { - SCTP_INP_RUNLOCK(inp); + SCTP_INP_WUNLOCK(inp); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EOPNOTSUPP); return (EOPNOTSUPP); } if (so->so_state & SS_ISDISCONNECTED) { - SCTP_INP_RUNLOCK(inp); + SCTP_INP_WUNLOCK(inp); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ECONNABORTED); return (ECONNABORTED); } stcb = LIST_FIRST(&inp->sctp_asoc_list); if (stcb == NULL) { - SCTP_INP_RUNLOCK(inp); + SCTP_INP_WUNLOCK(inp); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (ECONNRESET); } SCTP_TCB_LOCK(stcb); - SCTP_INP_RUNLOCK(inp); store = stcb->asoc.primary_destination->ro._l_addr; SCTP_CLEAR_SUBSTATE(stcb, SCTP_STATE_IN_ACCEPT_QUEUE); - SCTP_TCB_UNLOCK(stcb); + /* Wake any delayed sleep action */ + if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { + inp->sctp_flags &= ~SCTP_PCB_FLAGS_DONT_WAKE; + if (inp->sctp_flags & SCTP_PCB_FLAGS_WAKEOUTPUT) { + inp->sctp_flags &= ~SCTP_PCB_FLAGS_WAKEOUTPUT; + SOCKBUF_LOCK(&inp->sctp_socket->so_snd); + if (sowriteable(inp->sctp_socket)) { + sowwakeup_locked(inp->sctp_socket); + } else { + SOCKBUF_UNLOCK(&inp->sctp_socket->so_snd); + } + } + if (inp->sctp_flags & SCTP_PCB_FLAGS_WAKEINPUT) { + inp->sctp_flags &= ~SCTP_PCB_FLAGS_WAKEINPUT; + SOCKBUF_LOCK(&inp->sctp_socket->so_rcv); + if (soreadable(inp->sctp_socket)) { + sctp_defered_wakeup_cnt++; + sorwakeup_locked(inp->sctp_socket); + } else { + SOCKBUF_UNLOCK(&inp->sctp_socket->so_rcv); + } + } + } + SCTP_INP_WUNLOCK(inp); + if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { + sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, + SCTP_FROM_SCTP_USRREQ + SCTP_LOC_19); + } else { + SCTP_TCB_UNLOCK(stcb); + } switch (store.sa.sa_family) { #ifdef INET case AF_INET: @@ -7288,40 +7316,6 @@ sctp_accept(struct socket *so, struct sockaddr **addr) default: /* TSNH */ break; - } - /* Wake any delayed sleep action */ - if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { - SCTP_INP_WLOCK(inp); - inp->sctp_flags &= ~SCTP_PCB_FLAGS_DONT_WAKE; - if (inp->sctp_flags & SCTP_PCB_FLAGS_WAKEOUTPUT) { - inp->sctp_flags &= ~SCTP_PCB_FLAGS_WAKEOUTPUT; - SCTP_INP_WUNLOCK(inp); - SOCKBUF_LOCK(&inp->sctp_socket->so_snd); - if (sowriteable(inp->sctp_socket)) { - sowwakeup_locked(inp->sctp_socket); - } else { - SOCKBUF_UNLOCK(&inp->sctp_socket->so_snd); - } - SCTP_INP_WLOCK(inp); - } - if (inp->sctp_flags & SCTP_PCB_FLAGS_WAKEINPUT) { - inp->sctp_flags &= ~SCTP_PCB_FLAGS_WAKEINPUT; - SCTP_INP_WUNLOCK(inp); - SOCKBUF_LOCK(&inp->sctp_socket->so_rcv); - if (soreadable(inp->sctp_socket)) { - sctp_defered_wakeup_cnt++; - sorwakeup_locked(inp->sctp_socket); - } else { - SOCKBUF_UNLOCK(&inp->sctp_socket->so_rcv); - } - SCTP_INP_WLOCK(inp); - } - SCTP_INP_WUNLOCK(inp); - } - if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { - SCTP_TCB_LOCK(stcb); - sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, - SCTP_FROM_SCTP_USRREQ + SCTP_LOC_19); } return (0); } From owner-svn-src-head@freebsd.org Tue Aug 6 18:10:35 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B730C7194; Tue, 6 Aug 2019 18:10:35 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4632k30f7mz4JYF; Tue, 6 Aug 2019 18:10:35 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D99AA2FC11; Tue, 6 Aug 2019 18:10:34 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76IAYHL076014; Tue, 6 Aug 2019 18:10:34 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76IAYRA076013; Tue, 6 Aug 2019 18:10:34 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201908061810.x76IAYRA076013@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Tue, 6 Aug 2019 18:10:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350651 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 350651 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 18:10:35 -0000 Author: mckusick Date: Tue Aug 6 18:10:34 2019 New Revision: 350651 URL: https://svnweb.freebsd.org/changeset/base/350651 Log: A race condition existed between the time a UFS/FFS superblock check hash was computed and the time that the superblock was copied to a buffer to be written to disk. The result was a failed superblock check hash the next time that the superblock was read. The fix is to compute the check hash after the superblock has been copied to a buffer to be written. PR: 236504 Reported by: Peter Holm Tested by: Peter Holm Sponsored by: Netflix Modified: head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Tue Aug 6 17:15:46 2019 (r350650) +++ head/sys/ufs/ffs/ffs_vfsops.c Tue Aug 6 18:10:34 2019 (r350651) @@ -1998,7 +1998,13 @@ ffs_use_bwrite(void *devfd, off_t loc, void *buf, int if (MOUNTEDSOFTDEP(ump->um_mountp)) softdep_setup_sbupdate(ump, (struct fs *)bp->b_data, bp); bcopy((caddr_t)fs, bp->b_data, (u_int)fs->fs_sbsize); - ffs_oldfscompat_write((struct fs *)bp->b_data, ump); + fs = (struct fs *)bp->b_data; + ffs_oldfscompat_write(fs, ump); + /* + * Because we may have made changes to the superblock, we need to + * recompute its check-hash. + */ + fs->fs_ckhash = ffs_calc_sbhash(fs); if (devfdp->suspended) bp->b_flags |= B_VALIDSUSPWRT; if (devfdp->waitfor != MNT_WAIT) From owner-svn-src-head@freebsd.org Tue Aug 6 18:15:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB5D9C75AE; Tue, 6 Aug 2019 18:15:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4632qg52HKz4K0D; Tue, 6 Aug 2019 18:15:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EFE92FDE5; Tue, 6 Aug 2019 18:15:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76IFRqe081461; Tue, 6 Aug 2019 18:15:27 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76IFRo2081459; Tue, 6 Aug 2019 18:15:27 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908061815.x76IFRo2081459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 6 Aug 2019 18:15:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350652 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 350652 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 18:15:27 -0000 Author: imp Date: Tue Aug 6 18:15:26 2019 New Revision: 350652 URL: https://svnweb.freebsd.org/changeset/base/350652 Log: Fix mismerge. I merged passthru.c from the wrong branch (it was a branch that went further in a direction I wound up not taking). Fix the mismerge and turn passthru on. Modified: head/sbin/nvmecontrol/Makefile head/sbin/nvmecontrol/passthru.c Modified: head/sbin/nvmecontrol/Makefile ============================================================================== --- head/sbin/nvmecontrol/Makefile Tue Aug 6 18:10:34 2019 (r350651) +++ head/sbin/nvmecontrol/Makefile Tue Aug 6 18:15:26 2019 (r350652) @@ -5,7 +5,7 @@ PROG= nvmecontrol SRCS= comnd.c nvmecontrol.c SRCS+= devlist.c firmware.c format.c identify.c logpage.c ns.c nsid.c SRCS+= perftest.c power.c reset.c resv.c sanitize.c -#SRCS+= passthru.c +SRCS+= passthru.c SRCS+= identify_ext.c nvme_util.c nc_util.c MAN= nvmecontrol.8 LDFLAGS+= -rdynamic Modified: head/sbin/nvmecontrol/passthru.c ============================================================================== --- head/sbin/nvmecontrol/passthru.c Tue Aug 6 18:10:34 2019 (r350651) +++ head/sbin/nvmecontrol/passthru.c Tue Aug 6 18:15:26 2019 (r350652) @@ -101,7 +101,7 @@ static struct options { */ #define ARG(l, s, t, opt, addr, desc) { l, s, t, &opt.addr, desc } -static const struct opts opts[] = { +static struct opts opts[] = { ARG("opcode", 'o', arg_uint8, opt, opcode, "NVMe command opcode (required)"), ARG("cdw2", '2', arg_uint32, opt, cdw2, @@ -267,7 +267,23 @@ io_passthru(const struct cmd *nf, int argc, char *argv passthru(nf, argc, argv); } -CMD_COMMAND(top, admin-passthru, admin_passthru, sizeof(struct options), opts, args, - "Send a pass through Admin command to the specified device"); -CMD_COMMAND(top, io-passthru, io_passthru, sizeof(struct options), opts, args, - "Send a pass through I/O command to the specified device"); +static struct cmd admin_pass_cmd = { + .name = "admin-passthru", + .fn = admin_passthru, + .ctx_size = sizeof(struct options), + .opts = opts, + .args = args, + .descr = "Send a pass through Admin command to the specified device", +}; + +static struct cmd io_pass_cmd = { + .name = "io-passthru", + .fn = io_passthru, + .ctx_size = sizeof(struct options), + .opts = opts, + .args = args, + .descr = "Send a pass through Admin command to the specified device", +}; + +CMD_COMMAND(admin_pass_cmd); +CMD_COMMAND(io_pass_cmd); From owner-svn-src-head@freebsd.org Tue Aug 6 16:11:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 45462C4C59; Tue, 6 Aug 2019 16:11:01 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46304517Gzz49Rp; Tue, 6 Aug 2019 16:11:01 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0873B2E67B; Tue, 6 Aug 2019 16:11:01 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76GB0ik004231; Tue, 6 Aug 2019 16:11:00 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76GB0ul004230; Tue, 6 Aug 2019 16:11:00 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201908061611.x76GB0ul004230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 6 Aug 2019 16:11:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350636 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 350636 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 16:11:01 -0000 Author: glebius Date: Tue Aug 6 16:11:00 2019 New Revision: 350636 URL: https://svnweb.freebsd.org/changeset/base/350636 Log: Since r350426 this KASSERT doesn't serve any useful purpose. Modified: head/sys/kern/kern_sendfile.c Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Tue Aug 6 16:09:06 2019 (r350635) +++ head/sys/kern/kern_sendfile.c Tue Aug 6 16:11:00 2019 (r350636) @@ -392,8 +392,6 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, i VM_OBJECT_WUNLOCK(obj); return (EIO); } - KASSERT(rv == VM_PAGER_OK, ("%s: pager fail obj %p page %p", - __func__, obj, pa[i])); SFSTAT_INC(sf_iocnt); SFSTAT_ADD(sf_pages_read, count); From owner-svn-src-head@freebsd.org Tue Aug 6 16:53:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 917E3C56C6; Tue, 6 Aug 2019 16:53:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4631123MGLz4CTs; Tue, 6 Aug 2019 16:53:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 547D02EF38; Tue, 6 Aug 2019 16:53:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76GrQ38031355; Tue, 6 Aug 2019 16:53:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76GrP7k031353; Tue, 6 Aug 2019 16:53:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908061653.x76GrP7k031353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 6 Aug 2019 16:53:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350639 - in head/sys/amd64: amd64 include X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/amd64: amd64 include X-SVN-Commit-Revision: 350639 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 16:53:26 -0000 Author: kib Date: Tue Aug 6 16:53:25 2019 New Revision: 350639 URL: https://svnweb.freebsd.org/changeset/base/350639 Log: amd64: prevents speculations over swapgs reload of %gs base. Such speculations could use user-controlled %gs base, esp. since FreeBSD supports WRGSBASE instructions. Place LFENCEs on entry for each basic block after the test for previous kernel/user mode on the kernel entry, which prevents the speculation. Code accesses %gs-based PCPU before any serialization instructions are executed, like %cr3 reload for KPTI. With pti disabled, on haswell i7-4770S machine, "syscall_timings getppid" shows when no lfence is added to syscall path: test loop time iterations periteration getppid 0 1.040918865 4643611 0.000000224 getppid 1 1.004985962 4481816 0.000000224 getppid 2 1.005196483 4482363 0.000000224 with lfence: getppid 0 1.043701091 4554779 0.000000229 getppid 1 1.016930328 4438094 0.000000229 getppid 2 1.023223117 4466640 0.000000229 and ministat reports 'No difference proven at 95.0% confidence.' Security: CVE-2019-1125 Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/exception.S head/sys/amd64/include/asmacros.h Modified: head/sys/amd64/amd64/exception.S ============================================================================== --- head/sys/amd64/amd64/exception.S Tue Aug 6 16:12:43 2019 (r350638) +++ head/sys/amd64/amd64/exception.S Tue Aug 6 16:53:25 2019 (r350639) @@ -129,6 +129,7 @@ X\l: testb $SEL_RPL_MASK,TF_CS(%rsp) jz alltraps_noen_k swapgs + lfence jmp alltraps_noen_u .endm @@ -163,6 +164,7 @@ X\l: testb $SEL_RPL_MASK,TF_CS(%rsp) jz alltraps_k swapgs + lfence jmp alltraps_u .endm @@ -198,6 +200,7 @@ X\l: testb $SEL_RPL_MASK,TF_CS(%rsp) jz alltraps_k swapgs + lfence jmp alltraps_u .endm @@ -227,6 +230,7 @@ alltraps_u: .globl alltraps_k .type alltraps_k,@function alltraps_k: + lfence movq %rdi,TF_RDI(%rsp) movq %rdx,TF_RDX(%rsp) movq %rax,TF_RAX(%rsp) @@ -304,6 +308,7 @@ alltraps_noen_u: .globl alltraps_noen_k .type alltraps_noen_k,@function alltraps_noen_k: + lfence movq %rdi,TF_RDI(%rsp) alltraps_noen_save_segs: SAVE_SEGS @@ -343,7 +348,7 @@ IDTVEC(dblfault) testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ jz 1f /* already running with kernel GS.base */ swapgs -1: +1: lfence movq PCPU(KCR3),%rax cmpq $~0,%rax je 2f @@ -358,6 +363,7 @@ IDTVEC(page_pti) testb $SEL_RPL_MASK,PTI_CS-PTI_ERR(%rsp) jz page_k swapgs + lfence pushq %rax movq %cr3,%rax movq %rax,PCPU(SAVED_UCR3) @@ -373,6 +379,7 @@ IDTVEC(page) testb $SEL_RPL_MASK,TF_CS-TF_ERR(%rsp) /* Did we come from kernel? */ jnz page_u_swapgs /* already running with kernel GS.base */ page_k: + lfence subq $TF_ERR,%rsp movq %rdi,TF_RDI(%rsp) /* free up GP registers */ movq %rax,TF_RAX(%rsp) @@ -382,6 +389,7 @@ page_k: ALIGN_TEXT page_u_swapgs: swapgs + lfence page_u: subq $TF_ERR,%rsp movq %rdi,TF_RDI(%rsp) @@ -419,6 +427,7 @@ page_cr2: .macro PROTF_ENTRY name,trapno \name\()_pti_doreti: swapgs + lfence cmpq $~0,PCPU(UCR3) je 1f pushq %rax @@ -441,9 +450,9 @@ IDTVEC(\name\()_pti) cmpq $doreti_iret,PTI_RIP-2*8(%rsp) je \name\()_pti_doreti testb $SEL_RPL_MASK,PTI_CS-2*8(%rsp) /* %rax, %rdx not yet pushed */ - jz X\name + jz X\name /* lfence is not needed until %gs: use */ PTI_UENTRY has_err=1 - swapgs + swapgs /* fence provided by PTI_UENTRY */ IDTVEC(\name) subq $TF_ERR,%rsp movl $\trapno,TF_TRAPNO(%rsp) @@ -476,6 +485,7 @@ prot_addrf: jne 2f rdgsbase %rdx 2: swapgs + lfence movq PCPU(CURPCB),%rdi testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip) jz 4f @@ -495,7 +505,8 @@ prot_addrf: jmp alltraps_pushregs_no_rax 5: swapgs -6: movq PCPU(CURPCB),%rdi +6: lfence + movq PCPU(CURPCB),%rdi jmp 4b /* @@ -510,6 +521,7 @@ prot_addrf: SUPERALIGN_TEXT IDTVEC(fast_syscall_pti) swapgs + lfence movq %rax,PCPU(SCRATCH_RAX) cmpq $~0,PCPU(UCR3) je fast_syscall_common @@ -519,6 +531,7 @@ IDTVEC(fast_syscall_pti) SUPERALIGN_TEXT IDTVEC(fast_syscall) swapgs + lfence movq %rax,PCPU(SCRATCH_RAX) fast_syscall_common: movq %rsp,PCPU(SCRATCH_RSP) @@ -647,6 +660,7 @@ IDTVEC(dbg) popfq testb $SEL_RPL_MASK,TF_CS(%rsp) jnz dbg_fromuserspace + lfence /* * We've interrupted the kernel. Preserve GS.base in %r12, * %cr3 in %r13, and possibly lower half of MSR_IA32_SPEC_CTL in %r14d. @@ -702,6 +716,7 @@ dbg_fromuserspace: * in trap(). */ swapgs + lfence movq PCPU(KCR3),%rax cmpq $~0,%rax je 1f @@ -787,6 +802,7 @@ IDTVEC(nmi) * We've interrupted the kernel. Preserve GS.base in %r12, * %cr3 in %r13, and possibly lower half of MSR_IA32_SPEC_CTL in %r14d. */ + lfence movl $MSR_GSBASE,%ecx rdmsr movq %rax,%r12 @@ -812,6 +828,7 @@ IDTVEC(nmi) nmi_fromuserspace: incl %ebx swapgs + lfence movq %cr3,%r13 movq PCPU(KCR3),%rax cmpq $~0,%rax Modified: head/sys/amd64/include/asmacros.h ============================================================================== --- head/sys/amd64/include/asmacros.h Tue Aug 6 16:12:43 2019 (r350638) +++ head/sys/amd64/include/asmacros.h Tue Aug 6 16:53:25 2019 (r350639) @@ -196,6 +196,7 @@ .macro PTI_UENTRY has_err swapgs + lfence cmpq $~0,PCPU(UCR3) je 1f pushq %rax @@ -236,6 +237,7 @@ X\vec_name: jz .L\vec_name\()_u /* Yes, dont swapgs again */ swapgs .L\vec_name\()_u: + lfence subq $TF_RIP,%rsp /* skip dummy tf_err and tf_trapno */ movq %rdi,TF_RDI(%rsp) movq %rsi,TF_RSI(%rsp) From owner-svn-src-head@freebsd.org Tue Aug 6 20:21:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43BE3C9B0A; Tue, 6 Aug 2019 20:21:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4635df16NJz4Sfq; Tue, 6 Aug 2019 20:21:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0791D14B0; Tue, 6 Aug 2019 20:21:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76KLvL6057680; Tue, 6 Aug 2019 20:21:57 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76KLvAp057679; Tue, 6 Aug 2019 20:21:57 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201908062021.x76KLvAp057679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 6 Aug 2019 20:21:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350657 - head/sys/dev/ral X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/dev/ral X-SVN-Commit-Revision: 350657 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 20:21:58 -0000 Author: kevans Date: Tue Aug 6 20:21:57 2019 New Revision: 350657 URL: https://svnweb.freebsd.org/changeset/base/350657 Log: ral: rt2860: fix wcid2ni access/size issue RT2860_WCID_MAX is supposed to describe the max STA index for wcid2ni, and was instead being used as the size -- off-by-one. rt2860_drain_stats_fifo was range-checking wcid only after accessing out-of-bounds potentially. Submitted by: Augustin Cavalier (basically) Obtained from: Haiku (58d16d9fe2d5a209cf22823359a8407d138e1a87) Differential Revision: 3 days Modified: head/sys/dev/ral/rt2860.c head/sys/dev/ral/rt2860var.h Modified: head/sys/dev/ral/rt2860.c ============================================================================== --- head/sys/dev/ral/rt2860.c Tue Aug 6 20:13:28 2019 (r350656) +++ head/sys/dev/ral/rt2860.c Tue Aug 6 20:21:57 2019 (r350657) @@ -1092,10 +1092,12 @@ rt2860_drain_stats_fifo(struct rt2860_softc *sc) DPRINTFN(4, ("tx stat 0x%08x\n", stat)); wcid = (stat >> RT2860_TXQ_WCID_SHIFT) & 0xff; + if (wcid > RT2860_WCID_MAX) + continue; ni = sc->wcid2ni[wcid]; /* if no ACK was requested, no feedback is available */ - if (!(stat & RT2860_TXQ_ACKREQ) || wcid == 0xff || ni == NULL) + if (!(stat & RT2860_TXQ_ACKREQ) || ni == NULL) continue; /* update per-STA AMRR stats */ Modified: head/sys/dev/ral/rt2860var.h ============================================================================== --- head/sys/dev/ral/rt2860var.h Tue Aug 6 20:13:28 2019 (r350656) +++ head/sys/dev/ral/rt2860var.h Tue Aug 6 20:21:57 2019 (r350657) @@ -142,7 +142,7 @@ struct rt2860_softc { #define RT2860_PCIE (1 << 2) #define RT2860_RUNNING (1 << 3) - struct ieee80211_node *wcid2ni[RT2860_WCID_MAX]; + struct ieee80211_node *wcid2ni[RT2860_WCID_MAX + 1]; struct rt2860_tx_ring txq[6]; struct rt2860_rx_ring rxq; From owner-svn-src-head@freebsd.org Tue Aug 6 21:17:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC69DCA7DF; Tue, 6 Aug 2019 21:17:23 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4636sb5FJrz4VpQ; Tue, 6 Aug 2019 21:17:23 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90F121F2E; Tue, 6 Aug 2019 21:17:23 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76LHNaY088276; Tue, 6 Aug 2019 21:17:23 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76LHNOI088274; Tue, 6 Aug 2019 21:17:23 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201908062117.x76LHNOI088274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Tue, 6 Aug 2019 21:17:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350658 - head/tests/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: head/tests/sys/kern X-SVN-Commit-Revision: 350658 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 21:17:23 -0000 Author: jilles Date: Tue Aug 6 21:17:22 2019 New Revision: 350658 URL: https://svnweb.freebsd.org/changeset/base/350658 Log: Add a test for kill() on a zombie Added: head/tests/sys/kern/kill_zombie.c (contents, props changed) Modified: head/tests/sys/kern/Makefile Modified: head/tests/sys/kern/Makefile ============================================================================== --- head/tests/sys/kern/Makefile Tue Aug 6 20:21:57 2019 (r350657) +++ head/tests/sys/kern/Makefile Tue Aug 6 21:17:22 2019 (r350658) @@ -8,6 +8,7 @@ TESTSDIR= ${TESTSBASE}/sys/kern #ATF_TESTS_C+= kcov ATF_TESTS_C+= kern_copyin ATF_TESTS_C+= kern_descrip_test +ATF_TESTS_C+= kill_zombie ATF_TESTS_C+= ptrace_test TEST_METADATA.ptrace_test+= timeout="15" ATF_TESTS_C+= reaper Added: head/tests/sys/kern/kill_zombie.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/kern/kill_zombie.c Tue Aug 6 21:17:22 2019 (r350658) @@ -0,0 +1,65 @@ +/*- + * Copyright (c) 2018 Jilles Tjoelker + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include +#include + +ATF_TC_WITHOUT_HEAD(kill_zombie); +ATF_TC_BODY(kill_zombie, tc) +{ + pid_t child, pid; + int status, r; + + child = fork(); + ATF_REQUIRE(child != -1); + if (child == 0) { + _exit(42); + } + + r = waitid(P_PID, child, NULL, WEXITED | WNOWAIT); + ATF_REQUIRE(r == 0); + + r = kill(child, SIGTERM); + ATF_CHECK(r == 0); + + status = -1; + pid = waitpid(child, &status, 0); + ATF_REQUIRE(pid == child); + ATF_CHECK(WIFEXITED(status) && WEXITSTATUS(status) == 42); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, kill_zombie); + return (atf_no_error()); +} From owner-svn-src-head@freebsd.org Tue Aug 6 17:11:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA532C5E79; Tue, 6 Aug 2019 17:11:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4631Pv4Hzsz4DkG; Tue, 6 Aug 2019 17:11:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 762332F171; Tue, 6 Aug 2019 17:11:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76HBVMc039075; Tue, 6 Aug 2019 17:11:31 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76HBVrQ039074; Tue, 6 Aug 2019 17:11:31 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908061711.x76HBVrQ039074@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 6 Aug 2019 17:11:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350645 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 350645 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 17:11:31 -0000 Author: emaste Date: Tue Aug 6 17:11:30 2019 New Revision: 350645 URL: https://svnweb.freebsd.org/changeset/base/350645 Log: Correct ICMPv6/MLDv2 out-of-bounds memory access Previously the ICMPv6 input path incorrectly handled cases where an MLDv2 listener query packet was internally fragmented across multiple mbufs. admbugs: 921 Submitted by: jtl Reported by: CJD of Apple Approved by: so MFC after: 0 minutes Security: CVE-2019-5608 Modified: head/sys/netinet6/mld6.c Modified: head/sys/netinet6/mld6.c ============================================================================== --- head/sys/netinet6/mld6.c Tue Aug 6 17:11:17 2019 (r350644) +++ head/sys/netinet6/mld6.c Tue Aug 6 17:11:30 2019 (r350645) @@ -139,14 +139,15 @@ static int mld_v2_enqueue_group_record(struct mbufq *, struct in6_multi *, const int, const int, const int, const int); static int mld_v2_input_query(struct ifnet *, const struct ip6_hdr *, - struct mbuf *, const int, const int); + struct mbuf *, struct mldv2_query *, const int, const int); static int mld_v2_merge_state_changes(struct in6_multi *, struct mbufq *); static void mld_v2_process_group_timers(struct in6_multi_head *, struct mbufq *, struct mbufq *, struct in6_multi *, const int); static int mld_v2_process_group_query(struct in6_multi *, - struct mld_ifsoftc *mli, int, struct mbuf *, const int); + struct mld_ifsoftc *mli, int, struct mbuf *, + struct mldv2_query *, const int); static int sysctl_mld_gsr(SYSCTL_HANDLER_ARGS); static int sysctl_mld_ifinfo(SYSCTL_HANDLER_ARGS); @@ -804,16 +805,16 @@ mld_v1_update_group(struct in6_multi *inm, const int t * Process a received MLDv2 general, group-specific or * group-and-source-specific query. * - * Assumes that the query header has been pulled up to sizeof(mldv2_query). + * Assumes that mld points to a struct mldv2_query which is stored in + * contiguous memory. * * Return 0 if successful, otherwise an appropriate error code is returned. */ static int mld_v2_input_query(struct ifnet *ifp, const struct ip6_hdr *ip6, - struct mbuf *m, const int off, const int icmp6len) + struct mbuf *m, struct mldv2_query *mld, const int off, const int icmp6len) { struct mld_ifsoftc *mli; - struct mldv2_query *mld; struct in6_multi *inm; uint32_t maxdelay, nsrc, qqi; int is_general_query; @@ -845,8 +846,6 @@ mld_v2_input_query(struct ifnet *ifp, const struct ip6 CTR2(KTR_MLD, "input v2 query on ifp %p(%s)", ifp, if_name(ifp)); - mld = (struct mldv2_query *)(mtod(m, uint8_t *) + off); - maxdelay = ntohs(mld->mld_maxdelay); /* in 1/10ths of a second */ if (maxdelay >= 32768) { maxdelay = (MLD_MRC_MANT(maxdelay) | 0x1000) << @@ -973,7 +972,7 @@ mld_v2_input_query(struct ifnet *ifp, const struct ip6 * group-specific or group-and-source query. */ if (mli->mli_v2_timer == 0 || mli->mli_v2_timer >= timer) - mld_v2_process_group_query(inm, mli, timer, m, off); + mld_v2_process_group_query(inm, mli, timer, m, mld, off); /* XXX Clear embedded scope ID as userland won't expect it. */ in6_clearscope(&mld->mld_addr); @@ -994,9 +993,8 @@ out_locked: */ static int mld_v2_process_group_query(struct in6_multi *inm, struct mld_ifsoftc *mli, - int timer, struct mbuf *m0, const int off) + int timer, struct mbuf *m0, struct mldv2_query *mld, const int off) { - struct mldv2_query *mld; int retval; uint16_t nsrc; @@ -1004,7 +1002,6 @@ mld_v2_process_group_query(struct in6_multi *inm, stru MLD_LOCK_ASSERT(); retval = 0; - mld = (struct mldv2_query *)(mtod(m0, uint8_t *) + off); switch (inm->in6m_state) { case MLD_NOT_MEMBER: @@ -1024,6 +1021,15 @@ mld_v2_process_group_query(struct in6_multi *inm, stru nsrc = ntohs(mld->mld_numsrc); + /* Length should be checked by calling function. */ + KASSERT((m0->m_flags & M_PKTHDR) == 0 || + m0->m_pkthdr.len >= off + sizeof(struct mldv2_query) + + nsrc * sizeof(struct in6_addr), + ("mldv2 packet is too short: (%d bytes < %zd bytes, m=%p)", + m0->m_pkthdr.len, off + sizeof(struct mldv2_query) + + nsrc * sizeof(struct in6_addr), m0)); + + /* * Deal with group-specific queries upfront. * If any group query is already pending, purge any recorded @@ -1065,28 +1071,20 @@ mld_v2_process_group_query(struct in6_multi *inm, stru * report for those sources. */ if (inm->in6m_nsrc > 0) { - struct mbuf *m; - uint8_t *sp; + struct in6_addr srcaddr; int i, nrecorded; int soff; - m = m0; soff = off + sizeof(struct mldv2_query); nrecorded = 0; for (i = 0; i < nsrc; i++) { - sp = mtod(m, uint8_t *) + soff; - retval = in6m_record_source(inm, - (const struct in6_addr *)sp); + m_copydata(m0, soff, sizeof(struct in6_addr), + (caddr_t)&srcaddr); + retval = in6m_record_source(inm, &srcaddr); if (retval < 0) break; nrecorded += retval; soff += sizeof(struct in6_addr); - if (soff >= m->m_len) { - soff = soff - m->m_len; - m = m->m_next; - if (m == NULL) - break; - } } if (nrecorded > 0) { CTR1(KTR_MLD, @@ -1296,8 +1294,8 @@ mld_input(struct mbuf *m, int off, int icmp6len) if (mld_v1_input_query(ifp, ip6, mld) != 0) return (0); } else if (icmp6len >= sizeof(struct mldv2_query)) { - if (mld_v2_input_query(ifp, ip6, m, off, - icmp6len) != 0) + if (mld_v2_input_query(ifp, ip6, m, + (struct mldv2_query *)mld, off, icmp6len) != 0) return (0); } break; From owner-svn-src-head@freebsd.org Tue Aug 6 21:50:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95CE3CAF58; Tue, 6 Aug 2019 21:50:36 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4637bw4H3tz4X2F; Tue, 6 Aug 2019 21:50:36 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75B81249E; Tue, 6 Aug 2019 21:50:36 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76Loaw8006255; Tue, 6 Aug 2019 21:50:36 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76LoYvh006243; Tue, 6 Aug 2019 21:50:34 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201908062150.x76LoYvh006243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 6 Aug 2019 21:50:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350659 - in head: lib/libmemstat sys/conf sys/vm usr.bin/vmstat X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head: lib/libmemstat sys/conf sys/vm usr.bin/vmstat X-SVN-Commit-Revision: 350659 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 21:50:36 -0000 Author: jeff Date: Tue Aug 6 21:50:34 2019 New Revision: 350659 URL: https://svnweb.freebsd.org/changeset/base/350659 Log: Add two new kernel options to control memory locality on NUMA hardware. - UMA_XDOMAIN enables an additional per-cpu bucket for freed memory that was freed on a different domain from where it was allocated. This is only used for UMA_ZONE_NUMA (first-touch) zones. - UMA_FIRSTTOUCH sets the default UMA policy to be first-touch for all zones. This tries to maintain locality for kernel memory. Reviewed by: gallatin, alc, kib Tested by: pho, gallatin Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20929 Modified: head/lib/libmemstat/memstat.c head/lib/libmemstat/memstat.h head/lib/libmemstat/memstat_internal.h head/lib/libmemstat/memstat_uma.c head/sys/conf/options head/sys/vm/uma.h head/sys/vm/uma_core.c head/sys/vm/uma_int.h head/sys/vm/vm_phys.c head/sys/vm/vm_phys.h head/usr.bin/vmstat/vmstat.c Modified: head/lib/libmemstat/memstat.c ============================================================================== --- head/lib/libmemstat/memstat.c Tue Aug 6 21:17:22 2019 (r350658) +++ head/lib/libmemstat/memstat.c Tue Aug 6 21:50:34 2019 (r350659) @@ -326,6 +326,13 @@ memstat_get_sleeps(const struct memory_type *mtp) return (mtp->mt_sleeps); } +uint64_t +memstat_get_xdomain(const struct memory_type *mtp) +{ + + return (mtp->mt_xdomain); +} + void * memstat_get_caller_pointer(const struct memory_type *mtp, int index) { Modified: head/lib/libmemstat/memstat.h ============================================================================== --- head/lib/libmemstat/memstat.h Tue Aug 6 21:17:22 2019 (r350658) +++ head/lib/libmemstat/memstat.h Tue Aug 6 21:50:34 2019 (r350659) @@ -136,6 +136,7 @@ uint64_t memstat_get_count(const struct memory_type * uint64_t memstat_get_free(const struct memory_type *mtp); uint64_t memstat_get_failures(const struct memory_type *mtp); uint64_t memstat_get_sleeps(const struct memory_type *mtp); +uint64_t memstat_get_xdomain(const struct memory_type *mtp); void *memstat_get_caller_pointer(const struct memory_type *mtp, int index); void memstat_set_caller_pointer(struct memory_type *mtp, Modified: head/lib/libmemstat/memstat_internal.h ============================================================================== --- head/lib/libmemstat/memstat_internal.h Tue Aug 6 21:17:22 2019 (r350658) +++ head/lib/libmemstat/memstat_internal.h Tue Aug 6 21:50:34 2019 (r350659) @@ -69,6 +69,7 @@ struct memory_type { uint64_t mt_free; /* Number of cached free items. */ uint64_t mt_failures; /* Number of allocation failures. */ uint64_t mt_sleeps; /* Number of allocation sleeps. */ + uint64_t mt_xdomain; /* Number of cross domain sleeps. */ /* * Caller-owned memory. Modified: head/lib/libmemstat/memstat_uma.c ============================================================================== --- head/lib/libmemstat/memstat_uma.c Tue Aug 6 21:17:22 2019 (r350658) +++ head/lib/libmemstat/memstat_uma.c Tue Aug 6 21:50:34 2019 (r350659) @@ -201,6 +201,7 @@ retry: mtp->mt_numfrees = uthp->uth_frees; mtp->mt_failures = uthp->uth_fails; mtp->mt_sleeps = uthp->uth_sleeps; + mtp->mt_xdomain = uthp->uth_xdomain; for (j = 0; j < maxcpus; j++) { upsp = (struct uma_percpu_stat *)p; @@ -423,11 +424,11 @@ memstat_kvm_uma(struct memory_type_list *list, void *k mtp->mt_failures = kvm_counter_u64_fetch(kvm, (unsigned long )uz.uz_fails); mtp->mt_sleeps = uz.uz_sleeps; - /* See comment above in memstat_sysctl_uma(). */ if (mtp->mt_numallocs < mtp->mt_numfrees) mtp->mt_numallocs = mtp->mt_numfrees; + mtp->mt_xdomain = uz.uz_xdomain; if (kz.uk_flags & UMA_ZFLAG_INTERNAL) goto skip_percpu; for (i = 0; i < mp_maxid + 1; i++) { Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Tue Aug 6 21:17:22 2019 (r350658) +++ head/sys/conf/options Tue Aug 6 21:50:34 2019 (r350659) @@ -618,6 +618,8 @@ NO_SWAPPING opt_vm.h MALLOC_MAKE_FAILURES opt_vm.h MALLOC_PROFILE opt_vm.h MALLOC_DEBUG_MAXZONES opt_vm.h +UMA_XDOMAIN opt_vm.h +UMA_FIRSTTOUCH opt_vm.h # The MemGuard replacement allocator used for tamper-after-free detection DEBUG_MEMGUARD opt_vm.h Modified: head/sys/vm/uma.h ============================================================================== --- head/sys/vm/uma.h Tue Aug 6 21:17:22 2019 (r350658) +++ head/sys/vm/uma.h Tue Aug 6 21:50:34 2019 (r350659) @@ -282,7 +282,7 @@ uma_zone_t uma_zcache_create(char *name, int size, uma */ #define UMA_ZONE_INHERIT \ (UMA_ZONE_OFFPAGE | UMA_ZONE_MALLOC | UMA_ZONE_NOFREE | \ - UMA_ZONE_HASH | UMA_ZONE_VTOSLAB | UMA_ZONE_PCPU) + UMA_ZONE_HASH | UMA_ZONE_VTOSLAB | UMA_ZONE_PCPU | UMA_ZONE_NUMA) /* Definitions for align */ #define UMA_ALIGN_PTR (sizeof(void *) - 1) /* Alignment fit for ptr */ @@ -689,7 +689,8 @@ struct uma_type_header { uint64_t uth_frees; /* Zone: number of frees. */ uint64_t uth_fails; /* Zone: number of alloc failures. */ uint64_t uth_sleeps; /* Zone: number of alloc sleeps. */ - uint64_t _uth_reserved1[2]; /* Reserved. */ + uint64_t uth_xdomain; /* Zone: Number of cross domain frees. */ + uint64_t _uth_reserved1[1]; /* Reserved. */ }; struct uma_percpu_stat { Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Tue Aug 6 21:17:22 2019 (r350658) +++ head/sys/vm/uma_core.c Tue Aug 6 21:50:34 2019 (r350659) @@ -785,12 +785,17 @@ cache_drain(uma_zone_t zone) CPU_FOREACH(cpu) { cache = &zone->uz_cpu[cpu]; bucket_drain(zone, cache->uc_allocbucket); - bucket_drain(zone, cache->uc_freebucket); if (cache->uc_allocbucket != NULL) bucket_free(zone, cache->uc_allocbucket, NULL); + cache->uc_allocbucket = NULL; + bucket_drain(zone, cache->uc_freebucket); if (cache->uc_freebucket != NULL) bucket_free(zone, cache->uc_freebucket, NULL); - cache->uc_allocbucket = cache->uc_freebucket = NULL; + cache->uc_freebucket = NULL; + bucket_drain(zone, cache->uc_crossbucket); + if (cache->uc_crossbucket != NULL) + bucket_free(zone, cache->uc_crossbucket, NULL); + cache->uc_crossbucket = NULL; } ZONE_LOCK(zone); bucket_cache_drain(zone); @@ -813,13 +818,13 @@ static void cache_drain_safe_cpu(uma_zone_t zone) { uma_cache_t cache; - uma_bucket_t b1, b2; + uma_bucket_t b1, b2, b3; int domain; if (zone->uz_flags & UMA_ZFLAG_INTERNAL) return; - b1 = b2 = NULL; + b1 = b2 = b3 = NULL; ZONE_LOCK(zone); critical_enter(); if (zone->uz_flags & UMA_ZONE_NUMA) @@ -843,12 +848,18 @@ cache_drain_safe_cpu(uma_zone_t zone) b2 = cache->uc_freebucket; cache->uc_freebucket = NULL; } + b3 = cache->uc_crossbucket; + cache->uc_crossbucket = NULL; critical_exit(); ZONE_UNLOCK(zone); if (b1) bucket_free(zone, b1, NULL); if (b2) bucket_free(zone, b2, NULL); + if (b3) { + bucket_drain(zone, b3); + bucket_free(zone, b3, NULL); + } } /* @@ -1754,6 +1765,7 @@ zone_ctor(void *mem, int size, void *udata, int flags) zone->uz_init = NULL; zone->uz_fini = NULL; zone->uz_sleeps = 0; + zone->uz_xdomain = 0; zone->uz_count = 0; zone->uz_count_min = 0; zone->uz_count_max = BUCKET_MAX; @@ -2185,6 +2197,11 @@ uma_zcreate(const char *name, size_t size, uma_ctor ct KASSERT(powerof2(align + 1), ("invalid zone alignment %d for \"%s\"", align, name)); + /* Sets all zones to a first-touch domain policy. */ +#ifdef UMA_FIRSTTOUCH + flags |= UMA_ZONE_NUMA; +#endif + /* This stuff is essential for the zone ctor */ memset(&args, 0, sizeof(args)); args.name = name; @@ -2456,16 +2473,13 @@ zalloc_start: if (bucket != NULL) bucket_free(zone, bucket, udata); - if (zone->uz_flags & UMA_ZONE_NUMA) { - domain = PCPU_GET(domain); - if (VM_DOMAIN_EMPTY(domain)) - domain = UMA_ANYDOMAIN; - } else - domain = UMA_ANYDOMAIN; - /* Short-circuit for zones without buckets and low memory. */ if (zone->uz_count == 0 || bucketdisable) { ZONE_LOCK(zone); + if (zone->uz_flags & UMA_ZONE_NUMA) + domain = PCPU_GET(domain); + else + domain = UMA_ANYDOMAIN; goto zalloc_item; } @@ -2497,10 +2511,14 @@ zalloc_start: /* * Check the zone's cache of buckets. */ - if (domain == UMA_ANYDOMAIN) - zdom = &zone->uz_domain[0]; - else + if (zone->uz_flags & UMA_ZONE_NUMA) { + domain = PCPU_GET(domain); zdom = &zone->uz_domain[domain]; + } else { + domain = UMA_ANYDOMAIN; + zdom = &zone->uz_domain[0]; + } + if ((bucket = zone_try_fetch_bucket(zone, zdom, true)) != NULL) { KASSERT(bucket->ub_cnt != 0, ("uma_zalloc_arg: Returning an empty bucket.")); @@ -2842,6 +2860,10 @@ zone_alloc_bucket(uma_zone_t zone, void *udata, int do CTR1(KTR_UMA, "zone_alloc:_bucket domain %d)", domain); + /* Avoid allocs targeting empty domains. */ + if (domain != UMA_ANYDOMAIN && VM_DOMAIN_EMPTY(domain)) + domain = UMA_ANYDOMAIN; + /* Don't wait for buckets, preserve caller's NOVM setting. */ bucket = bucket_alloc(zone, udata, M_NOWAIT | (flags & M_NOVM)); if (bucket == NULL) @@ -2941,11 +2963,10 @@ zone_alloc_item_locked(uma_zone_t zone, void *udata, i } ZONE_UNLOCK(zone); - if (domain != UMA_ANYDOMAIN) { - /* avoid allocs targeting empty domains */ - if (VM_DOMAIN_EMPTY(domain)) - domain = UMA_ANYDOMAIN; - } + /* Avoid allocs targeting empty domains. */ + if (domain != UMA_ANYDOMAIN && VM_DOMAIN_EMPTY(domain)) + domain = UMA_ANYDOMAIN; + if (zone->uz_import(zone->uz_arg, &item, 1, domain, flags) != 1) goto fail; @@ -3006,6 +3027,9 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata uma_bucket_t bucket; uma_zone_domain_t zdom; int cpu, domain; +#ifdef UMA_XDOMAIN + int itemdomain; +#endif bool lockfail; #ifdef INVARIANTS bool skipdbg; @@ -3055,6 +3079,11 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata if (zone->uz_sleepers > 0) goto zfree_item; +#ifdef UMA_XDOMAIN + if ((zone->uz_flags & UMA_ZONE_NUMA) != 0) + itemdomain = _vm_phys_domain(pmap_kextract((vm_offset_t)item)); +#endif + /* * If possible, free to the per-CPU cache. There are two * requirements for safe access to the per-CPU cache: (1) the thread @@ -3072,14 +3101,26 @@ zfree_restart: cache = &zone->uz_cpu[cpu]; zfree_start: + domain = PCPU_GET(domain); +#ifdef UMA_XDOMAIN + if ((zone->uz_flags & UMA_ZONE_NUMA) == 0) + itemdomain = domain; +#endif /* * Try to free into the allocbucket first to give LIFO ordering * for cache-hot datastructures. Spill over into the freebucket * if necessary. Alloc will swap them if one runs dry. */ - bucket = cache->uc_allocbucket; - if (bucket == NULL || bucket->ub_cnt >= bucket->ub_entries) - bucket = cache->uc_freebucket; +#ifdef UMA_XDOMAIN + if (domain != itemdomain) { + bucket = cache->uc_crossbucket; + } else +#endif + { + bucket = cache->uc_allocbucket; + if (bucket == NULL || bucket->ub_cnt >= bucket->ub_entries) + bucket = cache->uc_freebucket; + } if (bucket != NULL && bucket->ub_cnt < bucket->ub_entries) { KASSERT(bucket->ub_bucket[bucket->ub_cnt] == NULL, ("uma_zfree: Freeing to non free bucket index.")); @@ -3110,24 +3151,66 @@ zfree_start: } critical_enter(); cpu = curcpu; + domain = PCPU_GET(domain); cache = &zone->uz_cpu[cpu]; - bucket = cache->uc_freebucket; +#ifdef UMA_XDOMAIN + if (domain != itemdomain) + bucket = cache->uc_crossbucket; + else +#endif + bucket = cache->uc_freebucket; if (bucket != NULL && bucket->ub_cnt < bucket->ub_entries) { ZONE_UNLOCK(zone); goto zfree_start; } - cache->uc_freebucket = NULL; +#ifdef UMA_XDOMAIN + if (domain != itemdomain) + cache->uc_crossbucket = NULL; + else +#endif + cache->uc_freebucket = NULL; /* We are no longer associated with this CPU. */ critical_exit(); +#ifdef UMA_XDOMAIN + if (domain != itemdomain) { + if (bucket != NULL) { + zone->uz_xdomain += bucket->ub_cnt; + if (vm_ndomains > 2 || + zone->uz_bkt_count >= zone->uz_bkt_max) { + ZONE_UNLOCK(zone); + bucket_drain(zone, bucket); + bucket_free(zone, bucket, udata); + } else { + zdom = &zone->uz_domain[itemdomain]; + zone_put_bucket(zone, zdom, bucket, true); + ZONE_UNLOCK(zone); + } + } else + ZONE_UNLOCK(zone); + bucket = bucket_alloc(zone, udata, M_NOWAIT); + if (bucket == NULL) + goto zfree_item; + critical_enter(); + cpu = curcpu; + cache = &zone->uz_cpu[cpu]; + if (cache->uc_crossbucket == NULL) { + cache->uc_crossbucket = bucket; + goto zfree_start; + } + critical_exit(); + bucket_free(zone, bucket, udata); + goto zfree_restart; + } +#endif + if ((zone->uz_flags & UMA_ZONE_NUMA) != 0) { - domain = PCPU_GET(domain); - if (VM_DOMAIN_EMPTY(domain)) - domain = UMA_ANYDOMAIN; - } else + zdom = &zone->uz_domain[domain]; + } else { domain = 0; - zdom = &zone->uz_domain[0]; + zdom = &zone->uz_domain[0]; + } /* Can we throw this on the zone full list? */ if (bucket != NULL) { @@ -3768,11 +3851,13 @@ slab_print(uma_slab_t slab) static void cache_print(uma_cache_t cache) { - printf("alloc: %p(%d), free: %p(%d)\n", + printf("alloc: %p(%d), free: %p(%d), cross: %p(%d)j\n", cache->uc_allocbucket, cache->uc_allocbucket?cache->uc_allocbucket->ub_cnt:0, cache->uc_freebucket, - cache->uc_freebucket?cache->uc_freebucket->ub_cnt:0); + cache->uc_freebucket?cache->uc_freebucket->ub_cnt:0, + cache->uc_crossbucket, + cache->uc_crossbucket?cache->uc_crossbucket->ub_cnt:0); } static void @@ -3834,13 +3919,13 @@ uma_print_zone(uma_zone_t zone) */ static void uma_zone_sumstat(uma_zone_t z, long *cachefreep, uint64_t *allocsp, - uint64_t *freesp, uint64_t *sleepsp) + uint64_t *freesp, uint64_t *sleepsp, uint64_t *xdomainp) { uma_cache_t cache; - uint64_t allocs, frees, sleeps; + uint64_t allocs, frees, sleeps, xdomain; int cachefree, cpu; - allocs = frees = sleeps = 0; + allocs = frees = sleeps = xdomain = 0; cachefree = 0; CPU_FOREACH(cpu) { cache = &z->uz_cpu[cpu]; @@ -3848,12 +3933,17 @@ uma_zone_sumstat(uma_zone_t z, long *cachefreep, uint6 cachefree += cache->uc_allocbucket->ub_cnt; if (cache->uc_freebucket != NULL) cachefree += cache->uc_freebucket->ub_cnt; + if (cache->uc_crossbucket != NULL) { + xdomain += cache->uc_crossbucket->ub_cnt; + cachefree += cache->uc_crossbucket->ub_cnt; + } allocs += cache->uc_allocs; frees += cache->uc_frees; } allocs += counter_u64_fetch(z->uz_allocs); frees += counter_u64_fetch(z->uz_frees); sleeps += z->uz_sleeps; + xdomain += z->uz_xdomain; if (cachefreep != NULL) *cachefreep = cachefree; if (allocsp != NULL) @@ -3862,6 +3952,8 @@ uma_zone_sumstat(uma_zone_t z, long *cachefreep, uint6 *freesp = frees; if (sleepsp != NULL) *sleepsp = sleeps; + if (xdomainp != NULL) + *xdomainp = xdomain; } #endif /* DDB */ @@ -3902,6 +3994,7 @@ uma_vm_zone_stats(struct uma_type_header *uth, uma_zon uth->uth_frees = counter_u64_fetch(z->uz_frees); uth->uth_fails = counter_u64_fetch(z->uz_fails); uth->uth_sleeps = z->uz_sleeps; + uth->uth_xdomain = z->uz_xdomain; /* * While it is not normally safe to access the cache * bucket pointers while not on the CPU that owns the @@ -3921,6 +4014,9 @@ uma_vm_zone_stats(struct uma_type_header *uth, uma_zon if (cache->uc_freebucket != NULL) ups[i].ups_cache_free += cache->uc_freebucket->ub_cnt; + if (cache->uc_crossbucket != NULL) + ups[i].ups_cache_free += + cache->uc_crossbucket->ub_cnt; ups[i].ups_allocs = cache->uc_allocs; ups[i].ups_frees = cache->uc_frees; } @@ -4176,12 +4272,12 @@ DB_SHOW_COMMAND(uma, db_show_uma) { uma_keg_t kz; uma_zone_t z; - uint64_t allocs, frees, sleeps; + uint64_t allocs, frees, sleeps, xdomain; long cachefree; int i; - db_printf("%18s %8s %8s %8s %12s %8s %8s\n", "Zone", "Size", "Used", - "Free", "Requests", "Sleeps", "Bucket"); + db_printf("%18s %8s %8s %8s %12s %8s %8s %8s\n", "Zone", "Size", "Used", + "Free", "Requests", "Sleeps", "Bucket", "XFree"); LIST_FOREACH(kz, &uma_kegs, uk_link) { LIST_FOREACH(z, &kz->uk_zones, uz_link) { if (kz->uk_flags & UMA_ZFLAG_INTERNAL) { @@ -4191,17 +4287,17 @@ DB_SHOW_COMMAND(uma, db_show_uma) cachefree = 0; } else uma_zone_sumstat(z, &cachefree, &allocs, - &frees, &sleeps); + &frees, &sleeps, &xdomain); if (!((z->uz_flags & UMA_ZONE_SECONDARY) && (LIST_FIRST(&kz->uk_zones) != z))) cachefree += kz->uk_free; for (i = 0; i < vm_ndomains; i++) cachefree += z->uz_domain[i].uzd_nitems; - db_printf("%18s %8ju %8jd %8ld %12ju %8ju %8u\n", + db_printf("%18s %8ju %8jd %8ld %12ju %8ju %8u %8ju\n", z->uz_name, (uintmax_t)kz->uk_size, (intmax_t)(allocs - frees), cachefree, - (uintmax_t)allocs, sleeps, z->uz_count); + (uintmax_t)allocs, sleeps, z->uz_count, xdomain); if (db_pager_quit) return; } @@ -4218,7 +4314,7 @@ DB_SHOW_COMMAND(umacache, db_show_umacache) db_printf("%18s %8s %8s %8s %12s %8s\n", "Zone", "Size", "Used", "Free", "Requests", "Bucket"); LIST_FOREACH(z, &uma_cachezones, uz_link) { - uma_zone_sumstat(z, &cachefree, &allocs, &frees, NULL); + uma_zone_sumstat(z, &cachefree, &allocs, &frees, NULL, NULL); for (i = 0; i < vm_ndomains; i++) cachefree += z->uz_domain[i].uzd_nitems; db_printf("%18s %8ju %8jd %8ld %12ju %8u\n", Modified: head/sys/vm/uma_int.h ============================================================================== --- head/sys/vm/uma_int.h Tue Aug 6 21:17:22 2019 (r350658) +++ head/sys/vm/uma_int.h Tue Aug 6 21:50:34 2019 (r350659) @@ -208,6 +208,7 @@ typedef struct uma_bucket * uma_bucket_t; struct uma_cache { uma_bucket_t uc_freebucket; /* Bucket we're freeing to */ uma_bucket_t uc_allocbucket; /* Bucket to allocate from */ + uma_bucket_t uc_crossbucket; /* cross domain bucket */ uint64_t uc_allocs; /* Count of allocations */ uint64_t uc_frees; /* Count of frees */ } UMA_ALIGN; @@ -368,6 +369,7 @@ struct uma_zone { counter_u64_t uz_frees; /* Total number of frees */ counter_u64_t uz_fails; /* Total number of alloc failures */ uint64_t uz_sleeps; /* Total number of alloc sleeps */ + uint64_t uz_xdomain; /* Total number of cross-domain frees */ /* * This HAS to be the last item because we adjust the zone size Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Tue Aug 6 21:17:22 2019 (r350658) +++ head/sys/vm/vm_phys.c Tue Aug 6 21:50:34 2019 (r350659) @@ -623,6 +623,26 @@ vm_phys_register_domains(int ndomains, struct mem_affi #endif } +int +_vm_phys_domain(vm_paddr_t pa) +{ +#ifdef NUMA + int i; + + if (vm_ndomains == 1 || mem_affinity == NULL) + return (0); + + /* + * Check for any memory that overlaps. + */ + for (i = 0; mem_affinity[i].end != 0; i++) + if (mem_affinity[i].start <= pa && + mem_affinity[i].end >= pa) + return (mem_affinity[i].domain); +#endif + return (0); +} + /* * Split a contiguous, power of two-sized set of physical pages. * Modified: head/sys/vm/vm_phys.h ============================================================================== --- head/sys/vm/vm_phys.h Tue Aug 6 21:17:22 2019 (r350658) +++ head/sys/vm/vm_phys.h Tue Aug 6 21:50:34 2019 (r350659) @@ -123,6 +123,7 @@ vm_phys_domain(vm_page_t m) return (0); #endif } +int _vm_phys_domain(vm_paddr_t pa); #endif /* _KERNEL */ #endif /* !_VM_PHYS_H_ */ Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Tue Aug 6 21:17:22 2019 (r350658) +++ head/usr.bin/vmstat/vmstat.c Tue Aug 6 21:50:34 2019 (r350659) @@ -1483,9 +1483,9 @@ domemstat_zone(void) } } xo_open_container("memory-zone-statistics"); - xo_emit("{T:/%-20s} {T:/%6s} {T:/%6s} {T:/%8s} {T:/%8s} {T:/%8s} " + xo_emit("{T:/%-20s} {T:/%6s} {T:/%6s} {T:/%8s} {T:/%8s} {T:/%8s} {T:/%8s}" "{T:/%4s} {T:/%4s}\n\n", "ITEM", "SIZE", - "LIMIT", "USED", "FREE", "REQ", "FAIL", "SLEEP"); + "LIMIT", "USED", "FREE", "REQ", "FAIL", "SLEEP", "XDOMAIN"); xo_open_list("zone"); for (mtp = memstat_mtl_first(mtlp); mtp != NULL; mtp = memstat_mtl_next(mtp)) { @@ -1495,7 +1495,7 @@ domemstat_zone(void) xo_emit("{d:name/%-20s}{ke:name/%s} {:size/%6ju}, " "{:limit/%6ju},{:used/%8ju}," "{:free/%8ju},{:requests/%8ju}," - "{:fail/%4ju},{:sleep/%4ju}\n", name, + "{:fail/%4ju},{:sleep/%4ju},{:xdomain/%4ju}\n", name, memstat_get_name(mtp), (uintmax_t)memstat_get_size(mtp), (uintmax_t)memstat_get_countlimit(mtp), @@ -1503,7 +1503,8 @@ domemstat_zone(void) (uintmax_t)memstat_get_free(mtp), (uintmax_t)memstat_get_numallocs(mtp), (uintmax_t)memstat_get_failures(mtp), - (uintmax_t)memstat_get_sleeps(mtp)); + (uintmax_t)memstat_get_sleeps(mtp), + (uintmax_t)memstat_get_xdomain(mtp)); xo_close_instance("zone"); } memstat_mtl_free(mtlp); From owner-svn-src-head@freebsd.org Tue Aug 6 19:27:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B1B4C8EE8; Tue, 6 Aug 2019 19:27:29 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4634Qn2z5Dz4N28; Tue, 6 Aug 2019 19:27:29 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 479F0B34; Tue, 6 Aug 2019 19:27:29 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76JRTZX022876; Tue, 6 Aug 2019 19:27:29 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76JRRrn022866; Tue, 6 Aug 2019 19:27:27 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201908061927.x76JRRrn022866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 6 Aug 2019 19:27:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350654 - in head/stand/efi: boot1 gptboot libefi loader X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in head/stand/efi: boot1 gptboot libefi loader X-SVN-Commit-Revision: 350654 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 19:27:29 -0000 Author: tsoome Date: Tue Aug 6 19:27:27 2019 New Revision: 350654 URL: https://svnweb.freebsd.org/changeset/base/350654 Log: loader.efi: replace HandleProtocol() with OpenProtocol() The HandleProtocol() is deprecated interface and we should use OpenProtocol() instead. Moreover, in some firmware implementation(s), the HandleProtocol() does return device path using static storage, so we can not keep the value returned there. With same firmware, the OpenProtocol() does return data we do not need to clone. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D21162 Modified: head/stand/efi/boot1/proto.c head/stand/efi/gptboot/proto.c head/stand/efi/libefi/devpath.c head/stand/efi/libefi/efinet.c head/stand/efi/libefi/efipart.c head/stand/efi/loader/efi_main.c head/stand/efi/loader/framebuffer.c head/stand/efi/loader/main.c Modified: head/stand/efi/boot1/proto.c ============================================================================== --- head/stand/efi/boot1/proto.c Tue Aug 6 18:28:44 2019 (r350653) +++ head/stand/efi/boot1/proto.c Tue Aug 6 19:27:27 2019 (r350654) @@ -61,7 +61,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) int preferred; /* Figure out if we're dealing with an actual partition. */ - status = BS->HandleProtocol(h, &DevicePathGUID, (void **)&devpath); + status = OpenProtocolByHandle(h, &DevicePathGUID, (void **)&devpath); if (status == EFI_UNSUPPORTED) return (0); @@ -77,7 +77,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) efi_free_devpath_name(text); } #endif - status = BS->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); + status = OpenProtocolByHandle(h, &BlockIoProtocolGUID, (void **)&blkio); if (status == EFI_UNSUPPORTED) return (0); Modified: head/stand/efi/gptboot/proto.c ============================================================================== --- head/stand/efi/gptboot/proto.c Tue Aug 6 18:28:44 2019 (r350653) +++ head/stand/efi/gptboot/proto.c Tue Aug 6 19:27:27 2019 (r350654) @@ -146,7 +146,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) EFI_STATUS status; /* Figure out if we're dealing with an actual partition. */ - status = BS->HandleProtocol(h, &DevicePathGUID, (void **)&devpath); + status = OpenProtocolByHandle(h, &DevicePathGUID, (void **)&devpath); if (status != EFI_SUCCESS) return; #ifdef EFI_DEBUG @@ -169,7 +169,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) return; } } - status = BS->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); + status = OpenProtocolByHandle(h, &BlockIoProtocolGUID, (void **)&blkio); if (status != EFI_SUCCESS) { DPRINTF("Can't get the block I/O protocol block\n"); return; Modified: head/stand/efi/libefi/devpath.c ============================================================================== --- head/stand/efi/libefi/devpath.c Tue Aug 6 18:28:44 2019 (r350653) +++ head/stand/efi/libefi/devpath.c Tue Aug 6 19:27:27 2019 (r350654) @@ -44,8 +44,8 @@ efi_lookup_image_devpath(EFI_HANDLE handle) EFI_DEVICE_PATH *devpath; EFI_STATUS status; - status = BS->HandleProtocol(handle, &ImageDevicePathGUID, - (VOID **)&devpath); + status = OpenProtocolByHandle(handle, &ImageDevicePathGUID, + (void **)&devpath); if (EFI_ERROR(status)) devpath = NULL; return (devpath); @@ -57,7 +57,8 @@ efi_lookup_devpath(EFI_HANDLE handle) EFI_DEVICE_PATH *devpath; EFI_STATUS status; - status = BS->HandleProtocol(handle, &DevicePathGUID, (VOID **)&devpath); + status = OpenProtocolByHandle(handle, &DevicePathGUID, + (void **)&devpath); if (EFI_ERROR(status)) devpath = NULL; return (devpath); Modified: head/stand/efi/libefi/efinet.c ============================================================================== --- head/stand/efi/libefi/efinet.c Tue Aug 6 18:28:44 2019 (r350653) +++ head/stand/efi/libefi/efinet.c Tue Aug 6 19:27:27 2019 (r350654) @@ -286,7 +286,7 @@ efinet_init(struct iodesc *desc, void *machdep_hint) } h = nif->nif_driver->netif_ifs[nif->nif_unit].dif_private; - status = BS->HandleProtocol(h, &sn_guid, (VOID **)&nif->nif_devdata); + status = OpenProtocolByHandle(h, &sn_guid, (void **)&nif->nif_devdata); if (status != EFI_SUCCESS) { printf("net%d: cannot fetch interface data (status=%lu)\n", nif->nif_unit, EFI_ERROR_CODE(status)); Modified: head/stand/efi/libefi/efipart.c ============================================================================== --- head/stand/efi/libefi/efipart.c Tue Aug 6 18:28:44 2019 (r350653) +++ head/stand/efi/libefi/efipart.c Tue Aug 6 19:27:27 2019 (r350654) @@ -297,8 +297,8 @@ efipart_hdd(EFI_DEVICE_PATH *dp) } /* Make sure we do have the media. */ - status = BS->HandleProtocol(efipart_handles[i], - &blkio_guid, (void **)&blkio); + status = OpenProtocolByHandle(efipart_handles[i], &blkio_guid, + (void **)&blkio); if (EFI_ERROR(status)) return (false); @@ -439,8 +439,8 @@ efipart_updatecd(void) if (efipart_hdd(devpath)) continue; - status = BS->HandleProtocol(efipart_handles[i], - &blkio_guid, (void **)&blkio); + status = OpenProtocolByHandle(efipart_handles[i], &blkio_guid, + (void **)&blkio); if (EFI_ERROR(status)) continue; /* @@ -691,8 +691,8 @@ efipart_updatehd(void) if (!efipart_hdd(devpath)) continue; - status = BS->HandleProtocol(efipart_handles[i], - &blkio_guid, (void **)&blkio); + status = OpenProtocolByHandle(efipart_handles[i], &blkio_guid, + (void **)&blkio); if (EFI_ERROR(status)) continue; @@ -779,7 +779,7 @@ efipart_print_common(struct devsw *dev, pdinfo_list_t snprintf(line, sizeof(line), " %s%d", dev->dv_name, pd->pd_unit); printf("%s:", line); - status = BS->HandleProtocol(h, &blkio_guid, (void **)&blkio); + status = OpenProtocolByHandle(h, &blkio_guid, (void **)&blkio); if (!EFI_ERROR(status)) { printf(" %llu", blkio->Media->LastBlock == 0? 0: @@ -862,7 +862,7 @@ efipart_open(struct open_file *f, ...) return (EIO); if (pd->pd_blkio == NULL) { - status = BS->HandleProtocol(pd->pd_handle, &blkio_guid, + status = OpenProtocolByHandle(pd->pd_handle, &blkio_guid, (void **)&pd->pd_blkio); if (EFI_ERROR(status)) return (efi_status_to_errno(status)); Modified: head/stand/efi/loader/efi_main.c ============================================================================== --- head/stand/efi/loader/efi_main.c Tue Aug 6 18:28:44 2019 (r350653) +++ head/stand/efi/loader/efi_main.c Tue Aug 6 19:27:27 2019 (r350654) @@ -103,7 +103,7 @@ efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *sy /* Use efi_exit() from here on... */ - status = BS->HandleProtocol(IH, &image_protocol, (VOID**)&img); + status = OpenProtocolByHandle(IH, &image_protocol, (void**)&img); if (status != EFI_SUCCESS) efi_exit(status); Modified: head/stand/efi/loader/framebuffer.c ============================================================================== --- head/stand/efi/loader/framebuffer.c Tue Aug 6 18:28:44 2019 (r350653) +++ head/stand/efi/loader/framebuffer.c Tue Aug 6 19:27:27 2019 (r350654) @@ -244,7 +244,8 @@ efifb_uga_get_pciio(void) /* Get the PCI I/O interface of the first handle that supports it. */ pciio = NULL; for (hp = buf; hp < buf + bufsz; hp++) { - status = BS->HandleProtocol(*hp, &pciio_guid, (void **)&pciio); + status = OpenProtocolByHandle(*hp, &pciio_guid, + (void **)&pciio); if (status == EFI_SUCCESS) { free(buf); return (pciio); Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Tue Aug 6 18:28:44 2019 (r350653) +++ head/stand/efi/loader/main.c Tue Aug 6 19:27:27 2019 (r350654) @@ -128,7 +128,7 @@ has_keyboard(void) */ hin_end = &hin[sz / sizeof(*hin)]; for (walker = hin; walker < hin_end; walker++) { - status = BS->HandleProtocol(*walker, &devid, (VOID **)&path); + status = OpenProtocolByHandle(*walker, &devid, (void **)&path); if (EFI_ERROR(status)) continue; @@ -864,7 +864,7 @@ main(int argc, CHAR16 *argv[]) archsw.arch_zfs_probe = efi_zfs_probe; /* Get our loaded image protocol interface structure. */ - BS->HandleProtocol(IH, &imgid, (VOID**)&boot_img); + (void) OpenProtocolByHandle(IH, &imgid, (void **)&boot_img); /* * Chicken-and-egg problem; we want to have console output early, but @@ -1004,7 +1004,8 @@ main(int argc, CHAR16 *argv[]) efi_free_devpath_name(text); } - rv = BS->HandleProtocol(boot_img->DeviceHandle, &devid, (void **)&imgpath); + rv = OpenProtocolByHandle(boot_img->DeviceHandle, &devid, + (void **)&imgpath); if (rv == EFI_SUCCESS) { text = efi_devpath_name(imgpath); if (text != NULL) { @@ -1464,7 +1465,7 @@ command_chain(int argc, char *argv[]) command_errmsg = "LoadImage failed"; return (CMD_ERROR); } - status = BS->HandleProtocol(loaderhandle, &LoadedImageGUID, + status = OpenProtocolByHandle(loaderhandle, &LoadedImageGUID, (void **)&loaded_image); if (argc > 2) { From owner-svn-src-head@freebsd.org Tue Aug 6 20:08:02 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53B86C979F; Tue, 6 Aug 2019 20:08:02 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4635KZ1V2yz4Pjj; Tue, 6 Aug 2019 20:08:02 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 11E22126D; Tue, 6 Aug 2019 20:08:02 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76K81Ws046867; Tue, 6 Aug 2019 20:08:01 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76K81NL046866; Tue, 6 Aug 2019 20:08:01 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201908062008.x76K81NL046866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 6 Aug 2019 20:08:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350655 - head/stand/efi/boot1 X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/efi/boot1 X-SVN-Commit-Revision: 350655 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 20:08:02 -0000 Author: tsoome Date: Tue Aug 6 20:08:01 2019 New Revision: 350655 URL: https://svnweb.freebsd.org/changeset/base/350655 Log: loader.efi: boot1.c was left out of 350654 Followup for 350654. Modified: head/stand/efi/boot1/boot1.c Modified: head/stand/efi/boot1/boot1.c ============================================================================== --- head/stand/efi/boot1/boot1.c Tue Aug 6 19:27:27 2019 (r350654) +++ head/stand/efi/boot1/boot1.c Tue Aug 6 20:08:01 2019 (r350655) @@ -137,8 +137,9 @@ try_boot(const boot_module_t *mod, dev_info_t *dev, vo goto errout; } - if ((status = BS->HandleProtocol(loaderhandle, &LoadedImageGUID, - (VOID**)&loaded_image)) != EFI_SUCCESS) { + status = OpenProtocolByHandle(loaderhandle, &LoadedImageGUID, + (void **)&loaded_image); + if (status != EFI_SUCCESS) { printf("Failed to query LoadedImage provided by %s (%lu)\n", mod->name, EFI_ERROR_CODE(status)); goto errout; @@ -242,7 +243,7 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) nhandles = hsize / sizeof(*handles); /* Determine the devpath of our image so we can prefer it. */ - status = BS->HandleProtocol(IH, &LoadedImageGUID, (VOID**)&img); + status = OpenProtocolByHandle(IH, &LoadedImageGUID, (void **)&img); imgpath = NULL; if (status == EFI_SUCCESS) { text = efi_devpath_name(img->FilePath); @@ -252,8 +253,8 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) efi_free_devpath_name(text); } - status = BS->HandleProtocol(img->DeviceHandle, &DevicePathGUID, - (void **)&imgpath); + status = OpenProtocolByHandle(img->DeviceHandle, + &DevicePathGUID, (void **)&imgpath); if (status != EFI_SUCCESS) { DPRINTF("Failed to get image DevicePath (%lu)\n", EFI_ERROR_CODE(status)); From owner-svn-src-head@freebsd.org Tue Aug 6 16:09:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C7A6C4AD1; Tue, 6 Aug 2019 16:09:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46301v2JtGz49KK; Tue, 6 Aug 2019 16:09:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4896A2E659; Tue, 6 Aug 2019 16:09:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76G977f001538; Tue, 6 Aug 2019 16:09:07 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76G97xX001537; Tue, 6 Aug 2019 16:09:07 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908061609.x76G97xX001537@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 6 Aug 2019 16:09:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350635 - head/contrib/bsnmp/lib X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/bsnmp/lib X-SVN-Commit-Revision: 350635 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 16:09:07 -0000 Author: emaste Date: Tue Aug 6 16:09:06 2019 New Revision: 350635 URL: https://svnweb.freebsd.org/changeset/base/350635 Log: bsnmp: add asn1 message length validation admbugs: 780 Submitted by: Guido Vranken, bz Reported by: Guido Vranken Security: CVE-2019-5610 Modified: head/contrib/bsnmp/lib/asn1.c Modified: head/contrib/bsnmp/lib/asn1.c ============================================================================== --- head/contrib/bsnmp/lib/asn1.c Tue Aug 6 14:39:02 2019 (r350634) +++ head/contrib/bsnmp/lib/asn1.c Tue Aug 6 16:09:06 2019 (r350635) @@ -100,6 +100,11 @@ asn_get_header(struct asn_buf *b, u_char *type, asn_le *len = *b->asn_cptr++; b->asn_len--; } + if (*len > b->asn_len) { + asn_error(b, "len %u exceeding asn_len %u", *len, b->asn_len); + return (ASN_ERR_EOBUF); + } + return (ASN_ERR_OK); } From owner-svn-src-head@freebsd.org Tue Aug 6 16:56:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1308C570A; Tue, 6 Aug 2019 16:56:18 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46314L595Rz4CZk; Tue, 6 Aug 2019 16:56:18 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id E4DA4CA38; Tue, 6 Aug 2019 16:56:17 +0000 (UTC) (envelope-from gjb@freebsd.org) Date: Tue, 6 Aug 2019 16:56:14 +0000 From: Glen Barber To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, freebsd-hackers@freebsd.org, freebsd-arch@freebsd.org Subject: Re: svn commit: r350550 - head/share/mk Message-ID: <20190806165614.GA41295@FreeBSD.org> References: <201908030106.x7316Ibx078529@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="zhXaljGHf11kAtnf" Content-Disposition: inline In-Reply-To: <201908030106.x7316Ibx078529@repo.freebsd.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 16:56:18 -0000 --zhXaljGHf11kAtnf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Aug 03, 2019 at 01:06:18AM +0000, John Baldwin wrote: > Author: jhb > Date: Sat Aug 3 01:06:17 2019 > New Revision: 350550 > URL: https://svnweb.freebsd.org/changeset/base/350550 >=20 > Log: > Flip REPRODUCIBLE_BUILD back to off by default in head. > =20 > Having the full uname output can be useful on head even with > unmodified trees or trees that newvers.sh fails to recognize as > modified. > =20 > Reviewed by: emaste > Differential Revision: https://reviews.freebsd.org/D20895 >=20 I would like to request this commit be reverted. While the original commit message to enable this knob stated the commit would be reverted after stable/12 branched, I have seen no public complaints about enabling REPRODUCIBLE_BUILD by default (and quite honestly, do not see the benefit of disabling it by default -- why wouldn't we want reproducibility?). To me, this feels like a step backwards, with no tangible benefit. Note, newvers.sh does properly detect a modified tree if it can find the VCS metadata directory (i.e., .git, .svn) -- I know this because I personally helped with it. In my opinion, those that want the non-reproducible metadata included in output from 'uname -a' should set WITHOUT_REPRODUCIBLE_BUILDS in their src.conf. Turning off a sane default for the benefit of what I suspect is likely a short list of use cases feels like a step in the wrong direction. Glen --zhXaljGHf11kAtnf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAl1JsSkACgkQAxRYpUeP 4pP1iQ/9HRagGOeEniZZhcv+PYAPG3x5PGj2Jw7x6XAG36wFAGGsPDtOl5T4It0x OFtfhiMWOAIE6BOlG1/7FRfldQq7HiZRanMjp8fPwSEooDJGDs97Rfw2y3iyjUaf mBi90XjF8oKmnQVMDnv3bcXNII2pt79VaDDryvLhpRMuH4fYALinu9I8DU7W+anh EN2PXq8lCR5EdzasZh45Sa+987uhX2zyhUfQsM7Q+Sgfbxc5rrCP8IJkjtmoE6Bu w27/7dQbGuAtygl8Zl8iEYdnfm2yv3uY/05cnjwLK85VBlWaPEEZiV6Dq2iGurtw yrrQQczrlXuv8pzjT43p3IScWU+3kDd0mD5EUYSVpBbaVcFuCEEcyMmn/bYh75nr EvkWzYgrveFupykpgF9k0EsqGViEt8SQNRAf3KihJhpAN4kl7q+hEXZardIcwoz7 pLqMA6rRMB5leOPXwEpLtZxPDHq4MX+GbmtaEOQtuPyJKlbMQ/ieDrfFQZ/Hv8pP EaWiPn7w2iuUliRCHTWsggVgdF/7kEMTfIMNfae/KYmD7fSXC2BHi5wOgKLJGs7H dZibtfqBgGTs8/prHyhBHy7ptSjhknTATfPnUVQ1rkWnpSMvyekoaR8QPM9mfVLR Iv7n30+QiMmhkSvR2CY2GbzI9DDgXdz9SkbwdnQagodV4h7MLmo= =tIoZ -----END PGP SIGNATURE----- --zhXaljGHf11kAtnf-- From owner-svn-src-head@freebsd.org Tue Aug 6 18:28:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC4A3C785E; Tue, 6 Aug 2019 18:28:44 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46337053XLz4KPR; Tue, 6 Aug 2019 18:28:44 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8AEFD2FFAB; Tue, 6 Aug 2019 18:28:44 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76ISikV087621; Tue, 6 Aug 2019 18:28:44 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76ISicx087620; Tue, 6 Aug 2019 18:28:44 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201908061828.x76ISicx087620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Tue, 6 Aug 2019 18:28:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350653 - head/sys/geom/label X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/geom/label X-SVN-Commit-Revision: 350653 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 18:28:44 -0000 Author: mckusick Date: Tue Aug 6 18:28:44 2019 New Revision: 350653 URL: https://svnweb.freebsd.org/changeset/base/350653 Log: Ignore UFS/FFS superblock check hash failures so as to allow a higher level in the filesystem stack to decide what to do about them. Reported by: Peter Holm Tested by: Peter Holm Sponsored by: Netflix Modified: head/sys/geom/label/g_label_ufs.c Modified: head/sys/geom/label/g_label_ufs.c ============================================================================== --- head/sys/geom/label/g_label_ufs.c Tue Aug 6 18:15:26 2019 (r350652) +++ head/sys/geom/label/g_label_ufs.c Tue Aug 6 18:28:44 2019 (r350653) @@ -76,8 +76,8 @@ g_label_ufs_taste_common(struct g_consumer *cp, char * label[0] = '\0'; fs = NULL; - if (SBLOCKSIZE % pp->sectorsize != 0 || - ffs_sbget(cp, &fs, STDSB, M_GEOM, g_use_g_read_data) != 0) { + if (SBLOCKSIZE % pp->sectorsize != 0 || ffs_sbget(cp, &fs, + STDSB_NOHASHFAIL, M_GEOM, g_use_g_read_data) != 0) { KASSERT(fs == NULL, ("g_label_ufs_taste_common: non-NULL fs %p\n", fs)); return; From owner-svn-src-head@freebsd.org Tue Aug 6 20:13:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0895C9940; Tue, 6 Aug 2019 20:13:29 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4635Rs4yG2z4Qrb; Tue, 6 Aug 2019 20:13:29 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BEF51428; Tue, 6 Aug 2019 20:13:29 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76KDTU0052587; Tue, 6 Aug 2019 20:13:29 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76KDTHl052583; Tue, 6 Aug 2019 20:13:29 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201908062013.x76KDTHl052583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 6 Aug 2019 20:13:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350656 - in head/stand/efi: include libefi X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in head/stand/efi: include libefi X-SVN-Commit-Revision: 350656 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 20:13:29 -0000 Author: tsoome Date: Tue Aug 6 20:13:28 2019 New Revision: 350656 URL: https://svnweb.freebsd.org/changeset/base/350656 Log: loader.efi: efilib.h and libefi.c were left out of 350654 And this is second followup for 350654 Modified: head/stand/efi/include/efilib.h head/stand/efi/libefi/libefi.c Modified: head/stand/efi/include/efilib.h ============================================================================== --- head/stand/efi/include/efilib.h Tue Aug 6 20:08:01 2019 (r350655) +++ head/stand/efi/include/efilib.h Tue Aug 6 20:13:28 2019 (r350656) @@ -70,6 +70,7 @@ pdinfo_t *efiblk_get_pdinfo_by_handle(EFI_HANDLE h); pdinfo_t *efiblk_get_pdinfo_by_device_path(EFI_DEVICE_PATH *path); void *efi_get_table(EFI_GUID *tbl); +EFI_STATUS OpenProtocolByHandle(EFI_HANDLE, EFI_GUID *, void **); int efi_getdev(void **vdev, const char *devspec, const char **path); char *efi_fmtdev(void *vdev); Modified: head/stand/efi/libefi/libefi.c ============================================================================== --- head/stand/efi/libefi/libefi.c Tue Aug 6 20:08:01 2019 (r350655) +++ head/stand/efi/libefi/libefi.c Tue Aug 6 20:13:28 2019 (r350656) @@ -50,3 +50,10 @@ efi_get_table(EFI_GUID *tbl) } return (NULL); } + +EFI_STATUS +OpenProtocolByHandle(EFI_HANDLE handle, EFI_GUID *protocol, void **interface) +{ + return (BS->OpenProtocol(handle, protocol, interface, IH, NULL, + EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL)); +} From owner-svn-src-head@freebsd.org Tue Aug 6 23:05:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AA97B5137; Tue, 6 Aug 2019 23:05:00 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4639Fm2Q1Sz3NHn; Tue, 6 Aug 2019 23:05:00 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34B6832F6; Tue, 6 Aug 2019 23:05:00 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76N500K054107; Tue, 6 Aug 2019 23:05:00 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76N4xXh054091; Tue, 6 Aug 2019 23:04:59 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201908062304.x76N4xXh054091@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 6 Aug 2019 23:04:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350661 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 350661 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 23:05:00 -0000 Author: jeff Date: Tue Aug 6 23:04:59 2019 New Revision: 350661 URL: https://svnweb.freebsd.org/changeset/base/350661 Log: Implement a MINBUCKET zone flag so we can use minimal caching on zones that may be expensive to cache. Reviewed by: markj, kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20930 Modified: head/sys/vm/uma.h head/sys/vm/uma_core.c Modified: head/sys/vm/uma.h ============================================================================== --- head/sys/vm/uma.h Tue Aug 6 22:36:29 2019 (r350660) +++ head/sys/vm/uma.h Tue Aug 6 23:04:59 2019 (r350661) @@ -274,6 +274,7 @@ uma_zone_t uma_zcache_create(char *name, int size, uma * NUMA aware Zone. Implements a best * effort first-touch policy. */ +#define UMA_ZONE_MINBUCKET 0x20000 /* Use smallest buckets. */ /* * These flags are shared between the keg and zone. In zones wishing to add Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Tue Aug 6 22:36:29 2019 (r350660) +++ head/sys/vm/uma_core.c Tue Aug 6 23:04:59 2019 (r350661) @@ -209,6 +209,7 @@ struct uma_bucket_zone { (((sizeof(void *) * (n)) - sizeof(struct uma_bucket)) / sizeof(void *)) #define BUCKET_MAX BUCKET_SIZE(256) +#define BUCKET_MIN BUCKET_SIZE(4) struct uma_bucket_zone bucket_zones[] = { { NULL, "4 Bucket", BUCKET_SIZE(4), 4096 }, @@ -1867,9 +1868,12 @@ out: KASSERT((arg->flags & (UMA_ZONE_MAXBUCKET | UMA_ZONE_NOBUCKET)) != (UMA_ZONE_MAXBUCKET | UMA_ZONE_NOBUCKET), ("Invalid zone flag combination")); - if ((arg->flags & UMA_ZONE_MAXBUCKET) != 0) + if ((arg->flags & UMA_ZONE_MAXBUCKET) != 0) { zone->uz_count = BUCKET_MAX; - else if ((arg->flags & UMA_ZONE_NOBUCKET) != 0) + } else if ((arg->flags & UMA_ZONE_MINBUCKET) != 0) { + zone->uz_count = BUCKET_MIN; + zone->uz_count_max = BUCKET_MIN; + } else if ((arg->flags & UMA_ZONE_NOBUCKET) != 0) zone->uz_count = 0; else zone->uz_count = bucket_select(zone->uz_size); From owner-svn-src-head@freebsd.org Tue Aug 6 23:15:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD4CDB54E4; Tue, 6 Aug 2019 23:15:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4639TP3ms6z3Nn2; Tue, 6 Aug 2019 23:15:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 62D0E34CF; Tue, 6 Aug 2019 23:15:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76NF5VA059984; Tue, 6 Aug 2019 23:15:05 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76NF59u059982; Tue, 6 Aug 2019 23:15:05 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201908062315.x76NF59u059982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 6 Aug 2019 23:15:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350662 - in head/sys: dev/acpica i386/pci X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: dev/acpica i386/pci X-SVN-Commit-Revision: 350662 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 23:15:05 -0000 Author: jhb Date: Tue Aug 6 23:15:04 2019 New Revision: 350662 URL: https://svnweb.freebsd.org/changeset/base/350662 Log: Detect invalid PCI devices more correctly in PCI interrupt router drivers. - Check for an invalid device (vendor is invalid) before reading the header type register when examining function 0 of a possible device. - When iterating over functions of a device, reject any device whose 16-bit vendor is invalid rather than requiring the full 32-bit vendor+device to be all 1's. In practice the latter check is probably fine, but checking the vendor is what the PCI spec recommends. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D21147 Modified: head/sys/dev/acpica/acpi_pci_link.c head/sys/i386/pci/pci_pir.c Modified: head/sys/dev/acpica/acpi_pci_link.c ============================================================================== --- head/sys/dev/acpica/acpi_pci_link.c Tue Aug 6 23:04:59 2019 (r350661) +++ head/sys/dev/acpica/acpi_pci_link.c Tue Aug 6 23:15:04 2019 (r350662) @@ -580,6 +580,9 @@ acpi_pci_link_search_irq(int bus, int device, int pin) uint8_t func, maxfunc; /* See if we have a valid device at function 0. */ + value = pci_cfgregread(bus, device, 0, PCIR_VENDOR, 2); + if (value == PCIV_INVALID) + return (PCI_INVALID_IRQ); value = pci_cfgregread(bus, device, 0, PCIR_HDRTYPE, 1); if ((value & PCIM_HDRTYPE) > PCI_MAXHDRTYPE) return (PCI_INVALID_IRQ); @@ -590,8 +593,8 @@ acpi_pci_link_search_irq(int bus, int device, int pin) /* Scan all possible functions at this device. */ for (func = 0; func <= maxfunc; func++) { - value = pci_cfgregread(bus, device, func, PCIR_DEVVENDOR, 4); - if (value == 0xffffffff) + value = pci_cfgregread(bus, device, func, PCIR_VENDOR, 2); + if (value == PCIV_INVALID) continue; value = pci_cfgregread(bus, device, func, PCIR_INTPIN, 1); Modified: head/sys/i386/pci/pci_pir.c ============================================================================== --- head/sys/i386/pci/pci_pir.c Tue Aug 6 23:04:59 2019 (r350661) +++ head/sys/i386/pci/pci_pir.c Tue Aug 6 23:15:04 2019 (r350662) @@ -257,8 +257,8 @@ pci_pir_create_links(struct PIR_entry *entry, struct P } /* - * Look to see if any of the function on the PCI device at bus/device have - * an interrupt routed to intpin 'pin' by the BIOS. + * Look to see if any of the functions on the PCI device at bus/device + * have an interrupt routed to intpin 'pin' by the BIOS. */ static uint8_t pci_pir_search_irq(int bus, int device, int pin) @@ -267,6 +267,9 @@ pci_pir_search_irq(int bus, int device, int pin) uint8_t func, maxfunc; /* See if we have a valid device at function 0. */ + value = pci_cfgregread(bus, device, 0, PCIR_VENDOR, 2); + if (value == PCIV_INVALID) + return (PCI_INVALID_IRQ); value = pci_cfgregread(bus, device, 0, PCIR_HDRTYPE, 1); if ((value & PCIM_HDRTYPE) > PCI_MAXHDRTYPE) return (PCI_INVALID_IRQ); @@ -277,8 +280,8 @@ pci_pir_search_irq(int bus, int device, int pin) /* Scan all possible functions at this device. */ for (func = 0; func <= maxfunc; func++) { - value = pci_cfgregread(bus, device, func, PCIR_DEVVENDOR, 4); - if (value == 0xffffffff) + value = pci_cfgregread(bus, device, func, PCIR_VENDOR, 2); + if (value == PCIV_INVALID) continue; value = pci_cfgregread(bus, device, func, PCIR_INTPIN, 1); From owner-svn-src-head@freebsd.org Tue Aug 6 23:15:35 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC523B555E; Tue, 6 Aug 2019 23:15:35 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4639Tz3t6Kz3Nvs; Tue, 6 Aug 2019 23:15:35 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6688F34D2; Tue, 6 Aug 2019 23:15:35 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76NFZvW060057; Tue, 6 Aug 2019 23:15:35 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76NFYeU060054; Tue, 6 Aug 2019 23:15:34 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201908062315.x76NFYeU060054@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 6 Aug 2019 23:15:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350663 - in head/sys: ddb sys vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: ddb sys vm X-SVN-Commit-Revision: 350663 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 23:15:35 -0000 Author: jeff Date: Tue Aug 6 23:15:34 2019 New Revision: 350663 URL: https://svnweb.freebsd.org/changeset/base/350663 Log: Cache kernel stacks in UMA. This gives us NUMA support, better concurrency, and more statistics. Reviewed by: kib, markj Tested by: pho Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20931 Deleted: head/sys/sys/_kstack_cache.h Modified: head/sys/ddb/db_ps.c head/sys/vm/vm_glue.c head/sys/vm/vm_param.h head/sys/vm/vm_swapout.c Modified: head/sys/ddb/db_ps.c ============================================================================== --- head/sys/ddb/db_ps.c Tue Aug 6 23:15:04 2019 (r350662) +++ head/sys/ddb/db_ps.c Tue Aug 6 23:15:34 2019 (r350663) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -505,7 +504,6 @@ db_findstack_cmd(db_expr_t addr, bool have_addr, db_ex { struct proc *p; struct thread *td; - struct kstack_cache_entry *ks_ce; vm_offset_t saddr; if (have_addr) @@ -522,15 +520,6 @@ db_findstack_cmd(db_expr_t addr, bool have_addr, db_ex db_printf("Thread %p\n", td); return; } - } - } - - for (ks_ce = kstack_cache; ks_ce != NULL; - ks_ce = ks_ce->next_ks_entry) { - if ((vm_offset_t)ks_ce <= saddr && saddr < (vm_offset_t)ks_ce + - PAGE_SIZE * kstack_pages) { - db_printf("Cached stack %p\n", ks_ce); - return; } } } Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Tue Aug 6 23:15:04 2019 (r350662) +++ head/sys/vm/vm_glue.c Tue Aug 6 23:15:34 2019 (r350663) @@ -84,12 +84,12 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include #include +#include #include #include #include @@ -282,52 +282,39 @@ vm_sync_icache(vm_map_t map, vm_offset_t va, vm_offset pmap_sync_icache(map->pmap, va, sz); } -struct kstack_cache_entry *kstack_cache; +static uma_zone_t kstack_cache; static int kstack_cache_size = 128; -static int kstacks, kstack_domain_iter; -static struct mtx kstack_cache_mtx; -MTX_SYSINIT(kstack_cache, &kstack_cache_mtx, "kstkch", MTX_DEF); +static int kstack_domain_iter; -SYSCTL_INT(_vm, OID_AUTO, kstack_cache_size, CTLFLAG_RW, &kstack_cache_size, 0, - ""); -SYSCTL_INT(_vm, OID_AUTO, kstacks, CTLFLAG_RD, &kstacks, 0, - ""); +static int +sysctl_kstack_cache_size(SYSCTL_HANDLER_ARGS) +{ + int error, newsize; + newsize = kstack_cache_size; + error = sysctl_handle_int(oidp, &newsize, 0, req); + if (error == 0 && req->newptr && newsize != kstack_cache_size) + kstack_cache_size = + uma_zone_set_maxcache(kstack_cache, newsize); + return (error); +} +SYSCTL_PROC(_vm, OID_AUTO, kstack_cache_size, CTLTYPE_INT|CTLFLAG_RW, + &kstack_cache_size, 0, sysctl_kstack_cache_size, "IU", + "Maximum number of cached kernel stacks"); + /* * Create the kernel stack (including pcb for i386) for a new thread. * This routine directly affects the fork perf for a process and * create performance for a thread. */ -int -vm_thread_new(struct thread *td, int pages) +static vm_offset_t +vm_thread_stack_create(struct domainset *ds, vm_object_t *ksobjp, int pages) { + vm_page_t ma[KSTACK_MAX_PAGES]; vm_object_t ksobj; vm_offset_t ks; - vm_page_t ma[KSTACK_MAX_PAGES]; - struct kstack_cache_entry *ks_ce; int i; - /* Bounds check */ - if (pages <= 1) - pages = kstack_pages; - else if (pages > KSTACK_MAX_PAGES) - pages = KSTACK_MAX_PAGES; - - if (pages == kstack_pages && kstack_cache != NULL) { - mtx_lock(&kstack_cache_mtx); - if (kstack_cache != NULL) { - ks_ce = kstack_cache; - kstack_cache = ks_ce->next_ks_entry; - mtx_unlock(&kstack_cache_mtx); - - td->td_kstack_obj = ks_ce->ksobj; - td->td_kstack = (vm_offset_t)ks_ce; - td->td_kstack_pages = kstack_pages; - return (1); - } - mtx_unlock(&kstack_cache_mtx); - } - /* * Allocate an object for the kstack. */ @@ -354,30 +341,17 @@ vm_thread_new(struct thread *td, int pages) vm_object_deallocate(ksobj); return (0); } - - /* - * Ensure that kstack objects can draw pages from any memory - * domain. Otherwise a local memory shortage can block a process - * swap-in. - */ if (vm_ndomains > 1) { - ksobj->domain.dr_policy = DOMAINSET_RR(); + ksobj->domain.dr_policy = ds; ksobj->domain.dr_iter = atomic_fetchadd_int(&kstack_domain_iter, 1); } - atomic_add_int(&kstacks, 1); if (KSTACK_GUARD_PAGES != 0) { pmap_qremove(ks, KSTACK_GUARD_PAGES); ks += KSTACK_GUARD_PAGES * PAGE_SIZE; } - td->td_kstack_obj = ksobj; - td->td_kstack = ks; - /* - * Knowing the number of pages allocated is useful when you - * want to deallocate them. - */ - td->td_kstack_pages = pages; + /* * For the length of the stack, link in a real page of ram for each * page of stack. @@ -389,7 +363,9 @@ vm_thread_new(struct thread *td, int pages) ma[i]->valid = VM_PAGE_BITS_ALL; VM_OBJECT_WUNLOCK(ksobj); pmap_qenter(ks, ma, pages); - return (1); + *ksobjp = ksobj; + + return (ks); } static void @@ -398,7 +374,6 @@ vm_thread_stack_dispose(vm_object_t ksobj, vm_offset_t vm_page_t m; int i; - atomic_add_int(&kstacks, -1); pmap_qremove(ks, pages); VM_OBJECT_WLOCK(ksobj); for (i = 0; i < pages; i++) { @@ -417,6 +392,45 @@ vm_thread_stack_dispose(vm_object_t ksobj, vm_offset_t } /* + * Allocate the kernel stack for a new thread. + */ +int +vm_thread_new(struct thread *td, int pages) +{ + vm_object_t ksobj; + vm_offset_t ks; + + /* Bounds check */ + if (pages <= 1) + pages = kstack_pages; + else if (pages > KSTACK_MAX_PAGES) + pages = KSTACK_MAX_PAGES; + + ks = 0; + ksobj = NULL; + if (pages == kstack_pages && kstack_cache != NULL) { + ks = (vm_offset_t)uma_zalloc(kstack_cache, M_NOWAIT); + if (ks != 0) + ksobj = PHYS_TO_VM_PAGE(pmap_kextract(ks))->object; + } + + /* + * Ensure that kstack objects can draw pages from any memory + * domain. Otherwise a local memory shortage can block a process + * swap-in. + */ + if (ks == 0) + ks = vm_thread_stack_create(DOMAINSET_PREF(PCPU_GET(domain)), + &ksobj, pages); + if (ks == 0) + return (0); + td->td_kstack_obj = ksobj; + td->td_kstack = ks; + td->td_kstack_pages = pages; + return (1); +} + +/* * Dispose of a thread's kernel stack. */ void @@ -424,7 +438,6 @@ vm_thread_dispose(struct thread *td) { vm_object_t ksobj; vm_offset_t ks; - struct kstack_cache_entry *ks_ce; int pages; pages = td->td_kstack_pages; @@ -432,43 +445,49 @@ vm_thread_dispose(struct thread *td) ks = td->td_kstack; td->td_kstack = 0; td->td_kstack_pages = 0; - if (pages == kstack_pages && kstacks <= kstack_cache_size) { - ks_ce = (struct kstack_cache_entry *)ks; - ks_ce->ksobj = ksobj; - mtx_lock(&kstack_cache_mtx); - ks_ce->next_ks_entry = kstack_cache; - kstack_cache = ks_ce; - mtx_unlock(&kstack_cache_mtx); - return; + if (pages == kstack_pages) + uma_zfree(kstack_cache, (void *)ks); + else + vm_thread_stack_dispose(ksobj, ks, pages); +} + +static int +kstack_import(void *arg, void **store, int cnt, int domain, int flags) +{ + vm_object_t ksobj; + int i; + + for (i = 0; i < cnt; i++) { + store[i] = (void *)vm_thread_stack_create( + DOMAINSET_PREF(domain), &ksobj, kstack_pages); + if (store[i] == NULL) + break; } - vm_thread_stack_dispose(ksobj, ks, pages); + return (i); } static void -vm_thread_stack_lowmem(void *nulll) +kstack_release(void *arg, void **store, int cnt) { - struct kstack_cache_entry *ks_ce, *ks_ce1; + vm_offset_t ks; + int i; - mtx_lock(&kstack_cache_mtx); - ks_ce = kstack_cache; - kstack_cache = NULL; - mtx_unlock(&kstack_cache_mtx); - - while (ks_ce != NULL) { - ks_ce1 = ks_ce; - ks_ce = ks_ce->next_ks_entry; - - vm_thread_stack_dispose(ks_ce1->ksobj, (vm_offset_t)ks_ce1, - kstack_pages); + for (i = 0; i < cnt; i++) { + ks = (vm_offset_t)store[i]; + vm_thread_stack_dispose( + PHYS_TO_VM_PAGE(pmap_kextract(ks))->object, + ks, kstack_pages); } } static void -kstack_cache_init(void *nulll) +kstack_cache_init(void *null) { - - EVENTHANDLER_REGISTER(vm_lowmem, vm_thread_stack_lowmem, NULL, - EVENTHANDLER_PRI_ANY); + kstack_cache = uma_zcache_create("kstack_cache", + kstack_pages * PAGE_SIZE, NULL, NULL, NULL, NULL, + kstack_import, kstack_release, NULL, + UMA_ZONE_NUMA|UMA_ZONE_MINBUCKET); + uma_zone_set_maxcache(kstack_cache, kstack_cache_size); } SYSINIT(vm_kstacks, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY, kstack_cache_init, NULL); Modified: head/sys/vm/vm_param.h ============================================================================== --- head/sys/vm/vm_param.h Tue Aug 6 23:15:04 2019 (r350662) +++ head/sys/vm/vm_param.h Tue Aug 6 23:15:34 2019 (r350663) @@ -122,6 +122,10 @@ struct xswdev { #endif /* !SMP */ #endif /* !PA_LOCK_COUNT */ +#ifndef KSTACK_MAX_PAGES +#define KSTACK_MAX_PAGES 32 +#endif + #ifndef ASSEMBLER #ifdef _KERNEL #define num_pages(x) \ Modified: head/sys/vm/vm_swapout.c ============================================================================== --- head/sys/vm/vm_swapout.c Tue Aug 6 23:15:04 2019 (r350662) +++ head/sys/vm/vm_swapout.c Tue Aug 6 23:15:34 2019 (r350663) @@ -85,7 +85,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include From owner-svn-src-head@freebsd.org Tue Aug 6 23:22:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B852CB5885; Tue, 6 Aug 2019 23:22:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4639ds4NkXz3PLP; Tue, 6 Aug 2019 23:22:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7941E3842; Tue, 6 Aug 2019 23:22:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76NMP1G066018; Tue, 6 Aug 2019 23:22:25 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76NMPko066017; Tue, 6 Aug 2019 23:22:25 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201908062322.x76NMPko066017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 6 Aug 2019 23:22:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350664 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 350664 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 23:22:25 -0000 Author: jhb Date: Tue Aug 6 23:22:25 2019 New Revision: 350664 URL: https://svnweb.freebsd.org/changeset/base/350664 Log: Fix LOCAL_MODULES and improve the make output. The exists() check guarding the invocation of ls was not working correctly as it was expanding '$L' to determine the path of the local modules directory. Fix by using {} around the variable name. Inline some of the logic from bsd.subdir.mk when invoking local module builds. This gives output in 'make buildkernel' the same as if there was a Makefile in /usr/local/sys/modules with SUBDIR = ${LOCAL_MODULES}. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D20991 Modified: head/sys/conf/kern.post.mk Modified: head/sys/conf/kern.post.mk ============================================================================== --- head/sys/conf/kern.post.mk Tue Aug 6 23:15:34 2019 (r350663) +++ head/sys/conf/kern.post.mk Tue Aug 6 23:22:25 2019 (r350664) @@ -61,7 +61,7 @@ LOCAL_MODULES_DIR?= ${LOCALBASE}/sys/modules # Default to installing all modules installed by ports unless overridden # by the user. -.if !defined(LOCAL_MODULES) && exists($LOCAL_MODULES_DIR) +.if !defined(LOCAL_MODULES) && exists(${LOCAL_MODULES_DIR}) LOCAL_MODULES!= ls ${LOCAL_MODULES_DIR} .endif .endif @@ -77,7 +77,9 @@ modules-${target}: ${target:S/^reinstall$/install/:S/^clobber$/cleandir/} .endif .for module in ${LOCAL_MODULES} - cd ${LOCAL_MODULES_DIR}/${module}; ${MKMODULESENV} ${MAKE} \ + @${ECHODIR} "===> ${module} (${target:S/^reinstall$/install/:S/^clobber$/cleandir/})" + @cd ${LOCAL_MODULES_DIR}/${module}; ${MKMODULESENV} ${MAKE} \ + DIRPRFX="${module}/" \ ${target:S/^reinstall$/install/:S/^clobber$/cleandir/} .endfor .endif From owner-svn-src-head@freebsd.org Wed Aug 7 00:38:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67CADB76D6; Wed, 7 Aug 2019 00:38:28 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463CKc2g55z3xYw; Wed, 7 Aug 2019 00:38:28 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1EB7545D3; Wed, 7 Aug 2019 00:38:28 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x770cSLY007722; Wed, 7 Aug 2019 00:38:28 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x770cQZE007711; Wed, 7 Aug 2019 00:38:26 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908070038.x770cQZE007711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 7 Aug 2019 00:38:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350665 - in head: . etc/mtree sbin/mount_fusefs share/man/man5 sys/fs/fuse sys/sys tests/sys/fs tests/sys/fs/fusefs X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: . etc/mtree sbin/mount_fusefs share/man/man5 sys/fs/fuse sys/sys tests/sys/fs tests/sys/fs/fusefs X-SVN-Commit-Revision: 350665 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 00:38:28 -0000 Author: asomers Date: Wed Aug 7 00:38:26 2019 New Revision: 350665 URL: https://svnweb.freebsd.org/changeset/base/350665 Log: fusefs: merge from projects/fuse2 This commit imports the new fusefs driver. It raises the protocol level from 7.8 to 7.23, fixes many bugs, adds a test suite for the driver, and adds many new features. New features include: * Optional kernel-side permissions checks (-o default_permissions) * Implement VOP_MKNOD, VOP_BMAP, and VOP_ADVLOCK * Allow interrupting FUSE operations * Support named pipes and unix-domain sockets in fusefs file systems * Forward UTIME_NOW during utimensat(2) to the daemon * kqueue support for /dev/fuse * Allow updating mounts with "mount -u" * Allow exporting fusefs file systems over NFS * Server-initiated invalidation of the name cache or data cache * Respect RLIMIT_FSIZE * Try to support servers as old as protocol 7.4 Performance enhancements include: * Implement FUSE's FOPEN_KEEP_CACHE and FUSE_ASYNC_READ flags * Cache file attributes * Cache lookup entries, both positive and negative * Server-selectable cache modes: writethrough, writeback, or uncached * Write clustering * Readahead * Use counter(9) for statistical reporting PR: 199934 216391 233783 234581 235773 235774 235775 PR: 236226 236231 236236 236291 236329 236381 236405 PR: 236327 236466 236472 236473 236474 236530 236557 PR: 236560 236844 237052 237181 237588 238565 Reviewed by: bcr (man pages) Reviewed by: cem, ngie, rpokala, glebius, kib, bde, emaste (post-commit review on project branch) MFC after: 3 weeks Relnotes: yes Sponsored by: The FreeBSD Foundation Pull Request: https://reviews.freebsd.org/D21110 Added: head/tests/sys/fs/fusefs/ - copied from r350621, projects/fuse2/tests/sys/fs/fusefs/ Deleted: head/sys/fs/fuse/fuse_param.h Modified: head/MAINTAINERS (contents, props changed) head/UPDATING head/etc/mtree/BSD.tests.dist head/sbin/mount_fusefs/mount_fusefs.8 head/sbin/mount_fusefs/mount_fusefs.c head/share/man/man5/fusefs.5 head/sys/fs/fuse/fuse.h head/sys/fs/fuse/fuse_device.c head/sys/fs/fuse/fuse_file.c head/sys/fs/fuse/fuse_file.h head/sys/fs/fuse/fuse_internal.c head/sys/fs/fuse/fuse_internal.h head/sys/fs/fuse/fuse_io.c head/sys/fs/fuse/fuse_io.h head/sys/fs/fuse/fuse_ipc.c head/sys/fs/fuse/fuse_ipc.h head/sys/fs/fuse/fuse_kernel.h head/sys/fs/fuse/fuse_main.c head/sys/fs/fuse/fuse_node.c head/sys/fs/fuse/fuse_node.h head/sys/fs/fuse/fuse_vfsops.c head/sys/fs/fuse/fuse_vnops.c head/sys/sys/param.h head/tests/sys/fs/Makefile Directory Properties: head/ (props changed) Modified: head/MAINTAINERS ============================================================================== --- head/MAINTAINERS Tue Aug 6 23:22:25 2019 (r350664) +++ head/MAINTAINERS Wed Aug 7 00:38:26 2019 (r350665) @@ -53,6 +53,7 @@ contrib/pjdfstest asomers,ngie,pjd,#test Pre-commit re etc/mail gshapiro Pre-commit review requested. Keep in sync with -STABLE. etc/sendmail gshapiro Pre-commit review requested. Keep in sync with -STABLE. fetch des Pre-commit review requested, email only. +fusefs(5) asomers Pre-commit review requested. geli pjd Pre-commit review requested (both sys/geom/eli/ and sbin/geom/class/eli/). isci(4) jimharris Pre-commit review requested. iwm(4) adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org Modified: head/UPDATING ============================================================================== --- head/UPDATING Tue Aug 6 23:22:25 2019 (r350664) +++ head/UPDATING Wed Aug 7 00:38:26 2019 (r350665) @@ -26,6 +26,18 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20190727: + The vfs.fusefs.sync_unmount and vfs.fusefs.init_backgrounded sysctls + and the "-o sync_unmount" and "-o init_backgrounded" mount options have + been removed from mount_fusefs(8). You can safely remove them from + your scripts, because they had no effect. + + The vfs.fusefs.fix_broken_io, vfs.fusefs.sync_resize, + vfs.fusefs.refresh_size, vfs.fusefs.mmap_enable, + vfs.fusefs.reclaim_revoked, and vfs.fusefs.data_cache_invalidate + sysctls have been removed. If you felt the need to set any of them to + a non-default value, please tell asomers@FreeBSD.org why. + 20190713: Default permissions on the /var/account/acct file (and copies of it rotated by periodic daily scripts) are changed from 0644 to 0640 Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Tue Aug 6 23:22:25 2019 (r350664) +++ head/etc/mtree/BSD.tests.dist Wed Aug 7 00:38:26 2019 (r350665) @@ -731,6 +731,8 @@ file .. fs + fusefs + .. tmpfs .. .. Modified: head/sbin/mount_fusefs/mount_fusefs.8 ============================================================================== --- head/sbin/mount_fusefs/mount_fusefs.8 Tue Aug 6 23:22:25 2019 (r350664) +++ head/sbin/mount_fusefs/mount_fusefs.8 Wed Aug 7 00:38:26 2019 (r350665) @@ -3,6 +3,11 @@ .\" Copyright (c) 2005, 2006 Csaba Henk .\" All rights reserved. .\" +.\" Copyright (c) 2019 The FreeBSD Foundation +.\" +.\" Portions of this documentation were written by BFF Storage Systems under +.\" sponsorship from the FreeBSD Foundation. +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -29,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 17, 2018 +.Dd July 31, 2019 .Dt MOUNT_FUSEFS 8 .Os .Sh NAME @@ -108,27 +113,27 @@ Intended for use in scripts and the .Xr sudoers 5 file. .It Fl S , Ic --safe -Run in safe mode (i.e. reject invoking a filesystem daemon) +Run in safe mode (i.e., reject invoking a filesystem daemon). .It Fl v -Be verbose -.It Fl D, Ic --daemon Ar daemon +Be verbose. +.It Fl D , Ic --daemon Ar daemon Call the specified -.Ar daemon -.It Fl O, Ic --daemon_opts Ar opts +.Ar daemon . +.It Fl O , Ic --daemon_opts Ar opts Add .Ar opts -to the daemon's command line -.It Fl s, Ic --special Ar special +to the daemon's command line. +.It Fl s , Ic --special Ar special Use .Ar special -as special -.It Fl m, Ic --mountpath Ar node +as special. +.It Fl m , Ic --mountpath Ar node Mount on -.Ar node -.It Fl h, Ic --help -Show help -.It Fl V, Ic --version -Show version information +.Ar node . +.It Fl h , Ic --help +Show help. +.It Fl V , Ic --version +Show version information. .It Fl o Mount options are specified via .Fl o . @@ -136,23 +141,38 @@ The following options are available (and also their ne by prefixing them with .Dq no ) : .Bl -tag -width indent -.It Cm default_permissions -Enable traditional (file mode based) permission checking in kernel .It Cm allow_other Do not apply .Sx STRICT ACCESS POLICY . -Only root can use this option +Only root can use this option. +.It Cm async +I/O to the file system may be done asynchronously. +Writes may be delayed and/or reordered. +.It Cm default_permissions +Enable traditional (file mode based) permission checking in kernel. +.It Cm intr +Allow signals to interrupt operations that are blocked waiting for a reply from the server. +When this option is in use, system calls may fail with +.Er EINTR +whenever a signal is received. .It Cm max_read Ns = Ns Ar n Limit size of read requests to -.Ar n +.Ar n . +.It Cm neglect_shares +Do not refuse unmounting if there are secondary mounts. .It Cm private Refuse shared mounting of the daemon. This is the default behaviour, to allow sharing, expicitly use -.Fl o Cm noprivate -.It Cm neglect_shares -Do not refuse unmounting if there are secondary mounts +.Fl o Cm noprivate . .It Cm push_symlinks_in -Prefix absolute symlinks with the mountpoint +Prefix absolute symlinks with the mountpoint. +.It Cm subtype Ns = Ns Ar fsname +Suffix +.Ar fsname +to the file system name as reported by +.Xr statfs 2 . +This option can be used to identify the file system implemented by +.Ar fuse_daemon . .El .El .Pp @@ -167,11 +187,11 @@ However, there are some which do require in-kernel sup Currently the options supported by the kernel are: .Bl -tag -width indent .It Cm direct_io -Bypass the buffer cache system +Bypass the buffer cache system. .It Cm kernel_cache By default cached buffers of a given file are flushed at each .Xr open 2 . -This option disables this behaviour +This option disables this behaviour. .El .Sh DAEMON MOUNTS Usually users do not need to use @@ -194,7 +214,7 @@ only if the filesystem daemon has the same credentials real gid) as the user. .Pp This is applied for Fuse mounts by default and only root can mount without -the strict access policy (i.e. the +the strict access policy (i.e., the .Cm allow_other mount option). .Pp @@ -206,7 +226,7 @@ Users might opt to willingly relax strict access polic are concerned) by doing their own secondary mount (See .Sx SHARED MOUNTS ) . .Sh SHARED MOUNTS -A Fuse daemon can be shared (i.e. mounted multiple times). +A Fuse daemon can be shared (i.e., mounted multiple times). When doing the first (primary) mount, the spawner and the mounter of the daemon must have the same uid, or the mounter should be the superuser. .Pp @@ -225,7 +245,7 @@ is used or not. .Pp The device name of a secondary mount is the device name of the corresponding primary mount, followed by a '#' character and the index of the secondary -mount; e.g. +mount; e.g., .Pa /dev/fuse0#3 . .Sh SECURITY System administrators might want to use a custom mount policy (ie., one going @@ -239,7 +259,7 @@ However, given that is capable of invoking an arbitrary program, one must be careful when doing this. .Nm is designed in a way such that it makes that easy. -For this purpose, there are options which disable certain risky features (i.e. +For this purpose, there are options which disable certain risky features ( .Fl S and .Fl A ) , @@ -342,7 +362,7 @@ does not call any external utility and also provides a was written as the part of the .Fx implementation of the Fuse userspace filesystem framework (see -.Xr https://github.com/libfuse/libfuse ) +.Lk https://github.com/libfuse/libfuse ) and first appeared in the .Pa sysutils/fusefs-kmod port, supporting Modified: head/sbin/mount_fusefs/mount_fusefs.c ============================================================================== --- head/sbin/mount_fusefs/mount_fusefs.c Tue Aug 6 23:22:25 2019 (r350664) +++ head/sbin/mount_fusefs/mount_fusefs.c Wed Aug 7 00:38:26 2019 (r350665) @@ -5,6 +5,11 @@ * Copyright (c) 2005 Csaba Henk * All rights reserved. * + * Copyright (c) 2019 The FreeBSD Foundation + * + * Portions of this software were developed by BFF Storage Systems under + * sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -60,7 +65,6 @@ void __usage_short(void); void usage(void); void helpmsg(void); void showversion(void); -int init_backgrounded(void); static struct mntopt mopts[] = { #define ALTF_PRIVATE 0x01 @@ -73,8 +77,6 @@ static struct mntopt mopts[] = { { "max_read=", 0, ALTF_MAXREAD, 1 }, #define ALTF_SUBTYPE 0x40 { "subtype=", 0, ALTF_SUBTYPE, 1 }, - #define ALTF_SYNC_UNMOUNT 0x80 - { "sync_unmount", 0, ALTF_SYNC_UNMOUNT, 1 }, /* * MOPT_AUTOMOUNTED, included by MOPT_STDOPTS, does not fit into * the 'flags' argument to nmount(2). We have to abuse altflags @@ -82,6 +84,8 @@ static struct mntopt mopts[] = { */ #define ALTF_AUTOMOUNTED 0x100 { "automounted", 0, ALTF_AUTOMOUNTED, 1 }, + #define ALTF_INTR 0x200 + { "intr", 0, ALTF_INTR, 1 }, /* Linux specific options, we silently ignore them */ { "fsname=", 0, 0x00, 1 }, { "fd=", 0, 0x00, 1 }, @@ -91,6 +95,8 @@ static struct mntopt mopts[] = { { "large_read", 0, 0x00, 1 }, /* "nonempty", just the first two chars are stripped off during parsing */ { "nempty", 0, 0x00, 1 }, + { "async", 0, MNT_ASYNC, 0}, + { "noasync", 1, MNT_ASYNC, 0}, MOPT_STDOPTS, MOPT_END }; @@ -107,7 +113,7 @@ static struct mntval mvals[] = { { 0, NULL, 0 } }; -#define DEFAULT_MOUNT_FLAGS ALTF_PRIVATE | ALTF_SYNC_UNMOUNT +#define DEFAULT_MOUNT_FLAGS ALTF_PRIVATE int main(int argc, char *argv[]) @@ -409,12 +415,6 @@ main(int argc, char *argv[]) } } - if (fd >= 0 && ! init_backgrounded() && close(fd) < 0) { - if (pid) - kill(pid, SIGKILL); - err(1, "failed to close fuse device"); - } - /* Prepare the options vector for nmount(). build_iovec() is declared * in mntopts.h. */ sprintf(fdstr, "%d", fd); @@ -471,6 +471,7 @@ helpmsg(void) " -o allow_other allow access to other users\n" /* " -o nonempty allow mounts over non-empty file/dir\n" */ " -o default_permissions enable permission checking by kernel\n" + " -o intr interruptible mount\n" /* " -o fsname=NAME set filesystem name\n" " -o large_read issue large read requests (2.4 only)\n" @@ -481,7 +482,6 @@ helpmsg(void) " -o neglect_shares don't report EBUSY when unmount attempted\n" " in presence of secondary mounts\n" " -o push_symlinks_in prefix absolute symlinks with mountpoint\n" - " -o sync_unmount do unmount synchronously\n" ); exit(EX_USAGE); } @@ -491,18 +491,4 @@ showversion(void) { puts("mount_fusefs [fuse4bsd] version: " FUSE4BSD_VERSION); exit(EX_USAGE); -} - -int -init_backgrounded(void) -{ - int ibg; - size_t len; - - len = sizeof(ibg); - - if (sysctlbyname("vfs.fusefs.init_backgrounded", &ibg, &len, NULL, 0)) - return (0); - - return (ibg); } Modified: head/share/man/man5/fusefs.5 ============================================================================== --- head/share/man/man5/fusefs.5 Tue Aug 6 23:22:25 2019 (r350664) +++ head/share/man/man5/fusefs.5 Wed Aug 7 00:38:26 2019 (r350665) @@ -3,8 +3,8 @@ .\" .\" Copyright (c) 2019 The FreeBSD Foundation .\" -.\" This software was developed by BFF Storage Systems, LLC under sponsorship -.\" from the FreeBSD Foundation. +.\" This documentation was written by BFF Storage Systems, LLC under +.\" sponsorship from the FreeBSD Foundation. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -28,7 +28,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd April 13, 2019 +.Dd July 31, 2019 .Dt FUSEFS 5 .Os .Sh NAME @@ -60,11 +60,9 @@ Finally, the API is portable. Many daemons can run on multiple operating systems with minimal modifications. .Sh SYSCTL VARIABLES -The following variables are available as both +The following .Xr sysctl 8 -variables and -.Xr loader 8 -tunables: +variables are available: .Bl -tag -width indent .It Va vfs.fusefs.kernelabi_major Major version of the FUSE kernel ABI supported by this driver. @@ -73,7 +71,7 @@ Minor version of the FUSE kernel ABI supported by this .It Va vfs.fusefs.data_cache_mode Controls how .Nm -will cache file data. +will cache file data for pre-7.23 file systems. A value of 0 will disable caching entirely. Every data access will be forwarded to the daemon. A value of 1 will select write-through caching. @@ -84,33 +82,26 @@ Reads and writes will both be cached, and writes will to the daemon by the page daemon. Write-back caching is usually unsafe, especially for FUSE file systems that require network access. -.It Va vfs.fusefs.lookup_cache_enable -Controls whether -.Nm -will cache lookup responses from the file system. -FUSE file systems indicate whether lookup responses should be cacheable, but -it may be useful to globally disable caching them if a file system is -misbehaving. +.Pp +FUSE file systems using protocol 7.23 or later specify their cache behavior +on a per-mountpoint basis, ignoring this sysctl. +.It Va vfs.fusefs.stats.filehandle_count +Current number of open FUSE file handles. +.It Va vfs.fusefs.stats.lookup_cache_hits +Total number of lookup cache hits. +.It Va vfs.fusefs.stats.lookup_cache_misses +Total number of lookup cache misses. +.It Va vfs.fusefs.stats.node_count +Current number of allocated FUSE vnodes. +.It Va vfs.fusefs.stats.ticket_count +Current number of allocated FUSE tickets, which is roughly equal to the number +of FUSE operations currently being processed by daemons. .\" Undocumented sysctls .\" ==================== -.\" Counters: I intend to rename to vfs.fusefs.stats.* for clarity -.\" vfs.fusefs.lookup_cache_{hits, misses} -.\" vfs.fusefs.filehandle_count -.\" vfs.fusefs.ticker_count -.\" vfs.fusefs.node_count -.\" -.\" vfs.fusefs.version - useless since the driver moved in-tree -.\" vfs.fusefs.reclaim_revoked: I don't understand it well-enough -.\" vfs.fusefs.sync_unmount: dead code .\" vfs.fusefs.enforce_dev_perms: I don't understand it well enough. -.\" vfs.fusefs.init_backgrounded: dead code .\" vfs.fusefs.iov_credit: I don't understand it well enough .\" vfs.fusefs.iov_permanent_bufsize: I don't understand it well enough -.\" vfs.fusefs.fix_broken_io: I don't understand it well enough -.\" vfs.fusefs.sync_resize: useless and should be removed -.\" vfs.fusefs.refresh_size: probably useless? -.\" vfs.fusefs.mmap_enable: why is this optional? -.\" vfs.fusefs.data_cache_invalidate: what is this needed for? +.El .Sh SEE ALSO .Xr mount_fusefs 8 .Sh HISTORY @@ -119,7 +110,7 @@ The driver was written as the part of the .Fx implementation of the FUSE userspace file system framework (see -.Xr https://github.com/libfuse/libfuse ) +.Lk https://github.com/libfuse/libfuse ) and first appeared in the .Pa sysutils/fusefs-kmod port, supporting Modified: head/sys/fs/fuse/fuse.h ============================================================================== --- head/sys/fs/fuse/fuse.h Tue Aug 6 23:22:25 2019 (r350664) +++ head/sys/fs/fuse/fuse.h Wed Aug 7 00:38:26 2019 (r350665) @@ -32,6 +32,11 @@ * * Copyright (C) 2005 Csaba Henk. * All rights reserved. + * + * Copyright (c) 2019 The FreeBSD Foundation + * + * Portions of this software were developed by BFF Storage Systems, LLC under + * sponsorship from the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -63,87 +68,10 @@ #define FUSE_MIN_DAEMON_TIMEOUT 0 /* s */ #define FUSE_MAX_DAEMON_TIMEOUT 600 /* s */ -#ifndef FUSE_FREEBSD_VERSION -#define FUSE_FREEBSD_VERSION "0.4.4" -#endif - -/* Mapping versions to features */ - -#define FUSE_KERNELABI_GEQ(maj, min) \ -(FUSE_KERNEL_VERSION > (maj) || (FUSE_KERNEL_VERSION == (maj) && FUSE_KERNEL_MINOR_VERSION >= (min))) - -/* - * Appearance of new FUSE operations is not always in par with version - * numbering... At least, 7.3 is a sufficient condition for having - * FUSE_{ACCESS,CREATE}. - */ -#if FUSE_KERNELABI_GEQ(7, 3) -#ifndef FUSE_HAS_ACCESS -#define FUSE_HAS_ACCESS 1 -#endif -#ifndef FUSE_HAS_CREATE -#define FUSE_HAS_CREATE 1 -#endif -#else /* FUSE_KERNELABI_GEQ(7, 3) */ -#ifndef FUSE_HAS_ACCESS -#define FUSE_HAS_ACCESS 0 -#endif -#ifndef FUSE_HAS_CREATE -#define FUSE_HAS_CREATE 0 -#endif -#endif - -#if FUSE_KERNELABI_GEQ(7, 7) -#ifndef FUSE_HAS_GETLK -#define FUSE_HAS_GETLK 1 -#endif -#ifndef FUSE_HAS_SETLK -#define FUSE_HAS_SETLK 1 -#endif -#ifndef FUSE_HAS_SETLKW -#define FUSE_HAS_SETLKW 1 -#endif -#ifndef FUSE_HAS_INTERRUPT -#define FUSE_HAS_INTERRUPT 1 -#endif -#else /* FUSE_KERNELABI_GEQ(7, 7) */ -#ifndef FUSE_HAS_GETLK -#define FUSE_HAS_GETLK 0 -#endif -#ifndef FUSE_HAS_SETLK -#define FUSE_HAS_SETLK 0 -#endif -#ifndef FUSE_HAS_SETLKW -#define FUSE_HAS_SETLKW 0 -#endif -#ifndef FUSE_HAS_INTERRUPT -#define FUSE_HAS_INTERRUPT 0 -#endif -#endif - -#if FUSE_KERNELABI_GEQ(7, 8) -#ifndef FUSE_HAS_FLUSH_RELEASE -#define FUSE_HAS_FLUSH_RELEASE 1 -/* - * "DESTROY" came in the middle of the 7.8 era, - * so this is not completely exact... - */ -#ifndef FUSE_HAS_DESTROY -#define FUSE_HAS_DESTROY 1 -#endif -#endif -#else /* FUSE_KERNELABI_GEQ(7, 8) */ -#ifndef FUSE_HAS_FLUSH_RELEASE -#define FUSE_HAS_FLUSH_RELEASE 0 -#ifndef FUSE_HAS_DESTROY -#define FUSE_HAS_DESTROY 0 -#endif -#endif -#endif - /* misc */ SYSCTL_DECL(_vfs_fusefs); +SYSCTL_DECL(_vfs_fusefs_stats); /* Fuse locking */ Modified: head/sys/fs/fuse/fuse_device.c ============================================================================== --- head/sys/fs/fuse/fuse_device.c Tue Aug 6 23:22:25 2019 (r350664) +++ head/sys/fs/fuse/fuse_device.c Wed Aug 7 00:38:26 2019 (r350665) @@ -33,6 +33,11 @@ * Copyright (C) 2005 Csaba Henk. * All rights reserved. * + * Copyright (c) 2019 The FreeBSD Foundation + * + * Portions of this software were developed by BFF Storage Systems, LLC under + * sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -81,27 +86,28 @@ __FBSDID("$FreeBSD$"); #include #include "fuse.h" +#include "fuse_internal.h" #include "fuse_ipc.h" -SDT_PROVIDER_DECLARE(fuse); +SDT_PROVIDER_DECLARE(fusefs); /* * Fuse trace probe: * arg0: verbosity. Higher numbers give more verbose messages * arg1: Textual message */ -SDT_PROBE_DEFINE2(fuse, , device, trace, "int", "char*"); +SDT_PROBE_DEFINE2(fusefs, , device, trace, "int", "char*"); static struct cdev *fuse_dev; +static d_kqfilter_t fuse_device_filter; static d_open_t fuse_device_open; -static d_close_t fuse_device_close; static d_poll_t fuse_device_poll; static d_read_t fuse_device_read; static d_write_t fuse_device_write; static struct cdevsw fuse_device_cdevsw = { + .d_kqfilter = fuse_device_filter, .d_open = fuse_device_open, - .d_close = fuse_device_close, .d_name = "fuse", .d_poll = fuse_device_poll, .d_read = fuse_device_read, @@ -109,6 +115,15 @@ static struct cdevsw fuse_device_cdevsw = { .d_version = D_VERSION, }; +static int fuse_device_filt_read(struct knote *kn, long hint); +static void fuse_device_filt_detach(struct knote *kn); + +struct filterops fuse_device_rfiltops = { + .f_isfd = 1, + .f_detach = fuse_device_filt_detach, + .f_event = fuse_device_filt_read, +}; + /**************************** * * >>> Fuse device op defs @@ -119,11 +134,100 @@ static void fdata_dtor(void *arg) { struct fuse_data *fdata; + struct fuse_ticket *tick; fdata = arg; + if (fdata == NULL) + return; + + fdata_set_dead(fdata); + + FUSE_LOCK(); + fuse_lck_mtx_lock(fdata->aw_mtx); + /* wakup poll()ers */ + selwakeuppri(&fdata->ks_rsel, PZERO + 1); + /* Don't let syscall handlers wait in vain */ + while ((tick = fuse_aw_pop(fdata))) { + fuse_lck_mtx_lock(tick->tk_aw_mtx); + fticket_set_answered(tick); + tick->tk_aw_errno = ENOTCONN; + wakeup(tick); + fuse_lck_mtx_unlock(tick->tk_aw_mtx); + FUSE_ASSERT_AW_DONE(tick); + fuse_ticket_drop(tick); + } + fuse_lck_mtx_unlock(fdata->aw_mtx); + + /* Cleanup unsent operations */ + fuse_lck_mtx_lock(fdata->ms_mtx); + while ((tick = fuse_ms_pop(fdata))) { + fuse_ticket_drop(tick); + } + fuse_lck_mtx_unlock(fdata->ms_mtx); + FUSE_UNLOCK(); + fdata_trydestroy(fdata); } +static int +fuse_device_filter(struct cdev *dev, struct knote *kn) +{ + struct fuse_data *data; + int error; + + error = devfs_get_cdevpriv((void **)&data); + + /* EVFILT_WRITE is not supported; the device is always ready to write */ + if (error == 0 && kn->kn_filter == EVFILT_READ) { + kn->kn_fop = &fuse_device_rfiltops; + kn->kn_hook = data; + knlist_add(&data->ks_rsel.si_note, kn, 0); + error = 0; + } else if (error == 0) { + error = EINVAL; + kn->kn_data = error; + } + + return (error); +} + +static void +fuse_device_filt_detach(struct knote *kn) +{ + struct fuse_data *data; + + data = (struct fuse_data*)kn->kn_hook; + MPASS(data != NULL); + knlist_remove(&data->ks_rsel.si_note, kn, 0); + kn->kn_hook = NULL; +} + +static int +fuse_device_filt_read(struct knote *kn, long hint) +{ + struct fuse_data *data; + int ready; + + data = (struct fuse_data*)kn->kn_hook; + MPASS(data != NULL); + + mtx_assert(&data->ms_mtx, MA_OWNED); + if (fdata_get_dead(data)) { + kn->kn_flags |= EV_EOF; + kn->kn_fflags = ENODEV; + kn->kn_data = 1; + ready = 1; + } else if (STAILQ_FIRST(&data->ms_head)) { + MPASS(data->ms_count >= 1); + kn->kn_data = data->ms_count; + ready = 1; + } else { + ready = 0; + } + + return (ready); +} + /* * Resources are set up on a per-open basis */ @@ -133,52 +237,17 @@ fuse_device_open(struct cdev *dev, int oflags, int dev struct fuse_data *fdata; int error; - SDT_PROBE2(fuse, , device, trace, 1, "device open"); + SDT_PROBE2(fusefs, , device, trace, 1, "device open"); fdata = fdata_alloc(dev, td->td_ucred); error = devfs_set_cdevpriv(fdata, fdata_dtor); if (error != 0) fdata_trydestroy(fdata); else - SDT_PROBE2(fuse, , device, trace, 1, "device open success"); + SDT_PROBE2(fusefs, , device, trace, 1, "device open success"); return (error); } -static int -fuse_device_close(struct cdev *dev, int fflag, int devtype, struct thread *td) -{ - struct fuse_data *data; - struct fuse_ticket *tick; - int error; - - error = devfs_get_cdevpriv((void **)&data); - if (error != 0) - return (error); - if (!data) - panic("no fuse data upon fuse device close"); - fdata_set_dead(data); - - FUSE_LOCK(); - fuse_lck_mtx_lock(data->aw_mtx); - /* wakup poll()ers */ - selwakeuppri(&data->ks_rsel, PZERO + 1); - /* Don't let syscall handlers wait in vain */ - while ((tick = fuse_aw_pop(data))) { - fuse_lck_mtx_lock(tick->tk_aw_mtx); - fticket_set_answered(tick); - tick->tk_aw_errno = ENOTCONN; - wakeup(tick); - fuse_lck_mtx_unlock(tick->tk_aw_mtx); - FUSE_ASSERT_AW_DONE(tick); - fuse_ticket_drop(tick); - } - fuse_lck_mtx_unlock(data->aw_mtx); - FUSE_UNLOCK(); - - SDT_PROBE2(fuse, , device, trace, 1, "device close"); - return (0); -} - int fuse_device_poll(struct cdev *dev, int events, struct thread *td) { @@ -219,7 +288,7 @@ fuse_device_read(struct cdev *dev, struct uio *uio, in int buflen[3]; int i; - SDT_PROBE2(fuse, , device, trace, 1, "fuse device read"); + SDT_PROBE2(fusefs, , device, trace, 1, "fuse device read"); err = devfs_get_cdevpriv((void **)&data); if (err != 0) @@ -228,7 +297,7 @@ fuse_device_read(struct cdev *dev, struct uio *uio, in fuse_lck_mtx_lock(data->ms_mtx); again: if (fdata_get_dead(data)) { - SDT_PROBE2(fuse, , device, trace, 2, + SDT_PROBE2(fusefs, , device, trace, 2, "we know early on that reader should be kicked so we " "don't wait for news"); fuse_lck_mtx_unlock(data->ms_mtx); @@ -256,7 +325,7 @@ again: * -- and some other cases, too, tho not totally clear, when * (cv_signal/wakeup_one signals the whole process ?) */ - SDT_PROBE2(fuse, , device, trace, 1, "no message on thread"); + SDT_PROBE2(fusefs, , device, trace, 1, "no message on thread"); goto again; } fuse_lck_mtx_unlock(data->ms_mtx); @@ -266,9 +335,10 @@ again: * somebody somewhere -- eg., umount routine -- * wants this liaison finished off */ - SDT_PROBE2(fuse, , device, trace, 2, "reader is to be sacked"); + SDT_PROBE2(fusefs, , device, trace, 2, + "reader is to be sacked"); if (tick) { - SDT_PROBE2(fuse, , device, trace, 2, "weird -- " + SDT_PROBE2(fusefs, , device, trace, 2, "weird -- " "\"kick\" is set tho there is message"); FUSE_ASSERT_MS_DONE(tick); fuse_ticket_drop(tick); @@ -276,7 +346,7 @@ again: return (ENODEV); /* This should make the daemon get off * of us */ } - SDT_PROBE2(fuse, , device, trace, 1, + SDT_PROBE2(fusefs, , device, trace, 1, "fuse device read message successfully"); KASSERT(tick->tk_ms_bufdata || tick->tk_ms_bufsize == 0, @@ -311,7 +381,7 @@ again: */ if (uio->uio_resid < buflen[i]) { fdata_set_dead(data); - SDT_PROBE2(fuse, , device, trace, 2, + SDT_PROBE2(fusefs, , device, trace, 2, "daemon is stupid, kick it off..."); err = ENODEV; break; @@ -331,23 +401,26 @@ static inline int fuse_ohead_audit(struct fuse_out_header *ohead, struct uio *uio) { if (uio->uio_resid + sizeof(struct fuse_out_header) != ohead->len) { - SDT_PROBE2(fuse, , device, trace, 1, "Format error: body size " + SDT_PROBE2(fusefs, , device, trace, 1, + "Format error: body size " "differs from size claimed by header"); return (EINVAL); } - if (uio->uio_resid && ohead->error) { - SDT_PROBE2(fuse, , device, trace, 1, + if (uio->uio_resid && ohead->unique != 0 && ohead->error) { + SDT_PROBE2(fusefs, , device, trace, 1, "Format error: non zero error but message had a body"); return (EINVAL); } - /* Sanitize the linuxism of negative errnos */ - ohead->error = -(ohead->error); return (0); } -SDT_PROBE_DEFINE1(fuse, , device, fuse_device_write_bumped_into_callback, - "uint64_t"); +SDT_PROBE_DEFINE1(fusefs, , device, fuse_device_write_notify, + "struct fuse_out_header*"); +SDT_PROBE_DEFINE1(fusefs, , device, fuse_device_write_missing_ticket, + "uint64_t"); +SDT_PROBE_DEFINE1(fusefs, , device, fuse_device_write_found, + "struct fuse_ticket*"); /* * fuse_device_write first reads the header sent by the daemon. * If that's OK, looks up ticket/callback node by the unique id seen in header. @@ -360,15 +433,17 @@ fuse_device_write(struct cdev *dev, struct uio *uio, i struct fuse_out_header ohead; int err = 0; struct fuse_data *data; - struct fuse_ticket *tick, *x_tick; + struct mount *mp; + struct fuse_ticket *tick, *itick, *x_tick; int found = 0; err = devfs_get_cdevpriv((void **)&data); if (err != 0) return (err); + mp = data->mp; if (uio->uio_resid < sizeof(struct fuse_out_header)) { - SDT_PROBE2(fuse, , device, trace, 1, + SDT_PROBE2(fusefs, , device, trace, 1, "fuse_device_write got less than a header!"); fdata_set_dead(data); return (EINVAL); @@ -393,15 +468,29 @@ fuse_device_write(struct cdev *dev, struct uio *uio, i fuse_lck_mtx_lock(data->aw_mtx); TAILQ_FOREACH_SAFE(tick, &data->aw_head, tk_aw_link, x_tick) { - SDT_PROBE1(fuse, , device, - fuse_device_write_bumped_into_callback, - tick->tk_unique); if (tick->tk_unique == ohead.unique) { + SDT_PROBE1(fusefs, , device, fuse_device_write_found, + tick); found = 1; fuse_aw_remove(tick); break; } } + if (found && tick->irq_unique > 0) { + /* + * Discard the FUSE_INTERRUPT ticket that tried to interrupt + * this operation + */ + TAILQ_FOREACH_SAFE(itick, &data->aw_head, tk_aw_link, + x_tick) { + if (itick->tk_unique == tick->irq_unique) { + fuse_aw_remove(itick); + fuse_ticket_drop(itick); + break; + } + } + tick->irq_unique = 0; + } fuse_lck_mtx_unlock(data->aw_mtx); if (found) { @@ -414,13 +503,15 @@ fuse_device_write(struct cdev *dev, struct uio *uio, i * via ticket_drop(), so no manual mucking * around...) */ - SDT_PROBE2(fuse, , device, trace, 1, + SDT_PROBE2(fusefs, , device, trace, 1, "pass ticket to a callback"); + /* Sanitize the linuxism of negative errnos */ + ohead.error *= -1; memcpy(&tick->tk_aw_ohead, &ohead, sizeof(ohead)); err = tick->tk_aw_handler(tick, uio); } else { /* pretender doesn't wanna do anything with answer */ - SDT_PROBE2(fuse, , device, trace, 1, + SDT_PROBE2(fusefs, , device, trace, 1, "stuff devalidated, so we drop it"); } @@ -430,11 +521,51 @@ fuse_device_write(struct cdev *dev, struct uio *uio, i * because fuse_ticket_drop() will deal with refcount anyway. */ fuse_ticket_drop(tick); + } else if (ohead.unique == 0){ + /* unique == 0 means asynchronous notification */ + SDT_PROBE1(fusefs, , device, fuse_device_write_notify, &ohead); + switch (ohead.error) { + case FUSE_NOTIFY_INVAL_ENTRY: + err = fuse_internal_invalidate_entry(mp, uio); + break; + case FUSE_NOTIFY_INVAL_INODE: + err = fuse_internal_invalidate_inode(mp, uio); + break; + case FUSE_NOTIFY_RETRIEVE: + case FUSE_NOTIFY_STORE: + /* + * Unimplemented. I don't know of any file systems + * that use them, and the protocol isn't sound anyway, + * since the notification messages don't include the + * inode's generation number. Without that, it's + * possible to manipulate the cache of the wrong vnode. + * Finally, it's not defined what this message should + * do for a file with dirty cache. + */ + case FUSE_NOTIFY_POLL: + /* Unimplemented. See comments in fuse_vnops */ + default: + /* Not implemented */ + err = ENOSYS; + } } else { /* no callback at all! */ - SDT_PROBE2(fuse, , device, trace, 1, - "erhm, no handler for this response"); - err = EINVAL; + SDT_PROBE1(fusefs, , device, fuse_device_write_missing_ticket, + ohead.unique); + if (ohead.error == -EAGAIN) { + /* + * This was probably a response to a FUSE_INTERRUPT + * operation whose original operation is already + * complete. We can't store FUSE_INTERRUPT tickets + * indefinitely because their responses are optional. + * So we delete them when the original operation + * completes. And sadly the fuse_header_out doesn't + * identify the opcode, so we have to guess. + */ + err = 0; + } else { + err = EINVAL; + } } return (err); @@ -445,7 +576,7 @@ fuse_device_init(void) { fuse_dev = make_dev(&fuse_device_cdevsw, 0, UID_ROOT, GID_OPERATOR, - S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, "fuse"); + S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, "fuse"); if (fuse_dev == NULL) return (ENOMEM); return (0); Modified: head/sys/fs/fuse/fuse_file.c ============================================================================== --- head/sys/fs/fuse/fuse_file.c Tue Aug 6 23:22:25 2019 (r350664) +++ head/sys/fs/fuse/fuse_file.c Wed Aug 7 00:38:26 2019 (r350665) @@ -33,6 +33,11 @@ * Copyright (C) 2005 Csaba Henk. * All rights reserved. * + * Copyright (c) 2019 The FreeBSD Foundation + * + * Portions of this software were developed by BFF Storage Systems, LLC under + * sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -59,8 +64,9 @@ __FBSDID("$FreeBSD$"); #include -#include #include +#include +#include #include #include #include @@ -79,52 +85,61 @@ __FBSDID("$FreeBSD$"); #include "fuse.h" #include "fuse_file.h" #include "fuse_internal.h" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Aug 7 00:47:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2062CB8163; Wed, 7 Aug 2019 00:47:10 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463CWd6sDmz3yZQ; Wed, 7 Aug 2019 00:47:09 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [172.17.133.228] (unknown [12.202.168.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 31FB2E811; Wed, 7 Aug 2019 00:47:09 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/10.1b.0.190715 Date: Tue, 06 Aug 2019 17:47:05 -0700 Subject: Re: svn commit: r350665 - in head: . etc/mtree sbin/mount_fusefs share/man/man5 sys/fs/fuse sys/sys tests/sys/fs tests/sys/fs/fusefs From: Ravi Pokala To: Alan Somers , , , Message-ID: <04AB02BB-553E-4B63-80BB-07FA4364287D@panasas.com> Thread-Topic: svn commit: r350665 - in head: . etc/mtree sbin/mount_fusefs share/man/man5 sys/fs/fuse sys/sys tests/sys/fs tests/sys/fs/fusefs References: <201908070038.x770cQZE007711@repo.freebsd.org> In-Reply-To: <201908070038.x770cQZE007711@repo.freebsd.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 00:47:10 -0000 -----Original Message----- From: on behalf of Alan Somers Date: 2019-08-06, Tuesday at 17:38 To: , , Subject: svn commit: r350665 - in head: . etc/mtree sbin/mount_fusefs share/man/man5 sys/fs/fuse sys/sys tests/sys/fs tests/sys/fs/fusefs > Author: asomers > Date: Wed Aug 7 00:38:26 2019 > New Revision: 350665 > URL: https://svnweb.freebsd.org/changeset/base/350665 > > Log: > fusefs: merge from projects/fuse2 Thanks Alan! I've been watching this work with significant interest[*] for quite a while, and am glad this is finally landing. Thanks again, Ravi (rpokala@) [*] or as much interest as anyone who knows ~nothing about filesystems can muster ;-) > This commit imports the new fusefs driver. It raises the protocol level > from 7.8 to 7.23, fixes many bugs, adds a test suite for the driver, and > adds many new features. New features include: > > * Optional kernel-side permissions checks (-o default_permissions) > * Implement VOP_MKNOD, VOP_BMAP, and VOP_ADVLOCK > * Allow interrupting FUSE operations > * Support named pipes and unix-domain sockets in fusefs file systems > * Forward UTIME_NOW during utimensat(2) to the daemon > * kqueue support for /dev/fuse > * Allow updating mounts with "mount -u" > * Allow exporting fusefs file systems over NFS > * Server-initiated invalidation of the name cache or data cache > * Respect RLIMIT_FSIZE > * Try to support servers as old as protocol 7.4 > > Performance enhancements include: > > * Implement FUSE's FOPEN_KEEP_CACHE and FUSE_ASYNC_READ flags > * Cache file attributes > * Cache lookup entries, both positive and negative > * Server-selectable cache modes: writethrough, writeback, or uncached > * Write clustering > * Readahead > * Use counter(9) for statistical reporting > > PR: 199934 216391 233783 234581 235773 235774 235775 > PR: 236226 236231 236236 236291 236329 236381 236405 > PR: 236327 236466 236472 236473 236474 236530 236557 > PR: 236560 236844 237052 237181 237588 238565 > Reviewed by: bcr (man pages) > Reviewed by: cem, ngie, rpokala, glebius, kib, bde, emaste (post-commit > review on project branch) > MFC after: 3 weeks > Relnotes: yes > Sponsored by: The FreeBSD Foundation > Pull Request: https://reviews.freebsd.org/D21110 From owner-svn-src-head@freebsd.org Wed Aug 7 00:53:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23517B840A; Wed, 7 Aug 2019 00:53:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463Cfv70NVz3yyy; Wed, 7 Aug 2019 00:53:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1F3D4A17; Wed, 7 Aug 2019 00:53:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x770rRaa019504; Wed, 7 Aug 2019 00:53:27 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x770rRd5019503; Wed, 7 Aug 2019 00:53:27 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201908070053.x770rRd5019503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 7 Aug 2019 00:53:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350666 - head/usr.bin/netstat X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/usr.bin/netstat X-SVN-Commit-Revision: 350666 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 00:53:28 -0000 Author: jhb Date: Wed Aug 7 00:53:27 2019 New Revision: 350666 URL: https://svnweb.freebsd.org/changeset/base/350666 Log: Tidy up the list of auth and encryption algorithms for IPsec stats. - Use keyed-md5 and keyed_sha1 instead of md5 and sha1 to match the names accepted by setkey and to also avoid confusion since these are not "plain" MD5 or SHA1. - Remove always-true #ifdef's to make the source a bit easier to read. - Add missing mappings for tcp-md5, camellia-cbc, and aes-gmac. MFC after: 2 weeks Sponsored by: Chelsio Communications Modified: head/usr.bin/netstat/ipsec.c Modified: head/usr.bin/netstat/ipsec.c ============================================================================== --- head/usr.bin/netstat/ipsec.c Wed Aug 7 00:38:26 2019 (r350665) +++ head/usr.bin/netstat/ipsec.c Wed Aug 7 00:53:27 2019 (r350666) @@ -125,33 +125,18 @@ static struct val2str ipsec_ahnames[] = { { SADB_AALG_NONE, "none", }, { SADB_AALG_MD5HMAC, "hmac-md5", }, { SADB_AALG_SHA1HMAC, "hmac-sha1", }, - { SADB_X_AALG_MD5, "md5", }, - { SADB_X_AALG_SHA, "sha", }, + { SADB_X_AALG_MD5, "keyed-md5", }, + { SADB_X_AALG_SHA, "keyed-sha1", }, { SADB_X_AALG_NULL, "null", }, -#ifdef SADB_X_AALG_SHA2_256 { SADB_X_AALG_SHA2_256, "hmac-sha2-256", }, -#endif -#ifdef SADB_X_AALG_SHA2_384 { SADB_X_AALG_SHA2_384, "hmac-sha2-384", }, -#endif -#ifdef SADB_X_AALG_SHA2_512 { SADB_X_AALG_SHA2_512, "hmac-sha2-512", }, -#endif -#ifdef SADB_X_AALG_RIPEMD160HMAC { SADB_X_AALG_RIPEMD160HMAC, "hmac-ripemd160", }, -#endif -#ifdef SADB_X_AALG_AES_XCBC_MAC { SADB_X_AALG_AES_XCBC_MAC, "aes-xcbc-mac", }, -#endif -#ifdef SADB_X_AALG_AES128GMAC + { SADB_X_AALG_TCP_MD5, "tcp-md5", }, { SADB_X_AALG_AES128GMAC, "aes-gmac-128", }, -#endif -#ifdef SADB_X_AALG_AES192GMAC { SADB_X_AALG_AES192GMAC, "aes-gmac-192", }, -#endif -#ifdef SADB_X_AALG_AES256GMAC { SADB_X_AALG_AES256GMAC, "aes-gmac-256", }, -#endif { -1, NULL }, }; @@ -162,15 +147,11 @@ static struct val2str ipsec_espnames[] = { { SADB_EALG_NULL, "null", }, { SADB_X_EALG_CAST128CBC, "cast128-cbc", }, { SADB_X_EALG_BLOWFISHCBC, "blowfish-cbc", }, -#ifdef SADB_X_EALG_RIJNDAELCBC { SADB_X_EALG_RIJNDAELCBC, "rijndael-cbc", }, -#endif -#ifdef SADB_X_EALG_AESCTR + { SADB_X_EALG_CAMELLIACBC, "camellia-cbc", }, { SADB_X_EALG_AESCTR, "aes-ctr", }, -#endif -#ifdef SADB_X_EALG_AESGCM16 { SADB_X_EALG_AESGCM16, "aes-gcm-16", }, -#endif + { SADB_X_EALG_AESGMAC, "aes-gmac", }, { -1, NULL }, }; From owner-svn-src-head@freebsd.org Wed Aug 7 01:41:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6FB87BA303; Wed, 7 Aug 2019 01:41:21 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463Dk937w1z437y; Wed, 7 Aug 2019 01:41:21 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E1A952BF; Wed, 7 Aug 2019 01:41:21 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x771fLge047909; Wed, 7 Aug 2019 01:41:21 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x771fIhQ047893; Wed, 7 Aug 2019 01:41:18 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908070141.x771fIhQ047893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 7 Aug 2019 01:41:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350670 - in head/sys: conf contrib/zlib dev/zlib modules/crypto modules/mxge/mxge modules/zfs modules/zlib X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in head/sys: conf contrib/zlib dev/zlib modules/crypto modules/mxge/mxge modules/zfs modules/zlib X-SVN-Commit-Revision: 350670 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 01:41:21 -0000 Author: delphij Date: Wed Aug 7 01:41:17 2019 New Revision: 350670 URL: https://svnweb.freebsd.org/changeset/base/350670 Log: Expose zlib's utility functions in Z_SOLO library when building kernel. This allows kernel code to reuse zlib's implementation. PR: 229763 Reviewed by: Yoshihiro Ota Relnotes: yes Differential Revision: https://reviews.freebsd.org/D21156 Modified: head/sys/conf/files head/sys/conf/kern.pre.mk head/sys/conf/kmod.mk head/sys/contrib/zlib/deflate.c head/sys/contrib/zlib/infback.c head/sys/contrib/zlib/inflate.c head/sys/contrib/zlib/zconf.h head/sys/contrib/zlib/zlib.h head/sys/contrib/zlib/zutil.h head/sys/dev/zlib/zcalloc.c head/sys/dev/zlib/zcalloc.h head/sys/modules/crypto/Makefile head/sys/modules/mxge/mxge/Makefile head/sys/modules/zfs/Makefile head/sys/modules/zlib/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Aug 7 01:34:41 2019 (r350669) +++ head/sys/conf/files Wed Aug 7 01:41:17 2019 (r350670) @@ -273,7 +273,7 @@ cddl/contrib/opensolaris/uts/common/os/callb.c opti cddl/contrib/opensolaris/uts/common/os/fm.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/os/list.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/os/nvpair_alloc_system.c optional zfs compile-with "${ZFS_C}" -cddl/contrib/opensolaris/uts/common/zmod/zmod.c optional zfs compile-with "${ZFS_C} ${ZLIB_CFLAGS}" +cddl/contrib/opensolaris/uts/common/zmod/zmod.c optional zfs compile-with "${ZFS_C}" # zfs lua support cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lapi.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lauxlib.c optional zfs compile-with "${ZFS_C}" @@ -2443,8 +2443,7 @@ mwlboot.fw optional mwlfw \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "mwlboot.fw" -dev/mxge/if_mxge.c optional mxge pci \ - compile-with "${ZLIB_C}" +dev/mxge/if_mxge.c optional mxge pci dev/mxge/mxge_eth_z8e.c optional mxge pci dev/mxge/mxge_ethp_z8e.c optional mxge pci dev/mxge/mxge_rss_eth_z8e.c optional mxge pci @@ -3999,35 +3998,32 @@ libkern/timingsafe_bcmp.c standard libkern/zlib.c optional crypto | geom_uzip | ipsec | \ ipsec_support | mxge | netgraph_deflate | ddb_ctf | gzio contrib/zlib/adler32.c optional crypto | geom_uzip | ipsec | \ + ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib +contrib/zlib/compress.c optional crypto | geom_uzip | ipsec | \ ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \ - compile-with "${ZLIB_C}" + compile-with "${NORMAL_C} -Wno-cast-qual" contrib/zlib/crc32.c optional crypto | geom_uzip | ipsec | \ - ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \ - compile-with "${ZLIB_C} -Wno-cast-qual" + ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib contrib/zlib/deflate.c optional crypto | geom_uzip | ipsec | \ ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \ - compile-with "${ZLIB_C} -Wno-cast-qual" + compile-with "${NORMAL_C} -Wno-cast-qual" contrib/zlib/inffast.c optional crypto | geom_uzip | ipsec | \ - ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \ - compile-with "${ZLIB_C}" + ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib contrib/zlib/inflate.c optional crypto | geom_uzip | ipsec | \ - ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \ - compile-with "${ZLIB_C}" + ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib contrib/zlib/inftrees.c optional crypto | geom_uzip | ipsec | \ - ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \ - compile-with "${ZLIB_C}" + ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib contrib/zlib/trees.c optional crypto | geom_uzip | ipsec | \ + ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib +contrib/zlib/uncompr.c optional crypto | geom_uzip | ipsec | \ ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \ - compile-with "${ZLIB_C}" + compile-with "${NORMAL_C} -Wno-cast-qual" contrib/zlib/zutil.c optional crypto | geom_uzip | ipsec | \ - ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \ - compile-with "${ZLIB_C}" + ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib dev/zlib/zlib_mod.c optional crypto | geom_uzip | ipsec | \ - ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \ - compile-with "${ZLIB_C}" + ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib dev/zlib/zcalloc.c optional crypto | geom_uzip | ipsec | \ - ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \ - compile-with "${ZLIB_C}" + ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib net/altq/altq_cbq.c optional altq net/altq/altq_codel.c optional altq net/altq/altq_hfsc.c optional altq @@ -4780,8 +4776,7 @@ opencrypto/crypto.c optional crypto | ipsec | ipsec_s opencrypto/cryptodev.c optional cryptodev opencrypto/cryptodev_if.m optional crypto | ipsec | ipsec_support opencrypto/cryptosoft.c optional crypto | ipsec | ipsec_support -opencrypto/cryptodeflate.c optional crypto | ipsec | ipsec_support \ - compile-with "${ZLIB_C}" +opencrypto/cryptodeflate.c optional crypto | ipsec | ipsec_support opencrypto/gmac.c optional crypto | ipsec | ipsec_support opencrypto/gfmult.c optional crypto | ipsec | ipsec_support opencrypto/rmd160.c optional crypto | ipsec | ipsec_support Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Wed Aug 7 01:34:41 2019 (r350669) +++ head/sys/conf/kern.pre.mk Wed Aug 7 01:41:17 2019 (r350670) @@ -173,10 +173,6 @@ NORMAL_FW= uudecode -o ${.TARGET} ${.ALLSRC} NORMAL_FWO= ${LD} -b binary --no-warn-mismatch -d -warn-common -r \ -m ${LD_EMULATION} -o ${.TARGET} ${.ALLSRC:M*.fw} -# for zlib in the kernel -ZLIB_CFLAGS+= -DZ_SOLO -ZLIB_C= ${CC} -c ${ZLIB_CFLAGS} ${CFLAGS} ${.IMPSRC} - # for ZSTD in the kernel (include zstd/lib/freebsd before other CFLAGS) ZSTD_C= ${CC} -c -DZSTD_HEAPMODE=1 -I$S/contrib/zstd/lib/freebsd ${CFLAGS} -I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WERROR} -Wno-inline -Wno-missing-prototypes ${PROF} -U__BMI__ ${.IMPSRC} Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Wed Aug 7 01:34:41 2019 (r350669) +++ head/sys/conf/kmod.mk Wed Aug 7 01:41:17 2019 (r350670) @@ -104,8 +104,6 @@ __KLD_SHARED=yes __KLD_SHARED=no .endif -ZLIB_CFLAGS+= -DZ_SOLO - .if !empty(CFLAGS:M-O[23s]) && empty(CFLAGS:M-fno-strict-aliasing) CFLAGS+= -fno-strict-aliasing .endif Modified: head/sys/contrib/zlib/deflate.c ============================================================================== --- head/sys/contrib/zlib/deflate.c Wed Aug 7 01:34:41 2019 (r350669) +++ head/sys/contrib/zlib/deflate.c Wed Aug 7 01:41:17 2019 (r350670) @@ -266,7 +266,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowB strm->msg = Z_NULL; if (strm->zalloc == (alloc_func)0) { -#ifdef Z_SOLO +#if defined(Z_SOLO) && !defined(_KERNEL) return Z_STREAM_ERROR; #else strm->zalloc = zcalloc; @@ -274,7 +274,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowB #endif } if (strm->zfree == (free_func)0) -#ifdef Z_SOLO +#if defined(Z_SOLO) && !defined(_KERNEL) return Z_STREAM_ERROR; #else strm->zfree = zcfree; Modified: head/sys/contrib/zlib/infback.c ============================================================================== --- head/sys/contrib/zlib/infback.c Wed Aug 7 01:34:41 2019 (r350669) +++ head/sys/contrib/zlib/infback.c Wed Aug 7 01:41:17 2019 (r350670) @@ -42,7 +42,7 @@ int stream_size; return Z_STREAM_ERROR; strm->msg = Z_NULL; /* in case we return an error */ if (strm->zalloc == (alloc_func)0) { -#ifdef Z_SOLO +#if defined(Z_SOLO) && !defined(_KERNEL) return Z_STREAM_ERROR; #else strm->zalloc = zcalloc; @@ -50,7 +50,7 @@ int stream_size; #endif } if (strm->zfree == (free_func)0) -#ifdef Z_SOLO +#if defined(Z_SOLO) && !defined(_KERNEL) return Z_STREAM_ERROR; #else strm->zfree = zcfree; Modified: head/sys/contrib/zlib/inflate.c ============================================================================== --- head/sys/contrib/zlib/inflate.c Wed Aug 7 01:34:41 2019 (r350669) +++ head/sys/contrib/zlib/inflate.c Wed Aug 7 01:41:17 2019 (r350670) @@ -207,7 +207,7 @@ int stream_size; if (strm == Z_NULL) return Z_STREAM_ERROR; strm->msg = Z_NULL; /* in case we return an error */ if (strm->zalloc == (alloc_func)0) { -#ifdef Z_SOLO +#if defined(Z_SOLO) && !defined(_KERNEL) return Z_STREAM_ERROR; #else strm->zalloc = zcalloc; @@ -215,7 +215,7 @@ int stream_size; #endif } if (strm->zfree == (free_func)0) -#ifdef Z_SOLO +#if defined(Z_SOLO) && !defined(_KERNEL) return Z_STREAM_ERROR; #else strm->zfree = zcfree; Modified: head/sys/contrib/zlib/zconf.h ============================================================================== --- head/sys/contrib/zlib/zconf.h Wed Aug 7 01:34:41 2019 (r350669) +++ head/sys/contrib/zlib/zconf.h Wed Aug 7 01:41:17 2019 (r350670) @@ -8,6 +8,12 @@ #ifndef ZCONF_H #define ZCONF_H +#ifdef __FreeBSD__ +#ifdef _KERNEL +#define Z_SOLO +#endif +#endif + /* * If you *really* need a unique prefix for all types and library functions, * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. @@ -30,7 +36,7 @@ # define adler32_combine z_adler32_combine # define adler32_combine64 z_adler32_combine64 # define adler32_z z_adler32_z -# ifndef Z_SOLO +# if !defined(Z_SOLO) && !defined(_KERNEL) # define compress z_compress # define compress2 z_compress2 # define compressBound z_compressBound @@ -125,12 +131,12 @@ # define inflate_copyright z_inflate_copyright # define inflate_fast z_inflate_fast # define inflate_table z_inflate_table -# ifndef Z_SOLO +# if !defined(Z_SOLO) && !defined(_KERNEL) # define uncompress z_uncompress # define uncompress2 z_uncompress2 # endif # define zError z_zError -# ifndef Z_SOLO +# if !defined(Z_SOLO) && !defined(_KERNEL) # define zcalloc z_zcalloc # define zcfree z_zcfree # endif Modified: head/sys/contrib/zlib/zlib.h ============================================================================== --- head/sys/contrib/zlib/zlib.h Wed Aug 7 01:34:41 2019 (r350669) +++ head/sys/contrib/zlib/zlib.h Wed Aug 7 01:41:17 2019 (r350670) @@ -1213,7 +1213,7 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); 27-31: 0 (reserved) */ -#ifndef Z_SOLO +#if !defined(Z_SOLO) || defined(_KERNEL) /* utility functions */ @@ -1288,6 +1288,9 @@ ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLo length of the source is *sourceLen. On return, *sourceLen is the number of source bytes consumed. */ +#endif /* !Z_SOLO || _KERNEL */ + +#ifndef Z_SOLO /* gzip file access functions */ Modified: head/sys/contrib/zlib/zutil.h ============================================================================== --- head/sys/contrib/zlib/zutil.h Wed Aug 7 01:34:41 2019 (r350669) +++ head/sys/contrib/zlib/zutil.h Wed Aug 7 01:41:17 2019 (r350670) @@ -256,7 +256,7 @@ extern z_const char * const z_errmsg[10]; /* indexed b # define Tracecv(c,x) #endif -#ifndef Z_SOLO +#if !defined(Z_SOLO) || defined(_KERNEL) voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, unsigned size)); void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); Modified: head/sys/dev/zlib/zcalloc.c ============================================================================== --- head/sys/dev/zlib/zcalloc.c Wed Aug 7 01:34:41 2019 (r350669) +++ head/sys/dev/zlib/zcalloc.c Wed Aug 7 01:41:17 2019 (r350670) @@ -24,6 +24,13 @@ zcalloc_nowait(void *nil, u_int items, u_int size) return mallocarray(items, size, M_ZLIB, M_NOWAIT); } +void * +zcalloc(void *nil, u_int items, u_int size) +{ + + return zcalloc_nowait(nil, items, size); +} + void zcfree(void *nil, void *ptr) { Modified: head/sys/dev/zlib/zcalloc.h ============================================================================== --- head/sys/dev/zlib/zcalloc.h Wed Aug 7 01:34:41 2019 (r350669) +++ head/sys/dev/zlib/zcalloc.h Wed Aug 7 01:41:17 2019 (r350670) @@ -6,8 +6,9 @@ #ifndef _DEV_ZLIB_ZCALLOC_ #define _DEV_ZLIB_ZCALLOC_ -void * zcalloc_waitok(void *nil, u_int items, u_int size); -void * zcalloc_nowait(void *nil, u_int items, u_int size); -void zcfree(void *nil, void *ptr); +#include +#undef local +void *zcalloc_waitok(void *, u_int, u_int); +void *zcalloc_nowait(void *, u_int, u_int); #endif Modified: head/sys/modules/crypto/Makefile ============================================================================== --- head/sys/modules/crypto/Makefile Wed Aug 7 01:34:41 2019 (r350669) +++ head/sys/modules/crypto/Makefile Wed Aug 7 01:41:17 2019 (r350670) @@ -23,7 +23,6 @@ KMOD = crypto SRCS = crypto.c cryptodev_if.c SRCS += criov.c cryptosoft.c xform.c SRCS += cast.c cryptodeflate.c rmd160.c rijndael-alg-fst.c rijndael-api.c rijndael-api-fst.c -CFLAGS.cryptodeflate.c += ${ZLIB_CFLAGS} SRCS += skipjack.c bf_enc.c bf_ecb.c bf_skey.c SRCS += camellia.c camellia-api.c SRCS += des_ecb.c des_enc.c des_setkey.c Modified: head/sys/modules/mxge/mxge/Makefile ============================================================================== --- head/sys/modules/mxge/mxge/Makefile Wed Aug 7 01:34:41 2019 (r350669) +++ head/sys/modules/mxge/mxge/Makefile Wed Aug 7 01:41:17 2019 (r350670) @@ -5,6 +5,4 @@ KMOD= if_mxge SRCS= if_mxge.c device_if.h bus_if.h pci_if.h opt_inet.h opt_inet6.h -CFLAGS.if_mxge.c+= ${ZLIB_CFLAGS} - .include Modified: head/sys/modules/zfs/Makefile ============================================================================== --- head/sys/modules/zfs/Makefile Wed Aug 7 01:34:41 2019 (r350669) +++ head/sys/modules/zfs/Makefile Wed Aug 7 01:41:17 2019 (r350670) @@ -56,7 +56,6 @@ SRCS+= nvpair_alloc_system.c .PATH: ${SUNW}/uts/common/zmod SRCS+= zmod.c -CFLAGS.zmod.c+= ${ZLIB_CFLAGS} .PATH: ${SYSDIR}/crypto/sha2 SRCS+= sha256c.c sha512c.c Modified: head/sys/modules/zlib/Makefile ============================================================================== --- head/sys/modules/zlib/Makefile Wed Aug 7 01:34:41 2019 (r350669) +++ head/sys/modules/zlib/Makefile Wed Aug 7 01:41:17 2019 (r350670) @@ -11,15 +11,15 @@ SRCS= zlib.c SRCS+= zcalloc.c SRCS+= zlib_mod.c SRCS+= adler32.c +SRCS+= compress.c SRCS+= crc32.c SRCS+= deflate.c SRCS+= inffast.c SRCS+= inflate.c SRCS+= inftrees.c SRCS+= trees.c +SRCS+= uncompr.c SRCS+= zutil.c - -CFLAGS+=${ZLIB_CFLAGS} CWARNFLAGS.compress.c+=-Wno-cast-qual # compress:49 CWARNFLAGS.deflate.c+=-Wno-cast-qual # deflate.c:415 From owner-svn-src-head@freebsd.org Wed Aug 7 03:14:45 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED39EBC2A5; Wed, 7 Aug 2019 03:14:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463Gnx5zD9z481t; Wed, 7 Aug 2019 03:14:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE9D963F2; Wed, 7 Aug 2019 03:14:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x773EjiQ003886; Wed, 7 Aug 2019 03:14:45 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x773Ejkw003885; Wed, 7 Aug 2019 03:14:45 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908070314.x773Ejkw003885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 7 Aug 2019 03:14:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350671 - head/contrib/elftoolchain/readelf X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/contrib/elftoolchain/readelf X-SVN-Commit-Revision: 350671 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 03:14:46 -0000 Author: markj Date: Wed Aug 7 03:14:45 2019 New Revision: 350671 URL: https://svnweb.freebsd.org/changeset/base/350671 Log: readelf: Close input files when done with them. The low fd limit used by poudriere exposed an odd failure mode in cap_fileargs (used by readelf as of r350516). In particular, when the limit was hit, both the main process and casper service would block on their shared socket, waiting forever for the other to send a message. Reported by: zeising MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/contrib/elftoolchain/readelf/readelf.c Modified: head/contrib/elftoolchain/readelf/readelf.c ============================================================================== --- head/contrib/elftoolchain/readelf/readelf.c Wed Aug 7 01:41:17 2019 (r350670) +++ head/contrib/elftoolchain/readelf/readelf.c Wed Aug 7 03:14:45 2019 (r350671) @@ -7732,10 +7732,12 @@ main(int argc, char **argv) for (i = 0; i < argc; i++) { re->filename = argv[i]; fd = fileargs_open(fa, re->filename); - if (fd < 0) + if (fd < 0) { warn("open %s failed", re->filename); - else + } else { dump_object(re, fd); + close(fd); + } } exit(EXIT_SUCCESS); From owner-svn-src-head@freebsd.org Wed Aug 7 05:34:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 994DDBF520; Wed, 7 Aug 2019 05:34:10 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 463Ktn2yhCz4GBG; Wed, 7 Aug 2019 05:34:08 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (v-critter.freebsd.dk [192.168.55.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by phk.freebsd.dk (Postfix) with ESMTPS id BC8561AF112; Wed, 7 Aug 2019 05:34:00 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id x775Y0DP063283 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 7 Aug 2019 05:34:00 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id x775Y0SF063282; Wed, 7 Aug 2019 05:34:00 GMT (envelope-from phk) To: Glen Barber cc: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, freebsd-hackers@freebsd.org, freebsd-arch@freebsd.org Subject: Re: svn commit: r350550 - head/share/mk In-reply-to: <20190806165614.GA41295@FreeBSD.org> From: "Poul-Henning Kamp" References: <201908030106.x7316Ibx078529@repo.freebsd.org> <20190806165614.GA41295@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <63280.1565156040.1@critter.freebsd.dk> Date: Wed, 07 Aug 2019 05:34:00 +0000 Message-ID: <63281.1565156040@critter.freebsd.dk> X-Rspamd-Queue-Id: 463Ktn2yhCz4GBG X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of phk@critter.freebsd.dk designates 130.225.244.222 as permitted sender) smtp.mailfrom=phk@critter.freebsd.dk X-Spamd-Result: default: False [-0.66 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.76)[-0.757,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.dk]; NEURAL_HAM_LONG(-0.85)[-0.852,0]; NEURAL_SPAM_SHORT(0.90)[0.903,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(0.05)[ip: (0.09), ipnet: 130.225.0.0/16(0.04), asn: 1835(0.12), country: EU(-0.00)]; RCPT_COUNT_SEVEN(0.00)[7]; FORGED_SENDER(0.30)[phk@phk.freebsd.dk,phk@critter.freebsd.dk]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:1835, ipnet:130.225.0.0/16, country:EU]; FROM_NEQ_ENVFROM(0.00)[phk@phk.freebsd.dk,phk@critter.freebsd.dk]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 05:34:10 -0000 -------- In message <20190806165614.GA41295@FreeBSD.org>, Glen Barber writes: >In my opinion, those that want the non-reproducible metadata included in >output from 'uname -a' should set WITHOUT_REPRODUCIBLE_BUILDS in their >src.conf. Turning off a sane default for the benefit of what I suspect >is likely a short list of use cases feels like a step in the wrong >direction. Seconded. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-svn-src-head@freebsd.org Wed Aug 7 13:11:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5AA8DAADF6; Wed, 7 Aug 2019 13:11:54 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463X2y1jlmz3DZB; Wed, 7 Aug 2019 13:11:54 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B296D23A; Wed, 7 Aug 2019 13:11:54 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77DBrT7057080; Wed, 7 Aug 2019 13:11:53 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77DBr8s057079; Wed, 7 Aug 2019 13:11:53 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201908071311.x77DBr8s057079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 7 Aug 2019 13:11:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350673 - head/sys/gnu/dts/arm X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/gnu/dts/arm X-SVN-Commit-Revision: 350673 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 13:11:54 -0000 Author: manu Date: Wed Aug 7 13:11:53 2019 New Revision: 350673 URL: https://svnweb.freebsd.org/changeset/base/350673 Log: arm: dts: am33xx: Fix the region for uart0 The region for uart0 is declared to be 0x2000 in size but the parent node only declare 0x1000. As the parent only declare a size of 0x1000 in the ranges for it's children this cause the device to not be mappable. https://patchwork.kernel.org/patch/11056769/ Modified: head/sys/gnu/dts/arm/am33xx-l4.dtsi Modified: head/sys/gnu/dts/arm/am33xx-l4.dtsi ============================================================================== --- head/sys/gnu/dts/arm/am33xx-l4.dtsi Wed Aug 7 04:08:50 2019 (r350672) +++ head/sys/gnu/dts/arm/am33xx-l4.dtsi Wed Aug 7 13:11:53 2019 (r350673) @@ -185,7 +185,7 @@ uart0: serial@0 { compatible = "ti,am3352-uart", "ti,omap3-uart"; clock-frequency = <48000000>; - reg = <0x0 0x2000>; + reg = <0x0 0x1000>; interrupts = <72>; status = "disabled"; dmas = <&edma 26 0>, <&edma 27 0>; From owner-svn-src-head@freebsd.org Wed Aug 7 13:13:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 907D9AB048; Wed, 7 Aug 2019 13:13:17 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463X4Y36P2z3DlK; Wed, 7 Aug 2019 13:13:17 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C939D27E; Wed, 7 Aug 2019 13:13:17 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77DDHVd057890; Wed, 7 Aug 2019 13:13:17 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77DDHXu057889; Wed, 7 Aug 2019 13:13:17 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201908071313.x77DDHXu057889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 7 Aug 2019 13:13:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350674 - head/sys/dev/ofw X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/ofw X-SVN-Commit-Revision: 350674 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 13:13:17 -0000 Author: manu Date: Wed Aug 7 13:13:16 2019 New Revision: 350674 URL: https://svnweb.freebsd.org/changeset/base/350674 Log: ofw: ofw_reg_to_paddr: Use a 256 static array for the cell Some hardware needs more than 32, bump this value. We cannot use the _alloc for of getencprop as this function is called too early in the boot before pmap is initialized and we only have 2k of stack when cninit is called. Discussed with: ian Modified: head/sys/dev/ofw/ofw_subr.c Modified: head/sys/dev/ofw/ofw_subr.c ============================================================================== --- head/sys/dev/ofw/ofw_subr.c Wed Aug 7 13:11:53 2019 (r350673) +++ head/sys/dev/ofw/ofw_subr.c Wed Aug 7 13:13:16 2019 (r350674) @@ -79,7 +79,8 @@ int ofw_reg_to_paddr(phandle_t dev, int regno, bus_addr_t *paddr, bus_size_t *psize, pcell_t *ppci_hi) { - pcell_t cell[32], pci_hi; + static pcell_t cell[256]; + pcell_t pci_hi; uint64_t addr, raddr, baddr; uint64_t size, rsize; uint32_t c, nbridge, naddr, nsize; From owner-svn-src-head@freebsd.org Wed Aug 7 13:35:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8977AB65F; Wed, 7 Aug 2019 13:35:13 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463XYs4VSrz3FkQ; Wed, 7 Aug 2019 13:35:13 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D230D63D; Wed, 7 Aug 2019 13:35:13 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77DZDMn069549; Wed, 7 Aug 2019 13:35:13 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77DZDjh069548; Wed, 7 Aug 2019 13:35:13 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201908071335.x77DZDjh069548@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 7 Aug 2019 13:35:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350675 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 350675 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 13:35:13 -0000 Author: hselasky Date: Wed Aug 7 13:35:13 2019 New Revision: 350675 URL: https://svnweb.freebsd.org/changeset/base/350675 Log: Correct PCI device ID for XHCI USB controller. Submitted by: Dmitry Luhtionov MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/usb/controller/xhci_pci.c Modified: head/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/xhci_pci.c Wed Aug 7 13:13:16 2019 (r350674) +++ head/sys/dev/usb/controller/xhci_pci.c Wed Aug 7 13:35:13 2019 (r350675) @@ -149,7 +149,7 @@ xhci_pci_match(device_t self) return ("Intel Lewisburg USB 3.0 controller"); case 0xa2af8086: return ("Intel Union Point USB 3.0 controller"); - case 0x36d88086: + case 0xa36d8086: return ("Intel Cannon Lake USB 3.1 controller"); case 0xa01b177d: From owner-svn-src-head@freebsd.org Wed Aug 7 14:45:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6754AACAF0; Wed, 7 Aug 2019 14:45:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463Z6c2psVz3JTd; Wed, 7 Aug 2019 14:45:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 436F4E2DC; Wed, 7 Aug 2019 14:45:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77EjCpx010370; Wed, 7 Aug 2019 14:45:12 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77EjB95010365; Wed, 7 Aug 2019 14:45:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908071445.x77EjB95010365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 7 Aug 2019 14:45:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350676 - in head: sbin/camcontrol sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head: sbin/camcontrol sys/cam/scsi X-SVN-Commit-Revision: 350676 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 14:45:12 -0000 Author: mav Date: Wed Aug 7 14:45:10 2019 New Revision: 350676 URL: https://svnweb.freebsd.org/changeset/base/350676 Log: Make `camcontrol modepage` support block descriptors. It allows to read and write block descriptors alike to mode page parameters. It allows to change block size or short-stroke HDDs or overprovision SSDs. Depenting on -P parameter the change can be either persistent or till reset. In case of block size change device may need reformat after the setting. In case of SSD overprovisioning format or sanitize may be needed to really free the flash. During implementation appeared that csio_encode_visit() can not handle integers of more then 4 bytes, that makes 8-byte LBA handling awkward. I had to split it into two 4-byte halves now. MFC after: 1 week Relnotes: yes Sponsored by: iXsystems, Inc. Modified: head/sbin/camcontrol/camcontrol.8 head/sbin/camcontrol/camcontrol.c head/sbin/camcontrol/camcontrol.h head/sbin/camcontrol/modeedit.c head/sys/cam/scsi/scsi_all.c head/sys/cam/scsi/scsi_all.h Modified: head/sbin/camcontrol/camcontrol.8 ============================================================================== --- head/sbin/camcontrol/camcontrol.8 Wed Aug 7 13:35:13 2019 (r350675) +++ head/sbin/camcontrol/camcontrol.8 Wed Aug 7 14:45:10 2019 (r350676) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 30, 2019 +.Dd August 6, 2019 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -125,6 +125,8 @@ .Op Fl 6 .Aq Fl m Ar page[,subpage] | Fl l .Op Fl P Ar pgctl +.Op Fl D +.Op Fl L .Op Fl b | Fl e .Op Fl d .Nm @@ -733,6 +735,11 @@ If not specified, starts with 10 byte commands and falls back to 6 byte on error. .It Fl d Disable block descriptors for mode sense. +.It Fl D +Display/edit block descriptors instead of mode page. +.It Fl L +Use long LBA block descriptors. +Allows number of LBAs bigger then 2^^32. .It Fl b Displays mode page data in binary format. .It Fl e Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Wed Aug 7 13:35:13 2019 (r350675) +++ head/sbin/camcontrol/camcontrol.c Wed Aug 7 14:45:10 2019 (r350676) @@ -221,7 +221,7 @@ static struct camcontrol_opts option_table[] = { {"devlist", CAM_CMD_DEVTREE, CAM_ARG_NONE, "-b"}, {"devtype", CAM_CMD_DEVTYPE, CAM_ARG_NONE, ""}, {"periphlist", CAM_CMD_DEVLIST, CAM_ARG_NONE, NULL}, - {"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "6bdelm:P:"}, + {"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "6bdelm:DLP:"}, {"tags", CAM_CMD_TAG, CAM_ARG_NONE, "N:q"}, {"negotiate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts}, {"rate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts}, @@ -4586,9 +4586,9 @@ reassignblocks(struct cam_device *device, u_int32_t *b #endif void -mode_sense(struct cam_device *device, int *cdb_len, int dbd, int pc, int page, - int subpage, int task_attr, int retry_count, int timeout, u_int8_t *data, - int datalen) +mode_sense(struct cam_device *device, int *cdb_len, int dbd, int llbaa, int pc, + int page, int subpage, int task_attr, int retry_count, int timeout, + u_int8_t *data, int datalen) { union ccb *ccb; int error_code, sense_key, asc, ascq; @@ -4620,6 +4620,11 @@ retry: /* minimum_cmd_size */ *cdb_len, /* sense_len */ SSD_FULL_SIZE, /* timeout */ timeout ? timeout : 5000); + if (llbaa && ccb->csio.cdb_len == 10) { + struct scsi_mode_sense_10 *cdb = + (struct scsi_mode_sense_10 *)ccb->csio.cdb_io.cdb_bytes; + cdb->byte2 |= SMS10_LLBAA; + } /* Record what CDB size the above function really set. */ *cdb_len = ccb->csio.cdb_len; @@ -4711,8 +4716,8 @@ modepage(struct cam_device *device, int argc, char **a int task_attr, int retry_count, int timeout) { char *str_subpage; - int c, page = -1, subpage = -1, pc = 0; - int binary = 0, cdb_len = 10, dbd = 0, edit = 0, list = 0; + int c, page = -1, subpage = -1, pc = 0, llbaa = 0; + int binary = 0, cdb_len = 10, dbd = 0, desc = 0, edit = 0, list = 0; while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c) { @@ -4744,6 +4749,12 @@ modepage(struct cam_device *device, int argc, char **a if (subpage < 0) errx(1, "invalid mode subpage %d", subpage); break; + case 'D': + desc = 1; + break; + case 'L': + llbaa = 1; + break; case 'P': pc = strtol(optarg, NULL, 0); if ((pc < 0) || (pc > 3)) @@ -4754,15 +4765,21 @@ modepage(struct cam_device *device, int argc, char **a } } - if (page == -1 && list == 0) + if (page == -1 && desc == 0 && list == 0) errx(1, "you must specify a mode page!"); + if (dbd && desc) + errx(1, "-d and -D are incompatible!"); + + if (llbaa && cdb_len != 10) + errx(1, "LLBAA bit is not present in MODE SENSE(6)!"); + if (list != 0) { mode_list(device, cdb_len, dbd, pc, list > 1, task_attr, retry_count, timeout); } else { - mode_edit(device, cdb_len, dbd, pc, page, subpage, edit, - binary, task_attr, retry_count, timeout); + mode_edit(device, cdb_len, desc, dbd, llbaa, pc, page, subpage, + edit, binary, task_attr, retry_count, timeout); } } Modified: head/sbin/camcontrol/camcontrol.h ============================================================================== --- head/sbin/camcontrol/camcontrol.h Wed Aug 7 13:35:13 2019 (r350675) +++ head/sbin/camcontrol/camcontrol.h Wed Aug 7 14:45:10 2019 (r350676) @@ -88,15 +88,15 @@ int epc(struct cam_device *device, int argc, char **ar int timestamp(struct cam_device *device, int argc, char **argv, char *combinedopt, int task_attr, int retry_count, int timeout, int verbosemode); -void mode_sense(struct cam_device *device, int *cdb_len, int dbd, int pc, - int page, int subpage, int task_attr, int retry_count, +void mode_sense(struct cam_device *device, int *cdb_len, int dbd, int llbaa, + int pc, int page, int subpage, int task_attr, int retry_count, int timeout, uint8_t *data, int datalen); void mode_select(struct cam_device *device, int cdb_len, int save_pages, int task_attr, int retry_count, int timeout, u_int8_t *data, int datalen); -void mode_edit(struct cam_device *device, int cdb_len, int dbd, int pc, - int page, int subpage, int edit, int binary, int task_attr, - int retry_count, int timeout); +void mode_edit(struct cam_device *device, int cdb_len, int desc, int dbd, + int llbaa, int pc, int page, int subpage, int edit, int binary, + int task_attr, int retry_count, int timeout); void mode_list(struct cam_device *device, int cdb_len, int dbd, int pc, int subpages, int task_attr, int retry_count, int timeout); int scsidoinquiry(struct cam_device *device, int argc, char **argv, Modified: head/sbin/camcontrol/modeedit.c ============================================================================== --- head/sbin/camcontrol/modeedit.c Wed Aug 7 13:35:13 2019 (r350675) +++ head/sbin/camcontrol/modeedit.c Wed Aug 7 14:45:10 2019 (r350676) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -96,6 +97,8 @@ static void editentry_create(void *hook, int letter, int count, char *name); static void editentry_update(void *hook, int letter, void *arg, int count, char *name); +static void editentry_create_desc(void *hook, int letter, void *arg, + int count, char *name); static int editentry_save(void *hook, char *name); static struct editentry *editentry_lookup(char *name); static int editentry_set(char *name, char *newvalue, @@ -103,9 +106,16 @@ static int editentry_set(char *name, char *newvalue, static void editlist_populate(struct cam_device *device, int cdb_len, int dbd, int pc, int page, int subpage, int task_attr, int retries, int timeout); +static void editlist_populate_desc(struct cam_device *device, + int cdb_len, int llbaa, int pc, int page, + int subpage, int task_attr, int retries, + int timeout); static void editlist_save(struct cam_device *device, int cdb_len, int dbd, int pc, int page, int subpage, int task_attr, int retries, int timeout); +static void editlist_save_desc(struct cam_device *device, int cdb_len, + int llbaa, int pc, int page, int subpage, + int task_attr, int retries, int timeout); static void nameentry_create(int page, int subpage, char *name); static struct pagename *nameentry_lookup(int page, int subpage); static int load_format(const char *pagedb_path, int lpage, @@ -116,6 +126,10 @@ static void modepage_edit(void); static void modepage_dump(struct cam_device *device, int cdb_len, int dbd, int pc, int page, int subpage, int task_attr, int retries, int timeout); +static void modepage_dump_desc(struct cam_device *device, + int cdb_len, int llbaa, int pc, int page, + int subpage, int task_attr, int retries, + int timeout); static void cleanup_editfile(void); @@ -182,6 +196,43 @@ editentry_update(void *hook __unused, int letter, void } } +static void +editentry_create_desc(void *hook __unused, int letter, void *arg, int count, + char *name) +{ + struct editentry *newentry; /* Buffer to hold new entry. */ + + /* Allocate memory for the new entry and a copy of the entry name. */ + if ((newentry = malloc(sizeof(struct editentry))) == NULL || + (newentry->name = strdup(name)) == NULL) + err(EX_OSERR, NULL); + + /* Trim any trailing whitespace for the entry name. */ + RTRIM(newentry->name); + + newentry->editable = 1; + newentry->type = letter; + newentry->size = count; + newentry->value.svalue = NULL; + + STAILQ_INSERT_TAIL(&editlist, newentry, link); + + switch (letter) { + case 'i': /* Byte-sized integral type. */ + case 'b': /* Bit-sized integral types. */ + case 't': + newentry->value.ivalue = (intptr_t)arg; + break; + + case 'c': /* Character array. */ + case 'z': /* Null-padded string. */ + editentry_set(name, (char *)arg, 0); + break; + default: + ; /* NOTREACHED */ + } +} + static int editentry_save(void *hook __unused, char *name) { @@ -238,7 +289,7 @@ editentry_set(char *name, char *newvalue, int editonly struct editentry *dest; /* Modepage entry to update. */ char *cval; /* Pointer to new string value. */ char *convertend; /* End-of-conversion pointer. */ - int ival; /* New integral value. */ + long long ival, newival; /* New integral value. */ int resolution; /* Resolution in bits for integer conversion. */ /* @@ -248,7 +299,7 @@ editentry_set(char *name, char *newvalue, int editonly * currently workaround it (even for int64's), so we have to kludge it. */ #define RESOLUTION_MAX(size) ((resolution * (size) == 32)? \ - INT_MAX: (1 << (resolution * (size))) - 1) + UINT_MAX: (1 << (resolution * (size))) - 1) assert(newvalue != NULL); if (*newvalue == '\0') @@ -265,13 +316,13 @@ editentry_set(char *name, char *newvalue, int editonly case 't': /* Convert the value string to an integer. */ resolution = (dest->type == 'i')? 8: 1; - ival = (int)strtol(newvalue, &convertend, 0); + ival = strtoll(newvalue, &convertend, 0); if (*convertend != '\0') returnerr(EINVAL); if (ival > RESOLUTION_MAX(dest->size) || ival < 0) { - int newival = (ival < 0)? 0: RESOLUTION_MAX(dest->size); - warnx("value %d is out of range for entry %s; clipping " - "to %d", ival, name, newival); + newival = (ival < 0) ? 0 : RESOLUTION_MAX(dest->size); + warnx("value %lld is out of range for entry %s; " + "clipping to %lld", ival, name, newival); ival = newival; } if (dest->value.ivalue != ival) @@ -548,7 +599,7 @@ static void editlist_populate(struct cam_device *device, int cdb_len, int dbd, int pc, int page, int subpage, int task_attr, int retries, int timeout) { - u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ + u_int8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ u_int8_t *mode_pars; /* Pointer to modepage params. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; @@ -557,8 +608,8 @@ editlist_populate(struct cam_device *device, int cdb_l STAILQ_INIT(&editlist); /* Fetch changeable values; use to build initial editlist. */ - mode_sense(device, &cdb_len, dbd, 1, page, subpage, task_attr, retries, - timeout, data, sizeof(data)); + mode_sense(device, &cdb_len, dbd, 0, 1, page, subpage, task_attr, + retries, timeout, data, sizeof(data)); if (cdb_len == 6) { struct scsi_mode_header_6 *mh = @@ -583,16 +634,77 @@ editlist_populate(struct cam_device *device, int cdb_l buff_decode_visit(mode_pars, len, format, editentry_create, 0); /* Fetch the current/saved values; use to set editentry values. */ - mode_sense(device, &cdb_len, dbd, pc, page, subpage, task_attr, + mode_sense(device, &cdb_len, dbd, 0, pc, page, subpage, task_attr, retries, timeout, data, sizeof(data)); buff_decode_visit(mode_pars, len, format, editentry_update, 0); } static void +editlist_populate_desc(struct cam_device *device, int cdb_len, int llbaa, int pc, + int page, int subpage, int task_attr, int retries, int timeout) +{ + uint8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ + uint8_t *desc; /* Pointer to block descriptor. */ + char num[8]; + struct sbuf sb; + size_t len; + u_int longlba, dlen, i; + + STAILQ_INIT(&editlist); + + /* Fetch the current/saved values. */ + mode_sense(device, &cdb_len, 0, llbaa, pc, page, subpage, task_attr, + retries, timeout, data, sizeof(data)); + + if (cdb_len == 6) { + struct scsi_mode_header_6 *mh = + (struct scsi_mode_header_6 *)data; + desc = (uint8_t *)(mh + 1); + len = mh->blk_desc_len; + longlba = 0; + } else { + struct scsi_mode_header_10 *mh = + (struct scsi_mode_header_10 *)data; + desc = (uint8_t *)(mh + 1); + len = scsi_2btoul(mh->blk_desc_len); + longlba = (mh->flags & SMH_LONGLBA) != 0; + } + dlen = longlba ? 16 : 8; + len = MIN(len, sizeof(data) - (desc - data)); + + sbuf_new(&sb, format, sizeof(format), SBUF_FIXEDLEN); + num[0] = 0; + for (i = 0; i * dlen < len; i++) { + if (i > 0) + snprintf(num, sizeof(num), " %d", i + 1); + if (longlba) { + sbuf_printf(&sb, "{Number of Logical Blocks%s High} i4\n", num); + sbuf_printf(&sb, "{Number of Logical Blocks%s} i4\n", num); + sbuf_cat(&sb, "{Reserved} *i4\n"); + sbuf_printf(&sb, "{Logical Block Length%s} i4\n", num); + } else if (device->pd_type == T_DIRECT) { + sbuf_printf(&sb, "{Number of Logical Blocks%s} i4\n", num); + sbuf_cat(&sb, "{Reserved} *i1\n"); + sbuf_printf(&sb, "{Logical Block Length%s} i3\n", num); + } else { + sbuf_printf(&sb, "{Density Code%s} i1\n", num); + sbuf_printf(&sb, "{Number of Logical Blocks%s} i3\n", num); + sbuf_cat(&sb, "{Reserved} *i1\n"); + sbuf_printf(&sb, "{Logical Block Length%s} i3\n", num); + } + } + sbuf_finish(&sb); + sbuf_delete(&sb); + + /* Decode the value data, creating edit_entries for each value. */ + buff_decode_visit(desc, len, format, editentry_create_desc, 0); +} + +static void editlist_save(struct cam_device *device, int cdb_len, int dbd, int pc, int page, int subpage, int task_attr, int retries, int timeout) { - u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ + u_int8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ u_int8_t *mode_pars; /* Pointer to modepage params. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; @@ -603,7 +715,7 @@ editlist_save(struct cam_device *device, int cdb_len, return; /* Preload the CDB buffer with the current mode page data. */ - mode_sense(device, &cdb_len, dbd, pc, page, subpage, task_attr, + mode_sense(device, &cdb_len, dbd, 0, pc, page, subpage, task_attr, retries, timeout, data, sizeof(data)); /* Initial headers & offsets. */ @@ -676,6 +788,56 @@ editlist_save(struct cam_device *device, int cdb_len, task_attr, retries, timeout, data, hlen + mphlen + len); } +static void +editlist_save_desc(struct cam_device *device, int cdb_len, int llbaa, int pc, + int page, int subpage, int task_attr, int retries, int timeout) +{ + uint8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ + uint8_t *desc; /* Pointer to block descriptor. */ + size_t len, hlen; + + /* Make sure that something changed before continuing. */ + if (! editlist_changed) + return; + + /* Preload the CDB buffer with the current mode page data. */ + mode_sense(device, &cdb_len, 0, llbaa, pc, page, subpage, task_attr, + retries, timeout, data, sizeof(data)); + + /* Initial headers & offsets. */ + if (cdb_len == 6) { + struct scsi_mode_header_6 *mh = + (struct scsi_mode_header_6 *)data; + hlen = sizeof(*mh); + desc = (uint8_t *)(mh + 1); + len = mh->blk_desc_len; + mh->data_length = 0; /* Reserved for MODE SELECT command. */ + if (device->pd_type != T_SEQUENTIAL) + mh->dev_spec = 0; /* See comment above */ + } else { + struct scsi_mode_header_10 *mh = + (struct scsi_mode_header_10 *)data; + hlen = sizeof(*mh); + desc = (uint8_t *)(mh + 1); + len = scsi_2btoul(mh->blk_desc_len); + scsi_ulto2b(0, mh->data_length); /* Reserved for MODE SELECT. */ + if (device->pd_type != T_SEQUENTIAL) + mh->dev_spec = 0; /* See comment above */ + } + len = MIN(len, sizeof(data) - (desc - data)); + + /* Encode the value data to be passed back to the device. */ + buff_encode_visit(desc, len, format, editentry_save, 0); + + /* + * Write the changes back to the device. If the user editted control + * page 3 (saved values) then request the changes be permanently + * recorded. + */ + mode_select(device, cdb_len, (pc << PAGE_CTRL_SHIFT == SMS_PAGE_CTRL_SAVED), + task_attr, retries, timeout, data, hlen + len); +} + static int modepage_write(FILE *file, int editonly) { @@ -689,7 +851,7 @@ modepage_write(FILE *file, int editonly) fprintf(file, "%s: %s\n", scan->name, scan->value.svalue); } else { - fprintf(file, "%s: %d\n", scan->name, + fprintf(file, "%s: %u\n", scan->name, scan->value.ivalue); } } @@ -845,13 +1007,13 @@ static void modepage_dump(struct cam_device *device, int cdb_len, int dbd, int pc, int page, int subpage, int task_attr, int retries, int timeout) { - u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ + u_int8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ u_int8_t *mode_pars; /* Pointer to modepage params. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; size_t indx, len; - mode_sense(device, &cdb_len, dbd, pc, page, subpage, task_attr, + mode_sense(device, &cdb_len, dbd, 0, pc, page, subpage, task_attr, retries, timeout, data, sizeof(data)); if (cdb_len == 6) { @@ -880,7 +1042,38 @@ modepage_dump(struct cam_device *device, int cdb_len, } putchar('\n'); } +static void +modepage_dump_desc(struct cam_device *device, int cdb_len, int llbaa, int pc, + int page, int subpage, int task_attr, int retries, int timeout) +{ + uint8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ + uint8_t *desc; /* Pointer to block descriptor. */ + size_t indx, len; + mode_sense(device, &cdb_len, 0, llbaa, pc, page, subpage, task_attr, + retries, timeout, data, sizeof(data)); + + if (cdb_len == 6) { + struct scsi_mode_header_6 *mh = + (struct scsi_mode_header_6 *)data; + desc = (uint8_t *)(mh + 1); + len = mh->blk_desc_len; + } else { + struct scsi_mode_header_10 *mh = + (struct scsi_mode_header_10 *)data; + desc = (uint8_t *)(mh + 1); + len = scsi_2btoul(mh->blk_desc_len); + } + len = MIN(len, sizeof(data) - (desc - data)); + + /* Print the raw mode page data with newlines each 8 bytes. */ + for (indx = 0; indx < len; indx++) { + printf("%02x%c", desc[indx], + (((indx + 1) % 8) == 0) ? '\n' : ' '); + } + putchar('\n'); +} + static void cleanup_editfile(void) { @@ -892,16 +1085,19 @@ cleanup_editfile(void) } void -mode_edit(struct cam_device *device, int cdb_len, int dbd, int pc, int page, - int subpage, int edit, int binary, int task_attr, int retry_count, - int timeout) +mode_edit(struct cam_device *device, int cdb_len, int desc, int dbd, int llbaa, + int pc, int page, int subpage, int edit, int binary, int task_attr, + int retry_count, int timeout) { const char *pagedb_path; /* Path to modepage database. */ - if (edit && binary) - errx(EX_USAGE, "cannot edit in binary mode."); - - if (! binary) { + if (binary) { + if (edit) + errx(EX_USAGE, "cannot edit in binary mode."); + } else if (desc) { + editlist_populate_desc(device, cdb_len, llbaa, pc, page, + subpage, task_attr, retry_count, timeout); + } else { if ((pagedb_path = getenv("SCSI_MODES")) == NULL) pagedb_path = DEFAULT_SCSI_MODE_DB; @@ -935,12 +1131,22 @@ mode_edit(struct cam_device *device, int cdb_len, int errx(EX_USAGE, "it only makes sense to edit page 0 " "(current) or page 3 (saved values)"); modepage_edit(); - editlist_save(device, cdb_len, dbd, pc, page, subpage, - task_attr, retry_count, timeout); + if (desc) { + editlist_save_desc(device, cdb_len, llbaa, pc, page, + subpage, task_attr, retry_count, timeout); + } else { + editlist_save(device, cdb_len, dbd, pc, page, subpage, + task_attr, retry_count, timeout); + } } else if (binary || STAILQ_EMPTY(&editlist)) { /* Display without formatting information. */ - modepage_dump(device, cdb_len, dbd, pc, page, subpage, - task_attr, retry_count, timeout); + if (desc) { + modepage_dump_desc(device, cdb_len, llbaa, pc, page, + subpage, task_attr, retry_count, timeout); + } else { + modepage_dump(device, cdb_len, dbd, pc, page, subpage, + task_attr, retry_count, timeout); + } } else { /* Display with format. */ modepage_write(stdout, 0); @@ -951,7 +1157,7 @@ void mode_list(struct cam_device *device, int cdb_len, int dbd, int pc, int subpages, int task_attr, int retry_count, int timeout) { - u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ + u_int8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; struct pagename *nameentry; @@ -967,7 +1173,7 @@ mode_list(struct cam_device *device, int cdb_len, int } /* Build the list of all mode pages by querying the "all pages" page. */ - mode_sense(device, &cdb_len, dbd, pc, SMS_ALL_PAGES_PAGE, + mode_sense(device, &cdb_len, dbd, 0, pc, SMS_ALL_PAGES_PAGE, subpages ? SMS_SUBPAGE_ALL : 0, task_attr, retry_count, timeout, data, sizeof(data)); Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Wed Aug 7 13:35:13 2019 (r350675) +++ head/sys/cam/scsi/scsi_all.c Wed Aug 7 14:45:10 2019 (r350676) @@ -2056,7 +2056,7 @@ static struct asc_table_entry asc_table[] = { { SST(0x30, 0x13, SS_RDEF, /* XXX TBD */ "Cleaning volume expired") }, /* DT WRO BK */ - { SST(0x31, 0x00, SS_RDEF, + { SST(0x31, 0x00, SS_FATAL | ENXIO, "Medium format corrupted") }, /* D L RO B */ { SST(0x31, 0x01, SS_RDEF, Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Wed Aug 7 13:35:13 2019 (r350675) +++ head/sys/cam/scsi/scsi_all.h Wed Aug 7 14:45:10 2019 (r350676) @@ -3622,7 +3622,9 @@ struct scsi_mode_header_10 u_int8_t data_length[2];/* Sense data length */ u_int8_t medium_type; u_int8_t dev_spec; - u_int8_t unused[2]; + u_int8_t flags; +#define SMH_LONGLBA 0x01 + u_int8_t unused; u_int8_t blk_desc_len[2]; }; From owner-svn-src-head@freebsd.org Wed Aug 7 15:05:09 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A4F97AD071; Wed, 7 Aug 2019 15:05:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463ZYd3tzSz3KLG; Wed, 7 Aug 2019 15:05:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 66F25E678; Wed, 7 Aug 2019 15:05:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77F59bN022031; Wed, 7 Aug 2019 15:05:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77F591h022030; Wed, 7 Aug 2019 15:05:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908071505.x77F591h022030@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 7 Aug 2019 15:05:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350677 - head/sbin/camcontrol X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sbin/camcontrol X-SVN-Commit-Revision: 350677 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 15:05:09 -0000 Author: mav Date: Wed Aug 7 15:05:08 2019 New Revision: 350677 URL: https://svnweb.freebsd.org/changeset/base/350677 Log: Make GCC happy about math in r350676. MFC after: 1 week Modified: head/sbin/camcontrol/modeedit.c Modified: head/sbin/camcontrol/modeedit.c ============================================================================== --- head/sbin/camcontrol/modeedit.c Wed Aug 7 14:45:10 2019 (r350676) +++ head/sbin/camcontrol/modeedit.c Wed Aug 7 15:05:08 2019 (r350677) @@ -295,11 +295,8 @@ editentry_set(char *name, char *newvalue, int editonly /* * Macro to determine the maximum value of the given size for the current * resolution. - * XXX Lovely x86's optimize out the case of shifting by 32 and gcc doesn't - * currently workaround it (even for int64's), so we have to kludge it. */ -#define RESOLUTION_MAX(size) ((resolution * (size) == 32)? \ - UINT_MAX: (1 << (resolution * (size))) - 1) +#define RESOLUTION_MAX(size) ((1LL << (resolution * (size))) - 1) assert(newvalue != NULL); if (*newvalue == '\0') From owner-svn-src-head@freebsd.org Wed Aug 7 15:49:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F1E7ADFA2; Wed, 7 Aug 2019 15:49:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463bXV2McTz3MFN; Wed, 7 Aug 2019 15:49:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from [192.168.0.5] (unknown [181.52.72.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: pfg) by smtp.freebsd.org (Postfix) with ESMTPSA id 90E571524B; Wed, 7 Aug 2019 15:49:13 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Subject: Re: svn commit: r350665 - in head: . etc/mtree sbin/mount_fusefs share/man/man5 sys/fs/fuse sys/sys tests/sys/fs tests/sys/fs/fusefs To: Alan Somers , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201908070038.x770cQZE007711@repo.freebsd.org> From: Pedro Giffuni Organization: FreeBSD Message-ID: <6c7f7b6f-c0e3-e99c-bd00-8c5a8f729c23@FreeBSD.org> Date: Wed, 7 Aug 2019 10:49:12 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <201908070038.x770cQZE007711@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 15:49:14 -0000 Awesome work. Thanks! On 06/08/2019 19:38, Alan Somers wrote: > Author: asomers > Date: Wed Aug 7 00:38:26 2019 > New Revision: 350665 > URL: https://svnweb.freebsd.org/changeset/base/350665 > > Log: > fusefs: merge from projects/fuse2 > > This commit imports the new fusefs driver. It raises the protocol level > from 7.8 to 7.23, fixes many bugs, adds a test suite for the driver, and > adds many new features. New features include: > > * Optional kernel-side permissions checks (-o default_permissions) > * Implement VOP_MKNOD, VOP_BMAP, and VOP_ADVLOCK > * Allow interrupting FUSE operations > * Support named pipes and unix-domain sockets in fusefs file systems > * Forward UTIME_NOW during utimensat(2) to the daemon > * kqueue support for /dev/fuse > * Allow updating mounts with "mount -u" > * Allow exporting fusefs file systems over NFS > * Server-initiated invalidation of the name cache or data cache > * Respect RLIMIT_FSIZE > * Try to support servers as old as protocol 7.4 > > Performance enhancements include: > > * Implement FUSE's FOPEN_KEEP_CACHE and FUSE_ASYNC_READ flags > * Cache file attributes > * Cache lookup entries, both positive and negative > * Server-selectable cache modes: writethrough, writeback, or uncached > * Write clustering > * Readahead > * Use counter(9) for statistical reporting > > PR: 199934 216391 233783 234581 235773 235774 235775 > PR: 236226 236231 236236 236291 236329 236381 236405 > PR: 236327 236466 236472 236473 236474 236530 236557 > PR: 236560 236844 237052 237181 237588 238565 > Reviewed by: bcr (man pages) > Reviewed by: cem, ngie, rpokala, glebius, kib, bde, emaste (post-commit > review on project branch) > MFC after: 3 weeks > Relnotes: yes > Sponsored by: The FreeBSD Foundation > Pull Request: https://reviews.freebsd.org/D21110 > > Added: > head/tests/sys/fs/fusefs/ > - copied from r350621, projects/fuse2/tests/sys/fs/fusefs/ > Deleted: > head/sys/fs/fuse/fuse_param.h > Modified: > head/MAINTAINERS (contents, props changed) > head/UPDATING > head/etc/mtree/BSD.tests.dist > head/sbin/mount_fusefs/mount_fusefs.8 > head/sbin/mount_fusefs/mount_fusefs.c > head/share/man/man5/fusefs.5 > head/sys/fs/fuse/fuse.h > head/sys/fs/fuse/fuse_device.c > head/sys/fs/fuse/fuse_file.c > head/sys/fs/fuse/fuse_file.h > head/sys/fs/fuse/fuse_internal.c > head/sys/fs/fuse/fuse_internal.h > head/sys/fs/fuse/fuse_io.c > head/sys/fs/fuse/fuse_io.h > head/sys/fs/fuse/fuse_ipc.c > head/sys/fs/fuse/fuse_ipc.h > head/sys/fs/fuse/fuse_kernel.h > head/sys/fs/fuse/fuse_main.c > head/sys/fs/fuse/fuse_node.c > head/sys/fs/fuse/fuse_node.h > head/sys/fs/fuse/fuse_vfsops.c > head/sys/fs/fuse/fuse_vnops.c > head/sys/sys/param.h > head/tests/sys/fs/Makefile > Directory Properties: > head/ (props changed) > > Modified: head/MAINTAINERS > ============================================================================== > --- head/MAINTAINERS Tue Aug 6 23:22:25 2019 (r350664) > +++ head/MAINTAINERS Wed Aug 7 00:38:26 2019 (r350665) > @@ -53,6 +53,7 @@ contrib/pjdfstest asomers,ngie,pjd,#test Pre-commit re > etc/mail gshapiro Pre-commit review requested. Keep in sync with -STABLE. > etc/sendmail gshapiro Pre-commit review requested. Keep in sync with -STABLE. > fetch des Pre-commit review requested, email only. > +fusefs(5) asomers Pre-commit review requested. > geli pjd Pre-commit review requested (both sys/geom/eli/ and sbin/geom/class/eli/). > isci(4) jimharris Pre-commit review requested. > iwm(4) adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org > > Modified: head/UPDATING > ============================================================================== > --- head/UPDATING Tue Aug 6 23:22:25 2019 (r350664) > +++ head/UPDATING Wed Aug 7 00:38:26 2019 (r350665) > @@ -26,6 +26,18 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: > disable the most expensive debugging functionality run > "ln -s 'abort:false,junk:false' /etc/malloc.conf".) > > +20190727: > + The vfs.fusefs.sync_unmount and vfs.fusefs.init_backgrounded sysctls > + and the "-o sync_unmount" and "-o init_backgrounded" mount options have > + been removed from mount_fusefs(8). You can safely remove them from > + your scripts, because they had no effect. > + > + The vfs.fusefs.fix_broken_io, vfs.fusefs.sync_resize, > + vfs.fusefs.refresh_size, vfs.fusefs.mmap_enable, > + vfs.fusefs.reclaim_revoked, and vfs.fusefs.data_cache_invalidate > + sysctls have been removed. If you felt the need to set any of them to > + a non-default value, please tell asomers@FreeBSD.org why. > + > 20190713: > Default permissions on the /var/account/acct file (and copies of it > rotated by periodic daily scripts) are changed from 0644 to 0640 > > Modified: head/etc/mtree/BSD.tests.dist > ============================================================================== > --- head/etc/mtree/BSD.tests.dist Tue Aug 6 23:22:25 2019 (r350664) > +++ head/etc/mtree/BSD.tests.dist Wed Aug 7 00:38:26 2019 (r350665) > @@ -731,6 +731,8 @@ > file > .. > fs > + fusefs > + .. > tmpfs > .. > .. > > Modified: head/sbin/mount_fusefs/mount_fusefs.8 > ============================================================================== > --- head/sbin/mount_fusefs/mount_fusefs.8 Tue Aug 6 23:22:25 2019 (r350664) > +++ head/sbin/mount_fusefs/mount_fusefs.8 Wed Aug 7 00:38:26 2019 (r350665) > @@ -3,6 +3,11 @@ > .\" Copyright (c) 2005, 2006 Csaba Henk > .\" All rights reserved. > .\" > +.\" Copyright (c) 2019 The FreeBSD Foundation > +.\" > +.\" Portions of this documentation were written by BFF Storage Systems under > +.\" sponsorship from the FreeBSD Foundation. > +.\" > .\" Redistribution and use in source and binary forms, with or without > .\" modification, are permitted provided that the following conditions > .\" are met: > @@ -29,7 +34,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd November 17, 2018 > +.Dd July 31, 2019 > .Dt MOUNT_FUSEFS 8 > .Os > .Sh NAME > @@ -108,27 +113,27 @@ Intended for use in scripts and the > .Xr sudoers 5 > file. > .It Fl S , Ic --safe > -Run in safe mode (i.e. reject invoking a filesystem daemon) > +Run in safe mode (i.e., reject invoking a filesystem daemon). > .It Fl v > -Be verbose > -.It Fl D, Ic --daemon Ar daemon > +Be verbose. > +.It Fl D , Ic --daemon Ar daemon > Call the specified > -.Ar daemon > -.It Fl O, Ic --daemon_opts Ar opts > +.Ar daemon . > +.It Fl O , Ic --daemon_opts Ar opts > Add > .Ar opts > -to the daemon's command line > -.It Fl s, Ic --special Ar special > +to the daemon's command line. > +.It Fl s , Ic --special Ar special > Use > .Ar special > -as special > -.It Fl m, Ic --mountpath Ar node > +as special. > +.It Fl m , Ic --mountpath Ar node > Mount on > -.Ar node > -.It Fl h, Ic --help > -Show help > -.It Fl V, Ic --version > -Show version information > +.Ar node . > +.It Fl h , Ic --help > +Show help. > +.It Fl V , Ic --version > +Show version information. > .It Fl o > Mount options are specified via > .Fl o . > @@ -136,23 +141,38 @@ The following options are available (and also their ne > by prefixing them with > .Dq no ) : > .Bl -tag -width indent > -.It Cm default_permissions > -Enable traditional (file mode based) permission checking in kernel > .It Cm allow_other > Do not apply > .Sx STRICT ACCESS POLICY . > -Only root can use this option > +Only root can use this option. > +.It Cm async > +I/O to the file system may be done asynchronously. > +Writes may be delayed and/or reordered. > +.It Cm default_permissions > +Enable traditional (file mode based) permission checking in kernel. > +.It Cm intr > +Allow signals to interrupt operations that are blocked waiting for a reply from the server. > +When this option is in use, system calls may fail with > +.Er EINTR > +whenever a signal is received. > .It Cm max_read Ns = Ns Ar n > Limit size of read requests to > -.Ar n > +.Ar n . > +.It Cm neglect_shares > +Do not refuse unmounting if there are secondary mounts. > .It Cm private > Refuse shared mounting of the daemon. > This is the default behaviour, to allow sharing, expicitly use > -.Fl o Cm noprivate > -.It Cm neglect_shares > -Do not refuse unmounting if there are secondary mounts > +.Fl o Cm noprivate . > .It Cm push_symlinks_in > -Prefix absolute symlinks with the mountpoint > +Prefix absolute symlinks with the mountpoint. > +.It Cm subtype Ns = Ns Ar fsname > +Suffix > +.Ar fsname > +to the file system name as reported by > +.Xr statfs 2 . > +This option can be used to identify the file system implemented by > +.Ar fuse_daemon . > .El > .El > .Pp > @@ -167,11 +187,11 @@ However, there are some which do require in-kernel sup > Currently the options supported by the kernel are: > .Bl -tag -width indent > .It Cm direct_io > -Bypass the buffer cache system > +Bypass the buffer cache system. > .It Cm kernel_cache > By default cached buffers of a given file are flushed at each > .Xr open 2 . > -This option disables this behaviour > +This option disables this behaviour. > .El > .Sh DAEMON MOUNTS > Usually users do not need to use > @@ -194,7 +214,7 @@ only if the filesystem daemon has the same credentials > real gid) as the user. > .Pp > This is applied for Fuse mounts by default and only root can mount without > -the strict access policy (i.e. the > +the strict access policy (i.e., the > .Cm allow_other > mount option). > .Pp > @@ -206,7 +226,7 @@ Users might opt to willingly relax strict access polic > are concerned) by doing their own secondary mount (See > .Sx SHARED MOUNTS ) . > .Sh SHARED MOUNTS > -A Fuse daemon can be shared (i.e. mounted multiple times). > +A Fuse daemon can be shared (i.e., mounted multiple times). > When doing the first (primary) mount, the spawner and the mounter of the daemon > must have the same uid, or the mounter should be the superuser. > .Pp > @@ -225,7 +245,7 @@ is used or not. > .Pp > The device name of a secondary mount is the device name of the corresponding > primary mount, followed by a '#' character and the index of the secondary > -mount; e.g. > +mount; e.g., > .Pa /dev/fuse0#3 . > .Sh SECURITY > System administrators might want to use a custom mount policy (ie., one going > @@ -239,7 +259,7 @@ However, given that > is capable of invoking an arbitrary program, one must be careful when doing this. > .Nm > is designed in a way such that it makes that easy. > -For this purpose, there are options which disable certain risky features (i.e. > +For this purpose, there are options which disable certain risky features ( > .Fl S > and > .Fl A ) , > @@ -342,7 +362,7 @@ does not call any external utility and also provides a > was written as the part of the > .Fx > implementation of the Fuse userspace filesystem framework (see > -.Xr https://github.com/libfuse/libfuse ) > +.Lk https://github.com/libfuse/libfuse ) > and first appeared in the > .Pa sysutils/fusefs-kmod > port, supporting > > Modified: head/sbin/mount_fusefs/mount_fusefs.c > ============================================================================== > --- head/sbin/mount_fusefs/mount_fusefs.c Tue Aug 6 23:22:25 2019 (r350664) > +++ head/sbin/mount_fusefs/mount_fusefs.c Wed Aug 7 00:38:26 2019 (r350665) > @@ -5,6 +5,11 @@ > * Copyright (c) 2005 Csaba Henk > * All rights reserved. > * > + * Copyright (c) 2019 The FreeBSD Foundation > + * > + * Portions of this software were developed by BFF Storage Systems under > + * sponsorship from the FreeBSD Foundation. > + * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > * are met: > @@ -60,7 +65,6 @@ void __usage_short(void); > void usage(void); > void helpmsg(void); > void showversion(void); > -int init_backgrounded(void); > > static struct mntopt mopts[] = { > #define ALTF_PRIVATE 0x01 > @@ -73,8 +77,6 @@ static struct mntopt mopts[] = { > { "max_read=", 0, ALTF_MAXREAD, 1 }, > #define ALTF_SUBTYPE 0x40 > { "subtype=", 0, ALTF_SUBTYPE, 1 }, > - #define ALTF_SYNC_UNMOUNT 0x80 > - { "sync_unmount", 0, ALTF_SYNC_UNMOUNT, 1 }, > /* > * MOPT_AUTOMOUNTED, included by MOPT_STDOPTS, does not fit into > * the 'flags' argument to nmount(2). We have to abuse altflags > @@ -82,6 +84,8 @@ static struct mntopt mopts[] = { > */ > #define ALTF_AUTOMOUNTED 0x100 > { "automounted", 0, ALTF_AUTOMOUNTED, 1 }, > + #define ALTF_INTR 0x200 > + { "intr", 0, ALTF_INTR, 1 }, > /* Linux specific options, we silently ignore them */ > { "fsname=", 0, 0x00, 1 }, > { "fd=", 0, 0x00, 1 }, > @@ -91,6 +95,8 @@ static struct mntopt mopts[] = { > { "large_read", 0, 0x00, 1 }, > /* "nonempty", just the first two chars are stripped off during parsing */ > { "nempty", 0, 0x00, 1 }, > + { "async", 0, MNT_ASYNC, 0}, > + { "noasync", 1, MNT_ASYNC, 0}, > MOPT_STDOPTS, > MOPT_END > }; > @@ -107,7 +113,7 @@ static struct mntval mvals[] = { > { 0, NULL, 0 } > }; > > -#define DEFAULT_MOUNT_FLAGS ALTF_PRIVATE | ALTF_SYNC_UNMOUNT > +#define DEFAULT_MOUNT_FLAGS ALTF_PRIVATE > > int > main(int argc, char *argv[]) > @@ -409,12 +415,6 @@ main(int argc, char *argv[]) > } > } > > - if (fd >= 0 && ! init_backgrounded() && close(fd) < 0) { > - if (pid) > - kill(pid, SIGKILL); > - err(1, "failed to close fuse device"); > - } > - > /* Prepare the options vector for nmount(). build_iovec() is declared > * in mntopts.h. */ > sprintf(fdstr, "%d", fd); > @@ -471,6 +471,7 @@ helpmsg(void) > " -o allow_other allow access to other users\n" > /* " -o nonempty allow mounts over non-empty file/dir\n" */ > " -o default_permissions enable permission checking by kernel\n" > + " -o intr interruptible mount\n" > /* > " -o fsname=NAME set filesystem name\n" > " -o large_read issue large read requests (2.4 only)\n" > @@ -481,7 +482,6 @@ helpmsg(void) > " -o neglect_shares don't report EBUSY when unmount attempted\n" > " in presence of secondary mounts\n" > " -o push_symlinks_in prefix absolute symlinks with mountpoint\n" > - " -o sync_unmount do unmount synchronously\n" > ); > exit(EX_USAGE); > } > @@ -491,18 +491,4 @@ showversion(void) > { > puts("mount_fusefs [fuse4bsd] version: " FUSE4BSD_VERSION); > exit(EX_USAGE); > -} > - > -int > -init_backgrounded(void) > -{ > - int ibg; > - size_t len; > - > - len = sizeof(ibg); > - > - if (sysctlbyname("vfs.fusefs.init_backgrounded", &ibg, &len, NULL, 0)) > - return (0); > - > - return (ibg); > } > > Modified: head/share/man/man5/fusefs.5 > ============================================================================== > --- head/share/man/man5/fusefs.5 Tue Aug 6 23:22:25 2019 (r350664) > +++ head/share/man/man5/fusefs.5 Wed Aug 7 00:38:26 2019 (r350665) > @@ -3,8 +3,8 @@ > .\" > .\" Copyright (c) 2019 The FreeBSD Foundation > .\" > -.\" This software was developed by BFF Storage Systems, LLC under sponsorship > -.\" from the FreeBSD Foundation. > +.\" This documentation was written by BFF Storage Systems, LLC under > +.\" sponsorship from the FreeBSD Foundation. > .\" > .\" Redistribution and use in source and binary forms, with or without > .\" modification, are permitted provided that the following conditions > @@ -28,7 +28,7 @@ > .\" SUCH DAMAGE. > .\" > .\" $FreeBSD$ > -.Dd April 13, 2019 > +.Dd July 31, 2019 > .Dt FUSEFS 5 > .Os > .Sh NAME > @@ -60,11 +60,9 @@ Finally, the > API is portable. > Many daemons can run on multiple operating systems with minimal modifications. > .Sh SYSCTL VARIABLES > -The following variables are available as both > +The following > .Xr sysctl 8 > -variables and > -.Xr loader 8 > -tunables: > +variables are available: > .Bl -tag -width indent > .It Va vfs.fusefs.kernelabi_major > Major version of the FUSE kernel ABI supported by this driver. > @@ -73,7 +71,7 @@ Minor version of the FUSE kernel ABI supported by this > .It Va vfs.fusefs.data_cache_mode > Controls how > .Nm > -will cache file data. > +will cache file data for pre-7.23 file systems. > A value of 0 will disable caching entirely. > Every data access will be forwarded to the daemon. > A value of 1 will select write-through caching. > @@ -84,33 +82,26 @@ Reads and writes will both be cached, and writes will > to the daemon by the page daemon. > Write-back caching is usually unsafe, especially for FUSE file systems that > require network access. > -.It Va vfs.fusefs.lookup_cache_enable > -Controls whether > -.Nm > -will cache lookup responses from the file system. > -FUSE file systems indicate whether lookup responses should be cacheable, but > -it may be useful to globally disable caching them if a file system is > -misbehaving. > +.Pp > +FUSE file systems using protocol 7.23 or later specify their cache behavior > +on a per-mountpoint basis, ignoring this sysctl. > +.It Va vfs.fusefs.stats.filehandle_count > +Current number of open FUSE file handles. > +.It Va vfs.fusefs.stats.lookup_cache_hits > +Total number of lookup cache hits. > +.It Va vfs.fusefs.stats.lookup_cache_misses > +Total number of lookup cache misses. > +.It Va vfs.fusefs.stats.node_count > +Current number of allocated FUSE vnodes. > +.It Va vfs.fusefs.stats.ticket_count > +Current number of allocated FUSE tickets, which is roughly equal to the number > +of FUSE operations currently being processed by daemons. > .\" Undocumented sysctls > .\" ==================== > -.\" Counters: I intend to rename to vfs.fusefs.stats.* for clarity > -.\" vfs.fusefs.lookup_cache_{hits, misses} > -.\" vfs.fusefs.filehandle_count > -.\" vfs.fusefs.ticker_count > -.\" vfs.fusefs.node_count > -.\" > -.\" vfs.fusefs.version - useless since the driver moved in-tree > -.\" vfs.fusefs.reclaim_revoked: I don't understand it well-enough > -.\" vfs.fusefs.sync_unmount: dead code > .\" vfs.fusefs.enforce_dev_perms: I don't understand it well enough. > -.\" vfs.fusefs.init_backgrounded: dead code > .\" vfs.fusefs.iov_credit: I don't understand it well enough > .\" vfs.fusefs.iov_permanent_bufsize: I don't understand it well enough > -.\" vfs.fusefs.fix_broken_io: I don't understand it well enough > -.\" vfs.fusefs.sync_resize: useless and should be removed > -.\" vfs.fusefs.refresh_size: probably useless? > -.\" vfs.fusefs.mmap_enable: why is this optional? > -.\" vfs.fusefs.data_cache_invalidate: what is this needed for? > +.El > .Sh SEE ALSO > .Xr mount_fusefs 8 > .Sh HISTORY > @@ -119,7 +110,7 @@ The > driver was written as the part of the > .Fx > implementation of the FUSE userspace file system framework (see > -.Xr https://github.com/libfuse/libfuse ) > +.Lk https://github.com/libfuse/libfuse ) > and first appeared in the > .Pa sysutils/fusefs-kmod > port, supporting > > Modified: head/sys/fs/fuse/fuse.h > ============================================================================== > --- head/sys/fs/fuse/fuse.h Tue Aug 6 23:22:25 2019 (r350664) > +++ head/sys/fs/fuse/fuse.h Wed Aug 7 00:38:26 2019 (r350665) > @@ -32,6 +32,11 @@ > * > * Copyright (C) 2005 Csaba Henk. > * All rights reserved. > + * > + * Copyright (c) 2019 The FreeBSD Foundation > + * > + * Portions of this software were developed by BFF Storage Systems, LLC under > + * sponsorship from the FreeBSD Foundation. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > @@ -63,87 +68,10 @@ > #define FUSE_MIN_DAEMON_TIMEOUT 0 /* s */ > #define FUSE_MAX_DAEMON_TIMEOUT 600 /* s */ > > -#ifndef FUSE_FREEBSD_VERSION > -#define FUSE_FREEBSD_VERSION "0.4.4" > -#endif > - > -/* Mapping versions to features */ > - > -#define FUSE_KERNELABI_GEQ(maj, min) \ > -(FUSE_KERNEL_VERSION > (maj) || (FUSE_KERNEL_VERSION == (maj) && FUSE_KERNEL_MINOR_VERSION >= (min))) > - > -/* > - * Appearance of new FUSE operations is not always in par with version > - * numbering... At least, 7.3 is a sufficient condition for having > - * FUSE_{ACCESS,CREATE}. > - */ > -#if FUSE_KERNELABI_GEQ(7, 3) > -#ifndef FUSE_HAS_ACCESS > -#define FUSE_HAS_ACCESS 1 > -#endif > -#ifndef FUSE_HAS_CREATE > -#define FUSE_HAS_CREATE 1 > -#endif > -#else /* FUSE_KERNELABI_GEQ(7, 3) */ > -#ifndef FUSE_HAS_ACCESS > -#define FUSE_HAS_ACCESS 0 > -#endif > -#ifndef FUSE_HAS_CREATE > -#define FUSE_HAS_CREATE 0 > -#endif > -#endif > - > -#if FUSE_KERNELABI_GEQ(7, 7) > -#ifndef FUSE_HAS_GETLK > -#define FUSE_HAS_GETLK 1 > -#endif > -#ifndef FUSE_HAS_SETLK > -#define FUSE_HAS_SETLK 1 > -#endif > -#ifndef FUSE_HAS_SETLKW > -#define FUSE_HAS_SETLKW 1 > -#endif > -#ifndef FUSE_HAS_INTERRUPT > -#define FUSE_HAS_INTERRUPT 1 > -#endif > -#else /* FUSE_KERNELABI_GEQ(7, 7) */ > -#ifndef FUSE_HAS_GETLK > -#define FUSE_HAS_GETLK 0 > -#endif > -#ifndef FUSE_HAS_SETLK > -#define FUSE_HAS_SETLK 0 > -#endif > -#ifndef FUSE_HAS_SETLKW > -#define FUSE_HAS_SETLKW 0 > -#endif > -#ifndef FUSE_HAS_INTERRUPT > -#define FUSE_HAS_INTERRUPT 0 > -#endif > -#endif > - > -#if FUSE_KERNELABI_GEQ(7, 8) > -#ifndef FUSE_HAS_FLUSH_RELEASE > -#define FUSE_HAS_FLUSH_RELEASE 1 > -/* > - * "DESTROY" came in the middle of the 7.8 era, > - * so this is not completely exact... > - */ > -#ifndef FUSE_HAS_DESTROY > -#define FUSE_HAS_DESTROY 1 > -#endif > -#endif > -#else /* FUSE_KERNELABI_GEQ(7, 8) */ > -#ifndef FUSE_HAS_FLUSH_RELEASE > -#define FUSE_HAS_FLUSH_RELEASE 0 > -#ifndef FUSE_HAS_DESTROY > -#define FUSE_HAS_DESTROY 0 > -#endif > -#endif > -#endif > - > /* misc */ > > SYSCTL_DECL(_vfs_fusefs); > +SYSCTL_DECL(_vfs_fusefs_stats); > > /* Fuse locking */ > > > Modified: head/sys/fs/fuse/fuse_device.c > ============================================================================== > --- head/sys/fs/fuse/fuse_device.c Tue Aug 6 23:22:25 2019 (r350664) > +++ head/sys/fs/fuse/fuse_device.c Wed Aug 7 00:38:26 2019 (r350665) > @@ -33,6 +33,11 @@ > * Copyright (C) 2005 Csaba Henk. > * All rights reserved. > * > + * Copyright (c) 2019 The FreeBSD Foundation > + * > + * Portions of this software were developed by BFF Storage Systems, LLC under > + * sponsorship from the FreeBSD Foundation. > + * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > * are met: > @@ -81,27 +86,28 @@ __FBSDID("$FreeBSD$"); > #include > > #include "fuse.h" > +#include "fuse_internal.h" > #include "fuse_ipc.h" > > -SDT_PROVIDER_DECLARE(fuse); > +SDT_PROVIDER_DECLARE(fusefs); > /* > * Fuse trace probe: > * arg0: verbosity. Higher numbers give more verbose messages > * arg1: Textual message > */ > -SDT_PROBE_DEFINE2(fuse, , device, trace, "int", "char*"); > +SDT_PROBE_DEFINE2(fusefs, , device, trace, "int", "char*"); > > static struct cdev *fuse_dev; > > +static d_kqfilter_t fuse_device_filter; > static d_open_t fuse_device_open; > -static d_close_t fuse_device_close; > static d_poll_t fuse_device_poll; > static d_read_t fuse_device_read; > static d_write_t fuse_device_write; > > static struct cdevsw fuse_device_cdevsw = { > + .d_kqfilter = fuse_device_filter, > .d_open = fuse_device_open, > - .d_close = fuse_device_close, > .d_name = "fuse", > .d_poll = fuse_device_poll, > .d_read = fuse_device_read, > @@ -109,6 +115,15 @@ static struct cdevsw fuse_device_cdevsw = { > .d_version = D_VERSION, > }; > > +static int fuse_device_filt_read(struct knote *kn, long hint); > +static void fuse_device_filt_detach(struct knote *kn); > + > +struct filterops fuse_device_rfiltops = { > + .f_isfd = 1, > + .f_detach = fuse_device_filt_detach, > + .f_event = fuse_device_filt_read, > +}; > + > /**************************** > * > * >>> Fuse device op defs > @@ -119,11 +134,100 @@ static void > fdata_dtor(void *arg) > { > struct fuse_data *fdata; > + struct fuse_ticket *tick; > > fdata = arg; > + if (fdata == NULL) > + return; > + > + fdata_set_dead(fdata); > + > + FUSE_LOCK(); > + fuse_lck_mtx_lock(fdata->aw_mtx); > + /* wakup poll()ers */ > + selwakeuppri(&fdata->ks_rsel, PZERO + 1); > + /* Don't let syscall handlers wait in vain */ > + while ((tick = fuse_aw_pop(fdata))) { > + fuse_lck_mtx_lock(tick->tk_aw_mtx); > + fticket_set_answered(tick); > + tick->tk_aw_errno = ENOTCONN; > + wakeup(tick); > + fuse_lck_mtx_unlock(tick->tk_aw_mtx); > + FUSE_ASSERT_AW_DONE(tick); > + fuse_ticket_drop(tick); > + } > + fuse_lck_mtx_unlock(fdata->aw_mtx); > + > + /* Cleanup unsent operations */ > + fuse_lck_mtx_lock(fdata->ms_mtx); > + while ((tick = fuse_ms_pop(fdata))) { > + fuse_ticket_drop(tick); > + } > + fuse_lck_mtx_unlock(fdata->ms_mtx); > + FUSE_UNLOCK(); > + > fdata_trydestroy(fdata); > } > > +static int > +fuse_device_filter(struct cdev *dev, struct knote *kn) > +{ > + struct fuse_data *data; > + int error; > + > + error = devfs_get_cdevpriv((void **)&data); > + > + /* EVFILT_WRITE is not supported; the device is always ready to write */ > + if (error == 0 && kn->kn_filter == EVFILT_READ) { > + kn->kn_fop = &fuse_device_rfiltops; > + kn->kn_hook = data; > + knlist_add(&data->ks_rsel.si_note, kn, 0); > + error = 0; > + } else if (error == 0) { > + error = EINVAL; > + kn->kn_data = error; > + } > + > + return (error); > +} > + > +static void > +fuse_device_filt_detach(struct knote *kn) > +{ > + struct fuse_data *data; > + > + data = (struct fuse_data*)kn->kn_hook; > + MPASS(data != NULL); > + knlist_remove(&data->ks_rsel.si_note, kn, 0); > + kn->kn_hook = NULL; > +} > + > +static int > +fuse_device_filt_read(struct knote *kn, long hint) > +{ > + struct fuse_data *data; > + int ready; > + > + data = (struct fuse_data*)kn->kn_hook; > + MPASS(data != NULL); > + > + mtx_assert(&data->ms_mtx, MA_OWNED); > + if (fdata_get_dead(data)) { > + kn->kn_flags |= EV_EOF; > + kn->kn_fflags = ENODEV; > + kn->kn_data = 1; > + ready = 1; > + } else if (STAILQ_FIRST(&data->ms_head)) { > + MPASS(data->ms_count >= 1); > + kn->kn_data = data->ms_count; > + ready = 1; > + } else { > + ready = 0; > + } > + > + return (ready); > +} > + > /* > * Resources are set up on a per-open basis > */ > @@ -133,52 +237,17 @@ fuse_device_open(struct cdev *dev, int oflags, int dev > struct fuse_data *fdata; > int error; > > - SDT_PROBE2(fuse, , device, trace, 1, "device open"); > + SDT_PROBE2(fusefs, , device, trace, 1, "device open"); > > fdata = fdata_alloc(dev, td->td_ucred); > error = devfs_set_cdevpriv(fdata, fdata_dtor); > if (error != 0) > fdata_trydestroy(fdata); > else > - SDT_PROBE2(fuse, , device, trace, 1, "device open success"); > + SDT_PROBE2(fusefs, , device, trace, 1, "device open success"); > return (error); > } > > -static int > -fuse_device_close(struct cdev *dev, int fflag, int devtype, struct thread *td) > -{ > - struct fuse_data *data; > - struct fuse_ticket *tick; > - int error; > - > - error = devfs_get_cdevpriv((void **)&data); > - if (error != 0) > - return (error); > - if (!data) > - panic("no fuse data upon fuse device close"); > - fdata_set_dead(data); > - > - FUSE_LOCK(); > - fuse_lck_mtx_lock(data->aw_mtx); > - /* wakup poll()ers */ > - selwakeuppri(&data->ks_rsel, PZERO + 1); > - /* Don't let syscall handlers wait in vain */ > - while ((tick = fuse_aw_pop(data))) { > - fuse_lck_mtx_lock(tick->tk_aw_mtx); > - fticket_set_answered(tick); > - tick->tk_aw_errno = ENOTCONN; > - wakeup(tick); > - fuse_lck_mtx_unlock(tick->tk_aw_mtx); > - FUSE_ASSERT_AW_DONE(tick); > - fuse_ticket_drop(tick); > - } > - fuse_lck_mtx_unlock(data->aw_mtx); > - FUSE_UNLOCK(); > - > - SDT_PROBE2(fuse, , device, trace, 1, "device close"); > - return (0); > -} > - > int > fuse_device_poll(struct cdev *dev, int events, struct thread *td) > { > @@ -219,7 +288,7 @@ fuse_device_read(struct cdev *dev, struct uio *uio, in > int buflen[3]; > int i; > > - SDT_PROBE2(fuse, , device, trace, 1, "fuse device read"); > + SDT_PROBE2(fusefs, , device, trace, 1, "fuse device read"); > > err = devfs_get_cdevpriv((void **)&data); > if (err != 0) > @@ -228,7 +297,7 @@ fuse_device_read(struct cdev *dev, struct uio *uio, in > fuse_lck_mtx_lock(data->ms_mtx); > again: > if (fdata_get_dead(data)) { > - SDT_PROBE2(fuse, , device, trace, 2, > + SDT_PROBE2(fusefs, , device, trace, 2, > "we know early on that reader should be kicked so we " > "don't wait for news"); > fuse_lck_mtx_unlock(data->ms_mtx); > @@ -256,7 +325,7 @@ again: > * -- and some other cases, too, tho not totally clear, when > * (cv_signal/wakeup_one signals the whole process ?) > */ > - SDT_PROBE2(fuse, , device, trace, 1, "no message on thread"); > + SDT_PROBE2(fusefs, , device, trace, 1, "no message on thread"); > goto again; > } > fuse_lck_mtx_unlock(data->ms_mtx); > @@ -266,9 +335,10 @@ again: > * somebody somewhere -- eg., umount routine -- > * wants this liaison finished off > */ > - SDT_PROBE2(fuse, , device, trace, 2, "reader is to be sacked"); > + SDT_PROBE2(fusefs, , device, trace, 2, > + "reader is to be sacked"); > if (tick) { > - SDT_PROBE2(fuse, , device, trace, 2, "weird -- " > + SDT_PROBE2(fusefs, , device, trace, 2, "weird -- " > "\"kick\" is set tho there is message"); > FUSE_ASSERT_MS_DONE(tick); > fuse_ticket_drop(tick); > @@ -276,7 +346,7 @@ again: > return (ENODEV); /* This should make the daemon get off > * of us */ > } > - SDT_PROBE2(fuse, , device, trace, 1, > + SDT_PROBE2(fusefs, , device, trace, 1, > "fuse device read message successfully"); > > KASSERT(tick->tk_ms_bufdata || tick->tk_ms_bufsize == 0, > @@ -311,7 +381,7 @@ again: > */ > if (uio->uio_resid < buflen[i]) { > fdata_set_dead(data); > - SDT_PROBE2(fuse, , device, trace, 2, > + SDT_PROBE2(fusefs, , device, trace, 2, > "daemon is stupid, kick it off..."); > err = ENODEV; > break; > @@ -331,23 +401,26 @@ static inline int > fuse_ohead_audit(struct fuse_out_header *ohead, struct uio *uio) > { > if (uio->uio_resid + sizeof(struct fuse_out_header) != ohead->len) { > - SDT_PROBE2(fuse, , device, trace, 1, "Format error: body size " > + SDT_PROBE2(fusefs, , device, trace, 1, > + "Format error: body size " > "differs from size claimed by header"); > return (EINVAL); > } > - if (uio->uio_resid && ohead->error) { > - SDT_PROBE2(fuse, , device, trace, 1, > + if (uio->uio_resid && ohead->unique != 0 && ohead->error) { > + SDT_PROBE2(fusefs, , device, trace, 1, > "Format error: non zero error but message had a body"); > return (EINVAL); > } > - /* Sanitize the linuxism of negative errnos */ > - ohead->error = -(ohead->error); > > return (0); > } > > -SDT_PROBE_DEFINE1(fuse, , device, fuse_device_write_bumped_into_callback, > - "uint64_t"); > +SDT_PROBE_DEFINE1(fusefs, , device, fuse_device_write_notify, > + "struct fuse_out_header*"); > +SDT_PROBE_DEFINE1(fusefs, , device, fuse_device_write_missing_ticket, > + "uint64_t"); > +SDT_PROBE_DEFINE1(fusefs, , device, fuse_device_write_found, > + "struct fuse_ticket*"); > /* > * fuse_device_write first reads the header sent by the daemon. > * If that's OK, looks up ticket/callback node by the unique id seen in header. > @@ -360,15 +433,17 @@ fuse_device_write(struct cdev *dev, struct uio *uio, i > struct fuse_out_header ohead; > int err = 0; > struct fuse_data *data; > - struct fuse_ticket *tick, *x_tick; > + struct mount *mp; > + struct fuse_ticket *tick, *itick, *x_tick; > int found = 0; > > err = devfs_get_cdevpriv((void **)&data); > if (err != 0) > return (err); > + mp = data->mp; > > if (uio->uio_resid < sizeof(struct fuse_out_header)) { > - SDT_PROBE2(fuse, , device, trace, 1, > + SDT_PROBE2(fusefs, , device, trace, 1, > "fuse_device_write got less than a header!"); > fdata_set_dead(data); > return (EINVAL); > @@ -393,15 +468,29 @@ fuse_device_write(struct cdev *dev, struct uio *uio, i > fuse_lck_mtx_lock(data->aw_mtx); > TAILQ_FOREACH_SAFE(tick, &data->aw_head, tk_aw_link, > x_tick) { > - SDT_PROBE1(fuse, , device, > - fuse_device_write_bumped_into_callback, > - tick->tk_unique); > if (tick->tk_unique == ohead.unique) { > + SDT_PROBE1(fusefs, , device, fuse_device_write_found, > + tick); > found = 1; > fuse_aw_remove(tick); > break; > } > } > + if (found && tick->irq_unique > 0) { > + /* > + * Discard the FUSE_INTERRUPT ticket that tried to interrupt > + * this operation > + */ > + TAILQ_FOREACH_SAFE(itick, &data->aw_head, tk_aw_link, > + x_tick) { > + if (itick->tk_unique == tick->irq_unique) { > + fuse_aw_remove(itick); > + fuse_ticket_drop(itick); > + break; > + } > + } > + tick->irq_unique = 0; > + } > fuse_lck_mtx_unlock(data->aw_mtx); > > if (found) { > @@ -414,13 +503,15 @@ fuse_device_write(struct cdev *dev, struct uio *uio, i > * via ticket_drop(), so no manual mucking > * around...) > */ > - SDT_PROBE2(fuse, , device, trace, 1, > + SDT_PROBE2(fusefs, , device, trace, 1, > "pass ticket to a callback"); > + /* Sanitize the linuxism of negative errnos */ > + ohead.error *= -1; > memcpy(&tick->tk_aw_ohead, &ohead, sizeof(ohead)); > err = tick->tk_aw_handler(tick, uio); > } else { > /* pretender doesn't wanna do anything with answer */ > - SDT_PROBE2(fuse, , device, trace, 1, > + SDT_PROBE2(fusefs, , device, trace, 1, > "stuff devalidated, so we drop it"); > } > > @@ -430,11 +521,51 @@ fuse_device_write(struct cdev *dev, struct uio *uio, i > * because fuse_ticket_drop() will deal with refcount anyway. > */ > fuse_ticket_drop(tick); > + } else if (ohead.unique == 0){ > + /* unique == 0 means asynchronous notification */ > + SDT_PROBE1(fusefs, , device, fuse_device_write_notify, &ohead); > + switch (ohead.error) { > + case FUSE_NOTIFY_INVAL_ENTRY: > + err = fuse_internal_invalidate_entry(mp, uio); > + break; > + case FUSE_NOTIFY_INVAL_INODE: > + err = fuse_internal_invalidate_inode(mp, uio); > + break; > + case FUSE_NOTIFY_RETRIEVE: > + case FUSE_NOTIFY_STORE: > + /* > + * Unimplemented. I don't know of any file systems > + * that use them, and the protocol isn't sound anyway, > + * since the notification messages don't include the > + * inode's generation number. Without that, it's > + * possible to manipulate the cache of the wrong vnode. > + * Finally, it's not defined what this message should > + * do for a file with dirty cache. > + */ > + case FUSE_NOTIFY_POLL: > + /* Unimplemented. See comments in fuse_vnops */ > + default: > + /* Not implemented */ > + err = ENOSYS; > + } > } else { > /* no callback at all! */ > - SDT_PROBE2(fuse, , device, trace, 1, > - "erhm, no handler for this response"); > - err = EINVAL; > + SDT_PROBE1(fusefs, , device, fuse_device_write_missing_ticket, > + ohead.unique); > + if (ohead.error == -EAGAIN) { > + /* > + * This was probably a response to a FUSE_INTERRUPT > + * operation whose original operation is already > + * complete. We can't store FUSE_INTERRUPT tickets > + * indefinitely because their responses are optional. > + * So we delete them when the original operation > + * completes. And sadly the fuse_header_out doesn't > + * identify the opcode, so we have to guess. > + */ > + err = 0; > + } else { > + err = EINVAL; > + } > } > > return (err); > @@ -445,7 +576,7 @@ fuse_device_init(void) > { > > fuse_dev = make_dev(&fuse_device_cdevsw, 0, UID_ROOT, GID_OPERATOR, > - S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, "fuse"); > + S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, "fuse"); > if (fuse_dev == NULL) > return (ENOMEM); > return (0); > > Modified: head/sys/fs/fuse/fuse_file.c > ============================================================================== > --- head/sys/fs/fuse/fuse_file.c Tue Aug 6 23:22:25 2019 (r350664) > +++ head/sys/fs/fuse/fuse_file.c Wed Aug 7 00:38:26 2019 (r350665) > @@ -33,6 +33,11 @@ > * Copyright (C) 2005 Csaba Henk. > * All rights reserved. > * > + * Copyright (c) 2019 The FreeBSD Foundation > + * > + * Portions of this software were developed by BFF Storage Systems, LLC under > + * sponsorship from the FreeBSD Foundation. > + * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > * are met: > @@ -59,8 +64,9 @@ > __FBSDID("$FreeBSD$"); > > #include > -#include > #include > +#include > +#include > #include > #include > #include > @@ -79,52 +85,61 @@ __FBSDID("$FreeBSD$"); > #include "fuse.h" > #include "fuse_file.h" > #include "fuse_internal.h" > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-head@freebsd.org Wed Aug 7 16:01:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 20E48AE3AE; Wed, 7 Aug 2019 16:01:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463bp506H1z3Mt2; Wed, 7 Aug 2019 16:01:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 30A0A15377; Wed, 7 Aug 2019 16:01:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r350550 - head/share/mk To: Glen Barber Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, freebsd-hackers@freebsd.org, freebsd-arch@freebsd.org References: <201908030106.x7316Ibx078529@repo.freebsd.org> <20190806165614.GA41295@FreeBSD.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <4e4d30b2-4801-2e53-6f26-49cb350445ec@FreeBSD.org> Date: Wed, 7 Aug 2019 09:00:58 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: <20190806165614.GA41295@FreeBSD.org> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 16:01:01 -0000 On 8/6/19 9:56 AM, Glen Barber wrote: > On Sat, Aug 03, 2019 at 01:06:18AM +0000, John Baldwin wrote: >> Author: jhb >> Date: Sat Aug 3 01:06:17 2019 >> New Revision: 350550 >> URL: https://svnweb.freebsd.org/changeset/base/350550 >> >> Log: >> Flip REPRODUCIBLE_BUILD back to off by default in head. >> >> Having the full uname output can be useful on head even with >> unmodified trees or trees that newvers.sh fails to recognize as >> modified. >> >> Reviewed by: emaste >> Differential Revision: https://reviews.freebsd.org/D20895 >> > > I would like to request this commit be reverted. While the original > commit message to enable this knob stated the commit would be reverted > after stable/12 branched, I have seen no public complaints about > enabling REPRODUCIBLE_BUILD by default (and quite honestly, do not see > the benefit of disabling it by default -- why wouldn't we want > reproducibility?). > > To me, this feels like a step backwards, with no tangible benefit. > Note, newvers.sh does properly detect a modified tree if it can find > the VCS metadata directory (i.e., .git, .svn) -- I know this because > I personally helped with it. > > In my opinion, those that want the non-reproducible metadata included in > output from 'uname -a' should set WITHOUT_REPRODUCIBLE_BUILDS in their > src.conf. Turning off a sane default for the benefit of what I suspect > is likely a short list of use cases feels like a step in the wrong > direction. My arguments for flipping this in head (and head only) are that the data provided in uname -a when this is disabled is useful for development, and that in head we do tailor settings towards development (e.g. GENERIC in head vs GENERIC in stable). The logic to handle modified trees has an inherent assumption that I think is false, at least for my workflow and I suspect many others. I do builds and tests of kernels on separate machines (VMs or bare metal) from where I use VCS to manage sources so that a kernel crash doesn't toast my source tree. The trees are then shared to the build/test machines via NFS. As a result, the build/test machines are not always able to detect that the tree is modified either because a subset of the checkout is exported via NFS, or the VCS tool isn't installed on the build/test machines because they are generally barebones systems with only a base installed. This does mean that flipping the knob off doesn't provide all of the same info, but it does provide the path, and the path matters because 'kgdb -n last' uses it, and because if you use separate directories for separate projects (e.g. git worktrees), then the path tells you which test kernel you booted. (It is not uncommon for me to have several test projects in flight on a single test machine for different branches.) In the original discussion on arch, we collectively recognized that developer builds vs release builds were different and needed different defaults. The compromise reached at that time was to depend on the VCS to detect developer builds to choose the policy. What I have found is that in practice for at least my workflow that doesn't actually work. I posit that the majority of kernels built from head are developer builds, not releases, and that the default should cater to that. You could also always patch release.sh to set WITH_REPRODUCIBLE_BUILD in the environment which I think would give a more accurate sense of when builds are releases or not. However, I will yield to whatever the consensus is. -- John Baldwin From owner-svn-src-head@freebsd.org Wed Aug 7 16:19:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54554AECCA; Wed, 7 Aug 2019 16:19:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463cBz1Sblz3P7T; Wed, 7 Aug 2019 16:19:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F50DF3C7; Wed, 7 Aug 2019 16:19:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77GJ6lW067925; Wed, 7 Aug 2019 16:19:06 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77GJ6qq067924; Wed, 7 Aug 2019 16:19:06 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908071619.x77GJ6qq067924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 7 Aug 2019 16:19:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350678 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 350678 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 16:19:07 -0000 Author: imp Date: Wed Aug 7 16:19:06 2019 New Revision: 350678 URL: https://svnweb.freebsd.org/changeset/base/350678 Log: Enable nvme on aarch64 Don't mark nvme as broken on aarch64. It compiles, at least, and people are testing it out. This only enables the userland parts of the nvme stack. Submitted by: greg at unrelenting technologies Differential Revision: https://reviews.freebsd.org/D21168 Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Wed Aug 7 15:05:08 2019 (r350677) +++ head/share/mk/src.opts.mk Wed Aug 7 16:19:06 2019 (r350678) @@ -389,8 +389,8 @@ BROKEN_OPTIONS+=MLX5TOOL BROKEN_OPTIONS+=HYPERV .endif -# NVME is only x86 and powerpc64 -.if ${__T} != "amd64" && ${__T} != "i386" && ${__T} != "powerpc64" +# NVME is only aarch64, x86 and powerpc64 +.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && ${__T} != "powerpc64" BROKEN_OPTIONS+=NVME .endif From owner-svn-src-head@freebsd.org Wed Aug 7 16:22:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A825AAEF68; Wed, 7 Aug 2019 16:22:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463cGp3xxlz3Ph1; Wed, 7 Aug 2019 16:22:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 501EBF58B; Wed, 7 Aug 2019 16:22:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77GMQuB072580; Wed, 7 Aug 2019 16:22:26 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77GMQl1072553; Wed, 7 Aug 2019 16:22:26 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908071622.x77GMQl1072553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 7 Aug 2019 16:22:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350679 - head/contrib/elftoolchain/elfcopy X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/contrib/elftoolchain/elfcopy X-SVN-Commit-Revision: 350679 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 16:22:26 -0000 Author: markj Date: Wed Aug 7 16:22:25 2019 New Revision: 350679 URL: https://svnweb.freebsd.org/changeset/base/350679 Log: Merge r3780 from elftoolchain. Adjust argc and argv by optind before using them. This slightly simplifies the code. No functional change intended. MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21079 Modified: head/contrib/elftoolchain/elfcopy/main.c Modified: head/contrib/elftoolchain/elfcopy/main.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/main.c Wed Aug 7 16:19:06 2019 (r350678) +++ head/contrib/elftoolchain/elfcopy/main.c Wed Aug 7 16:22:25 2019 (r350679) @@ -1017,13 +1017,16 @@ elfcopy_main(struct elfcopy *ecp, int argc, char **arg } } - if (optind == argc || optind + 2 < argc) + argc -= optind; + argv += optind; + + if (argc == 0 || argc > 2) elfcopy_usage(); - infile = argv[optind]; + infile = argv[0]; outfile = NULL; - if (optind + 1 < argc) - outfile = argv[optind + 1]; + if (argc > 1) + outfile = argv[1]; create_file(ecp, infile, outfile); } @@ -1067,7 +1070,10 @@ mcs_main(struct elfcopy *ecp, int argc, char **argv) } } - if (optind == argc) + argc -= optind; + argv += optind; + + if (argc == 0) mcs_usage(); /* Must specify one operation at least. */ @@ -1104,7 +1110,7 @@ mcs_main(struct elfcopy *ecp, int argc, char **argv) sac->string = string; } - for (i = optind; i < argc; i++) { + for (i = 0; i < argc; i++) { /* If only -p is specified, output to /dev/null */ if (print && !append && !compress && !delete) create_file(ecp, argv[i], "/dev/null"); @@ -1180,21 +1186,24 @@ strip_main(struct elfcopy *ecp, int argc, char **argv) } } + argc -= optind; + argv += optind; + if (ecp->strip == 0 && ((ecp->flags & DISCARD_LOCAL) == 0) && ((ecp->flags & DISCARD_LLABEL) == 0) && lookup_symop_list(ecp, NULL, SYMOP_STRIP) == NULL) ecp->strip = STRIP_ALL; - if (optind == argc) + if (argc == 0) strip_usage(); /* * Only accept a single input file if an output file had been * specified. */ - if (outfile != NULL && argc != (optind + 1)) + if (outfile != NULL && argc != 1) strip_usage(); - for (i = optind; i < argc; i++) + for (i = 0; i < argc; i++) create_file(ecp, argv[i], outfile); } From owner-svn-src-head@freebsd.org Wed Aug 7 16:22:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE475AEF8A; Wed, 7 Aug 2019 16:22:31 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 463cGt3nxFz3Pj4; Wed, 7 Aug 2019 16:22:30 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 5A42B21CDA; Wed, 7 Aug 2019 12:22:29 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 07 Aug 2019 12:22:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm1; bh=i KFQjkuBDI01x/nvatWdFxQkbSkjjB/b93reEcOvOKo=; b=mPIyOKSIROezMjsRG d7RExHoTxjqVF8ykCvLFTM9aEdAwHQ02Lw99iqPDYRDqGEK9HoJbp9kHqKRyMS40 cQSh9LMLO9flzaj5UWGtye1vaOJ1Qdf0A08f4KgJb+YVFbDPMzXurZlWodoStH0n jXiKIuPDv/PXPPCovGlROquEzg/VNM0kTH1YHw95fOys5z9nl7yE0b2cmei7ASTW QFVrn4p5L/7Mm++dcCw0OM4n7VLwSmq88fPQhy+gzRj7nGLf7hFVLKXT47UMhw1N yQXgb8C/4V1O7b05v6qdjD1J9kjE+Vl3xJn6xLidi4nPLcPTg3BUD4JnMS4eIenL hUnRA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=iKFQjkuBDI01x/nvatWdFxQkbSkjjB/b93reEcOvO Ko=; b=eXL16uIOjNVpKaj/wWzZEcTyWEiC3poFN/sUNTu6fFXRvXcDAaURHW6Kt ynxI/asTgE0gK81yUayh2Cq8Y1ukQ3IhtjFqJK6dZdrFsy565giqpVo+rlGiZsLO fZgAKJ4WWVGWiHA/rwBMvVPQlnYXPrQvvURyTLfRkvOCq2YhFcCJwssD1yjJp5XO 44y1opy7srmgrd1xPFLgVaBs6RljO15kAVkiCyiT0/lWPzXF9UV3+t52Hn3Gf0D9 OAhdsf96b84nVnGJPnGlpOOcivlUUKr/ibV8N+5RDFuOfm5OaeAmjwCCsLKQgKxd 2d6aMQXUptugKA9JBCfk8mD+1z5+A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudduvddguddttdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurheptggguffhjgffgffkfhfvofesth hqmhdthhdtjeenucfhrhhomhepufgtohhtthcunfhonhhguceoshgtohhtthhlsehsrghm shgtohdrohhrgheqnecuffhomhgrihhnpehfrhgvvggsshgurdhorhhgnecukfhppedule dvrdehhedrheegrdehkeenucfrrghrrghmpehmrghilhhfrhhomhepshgtohhtthhlsehs rghmshgtohdrohhrghenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [10.178.24.14] (unknown [192.55.54.58]) by mail.messagingengine.com (Postfix) with ESMTPA id 6047580059; Wed, 7 Aug 2019 12:22:27 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r350550 - head/share/mk From: Scott Long In-Reply-To: <4e4d30b2-4801-2e53-6f26-49cb350445ec@FreeBSD.org> Date: Wed, 7 Aug 2019 10:22:24 -0600 Cc: Glen Barber , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, freebsd-hackers@freebsd.org, freebsd-arch@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201908030106.x7316Ibx078529@repo.freebsd.org> <20190806165614.GA41295@FreeBSD.org> <4e4d30b2-4801-2e53-6f26-49cb350445ec@FreeBSD.org> To: John Baldwin X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 463cGt3nxFz3Pj4 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=samsco.org header.s=fm1 header.b=mPIyOKSI; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=eXL16uIO; dmarc=none; spf=pass (mx1.freebsd.org: domain of scottl@samsco.org designates 66.111.4.28 as permitted sender) smtp.mailfrom=scottl@samsco.org X-Spamd-Result: default: False [-0.78 / 15.00]; ARC_NA(0.00)[]; RECEIVED_SPAMHAUS_XBL(5.00)[58.54.55.192.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.4]; R_DKIM_ALLOW(0.00)[samsco.org:s=fm1,messagingengine.com:s=fm3]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(0.00)[+ip4:66.111.4.28]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MV_CASE(0.50)[]; DMARC_NA(0.00)[samsco.org]; BAD_REP_POLICIES(0.10)[]; NEURAL_HAM_LONG(-0.88)[-0.877,0]; RCVD_COUNT_THREE(0.00)[4]; RCVD_TLS_LAST(0.00)[]; DKIM_TRACE(0.00)[samsco.org:+,messagingengine.com:+]; NEURAL_HAM_SHORT(-1.00)[-0.997,0]; RCPT_COUNT_SEVEN(0.00)[7]; NEURAL_HAM_MEDIUM(-0.84)[-0.841,0]; IP_SCORE(-3.47)[ip: (-9.81), ipnet: 66.111.4.0/24(-4.81), asn: 11403(-2.68), country: US(-0.05)]; RCVD_IN_DNSWL_LOW(-0.10)[28.4.111.66.list.dnswl.org : 127.0.5.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:11403, ipnet:66.111.4.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 16:22:31 -0000 > On Aug 7, 2019, at 10:00 AM, John Baldwin wrote: >=20 > On 8/6/19 9:56 AM, Glen Barber wrote: >> On Sat, Aug 03, 2019 at 01:06:18AM +0000, John Baldwin wrote: >>> Author: jhb >>> Date: Sat Aug 3 01:06:17 2019 >>> New Revision: 350550 >>> URL: https://svnweb.freebsd.org/changeset/base/350550 >>>=20 >>> Log: >>> Flip REPRODUCIBLE_BUILD back to off by default in head. >>>=20 >>> Having the full uname output can be useful on head even with >>> unmodified trees or trees that newvers.sh fails to recognize as >>> modified. >>>=20 >>> Reviewed by: emaste >>> Differential Revision: https://reviews.freebsd.org/D20895 >>>=20 >>=20 >> I would like to request this commit be reverted. While the original >> commit message to enable this knob stated the commit would be = reverted >> after stable/12 branched, I have seen no public complaints about >> enabling REPRODUCIBLE_BUILD by default (and quite honestly, do not = see >> the benefit of disabling it by default -- why wouldn't we want >> reproducibility?). >>=20 >> To me, this feels like a step backwards, with no tangible benefit. >> Note, newvers.sh does properly detect a modified tree if it can find >> the VCS metadata directory (i.e., .git, .svn) -- I know this because >> I personally helped with it. >>=20 >> In my opinion, those that want the non-reproducible metadata included = in >> output from 'uname -a' should set WITHOUT_REPRODUCIBLE_BUILDS in = their >> src.conf. Turning off a sane default for the benefit of what I = suspect >> is likely a short list of use cases feels like a step in the wrong >> direction. >=20 > My arguments for flipping this in head (and head only) are that the = data > provided in uname -a when this is disabled is useful for development, = and > that in head we do tailor settings towards development (e.g. GENERIC = in > head vs GENERIC in stable). I=E2=80=99m in favor of how this works at the moment. It was a bit = jarring to me when the reproducible build flag was turned on and I lost all of the metadata = that I subconsciously use during development. I think that what John has = done is an appropriate compromise and is in line with how we=E2=80=99ve = treated similar development-facilitating features in the past, i.e. WITNESS/INVARIANTS, malloc-debug. Scott From owner-svn-src-head@freebsd.org Wed Aug 7 16:24:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9904AF165; Wed, 7 Aug 2019 16:24:08 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463cJm43NPz3Q8J; Wed, 7 Aug 2019 16:24:08 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 865EEF5A9; Wed, 7 Aug 2019 16:24:08 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77GO899074120; Wed, 7 Aug 2019 16:24:08 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77GO8ih074119; Wed, 7 Aug 2019 16:24:08 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908071624.x77GO8ih074119@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 7 Aug 2019 16:24:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350680 - head X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 350680 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 16:24:08 -0000 Author: asomers Date: Wed Aug 7 16:24:08 2019 New Revision: 350680 URL: https://svnweb.freebsd.org/changeset/base/350680 Log: RELNOTES: fix formatting from r350482 MFC after: Never Sponsored by: The FreeBSD Foundation Modified: head/RELNOTES Modified: head/RELNOTES ============================================================================== --- head/RELNOTES Wed Aug 7 16:22:25 2019 (r350679) +++ head/RELNOTES Wed Aug 7 16:24:08 2019 (r350680) @@ -11,8 +11,8 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. r350471: - gnop(8) can now configure a delay to be applied to read and write - request delays. See the -d, -q and -x parameters. + gnop(8) can now configure a delay to be applied to read and write + request delays. See the -d, -q and -x parameters. r350315, r350316: Adds a Linux compatible copy_file_range(2) syscall. From owner-svn-src-head@freebsd.org Wed Aug 7 16:24:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 391E8AF1D8 for ; Wed, 7 Aug 2019 16:24:28 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463cK73Vtqz3QH7 for ; Wed, 7 Aug 2019 16:24:27 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x842.google.com with SMTP id z4so89000660qtc.3 for ; Wed, 07 Aug 2019 09:24:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=n/Fm0FCS2HN/Egvw1tVv9mTzTn+zuyiqDM0UJqSx95U=; b=KSwI6alfRd194gxkmaG1kk+I9U26/37IuXj5dRlnju7BtJ6UrZY8+lRHornhgVPL4o or6umLNauDh9MCLGjzTMq60mq5PxDu+JnqEa9Pddt5AuBjtv5Ti3cTY533Y0nKDF6G3o SC4xy3m/K0/gOKLY9ilKOCvfzVYba9XfO5f0/oMwF+uN2uJ2AjSnCHkvHZopRRg1IlOG C5TOi6uKPcNF0I1sErXlQh7ko+KC7vD6PysgiIXTxkQRZbx6HO53RHLPfggSu0kMT9dy 5UIWhqJsiUJLHqonyqLMNr0qTRdOP4semacgm4snwCy5/hBhjn82vr4BMprfg6IJmAt1 8oog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=n/Fm0FCS2HN/Egvw1tVv9mTzTn+zuyiqDM0UJqSx95U=; b=E0ESJLlZzhd9GBIH/AUyCTK6awVQHU2I+6jzPO8cfhL1Kil7nTScaG/ZuuMI7yqJ4c FY9jipQ+FDZweWCaMaOyRT0Uuzu8oNGxD6fg/muSgGKbUB1j9iq+LTCIykho2YOW3ZmL +ioGutFe2QYc7aAxYZlDpSohEVS8XMXTeCPRbscciELuNDIMWl1sq1od7VBdgf2UjVjh 5ntfxjeESWsJg82CN/zTr+LX2KVWS9MHWgpIYxuIVaCQvYmzEqOPmrjCMg/3wulm6lve k+neup2GoGvDWt4XWjpTtBrNyXjEopLvuv8RPC2aQvjD701QTwcxKW0rEkLyfrW1vJFy xJZg== X-Gm-Message-State: APjAAAWJXIQ3XGdun/M5wjdudoSOINEIqy5aVX2sQ7vi/V1Aki81e6Zb 8Ge7PmCkJVFebBewroj/rUIc0oNPvtZr097yQmmLRw== X-Google-Smtp-Source: APXvYqwPIS5Fu8qMlm+LvPNDUCqwirihb14S3rYhnkP7sFwj7QAWzcdjATO32i8RnBDgu5xmXkNYSo0ZL3aVlVU9gd8= X-Received: by 2002:ac8:2baa:: with SMTP id m39mr9005043qtm.242.1565195066321; Wed, 07 Aug 2019 09:24:26 -0700 (PDT) MIME-Version: 1.0 References: <201908030106.x7316Ibx078529@repo.freebsd.org> <20190806165614.GA41295@FreeBSD.org> <4e4d30b2-4801-2e53-6f26-49cb350445ec@FreeBSD.org> In-Reply-To: <4e4d30b2-4801-2e53-6f26-49cb350445ec@FreeBSD.org> From: Warner Losh Date: Wed, 7 Aug 2019 10:24:15 -0600 Message-ID: Subject: Re: svn commit: r350550 - head/share/mk To: John Baldwin Cc: Glen Barber , svn-src-head , "freebsd-hackers@freebsd.org" , svn-src-all , src-committers , "freebsd-arch@freebsd.org" X-Rspamd-Queue-Id: 463cK73Vtqz3QH7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=KSwI6alf; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::842) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-2.67 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-0.99)[-0.986,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[9]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.99)[-0.992,0]; RCVD_IN_DNSWL_NONE(0.00)[2.4.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCPT_COUNT_SEVEN(0.00)[7]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-0.70)[ip: (2.03), ipnet: 2607:f8b0::/32(-3.03), asn: 15169(-2.43), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 16:24:28 -0000 On Wed, Aug 7, 2019 at 10:01 AM John Baldwin wrote: > On 8/6/19 9:56 AM, Glen Barber wrote: > > On Sat, Aug 03, 2019 at 01:06:18AM +0000, John Baldwin wrote: > >> Author: jhb > >> Date: Sat Aug 3 01:06:17 2019 > >> New Revision: 350550 > >> URL: https://svnweb.freebsd.org/changeset/base/350550 > >> > >> Log: > >> Flip REPRODUCIBLE_BUILD back to off by default in head. > >> > >> Having the full uname output can be useful on head even with > >> unmodified trees or trees that newvers.sh fails to recognize as > >> modified. > >> > >> Reviewed by: emaste > >> Differential Revision: https://reviews.freebsd.org/D20895 > >> > > > > I would like to request this commit be reverted. While the original > > commit message to enable this knob stated the commit would be reverted > > after stable/12 branched, I have seen no public complaints about > > enabling REPRODUCIBLE_BUILD by default (and quite honestly, do not see > > the benefit of disabling it by default -- why wouldn't we want > > reproducibility?). > > > > To me, this feels like a step backwards, with no tangible benefit. > > Note, newvers.sh does properly detect a modified tree if it can find > > the VCS metadata directory (i.e., .git, .svn) -- I know this because > > I personally helped with it. > > > > In my opinion, those that want the non-reproducible metadata included in > > output from 'uname -a' should set WITHOUT_REPRODUCIBLE_BUILDS in their > > src.conf. Turning off a sane default for the benefit of what I suspect > > is likely a short list of use cases feels like a step in the wrong > > direction. > > My arguments for flipping this in head (and head only) are that the data > provided in uname -a when this is disabled is useful for development, and > that in head we do tailor settings towards development (e.g. GENERIC in > head vs GENERIC in stable). > > The logic to handle modified trees has an inherent assumption that I think > is false, at least for my workflow and I suspect many others. I do builds > and tests of kernels on separate machines (VMs or bare metal) from where I > use VCS to manage sources so that a kernel crash doesn't toast my source > tree. The trees are then shared to the build/test machines via NFS. As > a result, the build/test machines are not always able to detect that the > tree is modified either because a subset of the checkout is exported via > NFS, or the VCS tool isn't installed on the build/test machines because > they are generally barebones systems with only a base installed. This > does mean that flipping the knob off doesn't provide all of the same info, > but it does provide the path, and the path matters because 'kgdb -n last' > uses it, and because if you use separate directories for separate projects > (e.g. git worktrees), then the path tells you which test kernel you booted. > (It is not uncommon for me to have several test projects in flight on a > single test machine for different branches.) > > In the original discussion on arch, we collectively recognized that > developer builds vs release builds were different and needed different > defaults. The compromise reached at that time was to depend on the VCS > to detect developer builds to choose the policy. What I have found is that > in practice for at least my workflow that doesn't actually work. I posit > that the majority of kernels built from head are developer builds, not > releases, and that the default should cater to that. You could also always > patch release.sh to set WITH_REPRODUCIBLE_BUILD in the environment which I > think would give a more accurate sense of when builds are releases or not. > > However, I will yield to whatever the consensus is. > I'm with John here: the dirty tree stuff is too fragile for the diversity of development environments that are typical on -current, but not typical on -stable. We should not revert this. Warner From owner-svn-src-head@freebsd.org Wed Aug 7 16:42:35 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 75B11AFFAF; Wed, 7 Aug 2019 16:42:35 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463ck32cPvz3xB2; Wed, 7 Aug 2019 16:42:35 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3393BF95F; Wed, 7 Aug 2019 16:42:35 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77GgZul086331; Wed, 7 Aug 2019 16:42:35 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77GgZOE086330; Wed, 7 Aug 2019 16:42:35 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908071642.x77GgZOE086330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 7 Aug 2019 16:42:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350681 - head X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 350681 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 16:42:35 -0000 Author: asomers Date: Wed Aug 7 16:42:34 2019 New Revision: 350681 URL: https://svnweb.freebsd.org/changeset/base/350681 Log: Update RELNOTES for the fusefs rewrite MFC after: Never Sponsored by: The FreeBSD Foundation Modified: head/RELNOTES Modified: head/RELNOTES ============================================================================== --- head/RELNOTES Wed Aug 7 16:24:08 2019 (r350680) +++ head/RELNOTES Wed Aug 7 16:42:34 2019 (r350681) @@ -10,6 +10,26 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +r350665: + The fuse driver has been renamed to fusefs(5) and been substantially + rewritten. The new driver includes many bug fixes and performance + enhancements, as well as the following user-visible features: + * Optional kernel-side permissions checks (-o default_permissions) + * mknod(2), socket(2), and pipe(2) support + * server side locking with fcntl(2) + * FUSE operations are now interruptible when mounted with -o intr + * server side handling of UTIME_NOW during utimensat(2) + * mount options may be updated with "mount -u" + * fusefs file system may now be exported over NFS + * RLIMIT_FSIZE support + * support for fuse file systems using protocols as old as 7.4 + + FUSE file system developers should also take note of the following new + features: + * The protocol level has been raised from 7.8 to 7.23 + * kqueue support on /dev/fuse + * server-initiated cache invalidation via FUSE_NOTIFY_REPLY + r350471: gnop(8) can now configure a delay to be applied to read and write request delays. See the -d, -q and -x parameters. From owner-svn-src-head@freebsd.org Wed Aug 7 16:51:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9B86B070F; Wed, 7 Aug 2019 16:51:29 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 463cwJ11Jdz40Dw; Wed, 7 Aug 2019 16:51:27 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id vP9nh4MQlIhW9vP9ohW99b; Wed, 07 Aug 2019 10:51:26 -0600 X-Authority-Analysis: v=2.3 cv=FcFJO626 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=8nJEP1OIZ-IA:10 a=FmdZ9Uzk2mMA:10 a=-o65W9qwAAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=N3yCi80q97NF-fv9y40A:9 a=wPNLvfGTeEIA:10 a=1tiFkAoI0pxFi1YEbzhn:22 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 32E1030D; Wed, 7 Aug 2019 09:51:22 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x77GpLho055590; Wed, 7 Aug 2019 09:51:21 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x77GpLBR055551; Wed, 7 Aug 2019 09:51:21 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201908071651.x77GpLBR055551@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Scott Long cc: John Baldwin , Glen Barber , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, freebsd-hackers@freebsd.org, freebsd-arch@freebsd.org Subject: Re: svn commit: r350550 - head/share/mk In-reply-to: References: <201908030106.x7316Ibx078529@repo.freebsd.org> <20190806165614.GA41295@FreeBSD.org> <4e4d30b2-4801-2e53-6f26-49cb350445ec@FreeBSD.org> Comments: In-reply-to Scott Long message dated "Wed, 07 Aug 2019 10:22:24 -0600." Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: Wed, 07 Aug 2019 09:51:21 -0700 X-CMAE-Envelope: MS4wfD3GEMNYB235v89UuPrZvPA9ooszLwKhIXaveTtUWgl+RCuKVOeL/pE9e45rnZRgsgWD7g4Vag8Zu15QptSiER7CC9YU86hVxP4C1p05p6yOQY+FJs+L OYzvjmcQRTuIHCYZrECAI2PusblOheyxMT+Av9pKt2VygOcB4Lwh03mrJC26ocgCGAJlEow363Ir8uj7pOV0gQr8wxnqMdN8kHpPq6LKP1Iv6kqv3CWUtHsK 1RVTU4ImPrOsDiaCjHmpF9kYMq8wNlvNiuRa+Gq4XGQPHucaFvJIbk58XqQoKUZKkFeuQxXgcECrtY8vuz5devsZx3Dt2jkJm1kgZQcmpV8TF4LqpFirNuro KUWBf3Q/gBHttAZIFON7Z9vP2bmgiW8riW0zc5cKGeHpiJLwjYoz6RdZkSh9eTC8C6C1/ZEI X-Rspamd-Queue-Id: 463cwJ11Jdz40Dw X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.136.138) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-5.02 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-1.00)[-0.998,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; REPLYTO_EQ_FROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-0.998,0]; RCVD_IN_DNSWL_NONE(0.00)[138.136.59.64.list.dnswl.org : 127.0.5.0]; RCPT_COUNT_SEVEN(0.00)[8]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-2.42)[ip: (-6.37), ipnet: 64.59.128.0/20(-3.18), asn: 6327(-2.48), country: CA(-0.09)]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 16:51:29 -0000 In message , Scott Long writes : > > > > On Aug 7, 2019, at 10:00 AM, John Baldwin wrote: > > > > On 8/6/19 9:56 AM, Glen Barber wrote: > >> On Sat, Aug 03, 2019 at 01:06:18AM +0000, John Baldwin wrote: > >>> Author: jhb > >>> Date: Sat Aug 3 01:06:17 2019 > >>> New Revision: 350550 > >>> URL: https://svnweb.freebsd.org/changeset/base/350550 > >>> > >>> Log: > >>> Flip REPRODUCIBLE_BUILD back to off by default in head. > >>> > >>> Having the full uname output can be useful on head even with > >>> unmodified trees or trees that newvers.sh fails to recognize as > >>> modified. > >>> > >>> Reviewed by: emaste > >>> Differential Revision: https://reviews.freebsd.org/D20895 > >>> > >> > >> I would like to request this commit be reverted. While the original > >> commit message to enable this knob stated the commit would be reverted > >> after stable/12 branched, I have seen no public complaints about > >> enabling REPRODUCIBLE_BUILD by default (and quite honestly, do not see > >> the benefit of disabling it by default -- why wouldn't we want > >> reproducibility?). > >> > >> To me, this feels like a step backwards, with no tangible benefit. > >> Note, newvers.sh does properly detect a modified tree if it can find > >> the VCS metadata directory (i.e., .git, .svn) -- I know this because > >> I personally helped with it. > >> > >> In my opinion, those that want the non-reproducible metadata included in > >> output from 'uname -a' should set WITHOUT_REPRODUCIBLE_BUILDS in their > >> src.conf. Turning off a sane default for the benefit of what I suspect > >> is likely a short list of use cases feels like a step in the wrong > >> direction. > > > > My arguments for flipping this in head (and head only) are that the data > > provided in uname -a when this is disabled is useful for development, and > > that in head we do tailor settings towards development (e.g. GENERIC in > > head vs GENERIC in stable). > > I’m in favor of how this works at the moment. It was a bit jarring to me w > hen > the reproducible build flag was turned on and I lost all of the metadata that > I subconsciously use during development. I think that what John has done > is an appropriate compromise and is in line with how we’ve treated similar > development-facilitating features in the past, i.e. WITNESS/INVARIANTS, > malloc-debug. Agreed. As with John, I have a combination of git and svn trees on various machines. Some install to different partitions on physical hardware while others are tested in VMs. The extra information is handy in keeping track of what is installed where. End users who are concerned about reproducible builds in what we might call pseudo-production will probably not use WITNESS or INVARIANTS either. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Wed Aug 7 16:56:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8ED0EB0CA9; Wed, 7 Aug 2019 16:56:01 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463d1Y3G5zz40nl; Wed, 7 Aug 2019 16:56:01 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CE52FB60; Wed, 7 Aug 2019 16:56:01 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77Gu1tj094474; Wed, 7 Aug 2019 16:56:01 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77Gu0wZ094472; Wed, 7 Aug 2019 16:56:00 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201908071656.x77Gu0wZ094472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 7 Aug 2019 16:56:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350682 - in head/sbin: fsck_ffs newfs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: in head/sbin: fsck_ffs newfs X-SVN-Commit-Revision: 350682 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 16:56:01 -0000 Author: mckusick Date: Wed Aug 7 16:56:00 2019 New Revision: 350682 URL: https://svnweb.freebsd.org/changeset/base/350682 Log: Correct the location of the first backup superblock in fsck_ffs.8. Make a note in the newfs.8 manual page to update the first backup superblock location when changing the default fragment size for the filesystem. Reported by: O. Hartmann Modified: head/sbin/fsck_ffs/fsck_ffs.8 head/sbin/newfs/newfs.8 Modified: head/sbin/fsck_ffs/fsck_ffs.8 ============================================================================== --- head/sbin/fsck_ffs/fsck_ffs.8 Wed Aug 7 16:42:34 2019 (r350681) +++ head/sbin/fsck_ffs/fsck_ffs.8 Wed Aug 7 16:56:00 2019 (r350682) @@ -153,7 +153,7 @@ exits without attempting any further cleaning. Use the block specified immediately after the flag as the super block for the file system. An alternate super block is usually located at block 32 for UFS1, -and block 160 for UFS2. +and block 192 for UFS2. .Pp See the .Fl N Modified: head/sbin/newfs/newfs.8 ============================================================================== --- head/sbin/newfs/newfs.8 Wed Aug 7 16:42:34 2019 (r350681) +++ head/sbin/newfs/newfs.8 Wed Aug 7 16:56:00 2019 (r350682) @@ -111,6 +111,9 @@ for more details on how to set this option. .It Fl b Ar block-size The block size of the file system, in bytes. It must be a power of 2. +.\" If changing the default block size and it causes the default +.\" fragment size to change, be sure to update the location of +.\" the first backup superblock on the fsck_ffs.8 manual page. The default size is 32768 bytes, and the smallest allowable size is 4096 bytes. The optimal block:fragment ratio is 8:1. @@ -143,6 +146,9 @@ ranging in value between .Ar blocksize Ns /8 and .Ar blocksize . +.\" If changing the default fragment size or it changes because of a +.\" change to the default block size, be sure to update the location +.\" of the first backup superblock on the fsck_ffs.8 manual page. The default is 4096 bytes. .It Fl g Ar avgfilesize The expected average file size for the file system. From owner-svn-src-head@freebsd.org Wed Aug 7 16:58:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8AC9FB0D77; Wed, 7 Aug 2019 16:58:10 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463d4239F0z40xL; Wed, 7 Aug 2019 16:58:10 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from [192.168.0.5] (unknown [181.52.72.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: pfg) by smtp.freebsd.org (Postfix) with ESMTPSA id C031315A91; Wed, 7 Aug 2019 16:58:09 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Subject: Re: svn commit: r350550 - head/share/mk To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org, freebsd-hackers@freebsd.org, freebsd-arch@freebsd.org References: <201908030106.x7316Ibx078529@repo.freebsd.org> <20190806165614.GA41295@FreeBSD.org> <4e4d30b2-4801-2e53-6f26-49cb350445ec@FreeBSD.org> From: Pedro Giffuni Organization: FreeBSD Message-ID: <86621ce5-3a8d-2e22-f146-3b0cc8252124@FreeBSD.org> Date: Wed, 7 Aug 2019 11:58:08 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <4e4d30b2-4801-2e53-6f26-49cb350445ec@FreeBSD.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 16:58:10 -0000 On 07/08/2019 11:00, John Baldwin wrote: > On 8/6/19 9:56 AM, Glen Barber wrote: >> On Sat, Aug 03, 2019 at 01:06:18AM +0000, John Baldwin wrote: >>> Author: jhb >>> Date: Sat Aug 3 01:06:17 2019 >>> New Revision: 350550 >>> URL: https://svnweb.freebsd.org/changeset/base/350550 >>> >>> Log: >>> Flip REPRODUCIBLE_BUILD back to off by default in head. >>> >>> Having the full uname output can be useful on head even with >>> unmodified trees or trees that newvers.sh fails to recognize as >>> modified. >>> >>> Reviewed by: emaste >>> Differential Revision: https://reviews.freebsd.org/D20895 >>> >> I would like to request this commit be reverted. While the original >> commit message to enable this knob stated the commit would be reverted >> after stable/12 branched, I have seen no public complaints about >> enabling REPRODUCIBLE_BUILD by default (and quite honestly, do not see >> the benefit of disabling it by default -- why wouldn't we want >> reproducibility?). >> >> To me, this feels like a step backwards, with no tangible benefit. >> Note, newvers.sh does properly detect a modified tree if it can find >> the VCS metadata directory (i.e., .git, .svn) -- I know this because >> I personally helped with it. >> >> In my opinion, those that want the non-reproducible metadata included in >> output from 'uname -a' should set WITHOUT_REPRODUCIBLE_BUILDS in their >> src.conf. Turning off a sane default for the benefit of what I suspect >> is likely a short list of use cases feels like a step in the wrong >> direction. > My arguments for flipping this in head (and head only) are that the data > provided in uname -a when this is disabled is useful for development, and > that in head we do tailor settings towards development (e.g. GENERIC in > head vs GENERIC in stable). > > The logic to handle modified trees has an inherent assumption that I think > is false, at least for my workflow and I suspect many others. I do builds > and tests of kernels on separate machines (VMs or bare metal) from where I > use VCS to manage sources so that a kernel crash doesn't toast my source > tree. The trees are then shared to the build/test machines via NFS. As > a result, the build/test machines are not always able to detect that the > tree is modified either because a subset of the checkout is exported via > NFS, or the VCS tool isn't installed on the build/test machines because > they are generally barebones systems with only a base installed. This > does mean that flipping the knob off doesn't provide all of the same info, > but it does provide the path, and the path matters because 'kgdb -n last' > uses it, and because if you use separate directories for separate projects > (e.g. git worktrees), then the path tells you which test kernel you booted. > (It is not uncommon for me to have several test projects in flight on a > single test machine for different branches.) > > In the original discussion on arch, we collectively recognized that > developer builds vs release builds were different and needed different > defaults. The compromise reached at that time was to depend on the VCS > to detect developer builds to choose the policy. What I have found is that > in practice for at least my workflow that doesn't actually work. I posit > that the majority of kernels built from head are developer builds, not > releases, and that the default should cater to that. You could also always > patch release.sh to set WITH_REPRODUCIBLE_BUILD in the environment which I > think would give a more accurate sense of when builds are releases or not. > > However, I will yield to whatever the consensus is. +1 keeping metadata in head. From owner-svn-src-head@freebsd.org Wed Aug 7 17:46:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D7C2B27C5; Wed, 7 Aug 2019 17:46:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463f7M74gzz44BT; Wed, 7 Aug 2019 17:46:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D4A7E1847C; Wed, 7 Aug 2019 17:46:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77Hk708024169; Wed, 7 Aug 2019 17:46:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77Hk7t2024168; Wed, 7 Aug 2019 17:46:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908071746.x77Hk7t2024168@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 7 Aug 2019 17:46:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350683 - head/share/man/man3 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/share/man/man3 X-SVN-Commit-Revision: 350683 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 17:46:08 -0000 Author: kib Date: Wed Aug 7 17:46:07 2019 New Revision: 350683 URL: https://svnweb.freebsd.org/changeset/base/350683 Log: Clarify the robustness guarantees. Wording submitted by: Martin Simmons MFC after: 3 days Modified: head/share/man/man3/pthread_mutex_lock.3 head/share/man/man3/pthread_mutex_trylock.3 Modified: head/share/man/man3/pthread_mutex_lock.3 ============================================================================== --- head/share/man/man3/pthread_mutex_lock.3 Wed Aug 7 16:56:00 2019 (r350682) +++ head/share/man/man3/pthread_mutex_lock.3 Wed Aug 7 17:46:07 2019 (r350683) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 29, 2016 +.Dd August 7, 2019 .Dt PTHREAD_MUTEX_LOCK 3 .Os .Sh NAME @@ -66,8 +66,8 @@ A deadlock would occur if the thread blocked waiting f .It Bq Er EOWNERDEAD The argument .Fa mutex -points to a robust mutex and the previous owning thread terminated -while holding the mutex lock. +points to a robust mutex and the process containing the previous owning +thread terminated while holding the mutex lock. The lock was granted to the caller and it is up to the new owner to make the state consistent. .It Bq Er ENOTRECOVERABLE Modified: head/share/man/man3/pthread_mutex_trylock.3 ============================================================================== --- head/share/man/man3/pthread_mutex_trylock.3 Wed Aug 7 16:56:00 2019 (r350682) +++ head/share/man/man3/pthread_mutex_trylock.3 Wed Aug 7 17:46:07 2019 (r350683) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 29, 2016 +.Dd August 7, 2019 .Dt PTHREAD_MUTEX_TRYLOCK 3 .Os .Sh NAME @@ -67,8 +67,8 @@ is already locked. .It Bq Er EOWNERDEAD The argument .Fa mutex -points to a robust mutex and the previous owning thread terminated -while holding the mutex lock. +points to a robust mutex and the process containing the previous owning +thread terminated while holding the mutex lock. The lock was granted to the caller and it is up to the new owner to make the state consistent. .It Bq Er ENOTRECOVERABLE From owner-svn-src-head@freebsd.org Wed Aug 7 17:51:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34D14B29EE; Wed, 7 Aug 2019 17:51:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463fFn0dFnz44Zr; Wed, 7 Aug 2019 17:51:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAACD185F5; Wed, 7 Aug 2019 17:51:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77HpeOL027631; Wed, 7 Aug 2019 17:51:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77HpeLg027268; Wed, 7 Aug 2019 17:51:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908071751.x77HpeLg027268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 7 Aug 2019 17:51:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350684 - head/share/man/man3 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/share/man/man3 X-SVN-Commit-Revision: 350684 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 17:51:41 -0000 Author: kib Date: Wed Aug 7 17:51:40 2019 New Revision: 350684 URL: https://svnweb.freebsd.org/changeset/base/350684 Log: More places to clarify the robustness guarantees. Wording submitted by: Martin Simmons MFC after: 3 days Modified: head/share/man/man3/pthread_cond_wait.3 head/share/man/man3/pthread_mutex_consistent.3 head/share/man/man3/pthread_mutex_timedlock.3 Modified: head/share/man/man3/pthread_cond_wait.3 ============================================================================== --- head/share/man/man3/pthread_cond_wait.3 Wed Aug 7 17:46:07 2019 (r350683) +++ head/share/man/man3/pthread_cond_wait.3 Wed Aug 7 17:51:40 2019 (r350684) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 17, 2018 +.Dd August 7, 2019 .Dt PTHREAD_COND_WAIT 3 .Os .Sh NAME @@ -78,8 +78,8 @@ was not locked by the calling thread. .It Bq Er EOWNERDEAD The argument .Fa mutex -points to a robust mutex and the previous owning thread terminated -while holding the mutex lock. +points to a robust mutex and the process containing the previous owning +thread terminated while holding the mutex lock. The lock was granted to the caller and it is up to the new owner to make the state consistent. .It Bq Er ENOTRECOVERABLE Modified: head/share/man/man3/pthread_mutex_consistent.3 ============================================================================== --- head/share/man/man3/pthread_mutex_consistent.3 Wed Aug 7 17:46:07 2019 (r350683) +++ head/share/man/man3/pthread_mutex_consistent.3 Wed Aug 7 17:51:40 2019 (r350684) @@ -41,9 +41,9 @@ .Ft int .Fn pthread_mutex_consistent "pthread_mutex_t *mutex" .Sh DESCRIPTION -If the thread owning a robust mutex terminates while holding the -mutex, the mutex becomes inconsistent and the next thread that -acquires the mutex lock is notified of the state by the return value +If the process containing the thread owning a robust mutex terminates +while holding the mutex, the mutex becomes inconsistent and the next thread +that acquires the mutex lock is notified of the state by the return value .Er EOWNERDEAD . In this case, the mutex does not become normally usable again until the state is marked consistent. Modified: head/share/man/man3/pthread_mutex_timedlock.3 ============================================================================== --- head/share/man/man3/pthread_mutex_timedlock.3 Wed Aug 7 17:46:07 2019 (r350683) +++ head/share/man/man3/pthread_mutex_timedlock.3 Wed Aug 7 17:51:40 2019 (r350684) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 17, 2018 +.Dd August 7, 2019 .Dt PTHREAD_MUTEX_TIMEDLOCK 3 .Os .Sh NAME @@ -92,8 +92,8 @@ The current thread already owns the .It Bq Er EOWNERDEAD The argument .Fa mutex -points to a robust mutex and the previous owning thread terminated -while holding the mutex lock. +points to a robust mutex and the process containing the previous owning +thread terminated while holding the mutex lock. The lock was granted to the caller and it is up to the new owner to make the state consistent. .It Bq Er ENOTRECOVERABLE From owner-svn-src-head@freebsd.org Wed Aug 7 18:14:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0432B362C; Wed, 7 Aug 2019 18:14:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463fmR4N4Rz46QN; Wed, 7 Aug 2019 18:14:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72AD8189FD; Wed, 7 Aug 2019 18:14:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77IElcT042389; Wed, 7 Aug 2019 18:14:47 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77IEjMh042379; Wed, 7 Aug 2019 18:14:45 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201908071814.x77IEjMh042379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 7 Aug 2019 18:14:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350685 - in head: share/man/man4 sys/conf sys/dev/usb sys/dev/usb/net sys/dev/usb/template sys/modules/usb sys/modules/usb/cdceem sys/modules/usb/template X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head: share/man/man4 sys/conf sys/dev/usb sys/dev/usb/net sys/dev/usb/template sys/modules/usb sys/modules/usb/cdceem sys/modules/usb/template X-SVN-Commit-Revision: 350685 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 18:14:47 -0000 Author: trasz Date: Wed Aug 7 18:14:45 2019 New Revision: 350685 URL: https://svnweb.freebsd.org/changeset/base/350685 Log: Add cdceem(4) driver, for virtual ethernet devices compliant with Communication Device Class Ethernet Emulation Model (CDC EEM). The driver supports both the device, and host side operation; there is a new USB template (#11) for the former. This enables communication with virtual USB NIC provided by iLO 5, as found in new HPE Proliant servers. Reviewed by: hselasky MFC after: 2 weeks Relnotes: yes Sponsored by: Hewlett Packard Enterprise Added: head/share/man/man4/cdceem.4 (contents, props changed) head/sys/dev/usb/net/if_cdceem.c (contents, props changed) head/sys/dev/usb/template/usb_template_cdceem.c (contents, props changed) head/sys/modules/usb/cdceem/ head/sys/modules/usb/cdceem/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/share/man/man4/cdce.4 head/share/man/man4/ipheth.4 head/share/man/man4/urndis.4 head/share/man/man4/usb_template.4 head/sys/conf/files head/sys/dev/usb/template/usb_template.c head/sys/dev/usb/template/usb_template.h head/sys/dev/usb/usb.h head/sys/dev/usb/usb_ioctl.h head/sys/modules/usb/Makefile head/sys/modules/usb/template/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Wed Aug 7 17:51:40 2019 (r350684) +++ head/share/man/man4/Makefile Wed Aug 7 18:14:45 2019 (r350685) @@ -103,6 +103,7 @@ MAN= aac.4 \ ccr.4 \ cd.4 \ cdce.4 \ + cdceem.4 \ cfi.4 \ cfumass.4 \ ch.4 \ Modified: head/share/man/man4/cdce.4 ============================================================================== --- head/share/man/man4/cdce.4 Wed Aug 7 17:51:40 2019 (r350684) +++ head/share/man/man4/cdce.4 Wed Aug 7 18:14:45 2019 (r350685) @@ -121,6 +121,7 @@ is running low on mbufs. .El .Sh SEE ALSO .Xr arp 4 , +.Xr cdceem 4 , .Xr intro 4 , .Xr ipheth 4 , .Xr netintro 4 , Added: head/share/man/man4/cdceem.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/cdceem.4 Wed Aug 7 18:14:45 2019 (r350685) @@ -0,0 +1,119 @@ +.\" Copyright (c) 2019 Edward Tomasz Napierala +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.Dd August 7, 2019 +.Dt CDCEEM 4 +.Os +.Sh NAME +.Nm cdceem +.Nd "USB Communication Device Class Ethernet Emulation Model (CDC EEM) driver" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device uhci" +.Cd "device ohci" +.Cd "device usb" +.Cd "device miibus" +.Cd "device uether" +.Cd "device cdceem" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_cdceem_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for USB devices based on the USB Communication +Device Class Ethernet Emulation Model (CDC EEM) specification. +.Pp +The driver works on both host, and device-side; see +.Xr usb_template 4 +for details. +.Pp +The USB device appears as a regular network interface on both sides, +transporting Ethernet frames. +.Pp +For more information on configuring this device, see +.Xr ifconfig 8 . +.Pp +The +.Nm +driver does not support different media types or options. +.Sh SYSCTL VARIABLES +The following variables are available as both +.Xr sysctl 8 +variables and +.Xr loader 8 +tunables: +.Bl -tag -width indent +.It Va hw.usb.cdceem.debug +Verbosity level for log messages from the +.Nm +driver. +Set to 0 to disable logging or 1 to warn about potential problems. +Larger values enable debugging output. +Defaults to 1. +.It Va hw.usb.cdceem.send_echoes +If set to 1, the driver will send an Echo EEM packet when the +interface is brought up. +While responding to Echo is mandatory, some devices cannot handle it. +Only use for debugging. +Defaults to 0. +.It Va hw.usb.cdceem.send_fake_crc +If set to 1, the driver will use 0xdeadbeef as the CRC value +for outgoing Data EEM packets. +Only use for debugging. +Defaults to 0. +.El +.Sh SEE ALSO +.Xr arp 4 , +.Xr cdce 4 , +.Xr intro 4 , +.Xr ipheth 4 , +.Xr netintro 4 , +.Xr urndis 4 , +.Xr usb 4 , +.Xr usb_template 4 , +.Xr ifconfig 8 +.Rs +.%T "Universal Serial Bus Communications Class Subclass Specification for Ethernet Emulation Model Devices" +.%U https://usb.org/sites/default/files/CDC_EEM10.pdf +.Re +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 13.0 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org +under sponsorship from Hewlett Packard Enterprise. Modified: head/share/man/man4/ipheth.4 ============================================================================== --- head/share/man/man4/ipheth.4 Wed Aug 7 17:51:40 2019 (r350684) +++ head/share/man/man4/ipheth.4 Wed Aug 7 18:14:45 2019 (r350685) @@ -159,6 +159,7 @@ The machine should now be connected to the network via .Sh SEE ALSO .Xr arp 4 , .Xr cdce 4 , +.Xr cdceem 4 , .Xr intro 4 , .Xr netintro 4 , .Xr urndis 4 , Modified: head/share/man/man4/urndis.4 ============================================================================== --- head/share/man/man4/urndis.4 Wed Aug 7 17:51:40 2019 (r350684) +++ head/share/man/man4/urndis.4 Wed Aug 7 18:14:45 2019 (r350685) @@ -79,6 +79,7 @@ functionality of many Android devices. .Sh SEE ALSO .Xr arp 4 , .Xr cdce 4 , +.Xr cdceem 4 , .Xr ipheth 4 , .Xr netintro 4 , .Xr usb 4 , Modified: head/share/man/man4/usb_template.4 ============================================================================== --- head/share/man/man4/usb_template.4 Wed Aug 7 17:51:40 2019 (r350684) +++ head/share/man/man4/usb_template.4 Wed Aug 7 18:14:45 2019 (r350685) @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 24, 2018 +.Dd August 7, 2019 .Dt USB_TEMPLATE 4 .Os . @@ -88,6 +88,8 @@ Available templates are: .It Dv 8 Ta CDC Ethernet and serial port .It Dv 9 Ta USB MIDI .It Dv 10 Ta CDC Ethernet, serial port, and storage +.It Dv 11 Ta CDC Ethernet Emulation Model, see +.Xr cdceem 4 .El . .Sh SYSCTL VARIABLES Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Aug 7 17:51:40 2019 (r350684) +++ head/sys/conf/files Wed Aug 7 18:14:45 2019 (r350685) @@ -3231,6 +3231,7 @@ dev/usb/net/if_aue.c optional aue dev/usb/net/if_axe.c optional axe dev/usb/net/if_axge.c optional axge dev/usb/net/if_cdce.c optional cdce +dev/usb/net/if_cdceem.c optional cdceem dev/usb/net/if_cue.c optional cue dev/usb/net/if_ipheth.c optional ipheth dev/usb/net/if_kue.c optional kue @@ -3244,8 +3245,8 @@ dev/usb/net/if_usie.c optional usie dev/usb/net/if_urndis.c optional urndis dev/usb/net/ruephy.c optional rue dev/usb/net/usb_ethernet.c optional uether | aue | axe | axge | cdce | \ - cue | ipheth | kue | mos | rue | \ - smsc | udav | ure | urndis | muge + cdceem | cue | ipheth | kue | mos | \ + rue | smsc | udav | ure | urndis | muge dev/usb/net/uhso.c optional uhso # # USB WLAN drivers @@ -3350,6 +3351,7 @@ dev/usb/template/usb_template_phone.c optional usb_tem dev/usb/template/usb_template_serialnet.c optional usb_template dev/usb/template/usb_template_midi.c optional usb_template dev/usb/template/usb_template_multi.c optional usb_template +dev/usb/template/usb_template_cdceem.c optional usb_template # # USB video drivers # Added: head/sys/dev/usb/net/if_cdceem.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/usb/net/if_cdceem.c Wed Aug 7 18:14:45 2019 (r350685) @@ -0,0 +1,870 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (C) 2012 Ben Gray . + * Copyright (C) 2018 The FreeBSD Foundation. + * Copyright (c) 2019 Edward Tomasz Napierala + * + * This software was developed by Arshan Khanifar + * under sponsorship from the FreeBSD Foundation. + * + * 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. + */ + +/* + * Universal Serial Bus Communications Class Subclass Specification + * for Ethernet Emulation Model Devices: + * + * https://usb.org/sites/default/files/CDC_EEM10.pdf + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include "usbdevs.h" + +#define USB_DEBUG_VAR cdceem_debug +#include +#include +#include +#include "usb_if.h" + +#include + +#define CDCEEM_FRAMES_MAX 1 +#define CDCEEM_ECHO_MAX 1024 + +#define CDCEEM_ECHO_PAYLOAD \ + "ICH DALEKOPIS FALSZUJE GDY PROBY XQV NIE WYTRZYMUJE 1234567890" + +enum { + CDCEEM_BULK_RX, + CDCEEM_BULK_TX, + CDCEEM_N_TRANSFER, +}; + +struct cdceem_softc { + struct usb_ether sc_ue; + struct mtx sc_mtx; + int sc_flags; + struct usb_xfer *sc_xfer[CDCEEM_N_TRANSFER]; + size_t sc_echo_len; + char sc_echo_buffer[CDCEEM_ECHO_MAX]; +}; + +#define CDCEEM_SC_FLAGS_ECHO_RESPONSE_PENDING 0x1 +#define CDCEEM_SC_FLAGS_ECHO_PENDING 0x2 + +static SYSCTL_NODE(_hw_usb, OID_AUTO, cdceem, CTLFLAG_RW, 0, "USB CDC EEM"); +static int cdceem_debug = 1; +SYSCTL_INT(_hw_usb_cdceem, OID_AUTO, debug, CTLFLAG_RWTUN, + &cdceem_debug, 0, "Debug level"); +static int cdceem_send_echoes = 0; +SYSCTL_INT(_hw_usb_cdceem, OID_AUTO, send_echoes, CTLFLAG_RWTUN, + &cdceem_send_echoes, 0, "Send an Echo command"); +static int cdceem_send_fake_crc = 0; +SYSCTL_INT(_hw_usb_cdceem, OID_AUTO, send_fake_crc, CTLFLAG_RWTUN, + &cdceem_send_fake_crc, 0, "Use 0xdeadbeef instead of CRC"); + +#define CDCEEM_DEBUG(S, X, ...) \ + do { \ + if (cdceem_debug > 1) { \ + device_printf(S->sc_ue.ue_dev, "%s: " X "\n", \ + __func__, ## __VA_ARGS__); \ + } \ + } while (0) + +#define CDCEEM_WARN(S, X, ...) \ + do { \ + if (cdceem_debug > 0) { \ + device_printf(S->sc_ue.ue_dev, \ + "WARNING: %s: " X "\n", \ + __func__, ## __VA_ARGS__); \ + } \ + } while (0) + +#define CDCEEM_LOCK(X) mtx_lock(&(X)->sc_mtx) +#define CDCEEM_UNLOCK(X) mtx_unlock(&(X)->sc_mtx) + +#define CDCEEM_TYPE_CMD (0x1 << 15) + +#define CDCEEM_CMD_MASK (0x7 << 11) + +#define CDCEEM_CMD_ECHO (0x0 << 11) +#define CDCEEM_CMD_ECHO_RESPONSE (0x1 << 11) +#define CDCEEM_CMD_SUSPEND_HINT (0x2 << 11) +#define CDCEEM_CMD_RESPONSE_HINT (0x3 << 11) +#define CDCEEM_CMD_RESPONSE_COMPLETE_HINT (0x4 << 11) +#define CDCEEM_CMD_TICKLE (0x5 << 11) + +#define CDCEEM_CMD_RESERVED (0x1 << 14) + +#define CDCEEM_ECHO_LEN_MASK 0x3ff + +#define CDCEEM_DATA_CRC (0x1 << 14) +#define CDCEEM_DATA_LEN_MASK 0x3fff + +static device_probe_t cdceem_probe; +static device_attach_t cdceem_attach; +static device_detach_t cdceem_detach; +static device_suspend_t cdceem_suspend; +static device_resume_t cdceem_resume; + +static usb_callback_t cdceem_bulk_write_callback; +static usb_callback_t cdceem_bulk_read_callback; + +static uether_fn_t cdceem_attach_post; +static uether_fn_t cdceem_init; +static uether_fn_t cdceem_stop; +static uether_fn_t cdceem_start; +static uether_fn_t cdceem_setmulti; +static uether_fn_t cdceem_setpromisc; + +static uint32_t cdceem_m_crc32(struct mbuf *, uint32_t, uint32_t); + +static const struct usb_config cdceem_config[CDCEEM_N_TRANSFER] = { + [CDCEEM_BULK_TX] = { + .type = UE_BULK, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_TX, + .bufsize = 16 * (MCLBYTES + 16), + .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, + .callback = cdceem_bulk_write_callback, + .timeout = 10000, /* 10 seconds */ + .usb_mode = USB_MODE_DUAL, + }, + + [CDCEEM_BULK_RX] = { + .type = UE_BULK, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_RX, + .bufsize = 20480, /* bytes */ + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .callback = cdceem_bulk_read_callback, + .timeout = 0, /* no timeout */ + .usb_mode = USB_MODE_DUAL, + }, +}; + +static device_method_t cdceem_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, cdceem_probe), + DEVMETHOD(device_attach, cdceem_attach), + DEVMETHOD(device_detach, cdceem_detach), + DEVMETHOD(device_suspend, cdceem_suspend), + DEVMETHOD(device_resume, cdceem_resume), + + DEVMETHOD_END +}; + +static driver_t cdceem_driver = { + .name = "cdceem", + .methods = cdceem_methods, + .size = sizeof(struct cdceem_softc), +}; + +static devclass_t cdceem_devclass; + +static const STRUCT_USB_DUAL_ID cdceem_dual_devs[] = { + {USB_IFACE_CLASS(UICLASS_CDC), + USB_IFACE_SUBCLASS(UISUBCLASS_ETHERNET_EMULATION_MODEL), + 0}, +}; + +DRIVER_MODULE(cdceem, uhub, cdceem_driver, cdceem_devclass, NULL, NULL); +MODULE_VERSION(cdceem, 1); +MODULE_DEPEND(cdceem, uether, 1, 1, 1); +MODULE_DEPEND(cdceem, usb, 1, 1, 1); +MODULE_DEPEND(cdceem, ether, 1, 1, 1); +USB_PNP_DUAL_INFO(cdceem_dual_devs); + +static const struct usb_ether_methods cdceem_ue_methods = { + .ue_attach_post = cdceem_attach_post, + .ue_start = cdceem_start, + .ue_init = cdceem_init, + .ue_stop = cdceem_stop, + .ue_setmulti = cdceem_setmulti, + .ue_setpromisc = cdceem_setpromisc, +}; + +static int +cdceem_probe(device_t dev) +{ + struct usb_attach_arg *uaa; + int error; + + uaa = device_get_ivars(dev); + error = usbd_lookup_id_by_uaa(cdceem_dual_devs, + sizeof(cdceem_dual_devs), uaa); + + return (error); +} + +static void +cdceem_attach_post(struct usb_ether *ue) +{ + + return; +} + +static int +cdceem_attach(device_t dev) +{ + struct cdceem_softc *sc; + struct usb_ether *ue; + struct usb_attach_arg *uaa; + int error; + uint8_t iface_index; + + sc = device_get_softc(dev); + ue = &sc->sc_ue; + uaa = device_get_ivars(dev); + + device_set_usb_desc(dev); + + mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); + + /* Setup the endpoints. */ + iface_index = 0; + error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, + cdceem_config, CDCEEM_N_TRANSFER, sc, &sc->sc_mtx); + if (error != 0) { + CDCEEM_WARN(sc, + "allocating USB transfers failed, error %d", error); + mtx_destroy(&sc->sc_mtx); + return (error); + } + + /* Random MAC address. */ + arc4rand(ue->ue_eaddr, ETHER_ADDR_LEN, 0); + ue->ue_eaddr[0] &= ~0x01; /* unicast */ + ue->ue_eaddr[0] |= 0x02; /* locally administered */ + + ue->ue_sc = sc; + ue->ue_dev = dev; + ue->ue_udev = uaa->device; + ue->ue_mtx = &sc->sc_mtx; + ue->ue_methods = &cdceem_ue_methods; + + error = uether_ifattach(ue); + if (error != 0) { + CDCEEM_WARN(sc, "could not attach interface, error %d", error); + usbd_transfer_unsetup(sc->sc_xfer, CDCEEM_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); + return (error); + } + + return (0); +} + +static int +cdceem_detach(device_t dev) +{ + struct cdceem_softc *sc = device_get_softc(dev); + struct usb_ether *ue = &sc->sc_ue; + + /* Stop all USB transfers first. */ + usbd_transfer_unsetup(sc->sc_xfer, CDCEEM_N_TRANSFER); + uether_ifdetach(ue); + mtx_destroy(&sc->sc_mtx); + + return (0); +} + +static void +cdceem_handle_cmd(struct usb_xfer *xfer, uint16_t hdr, int *offp) +{ + struct cdceem_softc *sc; + struct usb_page_cache *pc; + int actlen, off; + uint16_t pktlen; + + off = *offp; + sc = usbd_xfer_softc(xfer); + pc = usbd_xfer_get_frame(xfer, 0); + usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); + + if (hdr & CDCEEM_CMD_RESERVED) { + CDCEEM_WARN(sc, "received command header %#x " + "with Reserved bit set; ignoring", hdr); + return; + } + + switch (hdr & CDCEEM_CMD_MASK) { + case CDCEEM_CMD_ECHO: + pktlen = hdr & CDCEEM_ECHO_LEN_MASK; + CDCEEM_DEBUG(sc, "received Echo, length %d", pktlen); + + if (pktlen > (actlen - off)) { + CDCEEM_WARN(sc, + "bad Echo length %d, should be at most %d", + pktlen, actlen - off); + break; + } + + if (pktlen > sizeof(sc->sc_echo_buffer)) { + CDCEEM_WARN(sc, + "Echo length %u too big, must be less than %zd", + pktlen, sizeof(sc->sc_echo_buffer)); + break; + } + + sc->sc_flags |= CDCEEM_SC_FLAGS_ECHO_RESPONSE_PENDING; + sc->sc_echo_len = pktlen; + usbd_copy_out(pc, off, sc->sc_echo_buffer, pktlen); + off += pktlen; + break; + + case CDCEEM_CMD_ECHO_RESPONSE: + pktlen = hdr & CDCEEM_ECHO_LEN_MASK; + CDCEEM_DEBUG(sc, "received Echo Response, length %d", pktlen); + + if (pktlen > (actlen - off)) { + CDCEEM_WARN(sc, + "bad Echo Response length %d, " + "should be at most %d", + pktlen, actlen - off); + break; + } + + if (pktlen != sizeof(CDCEEM_ECHO_PAYLOAD)) { + CDCEEM_WARN(sc, "received Echo Response with bad " + "length %hu, should be %zd", + pktlen, sizeof(CDCEEM_ECHO_PAYLOAD)); + break; + } + + usbd_copy_out(pc, off, sc->sc_echo_buffer, pktlen); + off += pktlen; + + if (memcmp(sc->sc_echo_buffer, CDCEEM_ECHO_PAYLOAD, + sizeof(CDCEEM_ECHO_PAYLOAD)) != 0) { + CDCEEM_WARN(sc, + "received Echo Response payload does not match"); + } else { + CDCEEM_DEBUG(sc, "received Echo Response is valid"); + } + break; + + case CDCEEM_CMD_SUSPEND_HINT: + CDCEEM_DEBUG(sc, "received SuspendHint; ignoring"); + break; + + case CDCEEM_CMD_RESPONSE_HINT: + CDCEEM_DEBUG(sc, "received ResponseHint; ignoring"); + break; + + case CDCEEM_CMD_RESPONSE_COMPLETE_HINT: + CDCEEM_DEBUG(sc, "received ResponseCompleteHint; ignoring"); + break; + + case CDCEEM_CMD_TICKLE: + CDCEEM_DEBUG(sc, "received Tickle; ignoring"); + break; + + default: + CDCEEM_WARN(sc, + "received unknown command %u, header %#x; ignoring", + (hdr & CDCEEM_CMD_MASK >> 11), hdr); + break; + } + + *offp = off; +} + +static void +cdceem_handle_data(struct usb_xfer *xfer, uint16_t hdr, int *offp) +{ + struct cdceem_softc *sc; + struct usb_page_cache *pc; + struct usb_ether *ue; + struct ifnet *ifp; + struct mbuf *m; + int actlen, off; + uint32_t computed_crc, received_crc; + uint16_t pktlen; + + off = *offp; + sc = usbd_xfer_softc(xfer); + pc = usbd_xfer_get_frame(xfer, 0); + ue = &sc->sc_ue; + ifp = uether_getifp(ue); + usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); + + pktlen = hdr & CDCEEM_DATA_LEN_MASK; + CDCEEM_DEBUG(sc, "received Data, CRC %s, length %d", + (hdr & CDCEEM_DATA_CRC) ? "valid" : "absent", + pktlen); + + if (pktlen < ETHER_HDR_LEN) { + CDCEEM_WARN(sc, + "bad ethernet frame length %d, should be at least %d", + pktlen, ETHER_HDR_LEN); + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); + return; + } + + if (pktlen > (actlen - off)) { + CDCEEM_WARN(sc, + "bad ethernet frame length %d, should be at most %d", + pktlen, actlen - off); + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); + return; + } + + m = uether_newbuf(); + if (m == NULL) { + CDCEEM_WARN(sc, "uether_newbuf() failed"); + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); + return; + } + + pktlen -= 4; /* Subtract the CRC. */ + usbd_copy_out(pc, off, mtod(m, uint8_t *), pktlen); + off += pktlen; + + usbd_copy_out(pc, off, &received_crc, sizeof(received_crc)); + off += sizeof(received_crc); + + if (hdr & CDCEEM_DATA_CRC) { + computed_crc = cdceem_m_crc32(m, 0, pktlen); + } else { + computed_crc = be32toh(0xdeadbeef); + } + + if (received_crc != computed_crc) { + CDCEEM_WARN(sc, + "received Data packet with wrong CRC %#x, expected %#x", + received_crc, computed_crc); + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); + m_freem(m); + return; + } else { + CDCEEM_DEBUG(sc, "received correct CRC %#x", received_crc); + } + + uether_rxmbuf(ue, m, pktlen); + *offp = off; +} + +static void +cdceem_bulk_read_callback(struct usb_xfer *xfer, usb_error_t usb_error) +{ + struct cdceem_softc *sc; + struct usb_page_cache *pc; + int actlen, aframes, off; + uint16_t hdr; + + sc = usbd_xfer_softc(xfer); + usbd_xfer_status(xfer, &actlen, NULL, &aframes, NULL); + + switch (USB_GET_STATE(xfer)) { + case USB_ST_TRANSFERRED: + CDCEEM_DEBUG(sc, + "received %u bytes in %u frames", actlen, aframes); + + pc = usbd_xfer_get_frame(xfer, 0); + off = 0; + + while (off < actlen) { + usbd_copy_out(pc, off, &hdr, sizeof(hdr)); + CDCEEM_DEBUG(sc, "hdr = %#x", hdr); + off += sizeof(hdr); + + if (hdr == 0) { + CDCEEM_DEBUG(sc, "received Zero Length EEM"); + continue; + } + + hdr = le16toh(hdr); + + if ((hdr & CDCEEM_TYPE_CMD) != 0) { + cdceem_handle_cmd(xfer, hdr, &off); + } else { + cdceem_handle_data(xfer, hdr, &off); + } + + KASSERT(off <= actlen, + ("%s: went past the buffer, off %d, actlen %d", + __func__, off, actlen)); + } + + /* FALLTHROUGH */ + case USB_ST_SETUP: + CDCEEM_DEBUG(sc, "setup"); +tr_setup: + usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); + usbd_transfer_submit(xfer); + uether_rxflush(&sc->sc_ue); + break; + + default: + CDCEEM_WARN(sc, "USB_ST_ERROR: %s", usbd_errstr(usb_error)); + + if (usb_error != USB_ERR_CANCELLED) { + /* try to clear stall first */ + usbd_xfer_set_stall(xfer); + goto tr_setup; + } + break; + } +} + +static void +cdceem_send_echo(struct usb_xfer *xfer, int *offp) +{ + struct cdceem_softc *sc; + struct usb_page_cache *pc; + int maxlen, off; + uint16_t hdr; + + off = *offp; + sc = usbd_xfer_softc(xfer); + pc = usbd_xfer_get_frame(xfer, 0); + maxlen = usbd_xfer_max_len(xfer); + + CDCEEM_DEBUG(sc, "sending Echo, length %zd", + sizeof(CDCEEM_ECHO_PAYLOAD)); + + KASSERT(off + sizeof(hdr) + sizeof(CDCEEM_ECHO_PAYLOAD) < maxlen, + ("%s: out of space; have %d, need %zd", __func__, maxlen, + off + sizeof(hdr) + sizeof(CDCEEM_ECHO_PAYLOAD))); + + hdr = 0; + hdr |= CDCEEM_TYPE_CMD; + hdr |= CDCEEM_CMD_ECHO; + hdr |= sizeof(CDCEEM_ECHO_PAYLOAD); + CDCEEM_DEBUG(sc, "hdr = %#x", hdr); + hdr = htole16(hdr); + + usbd_copy_in(pc, off, &hdr, sizeof(hdr)); + off += sizeof(hdr); + + usbd_copy_in(pc, off, CDCEEM_ECHO_PAYLOAD, + sizeof(CDCEEM_ECHO_PAYLOAD)); + off += sizeof(CDCEEM_ECHO_PAYLOAD); + + sc->sc_flags &= ~CDCEEM_SC_FLAGS_ECHO_PENDING; + + *offp = off; +} + +static void +cdceem_send_echo_response(struct usb_xfer *xfer, int *offp) +{ + struct cdceem_softc *sc; + struct usb_page_cache *pc; + int maxlen, off; + uint16_t hdr; + + off = *offp; + sc = usbd_xfer_softc(xfer); + pc = usbd_xfer_get_frame(xfer, 0); + maxlen = usbd_xfer_max_len(xfer); + + KASSERT(off + sizeof(hdr) + sc->sc_echo_len < maxlen, + ("%s: out of space; have %d, need %zd", __func__, maxlen, + off + sizeof(hdr) + sc->sc_echo_len)); + + CDCEEM_DEBUG(sc, "sending Echo Response, length %zd", sc->sc_echo_len); + + hdr = 0; + hdr |= CDCEEM_TYPE_CMD; + hdr |= CDCEEM_CMD_ECHO_RESPONSE; + hdr |= sc->sc_echo_len; + CDCEEM_DEBUG(sc, "hdr = %#x", hdr); + hdr = htole16(hdr); + + usbd_copy_in(pc, off, &hdr, sizeof(hdr)); + off += sizeof(hdr); + + usbd_copy_in(pc, off, sc->sc_echo_buffer, sc->sc_echo_len); + off += sc->sc_echo_len; + + sc->sc_flags &= ~CDCEEM_SC_FLAGS_ECHO_RESPONSE_PENDING; + sc->sc_echo_len = 0; + + *offp = off; +} + +static void +cdceem_send_data(struct usb_xfer *xfer, int *offp) +{ + struct cdceem_softc *sc; + struct usb_page_cache *pc; + struct ifnet *ifp; + struct mbuf *m; + int maxlen, off; + uint32_t crc; + uint16_t hdr; + + off = *offp; + sc = usbd_xfer_softc(xfer); + pc = usbd_xfer_get_frame(xfer, 0); + ifp = uether_getifp(&sc->sc_ue); + maxlen = usbd_xfer_max_len(xfer); + + IFQ_DRV_DEQUEUE(&ifp->if_snd, m); + if (m == NULL) { + CDCEEM_DEBUG(sc, "no Data packets to send"); + return; + } + + KASSERT((m->m_pkthdr.len & CDCEEM_DATA_LEN_MASK) == m->m_pkthdr.len, + ("%s: packet too long: %d, should be %d\n", __func__, + m->m_pkthdr.len, m->m_pkthdr.len & CDCEEM_DATA_LEN_MASK)); + KASSERT(off + sizeof(hdr) + m->m_pkthdr.len + 4 < maxlen, + ("%s: out of space; have %d, need %zd", __func__, maxlen, + off + sizeof(hdr) + m->m_pkthdr.len + 4)); + + CDCEEM_DEBUG(sc, "sending Data, length %d + 4", m->m_pkthdr.len); + + hdr = 0; + if (!cdceem_send_fake_crc) + hdr |= CDCEEM_DATA_CRC; + hdr |= (m->m_pkthdr.len + 4); /* +4 for CRC */ + CDCEEM_DEBUG(sc, "hdr = %#x", hdr); + hdr = htole16(hdr); + + usbd_copy_in(pc, off, &hdr, sizeof(hdr)); + off += sizeof(hdr); + + usbd_m_copy_in(pc, off, m, 0, m->m_pkthdr.len); + off += m->m_pkthdr.len; + + if (cdceem_send_fake_crc) { + crc = htobe32(0xdeadbeef); + } else { + crc = cdceem_m_crc32(m, 0, m->m_pkthdr.len); + } + CDCEEM_DEBUG(sc, "CRC = %#x", crc); + + usbd_copy_in(pc, off, &crc, sizeof(crc)); + off += sizeof(crc); + + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); + + /* + * If there's a BPF listener, bounce a copy of this frame to it. + */ + BPF_MTAP(ifp, m); + m_freem(m); + + *offp = off; +} + +static void +cdceem_bulk_write_callback(struct usb_xfer *xfer, usb_error_t usb_error) +{ + struct cdceem_softc *sc; + struct ifnet *ifp; + int actlen, aframes, maxlen, off; + + sc = usbd_xfer_softc(xfer); + maxlen = usbd_xfer_max_len(xfer); + + switch (USB_GET_STATE(xfer)) { + case USB_ST_TRANSFERRED: + usbd_xfer_status(xfer, &actlen, NULL, &aframes, NULL); + CDCEEM_DEBUG(sc, "transferred %u bytes in %u frames", + actlen, aframes); + + /* FALLTHROUGH */ + case USB_ST_SETUP: + CDCEEM_DEBUG(sc, "setup"); +tr_setup: + + off = 0; + usbd_xfer_set_frame_offset(xfer, 0, 0); + + if (sc->sc_flags & CDCEEM_SC_FLAGS_ECHO_PENDING) { + cdceem_send_echo(xfer, &off); + } else if (sc->sc_flags & CDCEEM_SC_FLAGS_ECHO_RESPONSE_PENDING) { + cdceem_send_echo_response(xfer, &off); + } else { + cdceem_send_data(xfer, &off); + } + + KASSERT(off <= maxlen, + ("%s: went past the buffer, off %d, maxlen %d", + __func__, off, maxlen)); + + if (off > 0) { + CDCEEM_DEBUG(sc, "starting transfer, length %d", off); + usbd_xfer_set_frame_len(xfer, 0, off); + usbd_transfer_submit(xfer); + } else { + CDCEEM_DEBUG(sc, "nothing to transfer"); + } + + break; + + default: + CDCEEM_WARN(sc, "USB_ST_ERROR: %s", usbd_errstr(usb_error)); + + ifp = uether_getifp(&sc->sc_ue); + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + + if (usb_error != USB_ERR_CANCELLED) { + /* try to clear stall first */ + usbd_xfer_set_stall(xfer); + goto tr_setup; + } + break; + } +} + +static int32_t +cdceem_m_crc32_cb(void *arg, void *src, uint32_t count) +{ + uint32_t *p_crc = arg; + + *p_crc = crc32_raw(src, count, *p_crc); + return (0); +} + +static uint32_t +cdceem_m_crc32(struct mbuf *m, uint32_t src_offset, uint32_t src_len) +{ + uint32_t crc = 0xFFFFFFFF; + int error; + + error = m_apply(m, src_offset, src_len, cdceem_m_crc32_cb, &crc); + return (crc ^ 0xFFFFFFFF); +} + +static void +cdceem_start(struct usb_ether *ue) +{ + struct cdceem_softc *sc; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Aug 7 18:32:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4060B3CAE; Wed, 7 Aug 2019 18:32:01 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463g8K4Lzvz47YP; Wed, 7 Aug 2019 18:32:01 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7708918C6D; Wed, 7 Aug 2019 18:32:01 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77IW1dp053162; Wed, 7 Aug 2019 18:32:01 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77IW1Xa053161; Wed, 7 Aug 2019 18:32:01 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201908071832.x77IW1Xa053161@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 7 Aug 2019 18:32:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350688 - head/usr.bin/procstat X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/usr.bin/procstat X-SVN-Commit-Revision: 350688 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 18:32:01 -0000 Author: glebius Date: Wed Aug 7 18:32:01 2019 New Revision: 350688 URL: https://svnweb.freebsd.org/changeset/base/350688 Log: resource.h is sufficient here, no need for resoursevar.h. Modified: head/usr.bin/procstat/procstat_rlimit.c Modified: head/usr.bin/procstat/procstat_rlimit.c ============================================================================== --- head/usr.bin/procstat/procstat_rlimit.c Wed Aug 7 18:26:32 2019 (r350687) +++ head/usr.bin/procstat/procstat_rlimit.c Wed Aug 7 18:32:01 2019 (r350688) @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include From owner-svn-src-head@freebsd.org Wed Aug 7 19:23:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CDA47B50CE; Wed, 7 Aug 2019 19:23:08 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463hHJ53tvz4C3t; Wed, 7 Aug 2019 19:23:08 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F5D3196E9; Wed, 7 Aug 2019 19:23:08 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77JN8KV083699; Wed, 7 Aug 2019 19:23:08 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77JN7Ci083696; Wed, 7 Aug 2019 19:23:07 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908071923.x77JN7Ci083696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 7 Aug 2019 19:23:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350691 - in head: share/man/man9 sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: share/man/man9 sys/kern sys/sys X-SVN-Commit-Revision: 350691 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 19:23:08 -0000 Author: cem Date: Wed Aug 7 19:23:07 2019 New Revision: 350691 URL: https://svnweb.freebsd.org/changeset/base/350691 Log: sbuf(9): Add NOWAIT dynamic buffer extension mode The goal is to avoid some kinds of low-memory deadlock when formatting heap-allocated buffers. Reviewed by: vangyzen Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D21015 Modified: head/share/man/man9/sbuf.9 head/sys/kern/subr_sbuf.c head/sys/sys/sbuf.h Modified: head/share/man/man9/sbuf.9 ============================================================================== --- head/share/man/man9/sbuf.9 Wed Aug 7 19:18:32 2019 (r350690) +++ head/share/man/man9/sbuf.9 Wed Aug 7 19:23:07 2019 (r350691) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 7, 2019 +.Dd August 7, 2019 .Dt SBUF 9 .Os .Sh NAME @@ -288,6 +288,11 @@ If a record grows sufficiently large such that it fill and therefore cannot be drained without being split, an error of .Er EDEADLK is set. +.It Dv SBUF_NOWAIT +Indicates that attempts to extend the storage buffer should fail in low memory +conditions, like +.Xr malloc 9 +.Dv M_NOWAIT . .El .Pp Note that if Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Wed Aug 7 19:18:32 2019 (r350690) +++ head/sys/kern/subr_sbuf.c Wed Aug 7 19:23:07 2019 (r350691) @@ -56,11 +56,11 @@ __FBSDID("$FreeBSD$"); #ifdef _KERNEL static MALLOC_DEFINE(M_SBUF, "sbuf", "string buffers"); -#define SBMALLOC(size) malloc(size, M_SBUF, M_WAITOK|M_ZERO) +#define SBMALLOC(size, flags) malloc(size, M_SBUF, (flags) | M_ZERO) #define SBFREE(buf) free(buf, M_SBUF) #else /* _KERNEL */ #define KASSERT(e, m) -#define SBMALLOC(size) calloc(1, size) +#define SBMALLOC(size, flags) calloc(1, size) #define SBFREE(buf) free(buf) #endif /* _KERNEL */ @@ -77,6 +77,8 @@ static MALLOC_DEFINE(M_SBUF, "sbuf", "string buffers") #define SBUF_NULINCLUDED(s) ((s)->s_flags & SBUF_INCLUDENUL) #define SBUF_ISDRAINTOEOR(s) ((s)->s_flags & SBUF_DRAINTOEOR) #define SBUF_DODRAINTOEOR(s) (SBUF_ISSECTION(s) && SBUF_ISDRAINTOEOR(s)) +#define SBUF_MALLOCFLAG(s) \ + (((s)->s_flags & SBUF_NOWAIT) ? M_NOWAIT : M_WAITOK) /* * Set / clear flags @@ -171,7 +173,7 @@ sbuf_extend(struct sbuf *s, int addlen) if (!SBUF_CANEXTEND(s)) return (-1); newsize = sbuf_extendsize(s->s_size + addlen); - newbuf = SBMALLOC(newsize); + newbuf = SBMALLOC(newsize, SBUF_MALLOCFLAG(s)); if (newbuf == NULL) return (-1); memcpy(newbuf, s->s_buf, s->s_size); @@ -198,7 +200,7 @@ sbuf_newbuf(struct sbuf *s, char *buf, int length, int s->s_size = length; s->s_buf = buf; - if ((s->s_flags & SBUF_AUTOEXTEND) == 0) { + if (!SBUF_CANEXTEND(s)) { KASSERT(s->s_size >= SBUF_MINSIZE, ("attempt to create an sbuf smaller than %d bytes", SBUF_MINSIZE)); @@ -207,10 +209,10 @@ sbuf_newbuf(struct sbuf *s, char *buf, int length, int if (s->s_buf != NULL) return (s); - if ((flags & SBUF_AUTOEXTEND) != 0) + if (SBUF_CANEXTEND(s)) s->s_size = sbuf_extendsize(s->s_size); - s->s_buf = SBMALLOC(s->s_size); + s->s_buf = SBMALLOC(s->s_size, SBUF_MALLOCFLAG(s)); if (s->s_buf == NULL) return (NULL); SBUF_SETFLAG(s, SBUF_DYNAMIC); @@ -235,7 +237,7 @@ sbuf_new(struct sbuf *s, char *buf, int length, int fl if (s != NULL) return (sbuf_newbuf(s, buf, length, flags)); - s = SBMALLOC(sizeof(*s)); + s = SBMALLOC(sizeof(*s), (flags & SBUF_NOWAIT) ? M_NOWAIT : M_WAITOK); if (s == NULL) return (NULL); if (sbuf_newbuf(s, buf, length, flags) == NULL) { Modified: head/sys/sys/sbuf.h ============================================================================== --- head/sys/sys/sbuf.h Wed Aug 7 19:18:32 2019 (r350690) +++ head/sys/sys/sbuf.h Wed Aug 7 19:23:07 2019 (r350691) @@ -52,6 +52,7 @@ struct sbuf { #define SBUF_AUTOEXTEND 0x00000001 /* automatically extend buffer */ #define SBUF_INCLUDENUL 0x00000002 /* nulterm byte is counted in len */ #define SBUF_DRAINTOEOR 0x00000004 /* use section 0 as drain EOR marker */ +#define SBUF_NOWAIT 0x00000008 /* Extend with non-blocking malloc */ #define SBUF_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */ #define SBUF_DYNAMIC 0x00010000 /* s_buf must be freed */ #define SBUF_FINISHED 0x00020000 /* set by sbuf_finish() */ From owner-svn-src-head@freebsd.org Wed Aug 7 19:25:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8BE7AB5164; Wed, 7 Aug 2019 19:25:57 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463hLY3BdWz4CCy; Wed, 7 Aug 2019 19:25:57 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5009C196FD; Wed, 7 Aug 2019 19:25:57 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77JPv6q083873; Wed, 7 Aug 2019 19:25:57 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77JPvmP083872; Wed, 7 Aug 2019 19:25:57 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908071925.x77JPvmP083872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 7 Aug 2019 19:25:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350692 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 350692 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 19:25:57 -0000 Author: cem Date: Wed Aug 7 19:25:56 2019 New Revision: 350692 URL: https://svnweb.freebsd.org/changeset/base/350692 Log: sbuf(9): Refactor sbuf_newbuf into sbuf_new Code flow was somewhat difficult to read due to the combination of multiple return sites and the 4x possible dynamic constructions of an sbuf. (Future consideration: do we need all 4?) Refactored slightly to improve legibility. No functional change. Sponsored by: Dell EMC Isilon Modified: head/sys/kern/subr_sbuf.c Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Wed Aug 7 19:23:07 2019 (r350691) +++ head/sys/kern/subr_sbuf.c Wed Aug 7 19:25:56 2019 (r350692) @@ -187,39 +187,6 @@ sbuf_extend(struct sbuf *s, int addlen) } /* - * Initialize the internals of an sbuf. - * If buf is non-NULL, it points to a static or already-allocated string - * big enough to hold at least length characters. - */ -static struct sbuf * -sbuf_newbuf(struct sbuf *s, char *buf, int length, int flags) -{ - - memset(s, 0, sizeof(*s)); - s->s_flags = flags; - s->s_size = length; - s->s_buf = buf; - - if (!SBUF_CANEXTEND(s)) { - KASSERT(s->s_size >= SBUF_MINSIZE, - ("attempt to create an sbuf smaller than %d bytes", - SBUF_MINSIZE)); - } - - if (s->s_buf != NULL) - return (s); - - if (SBUF_CANEXTEND(s)) - s->s_size = sbuf_extendsize(s->s_size); - - s->s_buf = SBMALLOC(s->s_size, SBUF_MALLOCFLAG(s)); - if (s->s_buf == NULL) - return (NULL); - SBUF_SETFLAG(s, SBUF_DYNAMIC); - return (s); -} - -/* * Initialize an sbuf. * If buf is non-NULL, it points to a static or already-allocated string * big enough to hold at least length characters. @@ -232,19 +199,52 @@ sbuf_new(struct sbuf *s, char *buf, int length, int fl ("attempt to create an sbuf of negative length (%d)", length)); KASSERT((flags & ~SBUF_USRFLAGMSK) == 0, ("%s called with invalid flags", __func__)); + KASSERT((flags & SBUF_AUTOEXTEND) || length >= SBUF_MINSIZE, + ("sbuf buffer %d smaller than minimum %d bytes", length, + SBUF_MINSIZE)); flags &= SBUF_USRFLAGMSK; - if (s != NULL) - return (sbuf_newbuf(s, buf, length, flags)); - s = SBMALLOC(sizeof(*s), (flags & SBUF_NOWAIT) ? M_NOWAIT : M_WAITOK); - if (s == NULL) - return (NULL); - if (sbuf_newbuf(s, buf, length, flags) == NULL) { - SBFREE(s); - return (NULL); + /* + * Allocate 'DYNSTRUCT' sbuf from the heap, if NULL 's' was provided. + */ + if (s == NULL) { + s = SBMALLOC(sizeof(*s), + (flags & SBUF_NOWAIT) ? M_NOWAIT : M_WAITOK); + if (s == NULL) + goto out; + SBUF_SETFLAG(s, SBUF_DYNSTRUCT); + } else { + /* + * DYNSTRUCT SBMALLOC sbufs are allocated with M_ZERO, but + * user-provided sbuf objects must be initialized. + */ + memset(s, 0, sizeof(*s)); } - SBUF_SETFLAG(s, SBUF_DYNSTRUCT); + + s->s_flags |= flags; + s->s_size = length; + s->s_buf = buf; + + /* + * Allocate DYNAMIC, i.e., heap data buffer backing the sbuf, if no + * buffer was provided. + */ + if (s->s_buf == NULL) { + if (SBUF_CANEXTEND(s)) + s->s_size = sbuf_extendsize(s->s_size); + s->s_buf = SBMALLOC(s->s_size, SBUF_MALLOCFLAG(s)); + if (s->s_buf == NULL) + goto out; + SBUF_SETFLAG(s, SBUF_DYNAMIC); + } + +out: + if (s != NULL && s->s_buf == NULL) { + if (SBUF_ISDYNSTRUCT(s)) + SBFREE(s); + s = NULL; + } return (s); } From owner-svn-src-head@freebsd.org Wed Aug 7 19:27:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6711B5213; Wed, 7 Aug 2019 19:27:15 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463hN33wMrz4CM5; Wed, 7 Aug 2019 19:27:15 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 683F219702; Wed, 7 Aug 2019 19:27:15 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77JRFv6083974; Wed, 7 Aug 2019 19:27:15 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77JREeu083971; Wed, 7 Aug 2019 19:27:14 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908071927.x77JREeu083971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 7 Aug 2019 19:27:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350693 - in head: share/man/man9 sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: share/man/man9 sys/kern sys/sys X-SVN-Commit-Revision: 350693 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 19:27:15 -0000 Author: cem Date: Wed Aug 7 19:27:14 2019 New Revision: 350693 URL: https://svnweb.freebsd.org/changeset/base/350693 Log: sbuf(9): Add sbuf_nl_terminate() API The API is used to gracefully terminate text line(s) with a single \n. If the formatted buffer was empty or already ended in \n, it is unmodified. Otherwise, a newline character is appended to it. The API, like other sbuf-modifying routines, is only valid while the sbuf is not FINISHED. Reviewed by: rlibby Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D21030 Modified: head/share/man/man9/sbuf.9 head/sys/kern/subr_sbuf.c head/sys/sys/sbuf.h Modified: head/share/man/man9/sbuf.9 ============================================================================== --- head/share/man/man9/sbuf.9 Wed Aug 7 19:25:56 2019 (r350692) +++ head/share/man/man9/sbuf.9 Wed Aug 7 19:27:14 2019 (r350693) @@ -44,6 +44,7 @@ .Nm sbuf_cat , .Nm sbuf_copyin , .Nm sbuf_cpy , +.Nm sbuf_nl_terminate , .Nm sbuf_printf , .Nm sbuf_vprintf , .Nm sbuf_putc , @@ -123,6 +124,8 @@ .Fa "const char *str" .Fc .Ft int +.Fn sbuf_nl_terminate "struct sbuf *" +.Ft int .Fo sbuf_printf .Fa "struct sbuf *s" .Fa "const char *fmt" "..." @@ -440,10 +443,14 @@ To do unbuffered draining, initialize the sbuf with a The drain will be called for every byte added to the sbuf. The .Fn sbuf_bcopyin , +.Fn sbuf_bcpy , +.Fn sbuf_clear , .Fn sbuf_copyin , +.Fn sbuf_cpy , .Fn sbuf_trim , +.Fn sbuf_data , and -.Fn sbuf_data +.Fn sbuf_len functions cannot be used on an sbuf with a drain. .Pp The @@ -474,6 +481,11 @@ or one which position has been reset to zero with .Fn sbuf_clear or .Fn sbuf_setpos . +.Pp +The +.Fn sbuf_nl_terminate +function appends a trailing newline character, if the current line is non-empty +and not already terminated by a newline character. .Pp The .Fn sbuf_printf Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Wed Aug 7 19:25:56 2019 (r350692) +++ head/sys/kern/subr_sbuf.c Wed Aug 7 19:27:14 2019 (r350693) @@ -70,6 +70,7 @@ static MALLOC_DEFINE(M_SBUF, "sbuf", "string buffers") #define SBUF_ISDYNAMIC(s) ((s)->s_flags & SBUF_DYNAMIC) #define SBUF_ISDYNSTRUCT(s) ((s)->s_flags & SBUF_DYNSTRUCT) #define SBUF_ISFINISHED(s) ((s)->s_flags & SBUF_FINISHED) +#define SBUF_ISDRAINATEOL(s) ((s)->s_flags & SBUF_DRAINATEOL) #define SBUF_HASROOM(s) ((s)->s_len < (s)->s_size - 1) #define SBUF_FREESPACE(s) ((s)->s_size - ((s)->s_len + 1)) #define SBUF_CANEXTEND(s) ((s)->s_flags & SBUF_AUTOEXTEND) @@ -225,6 +226,10 @@ sbuf_new(struct sbuf *s, char *buf, int length, int fl s->s_flags |= flags; s->s_size = length; s->s_buf = buf; + /* + * Never-written sbufs do not need \n termination. + */ + SBUF_SETFLAG(s, SBUF_DRAINATEOL); /* * Allocate DYNAMIC, i.e., heap data buffer backing the sbuf, if no @@ -310,6 +315,8 @@ sbuf_clear(struct sbuf *s) assert_sbuf_integrity(s); /* don't care if it's finished or not */ + KASSERT(s->s_drain_func == NULL, + ("%s makes no sense on sbuf %p with drain", __func__, s)); SBUF_CLEARFLAG(s, SBUF_FINISHED); s->s_error = 0; @@ -384,6 +391,7 @@ sbuf_drain(struct sbuf *s) KASSERT(s->s_len > 0, ("Shouldn't drain empty sbuf %p", s)); KASSERT(s->s_error == 0, ("Called %s with error on %p", __func__, s)); + if (SBUF_DODRAINTOEOR(s) && s->s_rec_off == 0) return (s->s_error = EDEADLK); len = s->s_drain_func(s->s_drain_arg, s->s_buf, @@ -400,8 +408,18 @@ sbuf_drain(struct sbuf *s) * Fast path for the expected case where all the data was * drained. */ - if (s->s_len == 0) + if (s->s_len == 0) { + /* + * When the s_buf is entirely drained, we need to remember if + * the last character was a '\n' or not for + * sbuf_nl_terminate(). + */ + if (s->s_buf[len - 1] == '\n') + SBUF_SETFLAG(s, SBUF_DRAINATEOL); + else + SBUF_CLEARFLAG(s, SBUF_DRAINATEOL); return (0); + } /* * Move the remaining characters to the beginning of the * string. @@ -711,6 +729,38 @@ sbuf_putc(struct sbuf *s, int c) { sbuf_put_byte(s, c); + if (s->s_error != 0) + return (-1); + return (0); +} + +/* + * Append a trailing newline to a non-empty sbuf, if one is not already + * present. Handles sbufs with drain functions correctly. + */ +int +sbuf_nl_terminate(struct sbuf *s) +{ + + assert_sbuf_integrity(s); + assert_sbuf_state(s, 0); + + /* + * If the s_buf isn't empty, the last byte is simply s_buf[s_len - 1]. + * + * If the s_buf is empty because a drain function drained it, we + * remember if the last byte was a \n with the SBUF_DRAINATEOL flag in + * sbuf_drain(). + * + * In either case, we only append a \n if the previous character was + * something else. + */ + if (s->s_len == 0) { + if (!SBUF_ISDRAINATEOL(s)) + sbuf_put_byte(s, '\n'); + } else if (s->s_buf[s->s_len - 1] != '\n') + sbuf_put_byte(s, '\n'); + if (s->s_error != 0) return (-1); return (0); Modified: head/sys/sys/sbuf.h ============================================================================== --- head/sys/sys/sbuf.h Wed Aug 7 19:25:56 2019 (r350692) +++ head/sys/sys/sbuf.h Wed Aug 7 19:27:14 2019 (r350693) @@ -58,6 +58,7 @@ struct sbuf { #define SBUF_FINISHED 0x00020000 /* set by sbuf_finish() */ #define SBUF_DYNSTRUCT 0x00080000 /* sbuf must be freed */ #define SBUF_INSECTION 0x00100000 /* set by sbuf_start_section() */ +#define SBUF_DRAINATEOL 0x00200000 /* drained contents ended in \n */ int s_flags; /* flags */ ssize_t s_sect_len; /* current length of section */ ssize_t s_rec_off; /* current record start offset */ @@ -91,6 +92,7 @@ int sbuf_printf(struct sbuf *, const char *, ...) __printflike(2, 3); int sbuf_vprintf(struct sbuf *, const char *, __va_list) __printflike(2, 0); +int sbuf_nl_terminate(struct sbuf *); int sbuf_putc(struct sbuf *, int); void sbuf_set_drain(struct sbuf *, sbuf_drain_func *, void *); int sbuf_trim(struct sbuf *); From owner-svn-src-head@freebsd.org Wed Aug 7 19:28:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8FDECB52A6; Wed, 7 Aug 2019 19:28:46 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463hPp4191z4CWL; Wed, 7 Aug 2019 19:28:46 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5255C19715; Wed, 7 Aug 2019 19:28:46 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77JSkUi084123; Wed, 7 Aug 2019 19:28:46 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77JSZw4084069; Wed, 7 Aug 2019 19:28:35 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908071928.x77JSZw4084069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 7 Aug 2019 19:28:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350694 - in head: share/man/man9 sys/dev/fdc sys/geom sys/geom/cache sys/geom/concat sys/geom/eli sys/geom/gate sys/geom/journal sys/geom/label sys/geom/linux_lvm sys/geom/mirror sys/g... X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: share/man/man9 sys/dev/fdc sys/geom sys/geom/cache sys/geom/concat sys/geom/eli sys/geom/gate sys/geom/journal sys/geom/label sys/geom/linux_lvm sys/geom/mirror sys/geom/mountver sys/geom/nop... X-SVN-Commit-Revision: 350694 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 19:28:46 -0000 Author: cem Date: Wed Aug 7 19:28:35 2019 New Revision: 350694 URL: https://svnweb.freebsd.org/changeset/base/350694 Log: GEOM: Reduce unnecessary log interleaving with sbufs Similar to what was done for device_printfs in r347229. Convert g_print_bio() to a thin shim around g_format_bio(), which acts on an sbuf; documented in g_bio.9. Reviewed by: markj Discussed with: rlibby Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D21165 Added: head/sys/geom/geom_dbg.h (contents, props changed) Modified: head/share/man/man9/Makefile head/share/man/man9/g_bio.9 head/sys/dev/fdc/fdc.c head/sys/geom/cache/g_cache.c head/sys/geom/cache/g_cache.h head/sys/geom/concat/g_concat.c head/sys/geom/concat/g_concat.h head/sys/geom/eli/g_eli.c head/sys/geom/eli/g_eli.h head/sys/geom/eli/g_eli_ctl.c head/sys/geom/eli/g_eli_integrity.c head/sys/geom/eli/g_eli_privacy.c head/sys/geom/gate/g_gate.c head/sys/geom/gate/g_gate.h head/sys/geom/geom.h head/sys/geom/geom_io.c head/sys/geom/geom_subr.c head/sys/geom/geom_vfs.c head/sys/geom/journal/g_journal.c head/sys/geom/journal/g_journal.h head/sys/geom/journal/g_journal_ufs.c head/sys/geom/label/g_label.c head/sys/geom/label/g_label.h head/sys/geom/label/g_label_ext2fs.c head/sys/geom/label/g_label_iso9660.c head/sys/geom/label/g_label_msdosfs.c head/sys/geom/label/g_label_reiserfs.c head/sys/geom/label/g_label_ufs.c head/sys/geom/linux_lvm/g_linux_lvm.c head/sys/geom/linux_lvm/g_linux_lvm.h head/sys/geom/mirror/g_mirror.c head/sys/geom/mirror/g_mirror.h head/sys/geom/mirror/g_mirror_ctl.c head/sys/geom/mountver/g_mountver.c head/sys/geom/mountver/g_mountver.h head/sys/geom/nop/g_nop.c head/sys/geom/nop/g_nop.h head/sys/geom/raid/g_raid.c head/sys/geom/raid/g_raid.h head/sys/geom/raid/md_ddf.c head/sys/geom/raid/md_intel.c head/sys/geom/raid/md_jmicron.c head/sys/geom/raid/md_nvidia.c head/sys/geom/raid/md_promise.c head/sys/geom/raid/md_sii.c head/sys/geom/raid/tr_concat.c head/sys/geom/raid/tr_raid0.c head/sys/geom/raid/tr_raid1.c head/sys/geom/raid/tr_raid1e.c head/sys/geom/raid3/g_raid3.c head/sys/geom/raid3/g_raid3.h head/sys/geom/sched/g_sched.c head/sys/geom/sched/g_sched.h head/sys/geom/shsec/g_shsec.c head/sys/geom/shsec/g_shsec.h head/sys/geom/stripe/g_stripe.c head/sys/geom/stripe/g_stripe.h head/sys/geom/vinum/geom_vinum.c head/sys/geom/vinum/geom_vinum.h head/sys/geom/vinum/geom_vinum_create.c head/sys/geom/vinum/geom_vinum_drive.c head/sys/geom/vinum/geom_vinum_events.c head/sys/geom/vinum/geom_vinum_init.c head/sys/geom/vinum/geom_vinum_move.c head/sys/geom/vinum/geom_vinum_plex.c head/sys/geom/vinum/geom_vinum_raid5.c head/sys/geom/vinum/geom_vinum_rename.c head/sys/geom/vinum/geom_vinum_rm.c head/sys/geom/vinum/geom_vinum_state.c head/sys/geom/vinum/geom_vinum_subr.c head/sys/geom/virstor/g_virstor.c head/sys/geom/virstor/g_virstor.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Wed Aug 7 19:27:14 2019 (r350693) +++ head/share/man/man9/Makefile Wed Aug 7 19:28:35 2019 (r350694) @@ -1004,6 +1004,7 @@ MLINKS+=g_bio.9 g_alloc_bio.9 \ g_bio.9 g_clone_bio.9 \ g_bio.9 g_destroy_bio.9 \ g_bio.9 g_duplicate_bio.9 \ + g_bio.9 g_format_bio.9 \ g_bio.9 g_new_bio.9 \ g_bio.9 g_print_bio.9 \ g_bio.9 g_reset_bio.9 Modified: head/share/man/man9/g_bio.9 ============================================================================== --- head/share/man/man9/g_bio.9 Wed Aug 7 19:27:14 2019 (r350693) +++ head/share/man/man9/g_bio.9 Wed Aug 7 19:28:35 2019 (r350694) @@ -24,13 +24,14 @@ .\" .\" $FreeBSD$ .\" -.Dd Mar 7, 2018 +.Dd August 7, 2019 .Dt G_BIO 9 .Os .Sh NAME .Nm g_new_bio , .Nm g_clone_bio , .Nm g_destroy_bio , +.Nm g_format_bio , .Nm g_print_bio , .Nm g_reset_bio .Nd "GEOM bio controlling functions" @@ -48,8 +49,13 @@ .Ft void .Fn g_destroy_bio "struct bio *bp" .Ft void -.Fn g_print_bio "struct bio *bp" +.Fn g_format_bio "struct sbuf *sb" "const struct bio *bp" .Ft void +.Fo g_print_bio +.Fa "struct sbuf *sb" "const char *prefix" "const struct bio *bp" +.Fa "const char *fmtsuffix" ... +.Fc +.Ft void .Fn g_reset_bio "struct bio *bp" .Sh DESCRIPTION A @@ -204,12 +210,30 @@ function deallocates and destroys the given structure. .Pp The -.Fn g_print_bio +.Fn g_format_bio function prints information about the given .Vt bio -structure (for debugging purposes). +structure into the provided +.Vt sbuf . .Pp The +.Fn g_print_bio +function is a convenience wrapper around +.Fn g_format_bio +that can be used for debugging purposes. +It prints a provided +.Fa prefix +string, followed by the formatted +.Vt bio , +followed by a +.Fa fmtsuffix +in the style of +.Xr 9 printf . +Any of the prefix or suffix strings may be the empty string. +.Fn g_print_bio +always prints a newline character at the end of the line. +.Pp +The .Fn g_reset_bio function resets the given .Vt bio @@ -261,9 +285,7 @@ example_start(struct bio *bp) struct example_softc *sc; struct bio *cbp; - printf("Request received: "); - g_print_bio(bp); - printf("\\n"); + g_print_bio("Request received: ", bp, ""); sc = bp->bio_to->geom->softc; if (sc == NULL) { Modified: head/sys/dev/fdc/fdc.c ============================================================================== --- head/sys/dev/fdc/fdc.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/dev/fdc/fdc.c Wed Aug 7 19:28:35 2019 (r350694) @@ -1160,10 +1160,8 @@ fdc_thread(void *arg) mtx_unlock(&fdc->fdc_mtx); i = fdc_worker(fdc); if (i && debugflags & 0x20) { - if (fdc->bp != NULL) { - g_print_bio(fdc->bp); - printf("\n"); - } + if (fdc->bp != NULL) + g_print_bio("", fdc->bp, ""); printf("Retry line %d\n", retry_line); } fdc->retry += i; Modified: head/sys/geom/cache/g_cache.c ============================================================================== --- head/sys/geom/cache/g_cache.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/cache/g_cache.c Wed Aug 7 19:28:35 2019 (r350694) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include FEATURE(geom_cache, "GEOM cache module"); Modified: head/sys/geom/cache/g_cache.h ============================================================================== --- head/sys/geom/cache/g_cache.h Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/cache/g_cache.h Wed Aug 7 19:28:35 2019 (r350694) @@ -41,25 +41,10 @@ #define G_CACHE_TYPE_MANUAL 0 #define G_CACHE_TYPE_AUTOMATIC 1 -#define G_CACHE_DEBUG(lvl, ...) do { \ - if (g_cache_debug >= (lvl)) { \ - printf("GEOM_CACHE"); \ - if (g_cache_debug > 0) \ - printf("[%u]", lvl); \ - printf(": "); \ - printf(__VA_ARGS__); \ - printf("\n"); \ - } \ -} while (0) -#define G_CACHE_LOGREQ(bp, ...) do { \ - if (g_cache_debug >= 2) { \ - printf("GEOM_CACHE[2]: "); \ - printf(__VA_ARGS__); \ - printf(" "); \ - g_print_bio(bp); \ - printf("\n"); \ - } \ -} while (0) +#define G_CACHE_DEBUG(lvl, ...) \ + _GEOM_DEBUG("GEOM_CACHE", g_cache_debug, (lvl), NULL, __VA_ARGS__) +#define G_CACHE_LOGREQ(bp, ...) \ + _GEOM_DEBUG("GEOM_CACHE", g_cache_debug, 2, (bp), __VA_ARGS__) #define G_CACHE_BUCKETS (1 << 3) #define G_CACHE_BUCKET(bno) ((bno) & (G_CACHE_BUCKETS - 1)) Modified: head/sys/geom/concat/g_concat.c ============================================================================== --- head/sys/geom/concat/g_concat.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/concat/g_concat.c Wed Aug 7 19:28:35 2019 (r350694) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include FEATURE(geom_concat, "GEOM concatenation support"); Modified: head/sys/geom/concat/g_concat.h ============================================================================== --- head/sys/geom/concat/g_concat.h Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/concat/g_concat.h Wed Aug 7 19:28:35 2019 (r350694) @@ -49,25 +49,10 @@ #define G_CONCAT_TYPE_MANUAL 0 #define G_CONCAT_TYPE_AUTOMATIC 1 -#define G_CONCAT_DEBUG(lvl, ...) do { \ - if (g_concat_debug >= (lvl)) { \ - printf("GEOM_CONCAT"); \ - if (g_concat_debug > 0) \ - printf("[%u]", lvl); \ - printf(": "); \ - printf(__VA_ARGS__); \ - printf("\n"); \ - } \ -} while (0) -#define G_CONCAT_LOGREQ(bp, ...) do { \ - if (g_concat_debug >= 2) { \ - printf("GEOM_CONCAT[2]: "); \ - printf(__VA_ARGS__); \ - printf(" "); \ - g_print_bio(bp); \ - printf("\n"); \ - } \ -} while (0) +#define G_CONCAT_DEBUG(lvl, ...) \ + _GEOM_DEBUG("GEOM_CONCAT", g_concat_debug, (lvl), NULL, __VA_ARGS__) +#define G_CONCAT_LOGREQ(bp, ...) \ + _GEOM_DEBUG("GEOM_CONCAT", g_concat_debug, 2, (bp), __VA_ARGS__) struct g_concat_disk { struct g_consumer *d_consumer; Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/eli/g_eli.c Wed Aug 7 19:28:35 2019 (r350694) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Modified: head/sys/geom/eli/g_eli.h ============================================================================== --- head/sys/geom/eli/g_eli.h Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/eli/g_eli.h Wed Aug 7 19:28:35 2019 (r350694) @@ -155,28 +155,10 @@ extern int g_eli_debug; extern u_int g_eli_overwrites; extern u_int g_eli_batch; -#define G_ELI_DEBUG(lvl, ...) do { \ - if (g_eli_debug >= (lvl)) { \ - printf("GEOM_ELI"); \ - if (g_eli_debug > 0) \ - printf("[%u]", lvl); \ - printf(": "); \ - printf(__VA_ARGS__); \ - printf("\n"); \ - } \ -} while (0) -#define G_ELI_LOGREQ(lvl, bp, ...) do { \ - if (g_eli_debug >= (lvl)) { \ - printf("GEOM_ELI"); \ - if (g_eli_debug > 0) \ - printf("[%u]", lvl); \ - printf(": "); \ - printf(__VA_ARGS__); \ - printf(" "); \ - g_print_bio(bp); \ - printf("\n"); \ - } \ -} while (0) +#define G_ELI_DEBUG(lvl, ...) \ + _GEOM_DEBUG("GEOM_ELI", g_eli_debug, (lvl), NULL, __VA_ARGS__) +#define G_ELI_LOGREQ(lvl, bp, ...) \ + _GEOM_DEBUG("GEOM_ELI", g_eli_debug, (lvl), (bp), __VA_ARGS__) struct g_eli_worker { struct g_eli_softc *w_softc; Modified: head/sys/geom/eli/g_eli_ctl.c ============================================================================== --- head/sys/geom/eli/g_eli_ctl.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/eli/g_eli_ctl.c Wed Aug 7 19:28:35 2019 (r350694) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include Modified: head/sys/geom/eli/g_eli_integrity.c ============================================================================== --- head/sys/geom/eli/g_eli_integrity.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/eli/g_eli_integrity.c Wed Aug 7 19:28:35 2019 (r350694) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Modified: head/sys/geom/eli/g_eli_privacy.c ============================================================================== --- head/sys/geom/eli/g_eli_privacy.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/eli/g_eli_privacy.c Wed Aug 7 19:28:35 2019 (r350694) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Modified: head/sys/geom/gate/g_gate.c ============================================================================== --- head/sys/geom/gate/g_gate.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/gate/g_gate.c Wed Aug 7 19:28:35 2019 (r350694) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include FEATURE(geom_gate, "GEOM Gate module"); Modified: head/sys/geom/gate/g_gate.h ============================================================================== --- head/sys/geom/gate/g_gate.h Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/gate/g_gate.h Wed Aug 7 19:28:35 2019 (r350694) @@ -103,28 +103,10 @@ struct g_gate_softc { char sc_info[G_GATE_INFOSIZE]; /* P: (read-only) */ }; -#define G_GATE_DEBUG(lvl, ...) do { \ - if (g_gate_debug >= (lvl)) { \ - printf("GEOM_GATE"); \ - if (g_gate_debug > 0) \ - printf("[%u]", lvl); \ - printf(": "); \ - printf(__VA_ARGS__); \ - printf("\n"); \ - } \ -} while (0) -#define G_GATE_LOGREQ(lvl, bp, ...) do { \ - if (g_gate_debug >= (lvl)) { \ - printf("GEOM_GATE"); \ - if (g_gate_debug > 0) \ - printf("[%u]", lvl); \ - printf(": "); \ - printf(__VA_ARGS__); \ - printf(" "); \ - g_print_bio(bp); \ - printf("\n"); \ - } \ -} while (0) +#define G_GATE_DEBUG(lvl, ...) \ + _GEOM_DEBUG("GEOM_GATE", g_gate_debug, (lvl), NULL, __VA_ARGS__) +#define G_GATE_LOGREQ(lvl, bp, ...) \ + _GEOM_DEBUG("GEOM_GATE", g_gate_debug, (lvl), (bp), __VA_ARGS__) #endif /* !_KERNEL */ struct g_gate_ctl_create { Modified: head/sys/geom/geom.h ============================================================================== --- head/sys/geom/geom.h Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/geom.h Wed Aug 7 19:28:35 2019 (r350694) @@ -345,7 +345,8 @@ void g_reset_bio(struct bio *); void * g_read_data(struct g_consumer *cp, off_t offset, off_t length, int *error); int g_write_data(struct g_consumer *cp, off_t offset, void *ptr, off_t length); int g_delete_data(struct g_consumer *cp, off_t offset, off_t length); -void g_print_bio(struct bio *bp); +void g_format_bio(struct sbuf *, const struct bio *bp); +void g_print_bio(const char *prefix, const struct bio *bp, const char *fmtsuffix, ...) __printflike(3, 4); int g_use_g_read_data(void *, off_t, void **, int); int g_use_g_write_data(void *, off_t, void *, int); Added: head/sys/geom/geom_dbg.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/geom/geom_dbg.h Wed Aug 7 19:28:35 2019 (r350694) @@ -0,0 +1,49 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Conrad Meyer + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#pragma once + +#ifdef _KERNEL + +#define _GEOM_DEBUG(classname, ctrlvar, loglvl, biop, formatstr, ...) \ +do { \ + const int __control = (ctrlvar); \ + const int __level = (loglvl); \ + \ + if (__control < __level) \ + break; \ + \ + g_dbg_printf((classname), (__control > 0) ? __level : -1, \ + (biop), ": " formatstr, ## __VA_ARGS__); \ +} while (0) + +void g_dbg_printf(const char *classname, int lvl, struct bio *bp, + const char *format, ...) __printflike(4, 5); + +#endif /* _KERNEL */ Modified: head/sys/geom/geom_io.c ============================================================================== --- head/sys/geom/geom_io.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/geom_io.c Wed Aug 7 19:28:35 2019 (r350694) @@ -49,9 +49,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include #include @@ -1029,8 +1031,37 @@ g_delete_data(struct g_consumer *cp, off_t offset, off } void -g_print_bio(struct bio *bp) +g_print_bio(const char *prefix, const struct bio *bp, const char *fmtsuffix, + ...) { +#ifndef PRINTF_BUFR_SIZE +#define PRINTF_BUFR_SIZE 64 +#endif + char bufr[PRINTF_BUFR_SIZE]; + struct sbuf sb, *sbp __unused; + va_list ap; + + sbp = sbuf_new(&sb, bufr, sizeof(bufr), SBUF_FIXEDLEN); + KASSERT(sbp != NULL, ("sbuf_new misused?")); + + sbuf_set_drain(&sb, sbuf_printf_drain, NULL); + + sbuf_cat(&sb, prefix); + g_format_bio(&sb, bp); + + va_start(ap, fmtsuffix); + sbuf_vprintf(&sb, fmtsuffix, ap); + va_end(ap); + + sbuf_nl_terminate(&sb); + + sbuf_finish(&sb); + sbuf_delete(&sb); +} + +void +g_format_bio(struct sbuf *sb, const struct bio *bp) +{ const char *pname, *cmd = NULL; if (bp->bio_to != NULL) @@ -1041,11 +1072,12 @@ g_print_bio(struct bio *bp) switch (bp->bio_cmd) { case BIO_GETATTR: cmd = "GETATTR"; - printf("%s[%s(attr=%s)]", pname, cmd, bp->bio_attribute); + sbuf_printf(sb, "%s[%s(attr=%s)]", pname, cmd, + bp->bio_attribute); return; case BIO_FLUSH: cmd = "FLUSH"; - printf("%s[%s]", pname, cmd); + sbuf_printf(sb, "%s[%s]", pname, cmd); return; case BIO_ZONE: { char *subcmd = NULL; @@ -1073,7 +1105,7 @@ g_print_bio(struct bio *bp) subcmd = "UNKNOWN"; break; } - printf("%s[%s,%s]", pname, cmd, subcmd); + sbuf_printf(sb, "%s[%s,%s]", pname, cmd, subcmd); return; } case BIO_READ: @@ -1087,9 +1119,9 @@ g_print_bio(struct bio *bp) break; default: cmd = "UNKNOWN"; - printf("%s[%s()]", pname, cmd); + sbuf_printf(sb, "%s[%s()]", pname, cmd); return; } - printf("%s[%s(offset=%jd, length=%jd)]", pname, cmd, + sbuf_printf(sb, "%s[%s(offset=%jd, length=%jd)]", pname, cmd, (intmax_t)bp->bio_offset, (intmax_t)bp->bio_length); } Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/geom_subr.c Wed Aug 7 19:28:35 2019 (r350694) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -76,6 +77,44 @@ struct g_hh00 { int error; int post; }; + +void +g_dbg_printf(const char *classname, int lvl, struct bio *bp, + const char *format, + ...) +{ +#ifndef PRINTF_BUFR_SIZE +#define PRINTF_BUFR_SIZE 64 +#endif + char bufr[PRINTF_BUFR_SIZE]; + struct sbuf sb, *sbp __unused; + va_list ap; + + sbp = sbuf_new(&sb, bufr, sizeof(bufr), SBUF_FIXEDLEN); + KASSERT(sbp != NULL, ("sbuf_new misused?")); + + sbuf_set_drain(&sb, sbuf_printf_drain, NULL); + + sbuf_cat(&sb, classname); + if (lvl >= 0) + sbuf_printf(&sb, "[%d]", lvl); + + va_start(ap, format); + sbuf_vprintf(&sb, format, ap); + va_end(ap); + + if (bp != NULL) { + sbuf_putc(&sb, ' '); + g_format_bio(&sb, bp); + } + + /* Terminate the debug line with a single '\n'. */ + sbuf_nl_terminate(&sb); + + /* Flush line to printf. */ + sbuf_finish(&sb); + sbuf_delete(&sb); +} /* * This event offers a new class a chance to taste all preexisting providers. Modified: head/sys/geom/geom_vfs.c ============================================================================== --- head/sys/geom/geom_vfs.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/geom_vfs.c Wed Aug 7 19:28:35 2019 (r350694) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -138,11 +139,9 @@ g_vfs_done(struct bio *bip) cp = bip->bio_from; sc = cp->geom->softc; - if (bip->bio_error) { - printf("g_vfs_done():"); - g_print_bio(bip); - printf("error = %d\n", bip->bio_error); - } + if (bip->bio_error) + g_print_bio("g_vfs_done():", bip, "error = %d", + bip->bio_error); bp->b_error = bip->bio_error; bp->b_ioflags = bip->bio_flags; if (bip->bio_error) Modified: head/sys/geom/journal/g_journal.c ============================================================================== --- head/sys/geom/journal/g_journal.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/journal/g_journal.c Wed Aug 7 19:28:35 2019 (r350694) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include Modified: head/sys/geom/journal/g_journal.h ============================================================================== --- head/sys/geom/journal/g_journal.h Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/journal/g_journal.h Wed Aug 7 19:28:35 2019 (r350694) @@ -49,28 +49,10 @@ #ifdef _KERNEL extern int g_journal_debug; -#define GJ_DEBUG(lvl, ...) do { \ - if (g_journal_debug >= (lvl)) { \ - printf("GEOM_JOURNAL"); \ - if (g_journal_debug > 0) \ - printf("[%u]", lvl); \ - printf(": "); \ - printf(__VA_ARGS__); \ - printf("\n"); \ - } \ -} while (0) -#define GJ_LOGREQ(lvl, bp, ...) do { \ - if (g_journal_debug >= (lvl)) { \ - printf("GEOM_JOURNAL"); \ - if (g_journal_debug > 0) \ - printf("[%u]", lvl); \ - printf(": "); \ - printf(__VA_ARGS__); \ - printf(" "); \ - g_print_bio(bp); \ - printf("\n"); \ - } \ -} while (0) +#define GJ_DEBUG(lvl, ...) \ + _GEOM_DEBUG("GEOM_JOURNAL", g_journal_debug, (lvl), NULL, __VA_ARGS__) +#define GJ_LOGREQ(lvl, bp, ...) \ + _GEOM_DEBUG("GEOM_JOURNAL", g_journal_debug, (lvl), (bp), __VA_ARGS__) #define JEMPTY(sc) ((sc)->sc_journal_offset - \ (sc)->sc_jprovider->sectorsize == \ Modified: head/sys/geom/journal/g_journal_ufs.c ============================================================================== --- head/sys/geom/journal/g_journal_ufs.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/journal/g_journal_ufs.c Wed Aug 7 19:28:35 2019 (r350694) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include static int Modified: head/sys/geom/label/g_label.c ============================================================================== --- head/sys/geom/label/g_label.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/label/g_label.c Wed Aug 7 19:28:35 2019 (r350694) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: head/sys/geom/label/g_label.h ============================================================================== --- head/sys/geom/label/g_label.h Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/label/g_label.h Wed Aug 7 19:28:35 2019 (r350694) @@ -50,16 +50,8 @@ #ifdef _KERNEL extern u_int g_label_debug; -#define G_LABEL_DEBUG(lvl, ...) do { \ - if (g_label_debug >= (lvl)) { \ - printf("GEOM_LABEL"); \ - if (g_label_debug > 0) \ - printf("[%u]", lvl); \ - printf(": "); \ - printf(__VA_ARGS__); \ - printf("\n"); \ - } \ -} while (0) +#define G_LABEL_DEBUG(lvl, ...) \ + _GEOM_DEBUG("GEOM_LABEL", g_label_debug, (lvl), NULL, __VA_ARGS__) SYSCTL_DECL(_kern_geom_label); Modified: head/sys/geom/label/g_label_ext2fs.c ============================================================================== --- head/sys/geom/label/g_label_ext2fs.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/label/g_label_ext2fs.c Wed Aug 7 19:28:35 2019 (r350694) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #define EXT2FS_SB_OFFSET 1024 Modified: head/sys/geom/label/g_label_iso9660.c ============================================================================== --- head/sys/geom/label/g_label_iso9660.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/label/g_label_iso9660.c Wed Aug 7 19:28:35 2019 (r350694) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #define G_LABEL_ISO9660_DIR "iso9660" Modified: head/sys/geom/label/g_label_msdosfs.c ============================================================================== --- head/sys/geom/label/g_label_msdosfs.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/label/g_label_msdosfs.c Wed Aug 7 19:28:35 2019 (r350694) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Modified: head/sys/geom/label/g_label_reiserfs.c ============================================================================== --- head/sys/geom/label/g_label_reiserfs.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/label/g_label_reiserfs.c Wed Aug 7 19:28:35 2019 (r350694) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #define REISERFS_NEW_DISK_OFFSET 64 * 1024 Modified: head/sys/geom/label/g_label_ufs.c ============================================================================== --- head/sys/geom/label/g_label_ufs.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/label/g_label_ufs.c Wed Aug 7 19:28:35 2019 (r350694) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #define G_LABEL_UFS_VOLUME_DIR "ufs" Modified: head/sys/geom/linux_lvm/g_linux_lvm.c ============================================================================== --- head/sys/geom/linux_lvm/g_linux_lvm.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/linux_lvm/g_linux_lvm.c Wed Aug 7 19:28:35 2019 (r350694) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Modified: head/sys/geom/linux_lvm/g_linux_lvm.h ============================================================================== --- head/sys/geom/linux_lvm/g_linux_lvm.h Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/linux_lvm/g_linux_lvm.h Wed Aug 7 19:28:35 2019 (r350694) @@ -28,16 +28,8 @@ * $FreeBSD$ */ -#define G_LLVM_DEBUG(lvl, ...) do { \ - if (g_llvm_debug >= (lvl)) { \ - printf("GEOM_LINUX_LVM"); \ - if (g_llvm_debug > 0) \ - printf("[%u]", lvl); \ - printf(": "); \ - printf(__VA_ARGS__); \ - printf("\n"); \ - } \ -} while (0) +#define G_LLVM_DEBUG(lvl, ...) \ + _GEOM_DEBUG("GEOM_LINUX_LVM", g_llvm_debug, (lvl), NULL, __VA_ARGS__) #define G_LLVM_CLASS_NAME "LINUX_LVM" #define G_LLVM_NAMELEN 128 Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/mirror/g_mirror.c Wed Aug 7 19:28:35 2019 (r350694) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include FEATURE(geom_mirror, "GEOM mirroring support"); Modified: head/sys/geom/mirror/g_mirror.h ============================================================================== --- head/sys/geom/mirror/g_mirror.h Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/mirror/g_mirror.h Wed Aug 7 19:28:35 2019 (r350694) @@ -86,28 +86,10 @@ extern int g_mirror_debug; -#define G_MIRROR_DEBUG(lvl, ...) do { \ - if (g_mirror_debug >= (lvl)) { \ - printf("GEOM_MIRROR"); \ - if (g_mirror_debug > 0) \ - printf("[%u]", lvl); \ - printf(": "); \ - printf(__VA_ARGS__); \ - printf("\n"); \ - } \ -} while (0) -#define G_MIRROR_LOGREQ(lvl, bp, ...) do { \ - if (g_mirror_debug >= (lvl)) { \ - printf("GEOM_MIRROR"); \ - if (g_mirror_debug > 0) \ - printf("[%u]", lvl); \ - printf(": "); \ - printf(__VA_ARGS__); \ - printf(" "); \ - g_print_bio(bp); \ - printf("\n"); \ - } \ -} while (0) +#define G_MIRROR_DEBUG(lvl, ...) \ + _GEOM_DEBUG("GEOM_MIRROR", g_mirror_debug, (lvl), NULL, __VA_ARGS__) +#define G_MIRROR_LOGREQ(lvl, bp, ...) \ + _GEOM_DEBUG("GEOM_MIRROR", g_mirror_debug, (lvl), (bp), __VA_ARGS__) #define G_MIRROR_BIO_FLAG_REGULAR 0x01 #define G_MIRROR_BIO_FLAG_SYNC 0x02 Modified: head/sys/geom/mirror/g_mirror_ctl.c ============================================================================== --- head/sys/geom/mirror/g_mirror_ctl.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/mirror/g_mirror_ctl.c Wed Aug 7 19:28:35 2019 (r350694) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Modified: head/sys/geom/mountver/g_mountver.c ============================================================================== --- head/sys/geom/mountver/g_mountver.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/mountver/g_mountver.c Wed Aug 7 19:28:35 2019 (r350694) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include Modified: head/sys/geom/mountver/g_mountver.h ============================================================================== --- head/sys/geom/mountver/g_mountver.h Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/mountver/g_mountver.h Wed Aug 7 19:28:35 2019 (r350694) @@ -38,25 +38,10 @@ #ifdef _KERNEL -#define G_MOUNTVER_DEBUG(lvl, ...) do { \ - if (g_mountver_debug >= (lvl)) { \ - printf("GEOM_MOUNTVER"); \ - if (g_mountver_debug > 0) \ - printf("[%u]", lvl); \ - printf(": "); \ - printf(__VA_ARGS__); \ - printf("\n"); \ - } \ -} while (0) -#define G_MOUNTVER_LOGREQ(bp, ...) do { \ - if (g_mountver_debug >= 2) { \ - printf("GEOM_MOUNTVER[2]: "); \ - printf(__VA_ARGS__); \ - printf(" "); \ - g_print_bio(bp); \ - printf("\n"); \ - } \ -} while (0) +#define G_MOUNTVER_DEBUG(lvl, ...) \ + _GEOM_DEBUG("GEOM_MOUNTVER", g_mountver_debug, (lvl), NULL, __VA_ARGS__) +#define G_MOUNTVER_LOGREQ(bp, ...) \ + _GEOM_DEBUG("GEOM_MOUNTVER", g_mountver_debug, 2, (bp), __VA_ARGS__) struct g_mountver_softc { TAILQ_HEAD(, bio) sc_queue; Modified: head/sys/geom/nop/g_nop.c ============================================================================== --- head/sys/geom/nop/g_nop.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/nop/g_nop.c Wed Aug 7 19:28:35 2019 (r350694) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include Modified: head/sys/geom/nop/g_nop.h ============================================================================== --- head/sys/geom/nop/g_nop.h Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/nop/g_nop.h Wed Aug 7 19:28:35 2019 (r350694) @@ -41,26 +41,11 @@ #define G_NOP_PHYSPATH_PASSTHROUGH "\255" #ifdef _KERNEL -#define G_NOP_DEBUG(lvl, ...) do { \ - if (g_nop_debug >= (lvl)) { \ - printf("GEOM_NOP"); \ - if (g_nop_debug > 0) \ - printf("[%u]", lvl); \ - printf(": "); \ - printf(__VA_ARGS__); \ - printf("\n"); \ - } \ -} while (0) +#define G_NOP_DEBUG(lvl, ...) \ + _GEOM_DEBUG("GEOM_NOP", g_nop_debug, (lvl), NULL, __VA_ARGS__) +#define G_NOP_LOGREQLVL(lvl, bp, ...) \ + _GEOM_DEBUG("GEOM_NOP", g_nop_debug, (lvl), (bp), __VA_ARGS__) #define G_NOP_LOGREQ(bp, ...) G_NOP_LOGREQLVL(2, bp, __VA_ARGS__) -#define G_NOP_LOGREQLVL(lvl, bp, ...) do { \ - if (g_nop_debug >= (lvl)) { \ - printf("GEOM_NOP[%d]: ", (lvl)); \ - printf(__VA_ARGS__); \ - printf(" "); \ - g_print_bio(bp); \ - printf("\n"); \ - } \ -} while (0) struct g_nop_delay; Modified: head/sys/geom/raid/g_raid.c ============================================================================== --- head/sys/geom/raid/g_raid.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/raid/g_raid.c Wed Aug 7 19:28:35 2019 (r350694) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: head/sys/geom/raid/g_raid.h ============================================================================== --- head/sys/geom/raid/g_raid.h Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/raid/g_raid.h Wed Aug 7 19:28:35 2019 (r350694) @@ -61,39 +61,13 @@ extern int g_raid_read_err_thresh; extern u_int g_raid_start_timeout; extern struct g_class g_raid_class; -#define G_RAID_DEBUG(lvl, fmt, ...) do { \ - if (g_raid_debug >= (lvl)) { \ - if (g_raid_debug > 0) { \ - printf("GEOM_RAID[%u]: " fmt "\n", \ - lvl, ## __VA_ARGS__); \ - } else { \ - printf("GEOM_RAID: " fmt "\n", \ - ## __VA_ARGS__); \ - } \ - } \ -} while (0) -#define G_RAID_DEBUG1(lvl, sc, fmt, ...) do { \ - if (g_raid_debug >= (lvl)) { \ - if (g_raid_debug > 0) { \ - printf("GEOM_RAID[%u]: %s: " fmt "\n", \ - lvl, (sc)->sc_name, ## __VA_ARGS__); \ - } else { \ - printf("GEOM_RAID: %s: " fmt "\n", \ - (sc)->sc_name, ## __VA_ARGS__); \ - } \ - } \ -} while (0) -#define G_RAID_LOGREQ(lvl, bp, fmt, ...) do { \ - if (g_raid_debug >= (lvl)) { \ - if (g_raid_debug > 0) { \ - printf("GEOM_RAID[%u]: " fmt " ", \ - lvl, ## __VA_ARGS__); \ - } else \ - printf("GEOM_RAID: " fmt " ", ## __VA_ARGS__); \ - g_print_bio(bp); \ - printf("\n"); \ - } \ -} while (0) +#define G_RAID_DEBUG(lvl, ...) \ + _GEOM_DEBUG("GEOM_RAID", g_raid_debug, (lvl), NULL, __VA_ARGS__) +#define G_RAID_DEBUG1(lvl, sc, fmt, ...) \ + _GEOM_DEBUG("GEOM_RAID", g_raid_debug, (lvl), NULL, "%s: " fmt, \ + (sc)->sc_name, ## __VA_ARGS__) +#define G_RAID_LOGREQ(lvl, bp, ...) \ + _GEOM_DEBUG("GEOM_RAID", g_raid_debug, (lvl), (bp), __VA_ARGS__) /* * Flags we use to distinguish I/O initiated by the TR layer to maintain Modified: head/sys/geom/raid/md_ddf.c ============================================================================== --- head/sys/geom/raid/md_ddf.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/raid/md_ddf.c Wed Aug 7 19:28:35 2019 (r350694) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "geom/raid/g_raid.h" #include "geom/raid/md_ddf.h" #include "g_raid_md_if.h" Modified: head/sys/geom/raid/md_intel.c ============================================================================== --- head/sys/geom/raid/md_intel.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/raid/md_intel.c Wed Aug 7 19:28:35 2019 (r350694) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "geom/raid/g_raid.h" #include "g_raid_md_if.h" Modified: head/sys/geom/raid/md_jmicron.c ============================================================================== --- head/sys/geom/raid/md_jmicron.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/raid/md_jmicron.c Wed Aug 7 19:28:35 2019 (r350694) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "geom/raid/g_raid.h" #include "g_raid_md_if.h" Modified: head/sys/geom/raid/md_nvidia.c ============================================================================== --- head/sys/geom/raid/md_nvidia.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/raid/md_nvidia.c Wed Aug 7 19:28:35 2019 (r350694) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "geom/raid/g_raid.h" #include "g_raid_md_if.h" Modified: head/sys/geom/raid/md_promise.c ============================================================================== --- head/sys/geom/raid/md_promise.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/raid/md_promise.c Wed Aug 7 19:28:35 2019 (r350694) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "geom/raid/g_raid.h" #include "g_raid_md_if.h" Modified: head/sys/geom/raid/md_sii.c ============================================================================== --- head/sys/geom/raid/md_sii.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/raid/md_sii.c Wed Aug 7 19:28:35 2019 (r350694) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "geom/raid/g_raid.h" #include "g_raid_md_if.h" Modified: head/sys/geom/raid/tr_concat.c ============================================================================== --- head/sys/geom/raid/tr_concat.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/raid/tr_concat.c Wed Aug 7 19:28:35 2019 (r350694) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "geom/raid/g_raid.h" #include "g_raid_tr_if.h" Modified: head/sys/geom/raid/tr_raid0.c ============================================================================== --- head/sys/geom/raid/tr_raid0.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/raid/tr_raid0.c Wed Aug 7 19:28:35 2019 (r350694) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "geom/raid/g_raid.h" #include "g_raid_tr_if.h" Modified: head/sys/geom/raid/tr_raid1.c ============================================================================== --- head/sys/geom/raid/tr_raid1.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/raid/tr_raid1.c Wed Aug 7 19:28:35 2019 (r350694) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "geom/raid/g_raid.h" #include "g_raid_tr_if.h" Modified: head/sys/geom/raid/tr_raid1e.c ============================================================================== --- head/sys/geom/raid/tr_raid1e.c Wed Aug 7 19:27:14 2019 (r350693) +++ head/sys/geom/raid/tr_raid1e.c Wed Aug 7 19:28:35 2019 (r350694) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Aug 7 19:30:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB3B9B5391; Wed, 7 Aug 2019 19:30:33 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463hRs5Xhhz4ClP; Wed, 7 Aug 2019 19:30:33 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9FE351971D; Wed, 7 Aug 2019 19:30:33 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77JUXdr084438; Wed, 7 Aug 2019 19:30:33 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77JUXxh084437; Wed, 7 Aug 2019 19:30:33 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201908071930.x77JUXxh084437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Wed, 7 Aug 2019 19:30:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350695 - head/lib/libcasper/services/cap_fileargs X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/services/cap_fileargs X-SVN-Commit-Revision: 350695 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 19:30:33 -0000 Author: oshogbo Date: Wed Aug 7 19:30:33 2019 New Revision: 350695 URL: https://svnweb.freebsd.org/changeset/base/350695 Log: cap_filergs: limit size of the file name The limit of the name in fileargs is twice the size of the MAXPATH. The nvlist will not add an element with the longer name. We can detect at this point that the path is too big, and simple return the same error as open(2) would. PR: 239700 Reported by: markj Tested by: markj MFC after: 2 weeks Modified: head/lib/libcasper/services/cap_fileargs/cap_fileargs.c Modified: head/lib/libcasper/services/cap_fileargs/cap_fileargs.c ============================================================================== --- head/lib/libcasper/services/cap_fileargs/cap_fileargs.c Wed Aug 7 19:28:35 2019 (r350694) +++ head/lib/libcasper/services/cap_fileargs/cap_fileargs.c Wed Aug 7 19:30:33 2019 (r350695) @@ -185,6 +185,11 @@ fileargs_create_limit(int argc, const char * const *ar nvlist_add_number(limits, "mode", (uint64_t)mode); for (i = 0; i < argc; i++) { + if (strlen(argv[i]) >= MAXPATHLEN) { + nvlist_destroy(limits); + errno = ENAMETOOLONG; + return (NULL); + } nvlist_add_null(limits, argv[i]); } From owner-svn-src-head@freebsd.org Wed Aug 7 19:38:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6CADCB55B6; Wed, 7 Aug 2019 19:38:58 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 463hdZ1ywJz4D8v; Wed, 7 Aug 2019 19:38:57 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 393AE2016D; Wed, 7 Aug 2019 15:38:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 07 Aug 2019 15:38:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm1; bh=6 c4Q7MqdOG0pJYWOK+YRpJ2Lqux6z1e8IG7ru09EOvA=; b=P3nueDoZnTOXsmHdz kV4dMdewjNazM7wi+nP8AXtyTQpRrrLFjupJmH2ZGz0jeD0SwUDJCz9sG46T8pKk MvcZ8AnK5eR3fCouILDrRyn83b5I10Uii/DI3ZRGVNDCrh97fAWA4iOHxeZkEmOm mSIbWm8FGKCqQd8z0CmH3eh1tVzAvFnHqaMuFB/dspPVqD0wJoZU8tQZZIJyVJKf WKQcBD1uCDELSCWfBgzmNzJCUSsE4g1IM3Y5+BT35DNWQcpaQcYBP9swV/7p0Arq 5Qr15fHB7ClUo+1o/2TmCkfhJNHD2iDVMrzEplugK6YlPhfGJkhPGUdEJbJ8JnNn RcV8A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=6c4Q7MqdOG0pJYWOK+YRpJ2Lqux6z1e8IG7ru09EO vA=; b=Z5OyByFRQeBVn0cBQKQ4fllaKx/Ax5Cs090dfBBoJUFiUWTzUzeemhjaw eUpSDYrKItvD6voZKpiDcA6QZ704bSTzXLlsMFbG+HG/H76eyTfQPNzH2M9Mxy7a h8tAOFu1hYnaxmkVxZs9ilsOUjUhZscBNtWJpfUbbimZSnwXQxsyH038jgFXiMvJ sdx/mCKJCwV7kCi3XB5akoI2JjcSfWFF2Tcn6GtHlAMJHNdLv6o7qXIU6oe7RrTZ UIEibEK/Xc1HVn3cCl3JegtXIiRXqCOz8v6lYRVxqcJjTooxZU6kdRZKM7+X/Xsj 9os+uIL13c4gRb5ww45V7xm+L7qEw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudduvddgudeflecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurheptggguffhjgffgffkfhfvofesth hqmhdthhdtvdenucfhrhhomhepufgtohhtthcunfhonhhguceoshgtohhtthhlsehsrghm shgtohdrohhrgheqnecuffhomhgrihhnpehfrhgvvggsshgurdhorhhgnecukfhppedule dvrdehhedrheegrdehkeenucfrrghrrghmpehmrghilhhfrhhomhepshgtohhtthhlsehs rghmshgtohdrohhrghenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [10.178.24.14] (unknown [192.55.54.58]) by mail.messagingengine.com (Postfix) with ESMTPA id CE7008005A; Wed, 7 Aug 2019 15:38:55 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r350694 - in head: share/man/man9 sys/dev/fdc sys/geom sys/geom/cache sys/geom/concat sys/geom/eli sys/geom/gate sys/geom/journal sys/geom/label sys/geom/linux_lvm sys/geom/mirror sys/g... From: Scott Long In-Reply-To: <201908071928.x77JSZw4084069@repo.freebsd.org> Date: Wed, 7 Aug 2019 13:38:54 -0600 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201908071928.x77JSZw4084069@repo.freebsd.org> To: Conrad Meyer X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 463hdZ1ywJz4D8v X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-0.997,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.96)[-0.963,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 19:38:58 -0000 Good work on this and on r347229 and the sbuf improvements! Scott > On Aug 7, 2019, at 1:28 PM, Conrad Meyer wrote: >=20 > Author: cem > Date: Wed Aug 7 19:28:35 2019 > New Revision: 350694 > URL: https://svnweb.freebsd.org/changeset/base/350694 >=20 > Log: > GEOM: Reduce unnecessary log interleaving with sbufs >=20 > Similar to what was done for device_printfs in r347229. >=20 > Convert g_print_bio() to a thin shim around g_format_bio(), which = acts on an > sbuf; documented in g_bio.9. From owner-svn-src-head@freebsd.org Wed Aug 7 19:45:45 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 83168B595A; Wed, 7 Aug 2019 19:45:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463hnP2rt0z4DfY; Wed, 7 Aug 2019 19:45:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 436F219ABE; Wed, 7 Aug 2019 19:45:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77JjjUW096335; Wed, 7 Aug 2019 19:45:45 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77Jji3J096333; Wed, 7 Aug 2019 19:45:44 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908071945.x77Jji3J096333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 7 Aug 2019 19:45:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350696 - in head/sys/amd64/vmm: amd intel X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys/amd64/vmm: amd intel X-SVN-Commit-Revision: 350696 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 19:45:45 -0000 Author: markj Date: Wed Aug 7 19:45:44 2019 New Revision: 350696 URL: https://svnweb.freebsd.org/changeset/base/350696 Log: Use designated initializers for vmm_ops. MFC after: 3 days Modified: head/sys/amd64/vmm/amd/svm.c head/sys/amd64/vmm/intel/vmx.c Modified: head/sys/amd64/vmm/amd/svm.c ============================================================================== --- head/sys/amd64/vmm/amd/svm.c Wed Aug 7 19:30:33 2019 (r350695) +++ head/sys/amd64/vmm/amd/svm.c Wed Aug 7 19:45:44 2019 (r350696) @@ -2283,20 +2283,20 @@ svm_vlapic_cleanup(void *arg, struct vlapic *vlapic) } struct vmm_ops vmm_ops_amd = { - svm_init, - svm_cleanup, - svm_restore, - svm_vminit, - svm_vmrun, - svm_vmcleanup, - svm_getreg, - svm_setreg, - vmcb_getdesc, - vmcb_setdesc, - svm_getcap, - svm_setcap, - svm_npt_alloc, - svm_npt_free, - svm_vlapic_init, - svm_vlapic_cleanup + .init = svm_init, + .cleanup = svm_cleanup, + .resume = svm_restore, + .vminit = svm_vminit, + .vmrun = svm_vmrun, + .vmcleanup = svm_vmcleanup, + .vmgetreg = svm_getreg, + .vmsetreg = svm_setreg, + .vmgetdesc = vmcb_getdesc, + .vmsetdesc = vmcb_setdesc, + .vmgetcap = svm_getcap, + .vmsetcap = svm_setcap, + .vmspace_alloc = svm_npt_alloc, + .vmspace_free = svm_npt_free, + .vlapic_init = svm_vlapic_init, + .vlapic_cleanup = svm_vlapic_cleanup, }; Modified: head/sys/amd64/vmm/intel/vmx.c ============================================================================== --- head/sys/amd64/vmm/intel/vmx.c Wed Aug 7 19:30:33 2019 (r350695) +++ head/sys/amd64/vmm/intel/vmx.c Wed Aug 7 19:45:44 2019 (r350696) @@ -3790,20 +3790,20 @@ vmx_vlapic_cleanup(void *arg, struct vlapic *vlapic) } struct vmm_ops vmm_ops_intel = { - vmx_init, - vmx_cleanup, - vmx_restore, - vmx_vminit, - vmx_run, - vmx_vmcleanup, - vmx_getreg, - vmx_setreg, - vmx_getdesc, - vmx_setdesc, - vmx_getcap, - vmx_setcap, - ept_vmspace_alloc, - ept_vmspace_free, - vmx_vlapic_init, - vmx_vlapic_cleanup, + .init = vmx_init, + .cleanup = vmx_cleanup, + .resume = vmx_restore, + .vminit = vmx_vminit, + .vmrun = vmx_run, + .vmcleanup = vmx_vmcleanup, + .vmgetreg = vmx_getreg, + .vmsetreg = vmx_setreg, + .vmgetdesc = vmx_getdesc, + .vmsetdesc = vmx_setdesc, + .vmgetcap = vmx_getcap, + .vmsetcap = vmx_setcap, + .vmspace_alloc = ept_vmspace_alloc, + .vmspace_free = ept_vmspace_free, + .vlapic_init = vmx_vlapic_init, + .vlapic_cleanup = vmx_vlapic_cleanup, }; From owner-svn-src-head@freebsd.org Wed Aug 7 20:12:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B26F5B6453; Wed, 7 Aug 2019 20:12:26 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 463jNB3W7bz4GTC; Wed, 7 Aug 2019 20:12:26 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x77KCOHh089133; Wed, 7 Aug 2019 13:12:24 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x77KCObt089132; Wed, 7 Aug 2019 13:12:24 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201908072012.x77KCObt089132@gndrsh.dnsmgr.net> Subject: Re: svn commit: r350550 - head/share/mk In-Reply-To: <86621ce5-3a8d-2e22-f146-3b0cc8252124@FreeBSD.org> To: Pedro Giffuni Date: Wed, 7 Aug 2019 13:12:24 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, freebsd-hackers@freebsd.org, freebsd-arch@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 463jNB3W7bz4GTC X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 20:12:26 -0000 > On 07/08/2019 11:00, John Baldwin wrote: > > On 8/6/19 9:56 AM, Glen Barber wrote: > >> On Sat, Aug 03, 2019 at 01:06:18AM +0000, John Baldwin wrote: > >>> Author: jhb > >>> Date: Sat Aug 3 01:06:17 2019 > >>> New Revision: 350550 > >>> URL: https://svnweb.freebsd.org/changeset/base/350550 > >>> > >>> Log: > >>> Flip REPRODUCIBLE_BUILD back to off by default in head. > >>> > >>> Having the full uname output can be useful on head even with > >>> unmodified trees or trees that newvers.sh fails to recognize as > >>> modified. > >>> > >>> Reviewed by: emaste > >>> Differential Revision: https://reviews.freebsd.org/D20895 > >>> > >> I would like to request this commit be reverted. While the original > >> commit message to enable this knob stated the commit would be reverted > >> after stable/12 branched, I have seen no public complaints about > >> enabling REPRODUCIBLE_BUILD by default (and quite honestly, do not see > >> the benefit of disabling it by default -- why wouldn't we want > >> reproducibility?). > >> > >> To me, this feels like a step backwards, with no tangible benefit. > >> Note, newvers.sh does properly detect a modified tree if it can find > >> the VCS metadata directory (i.e., .git, .svn) -- I know this because > >> I personally helped with it. > >> > >> In my opinion, those that want the non-reproducible metadata included in > >> output from 'uname -a' should set WITHOUT_REPRODUCIBLE_BUILDS in their > >> src.conf. Turning off a sane default for the benefit of what I suspect > >> is likely a short list of use cases feels like a step in the wrong > >> direction. > > My arguments for flipping this in head (and head only) are that the data > > provided in uname -a when this is disabled is useful for development, and > > that in head we do tailor settings towards development (e.g. GENERIC in > > head vs GENERIC in stable). > > > > The logic to handle modified trees has an inherent assumption that I think > > is false, at least for my workflow and I suspect many others. I do builds > > and tests of kernels on separate machines (VMs or bare metal) from where I > > use VCS to manage sources so that a kernel crash doesn't toast my source > > tree. The trees are then shared to the build/test machines via NFS. As > > a result, the build/test machines are not always able to detect that the > > tree is modified either because a subset of the checkout is exported via > > NFS, or the VCS tool isn't installed on the build/test machines because > > they are generally barebones systems with only a base installed. This > > does mean that flipping the knob off doesn't provide all of the same info, > > but it does provide the path, and the path matters because 'kgdb -n last' > > uses it, and because if you use separate directories for separate projects > > (e.g. git worktrees), then the path tells you which test kernel you booted. > > (It is not uncommon for me to have several test projects in flight on a > > single test machine for different branches.) > > > > In the original discussion on arch, we collectively recognized that > > developer builds vs release builds were different and needed different > > defaults. The compromise reached at that time was to depend on the VCS > > to detect developer builds to choose the policy. What I have found is that > > in practice for at least my workflow that doesn't actually work. I posit > > that the majority of kernels built from head are developer builds, not > > releases, and that the default should cater to that. You could also always > > patch release.sh to set WITH_REPRODUCIBLE_BUILD in the environment which I > > think would give a more accurate sense of when builds are releases or not. > > > > However, I will yield to whatever the consensus is. > > +1 keeping metadata in head. I am conflicted on this one, and I think there is a reasonable argument on both sides, but from what I have read here this appears to be mostly the kernel that is at issue, loss of the meta data from newvers.sh in the kernel is infact a PITA, even on stable or production release systems. I propose a compromise, add 2 knobs: WITHOUT_REPRODUCIBLE_KERNEL (aka get your metadata in uname) WITH_REPRODUCIBLE_USERLAND (aka reproducible userland) WITH{,OUT}_REPRODUCIBLE_BUILD overrides both, for backwards compat, and neither should be defined by default. Somehow set WITH_REPRODUCIBLE_KERNEL for builds of GENERIC for releases/snapshots, but do not ship the system with it set (I can here a growl from Glen on this) Thus we build a reproducible kernel and ship it with the system but if the user builds a kernel it gets meta data to indicate it is no longer a stock kernel. FYI, upon finding I could not figure out what kernel I was running after installing 12.0 release I turnd off REPRODUCIBLE on my kernel build VM for 12.0. I do leave it on if I am building userland. Thoughts? -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Wed Aug 7 20:13:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6704B65A0; Wed, 7 Aug 2019 20:13:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463jPg5Pgyz4GlG; Wed, 7 Aug 2019 20:13:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B34A1A04A; Wed, 7 Aug 2019 20:13:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77KDhTB014932; Wed, 7 Aug 2019 20:13:43 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77KDhgM014931; Wed, 7 Aug 2019 20:13:43 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201908072013.x77KDhgM014931@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 7 Aug 2019 20:13:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350697 - head/lib/libc/string X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/lib/libc/string X-SVN-Commit-Revision: 350697 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 20:13:44 -0000 Author: dim Date: Wed Aug 7 20:13:43 2019 New Revision: 350697 URL: https://svnweb.freebsd.org/changeset/base/350697 Log: Fix a possible segfault in wcsxfrm(3) and wcsxfrm_l(3). If the length of the source wide character string, passed in via the "size_t n" parameter, is set to zero, the function should only return the required length for the destination wide character string. In this case, it should *not* attempt to write to the destination, so the "dst" parameter is permitted to be NULL. However, when the internally called _collate_wxfrm() function returns an error, such as when using the "C" locale, as a fallback wcscpy(3) or wcsncpy(3) are used. But if the input length is zero, wcsncpy(3) will be called with a length of -1! If the "dst" parameter is NULL, this will immediately result in a segfault, or if "dst" is a valid pointer, it will most likely result in unexpectedly overwritten memory. Fix this by explicitly checking for an input length greater than zero, before calling wcsncpy(3). Note that a similar situation does not occur in strxfrm(3), the plain character version of this function, as it uses strlcpy(3) for the error case. The strlcpy(3) function does not write to the destination if the input length is zero. MFC after: 1 week Modified: head/lib/libc/string/wcsxfrm.c Modified: head/lib/libc/string/wcsxfrm.c ============================================================================== --- head/lib/libc/string/wcsxfrm.c Wed Aug 7 19:45:44 2019 (r350696) +++ head/lib/libc/string/wcsxfrm.c Wed Aug 7 20:13:43 2019 (r350697) @@ -73,7 +73,7 @@ error: slen = wcslen(src); if (slen < len) (void) wcscpy(dest, src); - else { + else if (len > 0) { (void) wcsncpy(dest, src, len - 1); dest[len - 1] = L'\0'; } From owner-svn-src-head@freebsd.org Wed Aug 7 20:27:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3709B6B59; Wed, 7 Aug 2019 20:27:37 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463jjh6m35z4Hby; Wed, 7 Aug 2019 20:27:36 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-ot1-x32c.google.com with SMTP id q20so109448574otl.0; Wed, 07 Aug 2019 13:27:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=h7823emz+A8txgLOwhiX8ZIQX+qXPxr2GlwMIi9MVnw=; b=NhMhym77Wz3MLC7Jk4WzikyaKnHmtQ8kP4UWhEAEuThRPwffShWJyM9ozfKw4nDMsW m63uOaTS78CdwXOiekTv99B7PSJsjVRa9fP9BLmZ+SIvW3YnUp+txEqQP70MLL6x0+q1 4PPO51QttrLUHo+sArsZGFTO9CfmENzmFZmHTej3gJaBL1X4jMxI1T3rzWYo6P64QXnL CkcTMU1ee9G+g3f+XjJDwPvwBUAZBISU+5PBNza5NlnLyQ6qqouHBRtfxz7Whp4+yaNx fNV9bP8jk9JeDlqJ52xfHlVQoYLNvPSeWf7cgLm/FfcBCqFcdsKH+P3013V1KA/utdz2 La3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=h7823emz+A8txgLOwhiX8ZIQX+qXPxr2GlwMIi9MVnw=; b=J1hZRP7qSXRjzfUKeoGk6WsZrSrMPAMukbeC0oCQe7KWiV5FC6ygJk0pHyt/PhcDFU FajUXJQ6aj9k7Q3GHc6hxcZcCk1vdnUgnbUzHfP1kzsBRJH3Ot/G4msmRs/IeqWWHvSB pZ7z2jXRkZbritsf9TfjVWBxyP8i6+baLOwmR6b/5Nxj+0ci3NVFwl3z6/peCNrbbAKM 3zb4A+Sook+qic0Ww/j/va13LXyv8ig1zYu5NjQK0nCcKEb+hgbXOawnkINUFuoU4XQY nA22mmkKnTFcOigm2uOH8FaX56JIdaBsnaJU6+tp/tJDVRM1NGA8/dOMe3m8QhNIa6NO s8kQ== X-Gm-Message-State: APjAAAUYm74Wyze/IzEthhBcIwbui57q8EbuILXTGRBtTTzN512QlFb3 VbX4bkPyu73wQ8S5g42Qq2yrKYd2pSk= X-Google-Smtp-Source: APXvYqw4eQCDftgX1+aiJu+4j67DzbY8MpQRapvjZ/lzPRzNNMR+YBOElyjIroqWgjB2t8K5No81Hw== X-Received: by 2002:a5d:9bc6:: with SMTP id d6mr10206293ion.160.1565209655207; Wed, 07 Aug 2019 13:27:35 -0700 (PDT) Received: from raichu (toroon0560w-lp130-04-184-145-252-124.dsl.bell.ca. [184.145.252.124]) by smtp.gmail.com with ESMTPSA id s10sm192649922iod.46.2019.08.07.13.27.34 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 07 Aug 2019 13:27:34 -0700 (PDT) Sender: Mark Johnston Date: Wed, 7 Aug 2019 16:27:32 -0400 From: Mark Johnston To: Li-Wen Hsu Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r350512 - head/tests/sys/kern Message-ID: <20190807202732.GD1377@raichu> References: <201908011819.x71IJG0M076399@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201908011819.x71IJG0M076399@repo.freebsd.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-Rspamd-Queue-Id: 463jjh6m35z4Hby X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=NhMhym77; dmarc=none; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::32c as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-5.63 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-2.94)[ip: (-9.16), ipnet: 2607:f8b0::/32(-3.03), asn: 15169(-2.43), country: US(-0.05)]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-0.99)[-0.993,0]; RCVD_IN_DNSWL_NONE(0.00)[c.2.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[124.252.145.184.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; MID_RHS_NOT_FQDN(0.50)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 20:27:37 -0000 On Thu, Aug 01, 2019 at 06:19:16PM +0000, Li-Wen Hsu wrote: > Author: lwhsu > Date: Thu Aug 1 18:19:16 2019 > New Revision: 350512 > URL: https://svnweb.freebsd.org/changeset/base/350512 > > Log: > Only skip test cases sometimes failing in CI when they are running in CI > > Suggested by: jhb > Sponsored by: The FreeBSD Foundation This seems to break running the tests manually; atf dies because the "ci" variable is not defined. I have to use an invocation like this to avoid that: $ kyua -v test_suites.FreeBSD.ci=false test ptrace_test I suspect that share/mk/suite.test.mk needs to be augmented somehow to set this variable to "false" by default, so that the CI infrastructure can override that. > Modified: > head/tests/sys/kern/ptrace_test.c > > Modified: head/tests/sys/kern/ptrace_test.c > ============================================================================== > --- head/tests/sys/kern/ptrace_test.c Thu Aug 1 17:59:56 2019 (r350511) > +++ head/tests/sys/kern/ptrace_test.c Thu Aug 1 18:19:16 2019 (r350512) > @@ -258,7 +258,8 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debug > int cpipe[2], dpipe[2], status; > char c; > > - atf_tc_skip("https://bugs.freebsd.org/239399"); > + if (atf_tc_get_config_var_as_bool(tc, "ci")) > + atf_tc_skip("https://bugs.freebsd.org/239399"); > > ATF_REQUIRE(pipe(cpipe) == 0); > ATF_REQUIRE((child = fork()) != -1); > @@ -801,7 +802,8 @@ ATF_TC_BODY(ptrace__follow_fork_both_attached_unrelate > pid_t children[2], fpid, wpid; > int cpipe[2], status; > > - atf_tc_skip("https://bugs.freebsd.org/239397"); > + if (atf_tc_get_config_var_as_bool(tc, "ci")) > + atf_tc_skip("https://bugs.freebsd.org/239397"); > > ATF_REQUIRE(pipe(cpipe) == 0); > ATF_REQUIRE((fpid = fork()) != -1); > @@ -871,7 +873,8 @@ ATF_TC_BODY(ptrace__follow_fork_child_detached_unrelat > pid_t children[2], fpid, wpid; > int cpipe[2], status; > > - atf_tc_skip("https://bugs.freebsd.org/239292"); > + if (atf_tc_get_config_var_as_bool(tc, "ci")) > + atf_tc_skip("https://bugs.freebsd.org/239292"); > > ATF_REQUIRE(pipe(cpipe) == 0); > ATF_REQUIRE((fpid = fork()) != -1); > @@ -936,7 +939,8 @@ ATF_TC_BODY(ptrace__follow_fork_parent_detached_unrela > pid_t children[2], fpid, wpid; > int cpipe[2], status; > > - atf_tc_skip("https://bugs.freebsd.org/239425"); > + if (atf_tc_get_config_var_as_bool(tc, "ci")) > + atf_tc_skip("https://bugs.freebsd.org/239425"); > > ATF_REQUIRE(pipe(cpipe) == 0); > ATF_REQUIRE((fpid = fork()) != -1); > @@ -2084,7 +2088,8 @@ ATF_TC_BODY(ptrace__PT_KILL_competing_stop, tc) > struct ptrace_lwpinfo pl; > struct sched_param sched_param; > > - atf_tc_skip("https://bugs.freebsd.org/220841"); > + if (atf_tc_get_config_var_as_bool(tc, "ci")) > + atf_tc_skip("https://bugs.freebsd.org/220841"); > > ATF_REQUIRE((fpid = fork()) != -1); > if (fpid == 0) { > From owner-svn-src-head@freebsd.org Wed Aug 7 20:27:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 738B9B6BA6; Wed, 7 Aug 2019 20:27:50 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463jjy2YpKz4HkD; Wed, 7 Aug 2019 20:27:50 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from [192.168.0.5] (unknown [181.52.72.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: pfg) by smtp.freebsd.org (Postfix) with ESMTPSA id 59B6A17353; Wed, 7 Aug 2019 20:27:49 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Subject: Re: svn commit: r350550 - head/share/mk To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, freebsd-hackers@freebsd.org, freebsd-arch@freebsd.org References: <201908072012.x77KCObt089132@gndrsh.dnsmgr.net> From: Pedro Giffuni Organization: FreeBSD Message-ID: Date: Wed, 7 Aug 2019 15:27:48 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <201908072012.x77KCObt089132@gndrsh.dnsmgr.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 20:27:50 -0000 On 07/08/2019 15:12, Rodney W. Grimes wrote: >> On 07/08/2019 11:00, John Baldwin wrote: >>> On 8/6/19 9:56 AM, Glen Barber wrote: >>>> On Sat, Aug 03, 2019 at 01:06:18AM +0000, John Baldwin wrote: >>>>> Author: jhb >>>>> Date: Sat Aug 3 01:06:17 2019 >>>>> New Revision: 350550 >>>>> URL: https://svnweb.freebsd.org/changeset/base/350550 >>>>> >>>>> Log: >>>>> Flip REPRODUCIBLE_BUILD back to off by default in head. >>>>> >>>>> Having the full uname output can be useful on head even with >>>>> unmodified trees or trees that newvers.sh fails to recognize as >>>>> modified. >>>>> >>>>> Reviewed by: emaste >>>>> Differential Revision: https://reviews.freebsd.org/D20895 >>>>> >>>> I would like to request this commit be reverted. While the original >>>> commit message to enable this knob stated the commit would be reverted >>>> after stable/12 branched, I have seen no public complaints about >>>> enabling REPRODUCIBLE_BUILD by default (and quite honestly, do not see >>>> the benefit of disabling it by default -- why wouldn't we want >>>> reproducibility?). >>>> >>>> To me, this feels like a step backwards, with no tangible benefit. >>>> Note, newvers.sh does properly detect a modified tree if it can find >>>> the VCS metadata directory (i.e., .git, .svn) -- I know this because >>>> I personally helped with it. >>>> >>>> In my opinion, those that want the non-reproducible metadata included in >>>> output from 'uname -a' should set WITHOUT_REPRODUCIBLE_BUILDS in their >>>> src.conf. Turning off a sane default for the benefit of what I suspect >>>> is likely a short list of use cases feels like a step in the wrong >>>> direction. >>> My arguments for flipping this in head (and head only) are that the data >>> provided in uname -a when this is disabled is useful for development, and >>> that in head we do tailor settings towards development (e.g. GENERIC in >>> head vs GENERIC in stable). >>> >>> The logic to handle modified trees has an inherent assumption that I think >>> is false, at least for my workflow and I suspect many others. I do builds >>> and tests of kernels on separate machines (VMs or bare metal) from where I >>> use VCS to manage sources so that a kernel crash doesn't toast my source >>> tree. The trees are then shared to the build/test machines via NFS. As >>> a result, the build/test machines are not always able to detect that the >>> tree is modified either because a subset of the checkout is exported via >>> NFS, or the VCS tool isn't installed on the build/test machines because >>> they are generally barebones systems with only a base installed. This >>> does mean that flipping the knob off doesn't provide all of the same info, >>> but it does provide the path, and the path matters because 'kgdb -n last' >>> uses it, and because if you use separate directories for separate projects >>> (e.g. git worktrees), then the path tells you which test kernel you booted. >>> (It is not uncommon for me to have several test projects in flight on a >>> single test machine for different branches.) >>> >>> In the original discussion on arch, we collectively recognized that >>> developer builds vs release builds were different and needed different >>> defaults. The compromise reached at that time was to depend on the VCS >>> to detect developer builds to choose the policy. What I have found is that >>> in practice for at least my workflow that doesn't actually work. I posit >>> that the majority of kernels built from head are developer builds, not >>> releases, and that the default should cater to that. You could also always >>> patch release.sh to set WITH_REPRODUCIBLE_BUILD in the environment which I >>> think would give a more accurate sense of when builds are releases or not. >>> >>> However, I will yield to whatever the consensus is. >> +1 keeping metadata in head. > I am conflicted on this one, and I think there is a reasonable argument > on both sides, but from what I have read here this appears to be mostly > the kernel that is at issue, loss of the meta data from newvers.sh in > the kernel is infact a PITA, even on stable or production release > systems. > > I propose a compromise, add 2 knobs: > WITHOUT_REPRODUCIBLE_KERNEL (aka get your metadata in uname) > WITH_REPRODUCIBLE_USERLAND (aka reproducible userland) > > WITH{,OUT}_REPRODUCIBLE_BUILD overrides both, for backwards compat, > and neither should be defined by default. Too complex IMHO. Either the system is reproducible or it isn't. > Somehow set WITH_REPRODUCIBLE_KERNEL for builds of GENERIC > for releases/snapshots, but do not ship the system with it > set (I can here a growl from Glen on this) Thus we build > a reproducible kernel and ship it with the system but if > the user builds a kernel it gets meta data to indicate it > is no longer a stock kernel. > FYI, upon finding I could not figure out what kernel I was running > after installing 12.0 release I turnd off REPRODUCIBLE on my kernel > build VM for 12.0. I do leave it on if I am building userland. > > Thoughts? Among other things, reproducible builds implies that pkg upgrades are smaller. I see it makes sense to make releases, and in fact -stable, completely reproducible. For -current I am fine with it not being reproducible, All just IMHO. Pedro. From owner-svn-src-head@freebsd.org Wed Aug 7 20:28:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05468B6D60; Wed, 7 Aug 2019 20:28:28 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463jkg6LkSz4J42; Wed, 7 Aug 2019 20:28:27 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD2941A217; Wed, 7 Aug 2019 20:28:27 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77KSRwm021697; Wed, 7 Aug 2019 20:28:27 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77KSRWA021696; Wed, 7 Aug 2019 20:28:27 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908072028.x77KSRWA021696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 7 Aug 2019 20:28:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350698 - head/sys/modules/fusefs X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sys/modules/fusefs X-SVN-Commit-Revision: 350698 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 20:28:28 -0000 Author: asomers Date: Wed Aug 7 20:28:27 2019 New Revision: 350698 URL: https://svnweb.freebsd.org/changeset/base/350698 Log: Remove the fuse.ko -> fusefs.ko symlink On FreeBSD 13.0, the fuse driver will always be known as fusefs. The backwards compatibility symlink will still be used for stable/12 and stable/11, though. Reported by: jhibbits Reviewed by: rgrimes, imp, cem MFC after: Never Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21181 Modified: head/sys/modules/fusefs/Makefile Modified: head/sys/modules/fusefs/Makefile ============================================================================== --- head/sys/modules/fusefs/Makefile Wed Aug 7 20:13:43 2019 (r350697) +++ head/sys/modules/fusefs/Makefile Wed Aug 7 20:28:27 2019 (r350698) @@ -7,23 +7,4 @@ SRCS= vnode_if.h \ fuse_node.c fuse_io.c fuse_device.c fuse_ipc.c fuse_file.c \ fuse_vfsops.c fuse_vnops.c fuse_internal.c fuse_main.c -# Symlink for backwards compatibility with systems installed at 12.0 or older -.if ${MACHINE_CPUARCH} != "powerpc" -SYMLINKS= ${KMOD}.ko ${KMODDIR}/fuse.ko -.else -# Some PPC systems use msdosfs for /boot, which can't handle links or symlinks -afterinstall: alias alias_debug -alias: .PHONY - ${INSTALL} -T release -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ - ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR}/fuse.ko -.if defined(DEBUG_FLAGS) && !defined(INSTALL_NODEBUG) && "${MK_KERNEL_SYMBOLS}" != "no" -alias_debug: .PHONY - ${INSTALL} -T debug -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ - ${_INSTALLFLAGS} ${PROG}.debug \ - ${DESTDIR}${KERN_DEBUGDIR}${KMODDIR}/fuse.ko -.else -alias_debug: .PHONY -.endif -.endif - .include From owner-svn-src-head@freebsd.org Wed Aug 7 20:41:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBF43B73B1; Wed, 7 Aug 2019 20:41:16 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 463k1R2q6lz4Jr1; Wed, 7 Aug 2019 20:41:14 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x77KfDIK089237; Wed, 7 Aug 2019 13:41:13 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x77KfDv1089236; Wed, 7 Aug 2019 13:41:13 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201908072041.x77KfDv1089236@gndrsh.dnsmgr.net> Subject: Re: svn commit: r350550 - head/share/mk In-Reply-To: To: Pedro Giffuni Date: Wed, 7 Aug 2019 13:41:13 -0700 (PDT) CC: rgrimes@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, freebsd-hackers@freebsd.org, freebsd-arch@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 463k1R2q6lz4Jr1 X-Spamd-Bar: + Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd@gndrsh.dnsmgr.net X-Spamd-Result: default: False [1.72 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; NEURAL_SPAM_MEDIUM(0.73)[0.727,0]; IP_SCORE(0.05)[ip: (0.15), ipnet: 69.59.192.0/19(0.08), asn: 13868(0.05), country: US(-0.05)]; NEURAL_HAM_SHORT(-0.63)[-0.630,0]; NEURAL_SPAM_LONG(0.68)[0.679,0]; RCPT_COUNT_SEVEN(0.00)[7]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 20:41:16 -0000 > On 07/08/2019 15:12, Rodney W. Grimes wrote: > >> On 07/08/2019 11:00, John Baldwin wrote: > >>> On 8/6/19 9:56 AM, Glen Barber wrote: > >>>> On Sat, Aug 03, 2019 at 01:06:18AM +0000, John Baldwin wrote: > >>>>> Author: jhb > >>>>> Date: Sat Aug 3 01:06:17 2019 > >>>>> New Revision: 350550 > >>>>> URL: https://svnweb.freebsd.org/changeset/base/350550 > >>>>> > >>>>> Log: > >>>>> Flip REPRODUCIBLE_BUILD back to off by default in head. > >>>>> > >>>>> Having the full uname output can be useful on head even with > >>>>> unmodified trees or trees that newvers.sh fails to recognize as > >>>>> modified. > >>>>> > >>>>> Reviewed by: emaste > >>>>> Differential Revision: https://reviews.freebsd.org/D20895 > >>>>> > >>>> I would like to request this commit be reverted. While the original > >>>> commit message to enable this knob stated the commit would be reverted > >>>> after stable/12 branched, I have seen no public complaints about > >>>> enabling REPRODUCIBLE_BUILD by default (and quite honestly, do not see > >>>> the benefit of disabling it by default -- why wouldn't we want > >>>> reproducibility?). > >>>> > >>>> To me, this feels like a step backwards, with no tangible benefit. > >>>> Note, newvers.sh does properly detect a modified tree if it can find > >>>> the VCS metadata directory (i.e., .git, .svn) -- I know this because > >>>> I personally helped with it. > >>>> > >>>> In my opinion, those that want the non-reproducible metadata included in > >>>> output from 'uname -a' should set WITHOUT_REPRODUCIBLE_BUILDS in their > >>>> src.conf. Turning off a sane default for the benefit of what I suspect > >>>> is likely a short list of use cases feels like a step in the wrong > >>>> direction. > >>> My arguments for flipping this in head (and head only) are that the data > >>> provided in uname -a when this is disabled is useful for development, and > >>> that in head we do tailor settings towards development (e.g. GENERIC in > >>> head vs GENERIC in stable). > >>> > >>> The logic to handle modified trees has an inherent assumption that I think > >>> is false, at least for my workflow and I suspect many others. I do builds > >>> and tests of kernels on separate machines (VMs or bare metal) from where I > >>> use VCS to manage sources so that a kernel crash doesn't toast my source > >>> tree. The trees are then shared to the build/test machines via NFS. As > >>> a result, the build/test machines are not always able to detect that the > >>> tree is modified either because a subset of the checkout is exported via > >>> NFS, or the VCS tool isn't installed on the build/test machines because > >>> they are generally barebones systems with only a base installed. This > >>> does mean that flipping the knob off doesn't provide all of the same info, > >>> but it does provide the path, and the path matters because 'kgdb -n last' > >>> uses it, and because if you use separate directories for separate projects > >>> (e.g. git worktrees), then the path tells you which test kernel you booted. > >>> (It is not uncommon for me to have several test projects in flight on a > >>> single test machine for different branches.) > >>> > >>> In the original discussion on arch, we collectively recognized that > >>> developer builds vs release builds were different and needed different > >>> defaults. The compromise reached at that time was to depend on the VCS > >>> to detect developer builds to choose the policy. What I have found is that > >>> in practice for at least my workflow that doesn't actually work. I posit > >>> that the majority of kernels built from head are developer builds, not > >>> releases, and that the default should cater to that. You could also always > >>> patch release.sh to set WITH_REPRODUCIBLE_BUILD in the environment which I > >>> think would give a more accurate sense of when builds are releases or not. > >>> > >>> However, I will yield to whatever the consensus is. > >> +1 keeping metadata in head. > > I am conflicted on this one, and I think there is a reasonable argument > > on both sides, but from what I have read here this appears to be mostly > > the kernel that is at issue, loss of the meta data from newvers.sh in > > the kernel is infact a PITA, even on stable or production release > > systems. > > > > I propose a compromise, add 2 knobs: > > WITHOUT_REPRODUCIBLE_KERNEL (aka get your metadata in uname) > > WITH_REPRODUCIBLE_USERLAND (aka reproducible userland) > > > > WITH{,OUT}_REPRODUCIBLE_BUILD overrides both, for backwards compat, > > and neither should be defined by default. > Too complex IMHO. Either the system is reproducible or it isn't. > > Somehow set WITH_REPRODUCIBLE_KERNEL for builds of GENERIC > > for releases/snapshots, but do not ship the system with it > > set (I can here a growl from Glen on this) Thus we build > > a reproducible kernel and ship it with the system but if > > the user builds a kernel it gets meta data to indicate it > > is no longer a stock kernel. > > FYI, upon finding I could not figure out what kernel I was running > > after installing 12.0 release I turnd off REPRODUCIBLE on my kernel > > build VM for 12.0. I do leave it on if I am building userland. > > > > Thoughts? > > Among other things, reproducible builds implies that pkg upgrades are Do you mean freebsd-update? > smaller. I see it makes sense to make releases, and in fact -stable, > completely reproducible. For -current I am fine with it not being > reproducible, > > All just IMHO. Let me try to add a case for it on ^head, weekly snapshots are built, if ^head was running reproducible it would be possible to diff these snapshots in a meaniful way. It would also mean one could get pretty creative with ZFS, zfs-snapshots and the built snapshots to actually have on line almost all binary versions of ^head in a fairly compact form. > Pedro. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Wed Aug 7 21:02:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 36EADB7CF2; Wed, 7 Aug 2019 21:02:24 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463kTr0gWPz4L60; Wed, 7 Aug 2019 21:02:24 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED0B81A828; Wed, 7 Aug 2019 21:02:23 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77L2Nwb045958; Wed, 7 Aug 2019 21:02:23 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77L2NpO045957; Wed, 7 Aug 2019 21:02:23 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201908072102.x77L2NpO045957@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Wed, 7 Aug 2019 21:02:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350700 - head/tests/sys/kern X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/tests/sys/kern X-SVN-Commit-Revision: 350700 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 21:02:24 -0000 Author: lwhsu Date: Wed Aug 7 21:02:23 2019 New Revision: 350700 URL: https://svnweb.freebsd.org/changeset/base/350700 Log: Get configuration variable with default value for not breaking default setting Reported by: markj Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/kern/ptrace_test.c Modified: head/tests/sys/kern/ptrace_test.c ============================================================================== --- head/tests/sys/kern/ptrace_test.c Wed Aug 7 20:36:36 2019 (r350699) +++ head/tests/sys/kern/ptrace_test.c Wed Aug 7 21:02:23 2019 (r350700) @@ -259,7 +259,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debug int cpipe[2], dpipe[2], status; char c; - if (atf_tc_get_config_var_as_bool(tc, "ci")) + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) atf_tc_skip("https://bugs.freebsd.org/239399"); ATF_REQUIRE(pipe(cpipe) == 0); @@ -803,7 +803,7 @@ ATF_TC_BODY(ptrace__follow_fork_both_attached_unrelate pid_t children[2], fpid, wpid; int cpipe[2], status; - if (atf_tc_get_config_var_as_bool(tc, "ci")) + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) atf_tc_skip("https://bugs.freebsd.org/239397"); ATF_REQUIRE(pipe(cpipe) == 0); @@ -874,7 +874,7 @@ ATF_TC_BODY(ptrace__follow_fork_child_detached_unrelat pid_t children[2], fpid, wpid; int cpipe[2], status; - if (atf_tc_get_config_var_as_bool(tc, "ci")) + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) atf_tc_skip("https://bugs.freebsd.org/239292"); ATF_REQUIRE(pipe(cpipe) == 0); @@ -940,7 +940,7 @@ ATF_TC_BODY(ptrace__follow_fork_parent_detached_unrela pid_t children[2], fpid, wpid; int cpipe[2], status; - if (atf_tc_get_config_var_as_bool(tc, "ci")) + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) atf_tc_skip("https://bugs.freebsd.org/239425"); ATF_REQUIRE(pipe(cpipe) == 0); @@ -2089,7 +2089,7 @@ ATF_TC_BODY(ptrace__PT_KILL_competing_stop, tc) struct ptrace_lwpinfo pl; struct sched_param sched_param; - if (atf_tc_get_config_var_as_bool(tc, "ci")) + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) atf_tc_skip("https://bugs.freebsd.org/220841"); ATF_REQUIRE((fpid = fork()) != -1); From owner-svn-src-head@freebsd.org Wed Aug 7 21:04:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3EB2B7DA6; Wed, 7 Aug 2019 21:04:26 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: from mail-vs1-f54.google.com (mail-vs1-f54.google.com [209.85.217.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463kXB4n3yz4LGH; Wed, 7 Aug 2019 21:04:26 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: by mail-vs1-f54.google.com with SMTP id j26so61624116vsn.10; Wed, 07 Aug 2019 14:04:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=R9Y/Kz8/B5pR78bDbKMlIiAx4P+5sHZ6XtOOWa4mOZY=; b=fj6h6XpoXkXZvz63c+KK2ImV7LTukyQ/bpjsldwQeEllKT7a3uzB0fTSO299bkXhNn 0ntSjCEJzB0bZ5wYs3RTXYiCkWRn3hIpwf9jTcYQJMVHz57AJHeShki+IDeGQxbunDoU UgM1muwqK5+pLk2jJMSt01L4QArkwnx2C16r3rnPFQyTSzGc8ebH93HgtTV8P9EL3E1o DcVTLsZX3IUGqqKQ8zsw4inky+qmIvdo/CUDbHPy+JEE/DiXDMSgo9HXgJCXjW8sC+8P mK12hs6EJPxpLNHZ3B6wQjl5gd9+LDtfYE3n1BsPY6ZPEBRpgwmggAzsE5ZEVZnHBH1S GQHA== X-Gm-Message-State: APjAAAVdNPmV3HTa5IYpRI7RKuqCQlSLN7D6pfJsJGE+vKlwGKRgIqcz BpVpkZmeywPY72JiXG21+VqPBXc0e1AR8iXhnujsUQ== X-Google-Smtp-Source: APXvYqy8eUxXgmSkQwPzFgBe8W89Jh8L/5SAfrF51ifQsOx3WWFNBfPZe34OTCBgG3E2axoY8+4MxgHouE5vGw2nD+E= X-Received: by 2002:a05:6102:458:: with SMTP id e24mr7052529vsq.31.1565211865028; Wed, 07 Aug 2019 14:04:25 -0700 (PDT) MIME-Version: 1.0 References: <201908011819.x71IJG0M076399@repo.freebsd.org> <20190807202732.GD1377@raichu> In-Reply-To: <20190807202732.GD1377@raichu> From: Li-Wen Hsu Date: Thu, 8 Aug 2019 05:04:13 +0800 Message-ID: Subject: Re: svn commit: r350512 - head/tests/sys/kern To: Mark Johnston Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 463kXB4n3yz4LGH X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 21:04:26 -0000 On Thu, Aug 8, 2019 at 4:27 AM Mark Johnston wrote: > > On Thu, Aug 01, 2019 at 06:19:16PM +0000, Li-Wen Hsu wrote: > > Author: lwhsu > > Date: Thu Aug 1 18:19:16 2019 > > New Revision: 350512 > > URL: https://svnweb.freebsd.org/changeset/base/350512 > > > > Log: > > Only skip test cases sometimes failing in CI when they are running in CI > > > > Suggested by: jhb > > Sponsored by: The FreeBSD Foundation > > This seems to break running the tests manually; atf dies because the > "ci" variable is not defined. I have to use an invocation like this to > avoid that: > > $ kyua -v test_suites.FreeBSD.ci=false test ptrace_test > > I suspect that share/mk/suite.test.mk needs to be augmented somehow to > set this variable to "false" by default, so that the CI infrastructure > can override that. Thanks for catching this! I feel that the better approach is using function that gets this variable with default value, for keeping things simple. Best, Li-Wen From owner-svn-src-head@freebsd.org Wed Aug 7 21:08:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14332B7E50; Wed, 7 Aug 2019 21:08:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463kcH6lqsz4LQx; Wed, 7 Aug 2019 21:07:59 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4D471A949; Wed, 7 Aug 2019 21:07:59 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77L7xho046484; Wed, 7 Aug 2019 21:07:59 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77L7xvY046483; Wed, 7 Aug 2019 21:07:59 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201908072107.x77L7xvY046483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 7 Aug 2019 21:07:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350701 - head/share/man/man8 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/share/man/man8 X-SVN-Commit-Revision: 350701 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 21:08:00 -0000 Author: avg Date: Wed Aug 7 21:07:59 2019 New Revision: 350701 URL: https://svnweb.freebsd.org/changeset/base/350701 Log: rc.8: add a reference to service(8) While here: - use Xr macro for a reference to sysrc(8) - clarify that rc.shutdown invokes rc.d scripts with "faststop" argument MFC after: 1 week Modified: head/share/man/man8/rc.8 Modified: head/share/man/man8/rc.8 ============================================================================== --- head/share/man/man8/rc.8 Wed Aug 7 21:02:23 2019 (r350700) +++ head/share/man/man8/rc.8 Wed Aug 7 21:07:59 2019 (r350701) @@ -31,7 +31,7 @@ .\" @(#)rc.8 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd December 29, 2018 +.Dd August 7, 2019 .Dt RC 8 .Os .Sh NAME @@ -89,8 +89,13 @@ The directories contain scripts which will be automatically executed at boot time and shutdown time. .Pp -The sysrc(8) command provides a scripting interface to modify system -config files. +The +.Xr service 8 +command provides a conveninet interface to manage rc.d services. +.Pp +The +.Xr sysrc 8 +command provides a scripting interface to modify system config files. .Ss Operation of Nm .Bl -enum .It @@ -214,7 +219,7 @@ Call each script in turn using which sets .Va $1 to -.Dq Li stop , +.Dq Li faststop , and sources the script in a subshell. .El .Ss Contents of Nm rc.d/ @@ -556,6 +561,7 @@ is unnecessary, but is often included. .Xr rcorder 8 , .Xr reboot 8 , .Xr savecore 8 , +.Xr service 8 , .Xr sysrc 8 .Sh HISTORY The From owner-svn-src-head@freebsd.org Wed Aug 7 21:20:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82A35B82B0; Wed, 7 Aug 2019 21:20:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463ktf2t5Gz4M7L; Wed, 7 Aug 2019 21:20:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45B0F1AB34; Wed, 7 Aug 2019 21:20:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x77LKQoD053265; Wed, 7 Aug 2019 21:20:26 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x77LKQjJ053263; Wed, 7 Aug 2019 21:20:26 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201908072120.x77LKQjJ053263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 7 Aug 2019 21:20:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350702 - head/share/man/man8 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/share/man/man8 X-SVN-Commit-Revision: 350702 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 21:20:26 -0000 Author: avg Date: Wed Aug 7 21:20:25 2019 New Revision: 350702 URL: https://svnweb.freebsd.org/changeset/base/350702 Log: rc.8: fix a typo in r350701 I wronlgy expected that igor(1) checks spelling of all words. MFC after: 1 week Modified: head/share/man/man8/rc.8 Modified: head/share/man/man8/rc.8 ============================================================================== --- head/share/man/man8/rc.8 Wed Aug 7 21:07:59 2019 (r350701) +++ head/share/man/man8/rc.8 Wed Aug 7 21:20:25 2019 (r350702) @@ -91,7 +91,7 @@ executed at boot time and shutdown time. .Pp The .Xr service 8 -command provides a conveninet interface to manage rc.d services. +command provides a convenient interface to manage rc.d services. .Pp The .Xr sysrc 8 From owner-svn-src-head@freebsd.org Wed Aug 7 23:06:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4144CBAD1F for ; Wed, 7 Aug 2019 23:06:12 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 463nDg68kmz4SpC for ; Wed, 7 Aug 2019 23:06:11 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1565219170; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=nxz9Xe79Zibwx7vg0Lq0UKIdyIdRUyMPOv+pKDVIHHgV9V9M+GxXlgaThnHMtlemRGMl2RoBaIJk9 MSRR0H08Tl9YQ0ai/vpxRnfhq2HICsRMdi/JaFl/TRSbySyvaiq6RoccycLR73KXGnqz/5mO59MzAB 1S9ryi5cceEgF/Vgd27wHTL2zAMl08v7JuSLuPC0ChD32/OszCYowyhEqN2OKTR4qccfufFYO5FA6W LDpcnmWdpnVz/IZQ+9/A4Zod1vrVoAOniFwqxJSwB4uvA6en4NPG7ptsSDfqQnHfbWvcCUfr5mWz28 X9HxdNjIHKcDixFGBNElTizr1JZxCVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=SFJ/GfNdJOPzga7q8d30sRWgZvfEqH5HmMEKv/SjFGM=; b=glbLidK/jGlErn/XhmDOeM+16xB45SGgVkA3a8tMY0wsIGkmjnumjdADclv2FyuKat6XBgIQEeJne ZTHi2ngE7HPp3ZL6S2Ep38JdVPq5DTgbGZjeVbbE+pJCZcuNNixOBM/lHC6Jx5K9fkRO103CM7Dpof etcyNPgRZmsOj20Ac7qVi9cPIEra0b/kEjqJnkEzG36pj5ghtO5w4V3whJG5uTdgzFpg/0uHEn6SVf cmtusPW+ewiHMPD7+FxtLLJTudwSsMwPKmG/vNvzRxp2jwdYOC3Bxt7gXb+2kJVSfD7BVRGuPLQpUB Ig7uO40HNPCGfJr4BvuAuPpUG3MTOkA== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=SFJ/GfNdJOPzga7q8d30sRWgZvfEqH5HmMEKv/SjFGM=; b=LI6/7/D5VbznPpITKxkpD6okIY8j9H0hYpecOSMAkwMPRuJUEGxQqV4HkoKtgh1pDoijzJV35Enn7 3TcvoBq0vFzDqDhU2JDbjGaPKxadxHerN4NYbA3U42FGJtVarDkPsQvI46Ut7c3/ZdIJ8hxiuamBVE 2BYEFl9eFUz+Dw3gBwUHpd2NXy1n4fBCK5gFESfcwoyhgZF2us5b8M575q0IRnZkE+XkEEyYL4rjZo 625BtEMwZW279wcmvWzU1Oe5bBQgzh0sj4QWps9BLGB3V9TW0Q7H9A+KeoNQKpjGDvCsbg0A7/H6/i LJh6yncSMTbdQlGySAbJRuOZqu+KXyw== X-MHO-RoutePath: aGlwcGll X-MHO-User: f0003418-b967-11e9-85ec-13b9aae3a1d2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id f0003418-b967-11e9-85ec-13b9aae3a1d2; Wed, 07 Aug 2019 23:06:08 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x77N66Im027269; Wed, 7 Aug 2019 17:06:06 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <7f4c49df080f5e640723cea190ac2e7f909c4059.camel@freebsd.org> Subject: Re: svn commit: r350702 - head/share/man/man8 From: Ian Lepore To: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Wed, 07 Aug 2019 17:06:06 -0600 In-Reply-To: <201908072120.x77LKQjJ053263@repo.freebsd.org> References: <201908072120.x77LKQjJ053263@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 463nDg68kmz4SpC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.99)[-0.992,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 23:06:12 -0000 On Wed, 2019-08-07 at 21:20 +0000, Andriy Gapon wrote: > Author: avg > Date: Wed Aug 7 21:20:25 2019 > New Revision: 350702 > URL: https://svnweb.freebsd.org/changeset/base/350702 > > Log: > rc.8: fix a typo in r350701 > > I wronlgy expected that igor(1) checks spelling of all words. > > MFC after: 1 week > > Modified: > head/share/man/man8/rc.8 > > Modified: head/share/man/man8/rc.8 > ============================================================================== > --- head/share/man/man8/rc.8 Wed Aug 7 21:07:59 2019 (r350701) > +++ head/share/man/man8/rc.8 Wed Aug 7 21:20:25 2019 (r350702) > @@ -91,7 +91,7 @@ executed at boot time and shutdown time. > .Pp > The > .Xr service 8 > -command provides a conveninet interface to manage rc.d services. > +command provides a convenient interface to manage rc.d services. > .Pp > The > .Xr sysrc 8 > Given that probably 60% of any manpage is jargon that won't appear in any dictionary, I think nobody would use igor if it tried to be a full spellchecker. It pissed me off the other day by flagging a dozen occurrances of 'ti' as typos of 'it', in a manpage documenting a Texas Instruments device. -- Ian From owner-svn-src-head@freebsd.org Thu Aug 8 00:42:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFE32BD0F3; Thu, 8 Aug 2019 00:42:29 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463qMn5TDvz4YL1; Thu, 8 Aug 2019 00:42:29 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D85F1D115; Thu, 8 Aug 2019 00:42:29 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x780gTtR078294; Thu, 8 Aug 2019 00:42:29 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x780gThf078293; Thu, 8 Aug 2019 00:42:29 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908080042.x780gThf078293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 8 Aug 2019 00:42:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350713 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 350713 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 00:42:29 -0000 Author: cem Date: Thu Aug 8 00:42:29 2019 New Revision: 350713 URL: https://svnweb.freebsd.org/changeset/base/350713 Log: ddb(4): Add 'sysctl' command Implement `sysctl` in `ddb` by overriding `SYSCTL_OUT`. When handling the req, we install custom ddb in/out handlers. The out handler prints straight to the debugger, while the in handler ignores all input. This is intended to allow us to print just about any sysctl. There is a known issue when used from ddb(4) entered via 'sysctl debug.kdb.enter=1'. The DDB mode does not quite prevent all lock interactions, and it is possible for the recursive Giant lock to be unlocked when the ddb(4) 'sysctl' command is used. This may result in a panic on return from ddb(4) via 'c' (continue). Obviously, this is not a problem when debugging already-paniced systems. Submitted by: Travis Lane (formerly: ) Reviewed by: vangyzen (earlier version), Don Morris Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D20219 Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Thu Aug 8 00:33:23 2019 (r350712) +++ head/sys/kern/kern_sysctl.c Thu Aug 8 00:42:29 2019 (r350713) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include "opt_capsicum.h" +#include "opt_ddb.h" #include "opt_ktrace.h" #include @@ -48,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -64,6 +66,12 @@ __FBSDID("$FreeBSD$"); #include #endif +#ifdef DDB +#include +#include +#include +#endif + #include #include @@ -1609,9 +1617,10 @@ sysctl_handle_string(SYSCTL_HANDLER_ARGS) /* * A zero-length buffer indicates a fixed size read-only - * string: + * string. In ddb, don't worry about trying to make a malloced + * snapshot. */ - if (arg2 == 0) { + if (arg2 == 0 || kdb_active) { arg2 = strlen((char *)arg1) + 1; ro_string = 1; } @@ -2240,3 +2249,528 @@ sbuf_new_for_sysctl(struct sbuf *s, char *buf, int len sbuf_set_drain(s, sbuf_sysctl_drain, req); return (s); } + +#ifdef DDB + +/* The current OID the debugger is working with */ +static struct sysctl_oid *g_ddb_oid; + +/* The current flags specified by the user */ +static int g_ddb_sysctl_flags; + +/* Check to see if the last sysctl printed */ +static int g_ddb_sysctl_printed; + +static const int ctl_sign[CTLTYPE+1] = { + [CTLTYPE_INT] = 1, + [CTLTYPE_LONG] = 1, + [CTLTYPE_S8] = 1, + [CTLTYPE_S16] = 1, + [CTLTYPE_S32] = 1, + [CTLTYPE_S64] = 1, +}; + +static const int ctl_size[CTLTYPE+1] = { + [CTLTYPE_INT] = sizeof(int), + [CTLTYPE_UINT] = sizeof(u_int), + [CTLTYPE_LONG] = sizeof(long), + [CTLTYPE_ULONG] = sizeof(u_long), + [CTLTYPE_S8] = sizeof(int8_t), + [CTLTYPE_S16] = sizeof(int16_t), + [CTLTYPE_S32] = sizeof(int32_t), + [CTLTYPE_S64] = sizeof(int64_t), + [CTLTYPE_U8] = sizeof(uint8_t), + [CTLTYPE_U16] = sizeof(uint16_t), + [CTLTYPE_U32] = sizeof(uint32_t), + [CTLTYPE_U64] = sizeof(uint64_t), +}; + +#define DB_SYSCTL_NAME_ONLY 0x001 /* Compare with -N */ +#define DB_SYSCTL_VALUE_ONLY 0x002 /* Compare with -n */ +#define DB_SYSCTL_OPAQUE 0x004 /* Compare with -o */ +#define DB_SYSCTL_HEX 0x008 /* Compare with -x */ + +#define DB_SYSCTL_SAFE_ONLY 0x100 /* Only simple types */ + +static const char db_sysctl_modifs[] = { + 'N', 'n', 'o', 'x', +}; + +static const int db_sysctl_modif_values[] = { + DB_SYSCTL_NAME_ONLY, DB_SYSCTL_VALUE_ONLY, + DB_SYSCTL_OPAQUE, DB_SYSCTL_HEX, +}; + +/* Handlers considered safe to print while recursing */ +static int (* const db_safe_handlers[])(SYSCTL_HANDLER_ARGS) = { + sysctl_handle_bool, + sysctl_handle_8, + sysctl_handle_16, + sysctl_handle_32, + sysctl_handle_64, + sysctl_handle_int, + sysctl_handle_long, + sysctl_handle_string, + sysctl_handle_opaque, +}; + +/* + * Use in place of sysctl_old_kernel to print sysctl values. + * + * Compare to the output handling in show_var from sbin/sysctl/sysctl.c + */ +static int +sysctl_old_ddb(struct sysctl_req *req, const void *ptr, size_t len) +{ + const u_char *val, *p; + const char *sep1; + size_t intlen, slen; + uintmax_t umv; + intmax_t mv; + int sign, ctltype, hexlen, xflag, error; + + /* Suppress false-positive GCC uninitialized variable warnings */ + mv = 0; + umv = 0; + + slen = len; + val = p = ptr; + + if (ptr == NULL) { + error = 0; + goto out; + } + + /* We are going to print */ + g_ddb_sysctl_printed = 1; + + xflag = g_ddb_sysctl_flags & DB_SYSCTL_HEX; + + ctltype = (g_ddb_oid->oid_kind & CTLTYPE); + sign = ctl_sign[ctltype]; + intlen = ctl_size[ctltype]; + + switch (ctltype) { + case CTLTYPE_NODE: + case CTLTYPE_STRING: + db_printf("%.*s", (int) len, (const char *) p); + error = 0; + goto out; + + case CTLTYPE_INT: + case CTLTYPE_UINT: + case CTLTYPE_LONG: + case CTLTYPE_ULONG: + case CTLTYPE_S8: + case CTLTYPE_S16: + case CTLTYPE_S32: + case CTLTYPE_S64: + case CTLTYPE_U8: + case CTLTYPE_U16: + case CTLTYPE_U32: + case CTLTYPE_U64: + hexlen = 2 + (intlen * CHAR_BIT + 3) / 4; + sep1 = ""; + while (len >= intlen) { + switch (ctltype) { + case CTLTYPE_INT: + case CTLTYPE_UINT: + umv = *(const u_int *)p; + mv = *(const int *)p; + break; + case CTLTYPE_LONG: + case CTLTYPE_ULONG: + umv = *(const u_long *)p; + mv = *(const long *)p; + break; + case CTLTYPE_S8: + case CTLTYPE_U8: + umv = *(const uint8_t *)p; + mv = *(const int8_t *)p; + break; + case CTLTYPE_S16: + case CTLTYPE_U16: + umv = *(const uint16_t *)p; + mv = *(const int16_t *)p; + break; + case CTLTYPE_S32: + case CTLTYPE_U32: + umv = *(const uint32_t *)p; + mv = *(const int32_t *)p; + break; + case CTLTYPE_S64: + case CTLTYPE_U64: + umv = *(const uint64_t *)p; + mv = *(const int64_t *)p; + break; + } + + db_printf("%s", sep1); + if (xflag) + db_printf("%#0*jx", hexlen, umv); + else if (!sign) + db_printf("%ju", umv); + else if (g_ddb_oid->oid_fmt[1] == 'K') { + /* Kelvins are currently unsupported. */ + error = EOPNOTSUPP; + goto out; + } else + db_printf("%jd", mv); + + sep1 = " "; + len -= intlen; + p += intlen; + } + error = 0; + goto out; + + case CTLTYPE_OPAQUE: + /* TODO: Support struct functions. */ + + /* FALLTHROUGH */ + default: + db_printf("Format:%s Length:%zu Dump:0x", + g_ddb_oid->oid_fmt, len); + while (len-- && (xflag || p < val + 16)) + db_printf("%02x", *p++); + if (!xflag && len > 16) + db_printf("..."); + error = 0; + goto out; + } + +out: + req->oldidx += slen; + return (error); +} + +/* + * Avoid setting new sysctl values from the debugger + */ +static int +sysctl_new_ddb(struct sysctl_req *req, void *p, size_t l) +{ + + if (!req->newptr) + return (0); + + /* Changing sysctls from the debugger is currently unsupported */ + return (EPERM); +} + +/* + * Run a sysctl handler with the DDB oldfunc and newfunc attached. + * Instead of copying any output to a buffer we'll dump it right to + * the console. + */ +static int +db_sysctl(struct sysctl_oid *oidp, int *name, u_int namelen, + void *old, size_t *oldlenp, size_t *retval, int flags) +{ + struct sysctl_req req; + int error; + + /* Setup the request */ + bzero(&req, sizeof req); + req.td = kdb_thread; + req.oldfunc = sysctl_old_ddb; + req.newfunc = sysctl_new_ddb; + req.lock = REQ_UNWIRED; + if (oldlenp) { + req.oldlen = *oldlenp; + } + req.validlen = req.oldlen; + if (old) { + req.oldptr = old; + } + + /* Setup our globals for sysctl_old_ddb */ + g_ddb_oid = oidp; + g_ddb_sysctl_flags = flags; + g_ddb_sysctl_printed = 0; + + error = sysctl_root(0, name, namelen, &req); + + /* Reset globals */ + g_ddb_oid = NULL; + g_ddb_sysctl_flags = 0; + + if (retval) { + if (req.oldptr && req.oldidx > req.validlen) + *retval = req.validlen; + else + *retval = req.oldidx; + } + return (error); +} + +/* + * Show a sysctl's name + */ +static void +db_show_oid_name(int *oid, size_t nlen) +{ + struct sysctl_oid *oidp; + int qoid[CTL_MAXNAME+2]; + int error; + + qoid[0] = 0; + memcpy(qoid + 2, oid, nlen * sizeof(int)); + qoid[1] = 1; + + error = sysctl_find_oid(qoid, nlen + 2, &oidp, NULL, NULL); + if (error) + db_error("sysctl name oid"); + + error = db_sysctl(oidp, qoid, nlen + 2, NULL, NULL, NULL, 0); + if (error) + db_error("sysctl name"); +} + +/* + * Check to see if an OID is safe to print from ddb. + */ +static bool +db_oid_safe(const struct sysctl_oid *oidp) +{ + for (unsigned int i = 0; i < nitems(db_safe_handlers); ++i) { + if (oidp->oid_handler == db_safe_handlers[i]) + return (true); + } + + return (false); +} + +/* + * Show a sysctl at a specific OID + * Compare to the input handling in show_var from sbin/sysctl/sysctl.c + */ +static int +db_show_oid(struct sysctl_oid *oidp, int *oid, size_t nlen, int flags) +{ + int error, xflag, oflag, Nflag, nflag; + size_t len; + + xflag = flags & DB_SYSCTL_HEX; + oflag = flags & DB_SYSCTL_OPAQUE; + nflag = flags & DB_SYSCTL_VALUE_ONLY; + Nflag = flags & DB_SYSCTL_NAME_ONLY; + + if ((oidp->oid_kind & CTLTYPE) == CTLTYPE_OPAQUE && + (!xflag && !oflag)) + return (0); + + if (Nflag) { + db_show_oid_name(oid, nlen); + error = 0; + goto out; + } + + if (!nflag) { + db_show_oid_name(oid, nlen); + db_printf(": "); + } + + if ((flags & DB_SYSCTL_SAFE_ONLY) && !db_oid_safe(oidp)) { + db_printf("Skipping, unsafe to print while recursing."); + error = 0; + goto out; + } + + /* Try once, and ask about the size */ + len = 0; + error = db_sysctl(oidp, oid, nlen, + NULL, NULL, &len, flags); + if (error) + goto out; + + if (!g_ddb_sysctl_printed) + /* Lie about the size */ + error = db_sysctl(oidp, oid, nlen, + (void *) 1, &len, NULL, flags); + +out: + db_printf("\n"); + return (error); +} + +/* + * Show all sysctls under a specific OID + * Compare to sysctl_all from sbin/sysctl/sysctl.c + */ +static int +db_show_sysctl_all(int *oid, size_t len, int flags) +{ + struct sysctl_oid *oidp; + int name1[CTL_MAXNAME + 2], name2[CTL_MAXNAME + 2]; + size_t l1, l2; + + name1[0] = 0; + name1[1] = 2; + l1 = 2; + if (len) { + memcpy(name1+2, oid, len * sizeof(int)); + l1 +=len; + } else { + name1[2] = 1; + l1++; + } + for (;;) { + int i, error; + + l2 = sizeof(name2); + error = kernel_sysctl(kdb_thread, name1, l1, + name2, &l2, NULL, 0, &l2, 0); + if (error != 0) { + if (error == ENOENT) + return (0); + else + db_error("sysctl(getnext)"); + } + + l2 /= sizeof(int); + + if (l2 < (unsigned int)len) + return (0); + + for (i = 0; i < len; i++) + if (name2[i] != oid[i]) + return (0); + + /* Find the OID in question */ + error = sysctl_find_oid(name2, l2, &oidp, NULL, NULL); + if (error) + return (error); + + i = db_show_oid(oidp, name2, l2, flags | DB_SYSCTL_SAFE_ONLY); + + if (db_pager_quit) + return (0); + + memcpy(name1+2, name2, l2 * sizeof(int)); + l1 = 2 + l2; + } +} + +/* + * Show a sysctl by its user facing string + */ +static int +db_sysctlbyname(char *name, int flags) +{ + struct sysctl_oid *oidp; + int oid[CTL_MAXNAME]; + int error, nlen; + + error = name2oid(name, oid, &nlen, &oidp); + if (error) { + return (error); + } + + if ((oidp->oid_kind & CTLTYPE) == CTLTYPE_NODE) { + db_show_sysctl_all(oid, nlen, flags); + } else { + error = db_show_oid(oidp, oid, nlen, flags); + } + + return (error); +} + +static void +db_sysctl_cmd_usage(void) +{ + db_printf( + " sysctl [/Nnox] \n" + " \n" + " The name of the sysctl to show. \n" + " \n" + " Show a sysctl by hooking into SYSCTL_IN and SYSCTL_OUT. \n" + " This will work for most sysctls, but should not be used \n" + " with sysctls that are known to malloc. \n" + " \n" + " While recursing any \"unsafe\" sysctls will be skipped. \n" + " Call sysctl directly on the sysctl to try printing the \n" + " skipped sysctl. This is unsafe and may make the ddb \n" + " session unusable. \n" + " \n" + " Arguments: \n" + " /N Display only the name of the sysctl. \n" + " /n Display only the value of the sysctl. \n" + " /o Display opaque values. \n" + " /x Display the sysctl in hex. \n" + " \n" + "For example: \n" + "sysctl vm.v_free_min \n" + "vn.v_free_min: 12669 \n" + ); +} + +/* + * Show a specific sysctl similar to sysctl (8). + */ +DB_FUNC(sysctl, db_sysctl_cmd, db_cmd_table, CS_OWN, NULL) +{ + char name[TOK_STRING_SIZE]; + int error, i, t, flags; + + /* Parse the modifiers */ + t = db_read_token(); + if (t == tSLASH || t == tMINUS) { + t = db_read_token(); + if (t != tIDENT) { + db_printf("Bad modifier\n"); + error = EINVAL; + goto out; + } + db_strcpy(modif, db_tok_string); + } + else { + db_unread_token(t); + modif[0] = '\0'; + } + + flags = 0; + for (i = 0; i < nitems(db_sysctl_modifs); i++) { + if (strchr(modif, db_sysctl_modifs[i])) { + flags |= db_sysctl_modif_values[i]; + } + } + + /* Parse the sysctl names */ + t = db_read_token(); + if (t != tIDENT) { + db_printf("Need sysctl name\n"); + error = EINVAL; + goto out; + } + + /* Copy the name into a temporary buffer */ + db_strcpy(name, db_tok_string); + + /* Ensure there is no trailing cruft */ + t = db_read_token(); + if (t != tEOL) { + db_printf("Unexpected sysctl argument\n"); + error = EINVAL; + goto out; + } + + error = db_sysctlbyname(name, flags); + if (error == ENOENT) { + db_printf("unknown oid: '%s'\n", db_tok_string); + goto out; + } else if (error) { + db_printf("%s: error: %d\n", db_tok_string, error); + goto out; + } + +out: + /* Ensure we eat all of our text */ + db_flush_lex(); + + if (error == EINVAL) { + db_sysctl_cmd_usage(); + } +} + +#endif /* DDB */ From owner-svn-src-head@freebsd.org Thu Aug 8 00:51:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3C23BD3CC; Thu, 8 Aug 2019 00:51:17 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463qYx4BKjz4Yq0; Thu, 8 Aug 2019 00:51:17 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 715FF1D17F; Thu, 8 Aug 2019 00:51:17 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x780pH8r079465; Thu, 8 Aug 2019 00:51:17 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x780pHQe079464; Thu, 8 Aug 2019 00:51:17 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201908080051.x780pHQe079464@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 8 Aug 2019 00:51:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350714 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 350714 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 00:51:17 -0000 Author: lwhsu Date: Thu Aug 8 00:51:17 2019 New Revision: 350714 URL: https://svnweb.freebsd.org/changeset/base/350714 Log: Follow r350693 to add a link for sbuf_nl_terminate(9) Sponsored by: The FreeBSD Foundation Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Thu Aug 8 00:42:29 2019 (r350713) +++ head/share/man/man9/Makefile Thu Aug 8 00:51:17 2019 (r350714) @@ -1790,6 +1790,7 @@ MLINKS+=sbuf.9 sbuf_bcat.9 \ sbuf.9 sbuf_new.9 \ sbuf.9 sbuf_new_auto.9 \ sbuf.9 sbuf_new_for_sysctl.9 \ + sbuf.9 sbuf_nl_terminate.9 \ sbuf.9 sbuf_printf.9 \ sbuf.9 sbuf_printf_drain.9 \ sbuf.9 sbuf_putbuf.9 \ From owner-svn-src-head@freebsd.org Thu Aug 8 01:27:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 76977BE780; Thu, 8 Aug 2019 01:27:24 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463rMc2W7Fz4bkb; Thu, 8 Aug 2019 01:27:23 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-ot1-f46.google.com with SMTP id q20so112002893otl.0; Wed, 07 Aug 2019 18:27:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=OL3M+oWhRekHMvAfglyENaOEybMYil14kJfoR0QEtCs=; b=eZtpnNnTszPG5+qxn9s2+sR9dw7JLlYU+NdGv1X4pzd8mN1CrjDf4gMj5H1cOvRk48 uLjVcD1BA1dFbkRXEwGOYd2dync7i4a4MYJMl/kHnAnZ2MbthFSLE2rSLb7u1cBjQQM8 YYYynq3cCVLhymRssVgjZm82y2XPGsYBc6hmLifVfr9KYMcjno7HlBWzqA+3/pbk73rF dVP774+1lomGu1Xt8O0x+2nEDhI0w2QenYClNbHuiN/4ustHh5+l262tM0SY1NJCq32M EejPCwJ96lmF9m9TSsejR3AV7eKHzuUREdZlPCCNAaEG0HfrzIzHNoucZwuBs43RmGwk nkmw== X-Gm-Message-State: APjAAAWCo6RGwRU+y7YPTdl6PYf/udeIyVvpN4ix8UikTfXeMOoLnm+Q lPE6ozXvA/2Dh6iCh6uAv/cRT21i X-Google-Smtp-Source: APXvYqxbniiD8Ll/ZBjVt1GDJbx2LvbWVrtqctU8DPH1L1Qyv2i3Lz3Y+7j7UKJQgRn6XC3nCdsXlQ== X-Received: by 2002:a9d:65cb:: with SMTP id z11mr10826528oth.325.1565227642209; Wed, 07 Aug 2019 18:27:22 -0700 (PDT) Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com. [209.85.210.49]) by smtp.gmail.com with ESMTPSA id b21sm31825451otp.80.2019.08.07.18.27.21 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Wed, 07 Aug 2019 18:27:22 -0700 (PDT) Received: by mail-ot1-f49.google.com with SMTP id x21so18829828otq.12; Wed, 07 Aug 2019 18:27:21 -0700 (PDT) X-Received: by 2002:a02:aa0d:: with SMTP id r13mr13735632jam.129.1565227641770; Wed, 07 Aug 2019 18:27:21 -0700 (PDT) MIME-Version: 1.0 References: <201908080051.x780pHQe079464@repo.freebsd.org> In-Reply-To: <201908080051.x780pHQe079464@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Wed, 7 Aug 2019 18:27:11 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r350714 - head/share/man/man9 To: Li-Wen Hsu Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 463rMc2W7Fz4bkb X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.985,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 01:27:24 -0000 Thanks Li-Wen Hsu! On Wed, Aug 7, 2019 at 5:51 PM Li-Wen Hsu wrote: > > Author: lwhsu > Date: Thu Aug 8 00:51:17 2019 > New Revision: 350714 > URL: https://svnweb.freebsd.org/changeset/base/350714 > > Log: > Follow r350693 to add a link for sbuf_nl_terminate(9) > > Sponsored by: The FreeBSD Foundation > > Modified: > head/share/man/man9/Makefile > > Modified: head/share/man/man9/Makefile > ============================================================================== > --- head/share/man/man9/Makefile Thu Aug 8 00:42:29 2019 (r350713) > +++ head/share/man/man9/Makefile Thu Aug 8 00:51:17 2019 (r350714) > @@ -1790,6 +1790,7 @@ MLINKS+=sbuf.9 sbuf_bcat.9 \ > sbuf.9 sbuf_new.9 \ > sbuf.9 sbuf_new_auto.9 \ > sbuf.9 sbuf_new_for_sysctl.9 \ > + sbuf.9 sbuf_nl_terminate.9 \ > sbuf.9 sbuf_printf.9 \ > sbuf.9 sbuf_printf_drain.9 \ > sbuf.9 sbuf_putbuf.9 \ > From owner-svn-src-head@freebsd.org Thu Aug 8 01:37:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CB82BEF27; Thu, 8 Aug 2019 01:37:42 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463rbV0NLPz4cVM; Thu, 8 Aug 2019 01:37:42 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E30411DA7A; Thu, 8 Aug 2019 01:37:41 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x781bf7s007994; Thu, 8 Aug 2019 01:37:41 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x781bf4N007993; Thu, 8 Aug 2019 01:37:41 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908080137.x781bf4N007993@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 8 Aug 2019 01:37:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350715 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 350715 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 01:37:42 -0000 Author: cem Date: Thu Aug 8 01:37:41 2019 New Revision: 350715 URL: https://svnweb.freebsd.org/changeset/base/350715 Log: Fix !DDB kernel configurations after r350713 KDB is standard and the kdb_active variable is always available. So, de-conditionalize inclusion of sys/kdb.h in kern_sysctl.c. Reported by: Michael Butler X-MFC-With: r350713 Sponsored by: Dell EMC Isilon Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Thu Aug 8 00:51:17 2019 (r350714) +++ head/sys/kern/kern_sysctl.c Thu Aug 8 01:37:41 2019 (r350715) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -67,7 +68,6 @@ __FBSDID("$FreeBSD$"); #endif #ifdef DDB -#include #include #include #endif From owner-svn-src-head@freebsd.org Thu Aug 8 02:39:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFFFBC120D; Thu, 8 Aug 2019 02:39:12 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-ot1-f66.google.com (mail-ot1-f66.google.com [209.85.210.66]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463syR4dtHz3F4n; Thu, 8 Aug 2019 02:39:11 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-ot1-f66.google.com with SMTP id r21so106654927otq.6; Wed, 07 Aug 2019 19:39:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=yReDWTZcI1Q1R4sK8ZLH/khjCkVUGP0/VTmZaEA4Dxw=; b=HeI0VfSDX9ZDyYmjbzYnZTavhyEsOUoTpxoXYwibluSjzRvG4wRCHIY6uI/XSTrVGj gRFNHHEC7Qzi8OuUSNO5YLKKkrcVo2GlW2mpU+UTgVL1X1ATkXp0dMT/SJRkvbw1rsGy skEDeDUyJQbHpJehJHgiJ9xiWoj+P8AkdTlzNhUHo7uJQZ/IHWTBE1t3vs4epGOe/PEZ Q1OLBlgkh3VqKbKKTFaQepv3cXUXp0jqzgiTVWIK+jbtvVupYsWS38NtnKmLgaUcdBsT oWtEEXP/JM9I1oVU4ya5L2U2SvKJ4NnmEDvKjWCuMWob9CU42heoLpDXNVOZHzLWonqk bj8Q== X-Gm-Message-State: APjAAAWYyzrKCZqQC6RQYuicNep1ttwUs8JPyL0lY7XQJEbRFRMCf+jK GCBpYjF3dB5TeyP4BsZYbDhXloNv X-Google-Smtp-Source: APXvYqyaF4ux3Ib969chfBISQVnIweYDSRv/ec9XuO9PaSeugzPjhFNDHIbvgT2M+wRmSPpnO4IrSg== X-Received: by 2002:aca:b808:: with SMTP id i8mr906696oif.163.1565231950085; Wed, 07 Aug 2019 19:39:10 -0700 (PDT) Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com. [209.85.210.48]) by smtp.gmail.com with ESMTPSA id v203sm35642980oie.5.2019.08.07.19.39.09 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Wed, 07 Aug 2019 19:39:09 -0700 (PDT) Received: by mail-ot1-f48.google.com with SMTP id o101so112643392ota.8; Wed, 07 Aug 2019 19:39:09 -0700 (PDT) X-Received: by 2002:a6b:6409:: with SMTP id t9mr1589050iog.270.1565231948982; Wed, 07 Aug 2019 19:39:08 -0700 (PDT) MIME-Version: 1.0 References: <201907250546.x6P5kHWq076756@repo.freebsd.org> In-Reply-To: <201907250546.x6P5kHWq076756@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Wed, 7 Aug 2019 19:38:58 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r350315 - in head/sys: kern sys To: Rick Macklem Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 463syR4dtHz3F4n X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of csecem@gmail.com designates 209.85.210.66 as permitted sender) smtp.mailfrom=csecem@gmail.com X-Spamd-Result: default: False [-4.77 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[cem@freebsd.org]; RWL_MAILSPIKE_GOOD(0.00)[66.210.85.209.rep.mailspike.net : 127.0.0.18]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-0.999,0]; FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; IP_SCORE(-1.77)[ip: (-3.00), ipnet: 209.85.128.0/17(-3.39), asn: 15169(-2.43), country: US(-0.05)]; RCVD_IN_DNSWL_NONE(0.00)[66.210.85.209.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 02:39:12 -0000 Hi Rick, Coverity reports that the following portion of vn_generic_copy_file_range() is deadcode (CID 1403974), and it is: On Wed, Jul 24, 2019 at 10:46 PM Rick Macklem wrote: > > Author: rmacklem > Date: Thu Jul 25 05:46:16 2019 > New Revision: 350315 > URL: https://svnweb.freebsd.org/changeset/base/350315 > > Log: > Add kernel support for a Linux compatible copy_file_range(2) syscall. > ... > Modified: head/sys/kern/vfs_vnops.c > ============================================================================== > --- head/sys/kern/vfs_vnops.c Thu Jul 25 03:55:05 2019 (r350314) > +++ head/sys/kern/vfs_vnops.c Thu Jul 25 05:46:16 2019 (r350315) > ... > +int > +vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp, > + struct vnode *outvp, off_t *outoffp, size_t *lenp, unsigned int flags, > + struct ucred *incred, struct ucred *outcred, struct thread *fsize_td) > +{ > ... > + error = vn_lock(invp, LK_SHARED); > + if (error != 0) > + goto out; // error is now zero > + if (VOP_PATHCONF(invp, _PC_MIN_HOLE_SIZE, &holein) != 0) > + holein = 0; > + VOP_UNLOCK(invp, 0); // the following condition is impossible: > + if (error != 0) > + goto out; Best, Conrad From owner-svn-src-head@freebsd.org Thu Aug 8 03:16:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2EC51C1FB6; Thu, 8 Aug 2019 03:16:33 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463tnY0PMLz3H2s; Thu, 8 Aug 2019 03:16:33 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E39FB1ECB0; Thu, 8 Aug 2019 03:16:32 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x783GWmT070042; Thu, 8 Aug 2019 03:16:32 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x783GW3r070041; Thu, 8 Aug 2019 03:16:32 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908080316.x783GW3r070041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 8 Aug 2019 03:16:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350737 - head/usr.sbin/autofs X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/usr.sbin/autofs X-SVN-Commit-Revision: 350737 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 03:16:33 -0000 Author: jhibbits Date: Thu Aug 8 03:16:32 2019 New Revision: 350737 URL: https://svnweb.freebsd.org/changeset/base/350737 Log: Change autounmountd(8) to use time_t for duration instead of double Summary: autounmountd(8) uses doubles to handle mount time durations. However, it must convert to integer types, time_t in particular, to do anything meaningful. Additionally, even though it's a floating-point value in seconds, the sub-seconds component is never used, so it's unnecessary. Switching type to time_t fixes an assertion on powerpc64, which checks that a sleep value that's not -1.0 is greater than 0. On powerpc64, it happens that the value of -1.0 gets loaded as a float (perhaps a bug in gcc), but gets compared to a double. This compares as false, so follows through the 'sleep != -1.0' path, and fails the assert. Since the sub-second component isn't used in the double, just drop it and deal with whole-integer seconds. Reviewed by: trasz Differential Revision: https://reviews.freebsd.org/D21109 Modified: head/usr.sbin/autofs/autounmountd.c Modified: head/usr.sbin/autofs/autounmountd.c ============================================================================== --- head/usr.sbin/autofs/autounmountd.c Thu Aug 8 03:01:35 2019 (r350736) +++ head/usr.sbin/autofs/autounmountd.c Thu Aug 8 03:16:32 2019 (r350737) @@ -179,12 +179,12 @@ unmount_by_fsid(const fsid_t fsid, const char *mountpo return (error); } -static double -expire_automounted(double expiration_time) +static time_t +expire_automounted(time_t expiration_time) { struct automounted_fs *af, *tmpaf; time_t now; - double mounted_for, mounted_max = -1.0; + time_t mounted_for, mounted_max = -1; int error; now = time(NULL); @@ -196,9 +196,9 @@ expire_automounted(double expiration_time) if (mounted_for < expiration_time) { log_debugx("skipping %s (FSID:%d:%d), mounted " - "for %.0f seconds", af->af_mountpoint, + "for %ld seconds", af->af_mountpoint, af->af_fsid.val[0], af->af_fsid.val[1], - mounted_for); + (long)mounted_for); if (mounted_for > mounted_max) mounted_max = mounted_for; @@ -207,9 +207,9 @@ expire_automounted(double expiration_time) } log_debugx("filesystem mounted on %s (FSID:%d:%d), " - "was mounted for %.0f seconds; unmounting", + "was mounted for %ld seconds; unmounting", af->af_mountpoint, af->af_fsid.val[0], af->af_fsid.val[1], - mounted_for); + (long)mounted_for); error = unmount_by_fsid(af->af_fsid, af->af_mountpoint); if (error != 0) { if (mounted_for > mounted_max) @@ -229,18 +229,19 @@ usage_autounmountd(void) } static void -do_wait(int kq, double sleep_time) +do_wait(int kq, time_t sleep_time) { struct timespec timeout; struct kevent unused; int nevents; - if (sleep_time != -1.0) { - assert(sleep_time > 0.0); + if (sleep_time != -1) { + assert(sleep_time > 0); timeout.tv_sec = sleep_time; timeout.tv_nsec = 0; - log_debugx("waiting for filesystem event for %.0f seconds", sleep_time); + log_debugx("waiting for filesystem event for %ld seconds", + (long)sleep_time); nevents = kevent(kq, NULL, 0, &unused, 1, &timeout); } else { log_debugx("waiting for filesystem event"); @@ -254,7 +255,7 @@ do_wait(int kq, double sleep_time) if (nevents == 0) { log_debugx("timeout reached"); - assert(sleep_time > 0.0); + assert(sleep_time > 0); } else { log_debugx("got filesystem event"); } @@ -268,7 +269,7 @@ main_autounmountd(int argc, char **argv) pid_t otherpid; const char *pidfile_path = AUTOUNMOUNTD_PIDFILE; int ch, debug = 0, error, kq; - double expiration_time = 600, retry_time = 600, mounted_max, sleep_time; + time_t expiration_time = 600, retry_time = 600, mounted_max, sleep_time; bool dont_daemonize = false; while ((ch = getopt(argc, argv, "dr:t:v")) != -1) { @@ -336,17 +337,17 @@ main_autounmountd(int argc, char **argv) for (;;) { refresh_automounted(); mounted_max = expire_automounted(expiration_time); - if (mounted_max == -1.0) { + if (mounted_max == -1) { sleep_time = mounted_max; log_debugx("no filesystems to expire"); } else if (mounted_max < expiration_time) { sleep_time = difftime(expiration_time, mounted_max); - log_debugx("some filesystems expire in %.0f seconds", - sleep_time); + log_debugx("some filesystems expire in %ld seconds", + (long)sleep_time); } else { sleep_time = retry_time; log_debugx("some expired filesystems remain mounted, " - "will retry in %.0f seconds", sleep_time); + "will retry in %ld seconds", (long)sleep_time); } do_wait(kq, sleep_time); From owner-svn-src-head@freebsd.org Thu Aug 8 03:18:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67ECBC206B; Thu, 8 Aug 2019 03:18:36 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463tqw22Lfz3HCN; Thu, 8 Aug 2019 03:18:36 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 279511ECBC; Thu, 8 Aug 2019 03:18:36 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x783Iac9070184; Thu, 8 Aug 2019 03:18:36 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x783Iabd070183; Thu, 8 Aug 2019 03:18:36 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908080318.x783Iabd070183@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 8 Aug 2019 03:18:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350738 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 350738 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 03:18:36 -0000 Author: jhibbits Date: Thu Aug 8 03:18:35 2019 New Revision: 350738 URL: https://svnweb.freebsd.org/changeset/base/350738 Log: powerpc/pmap: Minor optimizations to 64-bit booke pmap Don't recalculate the VM page of the page table pages, just pass them down to free. Also, use the pmap's page zero function instead of bzero(). Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Thu Aug 8 03:16:32 2019 (r350737) +++ head/sys/powerpc/booke/pmap.c Thu Aug 8 03:18:35 2019 (r350738) @@ -264,7 +264,7 @@ static int pv_entry_count = 0, pv_entry_max = 0, pv_en #ifdef __powerpc64__ static pte_t *ptbl_alloc(mmu_t, pmap_t, pte_t **, unsigned int, boolean_t); -static void ptbl_free(mmu_t, pmap_t, pte_t **, unsigned int); +static void ptbl_free(mmu_t, pmap_t, pte_t **, unsigned int, vm_page_t); static void ptbl_hold(mmu_t, pmap_t, pte_t **, unsigned int); static int ptbl_unhold(mmu_t, pmap_t, vm_offset_t); #else @@ -615,19 +615,16 @@ pdir_alloc(mmu_t mmu, pmap_t pmap, unsigned int pp2d_i /* Zero whole ptbl. */ pdir = (pte_t **)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); - bzero(pdir, PAGE_SIZE); + mmu_booke_zero_page(mmu, m); return (pdir); } /* Free pdir pages and invalidate pdir entry. */ static void -pdir_free(mmu_t mmu, pmap_t pmap, unsigned int pp2d_idx) +pdir_free(mmu_t mmu, pmap_t pmap, unsigned int pp2d_idx, vm_page_t m) { pte_t **pdir; - vm_paddr_t pa; - vm_offset_t va; - vm_page_t m; pdir = pmap->pm_pp2d[pp2d_idx]; @@ -635,9 +632,6 @@ pdir_free(mmu_t mmu, pmap_t pmap, unsigned int pp2d_id pmap->pm_pp2d[pp2d_idx] = NULL; - va = (vm_offset_t) pdir; - pa = DMAP_TO_PHYS(va); - m = PHYS_TO_VM_PAGE(pa); vm_page_free_zero(m); } @@ -667,7 +661,7 @@ pdir_unhold(mmu_t mmu, pmap_t pmap, u_int pp2d_idx) * Free pdir page if there are no dir entries in this pdir. */ if (vm_page_unwire_noq(m)) { - pdir_free(mmu, pmap, pp2d_idx); + pdir_free(mmu, pmap, pp2d_idx, m); return (1); } return (0); @@ -717,19 +711,16 @@ ptbl_alloc(mmu_t mmu, pmap_t pmap, pte_t ** pdir, unsi /* Zero whole ptbl. */ ptbl = (pte_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); - bzero(ptbl, PAGE_SIZE); + mmu_booke_zero_page(mmu, m); return (ptbl); } /* Free ptbl pages and invalidate pdir entry. */ static void -ptbl_free(mmu_t mmu, pmap_t pmap, pte_t ** pdir, unsigned int pdir_idx) +ptbl_free(mmu_t mmu, pmap_t pmap, pte_t ** pdir, unsigned int pdir_idx, vm_page_t m) { pte_t *ptbl; - vm_paddr_t pa; - vm_offset_t va; - vm_page_t m; ptbl = pdir[pdir_idx]; @@ -737,9 +728,6 @@ ptbl_free(mmu_t mmu, pmap_t pmap, pte_t ** pdir, unsig pdir[pdir_idx] = NULL; - va = (vm_offset_t) ptbl; - pa = DMAP_TO_PHYS(va); - m = PHYS_TO_VM_PAGE(pa); vm_page_free_zero(m); } @@ -776,7 +764,7 @@ ptbl_unhold(mmu_t mmu, pmap_t pmap, vm_offset_t va) * last page. */ if (vm_page_unwire_noq(m)) { - ptbl_free(mmu, pmap, pdir, pdir_idx); + ptbl_free(mmu, pmap, pdir, pdir_idx, m); pdir_unhold(mmu, pmap, pp2d_idx); return (1); } From owner-svn-src-head@freebsd.org Thu Aug 8 03:27:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65725C230B; Thu, 8 Aug 2019 03:27:47 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463v2W1yb5z3Hgs; Thu, 8 Aug 2019 03:27:47 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 260391EE8E; Thu, 8 Aug 2019 03:27:47 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x783Rlff075979; Thu, 8 Aug 2019 03:27:47 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x783Rkfr075978; Thu, 8 Aug 2019 03:27:46 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908080327.x783Rkfr075978@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 8 Aug 2019 03:27:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350739 - in head: share/mk sys/conf X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: share/mk sys/conf X-SVN-Commit-Revision: 350739 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 03:27:47 -0000 Author: cem Date: Thu Aug 8 03:27:46 2019 New Revision: 350739 URL: https://svnweb.freebsd.org/changeset/base/350739 Log: Disable useless -Wformat-zero-length It is part of -Wformat, which is enabled by -Wall. Empty format strings are well defined and it is perfectly reasonable to expect them in a formatting interface. Modified: head/share/mk/bsd.sys.mk head/sys/conf/kern.mk Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Thu Aug 8 03:18:35 2019 (r350738) +++ head/share/mk/bsd.sys.mk Thu Aug 8 03:27:46 2019 (r350739) @@ -186,6 +186,9 @@ FORMAT_EXTENSIONS= -fformat-extensions CWARNFLAGS+= -Wno-unknown-pragmas .endif # IGNORE_PRAGMA +# This warning is utter nonsense +CWARNFLAGS+= -Wno-format-zero-length + # We need this conditional because many places that use it # only enable it for some files with CLFAGS.$FILE+=${CLANG_NO_IAS}. # unconditionally, and can't easily use the CFLAGS.clang= Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Thu Aug 8 03:18:35 2019 (r350738) +++ head/sys/conf/kern.mk Thu Aug 8 03:27:46 2019 (r350739) @@ -61,8 +61,7 @@ CWARNEXTRA?= -Wno-error=address \ CWARNEXTRA+= -Wno-error=misleading-indentation \ -Wno-error=nonnull-compare \ -Wno-error=shift-overflow \ - -Wno-error=tautological-compare \ - -Wno-format-zero-length + -Wno-error=tautological-compare .endif .if ${COMPILER_VERSION} >= 70200 CWARNEXTRA+= -Wno-error=memset-elt-size @@ -79,6 +78,9 @@ NO_WCAST_QUAL= -Wno-cast-qual NO_WNONNULL= -Wno-nonnull .endif .endif + +# This warning is utter nonsense +CWARNFLAGS+= -Wno-format-zero-length # External compilers may not support our format extensions. Allow them # to be disabled. WARNING: format checking is disabled in this case. From owner-svn-src-head@freebsd.org Thu Aug 8 04:29:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6370C2DE5; Thu, 8 Aug 2019 04:29:46 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463wQ24rfLz3KqP; Thu, 8 Aug 2019 04:29:46 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84E731F9A7; Thu, 8 Aug 2019 04:29:46 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x784TkQ1011460; Thu, 8 Aug 2019 04:29:46 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x784Tk2O011459; Thu, 8 Aug 2019 04:29:46 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908080429.x784Tk2O011459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 8 Aug 2019 04:29:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350740 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 350740 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 04:29:46 -0000 Author: cem Date: Thu Aug 8 04:29:46 2019 New Revision: 350740 URL: https://svnweb.freebsd.org/changeset/base/350740 Log: r350739 try #2 For some inexplicable reason, C++ compilers reject the -Wno- flag, and also (ab)use CWARNFLAGS. Reported by: imp Modified: head/share/mk/bsd.sys.mk Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Thu Aug 8 03:27:46 2019 (r350739) +++ head/share/mk/bsd.sys.mk Thu Aug 8 04:29:46 2019 (r350740) @@ -187,7 +187,7 @@ CWARNFLAGS+= -Wno-unknown-pragmas .endif # IGNORE_PRAGMA # This warning is utter nonsense -CWARNFLAGS+= -Wno-format-zero-length +CFLAGS+= -Wno-format-zero-length # We need this conditional because many places that use it # only enable it for some files with CLFAGS.$FILE+=${CLANG_NO_IAS}. From owner-svn-src-head@freebsd.org Thu Aug 8 06:26:35 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D50C3C4A9A; Thu, 8 Aug 2019 06:26:35 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463z0q5FSRz3PpF; Thu, 8 Aug 2019 06:26:35 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 91F4420F30; Thu, 8 Aug 2019 06:26:35 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x786QZdL081447; Thu, 8 Aug 2019 06:26:35 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x786QZh9081445; Thu, 8 Aug 2019 06:26:35 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201908080626.x786QZh9081445@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Thu, 8 Aug 2019 06:26:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350741 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 350741 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 06:26:35 -0000 Author: alc Date: Thu Aug 8 06:26:34 2019 New Revision: 350741 URL: https://svnweb.freebsd.org/changeset/base/350741 Log: Ordinarily, during a superpage promotion or demotion within a pmap, the pmap's lock ensures that other operations on the pmap don't observe the old mapping being broken before the new mapping is established. However, pmap_kextract() doesn't acquire the kernel pmap's lock, so it may observe the broken mapping. And, if it does, it returns an incorrect result. This revision implements a lock-free solution to this problem in pmap_update_entry() and pmap_kextract() because pmap_kextract() can't acquire the kernel pmap's lock. Reported by: andrew, greg_unrelenting.technology Reviewed by: andrew, markj Tested by: greg_unrelenting.technology X-MFC with: r350579 Differential Revision: https://reviews.freebsd.org/D21169 Modified: head/sys/arm64/arm64/pmap.c head/sys/arm64/include/pte.h Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Thu Aug 8 04:29:46 2019 (r350740) +++ head/sys/arm64/arm64/pmap.c Thu Aug 8 06:26:34 2019 (r350741) @@ -1128,40 +1128,35 @@ vm_paddr_t pmap_kextract(vm_offset_t va) { pt_entry_t *pte, tpte; - vm_paddr_t pa; - int lvl; - if (va >= DMAP_MIN_ADDRESS && va < DMAP_MAX_ADDRESS) { - pa = DMAP_TO_PHYS(va); - } else { - pa = 0; - pte = pmap_pte(kernel_pmap, va, &lvl); - if (pte != NULL) { - tpte = pmap_load(pte); - pa = tpte & ~ATTR_MASK; - switch(lvl) { - case 1: - KASSERT((tpte & ATTR_DESCR_MASK) == L1_BLOCK, - ("pmap_kextract: Invalid L1 pte found: %lx", - tpte & ATTR_DESCR_MASK)); - pa |= (va & L1_OFFSET); - break; - case 2: - KASSERT((tpte & ATTR_DESCR_MASK) == L2_BLOCK, - ("pmap_kextract: Invalid L2 pte found: %lx", - tpte & ATTR_DESCR_MASK)); - pa |= (va & L2_OFFSET); - break; - case 3: - KASSERT((tpte & ATTR_DESCR_MASK) == L3_PAGE, - ("pmap_kextract: Invalid L3 pte found: %lx", - tpte & ATTR_DESCR_MASK)); - pa |= (va & L3_OFFSET); - break; - } - } - } - return (pa); + if (va >= DMAP_MIN_ADDRESS && va < DMAP_MAX_ADDRESS) + return (DMAP_TO_PHYS(va)); + pte = pmap_l1(kernel_pmap, va); + if (pte == NULL) + return (0); + + /* + * A concurrent pmap_update_entry() will clear the entry's valid bit + * but leave the rest of the entry unchanged. Therefore, we treat a + * non-zero entry as being valid, and we ignore the valid bit when + * determining whether the entry maps a block, page, or table. + */ + tpte = pmap_load(pte); + if (tpte == 0) + return (0); + if ((tpte & ATTR_DESCR_TYPE_MASK) == ATTR_DESCR_TYPE_BLOCK) + return ((tpte & ~ATTR_MASK) | (va & L1_OFFSET)); + pte = pmap_l1_to_l2(&tpte, va); + tpte = pmap_load(pte); + if (tpte == 0) + return (0); + if ((tpte & ATTR_DESCR_TYPE_MASK) == ATTR_DESCR_TYPE_BLOCK) + return ((tpte & ~ATTR_MASK) | (va & L2_OFFSET)); + pte = pmap_l2_to_l3(&tpte, va); + tpte = pmap_load(pte); + if (tpte == 0) + return (0); + return ((tpte & ~ATTR_MASK) | (va & L3_OFFSET)); } /*************************************************** @@ -3021,8 +3016,12 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_ent intr = intr_disable(); critical_enter(); - /* Clear the old mapping */ - pmap_clear(pte); + /* + * Clear the old mapping's valid bit, but leave the rest of the entry + * unchanged, so that a lockless, concurrent pmap_kextract() can still + * lookup the physical address. + */ + pmap_clear_bits(pte, ATTR_DESCR_VALID); pmap_invalidate_range_nopin(pmap, va, va + size); /* Create the new mapping */ Modified: head/sys/arm64/include/pte.h ============================================================================== --- head/sys/arm64/include/pte.h Thu Aug 8 04:29:46 2019 (r350740) +++ head/sys/arm64/include/pte.h Thu Aug 8 06:26:34 2019 (r350741) @@ -71,7 +71,12 @@ typedef uint64_t pt_entry_t; /* page table entry */ #define ATTR_DEFAULT (ATTR_AF | ATTR_SH(ATTR_SH_IS)) -#define ATTR_DESCR_MASK 3 +#define ATTR_DESCR_MASK 3 +#define ATTR_DESCR_VALID 1 +#define ATTR_DESCR_TYPE_MASK 2 +#define ATTR_DESCR_TYPE_TABLE 2 +#define ATTR_DESCR_TYPE_PAGE 2 +#define ATTR_DESCR_TYPE_BLOCK 0 /* Level 0 table, 512GiB per entry */ #define L0_SHIFT 39 From owner-svn-src-head@freebsd.org Thu Aug 8 06:27:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A314FC4B37; Thu, 8 Aug 2019 06:27:40 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463z243s2Cz3PxJ; Thu, 8 Aug 2019 06:27:40 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C14B20F38; Thu, 8 Aug 2019 06:27:40 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x786Re1Q081538; Thu, 8 Aug 2019 06:27:40 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x786ReNW081537; Thu, 8 Aug 2019 06:27:40 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908080627.x786ReNW081537@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 8 Aug 2019 06:27:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350742 - in head/sys: geom/uzip modules/geom/geom_uzip X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in head/sys: geom/uzip modules/geom/geom_uzip X-SVN-Commit-Revision: 350742 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 06:27:40 -0000 Author: delphij Date: Thu Aug 8 06:27:39 2019 New Revision: 350742 URL: https://svnweb.freebsd.org/changeset/base/350742 Log: Update geom_uzip to use new zlib: - Use new zlib headers; - Removed z_alloc and z_free to use the common sys/dev/zlib version. - Replace z_compressBound with compressBound from zlib. While there, limit LZMA CFLAGS to apply only for g_uzip_lzma.c. PR: 229763 Submitted by: Yoshihiro Ota (with changes, bugs are mine) Differential Revision: https://reviews.freebsd.org/D20271 Modified: head/sys/geom/uzip/g_uzip_zlib.c head/sys/modules/geom/geom_uzip/Makefile Modified: head/sys/geom/uzip/g_uzip_zlib.c ============================================================================== --- head/sys/geom/uzip/g_uzip_zlib.c Thu Aug 8 06:26:34 2019 (r350741) +++ head/sys/geom/uzip/g_uzip_zlib.c Thu Aug 8 06:27:39 2019 (r350742) @@ -33,7 +33,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include +#include #include #include @@ -46,8 +47,6 @@ struct g_uzip_zlib { z_stream zs; }; -static void *z_alloc(void *, u_int, u_int); -static void z_free(void *, void *); static int g_uzip_zlib_rewind(struct g_uzip_dapi *, const char *); static void @@ -97,26 +96,17 @@ g_uzip_zlib_rewind(struct g_uzip_dapi *zpp, const char return (err); } -static int -z_compressBound(int len) -{ - - return (len + (len >> 12) + (len >> 14) + 11); -} - struct g_uzip_dapi * g_uzip_zlib_ctor(uint32_t blksz) { struct g_uzip_zlib *zp; - zp = malloc(sizeof(struct g_uzip_zlib), M_GEOM_UZIP, M_WAITOK); - zp->zs.zalloc = z_alloc; - zp->zs.zfree = z_free; + zp = malloc(sizeof(struct g_uzip_zlib), M_GEOM_UZIP, M_WAITOK | M_ZERO); if (inflateInit(&zp->zs) != Z_OK) { goto e1; } zp->blksz = blksz; - zp->pub.max_blen = z_compressBound(blksz); + zp->pub.max_blen = compressBound(blksz); zp->pub.decompress = &g_uzip_zlib_decompress; zp->pub.free = &g_uzip_zlib_free; zp->pub.rewind = &g_uzip_zlib_rewind; @@ -125,21 +115,4 @@ g_uzip_zlib_ctor(uint32_t blksz) e1: free(zp, M_GEOM_UZIP); return (NULL); -} - -static void * -z_alloc(void *nil, u_int type, u_int size) -{ - void *ptr; - - ptr = malloc(type * size, M_GEOM_UZIP, M_NOWAIT); - - return (ptr); -} - -static void -z_free(void *nil, void *ptr) -{ - - free(ptr, M_GEOM_UZIP); } Modified: head/sys/modules/geom/geom_uzip/Makefile ============================================================================== --- head/sys/modules/geom/geom_uzip/Makefile Thu Aug 8 06:26:34 2019 (r350741) +++ head/sys/modules/geom/geom_uzip/Makefile Thu Aug 8 06:27:39 2019 (r350742) @@ -10,7 +10,7 @@ SRCS+= g_uzip.h g_uzip_dapi.h g_uzip_lzma.h g_uzip_zli .PATH: ${SRCTOP}/sys/net -CFLAGS+= -I${SRCTOP}/sys/contrib/xz-embedded/freebsd \ +CFLAGS.g_uzip_lzma.c+= -I${SRCTOP}/sys/contrib/xz-embedded/freebsd \ -I${SRCTOP}/sys/contrib/xz-embedded/linux/lib/xz/ SRCS+= opt_geom.h From owner-svn-src-head@freebsd.org Thu Aug 8 06:30:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 81162C4BEE; Thu, 8 Aug 2019 06:30:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463z512tcQz3Q7C; Thu, 8 Aug 2019 06:30:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5936E20F57; Thu, 8 Aug 2019 06:30:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x786UDkN081739; Thu, 8 Aug 2019 06:30:13 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x786UDSt081738; Thu, 8 Aug 2019 06:30:13 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908080630.x786UDSt081738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 8 Aug 2019 06:30:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350743 - head/sys/dev/bxe X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sys/dev/bxe X-SVN-Commit-Revision: 350743 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 06:30:13 -0000 Author: delphij Date: Thu Aug 8 06:30:12 2019 New Revision: 350743 URL: https://svnweb.freebsd.org/changeset/base/350743 Log: Update bxe(4) to use new zlib. PR: 229763 Submitted by: Yoshihiro Ota Differential Revision: https://reviews.freebsd.org/D21175 Modified: head/sys/dev/bxe/bxe.h Modified: head/sys/dev/bxe/bxe.h ============================================================================== --- head/sys/dev/bxe/bxe.h Thu Aug 8 06:27:39 2019 (r350742) +++ head/sys/dev/bxe/bxe.h Thu Aug 8 06:30:12 2019 (r350743) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include From owner-svn-src-head@freebsd.org Thu Aug 8 07:27:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C53E2C6274; Thu, 8 Aug 2019 07:27:50 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4640MV4pyZz3y7y; Thu, 8 Aug 2019 07:27:50 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8737D21A46; Thu, 8 Aug 2019 07:27:50 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x787Rodu017074; Thu, 8 Aug 2019 07:27:50 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x787RofB017071; Thu, 8 Aug 2019 07:27:50 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908080727.x787RofB017071@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 8 Aug 2019 07:27:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350744 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 350744 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 07:27:50 -0000 Author: delphij Date: Thu Aug 8 07:27:49 2019 New Revision: 350744 URL: https://svnweb.freebsd.org/changeset/base/350744 Log: Convert DDB_CTF to use newer version of ZLIB. PR: 229763 Submitted by: Yoshihiro Ota Differential Revision: https://reviews.freebsd.org/D21176 Modified: head/sys/kern/kern_ctf.c head/sys/kern/link_elf.c head/sys/kern/link_elf_obj.c Modified: head/sys/kern/kern_ctf.c ============================================================================== --- head/sys/kern/kern_ctf.c Thu Aug 8 06:30:12 2019 (r350743) +++ head/sys/kern/kern_ctf.c Thu Aug 8 07:27:49 2019 (r350744) @@ -40,21 +40,7 @@ #define CTF_HDR_STRLEN_U32 8 #ifdef DDB_CTF -static void * -z_alloc(void *nil, u_int items, u_int size) -{ - void *ptr; - - ptr = malloc(items * size, M_TEMP, M_NOWAIT); - return ptr; -} - -static void -z_free(void *nil, void *ptr) -{ - free(ptr, M_TEMP); -} - +#include #endif static int @@ -269,8 +255,6 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc) /* Initialise the zlib structure. */ bzero(&zs, sizeof(zs)); - zs.zalloc = z_alloc; - zs.zfree = z_free; if (inflateInit(&zs) != Z_OK) { error = EIO; Modified: head/sys/kern/link_elf.c ============================================================================== --- head/sys/kern/link_elf.c Thu Aug 8 06:30:12 2019 (r350743) +++ head/sys/kern/link_elf.c Thu Aug 8 07:27:49 2019 (r350744) @@ -67,10 +67,6 @@ __FBSDID("$FreeBSD$"); #include -#ifdef DDB_CTF -#include -#endif - #include "linker_if.h" #define MAXSEGS 4 Modified: head/sys/kern/link_elf_obj.c ============================================================================== --- head/sys/kern/link_elf_obj.c Thu Aug 8 06:30:12 2019 (r350743) +++ head/sys/kern/link_elf_obj.c Thu Aug 8 07:27:49 2019 (r350744) @@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef DDB_CTF -#include +#include #endif #include "linker_if.h" From owner-svn-src-head@freebsd.org Thu Aug 8 08:23:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E471C7773; Thu, 8 Aug 2019 08:23:28 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4641bh0wZdz41fZ; Thu, 8 Aug 2019 08:23:28 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 018A422572; Thu, 8 Aug 2019 08:23:28 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x788NR87051934; Thu, 8 Aug 2019 08:23:27 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x788NRb6051933; Thu, 8 Aug 2019 08:23:27 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201908080823.x788NRb6051933@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 8 Aug 2019 08:23:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350745 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 350745 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 08:23:28 -0000 Author: tuexen Date: Thu Aug 8 08:23:27 2019 New Revision: 350745 URL: https://svnweb.freebsd.org/changeset/base/350745 Log: Fix a typo. Submitted by: Thomas Dreibholz MFC after: 1 week Modified: head/sys/netinet/sctp_asconf.c Modified: head/sys/netinet/sctp_asconf.c ============================================================================== --- head/sys/netinet/sctp_asconf.c Thu Aug 8 07:27:49 2019 (r350744) +++ head/sys/netinet/sctp_asconf.c Thu Aug 8 08:23:27 2019 (r350745) @@ -1366,7 +1366,7 @@ sctp_asconf_queue_add(struct sctp_tcb *stcb, struct sc if (sctp_asconf_queue_mgmt(stcb, stcb->asoc.asconf_addr_del_pending, SCTP_DEL_IP_ADDRESS) == 0) { - SCTPDBG(SCTP_DEBUG_ASCONF2, "asconf_queue_add: queing pending delete\n"); + SCTPDBG(SCTP_DEBUG_ASCONF2, "asconf_queue_add: queuing pending delete\n"); pending_delete_queued = 1; /* clear out the pending delete info */ stcb->asoc.asconf_del_pending = 0; From owner-svn-src-head@freebsd.org Thu Aug 8 09:42:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D2ADC968A; Thu, 8 Aug 2019 09:42:58 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4643MQ0K4nz45cx; Thu, 8 Aug 2019 09:42:58 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C76E423414; Thu, 8 Aug 2019 09:42:57 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x789gvMR098962; Thu, 8 Aug 2019 09:42:57 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x789gvWU098961; Thu, 8 Aug 2019 09:42:57 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201908080942.x789gvWU098961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 8 Aug 2019 09:42:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350746 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 350746 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 09:42:58 -0000 Author: bz Date: Thu Aug 8 09:42:57 2019 New Revision: 350746 URL: https://svnweb.freebsd.org/changeset/base/350746 Log: frag6.c: initial comment and whitespace cleanup. Cleanup some comments (start with upper case, ends in punctuation, use width and do not consume vertical space). Update comments to RFC8200. Some whitespace changes. No functional changes. MFC after: 3 months Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Aug 8 08:23:27 2019 (r350745) +++ head/sys/netinet6/frag6.c Thu Aug 8 09:42:57 2019 (r350746) @@ -60,16 +60,14 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include /* for ECN definitions */ -#include /* for ECN definitions */ +#include /* For ECN definitions. */ +#include /* For ECN definitions. */ #ifdef MAC #include #endif -/* - * Reassembly headers are stored in hash buckets. - */ +/* Reassembly headers are stored in hash buckets. */ #define IP6REASS_NHASH_LOG2 10 #define IP6REASS_NHASH (1 << IP6REASS_NHASH_LOG2) #define IP6REASS_HMASK (IP6REASS_NHASH - 1) @@ -211,8 +209,7 @@ ip6_deletefraghdr(struct mbuf *m, int offset, int wait } /* - * Free a fragment reassembly header and all - * associated datagrams. + * Free a fragment reassembly header and all associated datagrams. */ static void frag6_freef(struct ip6q *q6, uint32_t bucket) @@ -235,17 +232,18 @@ frag6_freef(struct ip6q *q6, uint32_t bucket) if (af6->ip6af_off == 0) { struct ip6_hdr *ip6; - /* adjust pointer */ + /* Adjust pointer. */ ip6 = mtod(m, struct ip6_hdr *); - /* restore source and destination addresses */ + /* Restore source and destination addresses. */ ip6->ip6_src = q6->ip6q_src; ip6->ip6_dst = q6->ip6q_dst; icmp6_error(m, ICMP6_TIME_EXCEEDED, - ICMP6_TIME_EXCEED_REASSEMBLY, 0); + ICMP6_TIME_EXCEED_REASSEMBLY, 0); } else m_freem(m); + free(af6, M_FRAG6); } frag6_remque(q6, bucket); @@ -258,27 +256,27 @@ frag6_freef(struct ip6q *q6, uint32_t bucket) } /* - * In RFC2460, fragment and reassembly rule do not agree with each other, - * in terms of next header field handling in fragment header. + * Like in RFC2460, in RFC8200, fragment and reassembly rules do not agree with + * each other, in terms of next header field handling in fragment header. * While the sender will use the same value for all of the fragmented packets, - * receiver is suggested not to check the consistency. + * receiver is suggested not to check for consistency. * - * fragment rule (p20): - * (2) A Fragment header containing: - * The Next Header value that identifies the first header of - * the Fragmentable Part of the original packet. + * Fragment rules (p18,p19): + * (2) A Fragment header containing: + * The Next Header value that identifies the first header + * after the Per-Fragment headers of the original packet. * -> next header field is same for all fragments * - * reassembly rule (p21): - * The Next Header field of the last header of the Unfragmentable - * Part is obtained from the Next Header field of the first + * Reassembly rule (p20): + * The Next Header field of the last header of the Per-Fragment + * headers is obtained from the Next Header field of the first * fragment's Fragment header. * -> should grab it from the first fragment only * * The following note also contradicts with fragment rule - no one is going to * send different fragment with different next header field. * - * additional note (p22): + * Additional note (p22) [not an error]: * The Next Header values in the Fragment headers of different * fragments of the same original packet may differ. Only the value * from the Offset zero fragment packet is used for reassembly. @@ -287,7 +285,7 @@ frag6_freef(struct ip6q *q6, uint32_t bucket) * There is no explicit reason given in the RFC. Historical reason maybe? */ /* - * Fragment input + * Fragment input. */ int frag6_input(struct mbuf **mp, int *offp, int proto) @@ -322,13 +320,14 @@ frag6_input(struct mbuf **mp, int *offp, int proto) #endif dstifp = NULL; - /* find the destination interface of the packet. */ + /* Find the destination interface of the packet. */ ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); if (ia != NULL) { dstifp = ia->ia_ifp; ifa_free(&ia->ia_ifa); } - /* jumbo payload can't contain a fragment header */ + + /* Jumbo payload cannot contain a fragment header. */ if (ip6->ip6_plen == 0) { icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, offset); in6_ifstat_inc(dstifp, ifs6_reass_fail); @@ -336,8 +335,8 @@ frag6_input(struct mbuf **mp, int *offp, int proto) } /* - * check whether fragment packet's fragment length is - * multiple of 8 octets. + * Check whether fragment packet's fragment length is a + * multiple of 8 octets (unless it is the last one). * sizeof(struct ip6_frag) == 8 * sizeof(struct ip6_hdr) = 40 */ @@ -352,16 +351,17 @@ frag6_input(struct mbuf **mp, int *offp, int proto) IP6STAT_INC(ip6s_fragments); in6_ifstat_inc(dstifp, ifs6_reass_reqd); - /* offset now points to data portion */ + /* Offset now points to data portion. */ offset += sizeof(struct ip6_frag); /* * Handle "atomic" fragments (offset and m bit set to 0) upfront, - * unrelated to any reassembly (see RFC 6946 and section 4.5 of RFC - * 8200). Just skip the fragment header. + * unrelated to any reassembly. Still need to remove the frag hdr. + * See RFC 6946 and section 4.5 of RFC 8200. */ if ((ip6f->ip6f_offlg & ~IP6F_RESERVED_MASK) == 0) { IP6STAT_INC(ip6s_atomicfrags); + /* XXX-BZ handle correctly. */ in6_ifstat_inc(dstifp, ifs6_reass_ok); *offp = offset; m->m_flags |= M_FRAGMENTED; @@ -378,6 +378,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) return IPPROTO_DONE; } + /* Generate a hash value for fragment bucket selection. */ hashkeyp = hashkey; memcpy(hashkeyp, &ip6->ip6_src, sizeof(struct in6_addr)); hashkeyp += sizeof(struct in6_addr) / sizeof(*hashkeyp); @@ -390,7 +391,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) IP6QB_LOCK(bucket); /* - * Enforce upper bound on number of fragments. + * Enforce upper bound on number of fragments for the entire system. * If maxfrag is 0, never accept fragments. * If maxfrag is -1, accept all fragments without limitation. */ @@ -410,9 +411,8 @@ frag6_input(struct mbuf **mp, int *offp, int proto) break; if (q6 == head) { - /* - * the first fragment to arrive, create a reassembly queue. - */ + + /* The first fragment to arrive, create a reassembly queue. */ first_frag = 1; /* @@ -429,6 +429,8 @@ frag6_input(struct mbuf **mp, int *offp, int proto) (u_int)V_ip6_maxfragpackets) goto dropfrag; atomic_add_int(&V_frag6_nfragpackets, 1); + + /* Allocate IPv6 fragement packet queue entry. */ q6 = (struct ip6q *)malloc(sizeof(struct ip6q), M_FRAG6, M_NOWAIT | M_ZERO); if (q6 == NULL) @@ -442,7 +444,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) #endif frag6_insque_head(q6, head, bucket); - /* ip6q_nxt will be filled afterwards, from 1st fragment */ + /* ip6q_nxt will be filled afterwards, from 1st fragment. */ q6->ip6q_down = q6->ip6q_up = (struct ip6asfrag *)q6; #ifdef notyet q6->ip6q_nxtp = (u_char *)nxtp; @@ -459,7 +461,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) } /* - * If it's the 1st fragment, record the length of the + * If it is the 1st fragment, record the length of the * unfragmentable part and the next header of the fragment header. */ fragoff = ntohs(ip6f->ip6f_offlg & IP6F_OFF_MASK); @@ -491,7 +493,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) return (IPPROTO_DONE); } /* - * If it's the first fragment, do the above check for each + * If it is the first fragment, do the above check for each * fragment already stored in the reassembly queue. */ if (fragoff == 0) { @@ -505,11 +507,11 @@ frag6_input(struct mbuf **mp, int *offp, int proto) struct ip6_hdr *ip6err; int erroff = af6->ip6af_offset; - /* dequeue the fragment. */ + /* Dequeue the fragment. */ frag6_deq(af6, bucket); free(af6, M_FRAG6); - /* adjust pointer. */ + /* Adjust pointer. */ ip6err = mtod(merr, struct ip6_hdr *); /* @@ -527,6 +529,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) } } + /* Allocate an IPv6 fragement queue entry for this fragmented part. */ ip6af = (struct ip6asfrag *)malloc(sizeof(struct ip6asfrag), M_FRAG6, M_NOWAIT | M_ZERO); if (ip6af == NULL) @@ -542,10 +545,11 @@ frag6_input(struct mbuf **mp, int *offp, int proto) goto insert; } + /* Do duplicate, condition, and boundry checks. */ /* * Handle ECN by comparing this segment with the first one; * if CE is set, do not lose CE. - * drop if CE and not-ECT are mixed for the same packet. + * Drop if CE and not-ECT are mixed for the same packet. */ ecn = (ntohl(ip6->ip6_flow) >> 20) & IPTOS_ECN_MASK; ecn0 = q6->ip6q_ecn; @@ -562,9 +566,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) goto dropfrag; } - /* - * Find a segment which begins after this one does. - */ + /* Find a fragmented part which begins after this one does. */ for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; af6 = af6->ip6af_down) if (af6->ip6af_off > ip6af->ip6af_off) @@ -572,13 +574,11 @@ frag6_input(struct mbuf **mp, int *offp, int proto) /* * If the incoming framgent overlaps some existing fragments in - * the reassembly queue, drop it, since it is dangerous to override - * existing fragments from a security point of view. - * We don't know which fragment is the bad guy - here we trust - * fragment that came in earlier, with no real reason. - * - * Note: due to changes after disabling this part, mbuf passed to - * m_adj() below now does not meet the requirement. + * the reassembly queue, drop both the new fragment and the + * entire reassembly queue. However, if the new fragment + * is an exact duplicate of an existing fragment, only silently + * drop the existing fragment and leave the fragmentation queue + * unchanged, as allowed by the RFC. (RFC 8200, 4.5) */ if (af6->ip6af_up != (struct ip6asfrag *)q6) { i = af6->ip6af_up->ip6af_off + af6->ip6af_up->ip6af_frglen @@ -603,11 +603,9 @@ insert: #endif /* - * Stick new segment in its place; - * check for complete reassembly. - * If not complete, check fragment limit. - * Move to front of packet queue, as we are - * the most recently active fragmented packet. + * Stick new segment in its place; check for complete reassembly. + * If not complete, check fragment limit. Move to front of packet + * queue, as we are the most recently active fragmented packet. */ frag6_enq(ip6af, af6->ip6af_up, bucket); atomic_add_int(&frag6_nfrags, 1); @@ -634,9 +632,7 @@ insert: return IPPROTO_DONE; } - /* - * Reassembly is complete; concatenate fragments. - */ + /* Reassembly is complete; concatenate fragments. */ ip6af = q6->ip6q_down; t = m = IP6_REASS_MBUF(ip6af); af6 = ip6af->ip6af_down; @@ -662,7 +658,7 @@ insert: m->m_pkthdr.csum_data = (m->m_pkthdr.csum_data & 0xffff) + (m->m_pkthdr.csum_data >> 16); - /* adjust offset to point where the original next header starts */ + /* Adjust offset to point where the original next header starts. */ offset = ip6af->ip6af_offset - sizeof(struct ip6_frag); free(ip6af, M_FRAG6); ip6 = mtod(m, struct ip6_hdr *); @@ -683,9 +679,7 @@ insert: goto dropfrag; } - /* - * Store NXT to the original. - */ + /* Set nxt(-hdr field value) to the original value. */ m_copyback(m, ip6_get_prevhdr(m, offset), sizeof(uint8_t), (caddr_t)&nxt); @@ -723,17 +717,12 @@ insert: in6_ifstat_inc(dstifp, ifs6_reass_ok); #ifdef RSS - /* - * Queue/dispatch for reprocessing. - */ + /* Queue/dispatch for reprocessing. */ netisr_dispatch(NETISR_IPV6_DIRECT, m); return IPPROTO_DONE; #endif - /* - * Tell launch routine the next header - */ - + /* Tell launch routine the next header. */ *mp = m; *offp = offset; @@ -749,8 +738,7 @@ insert: /* * IPv6 reassembling timer processing; - * if a timer expires on a reassembly - * queue, discard it. + * if a timer expires on a reassembly queue, discard it. */ void frag6_slowtimo(void) @@ -790,7 +778,7 @@ frag6_slowtimo(void) * enough to get down to the new limit. * Note that we drain all reassembly queues if * maxfragpackets is 0 (fragmentation is disabled), - * and don't enforce a limit when maxfragpackets + * and do not enforce a limit when maxfragpackets * is negative. */ while ((V_ip6_maxfragpackets == 0 || @@ -828,6 +816,9 @@ frag6_slowtimo(void) VNET_LIST_RUNLOCK_NOSLEEP(); } +/* + * Eventhandler to adjust limits in case nmbclusters change. + */ static void frag6_change(void *tag) { From owner-svn-src-head@freebsd.org Thu Aug 8 09:47:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FAB2C97D4; Thu, 8 Aug 2019 09:47:01 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4643S46CZBz45qH; Thu, 8 Aug 2019 09:47:00 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg1-x52b.google.com with SMTP id r26so7827785pgl.10; Thu, 08 Aug 2019 02:47:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=Saln8UERDn2b8ucAEk6bPXGchYkzEQo2xHutO/Fgx5s=; b=oAzs6Z40o1Dxtv20VeUHeHk4Ct4KcUfNuFyZq2uyKy7blAwdr1uSDp4h/6NKXca21H lj1LijV3OyPRq0I867yOVkGR5rbPOmRjpknOirzOFGU0JRVZvD9KDqBML7jyLrZTAtJx LUZFMNMcMj8el+jVkC5lxVfMlvH0KBBtFnVFSu6cnMl5eZZdjBwEbUy8zRXa/cwr1ZAw pWZ1qKC6gCbfeZHt4v8FA208ltiln4clwaxeKF37Zb1Ydx96gOXGIeGo0bpsnCDIBy9Z nvHjiD3AUy1RiMKWjUq5k33Fd1FQCUV/X+WhQZn6QB4kVubl49ieKb5Mlo03/R/Do2vp lQ1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=Saln8UERDn2b8ucAEk6bPXGchYkzEQo2xHutO/Fgx5s=; b=A06hzhi8Lh194dWMsXaYw/s5f39liO/5+Fo6nH6rHUHhejjeSHtb/cRk1VabGN8z/q Xyd8OLuoLK2TaVvQ3aIuk3mzATDKHFBABcANrDkkEq1tzwvT9BwiQdYFvXtZuUyd7PJw cKai8un80PnZ/qmwgwaAsxf4SsEyJ0K6QhhQgiHauMc1mN0lnpgJwJQ9gUdsQ1xRGmz9 FqCqBzGRXron0BzdZRHQfp9u8jWEW162kMjHSR6bSut0h4rNNqcj3o0kl7vc8RmsuXeO xfW67H5Dgk7Dc6+aWZCuMH5G9vG24KS54qmpTkdzc1LlHnc1W8q9H4kUgNb0AjIXYVWC NWAA== X-Gm-Message-State: APjAAAVdPJ63BI0JKEbLj+6B2C3GB992MTDNU406GbsOuSjmETqkTFy3 EUdlKopVou2jY2/foL9CCInurNeL3zQ= X-Google-Smtp-Source: APXvYqybaQR4hZwBBVAe2KaLqoT8MxOwi9OKJbMuNhwMdprUvMc8KCz72UyMm+WaYZUxbbHyVUrqsQ== X-Received: by 2002:a17:90a:25c8:: with SMTP id k66mr3129999pje.129.1565257618586; Thu, 08 Aug 2019 02:46:58 -0700 (PDT) Received: from [192.168.20.7] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id n185sm81530960pga.16.2019.08.08.02.46.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Aug 2019 02:46:57 -0700 (PDT) From: Enji Cooper Message-Id: <50736BCD-21A8-4E59-92F7-DBFE60E652DA@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r350512 - head/tests/sys/kern Date: Thu, 8 Aug 2019 02:46:56 -0700 In-Reply-To: Cc: Mark Johnston , src-committers , svn-src-all , svn-src-head@freebsd.org To: Li-Wen Hsu References: <201908011819.x71IJG0M076399@repo.freebsd.org> <20190807202732.GD1377@raichu> X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 4643S46CZBz45qH X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 09:47:01 -0000 > On Aug 7, 2019, at 2:04 PM, Li-Wen Hsu wrote: >=20 > On Thu, Aug 8, 2019 at 4:27 AM Mark Johnston > wrote: >>=20 >> On Thu, Aug 01, 2019 at 06:19:16PM +0000, Li-Wen Hsu wrote: >>> Author: lwhsu >>> Date: Thu Aug 1 18:19:16 2019 >>> New Revision: 350512 >>> URL: https://svnweb.freebsd.org/changeset/base/350512 >>>=20 >>> Log: >>> Only skip test cases sometimes failing in CI when they are running = in CI >>>=20 >>> Suggested by: jhb >>> Sponsored by: The FreeBSD Foundation >>=20 >> This seems to break running the tests manually; atf dies because the >> "ci" variable is not defined. I have to use an invocation like this = to >> avoid that: >>=20 >> $ kyua -v test_suites.FreeBSD.ci=3Dfalse test ptrace_test >>=20 >> I suspect that share/mk/suite.test.mk needs to be augmented somehow = to >> set this variable to "false" by default, so that the CI = infrastructure >> can override that. >=20 > Thanks for catching this! I feel that the better approach is using > function that gets this variable with default value, for keeping > things simple. This is the right API to use: atf_tc_get_config_var_as_bool_wd(tc, variable_name, default_value); Just set the default to `false`. HTH, -Enji= From owner-svn-src-head@freebsd.org Thu Aug 8 10:15:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 79E05CA0BC; Thu, 8 Aug 2019 10:15:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46445J2h6Yz47Zv; Thu, 8 Aug 2019 10:15:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3DC45239BA; Thu, 8 Aug 2019 10:15:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78AFmvj017041; Thu, 8 Aug 2019 10:15:48 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78AFmxh017040; Thu, 8 Aug 2019 10:15:48 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201908081015.x78AFmxh017040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 8 Aug 2019 10:15:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350747 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 350747 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 10:15:48 -0000 Author: bz Date: Thu Aug 8 10:15:47 2019 New Revision: 350747 URL: https://svnweb.freebsd.org/changeset/base/350747 Log: frag6.c: cleanup varaibles and return statements. Consitently put () around return values. Do not assign variables at the time of variable declaration. Sort variables. Rename ia to ia6, remove/reuse some variables used only once or twice for temporary calculations. No functional changes intended. MFC after: 3 months Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Aug 8 09:42:57 2019 (r350746) +++ head/sys/netinet6/frag6.c Thu Aug 8 10:15:47 2019 (r350747) @@ -186,17 +186,20 @@ SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGBUCKETSIZE, int ip6_deletefraghdr(struct mbuf *m, int offset, int wait) { - struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + struct ip6_hdr *ip6; struct mbuf *t; /* Delete frag6 header. */ if (m->m_len >= offset + sizeof(struct ip6_frag)) { + /* This is the only possible case with !PULLDOWN_TEST. */ + ip6 = mtod(m, struct ip6_hdr *); bcopy(ip6, (char *)ip6 + sizeof(struct ip6_frag), offset); m->m_data += sizeof(struct ip6_frag); m->m_len -= sizeof(struct ip6_frag); } else { + /* This comes with no copy if the boundary is on cluster. */ if ((t = m_split(m, offset, wait)) == NULL) return (ENOMEM); @@ -214,14 +217,16 @@ ip6_deletefraghdr(struct mbuf *m, int offset, int wait static void frag6_freef(struct ip6q *q6, uint32_t bucket) { + struct ip6_hdr *ip6; struct ip6asfrag *af6, *down6; + struct mbuf *m; IP6QB_LOCK_ASSERT(bucket); for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; af6 = down6) { - struct mbuf *m = IP6_REASS_MBUF(af6); + m = IP6_REASS_MBUF(af6); down6 = af6->ip6af_down; frag6_deq(af6, bucket); @@ -230,7 +235,6 @@ frag6_freef(struct ip6q *q6, uint32_t bucket) * Just free other fragments. */ if (af6->ip6af_off == 0) { - struct ip6_hdr *ip6; /* Adjust pointer. */ ip6 = mtod(m, struct ip6_hdr *); @@ -290,25 +294,28 @@ frag6_freef(struct ip6q *q6, uint32_t bucket) int frag6_input(struct mbuf **mp, int *offp, int proto) { - struct mbuf *m = *mp, *t; + struct ifnet *dstifp; + struct in6_ifaddr *ia6; struct ip6_hdr *ip6; struct ip6_frag *ip6f; struct ip6q *head, *q6; - struct ip6asfrag *af6, *ip6af, *af6dwn; - struct in6_ifaddr *ia; - int offset = *offp, nxt, i, next; - int first_frag = 0; - int fragoff, frgpartlen; /* must be larger than u_int16_t */ + struct ip6asfrag *af6, *af6dwn, *ip6af; + struct mbuf *m, *t; uint32_t hashkey[(sizeof(struct in6_addr) * 2 + sizeof(ip6f->ip6f_ident)) / sizeof(uint32_t)]; uint32_t bucket, *hashkeyp; - struct ifnet *dstifp; - u_int8_t ecn, ecn0; + int fragoff, frgpartlen; /* Must be larger than uint16_t. */ + int nxt, offset, plen; + uint8_t ecn, ecn0; + bool only_frag; #ifdef RSS - struct m_tag *mtag; struct ip6_direct_ctx *ip6dc; + struct m_tag *mtag; #endif + m = *mp; + offset = *offp; + ip6 = mtod(m, struct ip6_hdr *); #ifndef PULLDOWN_TEST IP6_EXTHDR_CHECK(m, offset, sizeof(struct ip6_frag), IPPROTO_DONE); @@ -321,17 +328,17 @@ frag6_input(struct mbuf **mp, int *offp, int proto) dstifp = NULL; /* Find the destination interface of the packet. */ - ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); - if (ia != NULL) { - dstifp = ia->ia_ifp; - ifa_free(&ia->ia_ifa); + ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); + if (ia6 != NULL) { + dstifp = ia6->ia_ifp; + ifa_free(&ia6->ia_ifa); } /* Jumbo payload cannot contain a fragment header. */ if (ip6->ip6_plen == 0) { icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, offset); in6_ifstat_inc(dstifp, ifs6_reass_fail); - return IPPROTO_DONE; + return (IPPROTO_DONE); } /* @@ -345,7 +352,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, offsetof(struct ip6_hdr, ip6_plen)); in6_ifstat_inc(dstifp, ifs6_reass_fail); - return IPPROTO_DONE; + return (IPPROTO_DONE); } IP6STAT_INC(ip6s_fragments); @@ -375,7 +382,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) offsetof(struct ip6_hdr, ip6_plen)); in6_ifstat_inc(dstifp, ifs6_reass_fail); IP6STAT_INC(ip6s_fragdropped); - return IPPROTO_DONE; + return (IPPROTO_DONE); } /* Generate a hash value for fragment bucket selection. */ @@ -410,10 +417,11 @@ frag6_input(struct mbuf **mp, int *offp, int proto) ) break; + only_frag = false; if (q6 == head) { - /* The first fragment to arrive, create a reassembly queue. */ - first_frag = 1; + /* A first fragment to arrive creates a reassembly queue. */ + only_frag = true; /* * Enforce upper bound on number of fragmented packets @@ -503,10 +511,13 @@ frag6_input(struct mbuf **mp, int *offp, int proto) if (q6->ip6q_unfrglen + af6->ip6af_off + af6->ip6af_frglen > IPV6_MAXPACKET) { - struct mbuf *merr = IP6_REASS_MBUF(af6); struct ip6_hdr *ip6err; - int erroff = af6->ip6af_offset; + struct mbuf *merr; + int erroff; + merr = IP6_REASS_MBUF(af6); + erroff = af6->ip6af_offset; + /* Dequeue the fragment. */ frag6_deq(af6, bucket); free(af6, M_FRAG6); @@ -540,7 +551,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) ip6af->ip6af_offset = offset; IP6_REASS_MBUF(ip6af) = m; - if (first_frag) { + if (only_frag) { af6 = (struct ip6asfrag *)q6; goto insert; } @@ -581,16 +592,15 @@ frag6_input(struct mbuf **mp, int *offp, int proto) * unchanged, as allowed by the RFC. (RFC 8200, 4.5) */ if (af6->ip6af_up != (struct ip6asfrag *)q6) { - i = af6->ip6af_up->ip6af_off + af6->ip6af_up->ip6af_frglen - - ip6af->ip6af_off; - if (i > 0) { + if (af6->ip6af_up->ip6af_off + af6->ip6af_up->ip6af_frglen - + ip6af->ip6af_off > 0) { free(ip6af, M_FRAG6); goto dropfrag; } } if (af6 != (struct ip6asfrag *)q6) { - i = (ip6af->ip6af_off + ip6af->ip6af_frglen) - af6->ip6af_off; - if (i > 0) { + if (ip6af->ip6af_off + ip6af->ip6af_frglen - + af6->ip6af_off > 0) { free(ip6af, M_FRAG6); goto dropfrag; } @@ -598,7 +608,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) insert: #ifdef MAC - if (!first_frag) + if (!only_frag) mac_ip6q_update(m, q6); #endif @@ -610,18 +620,18 @@ insert: frag6_enq(ip6af, af6->ip6af_up, bucket); atomic_add_int(&frag6_nfrags, 1); q6->ip6q_nfrag++; - next = 0; + plen = 0; for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; af6 = af6->ip6af_down) { - if (af6->ip6af_off != next) { + if (af6->ip6af_off != plen) { if (q6->ip6q_nfrag > V_ip6_maxfragsperpacket) { IP6STAT_ADD(ip6s_fragdropped, q6->ip6q_nfrag); frag6_freef(q6, bucket); } IP6QB_UNLOCK(bucket); - return IPPROTO_DONE; + return (IPPROTO_DONE); } - next += af6->ip6af_frglen; + plen += af6->ip6af_frglen; } if (af6->ip6af_up->ip6af_mff) { if (q6->ip6q_nfrag > V_ip6_maxfragsperpacket) { @@ -629,7 +639,7 @@ insert: frag6_freef(q6, bucket); } IP6QB_UNLOCK(bucket); - return IPPROTO_DONE; + return (IPPROTO_DONE); } /* Reassembly is complete; concatenate fragments. */ @@ -662,7 +672,7 @@ insert: offset = ip6af->ip6af_offset - sizeof(struct ip6_frag); free(ip6af, M_FRAG6); ip6 = mtod(m, struct ip6_hdr *); - ip6->ip6_plen = htons((u_short)next + offset - sizeof(struct ip6_hdr)); + ip6->ip6_plen = htons((u_short)plen + offset - sizeof(struct ip6_hdr)); if (q6->ip6q_ecn == IPTOS_ECN_CE) ip6->ip6_flow |= htonl(IPTOS_ECN_CE << 20); nxt = q6->ip6q_nxt; @@ -693,7 +703,8 @@ insert: atomic_subtract_int(&V_frag6_nfragpackets, 1); if (m->m_flags & M_PKTHDR) { /* Isn't it always true? */ - int plen = 0; + + plen = 0; for (t = m; t; t = t->m_next) plen += t->m_len; m->m_pkthdr.len = plen; @@ -719,21 +730,21 @@ insert: #ifdef RSS /* Queue/dispatch for reprocessing. */ netisr_dispatch(NETISR_IPV6_DIRECT, m); - return IPPROTO_DONE; + return (IPPROTO_DONE); #endif /* Tell launch routine the next header. */ *mp = m; *offp = offset; - return nxt; + return (nxt); - dropfrag: +dropfrag: IP6QB_UNLOCK(bucket); in6_ifstat_inc(dstifp, ifs6_reass_fail); IP6STAT_INC(ip6s_fragdropped); m_freem(m); - return IPPROTO_DONE; + return (IPPROTO_DONE); } /* From owner-svn-src-head@freebsd.org Thu Aug 8 10:55:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C0AEFCAB18; Thu, 8 Aug 2019 10:55:50 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 4644zV2GrGz49Gp; Thu, 8 Aug 2019 10:55:49 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 1922D3623A2; Thu, 8 Aug 2019 20:55:46 +1000 (AEST) Date: Thu, 8 Aug 2019 20:55:44 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Conrad Meyer cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r350713 - head/sys/kern In-Reply-To: <201908080042.x780gThf078293@repo.freebsd.org> Message-ID: <20190808183733.O1073@besplex.bde.org> References: <201908080042.x780gThf078293@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=P6RKvmIu c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=s7fTf2Y6X_s07L22htsA:9 a=CjuIK1q_8ugA:10 X-Rspamd-Queue-Id: 4644zV2GrGz49Gp X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.76 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.76)[-0.757,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 10:55:50 -0000 On Thu, 8 Aug 2019, Conrad Meyer wrote: > Log: > ddb(4): Add 'sysctl' command > > Implement `sysctl` in `ddb` by overriding `SYSCTL_OUT`. When handling the > req, we install custom ddb in/out handlers. The out handler prints straight > to the debugger, while the in handler ignores all input. This is intended > to allow us to print just about any sysctl. > > There is a known issue when used from ddb(4) entered via 'sysctl > debug.kdb.enter=1'. The DDB mode does not quite prevent all lock > interactions, and it is possible for the recursive Giant lock to be unlocked > when the ddb(4) 'sysctl' command is used. This may result in a panic on > return from ddb(4) via 'c' (continue). Obviously, this is not a problem > when debugging already-paniced systems. Locking for kdb was grossly broken in r339917, by setting and unsetting the SCHEDULER_STOPPED() flag on entry and exit to kdb. This flag is only usable during panic() since when it is set all mutex operations potentially corrupt their mutex, and unsetting the flag doesn't undo the corruption. Many different types of corruption are possible, but my simplest example if like the one here for Giant, but for a spinlock. kdb runs happily while SCHEDULER_STOPPED() is set, but if it corrupts a mutex then the corruption is fatal later when SCHEDULER_STOPPED() is clear (setting SCHEDULER_STOPPED() breaks early detection of the corruption in most cases). kern_sysctl.c does only 1 pair of mutex calls. In sysctl_root_handle_locked(), it locks and unlocks Giant for the !MPSAFE case. If that is the only mutex call, then the problem is easy to fix by not making these calls if kdb_active. One of my versions of kdb asserts that no mutex calls are made if kdb_active. This makes it easy to find buggy mutex calls. Unfortunately, low-quality low level console drivers like vt make such calls unconditionally. I used this to avoid all the buggy calls in syscons (a typical error there was for to wander into wakeup or timeout code which uses mutexes. This was "fixed" by removing things like beeping for errors. The keyboard driver uses Giant fundamentally. This was "fixed" using the usual hack of not doing the mutex call if kdb_active). > ... > Modified: head/sys/kern/kern_sysctl.c > ============================================================================== > --- head/sys/kern/kern_sysctl.c Thu Aug 8 00:33:23 2019 (r350712) > +++ head/sys/kern/kern_sysctl.c Thu Aug 8 00:42:29 2019 (r350713) > ... > +/* > + * Run a sysctl handler with the DDB oldfunc and newfunc attached. > + * Instead of copying any output to a buffer we'll dump it right to > + * the console. > + */ > +static int > +db_sysctl(struct sysctl_oid *oidp, int *name, u_int namelen, > + void *old, size_t *oldlenp, size_t *retval, int flags) > +{ > + struct sysctl_req req; > + int error; > + > + /* Setup the request */ > + bzero(&req, sizeof req); > + req.td = kdb_thread; > + req.oldfunc = sysctl_old_ddb; > + req.newfunc = sysctl_new_ddb; > + req.lock = REQ_UNWIRED; > + if (oldlenp) { > + req.oldlen = *oldlenp; > + } > + req.validlen = req.oldlen; > + if (old) { > + req.oldptr = old; > + } > + > + /* Setup our globals for sysctl_old_ddb */ > + g_ddb_oid = oidp; > + g_ddb_sysctl_flags = flags; > + g_ddb_sysctl_printed = 0; This has many style bugs. So does the rest of the file. > + > + error = sysctl_root(0, name, namelen, &req); This makes invalid mutex calls for all !MPSAFE sysctls. Setting SCHEDULER_STOPPED() for kdb is only very broken for spin mutexes. Then for a contested mutex, mtx_lock_spin() ends up doing nothing except invalid lock and/or kdtrace profiling when it finds SCHEDULER_STOPPED() set. but mtx_unlock_spin() never checks SCHEDULER_STOPPED(), so it ends up corrupting the mutex and the spinlock state by attempting to unlock a mutex whose corresponding locking was not done. INVARIANTS causes similar bugs for recursed-on spin mutexes. Without INVARIANTS, everything is done inline without checking SCHEDULER_STOPPED(), so it works well enough in practice in uncontested non-recursive cases. With INVARIANTS, the null locking gives no increment of the recursion counter and no call to spinlock_enter(), but the non-null unlocking decrements the recursion counter and calls spinlock_exit(). For sleep mutexes, unlocking checks SCHEDULER_STOPPED() consistently with locking, so the bugs are smaller. The easiest way to demonstrate them is to configure INVARIANTS and WITNESS. Starting with Giant unheld, mtx_lock(&Giant) does nothing with the mutex except invalid lock and/or kdtrace profiling. mtx_unlock) calls __mtx_unlock_flags() which calls __mtx_assert(m, MA_OWNED), but this check is subverted by not doing it when SCHEDULER_STOPPED(). But before that, __mtx_unlock_flags() calls WITNESS_UNLOCK() and witness_unlock() is not similarly subverted. Also, WITNESS uses a critical spin mutex w_mtx, and this is corrupted as above. Bruce From owner-svn-src-head@freebsd.org Thu Aug 8 10:59:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67C18CAC2C; Thu, 8 Aug 2019 10:59:55 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46454C23s2z49Vg; Thu, 8 Aug 2019 10:59:55 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 420FA240EF; Thu, 8 Aug 2019 10:59:55 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78AxtIq040448; Thu, 8 Aug 2019 10:59:55 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78Axsf0040447; Thu, 8 Aug 2019 10:59:54 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201908081059.x78Axsf0040447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 8 Aug 2019 10:59:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350748 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 350748 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 10:59:55 -0000 Author: bz Date: Thu Aug 8 10:59:54 2019 New Revision: 350748 URL: https://svnweb.freebsd.org/changeset/base/350748 Log: frag6: move public structure into file local space. Move ip6asfrag and the accompanying IP6_REASS_MBUF macro from ip6_var.h into frag6.c as they are not used outside frag6.c. Sadly struct ip6q is all over the mac framework so we have to leave it public. This reduces the public KPI space. MFC after: 3 months X-MFC: possibly MFC the #define only to stable branches Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c head/sys/netinet6/ip6_var.h Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Aug 8 10:15:47 2019 (r350747) +++ head/sys/netinet6/frag6.c Thu Aug 8 10:59:54 2019 (r350748) @@ -86,6 +86,18 @@ struct ip6qbucket { int count; }; +struct ip6asfrag { + struct ip6asfrag *ip6af_down; + struct ip6asfrag *ip6af_up; + struct mbuf *ip6af_m; + int ip6af_offset; /* offset in ip6af_m to next header */ + int ip6af_frglen; /* fragmentable part length */ + int ip6af_off; /* fragment offset */ + u_int16_t ip6af_mff; /* more fragment bit in frag off */ +}; + +#define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m)) + static MALLOC_DEFINE(M_FRAG6, "frag6", "IPv6 fragment reassembly header"); /* System wide (global) maximum and count of packets in reassembly queues. */ Modified: head/sys/netinet6/ip6_var.h ============================================================================== --- head/sys/netinet6/ip6_var.h Thu Aug 8 10:15:47 2019 (r350747) +++ head/sys/netinet6/ip6_var.h Thu Aug 8 10:59:54 2019 (r350748) @@ -68,6 +68,7 @@ #include +struct ip6asfrag; /* * IP6 reassembly queue structure. Each fragment * being reassembled is attached to one of these structures. @@ -83,24 +84,9 @@ struct ip6q { struct ip6q *ip6q_next; struct ip6q *ip6q_prev; int ip6q_unfrglen; /* len of unfragmentable part */ -#ifdef notyet - u_char *ip6q_nxtp; -#endif int ip6q_nfrag; /* # of fragments */ struct label *ip6q_label; }; - -struct ip6asfrag { - struct ip6asfrag *ip6af_down; - struct ip6asfrag *ip6af_up; - struct mbuf *ip6af_m; - int ip6af_offset; /* offset in ip6af_m to next header */ - int ip6af_frglen; /* fragmentable part length */ - int ip6af_off; /* fragment offset */ - u_int16_t ip6af_mff; /* more fragment bit in frag off */ -}; - -#define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m)) /* * IP6 reinjecting structure. From owner-svn-src-head@freebsd.org Thu Aug 8 11:43:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 298E8CBC70; Thu, 8 Aug 2019 11:43:10 +0000 (UTC) (envelope-from thj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4646260LMQz4Cyp; Thu, 8 Aug 2019 11:43:10 +0000 (UTC) (envelope-from thj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E233D24A21; Thu, 8 Aug 2019 11:43:09 +0000 (UTC) (envelope-from thj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78Bh9cI069980; Thu, 8 Aug 2019 11:43:09 GMT (envelope-from thj@FreeBSD.org) Received: (from thj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78Bh9Cx069979; Thu, 8 Aug 2019 11:43:09 GMT (envelope-from thj@FreeBSD.org) Message-Id: <201908081143.x78Bh9Cx069979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: thj set sender to thj@FreeBSD.org using -f From: Tom Jones Date: Thu, 8 Aug 2019 11:43:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350749 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: thj X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 350749 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 11:43:10 -0000 Author: thj Date: Thu Aug 8 11:43:09 2019 New Revision: 350749 URL: https://svnweb.freebsd.org/changeset/base/350749 Log: Rename IPPROTO 33 from SEP to DCCP IPPROTO 33 is DCCP in the IANA Registry: https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml IPPROTO_SEP was added about 20 years ago in r33804. The entries were added straight from RFC1700, without regard to whether they were used. The reference in RFC1700 for SEP is '[JC120] ', this is an indication that the protocol number was probably in use in a private network. As RFC1700 is no longer the authoritative list of internet numbers and that IANA assinged 33 to DCCP in RFC4340, change the header to the actual authoritative source. Reviewed by: Richard Scheffenegger, bz Approved by: bz (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21178 Modified: head/sys/netinet/in.h Modified: head/sys/netinet/in.h ============================================================================== --- head/sys/netinet/in.h Thu Aug 8 10:59:54 2019 (r350748) +++ head/sys/netinet/in.h Thu Aug 8 11:43:09 2019 (r350749) @@ -169,7 +169,7 @@ __END_DECLS #define IPPROTO_BLT 30 /* Bulk Data Transfer */ #define IPPROTO_NSP 31 /* Network Services */ #define IPPROTO_INP 32 /* Merit Internodal */ -#define IPPROTO_SEP 33 /* Sequential Exchange */ +#define IPPROTO_DCCP 33 /* Datagram Congestion Control Protocol */ #define IPPROTO_3PC 34 /* Third Party Connect */ #define IPPROTO_IDPR 35 /* InterDomain Policy Routing */ #define IPPROTO_XTP 36 /* XTP */ From owner-svn-src-head@freebsd.org Thu Aug 8 14:00:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D14B3CF79E for ; Thu, 8 Aug 2019 14:00:20 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46494N396Xz4MdN for ; Thu, 8 Aug 2019 14:00:20 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1565272819; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=kNDfYDUuioWp52cQcKSHJgpZsYgrFfptxia47iVxYGWhQTgQnhDStfAfjl7I4wunrB61Gw6V/qH75 fl2MsclPsr7vDFGjQYb16p2Zurvfsi0wwDLm6BN0KUg3cvg0ohtQLE/hJAthC2bqUO8BUNTKFS3J9R WRCBwMp1NlJb/lks7eUKk0UXaSb3Btoj9tNALvocRNHjFt5pKfwaaPM5GnXlmvdVtm0WteWNlGf/Mn EXuzlmodlfbHbJKps+ceR0Jl47Rg9FrXwO6uRhuvVamdkFMVbtmGPsO1uDNAkwUCss+owuIrAOGGWb /I/BLk3G9PMsYUu6ySGsMbV7TJHWgEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=8rC1AucEIp4ciCDtGzcTDhCSqgg78EwPkcKyjdoqtq4=; b=IsPPSJsQtUWXtdve4c3YJTPvvPzAks9JvPfR9n9lj/ryDv9aPbvPoC4NCP6mED7KmGg62HVMn1e8T MpYG6cWWVImJhdh6uuNlmFt3cTlra4ROOSXMKoWRlxzdEKR/EJZe/V8/+5TTqWX5RLbp4pqLWBZu1y GjkMYdn4Oke/GnSAqcy/+83OOT1zjykylHD+S37Wg8JcW7njzPXYT5bQ1tMvWSgJ6kpEgvHEtYahha dwb0wub4LGj7sVQrbMS8JShgbmXed8hEZP8HJEepum5dubF5v5qSeP3SxVbZlNC2Exm8OFTDPsMezS x+KdhXCGRgGQqzDwe2C39wYEgOSFosQ== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=8rC1AucEIp4ciCDtGzcTDhCSqgg78EwPkcKyjdoqtq4=; b=t3fcHj75oKoltBhmZEQvkP612M2tgX0EAwAhTSU9OEdL9LWUd0ASGztNkTFnLFSJivpuHSsvLDy8D Xduj35NSSy3g0tizVIPhnmybDHAZc+AvXl7/HOhOy8UMCAMtelBWiJBG4/JBZK0zKbzmw+oYVaq364 F6qZq/cz5YVA/TKNbtj5kQrj/SZi2NrAZlyvnXs/4QdgMghb74Txtd0HzB3s+pH4yJgFDZc4i6ii1g baFcyYtgtn4DfsR59HiKQN0U9VoO5pO91gWut6LUKcH+t7YHwB3SZtUjmRCfFSzoy1+F9yz328pYjx IGEeGpZ7cY9QCEgJw7sYwUtg9rHPy7g== X-MHO-RoutePath: aGlwcGll X-MHO-User: d99b2772-b9e4-11e9-85ec-13b9aae3a1d2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id d99b2772-b9e4-11e9-85ec-13b9aae3a1d2; Thu, 08 Aug 2019 14:00:17 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x78E0GE1029727; Thu, 8 Aug 2019 08:00:16 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <53d227e7f8535424c3abff229a41e9375b077dcc.camel@freebsd.org> Subject: Re: svn commit: r350737 - head/usr.sbin/autofs From: Ian Lepore To: Justin Hibbits , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Thu, 08 Aug 2019 08:00:16 -0600 In-Reply-To: <201908080316.x783GW3r070041@repo.freebsd.org> References: <201908080316.x783GW3r070041@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46494N396Xz4MdN X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.993,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 14:00:20 -0000 On Thu, 2019-08-08 at 03:16 +0000, Justin Hibbits wrote: > Author: jhibbits > Date: Thu Aug 8 03:16:32 2019 > New Revision: 350737 > URL: https://svnweb.freebsd.org/changeset/base/350737 > > Log: > Change autounmountd(8) to use time_t for duration instead of double > > Summary: > autounmountd(8) uses doubles to handle mount time durations. However, > it must convert to integer types, time_t in particular, to do anything > meaningful. Additionally, even though it's a floating-point value in > seconds, the sub-seconds component is never used, so it's unnecessary. > > Switching type to time_t fixes an assertion on powerpc64, which checks > that a sleep value that's not -1.0 is greater than 0. On powerpc64, it > happens that the value of -1.0 gets loaded as a float (perhaps a bug in > gcc), but gets compared to a double. This compares as false, so follows > through the 'sleep != -1.0' path, and fails the assert. Since the > sub-second component isn't used in the double, just drop it and deal > with whole-integer seconds. > > Reviewed by: trasz > Differential Revision: https://reviews.freebsd.org/D21109 > > Modified: > head/usr.sbin/autofs/autounmountd.c > > Modified: head/usr.sbin/autofs/autounmountd.c > ============================================================================== > --- head/usr.sbin/autofs/autounmountd.c Thu Aug 8 03:01:35 2019 (r350736) > +++ head/usr.sbin/autofs/autounmountd.c Thu Aug 8 03:16:32 2019 (r350737) > @@ -179,12 +179,12 @@ unmount_by_fsid(const fsid_t fsid, const char *mountpo > return (error); > } > > -static double > -expire_automounted(double expiration_time) > +static time_t > +expire_automounted(time_t expiration_time) > { > struct automounted_fs *af, *tmpaf; > time_t now; > - double mounted_for, mounted_max = -1.0; > + time_t mounted_for, mounted_max = -1; > int error; > > now = time(NULL); > @@ -196,9 +196,9 @@ expire_automounted(double expiration_time) > > if (mounted_for < expiration_time) { > log_debugx("skipping %s (FSID:%d:%d), mounted " > - "for %.0f seconds", af->af_mountpoint, > + "for %ld seconds", af->af_mountpoint, You can't print a time_t with %ld, it'll fail on 32-bit arches with 64- bit time_t. The usual incantation is %j and cast to intmax_t. -- Ian From owner-svn-src-head@freebsd.org Thu Aug 8 14:34:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7C24A8405; Thu, 8 Aug 2019 14:34:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4649rG3xYbz4PYd; Thu, 8 Aug 2019 14:34:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 642622695F; Thu, 8 Aug 2019 14:34:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78EYsrk070794; Thu, 8 Aug 2019 14:34:54 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78EYsdF070793; Thu, 8 Aug 2019 14:34:54 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908081434.x78EYsdF070793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 8 Aug 2019 14:34:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350750 - head/sys/crypto/armv8 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/crypto/armv8 X-SVN-Commit-Revision: 350750 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 14:34:54 -0000 Author: emaste Date: Thu Aug 8 14:34:53 2019 New Revision: 350750 URL: https://svnweb.freebsd.org/changeset/base/350750 Log: armv8crypto: add missing unlock for session (after r336439) Attempts to use cryptodev (e.g. tests at /usr/src/tests/sys/opencrypto with armv8crypto added to the module lists) were causing a panic. Submitted by: Greg V Differential Revision: https://reviews.freebsd.org/D21012 Modified: head/sys/crypto/armv8/armv8_crypto.c Modified: head/sys/crypto/armv8/armv8_crypto.c ============================================================================== --- head/sys/crypto/armv8/armv8_crypto.c Thu Aug 8 11:43:09 2019 (r350749) +++ head/sys/crypto/armv8/armv8_crypto.c Thu Aug 8 14:34:53 2019 (r350750) @@ -274,9 +274,11 @@ armv8_crypto_newsession(device_t dev, crypto_session_t error = armv8_crypto_cipher_setup(ses, encini); if (error != 0) { CRYPTDEB("setup failed"); + rw_wunlock(&sc->lock); return (error); } + rw_wunlock(&sc->lock); return (0); } From owner-svn-src-head@freebsd.org Thu Aug 8 15:11:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D6859A912E; Thu, 8 Aug 2019 15:11:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464Bfd5143z4RM8; Thu, 8 Aug 2019 15:11:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D90926F68; Thu, 8 Aug 2019 15:11:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78FBbSi092154; Thu, 8 Aug 2019 15:11:37 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78FBb3u092153; Thu, 8 Aug 2019 15:11:37 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908081511.x78FBb3u092153@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 8 Aug 2019 15:11:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350751 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 350751 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 15:11:37 -0000 Author: imp Date: Thu Aug 8 15:11:37 2019 New Revision: 350751 URL: https://svnweb.freebsd.org/changeset/base/350751 Log: Add TCP_RFC7413 We should be linting this This isn't enabled on all platforms, but compiles on them all. Noticed by: jhb in another review Modified: head/sys/conf/NOTES Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Thu Aug 8 14:34:53 2019 (r350750) +++ head/sys/conf/NOTES Thu Aug 8 15:11:37 2019 (r350751) @@ -655,6 +655,7 @@ options ROUTETABLES=2 # allocated fibs up to 65536. # but that would be a bad idea as they are large. options TCP_OFFLOAD # TCP offload support. +options TCP_RFC7413 # TCP Fast Open options TCPHPTS From owner-svn-src-head@freebsd.org Thu Aug 8 15:46:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 487F6A9EA9; Thu, 8 Aug 2019 15:46:36 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464CR01B3bz4Th6; Thu, 8 Aug 2019 15:46:35 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-ot1-x344.google.com with SMTP id n5so120497015otk.1; Thu, 08 Aug 2019 08:46:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8OD/tFb2EeDF0jwqBWeX0y9j7ssUHU9/YhFfBWTeDNE=; b=iHbyFYAL5MuGoAhQHvId99a8SMOVhsFTpWfbgCZx34fkDzw9mg32FfRsOiIg5Q+wKF Eq/cUE6TBJV9j5mGA0d7h94SJBsuFtaf06rSJnBHaNb02amd8rXJAm/Vp9uKT5l47hdb wkWk6QvlfEZ9lXaxJu+7MKCaqrm1tiCIlOytZKPhT9TkinE9oMQwLUtUN9tS+iDirA8/ bCDHesm9e4GKVJ2EugtbI6SaeB7OwVwhXIPzq1IM69BoRmsKuwU4nH6rJ2j6tPuoi8Lq r2bXN0C6tLQdU4JuizQJYpihqDUSSTk6DUr9ZCEEP9x2iMDgO17LHDReylRHgfKiwLOv QqJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8OD/tFb2EeDF0jwqBWeX0y9j7ssUHU9/YhFfBWTeDNE=; b=ITylBAU12bKzSnoyq/O2UgpC3ZGOAwCCgS1dNIy84MwYjAlZn2z9YuT00mOtllMZTf TeJF09L+kGFkdZvZeo4Gmh4tpKMjAmYGDLUwqZAyIZkfQhBkZz9MBtIiomz77aEY41q9 lLKb8W9mYVwjrlwRx9X+0D3mQjrnlYBz6TnnsVrLjC0t+5Xe2xVfkBtcqHqmTgvZh60a T040rLhWSlsjXqo0tDKZXo4x1o66LsqfQ9yP785NaxHihqZBDn735yrI0CPiIti6rFjC z4hdnGrg3XLofPgieiIg+eOQLXJdn8fApFymmyzeyJTB6LXnotnZkkh2e3B1pCS/pVaw a6xg== X-Gm-Message-State: APjAAAWnG3WZ78sdCWg04xdDZD+EwQrMtgRdF8bQdWkGIcORpBE872qg TO9vnU5sV+LrW7DAWG0iwtBWNGbZprQ= X-Google-Smtp-Source: APXvYqxZf+vRWTYRIK46N3VGjytKl5fRL6ncawPFrUMRW1zVCfOOl5AzGCGmUYq83iJJLHBpfp8Cag== X-Received: by 2002:a6b:b804:: with SMTP id i4mr4243190iof.205.1565279194051; Thu, 08 Aug 2019 08:46:34 -0700 (PDT) Received: from ralga.knownspace (173-25-245-129.client.mchsi.com. [173.25.245.129]) by smtp.gmail.com with ESMTPSA id l6sm5376466ioc.15.2019.08.08.08.46.33 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 08 Aug 2019 08:46:33 -0700 (PDT) Sender: Justin Hibbits Date: Thu, 8 Aug 2019 10:46:29 -0500 From: Justin Hibbits To: Ian Lepore Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r350737 - head/usr.sbin/autofs Message-ID: <20190808104629.405a5c0b@ralga.knownspace> In-Reply-To: <53d227e7f8535424c3abff229a41e9375b077dcc.camel@freebsd.org> References: <201908080316.x783GW3r070041@repo.freebsd.org> <53d227e7f8535424c3abff229a41e9375b077dcc.camel@freebsd.org> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; powerpc64-portbld-freebsd13.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 464CR01B3bz4Th6 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.96)[-0.962,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 15:46:36 -0000 On Thu, 08 Aug 2019 08:00:16 -0600 Ian Lepore wrote: > On Thu, 2019-08-08 at 03:16 +0000, Justin Hibbits wrote: > > Author: jhibbits > > Date: Thu Aug 8 03:16:32 2019 > > New Revision: 350737 > > URL: https://svnweb.freebsd.org/changeset/base/350737 > > > > Log: > > Change autounmountd(8) to use time_t for duration instead of > > double > > Summary: > > autounmountd(8) uses doubles to handle mount time durations. > > However, it must convert to integer types, time_t in particular, to > > do anything meaningful. Additionally, even though it's a > > floating-point value in seconds, the sub-seconds component is never > > used, so it's unnecessary. > > Switching type to time_t fixes an assertion on powerpc64, which > > checks that a sleep value that's not -1.0 is greater than 0. On > > powerpc64, it happens that the value of -1.0 gets loaded as a float > > (perhaps a bug in gcc), but gets compared to a double. This > > compares as false, so follows through the 'sleep != -1.0' path, and > > fails the assert. Since the sub-second component isn't used in the > > double, just drop it and deal with whole-integer seconds. > > > > Reviewed by: trasz > > Differential Revision: https://reviews.freebsd.org/D21109 > > > > Modified: > > head/usr.sbin/autofs/autounmountd.c > > > > Modified: head/usr.sbin/autofs/autounmountd.c > > ============================================================================== > > --- head/usr.sbin/autofs/autounmountd.c Thu Aug 8 03:01:35 > > 2019 (r350736) +++ > > head/usr.sbin/autofs/autounmountd.c Thu Aug 8 03:16:32 > > 2019 (r350737) @@ -179,12 +179,12 @@ unmount_by_fsid(const > > fsid_t fsid, const char *mountpo return (error); } > > > > -static double > > -expire_automounted(double expiration_time) > > +static time_t > > +expire_automounted(time_t expiration_time) > > { > > struct automounted_fs *af, *tmpaf; > > time_t now; > > - double mounted_for, mounted_max = -1.0; > > + time_t mounted_for, mounted_max = -1; > > int error; > > > > now = time(NULL); > > @@ -196,9 +196,9 @@ expire_automounted(double expiration_time) > > > > if (mounted_for < expiration_time) { > > log_debugx("skipping %s (FSID:%d:%d), > > mounted " > > - "for %.0f seconds", af->af_mountpoint, > > + "for %ld seconds", af->af_mountpoint, > > > > You can't print a time_t with %ld, it'll fail on 32-bit arches with > 64- bit time_t. The usual incantation is %j and cast to intmax_t. > > -- Ian > > I cast it to a long already, so it prints as a long for all archs. I guess intmax_t might be better, but I figured nobody would hold a mount for more than 2**31 seconds (the argument is for duration, not absolute time). - Justin From owner-svn-src-head@freebsd.org Thu Aug 8 16:37:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 17B2BAB054; Thu, 8 Aug 2019 16:37:33 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464DYm6t5tz4X38; Thu, 8 Aug 2019 16:37:32 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD19F27F51; Thu, 8 Aug 2019 16:37:32 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78GbWjc043956; Thu, 8 Aug 2019 16:37:32 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78GbW4s043955; Thu, 8 Aug 2019 16:37:32 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908081637.x78GbW4s043955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 8 Aug 2019 16:37:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350756 - head/lib/libproc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/lib/libproc X-SVN-Commit-Revision: 350756 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 16:37:33 -0000 Author: jhibbits Date: Thu Aug 8 16:37:32 2019 New Revision: 350756 URL: https://svnweb.freebsd.org/changeset/base/350756 Log: mips: Fix register target for SP setting in libproc Copy-paste-o from r233042 Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D21188 Modified: head/lib/libproc/proc_regs.c Modified: head/lib/libproc/proc_regs.c ============================================================================== --- head/lib/libproc/proc_regs.c Thu Aug 8 15:38:57 2019 (r350755) +++ head/lib/libproc/proc_regs.c Thu Aug 8 16:37:32 2019 (r350756) @@ -138,7 +138,7 @@ proc_regset(struct proc_handle *phdl, proc_reg_t reg, #elif defined(__i386__) regs.r_esp = regvalue; #elif defined(__mips__) - regs.r_regs[PC] = regvalue; + regs.r_regs[SP] = regvalue; #elif defined(__powerpc__) regs.fixreg[1] = regvalue; #elif defined(__riscv) From owner-svn-src-head@freebsd.org Thu Aug 8 16:39:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56976AB12C; Thu, 8 Aug 2019 16:39:22 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464Dbs0BTWz4XHJ; Thu, 8 Aug 2019 16:39:20 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-ot1-x330.google.com with SMTP id r21so115140968otq.6; Thu, 08 Aug 2019 09:39:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=glQceNDgE9VyxJ3acnVwXSBPTemKzFXytiVxd/yuVBQ=; b=tgj7ENte499C0umB1PuixHWfFeWCztex/0XADthuSHjVakvmGggFmPVzF1BzqqsB1r nrVSnZuYJUqhqt+7gz7CtgIfXkJNAiP219WJy09v6Z5kcFXHR7mVHYoZz+aOki5gGBIS KZvQHaV2dvZIEtQjyLxdwVPsb2lQB826VfF02et9TK41Q9Buboz7rqVw362GSAbdyNFK YhlwlUJq5Il4UQTlJCDZLi7ywWsrxaf4KAMS8SxieN9CBw7rRIGJAw5E6pb8pxPEqrax E/39ny7RePXK1t4AGModvr0o+zi9YXq71VXPx74nYXXSAW3Rml23CfBzUKJU39nJut0L yPog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=glQceNDgE9VyxJ3acnVwXSBPTemKzFXytiVxd/yuVBQ=; b=Jd8hvo8Wq5drO+YtlaQCwPHT3Br0c+UpBmOIVByZmbgZhHRwxdylx6oeWfyMFBfVaF 8FENlXTXn+mZfZWf89LqgZ2J6Hzcg9e5vcxMMX7PFDF++V47Drg9HUA1PHgsSIQKP4Lq oRqaU1ovrMfvsr8gFEKfv1ZhOmEeg1edyWhu8Q/fBxJy70449EFJoj/Dn7EzH24V1MYj A6Sayxt9Fu6cUEJBP3PxsfIbSLzocHyxo4ZnIybgQZA0UWlrWeqAyfA/dR3fD1VD74TV ZP9NcuBzm3qvufQAuh4x6f+0KEa4vgEYsOdUwsuU0SSM7K6MvgTktAt90gqIIFw80XTO p/pg== X-Gm-Message-State: APjAAAXitBrb7nDSIGurcC967EJ/+5Vbi48OXjcsmHFMXJwEvouPcI+u DkOadNZ0qgPH84pYAC6dLRcWyCAdCpM= X-Google-Smtp-Source: APXvYqxNX7apKUZ0BbGnhcRxYKMUFxYZ/rs9TsP8YYOMGYNR9BVyTl/XPbrINXyRSLekawVvBTNj4w== X-Received: by 2002:a6b:917:: with SMTP id t23mr1871096ioi.174.1565282359058; Thu, 08 Aug 2019 09:39:19 -0700 (PDT) Received: from ralga.knownspace (173-25-245-129.client.mchsi.com. [173.25.245.129]) by smtp.gmail.com with ESMTPSA id j25sm127892854ioj.67.2019.08.08.09.39.18 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 08 Aug 2019 09:39:18 -0700 (PDT) Date: Thu, 8 Aug 2019 11:39:03 -0500 From: Justin Hibbits To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r350756 - head/lib/libproc Message-ID: <20190808113903.364451d7@ralga.knownspace> In-Reply-To: <201908081637.x78GbW4s043955@repo.freebsd.org> References: <201908081637.x78GbW4s043955@repo.freebsd.org> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; powerpc64-portbld-freebsd13.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 464Dbs0BTWz4XHJ X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=tgj7ENte; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of chmeeedalf@gmail.com designates 2607:f8b0:4864:20::330 as permitted sender) smtp.mailfrom=chmeeedalf@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_NONE(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-0.999,0]; RECEIVED_SPAMHAUS_PBL(0.00)[129.245.25.173.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; IP_SCORE(0.00)[ip: (-9.05), ipnet: 2607:f8b0::/32(-3.03), asn: 15169(-2.43), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE_FREEMAIL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[0.3.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 16:39:22 -0000 On Thu, 8 Aug 2019 16:37:32 +0000 (UTC) Justin Hibbits wrote: > Author: jhibbits > Date: Thu Aug 8 16:37:32 2019 > New Revision: 350756 > URL: https://svnweb.freebsd.org/changeset/base/350756 > > Log: > mips: Fix register target for SP setting in libproc > > Copy-paste-o from r233042 > Reviewed by: imp Sponsored by: Juniper Networks > Differential Revision: https://reviews.freebsd.org/D21188 > > Modified: > head/lib/libproc/proc_regs.c > > Modified: head/lib/libproc/proc_regs.c > ============================================================================== > --- head/lib/libproc/proc_regs.c Thu Aug 8 15:38:57 > 2019 (r350755) +++ head/lib/libproc/proc_regs.c Thu Aug > 8 16:37:32 2019 (r350756) @@ -138,7 +138,7 @@ > proc_regset(struct proc_handle *phdl, proc_reg_t reg, #elif > defined(__i386__) regs.r_esp = regvalue; > #elif defined(__mips__) > - regs.r_regs[PC] = regvalue; > + regs.r_regs[SP] = regvalue; > #elif defined(__powerpc__) > regs.fixreg[1] = regvalue; > #elif defined(__riscv) > From owner-svn-src-head@freebsd.org Thu Aug 8 16:42:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7BFB7AB3F3; Thu, 8 Aug 2019 16:42:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464Dgy2g5Vz4Xh8; Thu, 8 Aug 2019 16:42:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3CC2D156; Thu, 8 Aug 2019 16:42:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78Ggsto049505; Thu, 8 Aug 2019 16:42:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78Ggsmu049504; Thu, 8 Aug 2019 16:42:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908081642.x78Ggsmu049504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 8 Aug 2019 16:42:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350757 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 350757 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 16:42:54 -0000 Author: kib Date: Thu Aug 8 16:42:53 2019 New Revision: 350757 URL: https://svnweb.freebsd.org/changeset/base/350757 Log: Update comment explaining create_init(). Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/kern/init_main.c Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Thu Aug 8 16:37:32 2019 (r350756) +++ head/sys/kern/init_main.c Thu Aug 8 16:42:53 2019 (r350757) @@ -797,11 +797,9 @@ start_init(void *dummy) } /* - * Like kproc_create(), but runs in its own address space. - * We do this early to reserve pid 1. - * - * Note special case - do not make it runnable yet. Other work - * in progress will change this more. + * Like kproc_create(), but runs in its own address space. We do this + * early to reserve pid 1. Note special case - do not make it + * runnable yet, init execution is started when userspace can be served. */ static void create_init(const void *udata __unused) From owner-svn-src-head@freebsd.org Thu Aug 8 16:48:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 845E4AB50A; Thu, 8 Aug 2019 16:48:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464DpD2w9Lz4Xtn; Thu, 8 Aug 2019 16:48:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45CA7175; Thu, 8 Aug 2019 16:48:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78GmKkQ049810; Thu, 8 Aug 2019 16:48:20 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78GmKe7049809; Thu, 8 Aug 2019 16:48:20 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908081648.x78GmKe7049809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 8 Aug 2019 16:48:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350758 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 350758 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 16:48:20 -0000 Author: kib Date: Thu Aug 8 16:48:19 2019 New Revision: 350758 URL: https://svnweb.freebsd.org/changeset/base/350758 Log: Fix stack grow for init. During early stages of kern_exec(), including strings copyout, p_textvp for init is NULL. This prevented stack grow from working for init execution. Without stack gap enabled, initial stack segment size is enough for strings passed by kernel to init. With the gap enabled, the used address might fall out of the initial segment, which kills init. Exclude initproc from the check for contexts which should not cause stack grow in the target map. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Thu Aug 8 16:42:53 2019 (r350757) +++ head/sys/vm/vm_map.c Thu Aug 8 16:48:19 2019 (r350758) @@ -4217,7 +4217,8 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_ma * debugger or AIO daemon. The reason is that the wrong * resource limits are applied. */ - if (map != &p->p_vmspace->vm_map || p->p_textvp == NULL) + if (p != initproc && (map != &p->p_vmspace->vm_map || + p->p_textvp == NULL)) return (KERN_FAILURE); MPASS(!map->system_map); From owner-svn-src-head@freebsd.org Thu Aug 8 16:51:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0FA4AB735; Thu, 8 Aug 2019 16:51:49 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464DtF5Czwz4YLl; Thu, 8 Aug 2019 16:51:49 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94C0C203; Thu, 8 Aug 2019 16:51:49 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78GpnLh054915; Thu, 8 Aug 2019 16:51:49 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78GpnaY054914; Thu, 8 Aug 2019 16:51:49 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201908081651.x78GpnaY054914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Thu, 8 Aug 2019 16:51:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350759 - head/sys/security/mac_veriexec_parser X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/security/mac_veriexec_parser X-SVN-Commit-Revision: 350759 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 16:51:49 -0000 Author: mw Date: Thu Aug 8 16:51:49 2019 New Revision: 350759 URL: https://svnweb.freebsd.org/changeset/base/350759 Log: Fix mac_veriexec_parser build after r347938 In r347938 the definition of mac_veriexec_metadata_add_file so adjust the argument list accordingly. Submitted by: Kornel Duleba Modified: head/sys/security/mac_veriexec_parser/mac_veriexec_parser.c Modified: head/sys/security/mac_veriexec_parser/mac_veriexec_parser.c ============================================================================== --- head/sys/security/mac_veriexec_parser/mac_veriexec_parser.c Thu Aug 8 16:48:19 2019 (r350758) +++ head/sys/security/mac_veriexec_parser/mac_veriexec_parser.c Thu Aug 8 16:51:49 2019 (r350759) @@ -364,7 +364,9 @@ parse_entry(char *entry, char *prefix) rc = mac_veriexec_metadata_add_file( is_exec == 0, va.va_fsid, va.va_fileid, va.va_gen, - digest, flags, fp_type, 1); + digest, + NULL, 0, + flags, fp_type, 1); mtx_unlock(&ve_mutex); out: From owner-svn-src-head@freebsd.org Thu Aug 8 16:54:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C0BDAB94A; Thu, 8 Aug 2019 16:54:26 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464DxG0pHhz4Yf0; Thu, 8 Aug 2019 16:54:26 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0A35370; Thu, 8 Aug 2019 16:54:25 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78GsPFX056013; Thu, 8 Aug 2019 16:54:25 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78GsMU6055994; Thu, 8 Aug 2019 16:54:22 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908081654.x78GsMU6055994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 8 Aug 2019 16:54:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350760 - in head: lib/libzstd sys/conf sys/contrib/zstd sys/contrib/zstd/contrib/largeNbDicts sys/contrib/zstd/contrib/seekable_format sys/contrib/zstd/contrib/seekable_format/examples... X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: lib/libzstd sys/conf sys/contrib/zstd sys/contrib/zstd/contrib/largeNbDicts sys/contrib/zstd/contrib/seekable_format sys/contrib/zstd/contrib/seekable_format/examples sys/contrib/zstd/doc sys... X-SVN-Commit-Revision: 350760 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 16:54:26 -0000 Author: cem Date: Thu Aug 8 16:54:22 2019 New Revision: 350760 URL: https://svnweb.freebsd.org/changeset/base/350760 Log: Update to Zstandard 1.4.2 The full release notes for 1.4.1 (skipped) and 1.4.2 can be found on Github: https://github.com/facebook/zstd/releases/tag/v1.4.1 https://github.com/facebook/zstd/releases/tag/v1.4.2 These are mostly minor updates; 1.4.1 purportedly brings something like 7% faster decompression speed. Relnotes: yes Added: head/sys/contrib/zstd/contrib/seekable_format/examples/seekable_decompression_mem.c - copied unchanged from r350755, vendor/zstd/dist/contrib/seekable_format/examples/seekable_decompression_mem.c head/sys/contrib/zstd/lib/compress/zstd_compress_literals.c - copied unchanged from r350755, vendor/zstd/dist/lib/compress/zstd_compress_literals.c head/sys/contrib/zstd/lib/compress/zstd_compress_literals.h - copied unchanged from r350755, vendor/zstd/dist/lib/compress/zstd_compress_literals.h head/sys/contrib/zstd/lib/compress/zstd_compress_sequences.c - copied unchanged from r350755, vendor/zstd/dist/lib/compress/zstd_compress_sequences.c head/sys/contrib/zstd/lib/compress/zstd_compress_sequences.h - copied unchanged from r350755, vendor/zstd/dist/lib/compress/zstd_compress_sequences.h head/sys/contrib/zstd/tests/bigdict.c - copied unchanged from r350755, vendor/zstd/dist/tests/bigdict.c head/sys/contrib/zstd/tests/fuzz/simple_compress.c - copied unchanged from r350755, vendor/zstd/dist/tests/fuzz/simple_compress.c head/sys/contrib/zstd/tests/fuzz/zstd_frame_info.c - copied unchanged from r350755, vendor/zstd/dist/tests/fuzz/zstd_frame_info.c Deleted: head/sys/contrib/zstd/tests/fuzz/default.options Modified: head/lib/libzstd/Makefile head/sys/conf/files head/sys/conf/kern.pre.mk head/sys/contrib/zstd/CHANGELOG head/sys/contrib/zstd/contrib/largeNbDicts/largeNbDicts.c head/sys/contrib/zstd/contrib/seekable_format/examples/.gitignore head/sys/contrib/zstd/contrib/seekable_format/examples/Makefile head/sys/contrib/zstd/contrib/seekable_format/zstdseek_decompress.c head/sys/contrib/zstd/doc/zstd_compression_format.md head/sys/contrib/zstd/doc/zstd_manual.html head/sys/contrib/zstd/examples/Makefile head/sys/contrib/zstd/lib/Makefile head/sys/contrib/zstd/lib/common/compiler.h head/sys/contrib/zstd/lib/common/zstd_internal.h head/sys/contrib/zstd/lib/compress/zstd_compress.c head/sys/contrib/zstd/lib/compress/zstd_compress_internal.h head/sys/contrib/zstd/lib/compress/zstd_double_fast.c head/sys/contrib/zstd/lib/compress/zstd_fast.c head/sys/contrib/zstd/lib/compress/zstd_lazy.c head/sys/contrib/zstd/lib/compress/zstd_ldm.c head/sys/contrib/zstd/lib/compress/zstd_opt.c head/sys/contrib/zstd/lib/compress/zstdmt_compress.c head/sys/contrib/zstd/lib/compress/zstdmt_compress.h head/sys/contrib/zstd/lib/decompress/zstd_decompress.c head/sys/contrib/zstd/lib/decompress/zstd_decompress_block.c head/sys/contrib/zstd/lib/dictBuilder/cover.c head/sys/contrib/zstd/lib/dictBuilder/cover.h head/sys/contrib/zstd/lib/dictBuilder/fastcover.c head/sys/contrib/zstd/lib/dictBuilder/zdict.c head/sys/contrib/zstd/lib/dictBuilder/zdict.h head/sys/contrib/zstd/lib/legacy/zstd_legacy.h head/sys/contrib/zstd/lib/legacy/zstd_v01.c head/sys/contrib/zstd/lib/legacy/zstd_v02.c head/sys/contrib/zstd/lib/legacy/zstd_v03.c head/sys/contrib/zstd/lib/legacy/zstd_v04.c head/sys/contrib/zstd/lib/legacy/zstd_v05.c head/sys/contrib/zstd/lib/legacy/zstd_v06.c head/sys/contrib/zstd/lib/legacy/zstd_v07.c head/sys/contrib/zstd/lib/zstd.h head/sys/contrib/zstd/programs/.gitignore head/sys/contrib/zstd/programs/README.md head/sys/contrib/zstd/programs/benchfn.c head/sys/contrib/zstd/programs/fileio.c head/sys/contrib/zstd/programs/fileio.h head/sys/contrib/zstd/programs/util.c head/sys/contrib/zstd/programs/zstd.1 head/sys/contrib/zstd/programs/zstd.1.md head/sys/contrib/zstd/programs/zstdcli.c head/sys/contrib/zstd/programs/zstdgrep head/sys/contrib/zstd/programs/zstdgrep.1 head/sys/contrib/zstd/programs/zstdless.1 head/sys/contrib/zstd/tests/.gitignore head/sys/contrib/zstd/tests/Makefile head/sys/contrib/zstd/tests/decodecorpus.c head/sys/contrib/zstd/tests/fullbench.c head/sys/contrib/zstd/tests/fuzz/Makefile head/sys/contrib/zstd/tests/fuzz/dictionary_decompress.c head/sys/contrib/zstd/tests/fuzz/fuzz.py head/sys/contrib/zstd/tests/fuzz/simple_decompress.c head/sys/contrib/zstd/tests/fuzzer.c head/sys/contrib/zstd/tests/paramgrill.c head/sys/contrib/zstd/tests/playTests.sh head/sys/contrib/zstd/tests/poolTests.c head/sys/contrib/zstd/tests/regression/results.csv head/sys/contrib/zstd/tests/zstreamtest.c head/sys/contrib/zstd/zlibWrapper/.gitignore Directory Properties: head/sys/contrib/zstd/ (props changed) Modified: head/lib/libzstd/Makefile ============================================================================== --- head/lib/libzstd/Makefile Thu Aug 8 16:51:49 2019 (r350759) +++ head/lib/libzstd/Makefile Thu Aug 8 16:54:22 2019 (r350760) @@ -11,6 +11,8 @@ SRCS= entropy_common.c \ fse_compress.c \ huf_compress.c \ zstd_compress.c \ + zstd_compress_literals.c \ + zstd_compress_sequences.c \ zstdmt_compress.c \ huf_decompress.c \ zstd_ddict.c \ @@ -43,7 +45,20 @@ ZSTDDIR= ${SRCTOP}/sys/contrib/zstd ${ZSTDDIR}/lib/decompress ${ZSTDDIR}/lib/deprecated \ ${ZSTDDIR}/lib/dictBuilder ${ZSTDDIR}/lib +.include + +# https://github.com/facebook/zstd/commit/812e8f2a [zstd 1.4.1] +# "Note that [GCC] autovectorization still does not do a good job on the +# optimized version, so it's turned off via attribute and flag. I found +# that neither attribute nor command-line flag were entirely successful in +# turning off vectorization, which is why there were both." +.if ${COMPILER_TYPE} == "gcc" +CFLAGS.zstd_decompress_block.c+= -fno-tree-vectorize +.endif + # Work around for LLVM bug 35023, https://bugs.llvm.org/show_bug.cgi?id=35023 +# Fixed in https://reviews.llvm.org/rL349935 ; not sure if we have that version +# in our LLVM or not yet. .if ${MACHINE_ARCH:Marm*} != "" CFLAGS.zstd_compress.c+= -O0 .endif Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Aug 8 16:51:49 2019 (r350759) +++ head/sys/conf/files Thu Aug 8 16:54:22 2019 (r350760) @@ -648,6 +648,8 @@ contrib/zstd/lib/common/entropy_common.c optional zstd contrib/zstd/lib/common/error_private.c optional zstdio compile-with ${ZSTD_C} contrib/zstd/lib/common/xxhash.c optional zstdio compile-with ${ZSTD_C} contrib/zstd/lib/compress/zstd_compress.c optional zstdio compile-with ${ZSTD_C} +contrib/zstd/lib/compress/zstd_compress_literals.c optional zstdio compile-with ${ZSTD_C} +contrib/zstd/lib/compress/zstd_compress_sequences.c optional zstdio compile-with ${ZSTD_C} contrib/zstd/lib/compress/fse_compress.c optional zstdio compile-with ${ZSTD_C} contrib/zstd/lib/compress/hist.c optional zstdio compile-with ${ZSTD_C} contrib/zstd/lib/compress/huf_compress.c optional zstdio compile-with ${ZSTD_C} @@ -658,7 +660,9 @@ contrib/zstd/lib/compress/zstd_ldm.c optional zstdio contrib/zstd/lib/compress/zstd_opt.c optional zstdio compile-with ${ZSTD_C} contrib/zstd/lib/decompress/zstd_ddict.c optional zstdio compile-with ${ZSTD_C} contrib/zstd/lib/decompress/zstd_decompress.c optional zstdio compile-with ${ZSTD_C} -contrib/zstd/lib/decompress/zstd_decompress_block.c optional zstdio compile-with ${ZSTD_C} +# See comment in sys/conf/kern.pre.mk +contrib/zstd/lib/decompress/zstd_decompress_block.c optional zstdio \ + compile-with "${ZSTD_C} ${ZSTD_DECOMPRESS_BLOCK_FLAGS}" contrib/zstd/lib/decompress/huf_decompress.c optional zstdio compile-with ${ZSTD_C} # Blake 2 contrib/libb2/blake2b-ref.c optional crypto | ipsec | ipsec_support \ Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Thu Aug 8 16:51:49 2019 (r350759) +++ head/sys/conf/kern.pre.mk Thu Aug 8 16:54:22 2019 (r350760) @@ -175,6 +175,14 @@ NORMAL_FWO= ${LD} -b binary --no-warn-mismatch -d -war # for ZSTD in the kernel (include zstd/lib/freebsd before other CFLAGS) ZSTD_C= ${CC} -c -DZSTD_HEAPMODE=1 -I$S/contrib/zstd/lib/freebsd ${CFLAGS} -I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WERROR} -Wno-inline -Wno-missing-prototypes ${PROF} -U__BMI__ ${.IMPSRC} +# https://github.com/facebook/zstd/commit/812e8f2a [zstd 1.4.1] +# "Note that [GCC] autovectorization still does not do a good job on the +# optimized version, so it's turned off via attribute and flag. I found +# that neither attribute nor command-line flag were entirely successful in +# turning off vectorization, which is why there were both." +.if ${COMPILER_TYPE} == "gcc" +ZSTD_DECOMPRESS_BLOCK_FLAGS= -fno-tree-vectorize +.endif # Common for dtrace / zfs CDDL_CFLAGS= -DFREEBSD_NAMECACHE -nostdinc -I$S/cddl/compat/opensolaris -I$S/cddl/contrib/opensolaris/uts/common -I$S -I$S/cddl/contrib/opensolaris/common ${CFLAGS} -Wno-unknown-pragmas -Wno-missing-prototypes -Wno-undef -Wno-strict-prototypes -Wno-cast-qual -Wno-parentheses -Wno-redundant-decls -Wno-missing-braces -Wno-uninitialized -Wno-unused -Wno-inline -Wno-switch -Wno-pointer-arith -Wno-unknown-pragmas Modified: head/sys/contrib/zstd/CHANGELOG ============================================================================== --- head/sys/contrib/zstd/CHANGELOG Thu Aug 8 16:51:49 2019 (r350759) +++ head/sys/contrib/zstd/CHANGELOG Thu Aug 8 16:54:22 2019 (r350760) @@ -1,3 +1,39 @@ +v1.4.2 +bug: Fix bug in zstd-0.5 decoder by @terrelln (#1696) +bug: Fix seekable decompression in-memory API by @iburinoc (#1695) +misc: Validate blocks are smaller than size limit by @vivekmg (#1685) +misc: Restructure source files by @ephiepark (#1679) + +v1.4.1 +bug: Fix data corruption in niche use cases by @terrelln (#1659) +bug: Fuzz legacy modes, fix uncovered bugs by @terrelln (#1593, #1594, #1595) +bug: Fix out of bounds read by @terrelln (#1590) +perf: Improve decode speed by ~7% @mgrice (#1668) +perf: Slightly improved compression ratio of level 3 and 4 (ZSTD_dfast) by @cyan4973 (#1681) +perf: Slightly faster compression speed when re-using a context by @cyan4973 (#1658) +perf: Improve compression ratio for small windowLog by @cyan4973 (#1624) +perf: Faster compression speed in high compression mode for repetitive data by @terrelln (#1635) +api: Add parameter to generate smaller dictionaries by @tyler-tran (#1656) +cli: Recognize symlinks when built in C99 mode by @felixhandte (#1640) +cli: Expose cpu load indicator for each file on -vv mode by @ephiepark (#1631) +cli: Restrict read permissions on destination files by @chungy (#1644) +cli: zstdgrep: handle -f flag by @felixhandte (#1618) +cli: zstdcat: follow symlinks by @vejnar (#1604) +doc: Remove extra size limit on compressed blocks by @felixhandte (#1689) +doc: Fix typo by @yk-tanigawa (#1633) +doc: Improve documentation on streaming buffer sizes by @cyan4973 (#1629) +build: CMake: support building with LZ4 @leeyoung624 (#1626) +build: CMake: install zstdless and zstdgrep by @leeyoung624 (#1647) +build: CMake: respect existing uninstall target by @j301scott (#1619) +build: Make: skip multithread tests when built without support by @michaelforney (#1620) +build: Make: Fix examples/ test target by @sjnam (#1603) +build: Meson: rename options out of deprecated namespace by @lzutao (#1665) +build: Meson: fix build by @lzutao (#1602) +build: Visual Studio: don't export symbols in static lib by @scharan (#1650) +build: Visual Studio: fix linking by @absotively (#1639) +build: Fix MinGW-W64 build by @myzhang1029 (#1600) +misc: Expand decodecorpus coverage by @ephiepark (#1664) + v1.4.0 perf: Improve level 1 compression speed in most scenarios by 6% by @gbtucker and @terrelln api: Move the advanced API, including all functions in the staging section, to the stable section Modified: head/sys/contrib/zstd/contrib/largeNbDicts/largeNbDicts.c ============================================================================== --- head/sys/contrib/zstd/contrib/largeNbDicts/largeNbDicts.c Thu Aug 8 16:51:49 2019 (r350759) +++ head/sys/contrib/zstd/contrib/largeNbDicts/largeNbDicts.c Thu Aug 8 16:54:22 2019 (r350760) @@ -559,7 +559,7 @@ static int benchMem(slice_collection_t dstBlocks, CONTROL(BMK_isSuccessful_runOutcome(outcome)); BMK_runTime_t const result = BMK_extract_runTime(outcome); - U64 const dTime_ns = result.nanoSecPerRun; + double const dTime_ns = result.nanoSecPerRun; double const dTime_sec = (double)dTime_ns / 1000000000; size_t const srcSize = result.sumOfReturn; double const dSpeed_MBps = (double)srcSize / dTime_sec / (1 MB); Modified: head/sys/contrib/zstd/contrib/seekable_format/examples/.gitignore ============================================================================== --- head/sys/contrib/zstd/contrib/seekable_format/examples/.gitignore Thu Aug 8 16:51:49 2019 (r350759) +++ head/sys/contrib/zstd/contrib/seekable_format/examples/.gitignore Thu Aug 8 16:54:22 2019 (r350760) @@ -1,4 +1,5 @@ seekable_compression seekable_decompression +seekable_decompression_mem parallel_processing parallel_compression Modified: head/sys/contrib/zstd/contrib/seekable_format/examples/Makefile ============================================================================== --- head/sys/contrib/zstd/contrib/seekable_format/examples/Makefile Thu Aug 8 16:51:49 2019 (r350759) +++ head/sys/contrib/zstd/contrib/seekable_format/examples/Makefile Thu Aug 8 16:54:22 2019 (r350760) @@ -24,7 +24,8 @@ SEEKABLE_OBJS = ../zstdseek_compress.c ../zstdseek_dec default: all -all: seekable_compression seekable_decompression parallel_processing +all: seekable_compression seekable_decompression seekable_decompression_mem \ + parallel_processing $(ZSTDLIB): make -C $(ZSTDLIB_PATH) $(ZSTDLIB_NAME) @@ -35,6 +36,9 @@ seekable_compression : seekable_compression.c $(SEEKAB seekable_decompression : seekable_decompression.c $(SEEKABLE_OBJS) $(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@ +seekable_decompression_mem : seekable_decompression_mem.c $(SEEKABLE_OBJS) + $(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@ + parallel_processing : parallel_processing.c $(SEEKABLE_OBJS) $(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@ -pthread @@ -44,5 +48,6 @@ parallel_compression : parallel_compression.c $(SEEKAB clean: @rm -f core *.o tmp* result* *.zst \ seekable_compression seekable_decompression \ + seekable_decompression_mem \ parallel_processing parallel_compression @echo Cleaning completed Copied: head/sys/contrib/zstd/contrib/seekable_format/examples/seekable_decompression_mem.c (from r350755, vendor/zstd/dist/contrib/seekable_format/examples/seekable_decompression_mem.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/zstd/contrib/seekable_format/examples/seekable_decompression_mem.c Thu Aug 8 16:54:22 2019 (r350760, copy of r350755, vendor/zstd/dist/contrib/seekable_format/examples/seekable_decompression_mem.c) @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2017-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + */ + + +#include // malloc, exit +#include // fprintf, perror, feof +#include // strerror +#include // errno +#define ZSTD_STATIC_LINKING_ONLY +#include // presumes zstd library is installed +#include + +#include "zstd_seekable.h" + +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + +#define MAX_FILE_SIZE (8 * 1024 * 1024) + +static void* malloc_orDie(size_t size) +{ + void* const buff = malloc(size); + if (buff) return buff; + /* error */ + perror("malloc"); + exit(1); +} + +static void* realloc_orDie(void* ptr, size_t size) +{ + ptr = realloc(ptr, size); + if (ptr) return ptr; + /* error */ + perror("realloc"); + exit(1); +} + +static FILE* fopen_orDie(const char *filename, const char *instruction) +{ + FILE* const inFile = fopen(filename, instruction); + if (inFile) return inFile; + /* error */ + perror(filename); + exit(3); +} + +static size_t fread_orDie(void* buffer, size_t sizeToRead, FILE* file) +{ + size_t const readSize = fread(buffer, 1, sizeToRead, file); + if (readSize == sizeToRead) return readSize; /* good */ + if (feof(file)) return readSize; /* good, reached end of file */ + /* error */ + perror("fread"); + exit(4); +} + +static size_t fwrite_orDie(const void* buffer, size_t sizeToWrite, FILE* file) +{ + size_t const writtenSize = fwrite(buffer, 1, sizeToWrite, file); + if (writtenSize == sizeToWrite) return sizeToWrite; /* good */ + /* error */ + perror("fwrite"); + exit(5); +} + +static size_t fclose_orDie(FILE* file) +{ + if (!fclose(file)) return 0; + /* error */ + perror("fclose"); + exit(6); +} + +static void fseek_orDie(FILE* file, long int offset, int origin) { + if (!fseek(file, offset, origin)) { + if (!fflush(file)) return; + } + /* error */ + perror("fseek"); + exit(7); +} + + +static void decompressFile_orDie(const char* fname, off_t startOffset, off_t endOffset) +{ + FILE* const fin = fopen_orDie(fname, "rb"); + FILE* const fout = stdout; + // Just for demo purposes, assume file is <= MAX_FILE_SIZE + void* const buffIn = malloc_orDie(MAX_FILE_SIZE); + size_t const inSize = fread_orDie(buffIn, MAX_FILE_SIZE, fin); + size_t const buffOutSize = ZSTD_DStreamOutSize(); /* Guarantee to successfully flush at least one complete compressed block in all circumstances. */ + void* const buffOut = malloc_orDie(buffOutSize); + + ZSTD_seekable* const seekable = ZSTD_seekable_create(); + if (seekable==NULL) { fprintf(stderr, "ZSTD_seekable_create() error \n"); exit(10); } + + size_t const initResult = ZSTD_seekable_initBuff(seekable, buffIn, inSize); + if (ZSTD_isError(initResult)) { fprintf(stderr, "ZSTD_seekable_init() error : %s \n", ZSTD_getErrorName(initResult)); exit(11); } + + while (startOffset < endOffset) { + size_t const result = ZSTD_seekable_decompress(seekable, buffOut, MIN(endOffset - startOffset, buffOutSize), startOffset); + + if (ZSTD_isError(result)) { + fprintf(stderr, "ZSTD_seekable_decompress() error : %s \n", + ZSTD_getErrorName(result)); + exit(12); + } + fwrite_orDie(buffOut, result, fout); + startOffset += result; + } + + ZSTD_seekable_free(seekable); + fclose_orDie(fin); + fclose_orDie(fout); + free(buffIn); + free(buffOut); +} + + +int main(int argc, const char** argv) +{ + const char* const exeName = argv[0]; + + if (argc!=4) { + fprintf(stderr, "wrong arguments\n"); + fprintf(stderr, "usage:\n"); + fprintf(stderr, "%s FILE START END\n", exeName); + return 1; + } + + { + const char* const inFilename = argv[1]; + off_t const startOffset = atoll(argv[2]); + off_t const endOffset = atoll(argv[3]); + decompressFile_orDie(inFilename, startOffset, endOffset); + } + + return 0; +} Modified: head/sys/contrib/zstd/contrib/seekable_format/zstdseek_decompress.c ============================================================================== --- head/sys/contrib/zstd/contrib/seekable_format/zstdseek_decompress.c Thu Aug 8 16:51:49 2019 (r350759) +++ head/sys/contrib/zstd/contrib/seekable_format/zstdseek_decompress.c Thu Aug 8 16:54:22 2019 (r350760) @@ -106,7 +106,7 @@ typedef struct { static int ZSTD_seekable_read_buff(void* opaque, void* buffer, size_t n) { buffWrapper_t* buff = (buffWrapper_t*) opaque; - if (buff->size + n > buff->pos) return -1; + if (buff->pos + n > buff->size) return -1; memcpy(buffer, (const BYTE*)buff->ptr + buff->pos, n); buff->pos += n; return 0; @@ -124,7 +124,7 @@ static int ZSTD_seekable_seek_buff(void* opaque, long newOffset = (unsigned long long)buff->pos + offset; break; case SEEK_END: - newOffset = (unsigned long long)buff->size - offset; + newOffset = (unsigned long long)buff->size + offset; break; default: assert(0); /* not possible */ Modified: head/sys/contrib/zstd/doc/zstd_compression_format.md ============================================================================== --- head/sys/contrib/zstd/doc/zstd_compression_format.md Thu Aug 8 16:51:49 2019 (r350759) +++ head/sys/contrib/zstd/doc/zstd_compression_format.md Thu Aug 8 16:54:22 2019 (r350760) @@ -16,7 +16,7 @@ Distribution of this document is unlimited. ### Version -0.3.1 (25/10/18) +0.3.2 (17/07/19) Introduction @@ -390,9 +390,7 @@ A block can contain any number of bytes (even zero), u - Window_Size - 128 KB -A `Compressed_Block` has the extra restriction that `Block_Size` is always -strictly less than the decompressed size. -If this condition cannot be respected, +If this condition cannot be respected when generating a `Compressed_Block`, the block must be sent uncompressed instead (`Raw_Block`). @@ -1655,6 +1653,7 @@ or at least provide a meaningful error code explaining Version changes --------------- +- 0.3.2 : remove additional block size restriction on compressed blocks - 0.3.1 : minor clarification regarding offset history update rules - 0.3.0 : minor edits to match RFC8478 - 0.2.9 : clarifications for huffman weights direct representation, by Ulrich Kunitz Modified: head/sys/contrib/zstd/doc/zstd_manual.html ============================================================================== --- head/sys/contrib/zstd/doc/zstd_manual.html Thu Aug 8 16:51:49 2019 (r350759) +++ head/sys/contrib/zstd/doc/zstd_manual.html Thu Aug 8 16:54:22 2019 (r350760) @@ -1,46 +1,36 @@ -zstd 1.4.0 Manual +zstd 1.4.2 Manual -

zstd 1.4.0 Manual

+

zstd 1.4.2 Manual


Contents

  1. Introduction
  2. Version
  3. -
  4. Default constant
  5. -
  6. Constants
  7. -
  8. Simple API
  9. -
  10. Explicit context
  11. -
  12. Advanced compression API
  13. -
  14. Advanced decompression API
  15. -
  16. Streaming
  17. -
  18. Streaming compression - HowTo
  19. -
  20. This is a legacy streaming API, and can be replaced by ZSTD_CCtx_reset() and
  21. -
  22. Equivalent to:
  23. -
  24. Alternative for ZSTD_compressStream2(zcs, output, input, ZSTD_e_continue).
  25. -
  26. Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_flush).
  27. -
  28. Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_end).
  29. -
  30. Streaming decompression - HowTo
  31. -
  32. Simple dictionary API
  33. -
  34. Bulk processing dictionary API
  35. -
  36. Dictionary helper functions
  37. -
  38. Advanced dictionary and prefix API
  39. -
  40. ADVANCED AND EXPERIMENTAL FUNCTIONS
  41. -
  42. experimental API (static linking only)
  43. -
  44. Frame size functions
  45. -
  46. ZSTD_decompressBound() :
  47. -
  48. Memory management
  49. -
  50. Advanced compression functions
  51. -
  52. Advanced decompression functions
  53. -
  54. Advanced streaming functions
  55. -
  56. Buffer-less and synchronous inner streaming functions
  57. -
  58. Buffer-less streaming compression (synchronous mode)
  59. -
  60. Buffer-less streaming decompression (synchronous mode)
  61. -
  62. ZSTD_getFrameHeader() :
  63. -
  64. Block level API
  65. +
  66. Simple API
  67. +
  68. Explicit context
  69. +
  70. Advanced compression API
  71. +
  72. Advanced decompression API
  73. +
  74. Streaming
  75. +
  76. Streaming compression - HowTo
  77. +
  78. Streaming decompression - HowTo
  79. +
  80. Simple dictionary API
  81. +
  82. Bulk processing dictionary API
  83. +
  84. Dictionary helper functions
  85. +
  86. Advanced dictionary and prefix API
  87. +
  88. experimental API (static linking only)
  89. +
  90. Frame size functions
  91. +
  92. Memory management
  93. +
  94. Advanced compression functions
  95. +
  96. Advanced decompression functions
  97. +
  98. Advanced streaming functions
  99. +
  100. Buffer-less and synchronous inner streaming functions
  101. +
  102. Buffer-less streaming compression (synchronous mode)
  103. +
  104. Buffer-less streaming decompression (synchronous mode)
  105. +
  106. Block level API

Introduction

@@ -78,12 +68,8 @@
 
 
unsigned ZSTD_versionNumber(void);   /**< to check runtime library version */
 

-

Default constant


+

Simple API


 
-

Constants


-
-

Simple API


-
 
size_t ZSTD_compress( void* dst, size_t dstCapacity,
                 const void* src, size_t srcSize,
                       int compressionLevel);
@@ -152,12 +138,17 @@ const char* ZSTD_getErrorName(size_t code);     /*
 int         ZSTD_minCLevel(void);               /*!< minimum negative compression level allowed */
 int         ZSTD_maxCLevel(void);               /*!< maximum compression level available */
 

-

Explicit context


+

Explicit context


 
 

Compression context

  When compressing many times,
-  it is recommended to allocate a context just once, and re-use it for each successive compression operation.
+  it is recommended to allocate a context just once,
+  and re-use it for each successive compression operation.
   This will make workload friendlier for system's memory.
-  Use one context per thread for parallel execution in multi-threaded environments. 
+  Note : re-using context is just a speed / resource optimization.
+         It doesn't change the compression ratio, which remains identical.
+  Note 2 : In multi-threaded environments,
+         use one different context per thread for parallel execution.
+ 
 
typedef struct ZSTD_CCtx_s ZSTD_CCtx;
 ZSTD_CCtx* ZSTD_createCCtx(void);
 size_t     ZSTD_freeCCtx(ZSTD_CCtx* cctx);
@@ -189,7 +180,7 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
  
 


-

Advanced compression API


+

Advanced compression API


 
 
typedef enum { ZSTD_fast=1,
                ZSTD_dfast=2,
@@ -332,6 +323,7 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
      * ZSTD_c_forceMaxWindow
      * ZSTD_c_forceAttachDict
      * ZSTD_c_literalCompressionMode
+     * ZSTD_c_targetCBlockSize
      * Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
      * note : never ever use experimentalParam? names directly;
      *        also, the enums values themselves are unstable and can still change.
@@ -341,6 +333,7 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
      ZSTD_c_experimentalParam3=1000,
      ZSTD_c_experimentalParam4=1001,
      ZSTD_c_experimentalParam5=1002,
+     ZSTD_c_experimentalParam6=1003,
 } ZSTD_cParameter;
 

typedef struct {
@@ -424,7 +417,7 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
  
 


-

Advanced decompression API


+

Advanced decompression API


 
 
typedef enum {
 
@@ -472,7 +465,7 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
  
 


-

Streaming


+

Streaming


 
 
typedef struct ZSTD_inBuffer_s {
   const void* src;    /**< start of input buffer */
@@ -486,7 +479,7 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
   size_t pos;         /**< position where writing stopped. Will be updated. Necessarily 0 <= pos <= size */
 } ZSTD_outBuffer;
 

-

Streaming compression - HowTo

+

Streaming compression - HowTo

   A ZSTD_CStream object is required to track streaming operation.
   Use ZSTD_createCStream() and ZSTD_freeCStream() to create/release resources.
   ZSTD_CStream objects can be reused multiple times on consecutive compression operations.
@@ -592,31 +585,28 @@ size_t ZSTD_freeCStream(ZSTD_CStream* zcs);
 
 
size_t ZSTD_CStreamInSize(void);    /**< recommended size for input buffer */
 

-
size_t ZSTD_CStreamOutSize(void);   /**< recommended size for output buffer. Guarantee to successfully flush at least one complete compressed block in all circumstances. */
+
size_t ZSTD_CStreamOutSize(void);   /**< recommended size for output buffer. Guarantee to successfully flush at least one complete compressed block. */
 

-

This is a legacy streaming API, and can be replaced by ZSTD_CCtx_reset() and

 ZSTD_compressStream2(). It is redundent, but is still fully supported.
- Advanced parameters and dictionary compression can only be used through the
- new API.
-
- -

Equivalent to:

+
size_t ZSTD_initCStream(ZSTD_CStream* zcs, int compressionLevel);
+/*!
+ * Alternative for ZSTD_compressStream2(zcs, output, input, ZSTD_e_continue).
+ * NOTE: The return value is different. ZSTD_compressStream() returns a hint for
+ * the next read size (if non-zero and not an error). ZSTD_compressStream2()
+ * returns the minimum nb of bytes left to flush (if non-zero and not an error).
+ */
+size_t ZSTD_compressStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output, ZSTD_inBuffer* input);
+/*! Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_flush). */
+size_t ZSTD_flushStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output);
+/*! Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_end). */
+size_t ZSTD_endStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output);
+

ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any) ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel); -

+


-

Alternative for ZSTD_compressStream2(zcs, output, input, ZSTD_e_continue).

 NOTE: The return value is different. ZSTD_compressStream() returns a hint for
- the next read size (if non-zero and not an error). ZSTD_compressStream2()
- returns the number of bytes left to flush (if non-zero and not an error).
- 
-
- -

Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_flush).


-
-

Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_end).


-
-

Streaming decompression - HowTo

+

Streaming decompression - HowTo

   A ZSTD_DStream object is required to track streaming operations.
   Use ZSTD_createDStream() and ZSTD_freeDStream() to create/release resources.
   ZSTD_DStream objects can be re-used multiple times.
@@ -647,14 +637,12 @@ size_t ZSTD_freeCStream(ZSTD_CStream* zcs);
 

ZSTD_DStream management functions

ZSTD_DStream* ZSTD_createDStream(void);
 size_t ZSTD_freeDStream(ZSTD_DStream* zds);
 

-

Streaming decompression functions

size_t ZSTD_initDStream(ZSTD_DStream* zds);
-size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inBuffer* input);
-

+

Streaming decompression functions


size_t ZSTD_DStreamInSize(void);    /*!< recommended size for input buffer */
 

size_t ZSTD_DStreamOutSize(void);   /*!< recommended size for output buffer. Guarantee to successfully flush at least one complete block in all circumstances. */
 

-

Simple dictionary API


+

Simple dictionary API


 
 
size_t ZSTD_compress_usingDict(ZSTD_CCtx* ctx,
                                void* dst, size_t dstCapacity,
@@ -680,7 +668,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_o
   Note : When `dict == NULL || dictSize < 8` no dictionary is used. 
 


-

Bulk processing dictionary API


+

Bulk processing dictionary API


 
 
ZSTD_CDict* ZSTD_createCDict(const void* dictBuffer, size_t dictSize,
                              int compressionLevel);
@@ -723,7 +711,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_o
   Recommended when same dictionary is used multiple times. 
 


-

Dictionary helper functions


+

Dictionary helper functions


 
 
unsigned ZSTD_getDictID_fromDict(const void* dict, size_t dictSize);
 

Provides the dictID stored within dictionary. @@ -749,7 +737,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_o When identifying the exact failure cause, it's possible to use ZSTD_getFrameHeader(), which will provide a more precise error code.


-

Advanced dictionary and prefix API

+

Advanced dictionary and prefix API

  This API allows dictionaries to be used with ZSTD_compress2(),
  ZSTD_compressStream2(), and ZSTD_decompress(). Dictionaries are sticky, and
  only reset with the context is reset with ZSTD_reset_parameters or
@@ -867,15 +855,7 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
   Note that object memory usage can evolve (increase or decrease) over time. 
 


-

ADVANCED AND EXPERIMENTAL FUNCTIONS

- The definitions in the following section are considered experimental.
- They are provided for advanced scenarios.
- They should never be used with a dynamic library, as prototypes may change in the future.
- Use them only in association with static linking.
- 
-
- -

experimental API (static linking only)

+

experimental API (static linking only)

  The following symbols and constants
  are not planned to join "stable API" status in the near future.
  They can still change in future versions.
@@ -973,7 +953,7 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
   ZSTD_lcm_uncompressed = 2,  /**< Always emit uncompressed literals. */
 } ZSTD_literalCompressionMode_e;
 

-

Frame size functions


+

Frame size functions


 
 
unsigned long long ZSTD_findDecompressedSize(const void* src, size_t srcSize);
 

`src` should point to the start of a series of ZSTD encoded and/or skippable frames @@ -998,7 +978,8 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict); however it does mean that all frame data must be present and valid.


-

ZSTD_decompressBound() :

  `src` should point to the start of a series of ZSTD encoded and/or skippable frames
+
unsigned long long ZSTD_decompressBound(const void* src, size_t srcSize);
+

`src` should point to the start of a series of ZSTD encoded and/or skippable frames `srcSize` must be the _exact_ size of this series (i.e. there should be a frame boundary at `src + srcSize`) @return : - upper-bound for the decompressed size of all data in all successive frames @@ -1010,7 +991,7 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict); note 3 : when the decompressed size field isn't available, the upper-bound for that frame is calculated by: upper-bound = # blocks * min(128 KB, Window_Size) -

+


size_t ZSTD_frameHeaderSize(const void* src, size_t srcSize);
 

srcSize must be >= ZSTD_FRAMEHEADERSIZE_PREFIX. @@ -1018,7 +999,7 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict); or an error code (if srcSize is too small)


-

Memory management


+

Memory management


 
 
size_t ZSTD_estimateCCtxSize(int compressionLevel);
 size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams);
@@ -1098,7 +1079,7 @@ static ZSTD_customMem const ZSTD_defaultCMem = { NULL,
  
 


-

Advanced compression functions


+

Advanced compression functions


 
 
ZSTD_CDict* ZSTD_createCDict_byReference(const void* dictBuffer, size_t dictSize, int compressionLevel);
 

Create a digested dictionary for compression @@ -1243,7 +1224,7 @@ size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params);


-

Advanced decompression functions


+

Advanced decompression functions


 
 
unsigned ZSTD_isFrame(const void* buffer, size_t size);
 

Tells if the content of `buffer` starts with a valid Frame Identifier. @@ -1305,7 +1286,7 @@ size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params);


-

Advanced streaming functions

  Warning : most of these functions are now redundant with the Advanced API.
+

Advanced streaming functions

  Warning : most of these functions are now redundant with the Advanced API.
   Once Advanced API reaches "stable" status,
   redundant functions will be deprecated, and then at some point removed.
 
@@ -1407,18 +1388,41 @@ size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStre


-

Advanced Streaming decompression functions

size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize); /**< note: no dictionary will be used if dict == NULL or dictSize < 8 */
-size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* zds, const ZSTD_DDict* ddict);  /**< note : ddict is referenced, it must outlive decompression session */
-size_t ZSTD_resetDStream(ZSTD_DStream* zds);  /**< re-use decompression parameters from previous init; saves dictionary loading */
+

Advanced Streaming decompression functions

/**
+ * This function is deprecated, and is equivalent to:
+ *
+ *     ZSTD_DCtx_reset(zds, ZSTD_reset_session_only);
+ *     ZSTD_DCtx_loadDictionary(zds, dict, dictSize);
+ *
+ * note: no dictionary will be used if dict == NULL or dictSize < 8
+ */
+size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize);
+/**
+ * This function is deprecated, and is equivalent to:
+ *
+ *     ZSTD_DCtx_reset(zds, ZSTD_reset_session_only);
+ *     ZSTD_DCtx_refDDict(zds, ddict);
+ *
+ * note : ddict is referenced, it must outlive decompression session
+ */
+size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* zds, const ZSTD_DDict* ddict);
+/**
+ * This function is deprecated, and is equivalent to:
+ *
+ *     ZSTD_DCtx_reset(zds, ZSTD_reset_session_only);
+ *
+ * re-use decompression parameters from previous init; saves dictionary loading
+ */
+size_t ZSTD_resetDStream(ZSTD_DStream* zds);
 

-

Buffer-less and synchronous inner streaming functions

+

Buffer-less and synchronous inner streaming functions

   This is an advanced API, giving full control over buffer management, for users which need direct control over memory.
   But it's also a complex one, with several restrictions, documented below.
   Prefer normal streaming API for an easier experience.
  
 
-

Buffer-less streaming compression (synchronous mode)

+

Buffer-less streaming compression (synchronous mode)

   A ZSTD_CCtx object is required to track streaming operations.
   Use ZSTD_createCCtx() / ZSTD_freeCCtx() to manage resource.
   ZSTD_CCtx object can be re-used multiple times within successive compression operations.
@@ -1454,7 +1458,7 @@ size_t ZSTD_compressBegin_usingCDict(ZSTD_CCtx* cctx, 
 size_t ZSTD_compressBegin_usingCDict_advanced(ZSTD_CCtx* const cctx, const ZSTD_CDict* const cdict, ZSTD_frameParameters const fParams, unsigned long long const pledgedSrcSize);   /* compression parameters are already set within cdict. pledgedSrcSize must be correct. If srcSize is not known, use macro ZSTD_CONTENTSIZE_UNKNOWN */
 size_t ZSTD_copyCCtx(ZSTD_CCtx* cctx, const ZSTD_CCtx* preparedCCtx, unsigned long long pledgedSrcSize); /**<  note: if pledgedSrcSize is not known, use ZSTD_CONTENTSIZE_UNKNOWN */
 

-

Buffer-less streaming decompression (synchronous mode)

+

Buffer-less streaming decompression (synchronous mode)

   A ZSTD_DCtx object is required to track streaming operations.
   Use ZSTD_createDCtx() / ZSTD_freeDCtx() to manage it.
   A ZSTD_DCtx object can be re-used multiple times.
@@ -1536,23 +1540,21 @@ typedef struct {
     unsigned checksumFlag;
 } ZSTD_frameHeader;
 

-

ZSTD_getFrameHeader() :

  decode Frame Header, or requires larger `srcSize`.
+
size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize);   /**< doesn't consume input */
+/*! ZSTD_getFrameHeader_advanced() :
+ *  same as ZSTD_getFrameHeader(),
+ *  with added capability to select a format (like ZSTD_f_zstd1_magicless) */
+size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize, ZSTD_format_e format);
+size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long long frameContentSize);  /**< when frame content size is not known, pass in frameContentSize == ZSTD_CONTENTSIZE_UNKNOWN */
+

decode Frame Header, or requires larger `srcSize`. @return : 0, `zfhPtr` is correctly filled, >0, `srcSize` is too small, value is wanted `srcSize` amount, or an error code, which can be tested using ZSTD_isError() -

- -
size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize);   /**< doesn't consume input */
-

-
size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize, ZSTD_format_e format);
-size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long long frameContentSize);  /**< when frame content size is not known, pass in frameContentSize == ZSTD_CONTENTSIZE_UNKNOWN */
-

same as ZSTD_getFrameHeader(), - with added capability to select a format (like ZSTD_f_zstd1_magicless)


typedef enum { ZSTDnit_frameHeader, ZSTDnit_blockHeader, ZSTDnit_block, ZSTDnit_lastBlock, ZSTDnit_checksum, ZSTDnit_skippableFrame } ZSTD_nextInputType_e;
 

-

Block level API


+

Block level API


 
 

Frame metadata cost is typically ~18 bytes, which can be non-negligible for very small blocks (< 100 bytes). User will have to take in charge required information to regenerate data, such as compressed and content sizes. Modified: head/sys/contrib/zstd/examples/Makefile ============================================================================== --- head/sys/contrib/zstd/examples/Makefile Thu Aug 8 16:51:49 2019 (r350759) +++ head/sys/contrib/zstd/examples/Makefile Thu Aug 8 16:54:22 2019 (r350760) @@ -77,7 +77,6 @@ test: all @echo -- Edge cases detection ! ./streaming_decompression tmp # invalid input, must fail ! ./simple_decompression tmp # invalid input, must fail - ! ./simple_decompression tmp.zst # unknown input size, must fail touch tmpNull # create 0-size file ./simple_compression tmpNull ./simple_decompression tmpNull.zst # 0-size frame : must work Modified: head/sys/contrib/zstd/lib/Makefile ============================================================================== --- head/sys/contrib/zstd/lib/Makefile Thu Aug 8 16:51:49 2019 (r350759) +++ head/sys/contrib/zstd/lib/Makefile Thu Aug 8 16:54:22 2019 (r350760) @@ -17,6 +17,7 @@ LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT)) LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT)) LIBVER := $(shell echo $(LIBVER_SCRIPT)) VERSION?= $(LIBVER) +CCVER := $(shell $(CC) --version) CPPFLAGS+= -I. -I./common -DXXH_NAMESPACE=ZSTD_ ifeq ($(OS),Windows_NT) # MinGW assumed @@ -44,6 +45,10 @@ ZSTDDECOMP_FILES := $(sort $(wildcard decompress/*.c)) ZDICT_FILES := $(sort $(wildcard dictBuilder/*.c)) ZDEPR_FILES := $(sort $(wildcard deprecated/*.c)) ZSTD_FILES := $(ZSTDCOMMON_FILES) + +ifeq ($(findstring GCC,$(CCVER)),GCC) +decompress/zstd_decompress_block.o : CFLAGS+=-fno-tree-vectorize +endif ZSTD_LEGACY_SUPPORT ?= 5 ZSTD_LIB_COMPRESSION ?= 1 Modified: head/sys/contrib/zstd/lib/common/compiler.h ============================================================================== --- head/sys/contrib/zstd/lib/common/compiler.h Thu Aug 8 16:51:49 2019 (r350759) +++ head/sys/contrib/zstd/lib/common/compiler.h Thu Aug 8 16:54:22 2019 (r350760) @@ -127,6 +127,13 @@ } \ } +/* vectorization */ +#if !defined(__clang__) && defined(__GNUC__) +# define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize"))) +#else +# define DONT_VECTORIZE +#endif + /* disable warnings */ #ifdef _MSC_VER /* Visual Studio */ # include /* For Visual 2005 */ Modified: head/sys/contrib/zstd/lib/common/zstd_internal.h ============================================================================== --- head/sys/contrib/zstd/lib/common/zstd_internal.h Thu Aug 8 16:51:49 2019 (r350759) +++ head/sys/contrib/zstd/lib/common/zstd_internal.h Thu Aug 8 16:54:22 2019 (r350760) @@ -34,7 +34,6 @@ #endif #include "xxhash.h" /* XXH_reset, update, digest */ - #if defined (__cplusplus) extern "C" { #endif @@ -193,19 +192,72 @@ static const U32 OF_defaultNormLog = OF_DEFAULTNORMLOG * Shared functions to include for inlining *********************************************/ static void ZSTD_copy8(void* dst, const void* src) { memcpy(dst, src, 8); } + #define COPY8(d,s) { ZSTD_copy8(d,s); d+=8; s+=8; } +static void ZSTD_copy16(void* dst, const void* src) { memcpy(dst, src, 16); } +#define COPY16(d,s) { ZSTD_copy16(d,s); d+=16; s+=16; } +#define WILDCOPY_OVERLENGTH 8 +#define VECLEN 16 + +typedef enum { + ZSTD_no_overlap, + ZSTD_overlap_src_before_dst, + /* ZSTD_overlap_dst_before_src, */ +} ZSTD_overlap_e; + /*! ZSTD_wildcopy() : * custom version of memcpy(), can overwrite up to WILDCOPY_OVERLENGTH bytes (if length==0) */ -#define WILDCOPY_OVERLENGTH 8 -MEM_STATIC void ZSTD_wildcopy(void* dst, const void* src, ptrdiff_t length) +MEM_STATIC FORCE_INLINE_ATTR DONT_VECTORIZE +void ZSTD_wildcopy(void* dst, const void* src, ptrdiff_t length, ZSTD_overlap_e ovtype) { + ptrdiff_t diff = (BYTE*)dst - (const BYTE*)src; const BYTE* ip = (const BYTE*)src; BYTE* op = (BYTE*)dst; BYTE* const oend = op + length; - do - COPY8(op, ip) - while (op < oend); + + assert(diff >= 8 || (ovtype == ZSTD_no_overlap && diff < -8)); + if (length < VECLEN || (ovtype == ZSTD_overlap_src_before_dst && diff < VECLEN)) { + do + COPY8(op, ip) + while (op < oend); + } + else { + if ((length & 8) == 0) + COPY8(op, ip); + do { + COPY16(op, ip); + } + while (op < oend); + } +} + +/*! ZSTD_wildcopy_16min() : + * same semantics as ZSTD_wilcopy() except guaranteed to be able to copy 16 bytes at the start */ +MEM_STATIC FORCE_INLINE_ATTR DONT_VECTORIZE +void ZSTD_wildcopy_16min(void* dst, const void* src, ptrdiff_t length, ZSTD_overlap_e ovtype) +{ + ptrdiff_t diff = (BYTE*)dst - (const BYTE*)src; + const BYTE* ip = (const BYTE*)src; + BYTE* op = (BYTE*)dst; + BYTE* const oend = op + length; + + assert(length >= 8); + assert(diff >= 8 || (ovtype == ZSTD_no_overlap && diff < -8)); + + if (ovtype == ZSTD_overlap_src_before_dst && diff < VECLEN) { + do + COPY8(op, ip) + while (op < oend); + } + else { + if ((length & 8) == 0) + COPY8(op, ip); + do { + COPY16(op, ip); + } + while (op < oend); + } } MEM_STATIC void ZSTD_wildcopy_e(void* dst, const void* src, void* dstEnd) /* should be faster for decoding, but strangely, not verified on all platform */ Modified: head/sys/contrib/zstd/lib/compress/zstd_compress.c ============================================================================== --- head/sys/contrib/zstd/lib/compress/zstd_compress.c Thu Aug 8 16:51:49 2019 (r350759) +++ head/sys/contrib/zstd/lib/compress/zstd_compress.c Thu Aug 8 16:54:22 2019 (r350760) @@ -21,6 +21,8 @@ #define HUF_STATIC_LINKING_ONLY #include "huf.h" #include "zstd_compress_internal.h" +#include "zstd_compress_sequences.h" +#include "zstd_compress_literals.h" #include "zstd_fast.h" #include "zstd_double_fast.h" #include "zstd_lazy.h" @@ -385,6 +387,11 @@ ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter para bounds.upperBound = ZSTD_lcm_uncompressed; return bounds; + case ZSTD_c_targetCBlockSize: + bounds.lowerBound = ZSTD_TARGETCBLOCKSIZE_MIN; + bounds.upperBound = ZSTD_TARGETCBLOCKSIZE_MAX; + return bounds; + default: { ZSTD_bounds const boundError = { ERROR(parameter_unsupported), 0, 0 }; return boundError; @@ -392,18 +399,6 @@ ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter para } } -/* ZSTD_cParam_withinBounds: - * @return 1 if value is within cParam bounds, - * 0 otherwise */ -static int ZSTD_cParam_withinBounds(ZSTD_cParameter cParam, int value) -{ - ZSTD_bounds const bounds = ZSTD_cParam_getBounds(cParam); - if (ZSTD_isError(bounds.error)) return 0; - if (value < bounds.lowerBound) return 0; - if (value > bounds.upperBound) return 0; - return 1; -} - /* ZSTD_cParam_clampBounds: * Clamps the value into the bounded range. */ @@ -452,6 +447,7 @@ static int ZSTD_isUpdateAuthorized(ZSTD_cParameter par case ZSTD_c_ldmHashRateLog: case ZSTD_c_forceAttachDict: case ZSTD_c_literalCompressionMode: + case ZSTD_c_targetCBlockSize: default: return 0; } @@ -497,6 +493,7 @@ size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cP case ZSTD_c_ldmHashLog: case ZSTD_c_ldmMinMatch: case ZSTD_c_ldmBucketSizeLog: + case ZSTD_c_targetCBlockSize: break; default: RETURN_ERROR(parameter_unsupported); @@ -671,6 +668,12 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams->ldmParams.hashRateLog = value; return CCtxParams->ldmParams.hashRateLog; + case ZSTD_c_targetCBlockSize : + if (value!=0) /* 0 ==> default */ + BOUNDCHECK(ZSTD_c_targetCBlockSize, value); + CCtxParams->targetCBlockSize = value; + return CCtxParams->targetCBlockSize; + default: RETURN_ERROR(parameter_unsupported, "unknown parameter"); } } @@ -692,13 +695,13 @@ size_t ZSTD_CCtxParams_getParameter( *value = CCtxParams->compressionLevel; break; case ZSTD_c_windowLog : - *value = CCtxParams->cParams.windowLog; + *value = (int)CCtxParams->cParams.windowLog; break; case ZSTD_c_hashLog : - *value = CCtxParams->cParams.hashLog; + *value = (int)CCtxParams->cParams.hashLog; break; case ZSTD_c_chainLog : - *value = CCtxParams->cParams.chainLog; + *value = (int)CCtxParams->cParams.chainLog; break; case ZSTD_c_searchLog : *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Aug 8 17:03:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BFD9ABC29; Thu, 8 Aug 2019 17:03:31 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464F7k6WGcz4ZC9; Thu, 8 Aug 2019 17:03:30 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0FF3555; Thu, 8 Aug 2019 17:03:30 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78H3U5B062114; Thu, 8 Aug 2019 17:03:30 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78H3UQW062112; Thu, 8 Aug 2019 17:03:30 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201908081703.x78H3UQW062112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Thu, 8 Aug 2019 17:03:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350761 - in head/stand: efi/loader i386/loader X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: in head/stand: efi/loader i386/loader X-SVN-Commit-Revision: 350761 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 17:03:31 -0000 Author: mw Date: Thu Aug 8 17:03:30 2019 New Revision: 350761 URL: https://svnweb.freebsd.org/changeset/base/350761 Log: Verify files loaded in chain command. The chain command can be used to chain load another binary. If veriexec is enabled we should verify it first. Note that on EFI systems the verification was already done through firmware, assuming that Secure Boot was enabled there. Submitted by: Kornel Duleba Reviewed by: sjg MFC after: 1 week Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D20952 Modified: head/stand/efi/loader/main.c head/stand/i386/loader/chain.c Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Thu Aug 8 16:54:22 2019 (r350760) +++ head/stand/efi/loader/main.c Thu Aug 8 17:03:30 2019 (r350761) @@ -1440,6 +1440,14 @@ command_chain(int argc, char *argv[]) return (CMD_ERROR); } +#ifdef LOADER_VERIEXEC + if (verify_file(fd, name, 0, VE_MUST) < 0) { + sprintf(command_errbuf, "can't verify: %s", name); + close(fd); + return (CMD_ERROR); + } +#endif + if (fstat(fd, &st) < -1) { command_errmsg = "stat failed"; close(fd); Modified: head/stand/i386/loader/chain.c ============================================================================== --- head/stand/i386/loader/chain.c Thu Aug 8 16:54:22 2019 (r350760) +++ head/stand/i386/loader/chain.c Thu Aug 8 17:03:30 2019 (r350761) @@ -75,6 +75,14 @@ command_chain(int argc, char *argv[]) return (CMD_ERROR); } +#ifdef LOADER_VERIEXEC + if (verify_file(fd, argv[1], 0, VE_MUST) < 0) { + sprintf(command_errbuf, "can't verify: %s", argv[1]); + close(fd); + return (CMD_ERROR); + } +#endif + len = strlen(argv[1]); if (argv[1][len-1] != ':') { if (fstat(fd, &st) == -1) { From owner-svn-src-head@freebsd.org Thu Aug 8 17:48:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B595AD4B8; Thu, 8 Aug 2019 17:48:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464G7C710yz4cvH; Thu, 8 Aug 2019 17:48:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2170CC0; Thu, 8 Aug 2019 17:48:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78Hm7l4085761; Thu, 8 Aug 2019 17:48:07 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78Hm79V085760; Thu, 8 Aug 2019 17:48:07 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908081748.x78Hm79V085760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 8 Aug 2019 17:48:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350764 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 350764 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 17:48:08 -0000 Author: imp Date: Thu Aug 8 17:48:07 2019 New Revision: 350764 URL: https://svnweb.freebsd.org/changeset/base/350764 Log: Make arm64 32-bit mode compile with COMPAT_43 The COMPAT_43 option isn't quite like the other compat options, and arm64 makes attempts to support it in 64-bit mode. In 32-bit compat mode, however, two syscall implementations that COMPAT_FREEBSD32 assumes will be there are missing. Provide implementations for these: ofreebsd32_sigreturn (which we'll never encounter, so implement it as nosys as is done in kern_sig.c) and ofreebsd32_getpagesize, where we'll always return 4096 since that's the only PAGE_SIZE we support, similar to how the ia32 implementation does things. Reviewed by: manu@ Differential Revision: https://reviews.freebsd.org/D21192 Modified: head/sys/arm64/arm64/freebsd32_machdep.c Modified: head/sys/arm64/arm64/freebsd32_machdep.c ============================================================================== --- head/sys/arm64/arm64/freebsd32_machdep.c Thu Aug 8 17:30:51 2019 (r350763) +++ head/sys/arm64/arm64/freebsd32_machdep.c Thu Aug 8 17:48:07 2019 (r350764) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #ifdef VFP #include @@ -410,3 +411,30 @@ freebsd32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigs mtx_lock(&psp->ps_mtx); } + +#ifdef COMPAT_43 +/* + * COMPAT_FREEBSD32 assumes we have this system call when COMPAT_43 is defined. + * FreeBSD/arm provies a similar getpagesize() syscall. + */ +#define ARM32_PAGE_SIZE 4096 +int +ofreebsd32_getpagesize(struct thread *td, + struct ofreebsd32_getpagesize_args *uap) +{ + + td->td_retval[0] = ARM32_PAGE_SIZE; + return (0); +} + +/* + * Mirror the osigreturn definition in kern_sig.c for !i386 platforms. This + * mirrors what's connected to the FreeBSD/arm syscall. + */ +int +ofreebsd32_sigreturn(struct thread *td, struct ofreebsd32_sigreturn_args *uap) +{ + + return (nosys(td, (struct nosys_args *)uap)); +} +#endif From owner-svn-src-head@freebsd.org Thu Aug 8 17:55:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4BF44AD856; Thu, 8 Aug 2019 17:55:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464GHX180tz4dSl; Thu, 8 Aug 2019 17:55:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A611E9A; Thu, 8 Aug 2019 17:55:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78HtJk3091566; Thu, 8 Aug 2019 17:55:19 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78HtJH9091565; Thu, 8 Aug 2019 17:55:19 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908081755.x78HtJH9091565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 8 Aug 2019 17:55:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350766 - head/sys/arm64/conf X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/arm64/conf X-SVN-Commit-Revision: 350766 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 17:55:20 -0000 Author: imp Date: Thu Aug 8 17:55:19 2019 New Revision: 350766 URL: https://svnweb.freebsd.org/changeset/base/350766 Log: First pass at a LINT for arm64. Create a rough and ready NOTES file from GENERIC, remove the duplication from sys/conf/NOTES and add relevant no* directives to make this compile. Reviewed by: jhb, manu (earlier versions that differed only in comments) Differential Revision: https://reviews.freebsd.org/D21184 Added: head/sys/arm64/conf/Makefile (contents, props changed) head/sys/arm64/conf/NOTES (contents, props changed) Added: head/sys/arm64/conf/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/conf/Makefile Thu Aug 8 17:55:19 2019 (r350766) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +TARGET=arm64 + +.include "${.CURDIR}/../../conf/makeLINT.mk" Added: head/sys/arm64/conf/NOTES ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/conf/NOTES Thu Aug 8 17:55:19 2019 (r350766) @@ -0,0 +1,245 @@ +# +# NOTES -- Lines that can be cut/pasted into kernel and hints configs. +# +# This file contains machine dependent kernel configuration notes. For +# machine independent notes, look in /sys/conf/NOTES. +# +# $FreeBSD$ +# + +# +# We want LINT to cover profiling as well. +# Except it's broken. +#profile 2 + +# +# Enable the kernel DTrace hooks which are required to load the DTrace +# kernel modules. +# +options KDTRACE_HOOKS + +# +# Most of the following is copied from ARM64 GENERIC. +cpu ARM64 + +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols +makeoptions WITH_CTF=1 # Run ctfconvert(1) for DTrace support + +options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. +options KDTRACE_FRAME # Ensure frames are compiled in +options VFP # Floating-point support +options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default +options INTRNG + +nooptions GDB # Support remote GDB -- not supported + +# SoC support +options SOC_ALLWINNER_A64 +options SOC_ALLWINNER_H5 +options SOC_CAVM_THUNDERX +options SOC_HISI_HI6220 +options SOC_BRCM_BCM2837 +options SOC_MARVELL_8K +options SOC_ROCKCHIP_RK3328 +options SOC_ROCKCHIP_RK3399 +options SOC_XILINX_ZYNQ + +# Timer drivers +device a10_timer + +# Annapurna Alpine drivers +device al_ccu # Alpine Cache Coherency Unit +device al_nb_service # Alpine North Bridge Service +device al_iofic # I/O Fabric Interrupt Controller +device al_serdes # Serializer/Deserializer +device al_udma # Universal DMA + +# Qualcomm Snapdragon drivers +device qcom_gcc # Global Clock Controller + +# VirtIO support +device virtio +device virtio_pci +device virtio_mmio +device virtio_blk +device vtnet + +# CPU frequency control +device cpufreq + +# Bus drivers +device al_pci # Annapurna Alpine PCI-E +options PCI_HP # PCI-Express native HotPlug +options PCI_IOV # PCI SR-IOV support + +# Ethernet NICs +device mdio +device awg # Allwinner EMAC Gigabit Ethernet +device axgbe # AMD Opteron A1100 integrated NIC +device neta # Marvell Armada 370/38x/XP/3700 NIC +device smc # SMSC LAN91C111 +device vnic # Cavium ThunderX NIC +device al_eth # Annapurna Alpine Ethernet NIC +device dwc_rk # Rockchip Designware +device dwc_socfpga # Altera SOCFPGA Ethernet MAC + +# Etherswitch devices +device e6000sw # Marvell mv88e6085 based switches + +# NVM Express (NVMe) support +device nvme # base NVMe driver +options NVME_USE_NVD=0 # prefer the cam(4) based nda(4) driver +device nvd # expose NVMe namespaces as disks, depends on nvme + +# MMC/SD/SDIO Card slot support +device sdhci_xenon # Marvell Xenon SD/MMC controller +device aw_mmc # Allwinner SD/MMC controller +device dwmmc +device dwmmc_altera +device rk_emmcphy + +# Serial (COM) ports +device uart_msm # Qualcomm MSM UART driver +device uart_mu # RPI3 aux port +device uart_mvebu # Armada 3700 UART driver +device uart_ns8250 # ns8250-type UART driver +device uart_snps +device pl011 + +# USB support +device aw_ehci # Allwinner EHCI USB interface (USB 2.0) +device aw_usbphy # Allwinner USB PHY +device dwcotg # DWC OTG controller +device ehci_mv # Marvell EHCI USB interface + +# USB ethernet support +device muge +device smsc + +# Sound support +device a10_codec + +# DMA controller +device a31_dmac + +# GPIO / PINCTRL +device a37x0_gpio # Marvell Armada 37x0 GPIO controller +device aw_gpio # Allwinner GPIO controller +device fdt_pinctrl +device mv_gpio # Marvell GPIO controller +device mvebu_pinctrl # Marvell Pinmux Controller +device rk_gpio # RockChip GPIO Controller +device rk_pinctrl # RockChip Pinmux Controller + +# I2C +device aw_rsb # Allwinner Reduced Serial Bus +device bcm2835_bsc # Broadcom BCM283x I2C bus +device twsi # Allwinner I2C controller +device rk_i2c # RockChip I2C controller + +# Clock and reset controllers +device aw_ccu # Allwinner clock controller + +# Interrupt controllers +device aw_nmi # Allwinner NMI support +device mv_cp110_icu # Marvell CP110 ICU +device mv_ap806_gicp # Marvell AP806 GICP + +# Real-time clock support +device aw_rtc # Allwinner Real-time Clock +device mv_rtc # Marvell Real-time Clock + +# Watchdog controllers +device aw_wdog # Allwinner Watchdog + +# Power management controllers +device axp81x # X-Powers AXP81x PMIC +device rk805 # RockChip RK805 PMIC + +# EFUSE +device aw_sid # Allwinner Secure ID EFUSE + +# Thermal sensors +device aw_thermal # Allwinner Thermal Sensor Controller +device mv_thermal # Marvell Thermal Sensor Controller + +# SPI +device bcm2835_spi # Broadcom BCM283x SPI bus + +# PWM +device pwm +device aw_pwm + +device vt_efifb + +# EVDEV support +options EVDEV_SUPPORT # evdev support in legacy drivers +device aw_cir + +# Pseudo devices. +options EFIRT # EFI Runtime Services + +# EXT_RESOURCES pseudo devices +options EXT_RESOURCES +device clk +device phy +device hwreset +device nvmem +device regulator +device syscon +device aw_syscon + +# Chip-specific errata +options THUNDERX_PASS_1_1_ERRATA + +options FDT +device acpi + +# DTBs +makeoptions MODULES_EXTRA="dtb/allwinner dtb/rockchip dtb/rpi" + +# Add CAMDEBUG stuff +options CAMDEBUG +options CAM_DEBUG_FLAGS=(CAM_DEBUG_INFO|CAM_DEBUG_PROBE|CAM_DEBUG_PERIPH) + +# bring in camified MMC too +options MMCCAM + +# No support for floppies on arm64 +nodevice fdc + +# arm64 doesn't support inb/outb, so disable chipset probing which needs it +nooptions PPC_PROBE_CHIPSET + +# can't support syscons, no inb/outb, ditto for the screen savers +nodevice sc +nodevice blank_saver +nodevice daemon_saver +nodevice dragon_saver +nodevice fade_saver +nodevice fire_saver +nodevice green_saver +nodevice logo_saver +nodevice rain_saver +nodevice snake_saver +nodevice star_saver +nodevice warp_saver + +# These cause weird issues, not sure why +nodevice ukbd +nooptions DEBUG + +# Makes assumptions about bus tags that aren't true on arm64 +nodevice snd_cmi + +# arm64 didn't exist for these releases, so doesn't have the required compat +# support. Just disable them because they are meaningless. +nooptions COMPAT_FREEBSD4 +nooptions COMPAT_FREEBSD5 +nooptions COMPAT_FREEBSD6 +nooptions COMPAT_FREEBSD7 +nooptions COMPAT_FREEBSD9 +nooptions COMPAT_FREEBSD10 + +# arm64 supports 32-bit FreeBSD/arm binaries (armv[67] ABIs) +options COMPAT_FREEBSD32 # Compatible with FreeBSD/arm From owner-svn-src-head@freebsd.org Thu Aug 8 18:08:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 75216ADE40; Thu, 8 Aug 2019 18:08:15 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464GZR35Djz4flk; Thu, 8 Aug 2019 18:08:15 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B86A1094; Thu, 8 Aug 2019 18:08:15 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78I8Fxk098406; Thu, 8 Aug 2019 18:08:15 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78I8E50098399; Thu, 8 Aug 2019 18:08:14 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201908081808.x78I8E50098399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 8 Aug 2019 18:08:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350772 - in head: cddl/contrib/opensolaris/lib/libzfs/common stand/efi/boot1 stand/i386/gptzfsboot stand/i386/zfsboot stand/libsa/zfs sys/cddl/boot/zfs sys/cddl/contrib/opensolaris/uts... X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/lib/libzfs/common stand/efi/boot1 stand/i386/gptzfsboot stand/i386/zfsboot stand/libsa/zfs sys/cddl/boot/zfs sys/cddl/contrib/opensolaris/uts/common/os sys/cddl/contr... X-SVN-Commit-Revision: 350772 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 18:08:15 -0000 Author: tsoome Date: Thu Aug 8 18:08:13 2019 New Revision: 350772 URL: https://svnweb.freebsd.org/changeset/base/350772 Log: loader: support com.delphix:removing We should support removing vdev from boot pool. Update loader zfs reader to support com.delphix:removing. Reviewed by: allanjude MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D18901 Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/stand/efi/boot1/Makefile head/stand/i386/gptzfsboot/Makefile head/stand/i386/zfsboot/Makefile head/stand/libsa/zfs/Makefile.inc head/stand/libsa/zfs/zfsimpl.c head/sys/cddl/boot/zfs/zfsimpl.h head/sys/cddl/contrib/opensolaris/uts/common/os/list.c head/sys/cddl/contrib/opensolaris/uts/common/sys/list.h head/sys/cddl/contrib/opensolaris/uts/common/sys/list_impl.h head/sys/cddl/contrib/opensolaris/uts/common/sys/note.h head/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Aug 8 18:00:37 2019 (r350771) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Aug 8 18:08:13 2019 (r350772) @@ -3300,13 +3300,6 @@ zpool_vdev_remove(zpool_handle_t *zhp, const char *pat return (zfs_error(hdl, EZFS_BADVERSION, msg)); } - if (!islog && !avail_spare && !l2cache && zpool_is_bootable(zhp)) { - zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, - "root pool can not have removed devices, " - "because GRUB does not understand them")); - return (zfs_error(hdl, EINVAL, msg)); - } - zc.zc_guid = fnvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID); if (zfs_ioctl(hdl, ZFS_IOC_VDEV_REMOVE, &zc) == 0) Modified: head/stand/efi/boot1/Makefile ============================================================================== --- head/stand/efi/boot1/Makefile Thu Aug 8 18:00:37 2019 (r350771) +++ head/stand/efi/boot1/Makefile Thu Aug 8 18:08:13 2019 (r350772) @@ -36,6 +36,8 @@ SRCS+= zfs_module.c CFLAGS.zfs_module.c+= -I${ZFSSRC} CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/boot/zfs CFLAGS.zfs_module.c+= -I${SYSDIR}/crypto/skein +CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common + CFLAGS+= -DEFI_ZFS_BOOT .endif Modified: head/stand/i386/gptzfsboot/Makefile ============================================================================== --- head/stand/i386/gptzfsboot/Makefile Thu Aug 8 18:00:37 2019 (r350771) +++ head/stand/i386/gptzfsboot/Makefile Thu Aug 8 18:08:13 2019 (r350772) @@ -28,6 +28,7 @@ CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \ -I${ZFSSRC} \ -I${SYSDIR}/crypto/skein \ -I${SYSDIR}/cddl/boot/zfs \ + -I${SYSDIR}/cddl/contrib/opensolaris/uts/common \ -I${BOOTSRC}/i386/btx/lib \ -I${BOOTSRC}/i386/boot2 \ -Wall -Waggregate-return -Wbad-function-cast \ Modified: head/stand/i386/zfsboot/Makefile ============================================================================== --- head/stand/i386/zfsboot/Makefile Thu Aug 8 18:00:37 2019 (r350771) +++ head/stand/i386/zfsboot/Makefile Thu Aug 8 18:08:13 2019 (r350772) @@ -27,6 +27,7 @@ CFLAGS+=-DBOOTPROG=\"zfsboot\" \ -I${ZFSSRC} \ -I${SYSDIR}/crypto/skein \ -I${SYSDIR}/cddl/boot/zfs \ + -I${SYSDIR}/cddl/contrib/opensolaris/uts/common \ -I${BOOTSRC}/i386/boot2 \ -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ Modified: head/stand/libsa/zfs/Makefile.inc ============================================================================== --- head/stand/libsa/zfs/Makefile.inc Thu Aug 8 18:00:37 2019 (r350771) +++ head/stand/libsa/zfs/Makefile.inc Thu Aug 8 18:08:13 2019 (r350772) @@ -1,13 +1,15 @@ # $FreeBSD$ .PATH: ${ZFSSRC} -SRCS+= zfs.c skein.c skein_block.c +SRCS+= zfs.c skein.c skein_block.c list.c # Do not unroll skein loops, reduce code size CFLAGS+= -DSKEIN_LOOP=111 .PATH: ${SYSDIR}/crypto/skein +.PATH: ${SYSDIR}/cddl/contrib/opensolaris/uts/common/os CFLAGS+= -I${LDRSRC} CFLAGS+= -I${SYSDIR}/cddl/boot/zfs +CFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common CFLAGS+= -I${SYSDIR}/crypto/skein CFLAGS+= -Wformat -Wall Modified: head/stand/libsa/zfs/zfsimpl.c ============================================================================== --- head/stand/libsa/zfs/zfsimpl.c Thu Aug 8 18:00:37 2019 (r350771) +++ head/stand/libsa/zfs/zfsimpl.c Thu Aug 8 18:08:13 2019 (r350772) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "zfsimpl.h" #include "zfssubr.c" @@ -47,6 +48,58 @@ struct zfsmount { static struct zfsmount zfsmount __unused; /* + * The indirect_child_t represents the vdev that we will read from, when we + * need to read all copies of the data (e.g. for scrub or reconstruction). + * For plain (non-mirror) top-level vdevs (i.e. is_vdev is not a mirror), + * ic_vdev is the same as is_vdev. However, for mirror top-level vdevs, + * ic_vdev is a child of the mirror. + */ +typedef struct indirect_child { + void *ic_data; + vdev_t *ic_vdev; +} indirect_child_t; + +/* + * The indirect_split_t represents one mapped segment of an i/o to the + * indirect vdev. For non-split (contiguously-mapped) blocks, there will be + * only one indirect_split_t, with is_split_offset==0 and is_size==io_size. + * For split blocks, there will be several of these. + */ +typedef struct indirect_split { + list_node_t is_node; /* link on iv_splits */ + + /* + * is_split_offset is the offset into the i/o. + * This is the sum of the previous splits' is_size's. + */ + uint64_t is_split_offset; + + vdev_t *is_vdev; /* top-level vdev */ + uint64_t is_target_offset; /* offset on is_vdev */ + uint64_t is_size; + int is_children; /* number of entries in is_child[] */ + + /* + * is_good_child is the child that we are currently using to + * attempt reconstruction. + */ + int is_good_child; + + indirect_child_t is_child[1]; /* variable-length */ +} indirect_split_t; + +/* + * The indirect_vsd_t is associated with each i/o to the indirect vdev. + * It is the "Vdev-Specific Data" in the zio_t's io_vsd. + */ +typedef struct indirect_vsd { + boolean_t iv_split_block; + boolean_t iv_reconstruct; + + list_t iv_splits; /* list of indirect_split_t's */ +} indirect_vsd_t; + +/* * List of all vdevs, chained through v_alllink. */ static vdev_list_t zfs_vdevs; @@ -70,6 +123,8 @@ static const char *features_for_read[] = { "com.datto:encryption", "org.zfsonlinux:allocation_classes", "com.datto:resilver_defer", + "com.delphix:device_removal", + "com.delphix:obsolete_counts", NULL }; @@ -92,6 +147,18 @@ static int zfs_rlookup(const spa_t *spa, uint64_t objn static int zap_lookup(const spa_t *spa, const dnode_phys_t *dnode, const char *name, uint64_t integer_size, uint64_t num_integers, void *value); +static int objset_get_dnode(const spa_t *, const objset_phys_t *, uint64_t, + dnode_phys_t *); +static int dnode_read(const spa_t *, const dnode_phys_t *, off_t, void *, + size_t); +static int vdev_indirect_read(vdev_t *, const blkptr_t *, void *, off_t, + size_t); +static int vdev_mirror_read(vdev_t *, const blkptr_t *, void *, off_t, size_t); +vdev_indirect_mapping_t *vdev_indirect_mapping_open(spa_t *, objset_phys_t *, + uint64_t); +vdev_indirect_mapping_entry_phys_t * + vdev_indirect_mapping_duplicate_adjacent_entries(vdev_t *, uint64_t, + uint64_t, uint64_t *); static void zfs_init(void) @@ -161,7 +228,7 @@ xdr_uint64_t(const unsigned char **xdr, uint64_t *lp) static int nvlist_find(const unsigned char *nvlist, const char *name, int type, - int* elementsp, void *valuep) + int *elementsp, void *valuep) { const unsigned char *p, *pair; int junk; @@ -426,13 +493,500 @@ vdev_read_phys(vdev_t *vdev, const blkptr_t *bp, void rc = vdev->v_phys_read(vdev, vdev->v_read_priv, offset, buf, psize); if (rc) return (rc); - if (bp && zio_checksum_verify(vdev->spa, bp, buf)) - return (EIO); + if (bp != NULL) + return (zio_checksum_verify(vdev->spa, bp, buf)); return (0); } +typedef struct remap_segment { + vdev_t *rs_vd; + uint64_t rs_offset; + uint64_t rs_asize; + uint64_t rs_split_offset; + list_node_t rs_node; +} remap_segment_t; + +static remap_segment_t * +rs_alloc(vdev_t *vd, uint64_t offset, uint64_t asize, uint64_t split_offset) +{ + remap_segment_t *rs = malloc(sizeof (remap_segment_t)); + + if (rs != NULL) { + rs->rs_vd = vd; + rs->rs_offset = offset; + rs->rs_asize = asize; + rs->rs_split_offset = split_offset; + } + + return (rs); +} + +vdev_indirect_mapping_t * +vdev_indirect_mapping_open(spa_t *spa, objset_phys_t *os, + uint64_t mapping_object) +{ + vdev_indirect_mapping_t *vim; + vdev_indirect_mapping_phys_t *vim_phys; + int rc; + + vim = calloc(1, sizeof (*vim)); + if (vim == NULL) + return (NULL); + + vim->vim_dn = calloc(1, sizeof (*vim->vim_dn)); + if (vim->vim_dn == NULL) { + free(vim); + return (NULL); + } + + rc = objset_get_dnode(spa, os, mapping_object, vim->vim_dn); + if (rc != 0) { + free(vim->vim_dn); + free(vim); + return (NULL); + } + + vim->vim_spa = spa; + vim->vim_phys = malloc(sizeof (*vim->vim_phys)); + if (vim->vim_phys == NULL) { + free(vim->vim_dn); + free(vim); + return (NULL); + } + + vim_phys = (vdev_indirect_mapping_phys_t *)DN_BONUS(vim->vim_dn); + *vim->vim_phys = *vim_phys; + + vim->vim_objset = os; + vim->vim_object = mapping_object; + vim->vim_entries = NULL; + + vim->vim_havecounts = + (vim->vim_dn->dn_bonuslen > VDEV_INDIRECT_MAPPING_SIZE_V0); + return (vim); +} + +/* + * Compare an offset with an indirect mapping entry; there are three + * possible scenarios: + * + * 1. The offset is "less than" the mapping entry; meaning the + * offset is less than the source offset of the mapping entry. In + * this case, there is no overlap between the offset and the + * mapping entry and -1 will be returned. + * + * 2. The offset is "greater than" the mapping entry; meaning the + * offset is greater than the mapping entry's source offset plus + * the entry's size. In this case, there is no overlap between + * the offset and the mapping entry and 1 will be returned. + * + * NOTE: If the offset is actually equal to the entry's offset + * plus size, this is considered to be "greater" than the entry, + * and this case applies (i.e. 1 will be returned). Thus, the + * entry's "range" can be considered to be inclusive at its + * start, but exclusive at its end: e.g. [src, src + size). + * + * 3. The last case to consider is if the offset actually falls + * within the mapping entry's range. If this is the case, the + * offset is considered to be "equal to" the mapping entry and + * 0 will be returned. + * + * NOTE: If the offset is equal to the entry's source offset, + * this case applies and 0 will be returned. If the offset is + * equal to the entry's source plus its size, this case does + * *not* apply (see "NOTE" above for scenario 2), and 1 will be + * returned. + */ static int +dva_mapping_overlap_compare(const void *v_key, const void *v_array_elem) +{ + const uint64_t *key = v_key; + const vdev_indirect_mapping_entry_phys_t *array_elem = + v_array_elem; + uint64_t src_offset = DVA_MAPPING_GET_SRC_OFFSET(array_elem); + + if (*key < src_offset) { + return (-1); + } else if (*key < src_offset + DVA_GET_ASIZE(&array_elem->vimep_dst)) { + return (0); + } else { + return (1); + } +} + +/* + * Return array entry. + */ +static vdev_indirect_mapping_entry_phys_t * +vdev_indirect_mapping_entry(vdev_indirect_mapping_t *vim, uint64_t index) +{ + uint64_t size; + off_t offset = 0; + int rc; + + if (vim->vim_phys->vimp_num_entries == 0) + return (NULL); + + if (vim->vim_entries == NULL) { + uint64_t bsize; + + bsize = vim->vim_dn->dn_datablkszsec << SPA_MINBLOCKSHIFT; + size = vim->vim_phys->vimp_num_entries * + sizeof (*vim->vim_entries); + if (size > bsize) { + size = bsize / sizeof (*vim->vim_entries); + size *= sizeof (*vim->vim_entries); + } + vim->vim_entries = malloc(size); + if (vim->vim_entries == NULL) + return (NULL); + vim->vim_num_entries = size / sizeof (*vim->vim_entries); + offset = index * sizeof (*vim->vim_entries); + } + + /* We have data in vim_entries */ + if (offset == 0) { + if (index >= vim->vim_entry_offset && + index <= vim->vim_entry_offset + vim->vim_num_entries) { + index -= vim->vim_entry_offset; + return (&vim->vim_entries[index]); + } + offset = index * sizeof (*vim->vim_entries); + } + + vim->vim_entry_offset = index; + size = vim->vim_num_entries * sizeof (*vim->vim_entries); + rc = dnode_read(vim->vim_spa, vim->vim_dn, offset, vim->vim_entries, + size); + if (rc != 0) { + /* Read error, invalidate vim_entries. */ + free(vim->vim_entries); + vim->vim_entries = NULL; + return (NULL); + } + index -= vim->vim_entry_offset; + return (&vim->vim_entries[index]); +} + +/* + * Returns the mapping entry for the given offset. + * + * It's possible that the given offset will not be in the mapping table + * (i.e. no mapping entries contain this offset), in which case, the + * return value value depends on the "next_if_missing" parameter. + * + * If the offset is not found in the table and "next_if_missing" is + * B_FALSE, then NULL will always be returned. The behavior is intended + * to allow consumers to get the entry corresponding to the offset + * parameter, iff the offset overlaps with an entry in the table. + * + * If the offset is not found in the table and "next_if_missing" is + * B_TRUE, then the entry nearest to the given offset will be returned, + * such that the entry's source offset is greater than the offset + * passed in (i.e. the "next" mapping entry in the table is returned, if + * the offset is missing from the table). If there are no entries whose + * source offset is greater than the passed in offset, NULL is returned. + */ +static vdev_indirect_mapping_entry_phys_t * +vdev_indirect_mapping_entry_for_offset(vdev_indirect_mapping_t *vim, + uint64_t offset) +{ + ASSERT(vim->vim_phys->vimp_num_entries > 0); + + vdev_indirect_mapping_entry_phys_t *entry; + + uint64_t last = vim->vim_phys->vimp_num_entries - 1; + uint64_t base = 0; + + /* + * We don't define these inside of the while loop because we use + * their value in the case that offset isn't in the mapping. + */ + uint64_t mid; + int result; + + while (last >= base) { + mid = base + ((last - base) >> 1); + + entry = vdev_indirect_mapping_entry(vim, mid); + if (entry == NULL) + break; + result = dva_mapping_overlap_compare(&offset, entry); + + if (result == 0) { + break; + } else if (result < 0) { + last = mid - 1; + } else { + base = mid + 1; + } + } + return (entry); +} + +/* + * Given an indirect vdev and an extent on that vdev, it duplicates the + * physical entries of the indirect mapping that correspond to the extent + * to a new array and returns a pointer to it. In addition, copied_entries + * is populated with the number of mapping entries that were duplicated. + * + * Finally, since we are doing an allocation, it is up to the caller to + * free the array allocated in this function. + */ +vdev_indirect_mapping_entry_phys_t * +vdev_indirect_mapping_duplicate_adjacent_entries(vdev_t *vd, uint64_t offset, + uint64_t asize, uint64_t *copied_entries) +{ + vdev_indirect_mapping_entry_phys_t *duplicate_mappings = NULL; + vdev_indirect_mapping_t *vim = vd->v_mapping; + uint64_t entries = 0; + + vdev_indirect_mapping_entry_phys_t *first_mapping = + vdev_indirect_mapping_entry_for_offset(vim, offset); + ASSERT3P(first_mapping, !=, NULL); + + vdev_indirect_mapping_entry_phys_t *m = first_mapping; + while (asize > 0) { + uint64_t size = DVA_GET_ASIZE(&m->vimep_dst); + uint64_t inner_offset = offset - DVA_MAPPING_GET_SRC_OFFSET(m); + uint64_t inner_size = MIN(asize, size - inner_offset); + + offset += inner_size; + asize -= inner_size; + entries++; + m++; + } + + size_t copy_length = entries * sizeof (*first_mapping); + duplicate_mappings = malloc(copy_length); + if (duplicate_mappings != NULL) + bcopy(first_mapping, duplicate_mappings, copy_length); + else + entries = 0; + + *copied_entries = entries; + + return (duplicate_mappings); +} + +static vdev_t * +vdev_lookup_top(spa_t *spa, uint64_t vdev) +{ + vdev_t *rvd; + + STAILQ_FOREACH(rvd, &spa->spa_vdevs, v_childlink) + if (rvd->v_id == vdev) + break; + + return (rvd); +} + +/* + * This is a callback for vdev_indirect_remap() which allocates an + * indirect_split_t for each split segment and adds it to iv_splits. + */ +static void +vdev_indirect_gather_splits(uint64_t split_offset, vdev_t *vd, uint64_t offset, + uint64_t size, void *arg) +{ + int n = 1; + zio_t *zio = arg; + indirect_vsd_t *iv = zio->io_vsd; + + if (vd->v_read == vdev_indirect_read) + return; + + if (vd->v_read == vdev_mirror_read) + n = vd->v_nchildren; + + indirect_split_t *is = + malloc(offsetof(indirect_split_t, is_child[n])); + if (is == NULL) { + zio->io_error = ENOMEM; + return; + } + bzero(is, offsetof(indirect_split_t, is_child[n])); + + is->is_children = n; + is->is_size = size; + is->is_split_offset = split_offset; + is->is_target_offset = offset; + is->is_vdev = vd; + + /* + * Note that we only consider multiple copies of the data for + * *mirror* vdevs. We don't for "replacing" or "spare" vdevs, even + * though they use the same ops as mirror, because there's only one + * "good" copy under the replacing/spare. + */ + if (vd->v_read == vdev_mirror_read) { + int i = 0; + vdev_t *kid; + + STAILQ_FOREACH(kid, &vd->v_children, v_childlink) { + is->is_child[i++].ic_vdev = kid; + } + } else { + is->is_child[0].ic_vdev = vd; + } + + list_insert_tail(&iv->iv_splits, is); +} + +static void +vdev_indirect_remap(vdev_t *vd, uint64_t offset, uint64_t asize, void *arg) +{ + list_t stack; + spa_t *spa = vd->spa; + + list_create(&stack, sizeof (remap_segment_t), + offsetof(remap_segment_t, rs_node)); + + for (remap_segment_t *rs = rs_alloc(vd, offset, asize, 0); + rs != NULL; rs = list_remove_head(&stack)) { + vdev_t *v = rs->rs_vd; + uint64_t num_entries = 0; + /* vdev_indirect_mapping_t *vim = v->v_mapping; */ + vdev_indirect_mapping_entry_phys_t *mapping = + vdev_indirect_mapping_duplicate_adjacent_entries(v, + rs->rs_offset, rs->rs_asize, &num_entries); + + for (uint64_t i = 0; i < num_entries; i++) { + vdev_indirect_mapping_entry_phys_t *m = &mapping[i]; + uint64_t size = DVA_GET_ASIZE(&m->vimep_dst); + uint64_t dst_offset = DVA_GET_OFFSET(&m->vimep_dst); + uint64_t dst_vdev = DVA_GET_VDEV(&m->vimep_dst); + uint64_t inner_offset = rs->rs_offset - + DVA_MAPPING_GET_SRC_OFFSET(m); + uint64_t inner_size = + MIN(rs->rs_asize, size - inner_offset); + vdev_t *dst_v = vdev_lookup_top(spa, dst_vdev); + + if (dst_v->v_read == vdev_indirect_read) { + list_insert_head(&stack, + rs_alloc(dst_v, dst_offset + inner_offset, + inner_size, rs->rs_split_offset)); + } + vdev_indirect_gather_splits(rs->rs_split_offset, dst_v, + dst_offset + inner_offset, + inner_size, arg); + + rs->rs_offset += inner_size; + rs->rs_asize -= inner_size; + rs->rs_split_offset += inner_size; + } + + free(mapping); + free(rs); + } + + list_destroy(&stack); +} + +static void +vdev_indirect_map_free(zio_t *zio) +{ + indirect_vsd_t *iv = zio->io_vsd; + indirect_split_t *is; + + while ((is = list_head(&iv->iv_splits)) != NULL) { + for (int c = 0; c < is->is_children; c++) { + indirect_child_t *ic = &is->is_child[c]; + free(ic->ic_data); + } + list_remove(&iv->iv_splits, is); + free(is); + } + free(iv); +} + +static int +vdev_indirect_read(vdev_t *vdev, const blkptr_t *bp, void *buf, + off_t offset, size_t bytes) +{ + zio_t zio = { 0 }; + spa_t *spa = vdev->spa; + indirect_vsd_t *iv = malloc(sizeof (*iv)); + indirect_split_t *first; + int rc = EIO; + + if (iv == NULL) + return (ENOMEM); + bzero(iv, sizeof (*iv)); + + list_create(&iv->iv_splits, + sizeof (indirect_split_t), offsetof(indirect_split_t, is_node)); + + zio.io_spa = spa; + zio.io_bp = (blkptr_t *)bp; + zio.io_data = buf; + zio.io_size = bytes; + zio.io_offset = offset; + zio.io_vd = vdev; + zio.io_vsd = iv; + + if (vdev->v_mapping == NULL) { + vdev_indirect_config_t *vic; + + vic = &vdev->vdev_indirect_config; + vdev->v_mapping = vdev_indirect_mapping_open(spa, + &spa->spa_mos, vic->vic_mapping_object); + } + + vdev_indirect_remap(vdev, offset, bytes, &zio); + + first = list_head(&iv->iv_splits); + if (first->is_size == zio.io_size) { + /* + * This is not a split block; we are pointing to the entire + * data, which will checksum the same as the original data. + * Pass the BP down so that the child i/o can verify the + * checksum, and try a different location if available + * (e.g. on a mirror). + * + * While this special case could be handled the same as the + * general (split block) case, doing it this way ensures + * that the vast majority of blocks on indirect vdevs + * (which are not split) are handled identically to blocks + * on non-indirect vdevs. This allows us to be less strict + * about performance in the general (but rare) case. + */ + rc = first->is_vdev->v_read(first->is_vdev, zio.io_bp, + zio.io_data, first->is_target_offset, bytes); + } else { + iv->iv_split_block = B_TRUE; + /* + * Read one copy of each split segment, from the + * top-level vdev. Since we don't know the + * checksum of each split individually, the child + * zio can't ensure that we get the right data. + * E.g. if it's a mirror, it will just read from a + * random (healthy) leaf vdev. We have to verify + * the checksum in vdev_indirect_io_done(). + */ + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + char *ptr = zio.io_data; + + rc = is->is_vdev->v_read(is->is_vdev, zio.io_bp, + ptr + is->is_split_offset, is->is_target_offset, + is->is_size); + } + if (zio_checksum_verify(spa, zio.io_bp, zio.io_data)) + rc = ECKSUM; + else + rc = 0; + } + + vdev_indirect_map_free(&zio); + if (rc == 0) + rc = zio.io_error; + + return (rc); +} + +static int vdev_disk_read(vdev_t *vdev, const blkptr_t *bp, void *buf, off_t offset, size_t bytes) { @@ -498,6 +1052,7 @@ static vdev_t * vdev_create(uint64_t guid, vdev_read_t *_read) { vdev_t *vdev; + vdev_indirect_config_t *vic; vdev = malloc(sizeof(vdev_t)); memset(vdev, 0, sizeof(vdev_t)); @@ -505,8 +1060,9 @@ vdev_create(uint64_t guid, vdev_read_t *_read) vdev->v_guid = guid; vdev->v_state = VDEV_STATE_OFFLINE; vdev->v_read = _read; - vdev->v_phys_read = 0; - vdev->v_read_priv = 0; + + vic = &vdev->vdev_indirect_config; + vic->vic_prev_indirect_vdev = UINT64_MAX; STAILQ_INSERT_TAIL(&zfs_vdevs, vdev, v_alllink); return (vdev); @@ -540,6 +1096,7 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vde && strcmp(type, VDEV_TYPE_FILE) #endif && strcmp(type, VDEV_TYPE_RAIDZ) + && strcmp(type, VDEV_TYPE_INDIRECT) && strcmp(type, VDEV_TYPE_REPLACING)) { printf("ZFS: can only boot from disk, mirror, raidz1, raidz2 and raidz3 vdevs\n"); return (EIO); @@ -568,7 +1125,23 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vde vdev = vdev_create(guid, vdev_raidz_read); else if (!strcmp(type, VDEV_TYPE_REPLACING)) vdev = vdev_create(guid, vdev_replacing_read); - else + else if (!strcmp(type, VDEV_TYPE_INDIRECT)) { + vdev_indirect_config_t *vic; + + vdev = vdev_create(guid, vdev_indirect_read); + vdev->v_state = VDEV_STATE_HEALTHY; + vic = &vdev->vdev_indirect_config; + + nvlist_find(nvlist, + ZPOOL_CONFIG_INDIRECT_OBJECT, DATA_TYPE_UINT64, + NULL, &vic->vic_mapping_object); + nvlist_find(nvlist, + ZPOOL_CONFIG_INDIRECT_BIRTHS, DATA_TYPE_UINT64, + NULL, &vic->vic_births_object); + nvlist_find(nvlist, + ZPOOL_CONFIG_PREV_INDIRECT_VDEV, DATA_TYPE_UINT64, + NULL, &vic->vic_prev_indirect_vdev); + } else vdev = vdev_create(guid, vdev_disk_read); vdev->v_id = id; @@ -591,20 +1164,24 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vde path += 5; vdev->v_name = strdup(path); } else { + char *name; + if (!strcmp(type, "raidz")) { - if (vdev->v_nparity == 1) - vdev->v_name = "raidz1"; - else if (vdev->v_nparity == 2) - vdev->v_name = "raidz2"; - else if (vdev->v_nparity == 3) - vdev->v_name = "raidz3"; - else { - printf("ZFS: can only boot from disk, mirror, raidz1, raidz2 and raidz3 vdevs\n"); + if (vdev->v_nparity < 1 || + vdev->v_nparity > 3) { + printf("ZFS: can only boot from disk, " + "mirror, raidz1, raidz2 and raidz3 " + "vdevs\n"); return (EIO); } + asprintf(&name, "%s%d-%jd", type, + vdev->v_nparity, id); } else { - vdev->v_name = strdup(type); + asprintf(&name, "%s-%jd", type, id); } + if (name == NULL) + return (ENOMEM); + vdev->v_name = name; } } else { is_new = 0; @@ -2227,11 +2804,49 @@ check_mos_features(const spa_t *spa) } static int -zfs_spa_init(spa_t *spa) +load_nvlist(spa_t *spa, uint64_t obj, unsigned char **value) { dnode_phys_t dir; + size_t size; int rc; + unsigned char *nv; + *value = NULL; + if ((rc = objset_get_dnode(spa, &spa->spa_mos, obj, &dir)) != 0) + return (rc); + if (dir.dn_type != DMU_OT_PACKED_NVLIST && + dir.dn_bonustype != DMU_OT_PACKED_NVLIST_SIZE) { + return (EIO); + } + + if (dir.dn_bonuslen != sizeof (uint64_t)) + return (EIO); + + size = *(uint64_t *)DN_BONUS(&dir); + nv = malloc(size); + if (nv == NULL) + return (ENOMEM); + + rc = dnode_read(spa, &dir, 0, nv, size); + if (rc != 0) { + free(nv); + nv = NULL; + return (rc); + } + *value = nv; + return (rc); +} + +static int +zfs_spa_init(spa_t *spa) +{ + dnode_phys_t dir; + uint64_t config_object; + unsigned char *nvlist; + char *type; + const unsigned char *nv; + int nkids, rc; + if (zio_read(spa, &spa->spa_uberblock.ub_rootbp, &spa->spa_mos)) { printf("ZFS: can't read MOS of pool %s\n", spa->spa_name); return (EIO); @@ -2255,8 +2870,77 @@ zfs_spa_init(spa_t *spa) rc = check_mos_features(spa); if (rc != 0) { printf("ZFS: pool %s is not supported\n", spa->spa_name); + return (rc); } + rc = zap_lookup(spa, &dir, DMU_POOL_CONFIG, + sizeof (config_object), 1, &config_object); + if (rc != 0) { + printf("ZFS: can not read MOS %s\n", DMU_POOL_CONFIG); + return (EIO); + } + rc = load_nvlist(spa, config_object, &nvlist); + if (rc != 0) + return (rc); + + /* Update vdevs from MOS config. */ + if (nvlist_find(nvlist + 4, ZPOOL_CONFIG_VDEV_TREE, DATA_TYPE_NVLIST, + NULL, &nv)) { + rc = EIO; + goto done; + } + + if (nvlist_find(nv, ZPOOL_CONFIG_TYPE, DATA_TYPE_STRING, + NULL, &type)) { + printf("ZFS: can't find vdev details\n"); + rc = ENOENT; + goto done; + } + if (strcmp(type, VDEV_TYPE_ROOT) != 0) { + rc = ENOENT; + goto done; + } + + rc = nvlist_find(nv, ZPOOL_CONFIG_CHILDREN, DATA_TYPE_NVLIST_ARRAY, + &nkids, &nv); + if (rc != 0) + goto done; + + for (int i = 0; i < nkids; i++) { + vdev_t *vd, *prev, *kid = NULL; + rc = vdev_init_from_nvlist(nv, NULL, &kid, 0); + if (rc != 0) { + printf("vdev_init_from_nvlist: %d\n", rc); + break; + } + kid->spa = spa; + prev = NULL; + STAILQ_FOREACH(vd, &spa->spa_vdevs, v_childlink) { + /* Already present? */ + if (kid->v_id == vd->v_id) { + kid = NULL; + break; + } + if (vd->v_id > kid->v_id) { + if (prev == NULL) { + STAILQ_INSERT_HEAD(&spa->spa_vdevs, + kid, v_childlink); + } else { + STAILQ_INSERT_AFTER(&spa->spa_vdevs, + prev, kid, v_childlink); + } + kid = NULL; + break; + } + prev = vd; + } + if (kid != NULL) + STAILQ_INSERT_TAIL(&spa->spa_vdevs, kid, v_childlink); + nv = nvlist_next(nv); + } + rc = 0; +done: + free(nvlist); return (rc); } Modified: head/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- head/sys/cddl/boot/zfs/zfsimpl.h Thu Aug 8 18:00:37 2019 (r350771) +++ head/sys/cddl/boot/zfs/zfsimpl.h Thu Aug 8 18:08:13 2019 (r350772) @@ -715,6 +715,9 @@ typedef enum { #define ZPOOL_CONFIG_CHILDREN "children" #define ZPOOL_CONFIG_ID "id" #define ZPOOL_CONFIG_GUID "guid" +#define ZPOOL_CONFIG_INDIRECT_OBJECT "com.delphix:indirect_object" +#define ZPOOL_CONFIG_INDIRECT_BIRTHS "com.delphix:indirect_births" +#define ZPOOL_CONFIG_PREV_INDIRECT_VDEV "com.delphix:prev_indirect_vdev" #define ZPOOL_CONFIG_PATH "path" #define ZPOOL_CONFIG_DEVID "devid" #define ZPOOL_CONFIG_METASLAB_ARRAY "metaslab_array" @@ -758,6 +761,7 @@ typedef enum { #define VDEV_TYPE_SPARE "spare" #define VDEV_TYPE_LOG "log" #define VDEV_TYPE_L2CACHE "l2cache" +#define VDEV_TYPE_INDIRECT "indirect" /* * This is needed in userland to report the minimum necessary device size. @@ -850,7 +854,7 @@ struct uberblock { */ #define DNODE_SHIFT 9 /* 512 bytes */ #define DN_MIN_INDBLKSHIFT 12 /* 4k */ -#define DN_MAX_INDBLKSHIFT 14 /* 16k */ +#define DN_MAX_INDBLKSHIFT 17 /* 128k */ #define DNODE_BLOCK_SHIFT 14 /* 16k */ #define DNODE_CORE_SIZE 64 /* 64 bytes for dnode sans blkptrs */ #define DN_MAX_OBJECT_SHIFT 48 /* 256 trillion (zfs_fid_t limit) */ @@ -1217,6 +1221,9 @@ typedef struct dsl_dataset_phys { #define DMU_POOL_HISTORY "history" #define DMU_POOL_PROPS "pool_props" #define DMU_POOL_CHECKSUM_SALT "org.illumos:checksum_salt" +#define DMU_POOL_REMOVING "com.delphix:removing" +#define DMU_POOL_OBSOLETE_BPOBJ "com.delphix:obsolete_bpobj" +#define DMU_POOL_CONDENSING_INDIRECT "com.delphix:condensing_indirect" #define ZAP_MAGIC 0x2F52AB2ABULL @@ -1530,6 +1537,116 @@ typedef int vdev_read_t(struct vdev *vdev, const blkpt typedef STAILQ_HEAD(vdev_list, vdev) vdev_list_t; +typedef struct vdev_indirect_mapping_entry_phys { + /* + * Decode with DVA_MAPPING_* macros. + * Contains: + * the source offset (low 63 bits) + * the one-bit "mark", used for garbage collection (by zdb) + */ + uint64_t vimep_src; + + /* + * Note: the DVA's asize is 24 bits, and can thus store ranges + * up to 8GB. + */ + dva_t vimep_dst; +} vdev_indirect_mapping_entry_phys_t; + +#define DVA_MAPPING_GET_SRC_OFFSET(vimep) \ + BF64_GET_SB((vimep)->vimep_src, 0, 63, SPA_MINBLOCKSHIFT, 0) +#define DVA_MAPPING_SET_SRC_OFFSET(vimep, x) \ + BF64_SET_SB((vimep)->vimep_src, 0, 63, SPA_MINBLOCKSHIFT, 0, x) + +typedef struct vdev_indirect_mapping_entry { + vdev_indirect_mapping_entry_phys_t vime_mapping; + uint32_t vime_obsolete_count; + list_node_t vime_node; +} vdev_indirect_mapping_entry_t; + +/* + * This is stored in the bonus buffer of the mapping object, see comment of + * vdev_indirect_config for more details. + */ +typedef struct vdev_indirect_mapping_phys { + uint64_t vimp_max_offset; + uint64_t vimp_bytes_mapped; + uint64_t vimp_num_entries; /* number of v_i_m_entry_phys_t's */ + + /* + * For each entry in the mapping object, this object contains an + * entry representing the number of bytes of that mapping entry + * that were no longer in use by the pool at the time this indirect + * vdev was last condensed. + */ + uint64_t vimp_counts_object; +} vdev_indirect_mapping_phys_t; + +#define VDEV_INDIRECT_MAPPING_SIZE_V0 (3 * sizeof (uint64_t)) + +typedef struct vdev_indirect_mapping { + uint64_t vim_object; + boolean_t vim_havecounts; + + /* vim_entries segment offset currently in memory. */ + uint64_t vim_entry_offset; + /* vim_entries segment size. */ + size_t vim_num_entries; + + /* Needed by dnode_read() */ + const void *vim_spa; + dnode_phys_t *vim_dn; + + /* + * An ordered array of mapping entries, sorted by source offset. + * Note that vim_entries is needed during a removal (and contains + * mappings that have been synced to disk so far) to handle frees + * from the removing device. + */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Aug 8 19:49:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC9BEB1076; Thu, 8 Aug 2019 19:49:12 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464Jpv4DZ6z4mqr; Thu, 8 Aug 2019 19:49:11 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-ot1-f51.google.com with SMTP id l15so66224233oth.7; Thu, 08 Aug 2019 12:49:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=L+tMFQfDDFLQBXM2tgaYOrvkfEybiz+VsLOTxXdXZEk=; b=Zt2gqSNOVM6O1BSXEyYfyDl5DtPWhXU6rLDO1hhFD7+XEWcytfaiZKas1jAX3wPBrF iR4Z/4QScGTIJTEpiKWYUi8K0546bIAA6MBP3BHHnkxQEQZe5zsCwztOhyNmEffMl4U4 f1h0KKycu2Ij6Sd83eCFlwWo/7ONzMnZLBt766JMA0l1YOupiiKSXvLSmzhqItIgUbRK /ADM9EglgPseZt1qeEplyn6ai8TH1c3QSpPAhFX0R3/7Uye82KwKcrsK/5XEv7l4/MAg 9TXHU93vHjmVHJ0LM2KRf/EYrAXDhn7+tWllp6hORZghk0tdN0XPWjpeCFp53kttBfmg Xa5Q== X-Gm-Message-State: APjAAAX7GqVRnodGwYgIwH0wO193uhXvoIpT/ktr8FY8eDSYYOhCXhXg RnDerfJE8hyxKRnXIwG669fuIUiY7Z6fJFlj7SXlMQ== X-Google-Smtp-Source: APXvYqwldHHqVNhunSwwVh5+JkoOVGX/wjFpBEWjBhykL9bBrB5imr2Yomg/sL7TkDnle9QvEn3xdF/WcjpivYOeTLY= X-Received: by 2002:a02:aa0d:: with SMTP id r13mr18639173jam.129.1565293749602; Thu, 08 Aug 2019 12:49:09 -0700 (PDT) MIME-Version: 1.0 References: <201908071619.x77GJ6qq067924@repo.freebsd.org> In-Reply-To: <201908071619.x77GJ6qq067924@repo.freebsd.org> From: Ed Maste Date: Thu, 8 Aug 2019 01:52:19 -0400 Message-ID: Subject: Re: svn commit: r350678 - head/share/mk To: Warner Losh Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 464Jpv4DZ6z4mqr X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.210.51 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [-4.43 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[freebsd.org]; RWL_MAILSPIKE_GOOD(0.00)[51.210.85.209.rep.mailspike.net : 127.0.0.18]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-1.44)[ip: (-1.34), ipnet: 209.85.128.0/17(-3.38), asn: 15169(-2.43), country: US(-0.05)]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.99)[-0.993,0]; RCVD_IN_DNSWL_NONE(0.00)[51.210.85.209.list.dnswl.org : 127.0.5.0]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 19:49:12 -0000 On Wed, 7 Aug 2019 at 12:19, Warner Losh wrote: > > Author: imp > Date: Wed Aug 7 16:19:06 2019 > New Revision: 350678 > URL: https://svnweb.freebsd.org/changeset/base/350678 > > Log: > Enable nvme on aarch64 > > Don't mark nvme as broken on aarch64. It compiles, at least, and people are > testing it out. This only enables the userland parts of the nvme stack. For BROKEN_OPTIONS we should probably list the archs where it is known to be broken instead? From owner-svn-src-head@freebsd.org Thu Aug 8 19:53:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29005B12C9; Thu, 8 Aug 2019 19:53:08 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464JvS0HcVz4nD4; Thu, 8 Aug 2019 19:53:08 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0359248B; Thu, 8 Aug 2019 19:53:07 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78Jr7tg062675; Thu, 8 Aug 2019 19:53:07 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78Jr7XW062674; Thu, 8 Aug 2019 19:53:07 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201908081953.x78Jr7XW062674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 8 Aug 2019 19:53:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350776 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 350776 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 19:53:08 -0000 Author: rmacklem Date: Thu Aug 8 19:53:07 2019 New Revision: 350776 URL: https://svnweb.freebsd.org/changeset/base/350776 Log: Fix copy_file_range(2) for an unlikely race during hole finding. Since the VOP_IOCTL(FIOSEEKDATA/FIOSEEKHOLE) calls are done with the vnode unlocked, it is possible for another thread to do: - truncate(), lseek(), write() between the two calls and create a hole where FIOSEEKDATA returned the start of data. For this case, VOP_IOCTL(FIOSEEKHOLE) will return the same offset for the hole location. This could result in an infinite loop in the copy code, since copylen is set to 0 and the copy doesn't advance. Usually, this race is avoided because of the use of rangelocks, but the NFS server does not do range locking and could do a sequence like the above to create the hole. This patch checks for this case and makes the hole search fail, to avoid the infinite loop. At this time, it is an open question as to whether or not the NFS server should do range locking to avoid this race. Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Thu Aug 8 18:52:53 2019 (r350775) +++ head/sys/kern/vfs_vnops.c Thu Aug 8 19:53:07 2019 (r350776) @@ -2895,6 +2895,17 @@ vn_generic_copy_file_range(struct vnode *invp, off_t * endoff = startoff; error = VOP_IOCTL(invp, FIOSEEKHOLE, &endoff, 0, incred, curthread); + /* + * Since invp is unlocked, it may be possible for + * another thread to do a truncate(), lseek(), write() + * creating a hole at startoff between the above + * VOP_IOCTL() calls, if the other thread does not do + * rangelocking. + * If that happens, startoff == endoff and finding + * the hole has failed, so set an error. + */ + if (error == 0 && startoff == endoff) + error = EINVAL; /* Any error. Reset to 0. */ } if (error == 0) { if (startoff > *inoffp) { From owner-svn-src-head@freebsd.org Thu Aug 8 20:07:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 989E5B159B; Thu, 8 Aug 2019 20:07:39 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464KDC3Y2Qz4nmm; Thu, 8 Aug 2019 20:07:39 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B8E62665; Thu, 8 Aug 2019 20:07:39 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78K7dRb068997; Thu, 8 Aug 2019 20:07:39 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78K7dLB068996; Thu, 8 Aug 2019 20:07:39 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201908082007.x78K7dLB068996@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 8 Aug 2019 20:07:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350777 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 350777 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 20:07:39 -0000 Author: rmacklem Date: Thu Aug 8 20:07:38 2019 New Revision: 350777 URL: https://svnweb.freebsd.org/changeset/base/350777 Log: Remove some harmless cruft from vn_generic_copy_file_range(). An earlier version of the patch had code that set "error" between line#s 2797-2799. When that code was moved, the second check for "error != 0" could never be true and the check became harmless cruft. This patch removes the cruft, mainly to make Coverity happy. Reported by: asomers, cem Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Thu Aug 8 19:53:07 2019 (r350776) +++ head/sys/kern/vfs_vnops.c Thu Aug 8 20:07:38 2019 (r350777) @@ -2798,8 +2798,6 @@ vn_generic_copy_file_range(struct vnode *invp, off_t * if (VOP_PATHCONF(invp, _PC_MIN_HOLE_SIZE, &holein) != 0) holein = 0; VOP_UNLOCK(invp, 0); - if (error != 0) - goto out; mp = NULL; error = vn_start_write(outvp, &mp, V_WAIT); From owner-svn-src-head@freebsd.org Thu Aug 8 20:09:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 75762B166E; Thu, 8 Aug 2019 20:09:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464KGT2Vk1z4p1S; Thu, 8 Aug 2019 20:09:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3894E2673; Thu, 8 Aug 2019 20:09:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78K9b94069232; Thu, 8 Aug 2019 20:09:37 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78K9bCV069231; Thu, 8 Aug 2019 20:09:37 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908082009.x78K9bCV069231@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 8 Aug 2019 20:09:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350778 - head/sys/contrib/zstd/lib/common X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/contrib/zstd/lib/common X-SVN-Commit-Revision: 350778 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 20:09:37 -0000 Author: imp Date: Thu Aug 8 20:09:36 2019 New Revision: 350778 URL: https://svnweb.freebsd.org/changeset/base/350778 Log: Stopgap fix for gcc platforms. Our in-tree gcc doesn't have a no-tree-vectorize optimization knob, so we get a warning that it's unused. This causes the build to fail on all our gcc platforms. Add a quick version check as a stop-gap measure to get CI building again. Modified: head/sys/contrib/zstd/lib/common/compiler.h Modified: head/sys/contrib/zstd/lib/common/compiler.h ============================================================================== --- head/sys/contrib/zstd/lib/common/compiler.h Thu Aug 8 20:07:38 2019 (r350777) +++ head/sys/contrib/zstd/lib/common/compiler.h Thu Aug 8 20:09:36 2019 (r350778) @@ -128,7 +128,7 @@ } /* vectorization */ -#if !defined(__clang__) && defined(__GNUC__) +#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ > 5 # define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize"))) #else # define DONT_VECTORIZE From owner-svn-src-head@freebsd.org Thu Aug 8 20:56:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6C47B278A; Thu, 8 Aug 2019 20:56:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464LK14fypz4r7T; Thu, 8 Aug 2019 20:56:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81BC92F68; Thu, 8 Aug 2019 20:56:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78Kur3j098321; Thu, 8 Aug 2019 20:56:53 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78Kurvi098320; Thu, 8 Aug 2019 20:56:53 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908082056.x78Kurvi098320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 8 Aug 2019 20:56:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350779 - head/sbin/iscontrol X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sbin/iscontrol X-SVN-Commit-Revision: 350779 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 20:56:53 -0000 Author: markj Date: Thu Aug 8 20:56:52 2019 New Revision: 350779 URL: https://svnweb.freebsd.org/changeset/base/350779 Log: Fix formatting. PR: 239726 Submitted by: Gordon Bergling MFC after: 3 days Modified: head/sbin/iscontrol/iscontrol.8 Modified: head/sbin/iscontrol/iscontrol.8 ============================================================================== --- head/sbin/iscontrol/iscontrol.8 Thu Aug 8 20:09:36 2019 (r350778) +++ head/sbin/iscontrol/iscontrol.8 Thu Aug 8 20:56:52 2019 (r350779) @@ -129,7 +129,7 @@ RFC 3720 The .Nm utility appeared in -Fx 7.0 . +.Fx 7.0 . .Sh BUGS .Nm should probably load the iscsi_initiator module if needed. From owner-svn-src-head@freebsd.org Thu Aug 8 21:08:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DE80B2C01; Thu, 8 Aug 2019 21:08:14 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464LZ60RJYz4rmv; Thu, 8 Aug 2019 21:08:14 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E622D3148; Thu, 8 Aug 2019 21:08:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78L8D5t004931; Thu, 8 Aug 2019 21:08:13 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78L8Dnx004930; Thu, 8 Aug 2019 21:08:13 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908082108.x78L8Dnx004930@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 8 Aug 2019 21:08:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350780 - head/usr.sbin/mountd X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/usr.sbin/mountd X-SVN-Commit-Revision: 350780 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 21:08:14 -0000 Author: markj Date: Thu Aug 8 21:08:13 2019 New Revision: 350780 URL: https://svnweb.freebsd.org/changeset/base/350780 Log: Add a reference to the NFSv3 RFC. PR: 239721 Submitted by: Gordon Bergling MFC after: 3 days Modified: head/usr.sbin/mountd/mountd.8 Modified: head/usr.sbin/mountd/mountd.8 ============================================================================== --- head/usr.sbin/mountd/mountd.8 Thu Aug 8 20:56:52 2019 (r350779) +++ head/usr.sbin/mountd/mountd.8 Thu Aug 8 21:08:13 2019 (r350780) @@ -28,7 +28,7 @@ .\" @(#)mountd.8 8.4 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd October 24, 2016 +.Dd August 1, 2019 .Dt MOUNTD 8 .Os .Sh NAME @@ -54,7 +54,7 @@ server specification; see .%T "Network File System Protocol Specification" , RFC1094, Appendix A and .%T "NFS: Network File System Version 3 Protocol Specification" , -Appendix I. +RFC1813, Appendix I. .Pp The following options are available: .Bl -tag -width indent From owner-svn-src-head@freebsd.org Thu Aug 8 21:13:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2FA8AB2F04 for ; Thu, 8 Aug 2019 21:13:05 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464Lgh2r59z4sDh for ; Thu, 8 Aug 2019 21:13:04 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x832.google.com with SMTP id d17so14806768qtj.8 for ; Thu, 08 Aug 2019 14:13:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AxVcmUF62D0g/P7OQHs5QkDB6mbefUoPRNw7HPLuA68=; b=i2wCZieinXNrNxUO5J/aN/338mP+X61QBjmn7J/OFcBwQqe2qnlOuCs/qniq/IRtM6 PhQJezHEziQFEzehphv0wVDKk2FKwoPypt03ni6A77KbjKMaDV/QZTf5Ys2rl8VkreXn 8KC7MK+agGHprfCCNB3kij1x3QDKo8TFRkhAMw7EIHpeS/7gqUaf48/m7uPK3MlRntx9 jSrgIZ5SjWwHFIL4piXyHQXQkCSiv3po4faHKVKfR6u1WIGd0VGjeMQ7jvaFJe2b/zMQ +Jm05LZnXGCd1AJSQlIee9QGTblC8NqzrKJq3JImUP5gOOcrh2ltE52A37A9V85T5Hd1 gcaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AxVcmUF62D0g/P7OQHs5QkDB6mbefUoPRNw7HPLuA68=; b=UJJeQ9sfX94Gt55BDyyhB8NusJI+tqrV/Dyhi94vLdjAmN7krtJ2H3q/Bvm1AjyYKQ SoNEbW8AgeclJc4lUtr7aPZyk1MAtlPR7zLJ3GmqHTzE9zoyfsW0gsq1Lnp2Cxxr20Y0 KPjp32oVd7kZ2voEgryQU697MQZ0I3pAcsqmai3riHrkuBzgThiJ9aBx3LoVUWwqw3St FxhpzQsY+O6f35qbsyHg6Jd7aykCJd35vAUr5xJOW01gutmE4wa06lv6nMsxvLdbpFDh 6vU4HjchVhfQ6jQCjFUmJiRMZ4A32+sp7XJXd8yuZ9zCBzlz4h4OoaekvpR3rjRp1Ir4 bAjA== X-Gm-Message-State: APjAAAV2IxxaMyJzTa/xill1J9oHsZgIvF4zkBOUImZXNgdq3zTBYtYs U3nD2bdVN+2fh7V1xE3pLRx1aynUUkd9TZxbT7uOig== X-Google-Smtp-Source: APXvYqxrMYhpNLzmMP2EAJnr219F1zkcHhQBzj1diLoh+9NlRvHC06zxjBmdcKVRBZmijBvULLLwPEuQvA/xjBtCB40= X-Received: by 2002:ac8:244f:: with SMTP id d15mr14359491qtd.32.1565298783430; Thu, 08 Aug 2019 14:13:03 -0700 (PDT) MIME-Version: 1.0 References: <201908071619.x77GJ6qq067924@repo.freebsd.org> In-Reply-To: From: Warner Losh Date: Thu, 8 Aug 2019 15:12:52 -0600 Message-ID: Subject: Re: svn commit: r350678 - head/share/mk To: Ed Maste Cc: Warner Losh , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 464Lgh2r59z4sDh X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=i2wCZiei; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::832) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.98 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.99)[-0.991,0]; RCVD_IN_DNSWL_NONE(0.00)[2.3.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.98)[ip: (-9.41), ipnet: 2607:f8b0::/32(-3.03), asn: 15169(-2.43), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 21:13:05 -0000 On Thu, Aug 8, 2019 at 1:49 PM Ed Maste wrote: > On Wed, 7 Aug 2019 at 12:19, Warner Losh wrote: > > > > Author: imp > > Date: Wed Aug 7 16:19:06 2019 > > New Revision: 350678 > > URL: https://svnweb.freebsd.org/changeset/base/350678 > > > > Log: > > Enable nvme on aarch64 > > > > Don't mark nvme as broken on aarch64. It compiles, at least, and > people are > > testing it out. This only enables the userland parts of the nvme stack. > > For BROKEN_OPTIONS we should probably list the archs where it is known > to be broken instead? > Generally. At first, this was known working only on x86 due to how the driver was written, so it made sense to whitelist. We're likely getting close to black-listing in this case. Warner From owner-svn-src-head@freebsd.org Thu Aug 8 21:15:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A24CBB3025; Thu, 8 Aug 2019 21:15:03 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464Ljz3nx9z4sNp; Thu, 8 Aug 2019 21:15:03 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6411332F6; Thu, 8 Aug 2019 21:15:03 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78LF3Po010458; Thu, 8 Aug 2019 21:15:03 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78LF3p5010457; Thu, 8 Aug 2019 21:15:03 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908082115.x78LF3p5010457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 8 Aug 2019 21:15:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350781 - head/usr.bin/whois X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/usr.bin/whois X-SVN-Commit-Revision: 350781 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 21:15:03 -0000 Author: markj Date: Thu Aug 8 21:15:02 2019 New Revision: 350781 URL: https://svnweb.freebsd.org/changeset/base/350781 Log: Update RFC references in the whois(1) man page. PR: 239720 Submitted by: Gordon Bergling MFC after: 3 days Modified: head/usr.bin/whois/whois.1 Modified: head/usr.bin/whois/whois.1 ============================================================================== --- head/usr.bin/whois/whois.1 Thu Aug 8 21:08:13 2019 (r350780) +++ head/usr.bin/whois/whois.1 Thu Aug 8 21:15:02 2019 (r350781) @@ -28,7 +28,7 @@ .\" From: @(#)whois.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd April 25, 2016 +.Dd August 1, 2019 .Dt WHOIS 1 .Os .Sh NAME @@ -272,13 +272,21 @@ to return a brief description of its object type: .Pp .Dl Ic whois -r -- '-t domain' -.Sh SEE ALSO +.Sh STANDARDS .Rs -.%A Ken Harrenstien -.%A Vic White +.%A K. Harrenstien +.%A M. Stahl +.%A E. Feinler +.%D October 1985 +.%R RFC 954 .%T NICNAME/WHOIS -.%D 1 March 1982 -.%O RFC 812 +.Re +.Pp +.Rs +.%A L. Daigle +.%D September 2004 +.%R RFC 3912 +.%T WHOIS Protocol Specification .Re .Sh HISTORY The From owner-svn-src-head@freebsd.org Thu Aug 8 21:16:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39B29B31C1; Thu, 8 Aug 2019 21:16:16 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464LlN0nNZz4sh2; Thu, 8 Aug 2019 21:16:16 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0B2E330A; Thu, 8 Aug 2019 21:16:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x78LGFHg010708; Thu, 8 Aug 2019 21:16:15 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x78LGFCU010707; Thu, 8 Aug 2019 21:16:15 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908082116.x78LGFCU010707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 8 Aug 2019 21:16:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350782 - head/usr.bin/du X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/usr.bin/du X-SVN-Commit-Revision: 350782 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 21:16:16 -0000 Author: markj Date: Thu Aug 8 21:16:15 2019 New Revision: 350782 URL: https://svnweb.freebsd.org/changeset/base/350782 Log: Flesh out the STANDARDS and AUTHORS sections in the du(1) man page. PR: 239722 Submitted by: Gordon Bergling MFC after: 3 days Modified: head/usr.bin/du/du.1 Modified: head/usr.bin/du/du.1 ============================================================================== --- head/usr.bin/du/du.1 Thu Aug 8 21:15:02 2019 (r350781) +++ head/usr.bin/du/du.1 Thu Aug 8 21:16:15 2019 (r350782) @@ -28,7 +28,7 @@ .\" @(#)du.1 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd August 8, 2017 +.Dd August 1, 2019 .Dt DU 1 .Os .Sh NAME @@ -221,8 +221,78 @@ Also display a grand total at the end: .Xr fts 3 , .Xr symlink 7 , .Xr quot 8 +.Sh STANDARDS +The +.Nm +utility is compliant with the +.St -p1003.1-2008 +specification. +.Pp +The flags +.Op Fl cdhP , +as well as the +.Ev BLOCKSIZE +environment variable, +are extensions to that specification. +.Pp +The flag +.Op Fl r +is accepted but ignored, for compatibility with systems implementing +the obsolete +.St -xcu5 +standard. .Sh HISTORY -A +The .Nm -command appeared in +utility and its +.Fl a +and +.Fl s +options first appeared in .At v1 . +.Pp +The +.Fl r +option first appeared in +.At III +and is available since +.Fx 3.5 . +The +.Fl k +and +.Fl x +options first appeared in +.Bx 4.3 Reno +and +.Fl H +in +.Bx 4.4 . +The +.Fl c +and +.Fl L +options first appeared in the GNU fileutils; +.Fl L +and +.Fl P +are available since +.Bx 4.4 Lite1 , +.Fl c +since +.Fx 2.2.6 . +The +.Fl d +option first appeared in +.Fx 2.2 , +.Fl h +first appeared in +.Fx 4.0 . +.Sh AUTHORS +.An -nosplit +This version of +.Nm +was written by +.An Chris Newcomb +for +.Bx 4.3 Reno +in 1989. From owner-svn-src-head@freebsd.org Thu Aug 8 21:29:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCA59B3823; Thu, 8 Aug 2019 21:29:34 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464M2k4xL8z4tSW; Thu, 8 Aug 2019 21:29:34 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-ot1-f43.google.com with SMTP id q20so124450684otl.0; Thu, 08 Aug 2019 14:29:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=9zHpbiguCj1Wvo8MSrdICwzUZTuUjI09Upu8gZLRLYk=; b=Lsnedcx3NwyAGelV/aSw9p210AOMN+yx0kgqI2buWztEBQBTBjxe3fIRn/74QgPmHQ rapZ4MdrIy7KUFvH70NrRkL1vrnnBjQHiRbOGAp+wFUGxfeWiZeyePE+5OjSktyG7LCS r1XiJ8+Pd3cmklBRD822a6N8gGTQcZhclACcz3eRo22qiQjZLDCk1IktrcDCL3CsSXJ+ s9CGM9AWV6GEi+JSPeS+9k2lAARllCztjEHtcKGFM/H6zxlyG7cdHKAxBJgJp+AY+oN5 cx2GN9Mt+AUJtHGSas+6zYccg0VlS6FQm/stcgii9QEKYeT3xbvXvu329Z7bXlcvYmgs WEVw== X-Gm-Message-State: APjAAAXQ501zFCx17e0lpjjt6BpItoPPA3HcuxQPsWyjqwjWS0XUcc0C rilPo8U2qsNhSrxMPRguVfQ6Uw9V X-Google-Smtp-Source: APXvYqwWDAI3EFFw4/eTjZ4JfZ2aBpnLne7/yrjZdFimFbSgmncPO5VMLY1d91c0QPBMrrqOv1OL6A== X-Received: by 2002:aca:4ad2:: with SMTP id x201mr4243929oia.129.1565299772167; Thu, 08 Aug 2019 14:29:32 -0700 (PDT) Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com. [209.85.210.42]) by smtp.gmail.com with ESMTPSA id 132sm31833716oid.47.2019.08.08.14.29.31 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Thu, 08 Aug 2019 14:29:31 -0700 (PDT) Received: by mail-ot1-f42.google.com with SMTP id n5so124658123otk.1; Thu, 08 Aug 2019 14:29:31 -0700 (PDT) X-Received: by 2002:a5d:8253:: with SMTP id n19mr6625806ioo.80.1565299771496; Thu, 08 Aug 2019 14:29:31 -0700 (PDT) MIME-Version: 1.0 References: <201908082009.x78K9bCV069231@repo.freebsd.org> In-Reply-To: <201908082009.x78K9bCV069231@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Thu, 8 Aug 2019 14:29:20 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r350778 - head/sys/contrib/zstd/lib/common To: Warner Losh Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 464M2k4xL8z4tSW X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.99)[-0.989,0]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 21:29:34 -0000 Thanks Warner for noticing and fixing this. I've sent the patch upstream to hopefully be addressed there as well: https://github.com/facebook/zstd/pull/1713 Best, Conrad On Thu, Aug 8, 2019 at 1:09 PM Warner Losh wrote: > > Author: imp > Date: Thu Aug 8 20:09:36 2019 > New Revision: 350778 > URL: https://svnweb.freebsd.org/changeset/base/350778 > > Log: > Stopgap fix for gcc platforms. > > Our in-tree gcc doesn't have a no-tree-vectorize optimization knob, so we get a > warning that it's unused. This causes the build to fail on all our gcc platforms. > Add a quick version check as a stop-gap measure to get CI building again. > > Modified: > head/sys/contrib/zstd/lib/common/compiler.h > > Modified: head/sys/contrib/zstd/lib/common/compiler.h > ============================================================================== > --- head/sys/contrib/zstd/lib/common/compiler.h Thu Aug 8 20:07:38 2019 (r350777) > +++ head/sys/contrib/zstd/lib/common/compiler.h Thu Aug 8 20:09:36 2019 (r350778) > @@ -128,7 +128,7 @@ > } > > /* vectorization */ > -#if !defined(__clang__) && defined(__GNUC__) > +#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ > 5 > # define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize"))) > #else > # define DONT_VECTORIZE > From owner-svn-src-head@freebsd.org Thu Aug 8 21:30:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1AC2BB38AC for ; Thu, 8 Aug 2019 21:30:12 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464M3R2gXvz4tbF for ; Thu, 8 Aug 2019 21:30:11 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72d.google.com with SMTP id g18so70078999qkl.3 for ; Thu, 08 Aug 2019 14:30:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=d4gx8YmMMGr6DsOP0/f2GIlqcpTANeVnebBk4mVjNcQ=; b=T8Sc4H2NglztldqrV/55no9vtpz08OBrwUBmXugAdM03rBcFaC75AZctnDD3VZpsZF c6gNVoesjCx/DWyPNtqsnui28PJqqsX7t6vuy9XmkPR0ure5rmCFUbhVH/do3ni752Qt Y+TL3UHsaJ8SqlSKS4hFCGWI9vK4SoVL8fFCG+Tn52oNws480sejZ8WYbPAzwR/3LFtw 08Im+R/vA8W0jH92qnArGjx1eQg9yfuTWkiZGCSFW9E00OvkT5bTALHwyAqdK3XJOUga 6JvEfog21APLCcN0NneNXp/vT+8ZA3vbviZwbrBVN6e4m6hUTKtB65mfJvLL8qviMJBb 0Cng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=d4gx8YmMMGr6DsOP0/f2GIlqcpTANeVnebBk4mVjNcQ=; b=uHjWA4/qZZUp9q0fBSv1ywZqQSWIzJy/h3T1COjRsOPmzww5NQZ69nmpp5SEGKG08m kFLCzWa1jFSvutcHR6BLY8vBralBX37rjOdvo+YpWq7hJ+pZDp7irrAHnTldMtVNZ5m5 tHljZaSyJxiRqe4QHzmFYasVtg05t1VKPisHnwpdd4oUkqbI+wKNn16X4Cdho551WW43 Uu7Ogz5I0WxrLZtSi19Xs0oC6PIdScxH2ooLgjZnxqsKgMA7ovf2sRRokmSvmQDNEPeS Z6ltzfHEghyKKj31cE3/Jd3Qj4a5+2lHphKKPihSIvQMTv98R1SOY1KQ5dUVFBPUk6YZ IiRQ== X-Gm-Message-State: APjAAAVklorWapWaOAD7QJI/1xS8l6z7WdUzkPxsRUegpd7nbqfflsUI EEYZOXRWYtgcW6u/nt8+2mQlcG3mXV7F2p5AJEjNZA== X-Google-Smtp-Source: APXvYqyfkB9UfT38rCojBLofn3ZrXqKHcHtD3qQXAT0Ric9Ntm6JwxOiJ4J5R2u3t+0OJQKsnrHByDNWMcnBJ3HmcxA= X-Received: by 2002:a37:9307:: with SMTP id v7mr8455100qkd.495.1565299810059; Thu, 08 Aug 2019 14:30:10 -0700 (PDT) MIME-Version: 1.0 References: <201908082009.x78K9bCV069231@repo.freebsd.org> In-Reply-To: From: Warner Losh Date: Thu, 8 Aug 2019 15:29:59 -0600 Message-ID: Subject: Re: svn commit: r350778 - head/sys/contrib/zstd/lib/common To: "Conrad E. Meyer" Cc: Warner Losh , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 464M3R2gXvz4tbF X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=T8Sc4H2N; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72d) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-5.98 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-0.998,0]; RCVD_IN_DNSWL_NONE(0.00)[d.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.98)[ip: (-9.39), ipnet: 2607:f8b0::/32(-3.03), asn: 15169(-2.43), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 21:30:12 -0000 Thanks Conrad for upstreaming... Warner On Thu, Aug 8, 2019 at 3:29 PM Conrad Meyer wrote: > Thanks Warner for noticing and fixing this. > > I've sent the patch upstream to hopefully be addressed there as well: > > https://github.com/facebook/zstd/pull/1713 > > Best, > Conrad > > On Thu, Aug 8, 2019 at 1:09 PM Warner Losh wrote: > > > > Author: imp > > Date: Thu Aug 8 20:09:36 2019 > > New Revision: 350778 > > URL: https://svnweb.freebsd.org/changeset/base/350778 > > > > Log: > > Stopgap fix for gcc platforms. > > > > Our in-tree gcc doesn't have a no-tree-vectorize optimization knob, so > we get a > > warning that it's unused. This causes the build to fail on all our gcc > platforms. > > Add a quick version check as a stop-gap measure to get CI building > again. > > > > Modified: > > head/sys/contrib/zstd/lib/common/compiler.h > > > > Modified: head/sys/contrib/zstd/lib/common/compiler.h > > > ============================================================================== > > --- head/sys/contrib/zstd/lib/common/compiler.h Thu Aug 8 20:07:38 > 2019 (r350777) > > +++ head/sys/contrib/zstd/lib/common/compiler.h Thu Aug 8 20:09:36 > 2019 (r350778) > > @@ -128,7 +128,7 @@ > > } > > > > /* vectorization */ > > -#if !defined(__clang__) && defined(__GNUC__) > > +#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ > 5 > > # define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize"))) > > #else > > # define DONT_VECTORIZE > > > From owner-svn-src-head@freebsd.org Thu Aug 8 22:59:56 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ADD23B6054; Thu, 8 Aug 2019 22:59:56 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 464P302T49z3Hvs; Thu, 8 Aug 2019 22:59:55 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id x78MxlqC003472 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 8 Aug 2019 15:59:47 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x78MxlBx003471; Thu, 8 Aug 2019 15:59:47 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Thu, 8 Aug 2019 15:59:47 -0700 From: Gleb Smirnoff To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r350764 - head/sys/arm64/arm64 Message-ID: <20190808225947.GD1531@FreeBSD.org> References: <201908081748.x78Hm79V085760@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201908081748.x78Hm79V085760@repo.freebsd.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-Rspamd-Queue-Id: 464P302T49z3Hvs X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.95)[-0.951,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 22:59:56 -0000 Hi, why do we need COMPAT_43 for arm64 at all? I can't imagine an application that would require this compatibility. A more general question is how far in the future are we going to carry COMPAT_43 for i386/amd64? On Thu, Aug 08, 2019 at 05:48:07PM +0000, Warner Losh wrote: W> Author: imp W> Date: Thu Aug 8 17:48:07 2019 W> New Revision: 350764 W> URL: https://svnweb.freebsd.org/changeset/base/350764 W> W> Log: W> Make arm64 32-bit mode compile with COMPAT_43 W> W> The COMPAT_43 option isn't quite like the other compat options, and arm64 makes W> attempts to support it in 64-bit mode. In 32-bit compat mode, however, two W> syscall implementations that COMPAT_FREEBSD32 assumes will be there are W> missing. Provide implementations for these: ofreebsd32_sigreturn (which we'll W> never encounter, so implement it as nosys as is done in kern_sig.c) and W> ofreebsd32_getpagesize, where we'll always return 4096 since that's the only W> PAGE_SIZE we support, similar to how the ia32 implementation does things. W> W> Reviewed by: manu@ W> Differential Revision: https://reviews.freebsd.org/D21192 W> W> Modified: W> head/sys/arm64/arm64/freebsd32_machdep.c W> W> Modified: head/sys/arm64/arm64/freebsd32_machdep.c W> ============================================================================== W> --- head/sys/arm64/arm64/freebsd32_machdep.c Thu Aug 8 17:30:51 2019 (r350763) W> +++ head/sys/arm64/arm64/freebsd32_machdep.c Thu Aug 8 17:48:07 2019 (r350764) W> @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); W> #include W> #include W> #include W> +#include W> #include W> #ifdef VFP W> #include W> @@ -410,3 +411,30 @@ freebsd32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigs W> mtx_lock(&psp->ps_mtx); W> W> } W> + W> +#ifdef COMPAT_43 W> +/* W> + * COMPAT_FREEBSD32 assumes we have this system call when COMPAT_43 is defined. W> + * FreeBSD/arm provies a similar getpagesize() syscall. W> + */ W> +#define ARM32_PAGE_SIZE 4096 W> +int W> +ofreebsd32_getpagesize(struct thread *td, W> + struct ofreebsd32_getpagesize_args *uap) W> +{ W> + W> + td->td_retval[0] = ARM32_PAGE_SIZE; W> + return (0); W> +} W> + W> +/* W> + * Mirror the osigreturn definition in kern_sig.c for !i386 platforms. This W> + * mirrors what's connected to the FreeBSD/arm syscall. W> + */ W> +int W> +ofreebsd32_sigreturn(struct thread *td, struct ofreebsd32_sigreturn_args *uap) W> +{ W> + W> + return (nosys(td, (struct nosys_args *)uap)); W> +} W> +#endif W> _______________________________________________ W> svn-src-all@freebsd.org mailing list W> https://lists.freebsd.org/mailman/listinfo/svn-src-all W> To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" -- Gleb Smirnoff From owner-svn-src-head@freebsd.org Fri Aug 9 01:38:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 91309B91DC for ; Fri, 9 Aug 2019 01:38:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464SZ93Tvbz3Pxs for ; Fri, 9 Aug 2019 01:38:41 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x844.google.com with SMTP id v38so1941977qtb.0 for ; Thu, 08 Aug 2019 18:38:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Za4kNDf3+zUt5DKsAq9XjAe0wPpfoDYZiLcjTPSv0Gk=; b=f5O7RmjGCOIVYOFEsQNuNBm6T4OabtU+zpfdlzHqKrr7BoiOBpKSx7y2Fpw6plsT8Q c2Ozmyqb6O1oMkhGj7+QEh0C+GP/80o9tlOBd62bf9W0zy6V0AOvtm9+kLbsiJmI9PFD fgG+aLBF2+W6QroB1mITXazVEEF/EJQhaq6ov0fmwkYUpiUu4kmk1ayAG/4cx00cudah +PthOhHSXWf7yPlwljjVi9PlR2yPnvywrnvhEvDVyMCGJqD/RCrE4ZB+9BlO4MWVYOFe MNWVUowzd2exyBn6+zoInCXrTmy5YwkMDgX3nKI3NFUHtXTdr6iZOUQZ4hW4VYMOmtAq dfFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Za4kNDf3+zUt5DKsAq9XjAe0wPpfoDYZiLcjTPSv0Gk=; b=KedlaXlIwcYIEu6NwEmK7QgNcWvPV1QOlbjdjzWIuCcOpJ/x3rp+nXEXZAsowSlJDJ vfWFzWsx9AtJzSvD96PDq5LDvmRJKpQTnPaxKY9i5/JP+lo1woE4CgcSLH7ab2Ggb/OH oDdr6tYXzbLHCL8veIWLIznFRY3i94DbVMOCr2Q4RNA4PZGLDRHVpcB1f7Q7qTqG1XBD p6LjTccRiTHcLRKw6MLpIwefxwiB8OKrOEq5+gAwzXSjcxm1bUERXpinjHHmpJX7OAoO nI/zI1676nQ9kgSU8uqAJAV36ttDqUGhs6D9+xrPCXNJKY2zgT9uq1RxtrVyPKwhNrof PN9w== X-Gm-Message-State: APjAAAVuyiBryGZXDfk4QBeQITsnbgQslZjCx34DnlwDDNNdCP6N89Pq FfVLYbpZ/d1TQLf8e4lRCuqOFU1y1tFsuy08e11tnQ== X-Google-Smtp-Source: APXvYqzUKqiZqNZM3KZ4u2PLX5eXF3HLvVJCbb9pmJ8uVA0iogtAPd5DLjXXa38v4Zxh3ca1RHVnTsef+rQzIHPi69M= X-Received: by 2002:a0c:c250:: with SMTP id w16mr4480540qvh.188.1565314720151; Thu, 08 Aug 2019 18:38:40 -0700 (PDT) MIME-Version: 1.0 References: <201908081748.x78Hm79V085760@repo.freebsd.org> <20190808225947.GD1531@FreeBSD.org> In-Reply-To: <20190808225947.GD1531@FreeBSD.org> From: Warner Losh Date: Thu, 8 Aug 2019 19:38:28 -0600 Message-ID: Subject: Re: svn commit: r350764 - head/sys/arm64/arm64 To: Gleb Smirnoff Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 464SZ93Tvbz3Pxs X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=f5O7RmjG; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::844) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-2.15 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[9]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.55)[-0.548,0]; RCVD_IN_DNSWL_NONE(0.00)[4.4.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-0.60)[ip: (2.50), ipnet: 2607:f8b0::/32(-3.03), asn: 15169(-2.43), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Aug 2019 01:38:42 -0000 On Thu, Aug 8, 2019, 4:59 PM Gleb Smirnoff wrote: > Hi, > > why do we need COMPAT_43 for arm64 at all? I can't imagine an > application that would require this compatibility. > > A more general question is how far in the future are we going > to carry COMPAT_43 for i386/amd64? > COMPAT_43 is a weird option. It's a combo of both sys calls and kernel behavior modifications. Before we thinned the ABIs we supported, it was necessary for them as well. The biggest behavior change is around signals. It is weird to sort out and nobody has done the deep analysis to see what is truly unused and what is there for compat with Linux and other SysV systems... Warner On Thu, Aug 08, 2019 at 05:48:07PM +0000, Warner Losh wrote: > W> Author: imp > W> Date: Thu Aug 8 17:48:07 2019 > W> New Revision: 350764 > W> URL: https://svnweb.freebsd.org/changeset/base/350764 > W> > W> Log: > W> Make arm64 32-bit mode compile with COMPAT_43 > W> > W> The COMPAT_43 option isn't quite like the other compat options, and > arm64 makes > W> attempts to support it in 64-bit mode. In 32-bit compat mode, > however, two > W> syscall implementations that COMPAT_FREEBSD32 assumes will be there > are > W> missing. Provide implementations for these: ofreebsd32_sigreturn > (which we'll > W> never encounter, so implement it as nosys as is done in kern_sig.c) > and > W> ofreebsd32_getpagesize, where we'll always return 4096 since that's > the only > W> PAGE_SIZE we support, similar to how the ia32 implementation does > things. > W> > W> Reviewed by: manu@ > W> Differential Revision: https://reviews.freebsd.org/D21192 > W> > W> Modified: > W> head/sys/arm64/arm64/freebsd32_machdep.c > W> > W> Modified: head/sys/arm64/arm64/freebsd32_machdep.c > W> > ============================================================================== > W> --- head/sys/arm64/arm64/freebsd32_machdep.c Thu Aug 8 17:30:51 2019 > (r350763) > W> +++ head/sys/arm64/arm64/freebsd32_machdep.c Thu Aug 8 17:48:07 2019 > (r350764) > W> @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); > W> #include > W> #include > W> #include > W> +#include > W> #include > W> #ifdef VFP > W> #include > W> @@ -410,3 +411,30 @@ freebsd32_sendsig(sig_t catcher, ksiginfo_t *ksi, > sigs > W> mtx_lock(&psp->ps_mtx); > W> > W> } > W> + > W> +#ifdef COMPAT_43 > W> +/* > W> + * COMPAT_FREEBSD32 assumes we have this system call when COMPAT_43 is > defined. > W> + * FreeBSD/arm provies a similar getpagesize() syscall. > W> + */ > W> +#define ARM32_PAGE_SIZE 4096 > W> +int > W> +ofreebsd32_getpagesize(struct thread *td, > W> + struct ofreebsd32_getpagesize_args *uap) > W> +{ > W> + > W> + td->td_retval[0] = ARM32_PAGE_SIZE; > W> + return (0); > W> +} > W> + > W> +/* > W> + * Mirror the osigreturn definition in kern_sig.c for !i386 platforms. > This > W> + * mirrors what's connected to the FreeBSD/arm syscall. > W> + */ > W> +int > W> +ofreebsd32_sigreturn(struct thread *td, struct > ofreebsd32_sigreturn_args *uap) > W> +{ > W> + > W> + return (nosys(td, (struct nosys_args *)uap)); > W> +} > W> +#endif > W> _______________________________________________ > W> svn-src-all@freebsd.org mailing list > W> https://lists.freebsd.org/mailman/listinfo/svn-src-all > W> To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > > -- > Gleb Smirnoff > From owner-svn-src-head@freebsd.org Fri Aug 9 02:11:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07328B9A07; Fri, 9 Aug 2019 02:11:48 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464TJM5jGcz3R2p; Fri, 9 Aug 2019 02:11:47 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5A6B6B0F; Fri, 9 Aug 2019 02:11:47 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x792Bl4M087100; Fri, 9 Aug 2019 02:11:47 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x792Bl7f087099; Fri, 9 Aug 2019 02:11:47 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908090211.x792Bl7f087099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 9 Aug 2019 02:11:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350813 - head/tools/tools/crypto X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/tools/tools/crypto X-SVN-Commit-Revision: 350813 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Aug 2019 02:11:48 -0000 Author: cem Date: Fri Aug 9 02:11:47 2019 New Revision: 350813 URL: https://svnweb.freebsd.org/changeset/base/350813 Log: tools/tools/crypto: cryptokeytest: Fix build with newer OpenSSL Also, drag into this decade. Modified: head/tools/tools/crypto/cryptokeytest.c Modified: head/tools/tools/crypto/cryptokeytest.c ============================================================================== --- head/tools/tools/crypto/cryptokeytest.c Fri Aug 9 00:50:02 2019 (r350812) +++ head/tools/tools/crypto/cryptokeytest.c Fri Aug 9 02:11:47 2019 (r350813) @@ -7,19 +7,21 @@ * --Jason L. Wright */ #include +#include #include -#include #include #include -#include -#include -#include #include +#include +#include +#include #include #include -#include +#include +#include + int crid = CRYPTO_FLAG_HARDWARE; int verbose = 0; @@ -63,80 +65,64 @@ crfind(int crid) } /* - * Convert a little endian byte string in 'p' that - * is 'plen' bytes long to a BIGNUM. If 'dst' is NULL, - * a new BIGNUM is allocated. Returns NULL on failure. - * - * XXX there has got to be a more efficient way to do - * this, but I haven't figured out enough of the OpenSSL - * magic. + * Convert a little endian byte string in 'p' that is 'plen' bytes long to a + * BIGNUM. A new BIGNUM is allocated. Returns NULL on failure. */ -BIGNUM * -le_to_bignum(BIGNUM *dst, u_int8_t *p, int plen) +static BIGNUM * +le_to_bignum(BIGNUM *res, const void *p, int plen) { - u_int8_t *pd; - int i; - if (plen == 0) - return (NULL); + res = BN_lebin2bn(p, plen, res); + if (res == NULL) + ERR_print_errors_fp(stderr); - if ((pd = (u_int8_t *)malloc(plen)) == NULL) - return (NULL); - - for (i = 0; i < plen; i++) - pd[i] = p[plen - i - 1]; - - dst = BN_bin2bn(pd, plen, dst); - free(pd); - return (dst); + return (res); } /* - * Convert a BIGNUM to a little endian byte string. - * If 'rd' is NULL, allocate space for it, otherwise - * 'rd' is assumed to have room for BN_num_bytes(n) - * bytes. Returns NULL on failure. + * Convert a BIGNUM to a little endian byte string. Space for BN_num_bytes(n) + * is allocated. + * Returns NULL on failure. */ -u_int8_t * -bignum_to_le(BIGNUM *n, u_int8_t *rd) +static void * +bignum_to_le(const BIGNUM *n) { - int i, j, k; - int blen = BN_num_bytes(n); + int blen, error; + void *rd; + blen = BN_num_bytes(n); if (blen == 0) return (NULL); + + rd = malloc(blen); if (rd == NULL) - rd = (u_int8_t *)malloc(blen); - if (rd == NULL) return (NULL); - for (i = 0, j = 0; i < n->top; i++) { - for (k = 0; k < BN_BITS2 / 8; k++) { - if ((j + k) >= blen) - goto out; - rd[j + k] = n->d[i] >> (k * 8); - } - j += BN_BITS2 / 8; + error = BN_bn2lebinpad(n, rd, blen); + if (error < 0) { + ERR_print_errors_fp(stderr); + free(rd); + return (NULL); } -out: + return (rd); } -int -UB_mod_exp(BIGNUM *res, BIGNUM *a, BIGNUM *b, BIGNUM *c, BN_CTX *ctx) +static int +UB_mod_exp(BIGNUM *res, const BIGNUM *a, const BIGNUM *b, const BIGNUM *c) { struct crypt_kop kop; - u_int8_t *ale, *ble, *cle; + void *ale, *ble, *cle; static int crypto_fd = -1; if (crypto_fd == -1 && ioctl(devcrypto(), CRIOGET, &crypto_fd) == -1) err(1, "CRIOGET"); - if ((ale = bignum_to_le(a, NULL)) == NULL) + if ((ale = bignum_to_le(a)) == NULL) err(1, "bignum_to_le, a"); - if ((ble = bignum_to_le(b, NULL)) == NULL) + if ((ble = bignum_to_le(b)) == NULL) err(1, "bignum_to_le, b"); - if ((cle = bignum_to_le(c, NULL)) == NULL) + if ((cle = bignum_to_le(c)) == NULL) err(1, "bignum_to_le, c"); bzero(&kop, sizeof(kop)); @@ -158,19 +144,19 @@ UB_mod_exp(BIGNUM *res, BIGNUM *a, BIGNUM *b, BIGNUM * if (verbose) printf("device = %s\n", crfind(kop.crk_crid)); - bzero(ale, BN_num_bytes(a)); + explicit_bzero(ale, BN_num_bytes(a)); free(ale); - bzero(ble, BN_num_bytes(b)); + explicit_bzero(ble, BN_num_bytes(b)); free(ble); if (kop.crk_status != 0) { printf("error %d\n", kop.crk_status); - bzero(cle, BN_num_bytes(c)); + explicit_bzero(cle, BN_num_bytes(c)); free(cle); return (-1); } else { res = le_to_bignum(res, cle, BN_num_bytes(c)); - bzero(cle, BN_num_bytes(c)); + explicit_bzero(cle, BN_num_bytes(c)); free(cle); if (res == NULL) err(1, "le_to_bignum"); @@ -179,9 +165,9 @@ UB_mod_exp(BIGNUM *res, BIGNUM *a, BIGNUM *b, BIGNUM * return (0); } -void -show_result(a, b, c, sw, hw) -BIGNUM *a, *b, *c, *sw, *hw; +static void +show_result(const BIGNUM *a, const BIGNUM *b, const BIGNUM *c, + const BIGNUM *sw, const BIGNUM *hw) { printf("\n"); @@ -208,7 +194,7 @@ BIGNUM *a, *b, *c, *sw, *hw; printf("\n"); } -void +static void testit(void) { BIGNUM *a, *b, *c, *r1, *r2; @@ -230,10 +216,10 @@ testit(void) BIGNUM *rem = BN_new(); BN_mod(rem, a, c, ctx); - UB_mod_exp(r2, rem, b, c, ctx); + UB_mod_exp(r2, rem, b, c); BN_free(rem); } else { - UB_mod_exp(r2, a, b, c, ctx); + UB_mod_exp(r2, a, b, c); } BN_mod_exp(r1, a, b, c, ctx); From owner-svn-src-head@freebsd.org Fri Aug 9 02:20:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6595AB9B2E; Fri, 9 Aug 2019 02:20:27 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464TVM1pwdz3RGY; Fri, 9 Aug 2019 02:20:27 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 350CA6B64; Fri, 9 Aug 2019 02:20:27 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x792KQx6089449; Fri, 9 Aug 2019 02:20:26 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x792KQw2089448; Fri, 9 Aug 2019 02:20:26 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908090220.x792KQw2089448@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 9 Aug 2019 02:20:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350814 - head/usr.sbin/autofs X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/usr.sbin/autofs X-SVN-Commit-Revision: 350814 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Aug 2019 02:20:27 -0000 Author: jhibbits Date: Fri Aug 9 02:20:26 2019 New Revision: 350814 URL: https://svnweb.freebsd.org/changeset/base/350814 Log: autofs: Fix autounmountd's printing of mount time. time_t should be printed as intmax_t. Even though duration should be short, the correct way to print is intmax_t, not long. Reported by: ian,imp Modified: head/usr.sbin/autofs/autounmountd.c Modified: head/usr.sbin/autofs/autounmountd.c ============================================================================== --- head/usr.sbin/autofs/autounmountd.c Fri Aug 9 02:11:47 2019 (r350813) +++ head/usr.sbin/autofs/autounmountd.c Fri Aug 9 02:20:26 2019 (r350814) @@ -196,9 +196,9 @@ expire_automounted(time_t expiration_time) if (mounted_for < expiration_time) { log_debugx("skipping %s (FSID:%d:%d), mounted " - "for %ld seconds", af->af_mountpoint, + "for %jd seconds", af->af_mountpoint, af->af_fsid.val[0], af->af_fsid.val[1], - (long)mounted_for); + (intmax_t)mounted_for); if (mounted_for > mounted_max) mounted_max = mounted_for; From owner-svn-src-head@freebsd.org Fri Aug 9 03:35:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCD14BB021; Fri, 9 Aug 2019 03:35:15 +0000 (UTC) (envelope-from jamie@catflap.org) Received: from donotpassgo.dyslexicfish.net (donotpassgo.dyslexicfish.net [IPv6:2001:19f0:300:2185:123::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 464W8f2hssz40Jv; Fri, 9 Aug 2019 03:35:14 +0000 (UTC) (envelope-from jamie@catflap.org) Received: from donotpassgo.dyslexicfish.net (donotpassgo.dyslexicfish.net [104.207.135.49]) by donotpassgo.dyslexicfish.net (8.14.5/8.14.5) with ESMTP id x793Z6as074460 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 9 Aug 2019 04:35:07 +0100 (BST) (envelope-from jamie@donotpassgo.dyslexicfish.net) Received: (from jamie@localhost) by donotpassgo.dyslexicfish.net (8.14.5/8.14.5/Submit) id x793Z5WP074456; Fri, 9 Aug 2019 04:35:05 +0100 (BST) (envelope-from jamie) From: Jamie Landeg-Jones Message-Id: <201908090335.x793Z5WP074456@donotpassgo.dyslexicfish.net> Date: Fri, 09 Aug 2019 04:35:05 +0100 Organization: Dyslexic Fish To: jhb@freebsd.org, gjb@freebsd.org Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, freebsd-hackers@freebsd.org, freebsd-arch@freebsd.org Subject: Re: svn commit: r350550 - head/share/mk References: <201908030106.x7316Ibx078529@repo.freebsd.org> <20190806165614.GA41295@FreeBSD.org> In-Reply-To: <20190806165614.GA41295@FreeBSD.org> User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.7 (donotpassgo.dyslexicfish.net [104.207.135.49]); Fri, 09 Aug 2019 04:35:07 +0100 (BST) X-Rspamd-Queue-Id: 464W8f2hssz40Jv X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=none) header.from=catflap.org; spf=pass (mx1.freebsd.org: domain of jamie@catflap.org designates 2001:19f0:300:2185:123::1 as permitted sender) smtp.mailfrom=jamie@catflap.org X-Spamd-Result: default: False [-3.90 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+mx:dyslexicfish.net]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; HAS_ORG_HEADER(0.00)[]; RCVD_TLS_LAST(0.00)[]; NEURAL_HAM_SHORT(-0.71)[-0.710,0]; DMARC_POLICY_ALLOW(-0.50)[catflap.org,none]; RCPT_COUNT_SEVEN(0.00)[7]; IP_SCORE(-0.40)[ipnet: 2001:19f0::/38(-1.74), asn: 20473(-0.18), country: US(-0.05)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:20473, ipnet:2001:19f0::/38, country:US]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Aug 2019 03:35:15 -0000 Glen Barber wrote: > after stable/12 branched, I have seen no public complaints about > enabling REPRODUCIBLE_BUILD by default (and quite honestly, do not see > the benefit of disabling it by default -- why wouldn't we want > reproducibility?). I track stable. I had no need to complain because I could edit src.conf and add WITHOUT_REPRODUCIBLE_BUILD=YES Please don't remove this ability thinking no-one minds reproducible builds.. I personally think they are pointless. Cheers, Jamie From owner-svn-src-head@freebsd.org Fri Aug 9 05:19:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7FEEFBD2CA; Fri, 9 Aug 2019 05:19:00 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464YSN2nHyz444W; Fri, 9 Aug 2019 05:19:00 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D11A8BD9; Fri, 9 Aug 2019 05:19:00 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x795J0Ww096496; Fri, 9 Aug 2019 05:19:00 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x795J0q0096491; Fri, 9 Aug 2019 05:19:00 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201908090519.x795J0q0096491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Fri, 9 Aug 2019 05:19:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350815 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 350815 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Aug 2019 05:19:00 -0000 Author: jtl Date: Fri Aug 9 05:18:59 2019 New Revision: 350815 URL: https://svnweb.freebsd.org/changeset/base/350815 Log: In m_pulldown(), before trying to prepend bytes to the subsequent mbuf, ensure that the subsequent mbuf contains the remainder of the bytes the caller sought. If this is not the case, fall through to the code which gathers the bytes in a new mbuf. This fixes a bug where m_pulldown() could fail to gather all the desired bytes into consecutive memory. PR: 238787 Reported by: A reddit user Discussed with: emaste Obtained from: NetBSD MFC after: 3 days Modified: head/sys/kern/uipc_mbuf2.c Modified: head/sys/kern/uipc_mbuf2.c ============================================================================== --- head/sys/kern/uipc_mbuf2.c Fri Aug 9 02:20:26 2019 (r350814) +++ head/sys/kern/uipc_mbuf2.c Fri Aug 9 05:18:59 2019 (r350815) @@ -216,7 +216,7 @@ m_pulldown(struct mbuf *m, int off, int len, int *offp goto ok; } if ((off == 0 || offp) && M_LEADINGSPACE(n->m_next) >= hlen - && writable) { + && writable && n->m_next->m_len >= tlen) { n->m_next->m_data -= hlen; n->m_next->m_len += hlen; bcopy(mtod(n, caddr_t) + off, mtod(n->m_next, caddr_t), hlen); From owner-svn-src-head@freebsd.org Fri Aug 9 06:57:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A0A5BF8DD; Fri, 9 Aug 2019 06:57:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 464bfF5cctz48Td; Fri, 9 Aug 2019 06:57:41 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x796vX9i016514 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 9 Aug 2019 09:57:36 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x796vX9i016514 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x796vXql016513; Fri, 9 Aug 2019 09:57:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 9 Aug 2019 09:57:33 +0300 From: Konstantin Belousov To: Warner Losh Cc: Gleb Smirnoff , Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r350764 - head/sys/arm64/arm64 Message-ID: <20190809065733.GI2731@kib.kiev.ua> References: <201908081748.x78Hm79V085760@repo.freebsd.org> <20190808225947.GD1531@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 464bfF5cctz48Td X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-2.96 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; RCPT_COUNT_FIVE(0.00)[6]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; IP_SCORE(0.00)[ip: (-2.61), ipnet: 2001:470::/32(-4.48), asn: 6939(-2.94), country: US(-0.05)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Aug 2019 06:57:42 -0000 On Thu, Aug 08, 2019 at 07:38:28PM -0600, Warner Losh wrote: > On Thu, Aug 8, 2019, 4:59 PM Gleb Smirnoff wrote: > > > Hi, > > > > why do we need COMPAT_43 for arm64 at all? I can't imagine an > > application that would require this compatibility. > > > > A more general question is how far in the future are we going > > to carry COMPAT_43 for i386/amd64? > > > > COMPAT_43 is a weird option. It's a combo of both sys calls and kernel > behavior modifications. Before we thinned the ABIs we supported, it was > necessary for them as well. The biggest behavior change is around signals. > It is weird to sort out and nobody has done the deep analysis to see what > is truly unused and what is there for compat with Linux and other SysV > systems... I am not aware of any changes that COMPAT_43 provides for the signal handling semantic, except a minor adjustment for interpretation of zero-sized stack for sigaltstack(2). The COMPAT_43 option indeed enables lcall 7,0 syscall entry emulation, on both i386 and amd64. We are able to run FreeBSD 1.1.8 (i386) on amd64 kernel in chroot this way. Since sometimes I get bug reports about this stuff, there are some users of it. I believe it is important to be able to run any FreeBSD binary for PR purposes, to wave the flag of excellent binary compatibility we offer. COMPAT_43 is there to stay as far as there are people willing to maintain it. There are more than one. From owner-svn-src-head@freebsd.org Fri Aug 9 08:58:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C874C2B12; Fri, 9 Aug 2019 08:58:10 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464fKG0TtMz4GKf; Fri, 9 Aug 2019 08:58:10 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E8140B343; Fri, 9 Aug 2019 08:58:09 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x798w9XW027770; Fri, 9 Aug 2019 08:58:09 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x798w9oV027769; Fri, 9 Aug 2019 08:58:09 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201908090858.x798w9oV027769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 9 Aug 2019 08:58:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350816 - head/sys/netipsec X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netipsec X-SVN-Commit-Revision: 350816 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Aug 2019 08:58:10 -0000 Author: ae Date: Fri Aug 9 08:58:09 2019 New Revision: 350816 URL: https://svnweb.freebsd.org/changeset/base/350816 Log: Add missing new line in several log messages. PR: 239694 MFC after: 1 week Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Fri Aug 9 05:18:59 2019 (r350815) +++ head/sys/netipsec/key.c Fri Aug 9 08:58:09 2019 (r350816) @@ -284,7 +284,7 @@ key_addrprotohash(const union sockaddr_union *src, #endif default: hval = 0; - ipseclog((LOG_DEBUG, "%s: unknown address family %d", + ipseclog((LOG_DEBUG, "%s: unknown address family %d\n", __func__, dst->sa.sa_family)); } return (hval); @@ -2039,8 +2039,8 @@ key_spdadd(struct socket *so, struct mbuf *m, const st key_freesp(&newsp); } else { key_freesp(&newsp); - ipseclog((LOG_DEBUG, "%s: a SP entry exists already.", - __func__)); + ipseclog((LOG_DEBUG, + "%s: a SP entry exists already.\n", __func__)); return (key_senderror(so, m, EEXIST)); } } @@ -5409,7 +5409,7 @@ key_update(struct socket *so, struct mbuf *m, const st } /* saidx should match with SA. */ if (key_cmpsaidx(&sav->sah->saidx, &saidx, CMP_MODE_REQID) == 0) { - ipseclog((LOG_DEBUG, "%s: saidx mismatched for SPI %u", + ipseclog((LOG_DEBUG, "%s: saidx mismatched for SPI %u\n", __func__, ntohl(sav->spi))); key_freesav(&sav); return key_senderror(so, m, ESRCH); @@ -6885,14 +6885,14 @@ key_acqdone(const struct secasindex *saidx, uint32_t s if (acq != NULL) { if (key_cmpsaidx(&acq->saidx, saidx, CMP_EXACTLY) == 0) { ipseclog((LOG_DEBUG, - "%s: Mismatched saidx for ACQ %u", __func__, seq)); + "%s: Mismatched saidx for ACQ %u\n", __func__, seq)); acq = NULL; } else { acq->created = 0; } } else { ipseclog((LOG_DEBUG, - "%s: ACQ %u is not found.", __func__, seq)); + "%s: ACQ %u is not found.\n", __func__, seq)); } ACQ_UNLOCK(); if (acq == NULL) From owner-svn-src-head@freebsd.org Fri Aug 9 16:01:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D730ACC2FE for ; Fri, 9 Aug 2019 16:01:44 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464qk001flz3FJk for ; Fri, 9 Aug 2019 16:01:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72c.google.com with SMTP id s22so72090367qkj.12 for ; Fri, 09 Aug 2019 09:01:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uDhoE0JwbuoDIDykmP00crDCn3vaXikXj8d+jf5c2S0=; b=j1IAfECQ8ax3NkgooA3UIVqoyP2ztNltM1Z//MRS19zj7sXsdhSZnKZXV9JNJVmP0T Rjco4kzsf2irUy1o3oUE1xoba/HMlFPPnDiuyH81/0Yi/4huglBOL3BN+RnsLxFrS8i3 kDjTfJ6R68E6Al4BpNAAlBMvm6vPvX22G45q70iHTpUCRAhvKNCuH2K/m1fkPGLbVZ1r C8FBqC+GZ9H418Lp+XzHh4TFGcHtq5NfDvzxcUICKDPOsdpmO/HDjqN890JzSBmVnZeb BBs4milY4RzpqH1O9FUr8Qjnxcr0UQCicK5mjT3M8rHFCk/YH6vvHzxVTRBEdETibQEM Bkgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uDhoE0JwbuoDIDykmP00crDCn3vaXikXj8d+jf5c2S0=; b=DzoOi/xwfeyg7hgNoJ1ewLJaBiLIXauj7BS9klBBmGcKUU8JC2onhwE5Z0zDmv2/tB 9ZMDfr8zlQ2E78KvFPiY500a9desXmWXYHl/1/NOb+TVoI888+OceBqWdMlbcnN9escm gqq+oaOl4hzKL4gp3uZcAITtX34EEkNOX2VzIiIfaN6cIhbqcULK9psVYV8lHAT7pIv5 eGNC/ek7FFBGKBxxQTK5kEnHGYZQLbg0FbAiMwjfdfwLjEyqHM7pFNGKnRfgwaYmzoum jxY/uqN89ryfY/7OibtITTEwjh0HD80o3FFtVXEnXwiw3WaR7JfjZD0O1lm3E/gnw14F 84pg== X-Gm-Message-State: APjAAAWVRR6pVvwHqsTP+YNSEBB1WcanjeTEjCcrgzqZ8yUocLkxi4k4 Iz7szOnORWFBEDsYDNnY2MEdw5NPrwsB/oAD4lhqiQ== X-Google-Smtp-Source: APXvYqxaqyrFzhwZvHktcuoQnnM/0YqpRLuKo2hzWVmDGFpaB3dQ8sT7rfJTcaj7h+EN9T4s9fuhVLW5Li6ZGHV8UCw= X-Received: by 2002:a37:c87:: with SMTP id 129mr17408854qkm.240.1565366502702; Fri, 09 Aug 2019 09:01:42 -0700 (PDT) MIME-Version: 1.0 References: <201908081748.x78Hm79V085760@repo.freebsd.org> <20190808225947.GD1531@FreeBSD.org> <20190809065733.GI2731@kib.kiev.ua> In-Reply-To: <20190809065733.GI2731@kib.kiev.ua> From: Warner Losh Date: Fri, 9 Aug 2019 10:01:31 -0600 Message-ID: Subject: Re: svn commit: r350764 - head/sys/arm64/arm64 To: Konstantin Belousov Cc: Gleb Smirnoff , Warner Losh , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 464qk001flz3FJk X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=j1IAfECQ; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72c) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-5.95 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-0.996,0]; RCVD_IN_DNSWL_NONE(0.00)[c.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; FREEMAIL_TO(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.96)[ip: (-9.36), ipnet: 2607:f8b0::/32(-2.98), asn: 15169(-2.40), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Aug 2019 16:01:44 -0000 On Fri, Aug 9, 2019 at 12:57 AM Konstantin Belousov wrote: > On Thu, Aug 08, 2019 at 07:38:28PM -0600, Warner Losh wrote: > > On Thu, Aug 8, 2019, 4:59 PM Gleb Smirnoff wrote: > > > > > Hi, > > > > > > why do we need COMPAT_43 for arm64 at all? I can't imagine an > > > application that would require this compatibility. > > > > > > A more general question is how far in the future are we going > > > to carry COMPAT_43 for i386/amd64? > > > > > > > COMPAT_43 is a weird option. It's a combo of both sys calls and kernel > > behavior modifications. Before we thinned the ABIs we supported, it was > > necessary for them as well. The biggest behavior change is around > signals. > > It is weird to sort out and nobody has done the deep analysis to see what > > is truly unused and what is there for compat with Linux and other SysV > > systems... > I am not aware of any changes that COMPAT_43 provides for the signal > handling semantic, except a minor adjustment for interpretation of > zero-sized stack for sigaltstack(2). > The onstack stuff was what I was thinking about, but we also have code in sys_getpid() that returns the ppid in the second retval register, and similar things for getuid and getgid, It also allows ioctl numbers that have IOC_IN set, but size == 0 (these would otherwise return ENOTTY). It also turns on the COMPAT_OLDSOCK code which generally only kicks in when compat bits are set, but in one place it allows a shorter unix domain socket path length to be compatible unconditionally. The compatibility TTY stuff, at least is under COMPAT_43TTY, but that's purely ioctl translation code. The COMPAT_43 option indeed enables lcall 7,0 syscall entry emulation, > on both i386 and amd64. We are able to run FreeBSD 1.1.8 (i386) on amd64 > kernel in chroot this way. Since sometimes I get bug reports about this > stuff, there are some users of it. I believe it is important to be able > to run any FreeBSD binary for PR purposes, to wave the flag of excellent > binary compatibility we offer. > > COMPAT_43 is there to stay as far as there are people willing to maintain > it. There are more than one. > I think it's safe to retain on i386. amd64 is less clear to me, but I'd lean yes. All the other platforms I'd agree with gleb: why do we need it in the kernels by default (and maybe why do we need to support it at all)? Warner From owner-svn-src-head@freebsd.org Fri Aug 9 19:09:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D8EBCF294; Fri, 9 Aug 2019 19:09:06 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464vtB1nlhz3Plv; Fri, 9 Aug 2019 19:09:06 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1AB421A2F0; Fri, 9 Aug 2019 19:09:06 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x79J95a1090298; Fri, 9 Aug 2019 19:09:05 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x79J951p090297; Fri, 9 Aug 2019 19:09:05 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201908091909.x79J951p090297@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Fri, 9 Aug 2019 19:09:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350825 - head/stand/libsa/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa/zfs X-SVN-Commit-Revision: 350825 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Aug 2019 19:09:06 -0000 Author: tsoome Date: Fri Aug 9 19:09:05 2019 New Revision: 350825 URL: https://svnweb.freebsd.org/changeset/base/350825 Log: loader: add error check for vdev_indirect calls We can error out due to memory allocation errors, we can not recover from those and need to get out. Modified: head/stand/libsa/zfs/zfsimpl.c Modified: head/stand/libsa/zfs/zfsimpl.c ============================================================================== --- head/stand/libsa/zfs/zfsimpl.c Fri Aug 9 12:15:23 2019 (r350824) +++ head/stand/libsa/zfs/zfsimpl.c Fri Aug 9 19:09:05 2019 (r350825) @@ -839,6 +839,7 @@ vdev_indirect_remap(vdev_t *vd, uint64_t offset, uint6 { list_t stack; spa_t *spa = vd->spa; + zio_t *zio = arg; list_create(&stack, sizeof (remap_segment_t), offsetof(remap_segment_t, rs_node)); @@ -872,6 +873,13 @@ vdev_indirect_remap(vdev_t *vd, uint64_t offset, uint6 dst_offset + inner_offset, inner_size, arg); + /* + * vdev_indirect_gather_splits can have memory + * allocation error, we can not recover from it. + */ + if (zio->io_error != 0) + break; + rs->rs_offset += inner_size; rs->rs_asize -= inner_size; rs->rs_split_offset += inner_size; @@ -879,6 +887,8 @@ vdev_indirect_remap(vdev_t *vd, uint64_t offset, uint6 free(mapping); free(rs); + if (zio->io_error != 0) + break; } list_destroy(&stack); @@ -935,6 +945,8 @@ vdev_indirect_read(vdev_t *vdev, const blkptr_t *bp, v } vdev_indirect_remap(vdev, offset, bytes, &zio); + if (zio.io_error != 0) + return (zio.io_error); first = list_head(&iv->iv_splits); if (first->is_size == zio.io_size) { From owner-svn-src-head@freebsd.org Fri Aug 9 20:16:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 679D4A8F0D; Fri, 9 Aug 2019 20:16:39 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 464xN70ryBz40YY; Fri, 9 Aug 2019 20:16:39 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F31801AF5E; Fri, 9 Aug 2019 20:16:38 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x79KGcN4033556; Fri, 9 Aug 2019 20:16:38 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x79KGcvW033553; Fri, 9 Aug 2019 20:16:38 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <201908092016.x79KGcvW033553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Fri, 9 Aug 2019 20:16:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350826 - in head/lib/libthr/arch/powerpc: . include powerpc X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: in head/lib/libthr/arch/powerpc: . include powerpc X-SVN-Commit-Revision: 350826 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Aug 2019 20:16:39 -0000 Author: bdragon Date: Fri Aug 9 20:16:38 2019 New Revision: 350826 URL: https://svnweb.freebsd.org/changeset/base/350826 Log: Implement _umtx_op_err.S on powerpc / powerpc64. As per r177853, we need to avoid using errno inside user mutex code, since signal handlers can interfere with it and mess up libthr internal state. So, implement _umtx_op_err() instead, which makes a raw syscall and returns the error value directly instead of using errno. Approved by: jhibbits (mentor) Differential Revision: https://reviews.freebsd.org/D20946 Added: head/lib/libthr/arch/powerpc/Makefile.inc (contents, props changed) head/lib/libthr/arch/powerpc/powerpc/ head/lib/libthr/arch/powerpc/powerpc/_umtx_op_err.S (contents, props changed) Modified: head/lib/libthr/arch/powerpc/include/pthread_md.h Added: head/lib/libthr/arch/powerpc/Makefile.inc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libthr/arch/powerpc/Makefile.inc Fri Aug 9 20:16:38 2019 (r350826) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +SRCS+= _umtx_op_err.S Modified: head/lib/libthr/arch/powerpc/include/pthread_md.h ============================================================================== --- head/lib/libthr/arch/powerpc/include/pthread_md.h Fri Aug 9 19:09:05 2019 (r350825) +++ head/lib/libthr/arch/powerpc/include/pthread_md.h Fri Aug 9 20:16:38 2019 (r350826) @@ -91,4 +91,6 @@ _get_curthread(void) return (NULL); } +#define HAS__UMTX_OP_ERR 1 + #endif /* _PTHREAD_MD_H_ */ Added: head/lib/libthr/arch/powerpc/powerpc/_umtx_op_err.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libthr/arch/powerpc/powerpc/_umtx_op_err.S Fri Aug 9 20:16:38 2019 (r350826) @@ -0,0 +1,41 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Brandon Bergren + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + + .text + .align 2 +ENTRY(_umtx_op_err) + li %r0, SYS__umtx_op + sc + blr +END(_umtx_op_err) + + .section .note.GNU-stack,"",%progbits From owner-svn-src-head@freebsd.org Fri Aug 9 21:05:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1564CA9F22; Fri, 9 Aug 2019 21:05:23 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 464ySK3skkz42sc; Fri, 9 Aug 2019 21:05:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x79L55CZ021364 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 10 Aug 2019 00:05:09 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x79L55CZ021364 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x79L55Av021355; Sat, 10 Aug 2019 00:05:05 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 10 Aug 2019 00:05:05 +0300 From: Konstantin Belousov To: Warner Losh Cc: Gleb Smirnoff , Warner Losh , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r350764 - head/sys/arm64/arm64 Message-ID: <20190809210505.GJ2731@kib.kiev.ua> References: <201908081748.x78Hm79V085760@repo.freebsd.org> <20190808225947.GD1531@FreeBSD.org> <20190809065733.GI2731@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 464ySK3skkz42sc X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-2.99 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-0.99)[-0.995,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; RCPT_COUNT_FIVE(0.00)[6]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-0.995,0]; IP_SCORE(0.00)[ip: (-2.59), ipnet: 2001:470::/32(-4.48), asn: 6939(-2.97), country: US(-0.05)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Aug 2019 21:05:23 -0000 On Fri, Aug 09, 2019 at 10:01:31AM -0600, Warner Losh wrote: > On Fri, Aug 9, 2019 at 12:57 AM Konstantin Belousov > wrote: > > > On Thu, Aug 08, 2019 at 07:38:28PM -0600, Warner Losh wrote: > > > On Thu, Aug 8, 2019, 4:59 PM Gleb Smirnoff wrote: > > > > > > > Hi, > > > > > > > > why do we need COMPAT_43 for arm64 at all? I can't imagine an > > > > application that would require this compatibility. > > > > > > > > A more general question is how far in the future are we going > > > > to carry COMPAT_43 for i386/amd64? > > > > > > > > > > COMPAT_43 is a weird option. It's a combo of both sys calls and kernel > > > behavior modifications. Before we thinned the ABIs we supported, it was > > > necessary for them as well. The biggest behavior change is around > > signals. > > > It is weird to sort out and nobody has done the deep analysis to see what > > > is truly unused and what is there for compat with Linux and other SysV > > > systems... > > I am not aware of any changes that COMPAT_43 provides for the signal > > handling semantic, except a minor adjustment for interpretation of > > zero-sized stack for sigaltstack(2). > > > > The onstack stuff was what I was thinking about, but we also have code in > sys_getpid() that returns the ppid in the second retval register, and > similar things for getuid and getgid, It also allows ioctl numbers that > have IOC_IN set, but size == 0 (these would otherwise return ENOTTY). It > also turns on the COMPAT_OLDSOCK code which generally only kicks in when > compat bits are set, but in one place it allows a shorter unix domain > socket path length to be compatible unconditionally. The compatibility TTY > stuff, at least is under COMPAT_43TTY, but that's purely ioctl translation > code. I only reacted to the note about changing the signals syscalls behavior. But the point is valid, we should not change the syscalls ABI for new binaries when COMPAT_43 is enabled. I propose the following https://reviews.freebsd.org/D21200 WRT ioctl code for no IOC_OUT and size == 0, I believe that this is in fact cannot be changed. It is enabled also under COMPAT_FREEBSD4 and 5, and we always enable these for GENERIC. So effectively this ioctl permissive mode is always there. > > The COMPAT_43 option indeed enables lcall 7,0 syscall entry emulation, > > on both i386 and amd64. We are able to run FreeBSD 1.1.8 (i386) on amd64 > > kernel in chroot this way. Since sometimes I get bug reports about this > > stuff, there are some users of it. I believe it is important to be able > > to run any FreeBSD binary for PR purposes, to wave the flag of excellent > > binary compatibility we offer. > > > > COMPAT_43 is there to stay as far as there are people willing to maintain > > it. There are more than one. > > > > I think it's safe to retain on i386. amd64 is less clear to me, but I'd > lean yes. I believe amd64 is required since you have less and less chances to usefully run i386 kernel on modern hardware. > All the other platforms I'd agree with gleb: why do we need it in > the kernels by default (and maybe why do we need to support it at all)? > > Warner From owner-svn-src-head@freebsd.org Fri Aug 9 21:29:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CEF84AAB2C; Fri, 9 Aug 2019 21:29:52 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 464z0b6hgjz44Fm; Fri, 9 Aug 2019 21:29:51 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x79LTnYW099314; Fri, 9 Aug 2019 14:29:49 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x79LTncP099313; Fri, 9 Aug 2019 14:29:49 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201908092129.x79LTncP099313@gndrsh.dnsmgr.net> Subject: Re: svn commit: r350764 - head/sys/arm64/arm64 In-Reply-To: <20190809210505.GJ2731@kib.kiev.ua> To: Konstantin Belousov Date: Fri, 9 Aug 2019 14:29:49 -0700 (PDT) CC: Warner Losh , Gleb Smirnoff , Warner Losh , src-committers , svn-src-all , svn-src-head Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 464z0b6hgjz44Fm X-Spamd-Bar: ++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd@gndrsh.dnsmgr.net X-Spamd-Result: default: False [2.86 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.15)[0.151,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; NEURAL_SPAM_MEDIUM(0.92)[0.922,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; NEURAL_SPAM_LONG(0.84)[0.839,0]; RCPT_COUNT_SEVEN(0.00)[7]; R_SPF_NA(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(0.05)[ip: (0.15), ipnet: 69.59.192.0/19(0.08), asn: 13868(0.05), country: US(-0.05)]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Aug 2019 21:29:52 -0000 > On Fri, Aug 09, 2019 at 10:01:31AM -0600, Warner Losh wrote: > > On Fri, Aug 9, 2019 at 12:57 AM Konstantin Belousov > > wrote: > > > > > On Thu, Aug 08, 2019 at 07:38:28PM -0600, Warner Losh wrote: > > > > On Thu, Aug 8, 2019, 4:59 PM Gleb Smirnoff wrote: > > > > > > > > > Hi, > > > > > > > > > > why do we need COMPAT_43 for arm64 at all? I can't imagine an > > > > > application that would require this compatibility. > > > > > > > > > > A more general question is how far in the future are we going > > > > > to carry COMPAT_43 for i386/amd64? > > > > > > > > > > > > > COMPAT_43 is a weird option. It's a combo of both sys calls and kernel > > > > behavior modifications. Before we thinned the ABIs we supported, it was > > > > necessary for them as well. The biggest behavior change is around > > > signals. > > > > It is weird to sort out and nobody has done the deep analysis to see what > > > > is truly unused and what is there for compat with Linux and other SysV > > > > systems... > > > I am not aware of any changes that COMPAT_43 provides for the signal > > > handling semantic, except a minor adjustment for interpretation of > > > zero-sized stack for sigaltstack(2). > > > > > > > The onstack stuff was what I was thinking about, but we also have code in > > sys_getpid() that returns the ppid in the second retval register, and > > similar things for getuid and getgid, It also allows ioctl numbers that > > have IOC_IN set, but size == 0 (these would otherwise return ENOTTY). It > > also turns on the COMPAT_OLDSOCK code which generally only kicks in when > > compat bits are set, but in one place it allows a shorter unix domain > > socket path length to be compatible unconditionally. The compatibility TTY > > stuff, at least is under COMPAT_43TTY, but that's purely ioctl translation > > code. > I only reacted to the note about changing the signals syscalls behavior. > But the point is valid, we should not change the syscalls ABI for new > binaries when COMPAT_43 is enabled. I propose the following > https://reviews.freebsd.org/D21200 > > WRT ioctl code for no IOC_OUT and size == 0, I believe that this is in > fact cannot be changed. It is enabled also under COMPAT_FREEBSD4 and > 5, and we always enable these for GENERIC. So effectively this ioctl > permissive mode is always there. > > > > > The COMPAT_43 option indeed enables lcall 7,0 syscall entry emulation, > > > on both i386 and amd64. We are able to run FreeBSD 1.1.8 (i386) on amd64 > > > kernel in chroot this way. Since sometimes I get bug reports about this > > > stuff, there are some users of it. I believe it is important to be able > > > to run any FreeBSD binary for PR purposes, to wave the flag of excellent > > > binary compatibility we offer. > > > > > > COMPAT_43 is there to stay as far as there are people willing to maintain > > > it. There are more than one. > > > > > > > I think it's safe to retain on i386. amd64 is less clear to me, but I'd > > lean yes. > I believe amd64 is required since you have less and less chances to usefully > run i386 kernel on modern hardware. Would this also be required for running i386 binaries on amd64 using lib32 that expect the COMPAT_43 behavior? > > All the other platforms I'd agree with gleb: why do we need it in > > the kernels by default (and maybe why do we need to support it at all)? > > > > Warner -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Fri Aug 9 21:49:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7114AB204; Fri, 9 Aug 2019 21:49:10 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 464zQt1gWYz45R4; Fri, 9 Aug 2019 21:49:09 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x79Ln15X031905 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 10 Aug 2019 00:49:05 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x79Ln15X031905 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x79Ln1gi031904; Sat, 10 Aug 2019 00:49:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 10 Aug 2019 00:49:01 +0300 From: Konstantin Belousov To: rgrimes@freebsd.org Cc: Warner Losh , Gleb Smirnoff , Warner Losh , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r350764 - head/sys/arm64/arm64 Message-ID: <20190809214901.GK2731@kib.kiev.ua> References: <20190809210505.GJ2731@kib.kiev.ua> <201908092129.x79LTncP099313@gndrsh.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201908092129.x79LTncP099313@gndrsh.dnsmgr.net> User-Agent: Mutt/1.12.1 (2019-06-15) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 464zQt1gWYz45R4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-2.99 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-0.997,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.99)[-0.994,0]; RCPT_COUNT_SEVEN(0.00)[7]; IP_SCORE(0.00)[ip: (-2.57), ipnet: 2001:470::/32(-4.47), asn: 6939(-2.97), country: US(-0.05)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Aug 2019 21:49:11 -0000 On Fri, Aug 09, 2019 at 02:29:49PM -0700, Rodney W. Grimes wrote: > > On Fri, Aug 09, 2019 at 10:01:31AM -0600, Warner Losh wrote: > > > On Fri, Aug 9, 2019 at 12:57 AM Konstantin Belousov > > > wrote: > > > > > > > On Thu, Aug 08, 2019 at 07:38:28PM -0600, Warner Losh wrote: > > > > > On Thu, Aug 8, 2019, 4:59 PM Gleb Smirnoff wrote: > > > > > > > > > > > Hi, > > > > > > > > > > > > why do we need COMPAT_43 for arm64 at all? I can't imagine an > > > > > > application that would require this compatibility. > > > > > > > > > > > > A more general question is how far in the future are we going > > > > > > to carry COMPAT_43 for i386/amd64? > > > > > > > > > > > > > > > > COMPAT_43 is a weird option. It's a combo of both sys calls and kernel > > > > > behavior modifications. Before we thinned the ABIs we supported, it was > > > > > necessary for them as well. The biggest behavior change is around > > > > signals. > > > > > It is weird to sort out and nobody has done the deep analysis to see what > > > > > is truly unused and what is there for compat with Linux and other SysV > > > > > systems... > > > > I am not aware of any changes that COMPAT_43 provides for the signal > > > > handling semantic, except a minor adjustment for interpretation of > > > > zero-sized stack for sigaltstack(2). > > > > > > > > > > The onstack stuff was what I was thinking about, but we also have code in > > > sys_getpid() that returns the ppid in the second retval register, and > > > similar things for getuid and getgid, It also allows ioctl numbers that > > > have IOC_IN set, but size == 0 (these would otherwise return ENOTTY). It > > > also turns on the COMPAT_OLDSOCK code which generally only kicks in when > > > compat bits are set, but in one place it allows a shorter unix domain > > > socket path length to be compatible unconditionally. The compatibility TTY > > > stuff, at least is under COMPAT_43TTY, but that's purely ioctl translation > > > code. > > I only reacted to the note about changing the signals syscalls behavior. > > But the point is valid, we should not change the syscalls ABI for new > > binaries when COMPAT_43 is enabled. I propose the following > > https://reviews.freebsd.org/D21200 > > > > WRT ioctl code for no IOC_OUT and size == 0, I believe that this is in > > fact cannot be changed. It is enabled also under COMPAT_FREEBSD4 and > > 5, and we always enable these for GENERIC. So effectively this ioctl > > permissive mode is always there. > > > > > > > > The COMPAT_43 option indeed enables lcall 7,0 syscall entry emulation, > > > > on both i386 and amd64. We are able to run FreeBSD 1.1.8 (i386) on amd64 > > > > kernel in chroot this way. Since sometimes I get bug reports about this > > > > stuff, there are some users of it. I believe it is important to be able > > > > to run any FreeBSD binary for PR purposes, to wave the flag of excellent > > > > binary compatibility we offer. > > > > > > > > COMPAT_43 is there to stay as far as there are people willing to maintain > > > > it. There are more than one. > > > > > > > > > > I think it's safe to retain on i386. amd64 is less clear to me, but I'd > > > lean yes. > > I believe amd64 is required since you have less and less chances to usefully > > run i386 kernel on modern hardware. > > Would this also be required for running i386 binaries on amd64 using lib32 > that expect the COMPAT_43 behavior? I do not quite understand the question. My proposed change would mostly limit effect of COMPAT_43 to a.out binaries. /usr/lib32 are ELF. I would not expect any modern (as in, ELF) binaries to require changes to the syscalls behavior from COMPAT_43. > > > > All the other platforms I'd agree with gleb: why do we need it in > > > the kernels by default (and maybe why do we need to support it at all)? > > > > > > Warner > > -- > Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Fri Aug 9 23:50:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E19B7AD451; Fri, 9 Aug 2019 23:50:57 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46527P5Hbbz4Bly; Fri, 9 Aug 2019 23:50:57 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 981381D4DA; Fri, 9 Aug 2019 23:50:57 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x79NovlF057295; Fri, 9 Aug 2019 23:50:57 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x79NovgE057294; Fri, 9 Aug 2019 23:50:57 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201908092350.x79NovgE057294@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 9 Aug 2019 23:50:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350827 - head/tests/sys/fs/fusefs X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/tests/sys/fs/fusefs X-SVN-Commit-Revision: 350827 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Aug 2019 23:50:57 -0000 Author: brooks Date: Fri Aug 9 23:50:57 2019 New Revision: 350827 URL: https://svnweb.freebsd.org/changeset/base/350827 Log: Don't add -Wno-class-memaccess with older gcc. This is a gcc 8.0+ warning which needed to be silenced on for the riscv build. amd64-xtoolchain-gcc still uses gcc 6.4.0 and does not understand this flag. Reviewed by: asomers Feedback from: imp Differential Revision: https://reviews.freebsd.org/D21195 Modified: head/tests/sys/fs/fusefs/Makefile Modified: head/tests/sys/fs/fusefs/Makefile ============================================================================== --- head/tests/sys/fs/fusefs/Makefile Fri Aug 9 20:16:38 2019 (r350826) +++ head/tests/sys/fs/fusefs/Makefile Fri Aug 9 23:50:57 2019 (r350827) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/fs/fusefs @@ -65,7 +67,10 @@ TEST_METADATA+= timeout=10 FUSEFS= ${SRCTOP}/sys/fs/fuse MOUNT= ${SRCTOP}/sbin/mount # Suppress warnings that GCC generates for the libc++ and gtest headers. -CXXWARNFLAGS.gcc+= -Wno-placement-new -Wno-attributes -Wno-class-memaccess +CXXWARNFLAGS.gcc+= -Wno-placement-new -Wno-attributes +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 80000 +CXXWARNFLAGS+= -Wno-class-memaccess +.endif CXXFLAGS+= -I${SRCTOP}/tests CXXFLAGS+= -I${FUSEFS} CXXFLAGS+= -I${MOUNT} From owner-svn-src-head@freebsd.org Sat Aug 10 00:18:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B6C54ADEFB for ; Sat, 10 Aug 2019 00:18:46 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4652lT64wRz4D3f for ; Sat, 10 Aug 2019 00:18:45 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72c.google.com with SMTP id d79so72955763qke.11 for ; Fri, 09 Aug 2019 17:18:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FeqrBd7UigagxbXy0TtbM7Cp/UGvhU6JeueDZS+vpw8=; b=P811mqUIOoA8XQ4do/fws+GtcdHfldaF0+AxSI8piDFQkgs6KhImuxnoWLEmDWed/1 t8j9IblARIzH0SzVUpMxV1OUeGcgctzNzKTk63YNaIbCheodvVH4y10vKiXtOYKaqmMo sVnahoDsx0g89d+6Y9YmuG7kDsK88+yYjLTD0FxB2K13Meqadm2tAdFEzejxGVaE1Jkq nfTy48pin0yXNNUcQbhd2SkKZYAStmSCnQeHLjgAK5uOJ9aP1YoVYXjj1rmag0FpIl/H C3PoQW+rdyA5sKRNRk0BTkfuM4cgzaYkeuJQI1pYwmXKGxrtUjPpAk1P3VshdMS6PDyK 8waA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FeqrBd7UigagxbXy0TtbM7Cp/UGvhU6JeueDZS+vpw8=; b=NqFicJ5vciAq70lnYkHvalY0MCWazYwlHoFvGAY7zkEUW9KENsYOY3OrzkadQ7UGQg uTQxOF+bim9kjP9KybmP0O5Y4Unna4PUczrQFNr/hM5BfOtzP3alwPSq0Q/wPHx+xyf9 pGpip5hQntSB2EqfJgjdCVgNdP6PLbANE+8i4xM7zpBEDg5s4Np68CAXa4/+2q78ct38 6t8Msl5hgROxg2ZI3qlZrLxWaxrugfZha64tgy2d7+uXDIY7x1F993zrAuBYkfyesaT/ TpfS6oplOmgcrooWkA6SY3O3U6gRJmcOoWIy2/56+2cUfCQFGn7WFuYjRAgdHDQd6eyR wRnw== X-Gm-Message-State: APjAAAUwud9/Iq+q41DUmYZ19qAcHEPLsW5MEz+oe4XtDu1f4qHY355O ooThF2ZqbIZlk91sA+fJ/A9+Y/Uddy0dqrS3X3F2nw== X-Google-Smtp-Source: APXvYqy4DGFCBPuuQDqIDa0t5s6VI6UF5q7j2IbmAXoL75gU/MRgbr8TRLVGPPlMFwKQ+UBTUofwINuo7NyTtIDqJT8= X-Received: by 2002:a37:c87:: with SMTP id 129mr19221533qkm.240.1565396323984; Fri, 09 Aug 2019 17:18:43 -0700 (PDT) MIME-Version: 1.0 References: <201908081748.x78Hm79V085760@repo.freebsd.org> <20190808225947.GD1531@FreeBSD.org> <20190809065733.GI2731@kib.kiev.ua> <20190809210505.GJ2731@kib.kiev.ua> In-Reply-To: <20190809210505.GJ2731@kib.kiev.ua> From: Warner Losh Date: Fri, 9 Aug 2019 18:18:32 -0600 Message-ID: Subject: Re: svn commit: r350764 - head/sys/arm64/arm64 To: Konstantin Belousov Cc: Gleb Smirnoff , Warner Losh , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 4652lT64wRz4D3f X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=P811mqUI; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72c) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.95 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.99)[-0.993,0]; RCVD_IN_DNSWL_NONE(0.00)[c.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; FREEMAIL_TO(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.96)[ip: (-9.36), ipnet: 2607:f8b0::/32(-2.98), asn: 15169(-2.40), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Aug 2019 00:18:46 -0000 On Fri, Aug 9, 2019 at 3:05 PM Konstantin Belousov wrote: > On Fri, Aug 09, 2019 at 10:01:31AM -0600, Warner Losh wrote: > > On Fri, Aug 9, 2019 at 12:57 AM Konstantin Belousov > > > wrote: > > > > > On Thu, Aug 08, 2019 at 07:38:28PM -0600, Warner Losh wrote: > > > > On Thu, Aug 8, 2019, 4:59 PM Gleb Smirnoff > wrote: > > > > > > > > > Hi, > > > > > > > > > > why do we need COMPAT_43 for arm64 at all? I can't imagine an > > > > > application that would require this compatibility. > > > > > > > > > > A more general question is how far in the future are we going > > > > > to carry COMPAT_43 for i386/amd64? > > > > > > > > > > > > > COMPAT_43 is a weird option. It's a combo of both sys calls and > kernel > > > > behavior modifications. Before we thinned the ABIs we supported, it > was > > > > necessary for them as well. The biggest behavior change is around > > > signals. > > > > It is weird to sort out and nobody has done the deep analysis to see > what > > > > is truly unused and what is there for compat with Linux and other > SysV > > > > systems... > > > I am not aware of any changes that COMPAT_43 provides for the signal > > > handling semantic, except a minor adjustment for interpretation of > > > zero-sized stack for sigaltstack(2). > > > > > > > The onstack stuff was what I was thinking about, but we also have code in > > sys_getpid() that returns the ppid in the second retval register, and > > similar things for getuid and getgid, It also allows ioctl numbers that > > have IOC_IN set, but size == 0 (these would otherwise return ENOTTY). It > > also turns on the COMPAT_OLDSOCK code which generally only kicks in when > > compat bits are set, but in one place it allows a shorter unix domain > > socket path length to be compatible unconditionally. The compatibility > TTY > > stuff, at least is under COMPAT_43TTY, but that's purely ioctl > translation > > code. > I only reacted to the note about changing the signals syscalls behavior. > But the point is valid, we should not change the syscalls ABI for new > binaries when COMPAT_43 is enabled. I propose the following > https://reviews.freebsd.org/D21200 Glad I did the dumpster-diving grep then. I like your proposal for the same reasons you stated. WRT ioctl code for no IOC_OUT and size == 0, I believe that this is in > fact cannot be changed. It is enabled also under COMPAT_FREEBSD4 and > 5, and we always enable these for GENERIC. So effectively this ioctl > permissive mode is always there. > Yes. I also agree. And I honestly think it's OK. > > > > The COMPAT_43 option indeed enables lcall 7,0 syscall entry emulation, > > > on both i386 and amd64. We are able to run FreeBSD 1.1.8 (i386) on > amd64 > > > kernel in chroot this way. Since sometimes I get bug reports about > this > > > stuff, there are some users of it. I believe it is important to be > able > > > to run any FreeBSD binary for PR purposes, to wave the flag of > excellent > > > binary compatibility we offer. > > > > > > COMPAT_43 is there to stay as far as there are people willing to > maintain > > > it. There are more than one. > > > > > > > I think it's safe to retain on i386. amd64 is less clear to me, but I'd > > lean yes. > I believe amd64 is required since you have less and less chances to > usefully > run i386 kernel on modern hardware. > True. With your changes, enabling the option is much safer, and only drags in a minor amount of extra code. All but the most space starved users won't care at all about the delta in size. Warner > > All the other platforms I'd agree with gleb: why do we need it in > > the kernels by default (and maybe why do we need to support it at all)? > > > > Warner > From owner-svn-src-head@freebsd.org Sat Aug 10 04:15:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B83B4B1C22; Sat, 10 Aug 2019 04:15:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46580n30H6z4NNV; Sat, 10 Aug 2019 04:15:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49C2B20517; Sat, 10 Aug 2019 04:15:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7A4Fb0o017592; Sat, 10 Aug 2019 04:15:37 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7A4FbQu017591; Sat, 10 Aug 2019 04:15:37 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908100415.x7A4FbQu017591@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 10 Aug 2019 04:15:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350830 - head/sys/sparc64/conf X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/sparc64/conf X-SVN-Commit-Revision: 350830 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Aug 2019 04:15:37 -0000 Author: imp Date: Sat Aug 10 04:15:36 2019 New Revision: 350830 URL: https://svnweb.freebsd.org/changeset/base/350830 Log: These are no longer a thing, remove them. We don't need to omit ep and ex from LINT since they have been removed from the tree. Modified: head/sys/sparc64/conf/NOTES Modified: head/sys/sparc64/conf/NOTES ============================================================================== --- head/sys/sparc64/conf/NOTES Sat Aug 10 00:02:45 2019 (r350829) +++ head/sys/sparc64/conf/NOTES Sat Aug 10 04:15:36 2019 (r350830) @@ -119,8 +119,6 @@ nodevice snd_via8233 nodevice snd_via82c686 nodevice snd_vibes nodevice snd_uaudio -nodevice ep -nodevice ex ##################################################################### From owner-svn-src-head@freebsd.org Sat Aug 10 15:53:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB48EBF80F; Sat, 10 Aug 2019 15:53:43 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 465RVH4Rn4z3Mqb; Sat, 10 Aug 2019 15:53:43 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A25C251; Sat, 10 Aug 2019 15:53:43 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7AFrhaf030049; Sat, 10 Aug 2019 15:53:43 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7AFrhvw030048; Sat, 10 Aug 2019 15:53:43 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201908101553.x7AFrhvw030048@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Enji Cooper Date: Sat, 10 Aug 2019 15:53:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350837 - head/tests/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/tests/sys/opencrypto X-SVN-Commit-Revision: 350837 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Aug 2019 15:53:43 -0000 Author: ngie Date: Sat Aug 10 15:53:42 2019 New Revision: 350837 URL: https://svnweb.freebsd.org/changeset/base/350837 Log: tests/sys/opencrypto: enable armv8crypto on aarch64 This change makes required modifications in runtests to also only require the aesni module on Intel (i386/amd64) platforms, as it is an Intel specific module. MFC after: 1 month MFC to: ^/stable/12 (support not present on ^/stable/11) Submitted by: Greg V Differential Revision: https://reviews.freebsd.org/D21018 Modified: head/tests/sys/opencrypto/cryptotest.py head/tests/sys/opencrypto/runtests.sh Modified: head/tests/sys/opencrypto/cryptotest.py ============================================================================== --- head/tests/sys/opencrypto/cryptotest.py Sat Aug 10 13:50:15 2019 (r350836) +++ head/tests/sys/opencrypto/cryptotest.py Sat Aug 10 15:53:42 2019 (r350837) @@ -50,9 +50,9 @@ def katg(base, glob): raise unittest.SkipTest("Missing %s test vectors" % (base)) return iglob(os.path.join(katdir, base, glob)) -aesmodules = [ 'cryptosoft0', 'aesni0', 'ccr0', 'ccp0' ] +aesmodules = [ 'cryptosoft0', 'aesni0', 'armv8crypto0', 'ccr0', 'ccp0' ] desmodules = [ 'cryptosoft0', ] -shamodules = [ 'cryptosoft0', 'aesni0', 'ccr0', 'ccp0' ] +shamodules = [ 'cryptosoft0', 'aesni0', 'armv8crypto0', 'ccr0', 'ccp0' ] def GenTestCase(cname): try: @@ -500,6 +500,7 @@ def GenTestCase(cname): cryptosoft = GenTestCase('cryptosoft0') aesni = GenTestCase('aesni0') +armv8crypto = GenTestCase('armv8crypto0') ccr = GenTestCase('ccr0') ccp = GenTestCase('ccp0') Modified: head/tests/sys/opencrypto/runtests.sh ============================================================================== --- head/tests/sys/opencrypto/runtests.sh Sat Aug 10 13:50:15 2019 (r350836) +++ head/tests/sys/opencrypto/runtests.sh Sat Aug 10 15:53:42 2019 (r350837) @@ -60,7 +60,19 @@ cleanup_tests() } trap cleanup_tests EXIT INT TERM -for required_module in nexus/aesni cryptodev; do +cpu_type="$(uname -p)" +cpu_module= + +case ${cpu_type} in +aarch64) + cpu_module=nexus/armv8crypto + ;; +amd64|i386) + cpu_module=nexus/aesni + ;; +esac + +for required_module in $cpu_module cryptodev; do if ! kldstat -q -m $required_module; then module_to_load=${required_module#nexus/} if ! kldload ${module_to_load}; then From owner-svn-src-head@freebsd.org Sat Aug 10 17:14:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3057AC1034; Sat, 10 Aug 2019 17:14:36 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 465THc0SWTz3wrL; Sat, 10 Aug 2019 17:14:36 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B02E10BD; Sat, 10 Aug 2019 17:14:36 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7AHEZBT076734; Sat, 10 Aug 2019 17:14:35 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7AHEZLP076733; Sat, 10 Aug 2019 17:14:35 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201908101714.x7AHEZLP076733@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 10 Aug 2019 17:14:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350838 - head/sys/arm/ti/am335x X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/ti/am335x X-SVN-Commit-Revision: 350838 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Aug 2019 17:14:36 -0000 Author: ian Date: Sat Aug 10 17:14:35 2019 New Revision: 350838 URL: https://svnweb.freebsd.org/changeset/base/350838 Log: Switch the am335x_pmic driver to using iicdev_readfrom/writeto. PR: 239697 Submitted by: Chuhong Yuan Modified: head/sys/arm/ti/am335x/am335x_pmic.c Modified: head/sys/arm/ti/am335x/am335x_pmic.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_pmic.c Sat Aug 10 15:53:42 2019 (r350837) +++ head/sys/arm/ti/am335x/am335x_pmic.c Sat Aug 10 17:14:35 2019 (r350838) @@ -79,30 +79,16 @@ static void am335x_pmic_shutdown(void *, int); static int am335x_pmic_read(device_t dev, uint8_t addr, uint8_t *data, uint8_t size) { - struct am335x_pmic_softc *sc = device_get_softc(dev); - struct iic_msg msg[] = { - { sc->sc_addr, IIC_M_WR, 1, &addr }, - { sc->sc_addr, IIC_M_RD, size, data }, - }; - return (iicbus_transfer(dev, msg, 2)); + return (iicdev_readfrom(dev, addr, data, size, IIC_INTRWAIT)); } static int am335x_pmic_write(device_t dev, uint8_t address, uint8_t *data, uint8_t size) { - uint8_t buffer[MAX_IIC_DATA_SIZE + 1]; - struct am335x_pmic_softc *sc = device_get_softc(dev); - struct iic_msg msg[] = { - { sc->sc_addr, IIC_M_WR, size + 1, buffer }, - }; - if (size > MAX_IIC_DATA_SIZE) return (ENOMEM); - buffer[0] = address; - memcpy(buffer + 1, data, size); - - return (iicbus_transfer(dev, msg, 1)); + return (iicdev_writeto(dev, address, data, size, IIC_INTRWAIT)); } static void From owner-svn-src-head@freebsd.org Sat Aug 10 17:28:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E13A5C1483; Sat, 10 Aug 2019 17:28:14 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 465TbL5WzNz3xWD; Sat, 10 Aug 2019 17:28:14 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B471912A2; Sat, 10 Aug 2019 17:28:14 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7AHSEoq082897; Sat, 10 Aug 2019 17:28:14 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7AHSEOc082896; Sat, 10 Aug 2019 17:28:14 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201908101728.x7AHSEOc082896@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 10 Aug 2019 17:28:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350840 - head/sys/arm/ti/am335x X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/ti/am335x X-SVN-Commit-Revision: 350840 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Aug 2019 17:28:14 -0000 Author: ian Date: Sat Aug 10 17:28:14 2019 New Revision: 350840 URL: https://svnweb.freebsd.org/changeset/base/350840 Log: Garbage collect the no-longer-necessary MAX_IIC_DATA_SIZE (there is not a buffer allocated at that fixed size anymore). Modified: head/sys/arm/ti/am335x/am335x_pmic.c Modified: head/sys/arm/ti/am335x/am335x_pmic.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_pmic.c Sat Aug 10 17:17:36 2019 (r350839) +++ head/sys/arm/ti/am335x/am335x_pmic.c Sat Aug 10 17:28:14 2019 (r350840) @@ -56,9 +56,6 @@ __FBSDID("$FreeBSD$"); #include "iicbus_if.h" -#define MAX_IIC_DATA_SIZE 2 - - struct am335x_pmic_softc { device_t sc_dev; uint32_t sc_addr; @@ -85,9 +82,6 @@ am335x_pmic_read(device_t dev, uint8_t addr, uint8_t * static int am335x_pmic_write(device_t dev, uint8_t address, uint8_t *data, uint8_t size) { - if (size > MAX_IIC_DATA_SIZE) - return (ENOMEM); - return (iicdev_writeto(dev, address, data, size, IIC_INTRWAIT)); } From owner-svn-src-head@freebsd.org Sat Aug 10 17:48:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 594F5C1A2F; Sat, 10 Aug 2019 17:48:12 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 465V2N1gmFz3yMv; Sat, 10 Aug 2019 17:48:12 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B3671644; Sat, 10 Aug 2019 17:48:12 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7AHmBZB094674; Sat, 10 Aug 2019 17:48:11 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7AHmBLl094673; Sat, 10 Aug 2019 17:48:11 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201908101748.x7AHmBLl094673@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 10 Aug 2019 17:48:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350841 - head/sys/arm/ti/am335x X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/ti/am335x X-SVN-Commit-Revision: 350841 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Aug 2019 17:48:12 -0000 Author: ian Date: Sat Aug 10 17:48:11 2019 New Revision: 350841 URL: https://svnweb.freebsd.org/changeset/base/350841 Log: When responding to an interrupt in the am335x_pmic driver, use a taskqueue thread to do the work that involves i2c IO, which sleeps while the IO is in progress. Modified: head/sys/arm/ti/am335x/am335x_pmic.c Modified: head/sys/arm/ti/am335x/am335x_pmic.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_pmic.c Sat Aug 10 17:28:14 2019 (r350840) +++ head/sys/arm/ti/am335x/am335x_pmic.c Sat Aug 10 17:48:11 2019 (r350841) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -62,6 +63,7 @@ struct am335x_pmic_softc { struct intr_config_hook enum_hook; struct resource *sc_irq_res; void *sc_intrhand; + struct task intr_task; }; static const char *tps65217_voreg_c[4] = {"4.10V", "4.15V", "4.20V", "4.25V"}; @@ -86,7 +88,7 @@ am335x_pmic_write(device_t dev, uint8_t address, uint8 } static void -am335x_pmic_intr(void *arg) +am335x_pmic_intrtask(void *arg, int pending) { struct am335x_pmic_softc *sc = (struct am335x_pmic_softc *)arg; struct tps65217_status_reg status_reg; @@ -94,20 +96,16 @@ am335x_pmic_intr(void *arg) int rv; char notify_buf[16]; - THREAD_SLEEPING_OK(); rv = am335x_pmic_read(sc->sc_dev, TPS65217_INT_REG, (uint8_t *)&int_reg, 1); if (rv != 0) { device_printf(sc->sc_dev, "Cannot read interrupt register\n"); - THREAD_NO_SLEEPING(); return; } rv = am335x_pmic_read(sc->sc_dev, TPS65217_STATUS_REG, (uint8_t *)&status_reg, 1); if (rv != 0) { device_printf(sc->sc_dev, "Cannot read status register\n"); - THREAD_NO_SLEEPING(); return; } - THREAD_NO_SLEEPING(); if (int_reg.pbi && status_reg.pb) shutdown_nice(RB_POWEROFF); @@ -118,6 +116,18 @@ am335x_pmic_intr(void *arg) } } +static void +am335x_pmic_intr(void *arg) +{ + struct am335x_pmic_softc *sc = arg; + + /* + * Handling the interrupt requires doing i2c IO, which sleeps while the + * IO is in progress, so do the processing on a taskqueue thread. + */ + taskqueue_enqueue(taskqueue_thread, &sc->intr_task); +} + static int am335x_pmic_probe(device_t dev) { @@ -279,6 +289,8 @@ am335x_pmic_attach(device_t dev) int rid; sc = device_get_softc(dev); + + TASK_INIT(&sc->intr_task, 0, am335x_pmic_intrtask, sc); rid = 0; sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, From owner-svn-src-head@freebsd.org Sat Aug 10 17:58:35 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07727C1D0A; Sat, 10 Aug 2019 17:58:35 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 465VGL6K6Zz3yvD; Sat, 10 Aug 2019 17:58:34 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B705C1816; Sat, 10 Aug 2019 17:58:34 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7AHwYCk000709; Sat, 10 Aug 2019 17:58:34 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7AHwVPF000692; Sat, 10 Aug 2019 17:58:31 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201908101758.x7AHwVPF000692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 10 Aug 2019 17:58:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350842 - in head/sys/arm/allwinner: . a20 clkng X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys/arm/allwinner: . a20 clkng X-SVN-Commit-Revision: 350842 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Aug 2019 17:58:35 -0000 Author: manu Date: Sat Aug 10 17:58:30 2019 New Revision: 350842 URL: https://svnweb.freebsd.org/changeset/base/350842 Log: allwinner: Rework the BUS_PASS on drivers - Put all clock and control unit driver in BUS_PASS_RESOURCE except for the DE2 CCU as it needs the main CCU to be available. - Use BUS_PASS_CPU for a20_cpu_cfg as it makes more sense. - For aw_syscon use SCHEDULER pass as we need it early for drivers that attach in BUS_PASS_SUPPORTDEV - For the rest we can use BUS_PASS_SUPPORTDEV Modified: head/sys/arm/allwinner/a10_sramc.c head/sys/arm/allwinner/a20/a20_cpu_cfg.c head/sys/arm/allwinner/aw_ccu.c head/sys/arm/allwinner/aw_gmacclk.c head/sys/arm/allwinner/aw_reset.c head/sys/arm/allwinner/aw_rsb.c head/sys/arm/allwinner/aw_rtc.c head/sys/arm/allwinner/aw_sid.c head/sys/arm/allwinner/aw_syscon.c head/sys/arm/allwinner/clkng/ccu_a10.c head/sys/arm/allwinner/clkng/ccu_a13.c head/sys/arm/allwinner/clkng/ccu_a31.c head/sys/arm/allwinner/clkng/ccu_a64.c head/sys/arm/allwinner/clkng/ccu_a83t.c head/sys/arm/allwinner/clkng/ccu_de2.c head/sys/arm/allwinner/clkng/ccu_h3.c head/sys/arm/allwinner/clkng/ccu_sun8i_r.c Modified: head/sys/arm/allwinner/a10_sramc.c ============================================================================== --- head/sys/arm/allwinner/a10_sramc.c Sat Aug 10 17:48:11 2019 (r350841) +++ head/sys/arm/allwinner/a10_sramc.c Sat Aug 10 17:58:30 2019 (r350842) @@ -116,7 +116,7 @@ static driver_t a10_sramc_driver = { static devclass_t a10_sramc_devclass; EARLY_DRIVER_MODULE(a10_sramc, simplebus, a10_sramc_driver, a10_sramc_devclass, - 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_EARLY); + 0, 0, BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_FIRST); int a10_map_to_emac(void) Modified: head/sys/arm/allwinner/a20/a20_cpu_cfg.c ============================================================================== --- head/sys/arm/allwinner/a20/a20_cpu_cfg.c Sat Aug 10 17:48:11 2019 (r350841) +++ head/sys/arm/allwinner/a20/a20_cpu_cfg.c Sat Aug 10 17:58:30 2019 (r350842) @@ -119,7 +119,7 @@ static driver_t a20_cpu_cfg_driver = { static devclass_t a20_cpu_cfg_devclass; EARLY_DRIVER_MODULE(a20_cpu_cfg, simplebus, a20_cpu_cfg_driver, a20_cpu_cfg_devclass, 0, 0, - BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); + BUS_PASS_CPU + BUS_PASS_ORDER_FIRST); uint64_t a20_read_counter64(void) Modified: head/sys/arm/allwinner/aw_ccu.c ============================================================================== --- head/sys/arm/allwinner/aw_ccu.c Sat Aug 10 17:48:11 2019 (r350841) +++ head/sys/arm/allwinner/aw_ccu.c Sat Aug 10 17:58:30 2019 (r350842) @@ -250,6 +250,6 @@ DEFINE_CLASS_1(aw_ccu, aw_ccu_driver, aw_ccu_methods, static devclass_t aw_ccu_devclass; EARLY_DRIVER_MODULE(aw_ccu, simplebus, aw_ccu_driver, aw_ccu_devclass, - 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); + 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); MODULE_VERSION(aw_ccu, 1); Modified: head/sys/arm/allwinner/aw_gmacclk.c ============================================================================== --- head/sys/arm/allwinner/aw_gmacclk.c Sat Aug 10 17:48:11 2019 (r350841) +++ head/sys/arm/allwinner/aw_gmacclk.c Sat Aug 10 17:58:30 2019 (r350842) @@ -277,4 +277,4 @@ static driver_t aw_gmacclk_driver = { static devclass_t aw_gmacclk_devclass; EARLY_DRIVER_MODULE(aw_gmacclk, simplebus, aw_gmacclk_driver, - aw_gmacclk_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); + aw_gmacclk_devclass, 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/arm/allwinner/aw_reset.c ============================================================================== --- head/sys/arm/allwinner/aw_reset.c Sat Aug 10 17:48:11 2019 (r350841) +++ head/sys/arm/allwinner/aw_reset.c Sat Aug 10 17:58:30 2019 (r350842) @@ -162,5 +162,5 @@ static driver_t aw_reset_driver = { static devclass_t aw_reset_devclass; EARLY_DRIVER_MODULE(aw_reset, simplebus, aw_reset_driver, aw_reset_devclass, - 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); + 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); MODULE_VERSION(aw_reset, 1); Modified: head/sys/arm/allwinner/aw_rsb.c ============================================================================== --- head/sys/arm/allwinner/aw_rsb.c Sat Aug 10 17:48:11 2019 (r350841) +++ head/sys/arm/allwinner/aw_rsb.c Sat Aug 10 17:58:30 2019 (r350842) @@ -494,9 +494,9 @@ static driver_t rsb_driver = { static devclass_t rsb_devclass; EARLY_DRIVER_MODULE(iicbus, rsb, iicbus_driver, iicbus_devclass, 0, 0, - BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); + BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_MIDDLE); EARLY_DRIVER_MODULE(rsb, simplebus, rsb_driver, rsb_devclass, 0, 0, - BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); + BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_MIDDLE); MODULE_VERSION(rsb, 1); MODULE_DEPEND(rsb, iicbus, 1, 1, 1); SIMPLEBUS_PNP_INFO(compat_data); Modified: head/sys/arm/allwinner/aw_rtc.c ============================================================================== --- head/sys/arm/allwinner/aw_rtc.c Sat Aug 10 17:48:11 2019 (r350841) +++ head/sys/arm/allwinner/aw_rtc.c Sat Aug 10 17:58:30 2019 (r350842) @@ -185,7 +185,7 @@ static driver_t aw_rtc_driver = { static devclass_t aw_rtc_devclass; EARLY_DRIVER_MODULE(aw_rtc, simplebus, aw_rtc_driver, aw_rtc_devclass, 0, 0, - BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); + BUS_PASS_RESOURCE + BUS_PASS_ORDER_FIRST); MODULE_VERSION(aw_rtc, 1); SIMPLEBUS_PNP_INFO(compat_data); Modified: head/sys/arm/allwinner/aw_sid.c ============================================================================== --- head/sys/arm/allwinner/aw_sid.c Sat Aug 10 17:48:11 2019 (r350841) +++ head/sys/arm/allwinner/aw_sid.c Sat Aug 10 17:58:30 2019 (r350842) @@ -412,6 +412,6 @@ static driver_t aw_sid_driver = { static devclass_t aw_sid_devclass; EARLY_DRIVER_MODULE(aw_sid, simplebus, aw_sid_driver, aw_sid_devclass, 0, 0, - BUS_PASS_RESOURCE + BUS_PASS_ORDER_FIRST); + BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_FIRST); MODULE_VERSION(aw_sid, 1); SIMPLEBUS_PNP_INFO(compat_data); Modified: head/sys/arm/allwinner/aw_syscon.c ============================================================================== --- head/sys/arm/allwinner/aw_syscon.c Sat Aug 10 17:48:11 2019 (r350841) +++ head/sys/arm/allwinner/aw_syscon.c Sat Aug 10 17:58:30 2019 (r350842) @@ -82,5 +82,5 @@ DEFINE_CLASS_1(aw_syscon, aw_syscon_driver, aw_syscon_ static devclass_t aw_syscon_devclass; /* aw_syscon needs to attach prior to if_awg */ EARLY_DRIVER_MODULE(aw_syscon, simplebus, aw_syscon_driver, aw_syscon_devclass, - 0, 0, BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_MIDDLE); + 0, 0, BUS_PASS_SCHEDULER + BUS_PASS_ORDER_LAST); MODULE_VERSION(aw_syscon, 1); Modified: head/sys/arm/allwinner/clkng/ccu_a10.c ============================================================================== --- head/sys/arm/allwinner/clkng/ccu_a10.c Sat Aug 10 17:48:11 2019 (r350841) +++ head/sys/arm/allwinner/clkng/ccu_a10.c Sat Aug 10 17:58:30 2019 (r350842) @@ -621,4 +621,4 @@ DEFINE_CLASS_1(ccu_a10ng, ccu_a10ng_driver, ccu_a10ng_ sizeof(struct aw_ccung_softc), aw_ccung_driver); EARLY_DRIVER_MODULE(ccu_a10ng, simplebus, ccu_a10ng_driver, - ccu_a10ng_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); + ccu_a10ng_devclass, 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/arm/allwinner/clkng/ccu_a13.c ============================================================================== --- head/sys/arm/allwinner/clkng/ccu_a13.c Sat Aug 10 17:48:11 2019 (r350841) +++ head/sys/arm/allwinner/clkng/ccu_a13.c Sat Aug 10 17:58:30 2019 (r350842) @@ -568,4 +568,4 @@ DEFINE_CLASS_1(ccu_a13ng, ccu_a13ng_driver, ccu_a13ng_ sizeof(struct aw_ccung_softc), aw_ccung_driver); EARLY_DRIVER_MODULE(ccu_a13ng, simplebus, ccu_a13ng_driver, - ccu_a13ng_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); + ccu_a13ng_devclass, 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/arm/allwinner/clkng/ccu_a31.c ============================================================================== --- head/sys/arm/allwinner/clkng/ccu_a31.c Sat Aug 10 17:48:11 2019 (r350841) +++ head/sys/arm/allwinner/clkng/ccu_a31.c Sat Aug 10 17:58:30 2019 (r350842) @@ -973,4 +973,4 @@ DEFINE_CLASS_1(ccu_a31ng, ccu_a31ng_driver, ccu_a31ng_ sizeof(struct aw_ccung_softc), aw_ccung_driver); EARLY_DRIVER_MODULE(ccu_a31ng, simplebus, ccu_a31ng_driver, - ccu_a31ng_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_LAST); + ccu_a31ng_devclass, 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/arm/allwinner/clkng/ccu_a64.c ============================================================================== --- head/sys/arm/allwinner/clkng/ccu_a64.c Sat Aug 10 17:48:11 2019 (r350841) +++ head/sys/arm/allwinner/clkng/ccu_a64.c Sat Aug 10 17:58:30 2019 (r350842) @@ -827,4 +827,4 @@ DEFINE_CLASS_1(ccu_a64ng, ccu_a64ng_driver, ccu_a64ng_ sizeof(struct aw_ccung_softc), aw_ccung_driver); EARLY_DRIVER_MODULE(ccu_a64ng, simplebus, ccu_a64ng_driver, - ccu_a64ng_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_LAST); + ccu_a64ng_devclass, 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/arm/allwinner/clkng/ccu_a83t.c ============================================================================== --- head/sys/arm/allwinner/clkng/ccu_a83t.c Sat Aug 10 17:48:11 2019 (r350841) +++ head/sys/arm/allwinner/clkng/ccu_a83t.c Sat Aug 10 17:58:30 2019 (r350842) @@ -786,4 +786,4 @@ DEFINE_CLASS_1(ccu_a83tng, ccu_a83tng_driver, ccu_a83t sizeof(struct aw_ccung_softc), aw_ccung_driver); EARLY_DRIVER_MODULE(ccu_a83tng, simplebus, ccu_a83tng_driver, - ccu_a83tng_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_LAST); + ccu_a83tng_devclass, 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/arm/allwinner/clkng/ccu_de2.c ============================================================================== --- head/sys/arm/allwinner/clkng/ccu_de2.c Sat Aug 10 17:48:11 2019 (r350841) +++ head/sys/arm/allwinner/clkng/ccu_de2.c Sat Aug 10 17:58:30 2019 (r350842) @@ -163,4 +163,4 @@ DEFINE_CLASS_1(ccu_de2, ccu_de2_driver, ccu_de2_method sizeof(struct aw_ccung_softc), aw_ccung_driver); EARLY_DRIVER_MODULE(ccu_de2, simplebus, ccu_de2_driver, - ccu_de2ng_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_LAST); + ccu_de2ng_devclass, 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_LAST); Modified: head/sys/arm/allwinner/clkng/ccu_h3.c ============================================================================== --- head/sys/arm/allwinner/clkng/ccu_h3.c Sat Aug 10 17:48:11 2019 (r350841) +++ head/sys/arm/allwinner/clkng/ccu_h3.c Sat Aug 10 17:58:30 2019 (r350842) @@ -787,4 +787,4 @@ DEFINE_CLASS_1(ccu_h3ng, ccu_h3ng_driver, ccu_h3ng_met sizeof(struct aw_ccung_softc), aw_ccung_driver); EARLY_DRIVER_MODULE(ccu_h3ng, simplebus, ccu_h3ng_driver, - ccu_h3ng_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_LAST); + ccu_h3ng_devclass, 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/arm/allwinner/clkng/ccu_sun8i_r.c ============================================================================== --- head/sys/arm/allwinner/clkng/ccu_sun8i_r.c Sat Aug 10 17:48:11 2019 (r350841) +++ head/sys/arm/allwinner/clkng/ccu_sun8i_r.c Sat Aug 10 17:58:30 2019 (r350842) @@ -215,7 +215,7 @@ DEFINE_CLASS_1(ccu_sun8i_r, ccu_sun8i_r_driver, ccu_su sizeof(struct aw_ccung_softc), aw_ccung_driver); EARLY_DRIVER_MODULE(ccu_sun8i_r, simplebus, ccu_sun8i_r_driver, - ccu_sun8i_r_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_LAST); + ccu_sun8i_r_devclass, 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); static int ccu_a83t_r_probe(device_t dev) @@ -262,4 +262,4 @@ DEFINE_CLASS_1(ccu_a83t_r, ccu_a83t_r_driver, ccu_a83t sizeof(struct aw_ccung_softc), aw_ccung_driver); EARLY_DRIVER_MODULE(ccu_a83t_r, simplebus, ccu_a83t_r_driver, - ccu_a83t_r_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_LAST); + ccu_a83t_r_devclass, 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); From owner-svn-src-head@freebsd.org Sat Aug 10 18:22:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D7E7DC273E; Sat, 10 Aug 2019 18:22:22 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 465Vnp5Pxnz41FQ; Sat, 10 Aug 2019 18:22:22 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CA931C4D; Sat, 10 Aug 2019 18:22:22 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7AIMMI3018081; Sat, 10 Aug 2019 18:22:22 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7AIMMZg018080; Sat, 10 Aug 2019 18:22:22 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908101822.x7AIMMZg018080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 10 Aug 2019 18:22:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350843 - head X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 350843 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Aug 2019 18:22:22 -0000 Author: cem Date: Sat Aug 10 18:22:22 2019 New Revision: 350843 URL: https://svnweb.freebsd.org/changeset/base/350843 Log: .gitignore: Add LINT kernel configurations generated into SRCDIR Modified: head/.gitignore Modified: head/.gitignore ============================================================================== --- head/.gitignore Sat Aug 10 17:58:30 2019 (r350842) +++ head/.gitignore Sat Aug 10 18:22:22 2019 (r350843) @@ -17,3 +17,19 @@ GTAGS ID cscope.out ?cscope.out +# Ignore LINT generated configs. +/sys/amd64/conf/LINT +/sys/amd64/conf/LINT-NOINET +/sys/amd64/conf/LINT-NOINET6 +/sys/amd64/conf/LINT-NOIP +/sys/arm/conf/LINT +/sys/arm/conf/LINT-V5 +/sys/arm/conf/LINT-V7 +/sys/arm64/conf/LINT +/sys/i386/conf/LINT +/sys/i386/conf/LINT-NOINET +/sys/i386/conf/LINT-NOINET6 +/sys/i386/conf/LINT-NOIP +/sys/powerpc/conf/LINT +/sys/powerpc/conf/LINT64 +/sys/sparc64/conf/LINT From owner-svn-src-head@freebsd.org Sat Aug 10 18:50:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C4981C2F41; Sat, 10 Aug 2019 18:50:39 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 465WQR5cFdz429N; Sat, 10 Aug 2019 18:50:39 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 89C052159; Sat, 10 Aug 2019 18:50:39 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7AIod3R030464; Sat, 10 Aug 2019 18:50:39 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7AIobSP030442; Sat, 10 Aug 2019 18:50:37 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201908101850.x7AIobSP030442@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 10 Aug 2019 18:50:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350844 - in head/sys: arm/allwinner arm/allwinner/clkng conf dev/extres/clk X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm/allwinner arm/allwinner/clkng conf dev/extres/clk X-SVN-Commit-Revision: 350844 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Aug 2019 18:50:39 -0000 Author: manu Date: Sat Aug 10 18:50:37 2019 New Revision: 350844 URL: https://svnweb.freebsd.org/changeset/base/350844 Log: allwinner: Add a new clock aw_clk_m We used the aw_clk_nm clock for clock with only one divider factor and used a fake multiplier factor. This cannot work properly as we end up writing the "fake" factor to the register (and so always set the LSB to 1). Create a new clock for those. The reason for not using the clk_div clock is because those clocks are a bit special. Since they are (almost) all related to video we also need to set the parent clock (the main PLL) to a frequency that they can support. As the main PLL have some minimal frequency that they can support we need to be able to set the main PLL to a multiple of the desired frequency. Let say you want to have a 71Mhz pixel clock (typical for a 1280x800 display) and the main PLL cannot go under 192Mhz, you need to set it to 3 times the desired frequency and set the divider to 3 on the hdmi clock. So this also introduce the CLK_SET_ROUND_MULTIPLE flag that allow for this kind of scenario. Added: head/sys/arm/allwinner/clkng/aw_clk_m.c (contents, props changed) head/sys/arm/allwinner/clkng/aw_clk_m.h (contents, props changed) Modified: head/sys/arm/allwinner/clkng/aw_ccung.c head/sys/arm/allwinner/clkng/aw_ccung.h head/sys/arm/allwinner/clkng/aw_clk.h head/sys/arm/allwinner/clkng/ccu_a64.c head/sys/arm/allwinner/files.allwinner head/sys/conf/files.arm64 head/sys/dev/extres/clk/clk.h Modified: head/sys/arm/allwinner/clkng/aw_ccung.c ============================================================================== --- head/sys/arm/allwinner/clkng/aw_ccung.c Sat Aug 10 18:22:22 2019 (r350843) +++ head/sys/arm/allwinner/clkng/aw_ccung.c Sat Aug 10 18:50:37 2019 (r350844) @@ -301,6 +301,9 @@ aw_ccung_attach(device_t dev) case AW_CLK_NM: aw_clk_nm_register(sc->clkdom, sc->clks[i].clk.nm); break; + case AW_CLK_M: + aw_clk_m_register(sc->clkdom, sc->clks[i].clk.m); + break; case AW_CLK_PREDIV_MUX: aw_clk_prediv_mux_register(sc->clkdom, sc->clks[i].clk.prediv_mux); Modified: head/sys/arm/allwinner/clkng/aw_ccung.h ============================================================================== --- head/sys/arm/allwinner/clkng/aw_ccung.h Sat Aug 10 18:22:22 2019 (r350843) +++ head/sys/arm/allwinner/clkng/aw_ccung.h Sat Aug 10 18:50:37 2019 (r350844) @@ -31,6 +31,7 @@ #define __CCU_NG_H__ #include +#include #include #include #include @@ -48,6 +49,7 @@ enum aw_ccung_clk_type { AW_CLK_NM, AW_CLK_PREDIV_MUX, AW_CLK_FRAC, + AW_CLK_M, }; struct aw_ccung_clk { @@ -60,6 +62,7 @@ struct aw_ccung_clk { struct aw_clk_nm_def *nm; struct aw_clk_prediv_mux_def *prediv_mux; struct aw_clk_frac_def *frac; + struct aw_clk_m_def *m; } clk; }; Modified: head/sys/arm/allwinner/clkng/aw_clk.h ============================================================================== --- head/sys/arm/allwinner/clkng/aw_clk.h Sat Aug 10 18:22:22 2019 (r350843) +++ head/sys/arm/allwinner/clkng/aw_clk.h Sat Aug 10 18:50:37 2019 (r350844) @@ -66,6 +66,7 @@ struct aw_clk_init { #define AW_CLK_SCALE_CHANGE 0x0010 #define AW_CLK_HAS_UPDATE 0x0040 #define AW_CLK_HAS_PREDIV 0x0080 +#define AW_CLK_SET_PARENT 0x0100 #define AW_CLK_FACTOR_POWER_OF_TWO 0x0001 #define AW_CLK_FACTOR_ZERO_BASED 0x0002 @@ -338,6 +339,30 @@ aw_clk_factor_get_value(struct aw_clk_factor *factor, .frac.freq1 = _freq1, \ .frac.mode_sel = _mode_sel, \ .frac.freq_sel = _freq_sel, \ + } + +#define M_CLK(_clkname, _id, _name, _pnames, \ + _offset, \ + _mshift, _mwidth, _mvalue, _mflags, \ + _mux_shift, _mux_width, \ + _gate_shift, \ + _flags) \ + static struct aw_clk_m_def _clkname = { \ + .clkdef = { \ + .id = _id, \ + .name = _name, \ + .parent_names = _pnames, \ + .parent_cnt = nitems(_pnames), \ + }, \ + .offset = _offset, \ + .mux_shift = _mux_shift, \ + .m.shift = _mshift, \ + .m.width = _mwidth, \ + .m.value = _mvalue, \ + .m.flags = _mflags, \ + .mux_width = _mux_width, \ + .gate_shift = _gate_shift, \ + .flags = _flags, \ } #define NM_CLK(_clkname, _id, _name, _pnames, \ Added: head/sys/arm/allwinner/clkng/aw_clk_m.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/clkng/aw_clk_m.c Sat Aug 10 18:50:37 2019 (r350844) @@ -0,0 +1,580 @@ +/*- + * Copyright (c) 2019 Emmanuel Vadot + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include + +#include +#include + +#include "clkdev_if.h" + +/* + * clknode for clocks matching the formula : + * + * clk = clkin / m + * And that needs to potentially : + * 1) Set the parent freq + * 2) Support Setting the parent to a multiple + * + */ + +struct aw_clk_m_sc { + uint32_t offset; + + struct aw_clk_factor m; + + uint32_t mux_shift; + uint32_t mux_mask; + uint32_t gate_shift; + + uint32_t flags; +}; + +#define WRITE4(_clk, off, val) \ + CLKDEV_WRITE_4(clknode_get_device(_clk), off, val) +#define READ4(_clk, off, val) \ + CLKDEV_READ_4(clknode_get_device(_clk), off, val) +#define DEVICE_LOCK(_clk) \ + CLKDEV_DEVICE_LOCK(clknode_get_device(_clk)) +#define DEVICE_UNLOCK(_clk) \ + CLKDEV_DEVICE_UNLOCK(clknode_get_device(_clk)) + +static int +aw_clk_m_init(struct clknode *clk, device_t dev) +{ + struct aw_clk_m_sc *sc; + uint32_t val, idx; + + sc = clknode_get_softc(clk); + + idx = 0; + if ((sc->flags & AW_CLK_HAS_MUX) != 0) { + DEVICE_LOCK(clk); + READ4(clk, sc->offset, &val); + DEVICE_UNLOCK(clk); + + idx = (val & sc->mux_mask) >> sc->mux_shift; + } + + clknode_init_parent_idx(clk, idx); + return (0); +} + +static int +aw_clk_m_set_gate(struct clknode *clk, bool enable) +{ + struct aw_clk_m_sc *sc; + uint32_t val; + + sc = clknode_get_softc(clk); + + if ((sc->flags & AW_CLK_HAS_GATE) == 0) + return (0); + + DEVICE_LOCK(clk); + READ4(clk, sc->offset, &val); + if (enable) + val |= (1 << sc->gate_shift); + else + val &= ~(1 << sc->gate_shift); + WRITE4(clk, sc->offset, val); + DEVICE_UNLOCK(clk); + + return (0); +} + +static int +aw_clk_m_set_mux(struct clknode *clk, int index) +{ + struct aw_clk_m_sc *sc; + uint32_t val; + + sc = clknode_get_softc(clk); + + if ((sc->flags & AW_CLK_HAS_MUX) == 0) + return (0); + + DEVICE_LOCK(clk); + READ4(clk, sc->offset, &val); + val &= ~sc->mux_mask; + val |= index << sc->mux_shift; + WRITE4(clk, sc->offset, val); + DEVICE_UNLOCK(clk); + + return (0); +} + +static uint64_t +aw_clk_m_find_best(struct aw_clk_m_sc *sc, uint64_t fparent, uint64_t *fout, + uint32_t *factor_m) +{ + uint64_t cur, best; + uint32_t m, max_m, min_m; + + *factor_m = 0; + + max_m = aw_clk_factor_get_max(&sc->m); + min_m = aw_clk_factor_get_min(&sc->m); + + for (m = min_m; m <= max_m; ) { + cur = fparent / m; + if (abs(*fout - cur) < abs(*fout - best)) { + best = cur; + *factor_m = m; + } + if ((sc->m.flags & AW_CLK_FACTOR_POWER_OF_TWO) != 0) + m <<= 1; + else + m++; + } + + return (best); +} + +static int +aw_clk_m_set_freq(struct clknode *clk, uint64_t fparent, uint64_t *fout, + int flags, int *stop) +{ + struct aw_clk_m_sc *sc; + struct clknode *p_clk; + uint64_t cur, best; + uint32_t val, m, best_m; + + sc = clknode_get_softc(clk); + + best = cur = 0; + + if ((sc->flags & AW_CLK_SET_PARENT) != 0) { + p_clk = clknode_get_parent(clk); + if (p_clk == NULL) { + printf("%s: Cannot get parent for clock %s\n", + __func__, + clknode_get_name(clk)); + return (ENXIO); + } + clknode_set_freq(p_clk, *fout, CLK_SET_ROUND_MULTIPLE, 0); + clknode_get_freq(p_clk, &fparent); + best = aw_clk_m_find_best(sc, fparent, fout, + &best_m); + } else { + best = aw_clk_m_find_best(sc, fparent, fout, + &best_m); + } + + if ((flags & CLK_SET_DRYRUN) != 0) { + *fout = best; + *stop = 1; + return (0); + } + + if ((best < *fout) && + ((flags & CLK_SET_ROUND_DOWN) == 0)) { + *stop = 1; + return (ERANGE); + } + if ((best > *fout) && + ((flags & CLK_SET_ROUND_UP) == 0)) { + *stop = 1; + return (ERANGE); + } + + DEVICE_LOCK(clk); + READ4(clk, sc->offset, &val); + + m = aw_clk_factor_get_value(&sc->m, best_m); + val &= ~sc->m.mask; + val |= m << sc->m.shift; + + WRITE4(clk, sc->offset, val); + DEVICE_UNLOCK(clk); + + *fout = best; + *stop = 1; + + return (0); +} + +static int +aw_clk_m_recalc(struct clknode *clk, uint64_t *freq) +{ + struct aw_clk_m_sc *sc; + uint32_t val, m; + + sc = clknode_get_softc(clk); + + DEVICE_LOCK(clk); + READ4(clk, sc->offset, &val); + DEVICE_UNLOCK(clk); + + m = aw_clk_get_factor(val, &sc->m); + + *freq = *freq / m; + + return (0); +} + +static clknode_method_t aw_m_clknode_methods[] = { + /* Device interface */ + CLKNODEMETHOD(clknode_init, aw_clk_m_init), + CLKNODEMETHOD(clknode_set_gate, aw_clk_m_set_gate), + CLKNODEMETHOD(clknode_set_mux, aw_clk_m_set_mux), + CLKNODEMETHOD(clknode_recalc_freq, aw_clk_m_recalc), + CLKNODEMETHOD(clknode_set_freq, aw_clk_m_set_freq), + CLKNODEMETHOD_END +}; + +DEFINE_CLASS_1(aw_m_clknode, aw_m_clknode_class, aw_m_clknode_methods, + sizeof(struct aw_clk_m_sc), clknode_class); + +int +aw_clk_m_register(struct clkdom *clkdom, struct aw_clk_m_def *clkdef) +{ + struct clknode *clk; + struct aw_clk_m_sc *sc; + + clk = clknode_create(clkdom, &aw_m_clknode_class, &clkdef->clkdef); + if (clk == NULL) + return (1); + + sc = clknode_get_softc(clk); + + sc->offset = clkdef->offset; + + sc->m.shift = clkdef->m.shift; + sc->m.width = clkdef->m.width; + sc->m.mask = ((1 << sc->m.width) - 1) << sc->m.shift; + sc->m.value = clkdef->m.value; + sc->m.flags = clkdef->m.flags; + + sc->mux_shift = clkdef->mux_shift; + sc->mux_mask = ((1 << clkdef->mux_width) - 1) << sc->mux_shift; + + sc->gate_shift = clkdef->gate_shift; + + sc->flags = clkdef->flags; + + clknode_register(clkdom, clk); + + return (0); +} +/*- + * Copyright (c) 2019 Emmanuel Vadot + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include + +#include +#include + +#include "clkdev_if.h" + +/* + * clknode for clocks matching the formula : + * + * clk = clkin / m + * And that needs to potentially : + * 1) Set the parent freq + * 2) Support Setting the parent to a multiple + * + */ + +struct aw_clk_m_sc { + uint32_t offset; + + struct aw_clk_factor m; + + uint32_t mux_shift; + uint32_t mux_mask; + uint32_t gate_shift; + + uint32_t flags; +}; + +#define WRITE4(_clk, off, val) \ + CLKDEV_WRITE_4(clknode_get_device(_clk), off, val) +#define READ4(_clk, off, val) \ + CLKDEV_READ_4(clknode_get_device(_clk), off, val) +#define DEVICE_LOCK(_clk) \ + CLKDEV_DEVICE_LOCK(clknode_get_device(_clk)) +#define DEVICE_UNLOCK(_clk) \ + CLKDEV_DEVICE_UNLOCK(clknode_get_device(_clk)) + +static int +aw_clk_m_init(struct clknode *clk, device_t dev) +{ + struct aw_clk_m_sc *sc; + uint32_t val, idx; + + sc = clknode_get_softc(clk); + + idx = 0; + if ((sc->flags & AW_CLK_HAS_MUX) != 0) { + DEVICE_LOCK(clk); + READ4(clk, sc->offset, &val); + DEVICE_UNLOCK(clk); + + idx = (val & sc->mux_mask) >> sc->mux_shift; + } + + clknode_init_parent_idx(clk, idx); + return (0); +} + +static int +aw_clk_m_set_gate(struct clknode *clk, bool enable) +{ + struct aw_clk_m_sc *sc; + uint32_t val; + + sc = clknode_get_softc(clk); + + if ((sc->flags & AW_CLK_HAS_GATE) == 0) + return (0); + + DEVICE_LOCK(clk); + READ4(clk, sc->offset, &val); + if (enable) + val |= (1 << sc->gate_shift); + else + val &= ~(1 << sc->gate_shift); + WRITE4(clk, sc->offset, val); + DEVICE_UNLOCK(clk); + + return (0); +} + +static int +aw_clk_m_set_mux(struct clknode *clk, int index) +{ + struct aw_clk_m_sc *sc; + uint32_t val; + + sc = clknode_get_softc(clk); + + if ((sc->flags & AW_CLK_HAS_MUX) == 0) + return (0); + + DEVICE_LOCK(clk); + READ4(clk, sc->offset, &val); + val &= ~sc->mux_mask; + val |= index << sc->mux_shift; + WRITE4(clk, sc->offset, val); + DEVICE_UNLOCK(clk); + + return (0); +} + +static uint64_t +aw_clk_m_find_best(struct aw_clk_m_sc *sc, uint64_t fparent, uint64_t *fout, + uint32_t *factor_m) +{ + uint64_t cur, best; + uint32_t m, max_m, min_m; + + *factor_m = 0; + + max_m = aw_clk_factor_get_max(&sc->m); + min_m = aw_clk_factor_get_min(&sc->m); + + for (m = min_m; m <= max_m; ) { + cur = fparent / m; + if (abs(*fout - cur) < abs(*fout - best)) { + best = cur; + *factor_m = m; + } + if ((sc->m.flags & AW_CLK_FACTOR_POWER_OF_TWO) != 0) + m <<= 1; + else + m++; + } + + return (best); +} + +static int +aw_clk_m_set_freq(struct clknode *clk, uint64_t fparent, uint64_t *fout, + int flags, int *stop) +{ + struct aw_clk_m_sc *sc; + struct clknode *p_clk; + uint64_t cur, best; + uint32_t val, m, best_m; + + sc = clknode_get_softc(clk); + + best = cur = 0; + + if ((sc->flags & AW_CLK_SET_PARENT) != 0) { + p_clk = clknode_get_parent(clk); + if (p_clk == NULL) { + printf("%s: Cannot get parent for clock %s\n", + __func__, + clknode_get_name(clk)); + return (ENXIO); + } + clknode_set_freq(p_clk, *fout, CLK_SET_ROUND_MULTIPLE, 0); + clknode_get_freq(p_clk, &fparent); + best = aw_clk_m_find_best(sc, fparent, fout, + &best_m); + } else { + best = aw_clk_m_find_best(sc, fparent, fout, + &best_m); + } + + if ((flags & CLK_SET_DRYRUN) != 0) { + *fout = best; + *stop = 1; + return (0); + } + + if ((best < *fout) && + ((flags & CLK_SET_ROUND_DOWN) == 0)) { + *stop = 1; + return (ERANGE); + } + if ((best > *fout) && + ((flags & CLK_SET_ROUND_UP) == 0)) { + *stop = 1; + return (ERANGE); + } + + DEVICE_LOCK(clk); + READ4(clk, sc->offset, &val); + + m = aw_clk_factor_get_value(&sc->m, best_m); + val &= ~sc->m.mask; + val |= m << sc->m.shift; + + WRITE4(clk, sc->offset, val); + DEVICE_UNLOCK(clk); + + *fout = best; + *stop = 1; + + return (0); +} + +static int +aw_clk_m_recalc(struct clknode *clk, uint64_t *freq) +{ + struct aw_clk_m_sc *sc; + uint32_t val, m; + + sc = clknode_get_softc(clk); + + DEVICE_LOCK(clk); + READ4(clk, sc->offset, &val); + DEVICE_UNLOCK(clk); + + m = aw_clk_get_factor(val, &sc->m); + + *freq = *freq / m; + + return (0); +} + +static clknode_method_t aw_m_clknode_methods[] = { + /* Device interface */ + CLKNODEMETHOD(clknode_init, aw_clk_m_init), + CLKNODEMETHOD(clknode_set_gate, aw_clk_m_set_gate), + CLKNODEMETHOD(clknode_set_mux, aw_clk_m_set_mux), + CLKNODEMETHOD(clknode_recalc_freq, aw_clk_m_recalc), + CLKNODEMETHOD(clknode_set_freq, aw_clk_m_set_freq), + CLKNODEMETHOD_END +}; + +DEFINE_CLASS_1(aw_m_clknode, aw_m_clknode_class, aw_m_clknode_methods, + sizeof(struct aw_clk_m_sc), clknode_class); + +int +aw_clk_m_register(struct clkdom *clkdom, struct aw_clk_m_def *clkdef) +{ + struct clknode *clk; + struct aw_clk_m_sc *sc; + + clk = clknode_create(clkdom, &aw_m_clknode_class, &clkdef->clkdef); + if (clk == NULL) + return (1); + + sc = clknode_get_softc(clk); + + sc->offset = clkdef->offset; + + sc->m.shift = clkdef->m.shift; + sc->m.width = clkdef->m.width; + sc->m.mask = ((1 << sc->m.width) - 1) << sc->m.shift; + sc->m.value = clkdef->m.value; + sc->m.flags = clkdef->m.flags; + + sc->mux_shift = clkdef->mux_shift; + sc->mux_mask = ((1 << clkdef->mux_width) - 1) << sc->mux_shift; + + sc->gate_shift = clkdef->gate_shift; + + sc->flags = clkdef->flags; + + clknode_register(clkdom, clk); + + return (0); +} Added: head/sys/arm/allwinner/clkng/aw_clk_m.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/clkng/aw_clk_m.h Sat Aug 10 18:50:37 2019 (r350844) @@ -0,0 +1,96 @@ +/*- + * Copyright (c) 2019 Emmanuel Vadot + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __AW_CLK_M_H__ +#define __AW_CLK_M_H__ + +#include + +struct aw_clk_m_def { + struct clknode_init_def clkdef; + uint32_t offset; + + struct aw_clk_factor m; + + uint32_t mux_shift; + uint32_t mux_width; + uint32_t gate_shift; + + uint32_t flags; +}; + +int aw_clk_m_register(struct clkdom *clkdom, struct aw_clk_m_def *clkdef); + +#endif /* __AW_CLK_M_H__ */ +/*- + * Copyright (c) 2019 Emmanuel Vadot + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __AW_CLK_M_H__ +#define __AW_CLK_M_H__ + +#include + +struct aw_clk_m_def { + struct clknode_init_def clkdef; + uint32_t offset; + + struct aw_clk_factor m; + + uint32_t mux_shift; + uint32_t mux_width; + uint32_t gate_shift; + + uint32_t flags; +}; + +int aw_clk_m_register(struct clkdom *clkdom, struct aw_clk_m_def *clkdef); + +#endif /* __AW_CLK_M_H__ */ Modified: head/sys/arm/allwinner/clkng/ccu_a64.c ============================================================================== --- head/sys/arm/allwinner/clkng/ccu_a64.c Sat Aug 10 18:22:22 2019 (r350843) +++ head/sys/arm/allwinner/clkng/ccu_a64.c Sat Aug 10 18:50:37 2019 (r350844) @@ -607,10 +607,9 @@ MUX_CLK(i2s2mux_clk, 0xb8, 16, 2); /* offset, mux shift, mux width */ static const char *spdif_parents[] = {"pll_audio"}; -NM_CLK(spdif_clk, +M_CLK(spdif_clk, CLK_SPDIF, "spdif", spdif_parents, /* id, name, parents */ 0xC0, /* offset */ - 0, 0, 1, AW_CLK_FACTOR_FIXED, /* n factor (fake); */ 0, 4, 0, 0, /* m factor */ 0, 0, /* mux */ 31, /* gate */ @@ -620,20 +619,18 @@ NM_CLK(spdif_clk, /* DRAM needs update bit */ static const char *dram_parents[] = {"pll_ddr0", "pll_ddr1"}; -NM_CLK(dram_clk, +M_CLK(dram_clk, CLK_DRAM, "dram", dram_parents, /* id, name, parents */ 0xF4, /* offset */ - 0, 0, 1, AW_CLK_FACTOR_FIXED, /* n factor (fake) */ 0, 2, 0, 0, /* m factor */ 20, 2, /* mux */ 0, /* gate */ AW_CLK_HAS_MUX); /* flags */ static const char *de_parents[] = {"pll_periph0_2x", "pll_de"}; -NM_CLK(de_clk, +M_CLK(de_clk, CLK_DE, "de", de_parents, /* id, name, parents */ 0x104, /* offset */ - 0, 0, 1, AW_CLK_FACTOR_FIXED, /* n factor (fake) */ 0, 4, 0, 0, /* m factor */ 24, 2, /* mux */ 31, /* gate */ @@ -641,81 +638,74 @@ NM_CLK(de_clk, /* TCON0/1 Needs mux table */ static const char *tcon1_parents[] = {"pll_video0", "pll_video0", "pll_video1"}; -NM_CLK(tcon1_clk, - CLK_TCON1, "tcon1", tcon1_parents, - 0x11C, - 0, 0, 1, AW_CLK_FACTOR_FIXED, - 0, 4, 0, 0, - 24, 2, - 31, - AW_CLK_HAS_MUX | AW_CLK_HAS_GATE); +M_CLK(tcon1_clk, + CLK_TCON1, "tcon1", tcon1_parents, /* id, name, parents */ + 0x11C, /* offset */ + 0, 5, 0, 0, /* m factor */ + 24, 2, /* mux */ + 31, /* gate */ + AW_CLK_HAS_MUX | AW_CLK_HAS_GATE | + AW_CLK_SET_PARENT); /* flags */ static const char *deinterlace_parents[] = {"pll_periph0", "pll_periph1"}; -NM_CLK(deinterlace_clk, +M_CLK(deinterlace_clk, CLK_DEINTERLACE, "deinterlace", deinterlace_parents, /* id, name, parents */ 0x124, /* offset */ - 0, 0, 1, AW_CLK_FACTOR_FIXED, /* n factor (fake) */ 0, 4, 0, 0, /* m factor */ 24, 2, /* mux */ 31, /* gate */ AW_CLK_HAS_MUX | AW_CLK_HAS_GATE); /* flags */ static const char *csi_sclk_parents[] = {"pll_periph0", "pll_periph1"}; -NM_CLK(csi_sclk_clk, +M_CLK(csi_sclk_clk, CLK_CSI_SCLK, "csi-sclk", csi_sclk_parents, /* id, name, parents */ 0x134, /* offset */ - 0, 0, 1, AW_CLK_FACTOR_FIXED, /* n factor (fake) */ 16, 4, 0, 0, /* m factor */ 24, 2, /* mux */ 31, /* gate */ AW_CLK_HAS_MUX | AW_CLK_HAS_GATE); /* flags */ static const char *csi_mclk_parents[] = {"osc24M", "pll_video0", "pll_periph1"}; -NM_CLK(csi_mclk_clk, +M_CLK(csi_mclk_clk, CLK_CSI_MCLK, "csi-mclk", csi_mclk_parents, /* id, name, parents */ 0x134, /* offset */ - 0, 0, 1, AW_CLK_FACTOR_FIXED, /* n factor (fake) */ 0, 4, 0, 0, /* m factor */ 8, 2, /* mux */ 15, /* gate */ AW_CLK_HAS_MUX | AW_CLK_HAS_GATE); /* flags */ static const char *ve_parents[] = {"pll_ve"}; -NM_CLK(ve_clk, +M_CLK(ve_clk, CLK_VE, "ve", ve_parents, /* id, name, parents */ 0x13C, /* offset */ - 16, 3, 0, 0, /* n factor */ - 0, 0, 1, AW_CLK_FACTOR_FIXED, /* m factor (fake) */ + 16, 3, 0, 0, /* m factor */ 0, 0, /* mux */ 31, /* gate */ AW_CLK_HAS_GATE); /* flags */ static const char *hdmi_parents[] = {"pll_video0"}; -NM_CLK(hdmi_clk, +M_CLK(hdmi_clk, CLK_HDMI, "hdmi", hdmi_parents, /* id, name, parents */ 0x150, /* offset */ - 0, 0, 1, AW_CLK_FACTOR_FIXED, /* n factor (fake) */ 0, 4, 0, 0, /* m factor */ 24, 2, /* mux */ 31, /* gate */ - AW_CLK_HAS_MUX | AW_CLK_HAS_GATE); /* flags */ + AW_CLK_HAS_MUX | AW_CLK_HAS_GATE | AW_CLK_SET_PARENT); /* flags */ static const char *mbus_parents[] = {"osc24M", "pll_periph0_2x", "pll_ddr0"}; -NM_CLK(mbus_clk, +M_CLK(mbus_clk, CLK_MBUS, "mbus", mbus_parents, /* id, name, parents */ 0x15C, /* offset */ - 0, 0, 1, AW_CLK_FACTOR_FIXED, /* n factor (fake) */ 0, 3, 0, 0, /* m factor */ 24, 2, /* mux */ 31, /* gate */ AW_CLK_HAS_MUX | AW_CLK_HAS_GATE); /* flags */ static const char *gpu_parents[] = {"pll_gpu"}; -NM_CLK(gpu_clk, +M_CLK(gpu_clk, CLK_GPU, "gpu", gpu_parents, /* id, name, parents */ 0x1A0, /* offset */ - 0, 2, 0, 0, /* n factor */ - 0, 0, 1, AW_CLK_FACTOR_FIXED, /* m factor (fake) */ + 0, 2, 0, 0, /* m factor */ 0, 0, /* mux */ 31, /* gate */ AW_CLK_HAS_GATE); /* flags */ @@ -744,17 +734,17 @@ static struct aw_ccung_clk a64_ccu_clks[] = { { .type = AW_CLK_NM, .clk.nm = &ce_clk}, { .type = AW_CLK_NM, .clk.nm = &spi0_clk}, { .type = AW_CLK_NM, .clk.nm = &spi1_clk}, - { .type = AW_CLK_NM, .clk.nm = &spdif_clk}, - { .type = AW_CLK_NM, .clk.nm = &dram_clk}, - { .type = AW_CLK_NM, .clk.nm = &de_clk}, - { .type = AW_CLK_NM, .clk.nm = &tcon1_clk}, - { .type = AW_CLK_NM, .clk.nm = &deinterlace_clk}, - { .type = AW_CLK_NM, .clk.nm = &csi_sclk_clk}, - { .type = AW_CLK_NM, .clk.nm = &csi_mclk_clk}, - { .type = AW_CLK_NM, .clk.nm = &ve_clk}, - { .type = AW_CLK_NM, .clk.nm = &hdmi_clk}, - { .type = AW_CLK_NM, .clk.nm = &mbus_clk}, - { .type = AW_CLK_NM, .clk.nm = &gpu_clk}, + { .type = AW_CLK_M, .clk.m = &spdif_clk}, + { .type = AW_CLK_M, .clk.m = &dram_clk}, + { .type = AW_CLK_M, .clk.m = &de_clk}, + { .type = AW_CLK_M, .clk.m = &tcon1_clk}, + { .type = AW_CLK_M, .clk.m = &deinterlace_clk}, + { .type = AW_CLK_M, .clk.m = &csi_sclk_clk}, + { .type = AW_CLK_M, .clk.m = &csi_mclk_clk}, + { .type = AW_CLK_M, .clk.m = &ve_clk}, + { .type = AW_CLK_M, .clk.m = &hdmi_clk}, + { .type = AW_CLK_M, .clk.m = &mbus_clk}, + { .type = AW_CLK_M, .clk.m = &gpu_clk}, { .type = AW_CLK_PREDIV_MUX, .clk.prediv_mux = &ahb1_clk}, { .type = AW_CLK_PREDIV_MUX, .clk.prediv_mux = &ahb2_clk}, { .type = AW_CLK_MUX, .clk.mux = &cpux_clk}, Modified: head/sys/arm/allwinner/files.allwinner ============================================================================== --- head/sys/arm/allwinner/files.allwinner Sat Aug 10 18:22:22 2019 (r350843) +++ head/sys/arm/allwinner/files.allwinner Sat Aug 10 18:50:37 2019 (r350844) @@ -36,6 +36,7 @@ arm/allwinner/aw_gmacclk.c standard arm/allwinner/clkng/aw_ccung.c standard arm/allwinner/clkng/aw_clk_frac.c standard +arm/allwinner/clkng/aw_clk_m.c standard arm/allwinner/clkng/aw_clk_nkmp.c standard arm/allwinner/clkng/aw_clk_nm.c standard arm/allwinner/clkng/aw_clk_prediv_mux.c standard Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Sat Aug 10 18:22:22 2019 (r350843) +++ head/sys/conf/files.arm64 Sat Aug 10 18:50:37 2019 (r350844) @@ -50,6 +50,7 @@ arm/allwinner/if_awg.c optional awg ext_resources sys # Allwinner clock driver arm/allwinner/clkng/aw_ccung.c optional aw_ccu fdt arm/allwinner/clkng/aw_clk_frac.c optional aw_ccu fdt +arm/allwinner/clkng/aw_clk_m.c optional aw_ccu fdt arm/allwinner/clkng/aw_clk_nkmp.c optional aw_ccu fdt arm/allwinner/clkng/aw_clk_nm.c optional aw_ccu fdt arm/allwinner/clkng/aw_clk_prediv_mux.c optional aw_ccu fdt Modified: head/sys/dev/extres/clk/clk.h ============================================================================== --- head/sys/dev/extres/clk/clk.h Sat Aug 10 18:22:22 2019 (r350843) +++ head/sys/dev/extres/clk/clk.h Sat Aug 10 18:50:37 2019 (r350844) @@ -48,6 +48,7 @@ #define CLK_SET_ROUND_EXACT 0 #define CLK_SET_ROUND_UP 0x00000001 #define CLK_SET_ROUND_DOWN 0x00000002 +#define CLK_SET_ROUND_MULTIPLE 0x00000004 #define CLK_SET_ROUND_ANY (CLK_SET_ROUND_UP | CLK_SET_ROUND_DOWN) #define CLK_SET_USER_MASK 0x0000FFFF From owner-svn-src-head@freebsd.org Sat Aug 10 18:58:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C9326C303B; Sat, 10 Aug 2019 18:58:26 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 465WbQ50dhz42X8; Sat, 10 Aug 2019 18:58:26 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D55F2312; Sat, 10 Aug 2019 18:58:26 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7AIwQih036172; Sat, 10 Aug 2019 18:58:26 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7AIwQs9036171; Sat, 10 Aug 2019 18:58:26 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201908101858.x7AIwQs9036171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 10 Aug 2019 18:58:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350845 - head/sys/arm/allwinner/clkng X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner/clkng X-SVN-Commit-Revision: 350845 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Aug 2019 18:58:26 -0000 Author: manu Date: Sat Aug 10 18:58:25 2019 New Revision: 350845 URL: https://svnweb.freebsd.org/changeset/base/350845 Log: Remove some duplicate code that end up in r350844 Modified: head/sys/arm/allwinner/clkng/aw_clk_m.c head/sys/arm/allwinner/clkng/aw_clk_m.h Modified: head/sys/arm/allwinner/clkng/aw_clk_m.c ============================================================================== --- head/sys/arm/allwinner/clkng/aw_clk_m.c Sat Aug 10 18:50:37 2019 (r350844) +++ head/sys/arm/allwinner/clkng/aw_clk_m.c Sat Aug 10 18:58:25 2019 (r350845) @@ -288,293 +288,3 @@ aw_clk_m_register(struct clkdom *clkdom, struct aw_clk return (0); } -/*- - * Copyright (c) 2019 Emmanuel Vadot - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -#include - -#include -#include - -#include "clkdev_if.h" - -/* - * clknode for clocks matching the formula : - * - * clk = clkin / m - * And that needs to potentially : - * 1) Set the parent freq - * 2) Support Setting the parent to a multiple - * - */ - -struct aw_clk_m_sc { - uint32_t offset; - - struct aw_clk_factor m; - - uint32_t mux_shift; - uint32_t mux_mask; - uint32_t gate_shift; - - uint32_t flags; -}; - -#define WRITE4(_clk, off, val) \ - CLKDEV_WRITE_4(clknode_get_device(_clk), off, val) -#define READ4(_clk, off, val) \ - CLKDEV_READ_4(clknode_get_device(_clk), off, val) -#define DEVICE_LOCK(_clk) \ - CLKDEV_DEVICE_LOCK(clknode_get_device(_clk)) -#define DEVICE_UNLOCK(_clk) \ - CLKDEV_DEVICE_UNLOCK(clknode_get_device(_clk)) - -static int -aw_clk_m_init(struct clknode *clk, device_t dev) -{ - struct aw_clk_m_sc *sc; - uint32_t val, idx; - - sc = clknode_get_softc(clk); - - idx = 0; - if ((sc->flags & AW_CLK_HAS_MUX) != 0) { - DEVICE_LOCK(clk); - READ4(clk, sc->offset, &val); - DEVICE_UNLOCK(clk); - - idx = (val & sc->mux_mask) >> sc->mux_shift; - } - - clknode_init_parent_idx(clk, idx); - return (0); -} - -static int -aw_clk_m_set_gate(struct clknode *clk, bool enable) -{ - struct aw_clk_m_sc *sc; - uint32_t val; - - sc = clknode_get_softc(clk); - - if ((sc->flags & AW_CLK_HAS_GATE) == 0) - return (0); - - DEVICE_LOCK(clk); - READ4(clk, sc->offset, &val); - if (enable) - val |= (1 << sc->gate_shift); - else - val &= ~(1 << sc->gate_shift); - WRITE4(clk, sc->offset, val); - DEVICE_UNLOCK(clk); - - return (0); -} - -static int -aw_clk_m_set_mux(struct clknode *clk, int index) -{ - struct aw_clk_m_sc *sc; - uint32_t val; - - sc = clknode_get_softc(clk); - - if ((sc->flags & AW_CLK_HAS_MUX) == 0) - return (0); - - DEVICE_LOCK(clk); - READ4(clk, sc->offset, &val); - val &= ~sc->mux_mask; - val |= index << sc->mux_shift; - WRITE4(clk, sc->offset, val); - DEVICE_UNLOCK(clk); - - return (0); -} - -static uint64_t -aw_clk_m_find_best(struct aw_clk_m_sc *sc, uint64_t fparent, uint64_t *fout, - uint32_t *factor_m) -{ - uint64_t cur, best; - uint32_t m, max_m, min_m; - - *factor_m = 0; - - max_m = aw_clk_factor_get_max(&sc->m); - min_m = aw_clk_factor_get_min(&sc->m); - - for (m = min_m; m <= max_m; ) { - cur = fparent / m; - if (abs(*fout - cur) < abs(*fout - best)) { - best = cur; - *factor_m = m; - } - if ((sc->m.flags & AW_CLK_FACTOR_POWER_OF_TWO) != 0) - m <<= 1; - else - m++; - } - - return (best); -} - -static int -aw_clk_m_set_freq(struct clknode *clk, uint64_t fparent, uint64_t *fout, - int flags, int *stop) -{ - struct aw_clk_m_sc *sc; - struct clknode *p_clk; - uint64_t cur, best; - uint32_t val, m, best_m; - - sc = clknode_get_softc(clk); - - best = cur = 0; - - if ((sc->flags & AW_CLK_SET_PARENT) != 0) { - p_clk = clknode_get_parent(clk); - if (p_clk == NULL) { - printf("%s: Cannot get parent for clock %s\n", - __func__, - clknode_get_name(clk)); - return (ENXIO); - } - clknode_set_freq(p_clk, *fout, CLK_SET_ROUND_MULTIPLE, 0); - clknode_get_freq(p_clk, &fparent); - best = aw_clk_m_find_best(sc, fparent, fout, - &best_m); - } else { - best = aw_clk_m_find_best(sc, fparent, fout, - &best_m); - } - - if ((flags & CLK_SET_DRYRUN) != 0) { - *fout = best; - *stop = 1; - return (0); - } - - if ((best < *fout) && - ((flags & CLK_SET_ROUND_DOWN) == 0)) { - *stop = 1; - return (ERANGE); - } - if ((best > *fout) && - ((flags & CLK_SET_ROUND_UP) == 0)) { - *stop = 1; - return (ERANGE); - } - - DEVICE_LOCK(clk); - READ4(clk, sc->offset, &val); - - m = aw_clk_factor_get_value(&sc->m, best_m); - val &= ~sc->m.mask; - val |= m << sc->m.shift; - - WRITE4(clk, sc->offset, val); - DEVICE_UNLOCK(clk); - - *fout = best; - *stop = 1; - - return (0); -} - -static int -aw_clk_m_recalc(struct clknode *clk, uint64_t *freq) -{ - struct aw_clk_m_sc *sc; - uint32_t val, m; - - sc = clknode_get_softc(clk); - - DEVICE_LOCK(clk); - READ4(clk, sc->offset, &val); - DEVICE_UNLOCK(clk); - - m = aw_clk_get_factor(val, &sc->m); - - *freq = *freq / m; - - return (0); -} - -static clknode_method_t aw_m_clknode_methods[] = { - /* Device interface */ - CLKNODEMETHOD(clknode_init, aw_clk_m_init), - CLKNODEMETHOD(clknode_set_gate, aw_clk_m_set_gate), - CLKNODEMETHOD(clknode_set_mux, aw_clk_m_set_mux), - CLKNODEMETHOD(clknode_recalc_freq, aw_clk_m_recalc), - CLKNODEMETHOD(clknode_set_freq, aw_clk_m_set_freq), - CLKNODEMETHOD_END -}; - -DEFINE_CLASS_1(aw_m_clknode, aw_m_clknode_class, aw_m_clknode_methods, - sizeof(struct aw_clk_m_sc), clknode_class); - -int -aw_clk_m_register(struct clkdom *clkdom, struct aw_clk_m_def *clkdef) -{ - struct clknode *clk; - struct aw_clk_m_sc *sc; - - clk = clknode_create(clkdom, &aw_m_clknode_class, &clkdef->clkdef); - if (clk == NULL) - return (1); - - sc = clknode_get_softc(clk); - - sc->offset = clkdef->offset; - - sc->m.shift = clkdef->m.shift; - sc->m.width = clkdef->m.width; - sc->m.mask = ((1 << sc->m.width) - 1) << sc->m.shift; - sc->m.value = clkdef->m.value; - sc->m.flags = clkdef->m.flags; - - sc->mux_shift = clkdef->mux_shift; - sc->mux_mask = ((1 << clkdef->mux_width) - 1) << sc->mux_shift; - - sc->gate_shift = clkdef->gate_shift; - - sc->flags = clkdef->flags; - - clknode_register(clkdom, clk); - - return (0); -} Modified: head/sys/arm/allwinner/clkng/aw_clk_m.h ============================================================================== --- head/sys/arm/allwinner/clkng/aw_clk_m.h Sat Aug 10 18:50:37 2019 (r350844) +++ head/sys/arm/allwinner/clkng/aw_clk_m.h Sat Aug 10 18:58:25 2019 (r350845) @@ -46,51 +46,3 @@ struct aw_clk_m_def { int aw_clk_m_register(struct clkdom *clkdom, struct aw_clk_m_def *clkdef); #endif /* __AW_CLK_M_H__ */ -/*- - * Copyright (c) 2019 Emmanuel Vadot - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef __AW_CLK_M_H__ -#define __AW_CLK_M_H__ - -#include - -struct aw_clk_m_def { - struct clknode_init_def clkdef; - uint32_t offset; - - struct aw_clk_factor m; - - uint32_t mux_shift; - uint32_t mux_width; - uint32_t gate_shift; - - uint32_t flags; -}; - -int aw_clk_m_register(struct clkdom *clkdom, struct aw_clk_m_def *clkdef); - -#endif /* __AW_CLK_M_H__ */ From owner-svn-src-head@freebsd.org Sat Aug 10 19:02:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E004CC32BE; Sat, 10 Aug 2019 19:02:51 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 465WhW6MBzz42vJ; Sat, 10 Aug 2019 19:02:51 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB6BD24D8; Sat, 10 Aug 2019 19:02:51 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7AJ2phm041888; Sat, 10 Aug 2019 19:02:51 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7AJ2ojd041881; Sat, 10 Aug 2019 19:02:50 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201908101902.x7AJ2ojd041881@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 10 Aug 2019 19:02:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350846 - head/sys/arm/allwinner/clkng X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner/clkng X-SVN-Commit-Revision: 350846 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Aug 2019 19:02:51 -0000 Author: manu Date: Sat Aug 10 19:02:50 2019 New Revision: 350846 URL: https://svnweb.freebsd.org/changeset/base/350846 Log: allwinner: Add support to min/max in aw_clk_frac The Fractionals clock in Allwinner device have some min/max frequencies that they can do. Add support for it. Modified: head/sys/arm/allwinner/clkng/aw_clk.h head/sys/arm/allwinner/clkng/aw_clk_frac.c head/sys/arm/allwinner/clkng/aw_clk_frac.h head/sys/arm/allwinner/clkng/ccu_a10.c head/sys/arm/allwinner/clkng/ccu_a31.c head/sys/arm/allwinner/clkng/ccu_a64.c head/sys/arm/allwinner/clkng/ccu_h3.c Modified: head/sys/arm/allwinner/clkng/aw_clk.h ============================================================================== --- head/sys/arm/allwinner/clkng/aw_clk.h Sat Aug 10 18:58:25 2019 (r350845) +++ head/sys/arm/allwinner/clkng/aw_clk.h Sat Aug 10 19:02:50 2019 (r350846) @@ -314,13 +314,15 @@ aw_clk_factor_get_value(struct aw_clk_factor *factor, _nshift, _nwidth, _nvalue, _nflags, \ _mshift, _mwidth, _mvalue, _mflags, \ _gate_shift, _lock_shift,_lock_retries, \ - _flags, _freq0, _freq1, _mode_sel, _freq_sel) \ + _flags, _freq0, _freq1, _mode_sel, _freq_sel, \ + _min_freq, _max_freq) \ static struct aw_clk_frac_def _clkname = { \ .clkdef = { \ .id = _id, \ .name = _name, \ .parent_names = _pnames, \ .parent_cnt = nitems(_pnames), \ + .flags = CLK_NODE_GLITCH_FREE, \ }, \ .offset = _offset, \ .n.shift = _nshift, \ @@ -339,6 +341,8 @@ aw_clk_factor_get_value(struct aw_clk_factor *factor, .frac.freq1 = _freq1, \ .frac.mode_sel = _mode_sel, \ .frac.freq_sel = _freq_sel, \ + .min_freq = _min_freq, \ + .max_freq = _max_freq, \ } #define M_CLK(_clkname, _id, _name, _pnames, \ Modified: head/sys/arm/allwinner/clkng/aw_clk_frac.c ============================================================================== --- head/sys/arm/allwinner/clkng/aw_clk_frac.c Sat Aug 10 18:58:25 2019 (r350845) +++ head/sys/arm/allwinner/clkng/aw_clk_frac.c Sat Aug 10 19:02:50 2019 (r350846) @@ -39,6 +39,9 @@ __FBSDID("$FreeBSD$"); #include "clkdev_if.h" +/* #define dprintf(format, arg...) printf("%s:(%s)" format, __func__, clknode_get_name(clk), arg) */ +#define dprintf(format, arg...) + /* * clknode for clocks matching the formula : * @@ -54,6 +57,9 @@ struct aw_clk_frac_sc { struct aw_clk_factor n; struct aw_clk_frac frac; + uint64_t min_freq; + uint64_t max_freq; + uint32_t mux_shift; uint32_t mux_mask; uint32_t gate_shift; @@ -89,6 +95,7 @@ aw_clk_frac_init(struct clknode *clk, device_t dev) idx = (val & sc->mux_mask) >> sc->mux_shift; } + dprintf("init parent idx %d\n", idx); clknode_init_parent_idx(clk, idx); return (0); } @@ -104,6 +111,7 @@ aw_clk_frac_set_gate(struct clknode *clk, bool enable) if ((sc->flags & AW_CLK_HAS_GATE) == 0) return (0); + dprintf("%sabling gate\n", enable ? "En" : "Dis"); DEVICE_LOCK(clk); READ4(clk, sc->offset, &val); if (enable) @@ -127,6 +135,7 @@ aw_clk_frac_set_mux(struct clknode *clk, int index) if ((sc->flags & AW_CLK_HAS_MUX) == 0) return (0); + dprintf("Set mux to %d\n", index); DEVICE_LOCK(clk); READ4(clk, sc->offset, &val); val &= ~sc->mux_mask; @@ -138,7 +147,7 @@ aw_clk_frac_set_mux(struct clknode *clk, int index) } static uint64_t -aw_clk_frac_find_best(struct aw_clk_frac_sc *sc, uint64_t fparent, uint64_t *fout, +aw_clk_frac_find_best(struct aw_clk_frac_sc *sc, uint64_t fparent, uint64_t fout, uint32_t *factor_n, uint32_t *factor_m) { uint64_t cur, best; @@ -150,18 +159,27 @@ aw_clk_frac_find_best(struct aw_clk_frac_sc *sc, uint6 max_m = aw_clk_factor_get_max(&sc->m); max_n = aw_clk_factor_get_max(&sc->n); min_m = aw_clk_factor_get_min(&sc->m); - min_n = aw_clk_factor_get_min(&sc->n); + min_n = sc->min_freq / fparent; for (n = min_n; n <= max_n; n++) { for (m = min_m; m <= max_m; m++) { cur = fparent * n / m; - if ((*fout - cur) < (*fout - best)) { + if (cur < sc->min_freq) { + continue; + } + if (cur > sc->max_freq) { + continue; + } + if (cur == fout) { + *factor_n = n; + *factor_m = m; + return (cur); + } + if (abs((fout - cur)) < abs((fout - best))) { best = cur; *factor_n = n; *factor_m = m; } - if (best == *fout) - return (best); } } @@ -175,32 +193,73 @@ aw_clk_frac_set_freq(struct clknode *clk, uint64_t fpa struct aw_clk_frac_sc *sc; uint64_t cur, best, best_frac; uint32_t val, m, n, best_m, best_n; - int retry; + int retry, multiple, max_mult, best_mult; sc = clknode_get_softc(clk); best = best_frac = cur = 0; + best_mult = 0; + max_mult = 1; - if (*fout == sc->frac.freq0) - best = best_frac = sc->frac.freq0; - else if (*fout == sc->frac.freq1) - best = best_frac = sc->frac.freq1; - else - best = aw_clk_frac_find_best(sc, fparent, fout, - &best_n, &best_m); + dprintf("Trying to find freq %ju with parent %ju\n", *fout, fparent); + if ((flags & CLK_SET_ROUND_MULTIPLE) != 0) + max_mult = 10; + for (multiple = 1; multiple <= max_mult; multiple++) { + /* First test the fractional frequencies */ + dprintf("Testing with multiple %d\n", multiple); + if (*fout * multiple == sc->frac.freq0) { + best = best_frac = sc->frac.freq0; + best_mult = multiple; + dprintf("Found with using frac.freq0 and multiple %d\n", multiple); + break; + } + else if (*fout * multiple == sc->frac.freq1) { + best = best_frac = sc->frac.freq1; + best_mult = multiple; + dprintf("Found with using frac.freq1 and multiple %d\n", multiple); + break; + } + else { + cur = aw_clk_frac_find_best(sc, fparent, *fout * multiple, + &n, &m); + dprintf("Got %ju with n=%d, m=%d\n", cur, n, m); + if (cur == (*fout * multiple)) { + best = cur; + best_mult = multiple; + best_n = n; + best_m = m; + dprintf("This is the one: n=%d m=%d mult=%d\n", best_n, best_m, best_mult); + break; + } + if (abs(((*fout * multiple) - cur)) < abs(((*fout * multiple) - best))) { + best = cur; + best_mult = multiple; + best_n = n; + best_m = m; + dprintf("This is the best for now: n=%d m=%d mult=%d\n", best_n, best_m, best_mult); + } + } + } + if (best < sc->min_freq || + best > sc->max_freq) { + printf("%s: Cannot set %ju for %s (min=%ju max=%ju)\n", + __func__, best, clknode_get_name(clk), + sc->min_freq, sc->max_freq); + return (ERANGE); + } if ((flags & CLK_SET_DRYRUN) != 0) { *fout = best; *stop = 1; return (0); } - if ((best < *fout) && + if ((best < (*fout * best_mult)) && ((flags & CLK_SET_ROUND_DOWN) == 0)) { *stop = 1; return (ERANGE); } - if ((best > *fout) && + if ((best > *fout * best_mult) && ((flags & CLK_SET_ROUND_UP) == 0)) { *stop = 1; return (ERANGE); @@ -271,7 +330,6 @@ aw_clk_frac_recalc(struct clknode *clk, uint64_t *freq } else { m = aw_clk_get_factor(val, &sc->m); n = aw_clk_get_factor(val, &sc->n); - *freq = *freq * n / m; } @@ -321,6 +379,9 @@ aw_clk_frac_register(struct clkdom *clkdom, struct aw_ sc->frac.freq1 = clkdef->frac.freq1; sc->frac.mode_sel = 1 << clkdef->frac.mode_sel; sc->frac.freq_sel = 1 << clkdef->frac.freq_sel; + + sc->min_freq = clkdef->min_freq; + sc->max_freq = clkdef->max_freq; sc->mux_shift = clkdef->mux_shift; sc->mux_mask = ((1 << clkdef->mux_width) - 1) << sc->mux_shift; Modified: head/sys/arm/allwinner/clkng/aw_clk_frac.h ============================================================================== --- head/sys/arm/allwinner/clkng/aw_clk_frac.h Sat Aug 10 18:58:25 2019 (r350845) +++ head/sys/arm/allwinner/clkng/aw_clk_frac.h Sat Aug 10 19:02:50 2019 (r350846) @@ -38,6 +38,9 @@ struct aw_clk_frac_def { struct aw_clk_factor n; struct aw_clk_frac frac; + uint64_t min_freq; + uint64_t max_freq; + uint32_t mux_shift; uint32_t mux_width; uint32_t gate_shift; Modified: head/sys/arm/allwinner/clkng/ccu_a10.c ============================================================================== --- head/sys/arm/allwinner/clkng/ccu_a10.c Sat Aug 10 18:58:25 2019 (r350845) +++ head/sys/arm/allwinner/clkng/ccu_a10.c Sat Aug 10 19:02:50 2019 (r350846) @@ -221,7 +221,8 @@ FRAC_CLK(pll_video0_clk, 31, 0, 0, /* gate, lock, lock retries */ AW_CLK_HAS_GATE, /* flags */ 270000000, 297000000, /* freq0, freq1 */ - 15, 14); /* mode sel, freq sel */ + 15, 14, /* mode sel, freq sel */ + 27000000, 381000000); /* min freq, max freq */ static const char *pll_video0_2x_parents[] = {"pll_video0"}; FIXED_CLK(pll_video0_2x_clk, CLK_PLL_VIDEO0_2X, /* id */ @@ -240,7 +241,8 @@ FRAC_CLK(pll_video1_clk, 31, 0, 0, /* gate, lock, lock retries */ AW_CLK_HAS_GATE, /* flags */ 270000000, 297000000, /* freq0, freq1 */ - 15, 14); /* mode sel, freq sel */ + 15, 14, /* mode sel, freq sel */ + 27000000, 381000000); /* min freq, max freq */ static const char *pll_video1_2x_parents[] = {"pll_video1"}; FIXED_CLK(pll_video1_2x_clk, CLK_PLL_VIDEO1_2X, /* id */ Modified: head/sys/arm/allwinner/clkng/ccu_a31.c ============================================================================== --- head/sys/arm/allwinner/clkng/ccu_a31.c Sat Aug 10 18:58:25 2019 (r350845) +++ head/sys/arm/allwinner/clkng/ccu_a31.c Sat Aug 10 19:02:50 2019 (r350846) @@ -302,8 +302,8 @@ FRAC_CLK(pll_video0_clk, 31, 28, 1000, /* gate, lock, lock retries */ AW_CLK_HAS_LOCK, /* flags */ 270000000, 297000000, /* freq0, freq1 */ - 24, 25); /* mode sel, freq sel */ - + 24, 25, /* mode sel, freq sel */ + 30000000, 600000000); /* min freq, max freq */ static const char *pll_video0_2x_parents[] = {"pll_video0"}; FIXED_CLK(pll_video0_2x_clk, CLK_PLL_VIDEO0_2X, /* id */ @@ -323,7 +323,8 @@ FRAC_CLK(pll_ve_clk, 31, 28, 1000, /* gate, lock, lock retries */ AW_CLK_HAS_LOCK, /* flags */ 270000000, 297000000, /* freq0, freq1 */ - 24, 25); /* mode sel, freq sel */ + 24, 25, /* mode sel, freq sel */ + 30000000, 600000000); /* min freq, max freq */ NKMP_CLK_WITH_UPDATE(pll_ddr_clk, CLK_PLL_DDR, /* id */ @@ -369,7 +370,8 @@ FRAC_CLK(pll_video1_clk, 31, 28, 1000, /* gate, lock, lock retries */ AW_CLK_HAS_LOCK, /* flags */ 270000000, 297000000, /* freq0, freq1 */ - 24, 25); /* mode sel, freq sel */ + 24, 25, /* mode sel, freq sel */ + 30000000, 600000000); /* min freq, max freq */ static const char *pll_video1_2x_parents[] = {"pll_video1"}; FIXED_CLK(pll_video1_2x_clk, @@ -390,7 +392,8 @@ FRAC_CLK(pll_gpu_clk, 31, 28, 1000, /* gate, lock, lock retries */ AW_CLK_HAS_LOCK, /* flags */ 270000000, 297000000, /* freq0, freq1 */ - 24, 25); /* mode sel, freq sel */ + 24, 25, /* mode sel, freq sel */ + 30000000, 600000000); /* min freq, max freq */ static const char *pll_mipi_parents[] = {"pll_video0", "pll_video1"}; NKMP_CLK(pll_mipi_clk, @@ -414,7 +417,8 @@ FRAC_CLK(pll9_clk, 31, 28, 1000, /* gate, lock, lock retries */ AW_CLK_HAS_LOCK, /* flags */ 270000000, 297000000, /* freq0, freq1 */ - 24, 25); /* mode sel, freq sel */ + 24, 25, /* mode sel, freq sel */ + 30000000, 600000000); /* min freq, max freq */ FRAC_CLK(pll10_clk, CLK_PLL10, /* id */ @@ -425,7 +429,8 @@ FRAC_CLK(pll10_clk, 31, 28, 1000, /* gate, lock, lock retries */ AW_CLK_HAS_LOCK, /* flags */ 270000000, 297000000, /* freq0, freq1 */ - 24, 25); /* mode sel, freq sel */ + 24, 25, /* mode sel, freq sel */ + 30000000, 600000000); /* min freq, max freq */ static struct clk_div_table axi_div_table[] = { { .value = 0, .divider = 1, }, Modified: head/sys/arm/allwinner/clkng/ccu_a64.c ============================================================================== --- head/sys/arm/allwinner/clkng/ccu_a64.c Sat Aug 10 18:58:25 2019 (r350845) +++ head/sys/arm/allwinner/clkng/ccu_a64.c Sat Aug 10 19:02:50 2019 (r350846) @@ -288,7 +288,8 @@ FRAC_CLK(pll_video0_clk, 31, 28, 1000, /* gate, lock, lock retries */ AW_CLK_HAS_LOCK, /* flags */ 270000000, 297000000, /* freq0, freq1 */ - 24, 25); /* mode sel, freq sel */ + 24, 25, /* mode sel, freq sel */ + 192000000, 600000000); /* min freq, max freq */ static const char *pll_video0_2x_parents[] = {"pll_video0"}; FIXED_CLK(pll_video0_2x_clk, CLK_PLL_VIDEO0_2X, /* id */ @@ -309,7 +310,8 @@ FRAC_CLK(pll_ve_clk, 31, 28, 1000, /* gate, lock, lock retries */ AW_CLK_HAS_LOCK, /* flags */ 270000000, 297000000, /* freq0, freq1 */ - 24, 25); /* mode sel, freq sel */ + 24, 25, /* mode sel, freq sel */ + 192000000, 600000000); /* min freq, max freq */ static const char *pll_ddr0_parents[] = {"osc24M"}; NKMP_CLK_WITH_UPDATE(pll_ddr0_clk, @@ -379,7 +381,8 @@ FRAC_CLK(pll_video1_clk, 31, 28, 1000, /* gate, lock, lock retries */ AW_CLK_HAS_LOCK, /* flags */ 270000000, 297000000, /* freq0, freq1 */ - 24, 25); /* mode sel, freq sel */ + 24, 25, /* mode sel, freq sel */ + 192000000, 600000000); /* min freq, max freq */ static const char *pll_gpu_parents[] = {"osc24M"}; FRAC_CLK(pll_gpu_clk, @@ -391,7 +394,8 @@ FRAC_CLK(pll_gpu_clk, 31, 28, 1000, /* gate, lock, lock retries */ AW_CLK_HAS_LOCK, /* flags */ 270000000, 297000000, /* freq0, freq1 */ - 24, 25); /* mode sel, freq sel */ + 24, 25, /* mode sel, freq sel */ + 192000000, 600000000); /* min freq, max freq */ /* PLL MIPI is missing */ @@ -405,7 +409,8 @@ FRAC_CLK(pll_hsic_clk, 31, 28, 1000, /* gate, lock, lock retries */ AW_CLK_HAS_LOCK, /* flags */ 270000000, 297000000, /* freq0, freq1 */ - 24, 25); /* mode sel, freq sel */ + 24, 25, /* mode sel, freq sel */ + 192000000, 600000000); /* min freq, max freq */ static const char *pll_de_parents[] = {"osc24M"}; FRAC_CLK(pll_de_clk, @@ -417,7 +422,8 @@ FRAC_CLK(pll_de_clk, 31, 28, 1000, /* gate, lock, lock retries */ AW_CLK_HAS_LOCK, /* flags */ 270000000, 297000000, /* freq0, freq1 */ - 24, 25); /* mode sel, freq sel */ + 24, 25, /* mode sel, freq sel */ + 192000000, 600000000); /* min freq, max freq */ static const char *pll_ddr1_parents[] = {"osc24M"}; NKMP_CLK_WITH_UPDATE(pll_ddr1_clk, Modified: head/sys/arm/allwinner/clkng/ccu_h3.c ============================================================================== --- head/sys/arm/allwinner/clkng/ccu_h3.c Sat Aug 10 18:58:25 2019 (r350845) +++ head/sys/arm/allwinner/clkng/ccu_h3.c Sat Aug 10 19:02:50 2019 (r350846) @@ -306,7 +306,8 @@ FRAC_CLK(pll_video_clk, 31, 28, 1000, /* gate, lock, lock retries */ AW_CLK_HAS_LOCK, /* flags */ 270000000, 297000000, /* freq0, freq1 */ - 24, 25); /* mode sel, freq sel */ + 24, 25, /* mode sel, freq sel */ + 192000000, 600000000); /* min freq, max freq */ static const char *pll_ve_parents[] = {"osc24M"}; FRAC_CLK(pll_ve_clk, @@ -318,7 +319,8 @@ FRAC_CLK(pll_ve_clk, 31, 28, 1000, /* gate, lock, lock retries */ AW_CLK_HAS_LOCK, /* flags */ 270000000, 297000000, /* freq0, freq1 */ - 24, 25); /* mode sel, freq sel */ + 24, 25, /* mode sel, freq sel */ + 192000000, 600000000); /* min freq, max freq */ static const char *pll_ddr_parents[] = {"osc24M"}; NKMP_CLK_WITH_UPDATE(pll_ddr_clk, @@ -366,7 +368,8 @@ FRAC_CLK(pll_gpu_clk, 31, 28, 1000, /* gate, lock, lock retries */ AW_CLK_HAS_LOCK, /* flags */ 270000000, 297000000, /* freq0, freq1 */ - 24, 25); /* mode sel, freq sel */ + 24, 25, /* mode sel, freq sel */ + 192000000, 600000000); /* min freq, max freq */ static const char *pll_periph1_parents[] = {"osc24M"}; NKMP_CLK(pll_periph1_clk, @@ -391,7 +394,8 @@ FRAC_CLK(pll_de_clk, 31, 28, 1000, /* gate, lock, lock retries */ AW_CLK_HAS_LOCK, /* flags */ 270000000, 297000000, /* freq0, freq1 */ - 24, 25); /* mode sel, freq sel */ + 24, 25, /* mode sel, freq sel */ + 192000000, 600000000); /* min freq, max freq */ static const char *cpux_parents[] = {"osc32k", "osc24M", "pll_cpux", "pll_cpux"}; MUX_CLK(cpux_clk, From owner-svn-src-head@freebsd.org Sat Aug 10 20:03:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15E42C4562; Sat, 10 Aug 2019 20:03:15 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 465Y2B6pc2z45Rc; Sat, 10 Aug 2019 20:03:14 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB1E12F8B; Sat, 10 Aug 2019 20:03:14 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7AK3ERD077807; Sat, 10 Aug 2019 20:03:14 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7AK3EQt077806; Sat, 10 Aug 2019 20:03:14 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201908102003.x7AK3EQt077806@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 10 Aug 2019 20:03:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350847 - head/sys/dev/sdhci X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/sdhci X-SVN-Commit-Revision: 350847 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Aug 2019 20:03:15 -0000 Author: ian Date: Sat Aug 10 20:03:14 2019 New Revision: 350847 URL: https://svnweb.freebsd.org/changeset/base/350847 Log: Allow the sdhci timeout sysctl var to be set as a tunable. Also, add a missing newline in a warning printf. Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Sat Aug 10 19:02:50 2019 (r350846) +++ head/sys/dev/sdhci/sdhci.c Sat Aug 10 20:03:14 2019 (r350847) @@ -481,7 +481,7 @@ sdhci_set_power(struct sdhci_slot *slot, u_char power) DELAY(100); } if (!(RD1(slot, SDHCI_POWER_CONTROL) & SDHCI_POWER_ON)) - slot_printf(slot, "Bus power failed to enable"); + slot_printf(slot, "Bus power failed to enable\n"); if (slot->quirks & SDHCI_QUIRK_INTEL_POWER_UP_RESET) { WR1(slot, SDHCI_POWER_CONTROL, pwr | 0x10); @@ -1128,7 +1128,7 @@ no_tuning: slot->timeout = 10; SYSCTL_ADD_INT(device_get_sysctl_ctx(slot->bus), SYSCTL_CHILDREN(device_get_sysctl_tree(slot->bus)), OID_AUTO, - "timeout", CTLFLAG_RW, &slot->timeout, 0, + "timeout", CTLFLAG_RWTUN, &slot->timeout, 0, "Maximum timeout for SDHCI transfers (in secs)"); TASK_INIT(&slot->card_task, 0, sdhci_card_task, slot); TIMEOUT_TASK_INIT(taskqueue_swi_giant, &slot->card_delayed_task, 0, From owner-svn-src-head@freebsd.org Sat Aug 10 20:05:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7227BC45FB; Sat, 10 Aug 2019 20:05:16 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 465Y4X2NXkz45ZB; Sat, 10 Aug 2019 20:05:16 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48D192F8C; Sat, 10 Aug 2019 20:05:16 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7AK5Ggm077940; Sat, 10 Aug 2019 20:05:16 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7AK5Gbi077939; Sat, 10 Aug 2019 20:05:16 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201908102005.x7AK5Gbi077939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 10 Aug 2019 20:05:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350848 - head/sys/arm/ti/am335x X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/ti/am335x X-SVN-Commit-Revision: 350848 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Aug 2019 20:05:16 -0000 Author: ian Date: Sat Aug 10 20:05:15 2019 New Revision: 350848 URL: https://svnweb.freebsd.org/changeset/base/350848 Log: The am335x_ehrpwm driver now requires the pwmbus_if interface, add it. Modified: head/sys/arm/ti/am335x/files.am335x Modified: head/sys/arm/ti/am335x/files.am335x ============================================================================== --- head/sys/arm/ti/am335x/files.am335x Sat Aug 10 20:03:14 2019 (r350847) +++ head/sys/arm/ti/am335x/files.am335x Sat Aug 10 20:05:15 2019 (r350848) @@ -10,6 +10,7 @@ arm/ti/am335x/am335x_lcd_syscons.c optional sc arm/ti/am335x/am335x_pmic.c optional am335x_pmic arm/ti/am335x/am335x_prcm.c standard arm/ti/am335x/am335x_pwmss.c standard +dev/pwm/pwmbus_if.m standard arm/ti/am335x/am335x_ehrpwm.c standard arm/ti/am335x/am335x_ecap.c standard arm/ti/am335x/am335x_rtc.c optional am335x_rtc From owner-svn-src-head@freebsd.org Sat Aug 10 20:08:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 81D05C46DF; Sat, 10 Aug 2019 20:08:38 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 465Y8Q2qfdz45kg; Sat, 10 Aug 2019 20:08:38 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 28BB92F91; Sat, 10 Aug 2019 20:08:38 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7AK8cYd078119; Sat, 10 Aug 2019 20:08:38 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7AK8bHq078117; Sat, 10 Aug 2019 20:08:37 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201908102008.x7AK8bHq078117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 10 Aug 2019 20:08:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350849 - head/sys/arm/ti/am335x X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/ti/am335x X-SVN-Commit-Revision: 350849 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Aug 2019 20:08:38 -0000 Author: ian Date: Sat Aug 10 20:08:37 2019 New Revision: 350849 URL: https://svnweb.freebsd.org/changeset/base/350849 Log: Remove use of intr_config_hook from the am335x_pmic and tda19988 drivers. Long ago this was needed, but now low-level i2c controller drivers cleverly defer attachment of the bus until interrupts are enabled (if they require interrupts to function), so that every i2c slave device doesn't have to. Modified: head/sys/arm/ti/am335x/am335x_pmic.c head/sys/arm/ti/am335x/tda19988.c Modified: head/sys/arm/ti/am335x/am335x_pmic.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_pmic.c Sat Aug 10 20:05:15 2019 (r350848) +++ head/sys/arm/ti/am335x/am335x_pmic.c Sat Aug 10 20:08:37 2019 (r350849) @@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$"); struct am335x_pmic_softc { device_t sc_dev; uint32_t sc_addr; - struct intr_config_hook enum_hook; struct resource *sc_irq_res; void *sc_intrhand; struct task intr_task; @@ -210,10 +209,9 @@ am335x_pmic_setvo(device_t dev, uint8_t vo) } static void -am335x_pmic_start(void *xdev) +am335x_pmic_start(struct am335x_pmic_softc *sc) { - struct am335x_pmic_softc *sc; - device_t dev = (device_t)xdev; + device_t dev; struct tps65217_status_reg status_reg; struct tps65217_chipid_reg chipid_reg; uint8_t reg, vo; @@ -221,8 +219,7 @@ am335x_pmic_start(void *xdev) char pwr[4][11] = {"Battery", "USB", "AC", "USB and AC"}; int rv; - sc = device_get_softc(dev); - + dev = sc->sc_dev; am335x_pmic_read(dev, TPS65217_CHIPID_REG, (uint8_t *)&chipid_reg, 1); switch (chipid_reg.chip) { case TPS65217A: @@ -265,8 +262,6 @@ am335x_pmic_start(void *xdev) EVENTHANDLER_REGISTER(shutdown_final, am335x_pmic_shutdown, dev, SHUTDOWN_PRI_LAST); - config_intrhook_disestablish(&sc->enum_hook); - /* Unmask all interrupts and clear pending status */ reg = 0; am335x_pmic_write(dev, TPS65217_INT_REG, ®, 1); @@ -300,11 +295,7 @@ am335x_pmic_attach(device_t dev) /* return (ENXIO); */ } - sc->enum_hook.ich_func = am335x_pmic_start; - sc->enum_hook.ich_arg = dev; - - if (config_intrhook_establish(&sc->enum_hook) != 0) - return (ENOMEM); + am335x_pmic_start(sc); return (0); } Modified: head/sys/arm/ti/am335x/tda19988.c ============================================================================== --- head/sys/arm/ti/am335x/tda19988.c Sat Aug 10 20:05:15 2019 (r350848) +++ head/sys/arm/ti/am335x/tda19988.c Sat Aug 10 20:08:37 2019 (r350849) @@ -243,7 +243,6 @@ struct tda19988_softc { uint32_t sc_addr; uint32_t sc_cec_addr; uint16_t sc_version; - struct intr_config_hook enum_hook; int sc_current_page; uint8_t *sc_edid; uint32_t sc_edid_len; @@ -645,15 +644,14 @@ done: } static void -tda19988_start(void *xdev) +tda19988_start(struct tda19988_softc *sc) { - struct tda19988_softc *sc; - device_t dev = (device_t)xdev; + device_t dev; uint8_t data; uint16_t version; - sc = device_get_softc(dev); - + dev = sc->sc_dev; + tda19988_cec_write(sc, TDA_CEC_ENAMODS, ENAMODS_RXSENS | ENAMODS_HDMI); DELAY(1000); tda19988_cec_read(sc, 0xfe, &data); @@ -699,7 +697,7 @@ tda19988_start(void *xdev) break; default: device_printf(dev, "Unknown device: %04x\n", sc->sc_version); - goto done; + return; } tda19988_reg_write(sc, TDA_DDC_CTRL, DDC_ENABLE); @@ -710,16 +708,13 @@ tda19988_start(void *xdev) if (tda19988_read_edid(sc) < 0) { device_printf(dev, "failed to read EDID\n"); - goto done; + return; } /* Default values for RGB 4:4:4 mapping */ tda19988_reg_write(sc, TDA_VIP_CNTRL_0, 0x23); tda19988_reg_write(sc, TDA_VIP_CNTRL_1, 0x01); tda19988_reg_write(sc, TDA_VIP_CNTRL_2, 0x45); - -done: - config_intrhook_disestablish(&sc->enum_hook); } static int @@ -738,14 +733,10 @@ tda19988_attach(device_t dev) device_set_desc(dev, "NXP TDA19988 HDMI transmitter"); - sc->enum_hook.ich_func = tda19988_start; - sc->enum_hook.ich_arg = dev; - - if (config_intrhook_establish(&sc->enum_hook) != 0) - return (ENOMEM); - node = ofw_bus_get_node(dev); OF_device_register_xref(OF_xref_from_node(node), dev); + + tda19988_start(sc); return (0); }