From owner-svn-src-all@freebsd.org Sun Oct 13 00:08:18 2019 Return-Path: Delivered-To: svn-src-all@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 AA461156347; Sun, 13 Oct 2019 00:08:18 +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 46rMTt3zXqz3N9C; Sun, 13 Oct 2019 00:08:18 +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 6CD20B5E9; Sun, 13 Oct 2019 00:08:18 +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 x9D08I6r002864; Sun, 13 Oct 2019 00:08:18 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9D08Ij9002863; Sun, 13 Oct 2019 00:08:18 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910130008.x9D08Ij9002863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 13 Oct 2019 00:08:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353460 - head/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/netpfil/pf X-SVN-Commit-Revision: 353460 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 00:08:18 -0000 Author: markj Date: Sun Oct 13 00:08:17 2019 New Revision: 353460 URL: https://svnweb.freebsd.org/changeset/base/353460 Log: Fix the build after r353458. MFC with: r353458 Sponsored by: The FreeBSD Foundation Modified: head/sys/netpfil/pf/pf.c Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Sat Oct 12 23:16:17 2019 (r353459) +++ head/sys/netpfil/pf/pf.c Sun Oct 13 00:08:17 2019 (r353460) @@ -103,6 +103,10 @@ __FBSDID("$FreeBSD$"); #include #endif /* INET6 */ +#ifdef SCTP +#include +#endif + #include #include @@ -5589,7 +5593,7 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, } #ifdef SCTP if (m0->m_pkthdr.csum_flags & CSUM_SCTP & ~ifp->if_hwassist) { - sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2)); + sctp_delayed_cksum(m0, (uint32_t)(ip->ip_hl << 2)); m0->m_pkthdr.csum_flags &= ~CSUM_SCTP; } #endif From owner-svn-src-all@freebsd.org Sun Oct 13 02:10:56 2019 Return-Path: Delivered-To: svn-src-all@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 A8FEFD016E; Sun, 13 Oct 2019 02:10:56 +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 46rQCN26pFz4G4Y; Sun, 13 Oct 2019 02:10:55 +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 x9D2AppA097895; Sat, 12 Oct 2019 19:10:51 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x9D2AokR097894; Sat, 12 Oct 2019 19:10:50 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201910130210.x9D2AokR097894@gndrsh.dnsmgr.net> Subject: Re: svn commit: r353456 - head/usr.sbin/pciconf In-Reply-To: <201910122227.x9CMRvPK044042@repo.freebsd.org> To: Scott Long Date: Sat, 12 Oct 2019 19:10:50 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@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: 46rQCN26pFz4G4Y X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 02:10:56 -0000 > Author: scottl > Date: Sat Oct 12 22:27:57 2019 > New Revision: 353456 > URL: https://svnweb.freebsd.org/changeset/base/353456 > > Log: > Change from the non-standard nomenclature of "chip" and "card" to the > standard nomenclature of "device" and "vendor" with the "sub" variants. > This changes the printed format, so anything that scrapes and parses > this will need to be adapted. No compatibility shims are provided, > but this will not be MFC'd. I can not "adapt" google easily, seaching for these strings are often very usefull in finding stuff like bug reports and ohers with similiar issues. I am not sure the gain of this is positive over the loss of that. > > Reviewed by: jhb, emaste, gtetlow > Approved by: jhb, emaste, gtetlow > > Modified: > head/usr.sbin/pciconf/pciconf.c > > Modified: head/usr.sbin/pciconf/pciconf.c > ============================================================================== > --- head/usr.sbin/pciconf/pciconf.c Sat Oct 12 20:53:40 2019 (r353455) > +++ head/usr.sbin/pciconf/pciconf.c Sat Oct 12 22:27:57 2019 (r353456) > @@ -261,8 +261,8 @@ list_devs(const char *name, int verbose, int bars, int > return; > } > for (p = conf; p < &conf[pc.num_matches]; p++) { > - printf("%s%d@pci%d:%d:%d:%d:\tclass=0x%06x card=0x%08x " > - "chip=0x%08x rev=0x%02x hdr=0x%02x\n", > + printf("%s%d@pci%d:%d:%d:%d:\tclass=0x%06x subvendor=0x%04x subdevice=0x%04x " > + "vendor=0x%04x device=0x%04x rev=0x%02x hdr=0x%02x\n", > *p->pd_name ? p->pd_name : > "none", > *p->pd_name ? (int)p->pd_unit : > @@ -270,8 +270,8 @@ list_devs(const char *name, int verbose, int bars, int > p->pc_sel.pc_bus, p->pc_sel.pc_dev, > p->pc_sel.pc_func, (p->pc_class << 16) | > (p->pc_subclass << 8) | p->pc_progif, > - (p->pc_subdevice << 16) | p->pc_subvendor, > - (p->pc_device << 16) | p->pc_vendor, > + p->pc_subdevice, p->pc_subvendor, > + p->pc_device, p->pc_vendor, > p->pc_revid, p->pc_hdr); > if (verbose) > list_verbose(p); > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Sun Oct 13 03:42:42 2019 Return-Path: Delivered-To: svn-src-all@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 94855DF1DA; Sun, 13 Oct 2019 03:42:42 +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 46rSFG1h84z4RSp; Sun, 13 Oct 2019 03:42:41 +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 83A2B21F8A; Sat, 12 Oct 2019 23:42:41 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sat, 12 Oct 2019 23:42:41 -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=D QCI+/8gUrtOWBxVKALDJpWpBfvFzhtrAk351rk4GOw=; b=EAW/oB0AaYGXfgq2Z TjpddstPzaIHjZr/OlEYaspvyyT/tgz2Fbl0bY9d+vYIjypE7S/tzheqoHN+bLzt uOyqYJtq+YylVZxRcdlEwQxy1h/5jMFG2mVpuPdlwEGiYg97Wl287uWIseWhD7cc pI0N1V81wSH53M5i0Hg4oxqDSq+7D7L2FtYuQ56ubWlVPDryA7mNHiHnx9vFXmK0 XlXmEIkV9eSTrndi33L+sV23/W98pF1uIBuDNaAGBs36AjOD095NENsRsUw5zDWM echfK7XF6QXKpw7RwYQreEarE+pw5MCx/lkgZimnrJeNX/CfxFwuEta8S1ZdZh/Q 5Yj4g== 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=fm1; bh=DQCI+/8gUrtOWBxVKALDJpWpBfvFzhtrAk351rk4G Ow=; b=qcF/9jIGUIkF91qP3LLjZDxnrBjY6qQjpicjeW+iSUYZ5cjxmYiKxP7cJ /YBblsXM/nrqYPis9djeQWc/LeE6SUoJDqd723ixYUDGbh+dgEd0W5SyOJ70RrgX ww3B7P/lPWp2uHn58hLagyJqTgg3m1ZgiLQw5RBHI+GDqz2bZlmq9mIF3+7HtQko C2TaGwiOInGYdUiYEKwRdF5NsSFEkTHSEgVS2vMibP9sC5QIymRjgzpRQuhGyZtu 3ZhkVzpLGUAt3N+uRyGALfTp5cC5edO8WDRFLNo/azhqbb+xxAGvR8qnuOz0ny4o M/9qGAWVfs1KZNh+beHC3xaYc+ztw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrieekgdejhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecuufhorhhtvgguuchrvggtihhpshculdegtddmnecujf gurheptggguffhjgffgffkfhfvofesthhqmhdthhdtjeenucfhrhhomhepufgtohhtthcu nfhonhhguceoshgtohhtthhlsehsrghmshgtohdrohhrgheqnecuffhomhgrihhnpehfrh gvvggsshgurdhorhhgnecukfhppeduvddrvddvledrvdegjedrgeenucfrrghrrghmpehm rghilhhfrhhomhepshgtohhtthhlsehsrghmshgtohdrohhrghenucevlhhushhtvghruf hiiigvpedt X-ME-Proxy: Received: from [172.20.1.19] (unknown [12.229.247.4]) by mail.messagingengine.com (Postfix) with ESMTPA id 52DFC80059; Sat, 12 Oct 2019 23:42:40 -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: r353456 - head/usr.sbin/pciconf From: Scott Long In-Reply-To: <201910130210.x9D2AokR097894@gndrsh.dnsmgr.net> Date: Sat, 12 Oct 2019 20:42:39 -0700 Cc: Scott Long , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <33AA1D39-CA5B-4AE1-BD1F-A12D1F0DE508@samsco.org> References: <201910130210.x9D2AokR097894@gndrsh.dnsmgr.net> To: rgrimes@freebsd.org X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 46rSFG1h84z4RSp X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 03:42:42 -0000 > On Oct 12, 2019, at 7:10 PM, Rodney W. Grimes = wrote: >=20 >> Author: scottl >> Date: Sat Oct 12 22:27:57 2019 >> New Revision: 353456 >> URL: https://svnweb.freebsd.org/changeset/base/353456 >>=20 >> Log: >> Change from the non-standard nomenclature of "chip" and "card" to = the >> standard nomenclature of "device" and "vendor" with the "sub" = variants. >> This changes the printed format, so anything that scrapes and parses >> this will need to be adapted. No compatibility shims are provided, >> but this will not be MFC'd. >=20 > I can not "adapt" google easily, seaching for these strings are > often very usefull in finding stuff like bug reports and ohers > with similiar issues. I am not sure the gain of this is positive > over the loss of that. It=E2=80=99s never too early to change bad habits =3D-) Every time I write a driver, or even just evaluate an existing driver = against new hardware (which happens frequently for me now, you should = have been at my talk yesterday), I stumble over the non-standard = nomenclature. It doesn=E2=80=99t match the published spec, it doesn=E2=80= =99t match the kernel API, and it doesn=E2=80=99t match any other OS. = John, Warner, and I have been talking about this for at least 10 years, = and it was time to rip off the band-aid and just do it. Scott From owner-svn-src-all@freebsd.org Sun Oct 13 04:25:17 2019 Return-Path: Delivered-To: svn-src-all@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 80A0EE3654; Sun, 13 Oct 2019 04:25:17 +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 46rTBP2YYCz4Vgq; Sun, 13 Oct 2019 04:25:17 +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 36D0BF8F1; Sun, 13 Oct 2019 04:25:17 +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 x9D4PHkJ056703; Sun, 13 Oct 2019 04:25:17 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9D4PGgI056699; Sun, 13 Oct 2019 04:25:16 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910130425.x9D4PGgI056699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Sun, 13 Oct 2019 04:25:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353461 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 353461 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 04:25:17 -0000 Author: glebius Date: Sun Oct 13 04:25:16 2019 New Revision: 353461 URL: https://svnweb.freebsd.org/changeset/base/353461 Log: Don't cover in6_ifattach() with network epoch, as it may call into network drivers ioctls, that may sleep. PR: 241223 Modified: head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/nd6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Sun Oct 13 00:08:17 2019 (r353460) +++ head/sys/netinet6/in6.c Sun Oct 13 04:25:16 2019 (r353461) @@ -1930,12 +1930,12 @@ in6_if_up(struct ifnet *ifp) arc4random() % (MAX_RTR_SOLICITATION_DELAY * hz)); } } + NET_EPOCH_EXIT(et); /* * special cases, like 6to4, are handled in in6_ifattach */ in6_ifattach(ifp, NULL); - NET_EPOCH_EXIT(et); } int Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Sun Oct 13 00:08:17 2019 (r353460) +++ head/sys/netinet6/in6_ifattach.c Sun Oct 13 04:25:16 2019 (r353461) @@ -423,6 +423,7 @@ in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet struct in6_ifaddr *ia; struct in6_aliasreq ifra; struct nd_prefixctl pr0; + struct epoch_tracker et; struct nd_prefix *pr; int error; @@ -437,7 +438,10 @@ in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet ifra.ifra_addr.sin6_addr.s6_addr32[2] = 0; ifra.ifra_addr.sin6_addr.s6_addr32[3] = htonl(1); } else { - if (get_ifid(ifp, altifp, &ifra.ifra_addr.sin6_addr) != 0) { + NET_EPOCH_ENTER(et); + error = get_ifid(ifp, altifp, &ifra.ifra_addr.sin6_addr); + NET_EPOCH_EXIT(et); + if (error != 0) { nd6log((LOG_ERR, "%s: no ifid available\n", if_name(ifp))); return (-1); @@ -472,7 +476,9 @@ in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet return (-1); } + NET_EPOCH_ENTER(et); ia = in6ifa_ifpforlinklocal(ifp, 0); + NET_EPOCH_EXIT(et); if (ia == NULL) { /* * Another thread removed the address that we just added. @@ -667,8 +673,6 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp) { struct in6_ifaddr *ia; - NET_EPOCH_ASSERT(); - if (ifp->if_afdata[AF_INET6] == NULL) return; /* @@ -718,7 +722,11 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp) */ if (!(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) && ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) { + struct epoch_tracker et; + + NET_EPOCH_ENTER(et); ia = in6ifa_ifpforlinklocal(ifp, 0); + NET_EPOCH_EXIT(et); if (ia == NULL) in6_ifattach_linklocal(ifp, altifp); else Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Sun Oct 13 00:08:17 2019 (r353460) +++ head/sys/netinet6/nd6.c Sun Oct 13 04:25:16 2019 (r353461) @@ -1691,7 +1691,6 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) struct ifaddr *ifa; struct in6_ifaddr *ia; - NET_EPOCH_ENTER(et); if ((ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) && !(ND.flags & ND6_IFF_IFDISABLED)) { /* ifdisabled 1->0 transision */ @@ -1702,6 +1701,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) * do not clear ND6_IFF_IFDISABLED. * See RFC 4862, Section 5.4.5. */ + NET_EPOCH_ENTER(et); CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; @@ -1710,6 +1710,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) IN6_IS_ADDR_LINKLOCAL(IA6_IN6(ia))) break; } + NET_EPOCH_EXIT(et); if (ifa != NULL) { /* LLA is duplicated. */ @@ -1730,6 +1731,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) ND_IFINFO(ifp)->flags |= ND6_IFF_IFDISABLED; if (V_ip6_dad_count > 0 && (ND_IFINFO(ifp)->flags & ND6_IFF_NO_DAD) == 0) { + NET_EPOCH_ENTER(et); CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != @@ -1738,6 +1740,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) ia = (struct in6_ifaddr *)ifa; ia->ia6_flags |= IN6_IFF_TENTATIVE; } + NET_EPOCH_EXIT(et); } } @@ -1756,6 +1759,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) * address is assigned, and IFF_UP, try to * assign one. */ + NET_EPOCH_ENTER(et); CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != @@ -1765,13 +1769,13 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) if (IN6_IS_ADDR_LINKLOCAL(IA6_IN6(ia))) break; } + NET_EPOCH_EXIT(et); if (ifa != NULL) /* No LLA is configured. */ in6_ifattach(ifp, NULL); } } ND_IFINFO(ifp)->flags = ND.flags; - NET_EPOCH_EXIT(et); break; } #undef ND From owner-svn-src-all@freebsd.org Sun Oct 13 05:11:55 2019 Return-Path: Delivered-To: svn-src-all@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 19EA3E4F14; Sun, 13 Oct 2019 05:11:55 +0000 (UTC) (envelope-from scottl@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 46rVDB6zD4z4XVq; Sun, 13 Oct 2019 05:11:54 +0000 (UTC) (envelope-from scottl@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 D31BD18179; Sun, 13 Oct 2019 05:11:54 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9D5BsUl083314; Sun, 13 Oct 2019 05:11:54 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9D5BsPT083310; Sun, 13 Oct 2019 05:11:54 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201910130511.x9D5BsPT083310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sun, 13 Oct 2019 05:11:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353462 - head/usr.sbin/pciconf X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/usr.sbin/pciconf X-SVN-Commit-Revision: 353462 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 05:11:55 -0000 Author: scottl Date: Sun Oct 13 05:11:53 2019 New Revision: 353462 URL: https://svnweb.freebsd.org/changeset/base/353462 Log: Fix the botched field ordering in the last commit. While here, fix whitespace, and also reorder the fields so they are easier to read on an 80 column display (the lines wrapped even before these changes). Also fix non-standard nomenclature in the Caps code, and update the man page. Reported by: rpokala Modified: head/usr.sbin/pciconf/cap.c head/usr.sbin/pciconf/pciconf.8 head/usr.sbin/pciconf/pciconf.c Modified: head/usr.sbin/pciconf/cap.c ============================================================================== --- head/usr.sbin/pciconf/cap.c Sun Oct 13 04:25:16 2019 (r353461) +++ head/usr.sbin/pciconf/cap.c Sun Oct 13 05:11:53 2019 (r353462) @@ -371,9 +371,12 @@ static void cap_subvendor(int fd, struct pci_conf *p, uint8_t ptr) { uint32_t id; + uint16_t ssid, ssvid; id = read_config(fd, &p->pc_sel, ptr + PCIR_SUBVENDCAP_ID, 4); - printf("PCI Bridge card=0x%08x", id); + ssid = id >> 16; + ssvid = id & 0xffff; + printf("PCI Bridge subvendor=0x%04x subdevice=0x%04x", ssvid, ssid); } #define MAX_PAYLOAD(field) (128 << (field)) Modified: head/usr.sbin/pciconf/pciconf.8 ============================================================================== --- head/usr.sbin/pciconf/pciconf.8 Sun Oct 13 04:25:16 2019 (r353461) +++ head/usr.sbin/pciconf/pciconf.8 Sun Oct 13 05:11:53 2019 (r353462) @@ -60,16 +60,16 @@ option, .Nm lists PCI devices in the following format: .Bd -literal -foo0@pci0:0:4:0: class=0x010000 card=0x00000000 chip=0x000f1000 rev=0x01 \ -hdr=0x00 -bar0@pci0:0:5:0: class=0x000100 card=0x00000000 chip=0x88c15333 rev=0x00 \ -hdr=0x00 -none0@pci0:0:6:0: class=0x020000 card=0x00000000 chip=0x802910ec rev=0x00 \ -hdr=0x00 +foo0@pci0:0:4:0: class=0x010000 rev=0x01 hdr=0x00 vendor=0x1000 device=0x000f \ +subvendor=0x0000 subdevice=0x0000 +bar0@pci0:0:5:0: class=0x000100 rev=0x00 hdr=0x00 vendor=0x88c1 device=0x5333 \ +subvendor=0x0000 subdevice=0x0000 +none0@pci0:0:6:0: class=0x020000 rev=0x00 hdr=0x00 vendor=0x10ec device=0x8029 \ +subvendor=0x0000 subdevice=0x0000 .Ed .Pp The first column gives the -driver name, unit number, and selector . +driver name, unit number, and selector. If there is no driver attached to the .Tn PCI device in question, the driver name will be @@ -80,21 +80,10 @@ The selector is in a form which may directly be used for the other forms of the command. The second column is the class code, with the class byte printed as two hex digits, followed by the sub-class and the interface bytes. -The third column gives the contents of the subvendorid register, introduced -in revision 2.1 of the -.Tn PCI -standard. -Note that it will be 0 for older cards. -The field consists of the card ID in the upper -half and the card vendor ID in the lower half of the value. +The third column prints the device's revision. +The fourth column describes the header type. .Pp -The fourth column contains the chip device ID, which identifies the chip -this card is based on. -It consists of two fields, identifying the chip and -its vendor, as above. -The fifth column prints the chip's revision. -The sixth column describes the header type. -Currently assigned header types include 0 for most devices, +Currently assigned header types include 0 for standard devices, 1 for .Tn PCI to @@ -112,6 +101,14 @@ device, it is a .Em multi-function device, which contains several (similar or independent) functions on one chip. +.Pp +The sixth and seventh columns contain the vendor ID and the device ID of the +device. +The eigth and ninth columns contain subvendor and subdevice IDs, introduced +in revision 2.1 of the +.Tn PCI +standard. +Note that they will be 0 for older cards. .Pp If the .Fl B Modified: head/usr.sbin/pciconf/pciconf.c ============================================================================== --- head/usr.sbin/pciconf/pciconf.c Sun Oct 13 04:25:16 2019 (r353461) +++ head/usr.sbin/pciconf/pciconf.c Sun Oct 13 05:11:53 2019 (r353462) @@ -261,8 +261,10 @@ list_devs(const char *name, int verbose, int bars, int return; } for (p = conf; p < &conf[pc.num_matches]; p++) { - printf("%s%d@pci%d:%d:%d:%d:\tclass=0x%06x subvendor=0x%04x subdevice=0x%04x " - "vendor=0x%04x device=0x%04x rev=0x%02x hdr=0x%02x\n", + printf("%s%d@pci%d:%d:%d:%d:" + "\tclass=0x%06x rev=0x%02x hdr=0x%02x " + "vendor=0x%04x device=0x%04x " + "subvendor=0x%04x subdevice=0x%04x\n", *p->pd_name ? p->pd_name : "none", *p->pd_name ? (int)p->pd_unit : @@ -270,9 +272,9 @@ list_devs(const char *name, int verbose, int bars, int p->pc_sel.pc_bus, p->pc_sel.pc_dev, p->pc_sel.pc_func, (p->pc_class << 16) | (p->pc_subclass << 8) | p->pc_progif, - p->pc_subdevice, p->pc_subvendor, - p->pc_device, p->pc_vendor, - p->pc_revid, p->pc_hdr); + p->pc_revid, p->pc_hdr, + p->pc_vendor, p->pc_device, + p->pc_subvendor, p->pc_subdevice); if (verbose) list_verbose(p); if (bars) From owner-svn-src-all@freebsd.org Sun Oct 13 06:56:46 2019 Return-Path: Delivered-To: svn-src-all@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 48AC1E6B7D; Sun, 13 Oct 2019 06:56:46 +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 46rXYB14Lqz4bXH; Sun, 13 Oct 2019 06:56:46 +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 08A741935A; Sun, 13 Oct 2019 06:56:46 +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 x9D6uj9s044335; Sun, 13 Oct 2019 06:56:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9D6ujnS044334; Sun, 13 Oct 2019 06:56:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910130656.x9D6ujnS044334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 13 Oct 2019 06:56:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353463 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353463 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 06:56:46 -0000 Author: kib Date: Sun Oct 13 06:56:45 2019 New Revision: 353463 URL: https://svnweb.freebsd.org/changeset/base/353463 Log: Restore nofaulting operations after r352807 The TDP_NOFAULTING flag should be checked in vm_fault(), not in vm_fault_trap(). Otherwise kernel accesses to userspace, like vn_io_fault(), enter vm locking when it should not. Reported and tested by: pho Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D21992 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sun Oct 13 05:11:53 2019 (r353462) +++ head/sys/vm/vm_fault.c Sun Oct 13 06:56:45 2019 (r353463) @@ -554,15 +554,11 @@ int vm_fault_trap(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, int fault_flags, int *signo, int *ucode) { - struct thread *td; int result; MPASS(signo == NULL || ucode != NULL); - td = curthread; - if ((td->td_pflags & TDP_NOFAULTING) != 0) - return (KERN_PROTECTION_FAILURE); #ifdef KTRACE - if (map != kernel_map && KTRPOINT(td, KTR_FAULT)) + if (map != kernel_map && KTRPOINT(curthread, KTR_FAULT)) ktrfault(vaddr, fault_type); #endif result = vm_fault(map, trunc_page(vaddr), fault_type, fault_flags, @@ -574,7 +570,7 @@ vm_fault_trap(vm_map_t map, vm_offset_t vaddr, vm_prot result == KERN_OUT_OF_BOUNDS, ("Unexpected Mach error %d from vm_fault()", result)); #ifdef KTRACE - if (map != kernel_map && KTRPOINT(td, KTR_FAULTEND)) + if (map != kernel_map && KTRPOINT(curthread, KTR_FAULTEND)) ktrfaultend(result); #endif if (result != KERN_SUCCESS && signo != NULL) { @@ -644,6 +640,10 @@ vm_fault(vm_map_t map, vm_offset_t vaddr, vm_prot_t fa bool dead, hardfault, is_first_object_locked; VM_CNT_INC(v_vm_faults); + + if ((curthread->td_pflags & TDP_NOFAULTING) != 0) + return (KERN_PROTECTION_FAILURE); + fs.vp = NULL; faultcount = 0; nera = -1; From owner-svn-src-all@freebsd.org Sun Oct 13 06:58:40 2019 Return-Path: Delivered-To: svn-src-all@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 38A98E6C46; Sun, 13 Oct 2019 06:58:40 +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 46rXbN0d71z4bgS; Sun, 13 Oct 2019 06:58:40 +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 ECD1319361; Sun, 13 Oct 2019 06:58:39 +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 x9D6wdmT044475; Sun, 13 Oct 2019 06:58:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9D6wdGe044474; Sun, 13 Oct 2019 06:58:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910130658.x9D6wdGe044474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 13 Oct 2019 06:58:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353464 - stable/12/sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/sys X-SVN-Commit-Revision: 353464 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 06:58:40 -0000 Author: kib Date: Sun Oct 13 06:58:39 2019 New Revision: 353464 URL: https://svnweb.freebsd.org/changeset/base/353464 Log: MFC r353413: Typo out->in. Modified: stable/12/sys/sys/lockf.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/sys/lockf.h ============================================================================== --- stable/12/sys/sys/lockf.h Sun Oct 13 06:56:45 2019 (r353463) +++ stable/12/sys/sys/lockf.h Sun Oct 13 06:58:39 2019 (r353464) @@ -81,7 +81,7 @@ struct lockf_entry { struct task *lf_async_task;/* (c) Async lock callback */ LIST_ENTRY(lockf_entry) lf_link; /* (s) Linkage for lock lists */ struct lockf_edge_list lf_outedges; /* (s) list of out-edges */ - struct lockf_edge_list lf_inedges; /* (s) list of out-edges */ + struct lockf_edge_list lf_inedges; /* (s) list of in-edges */ int lf_refs; /* (s) ref count */ }; LIST_HEAD(lockf_entry_list, lockf_entry); From owner-svn-src-all@freebsd.org Sun Oct 13 06:59:37 2019 Return-Path: Delivered-To: svn-src-all@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 C00E0E6CD3; Sun, 13 Oct 2019 06:59:37 +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 46rXcT4bmbz4bnd; Sun, 13 Oct 2019 06:59:37 +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 815BB19362; Sun, 13 Oct 2019 06:59:37 +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 x9D6xbvS044583; Sun, 13 Oct 2019 06:59:37 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9D6xbPX044582; Sun, 13 Oct 2019 06:59:37 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910130659.x9D6xbPX044582@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 13 Oct 2019 06:59:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353465 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 353465 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 06:59:37 -0000 Author: kib Date: Sun Oct 13 06:59:37 2019 New Revision: 353465 URL: https://svnweb.freebsd.org/changeset/base/353465 Log: MFC r353413: Typo out->in. Modified: stable/11/sys/sys/lockf.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/lockf.h ============================================================================== --- stable/11/sys/sys/lockf.h Sun Oct 13 06:58:39 2019 (r353464) +++ stable/11/sys/sys/lockf.h Sun Oct 13 06:59:37 2019 (r353465) @@ -79,7 +79,7 @@ struct lockf_entry { struct task *lf_async_task;/* (c) Async lock callback */ LIST_ENTRY(lockf_entry) lf_link; /* (s) Linkage for lock lists */ struct lockf_edge_list lf_outedges; /* (s) list of out-edges */ - struct lockf_edge_list lf_inedges; /* (s) list of out-edges */ + struct lockf_edge_list lf_inedges; /* (s) list of in-edges */ int lf_refs; /* (s) ref count */ }; LIST_HEAD(lockf_entry_list, lockf_entry); From owner-svn-src-all@freebsd.org Sun Oct 13 09:35:04 2019 Return-Path: Delivered-To: svn-src-all@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 6D8B3F336C; Sun, 13 Oct 2019 09:35:04 +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 46rc3r1bsGz3FZC; Sun, 13 Oct 2019 09:35:04 +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 1A4B71AF78; Sun, 13 Oct 2019 09:35:04 +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 x9D9Z3L7039850; Sun, 13 Oct 2019 09:35:03 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9D9Z3Ns039849; Sun, 13 Oct 2019 09:35:03 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910130935.x9D9Z3Ns039849@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 13 Oct 2019 09:35:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353466 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 353466 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 09:35:04 -0000 Author: tuexen Date: Sun Oct 13 09:35:03 2019 New Revision: 353466 URL: https://svnweb.freebsd.org/changeset/base/353466 Log: Remove line not needed. Submitted by: markj@ MFC after: 3 days Modified: head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet6/sctp6_usrreq.c ============================================================================== --- head/sys/netinet6/sctp6_usrreq.c Sun Oct 13 06:59:37 2019 (r353465) +++ head/sys/netinet6/sctp6_usrreq.c Sun Oct 13 09:35:03 2019 (r353466) @@ -57,8 +57,6 @@ __FBSDID("$FreeBSD$"); #include #include -extern struct protosw inetsw[]; - int sctp6_input_with_port(struct mbuf **i_pak, int *offp, uint16_t port) { From owner-svn-src-all@freebsd.org Sun Oct 13 15:15:10 2019 Return-Path: Delivered-To: svn-src-all@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 509FCFBEFC; Sun, 13 Oct 2019 15:15:10 +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 46rlcG158pz41cy; Sun, 13 Oct 2019 15:15:10 +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 08B111EB63; Sun, 13 Oct 2019 15:15:10 +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 x9DFF9OW040917; Sun, 13 Oct 2019 15:15:09 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9DFF9It040916; Sun, 13 Oct 2019 15:15:09 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910131515.x9DFF9It040916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Sun, 13 Oct 2019 15:15:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353467 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353467 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 15:15:10 -0000 Author: glebius Date: Sun Oct 13 15:15:09 2019 New Revision: 353467 URL: https://svnweb.freebsd.org/changeset/base/353467 Log: vlan_config() isn't always called in epoch context. Reported by: kp Modified: head/sys/net/if_vlan.c Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Sun Oct 13 09:35:03 2019 (r353466) +++ head/sys/net/if_vlan.c Sun Oct 13 15:15:09 2019 (r353467) @@ -1346,12 +1346,11 @@ vlan_lladdr_fn(void *arg, int pending __unused) static int vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t vid) { + struct epoch_tracker et; struct ifvlantrunk *trunk; struct ifnet *ifp; int error = 0; - NET_EPOCH_ASSERT(); - /* * We can handle non-ethernet hardware types as long as * they handle the tagging and headers themselves. @@ -1452,7 +1451,9 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint1 ifp->if_link_state = p->if_link_state; + NET_EPOCH_ENTER(et); vlan_capabilities(ifv); + NET_EPOCH_EXIT(et); /* * Set up our interface address to reflect the underlying @@ -1794,8 +1795,6 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data struct vlanreq vlr; int error = 0; - NET_EPOCH_ASSERT(); - ifr = (struct ifreq *)data; ifa = (struct ifaddr *) data; ifv = ifp->if_softc; @@ -1972,8 +1971,13 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data VLAN_SLOCK(); ifv->ifv_capenable = ifr->ifr_reqcap; trunk = TRUNK(ifv); - if (trunk != NULL) + if (trunk != NULL) { + struct epoch_tracker et; + + NET_EPOCH_ENTER(et); vlan_capabilities(ifv); + NET_EPOCH_EXIT(et); + } VLAN_SUNLOCK(); break; From owner-svn-src-all@freebsd.org Sun Oct 13 15:39:11 2019 Return-Path: Delivered-To: svn-src-all@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 C57B5130F0F; Sun, 13 Oct 2019 15:39:11 +0000 (UTC) (envelope-from mjg@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 46rm7z4h1Pz4BQX; Sun, 13 Oct 2019 15:39:11 +0000 (UTC) (envelope-from mjg@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 83A851EF01; Sun, 13 Oct 2019 15:39:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9DFdB9Z052831; Sun, 13 Oct 2019 15:39:11 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9DFdBKD052830; Sun, 13 Oct 2019 15:39:11 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201910131539.x9DFdBKD052830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 13 Oct 2019 15:39:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353468 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 353468 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 15:39:11 -0000 Author: mjg Date: Sun Oct 13 15:39:11 2019 New Revision: 353468 URL: https://svnweb.freebsd.org/changeset/base/353468 Log: vfs: return free vnode batches in sync instead of vfs_msync It is a more natural fit. vfs_msync only deals with active vnodes. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22008 Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sun Oct 13 15:15:09 2019 (r353467) +++ head/sys/kern/vfs_subr.c Sun Oct 13 15:39:11 2019 (r353468) @@ -4395,8 +4395,6 @@ vfs_msync(struct mount *mp, int flags) CTR2(KTR_VFS, "%s: mp %p", __func__, mp); - vnlru_return_batch(mp); - MNT_VNODE_FOREACH_ACTIVE(vp, mp, mvp) { obj = vp->v_object; if (obj != NULL && (obj->flags & OBJ_MIGHTBEDIRTY) != 0 && @@ -4628,6 +4626,11 @@ sync_fsync(struct vop_fsync_args *ap) return (0); } save = curthread_pflags_set(TDP_SYNCIO); + /* + * The filesystem at hand may be idle with free vnodes stored in the + * batch. Return them instead of letting them stay there indefinitely. + */ + vnlru_return_batch(mp); vfs_msync(mp, MNT_NOWAIT); error = VFS_SYNC(mp, MNT_LAZY); curthread_pflags_restore(save); From owner-svn-src-all@freebsd.org Sun Oct 13 15:40:35 2019 Return-Path: Delivered-To: svn-src-all@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 B1D17131BEA; Sun, 13 Oct 2019 15:40:35 +0000 (UTC) (envelope-from mjg@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 46rm9b23dCz4C5T; Sun, 13 Oct 2019 15:40:35 +0000 (UTC) (envelope-from mjg@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 27BAE1EF09; Sun, 13 Oct 2019 15:40:35 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9DFeZ39052970; Sun, 13 Oct 2019 15:40:35 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9DFeYmf052968; Sun, 13 Oct 2019 15:40:34 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201910131540.x9DFeYmf052968@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 13 Oct 2019 15:40:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353469 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 353469 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 15:40:35 -0000 Author: mjg Date: Sun Oct 13 15:40:34 2019 New Revision: 353469 URL: https://svnweb.freebsd.org/changeset/base/353469 Log: vfs: add MNTK_NOMSYNC On many filesystems the traversal is effectively a no-op. Add a way to avoid the overhead. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22009 Modified: head/sys/kern/vfs_subr.c head/sys/sys/mount.h Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sun Oct 13 15:39:11 2019 (r353468) +++ head/sys/kern/vfs_subr.c Sun Oct 13 15:40:34 2019 (r353469) @@ -4395,6 +4395,9 @@ vfs_msync(struct mount *mp, int flags) CTR2(KTR_VFS, "%s: mp %p", __func__, mp); + if ((mp->mnt_kern_flag & MNTK_NOMSYNC) != 0) + return; + MNT_VNODE_FOREACH_ACTIVE(vp, mp, mvp) { obj = vp->v_object; if (obj != NULL && (obj->flags & OBJ_MIGHTBEDIRTY) != 0 && Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Sun Oct 13 15:39:11 2019 (r353468) +++ head/sys/sys/mount.h Sun Oct 13 15:40:34 2019 (r353469) @@ -396,6 +396,7 @@ void __mnt_vnode_markerfree_active(struct vno #define MNTK_UNMOUNTF 0x00000001 /* forced unmount in progress */ #define MNTK_ASYNC 0x00000002 /* filtered async flag */ #define MNTK_SOFTDEP 0x00000004 /* async disabled by softdep */ +#define MNTK_NOMSYNC 0x00000008 /* don't do vfs_msync */ #define MNTK_DRAINING 0x00000010 /* lock draining is happening */ #define MNTK_REFEXPIRE 0x00000020 /* refcount expiring is happening */ #define MNTK_EXTENDED_SHARED 0x00000040 /* Allow shared locking for more ops */ From owner-svn-src-all@freebsd.org Sun Oct 13 15:41:30 2019 Return-Path: Delivered-To: svn-src-all@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 D47F1131EC6; Sun, 13 Oct 2019 15:41:30 +0000 (UTC) (envelope-from mjg@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 46rmBf3w30z4CM4; Sun, 13 Oct 2019 15:41:30 +0000 (UTC) (envelope-from mjg@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 6A7361EF54; Sun, 13 Oct 2019 15:41:30 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9DFfUjr057623; Sun, 13 Oct 2019 15:41:30 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9DFfUdL057622; Sun, 13 Oct 2019 15:41:30 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201910131541.x9DFfUdL057622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 13 Oct 2019 15:41:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353470 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 353470 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 15:41:30 -0000 Author: mjg Date: Sun Oct 13 15:41:30 2019 New Revision: 353470 URL: https://svnweb.freebsd.org/changeset/base/353470 Log: zfs: use MNTK_NOMSYNC Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22009 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sun Oct 13 15:40:34 2019 (r353469) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sun Oct 13 15:41:30 2019 (r353470) @@ -1393,6 +1393,7 @@ zfs_domount(vfs_t *vfsp, char *osname) vfsp->mnt_kern_flag |= MNTK_SHARED_WRITES; vfsp->mnt_kern_flag |= MNTK_EXTENDED_SHARED; vfsp->mnt_kern_flag |= MNTK_NO_IOPF; /* vn_io_fault can be used */ + vfsp->mnt_kern_flag |= MNTK_NOMSYNC; /* * The fsid is 64 bits, composed of an 8-bit fs type, which From owner-svn-src-all@freebsd.org Sun Oct 13 15:41:48 2019 Return-Path: Delivered-To: svn-src-all@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 188B9131F5B; Sun, 13 Oct 2019 15:41:48 +0000 (UTC) (envelope-from mjg@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 46rmBz6xqmz4CVc; Sun, 13 Oct 2019 15:41:47 +0000 (UTC) (envelope-from mjg@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 D32721EF69; Sun, 13 Oct 2019 15:41:47 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9DFflZQ057681; Sun, 13 Oct 2019 15:41:47 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9DFflQO057680; Sun, 13 Oct 2019 15:41:47 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201910131541.x9DFflQO057680@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 13 Oct 2019 15:41:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353471 - head/sys/fs/devfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/devfs X-SVN-Commit-Revision: 353471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 15:41:48 -0000 Author: mjg Date: Sun Oct 13 15:41:47 2019 New Revision: 353471 URL: https://svnweb.freebsd.org/changeset/base/353471 Log: devfs: use MNTK_NOMSYNC Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22009 Modified: head/sys/fs/devfs/devfs_vfsops.c Modified: head/sys/fs/devfs/devfs_vfsops.c ============================================================================== --- head/sys/fs/devfs/devfs_vfsops.c Sun Oct 13 15:41:30 2019 (r353470) +++ head/sys/fs/devfs/devfs_vfsops.c Sun Oct 13 15:41:47 2019 (r353471) @@ -130,7 +130,8 @@ devfs_mount(struct mount *mp) MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; - mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED; + mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED | + MNTK_NOMSYNC; #ifdef MAC mp->mnt_flag |= MNT_MULTILABEL; #endif From owner-svn-src-all@freebsd.org Sun Oct 13 15:42:04 2019 Return-Path: Delivered-To: svn-src-all@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 E0182132163; Sun, 13 Oct 2019 15:42:04 +0000 (UTC) (envelope-from mjg@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 46rmCJ5gMQz4CfQ; Sun, 13 Oct 2019 15:42:04 +0000 (UTC) (envelope-from mjg@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 A78EF1EF85; Sun, 13 Oct 2019 15:42:04 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9DFg4rI057741; Sun, 13 Oct 2019 15:42:04 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9DFg49e057740; Sun, 13 Oct 2019 15:42:04 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201910131542.x9DFg49e057740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 13 Oct 2019 15:42:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353472 - head/sys/fs/nullfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/nullfs X-SVN-Commit-Revision: 353472 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 15:42:05 -0000 Author: mjg Date: Sun Oct 13 15:42:04 2019 New Revision: 353472 URL: https://svnweb.freebsd.org/changeset/base/353472 Log: nullfs: use MNTK_NOMSYNC Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22009 Modified: head/sys/fs/nullfs/null_vfsops.c Modified: head/sys/fs/nullfs/null_vfsops.c ============================================================================== --- head/sys/fs/nullfs/null_vfsops.c Sun Oct 13 15:41:47 2019 (r353471) +++ head/sys/fs/nullfs/null_vfsops.c Sun Oct 13 15:42:04 2019 (r353472) @@ -205,7 +205,7 @@ nullfs_mount(struct mount *mp) (MNTK_SHARED_WRITES | MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED); } - mp->mnt_kern_flag |= MNTK_LOOKUP_EXCL_DOTDOT; + mp->mnt_kern_flag |= MNTK_LOOKUP_EXCL_DOTDOT | MNTK_NOMSYNC; mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag & (MNTK_USES_BCACHE | MNTK_NO_IOPF | MNTK_UNMAPPED_BUFS); MNT_IUNLOCK(mp); From owner-svn-src-all@freebsd.org Sun Oct 13 15:42:26 2019 Return-Path: Delivered-To: svn-src-all@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 6B95A1322AF; Sun, 13 Oct 2019 15:42:26 +0000 (UTC) (envelope-from mjg@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 46rmCk0Jmnz4Cq6; Sun, 13 Oct 2019 15:42:26 +0000 (UTC) (envelope-from mjg@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 DE1F91F0C4; Sun, 13 Oct 2019 15:42:25 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9DFgP5w058499; Sun, 13 Oct 2019 15:42:25 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9DFgPXo058498; Sun, 13 Oct 2019 15:42:25 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201910131542.x9DFgPXo058498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 13 Oct 2019 15:42:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353473 - head/sys/fs/pseudofs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/pseudofs X-SVN-Commit-Revision: 353473 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 15:42:26 -0000 Author: mjg Date: Sun Oct 13 15:42:25 2019 New Revision: 353473 URL: https://svnweb.freebsd.org/changeset/base/353473 Log: pseudofs: use MNTK_NOMSYNC Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22009 Modified: head/sys/fs/pseudofs/pseudofs.c Modified: head/sys/fs/pseudofs/pseudofs.c ============================================================================== --- head/sys/fs/pseudofs/pseudofs.c Sun Oct 13 15:42:04 2019 (r353472) +++ head/sys/fs/pseudofs/pseudofs.c Sun Oct 13 15:42:25 2019 (r353473) @@ -368,6 +368,7 @@ pfs_mount(struct pfs_info *pi, struct mount *mp) MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; + mp->mnt_kern_flag |= MNTK_NOMSYNC; MNT_IUNLOCK(mp); mp->mnt_data = pi; vfs_getnewfsid(mp); From owner-svn-src-all@freebsd.org Sun Oct 13 15:42:42 2019 Return-Path: Delivered-To: svn-src-all@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 2600B13235F; Sun, 13 Oct 2019 15:42:42 +0000 (UTC) (envelope-from mjg@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 46rmD20H3lz4D58; Sun, 13 Oct 2019 15:42:42 +0000 (UTC) (envelope-from mjg@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 E13CD1F0D7; Sun, 13 Oct 2019 15:42:41 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9DFgfYN058558; Sun, 13 Oct 2019 15:42:41 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9DFgfJm058557; Sun, 13 Oct 2019 15:42:41 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201910131542.x9DFgfJm058557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 13 Oct 2019 15:42:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353474 - head/sys/fs/tmpfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/tmpfs X-SVN-Commit-Revision: 353474 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 15:42:42 -0000 Author: mjg Date: Sun Oct 13 15:42:41 2019 New Revision: 353474 URL: https://svnweb.freebsd.org/changeset/base/353474 Log: tmpfs: use MNTK_NOMSYNC Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22009 Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vfsops.c Sun Oct 13 15:42:25 2019 (r353473) +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Sun Oct 13 15:42:41 2019 (r353474) @@ -507,7 +507,7 @@ tmpfs_mount(struct mount *mp) MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED | - MNTK_TEXT_REFS; + MNTK_TEXT_REFS | MNTK_NOMSYNC; MNT_IUNLOCK(mp); mp->mnt_data = tmp; From owner-svn-src-all@freebsd.org Sun Oct 13 15:54:23 2019 Return-Path: Delivered-To: svn-src-all@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 313CE133850; Sun, 13 Oct 2019 15:54:23 +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 46rmTW0SDtz4F3q; Sun, 13 Oct 2019 15:54:23 +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 E71671F2A6; Sun, 13 Oct 2019 15:54:22 +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 x9DFsMcx064649; Sun, 13 Oct 2019 15:54:22 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9DFsMWY064648; Sun, 13 Oct 2019 15:54:22 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910131554.x9DFsMWY064648@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 13 Oct 2019 15:54:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353475 - stable/12/sys/riscv/riscv X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/riscv/riscv X-SVN-Commit-Revision: 353475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 15:54:23 -0000 Author: markj Date: Sun Oct 13 15:54:22 2019 New Revision: 353475 URL: https://svnweb.freebsd.org/changeset/base/353475 Log: MFC r353308: Avoid erroneously clearing PGA_WRITEABLE in riscv's pmap_enter(). Modified: stable/12/sys/riscv/riscv/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/riscv/riscv/pmap.c ============================================================================== --- stable/12/sys/riscv/riscv/pmap.c Sun Oct 13 15:42:41 2019 (r353474) +++ stable/12/sys/riscv/riscv/pmap.c Sun Oct 13 15:54:22 2019 (r353475) @@ -2830,7 +2830,9 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v if ((new_l3 & PTE_SW_MANAGED) == 0) free_pv_entry(pmap, pv); if ((om->aflags & PGA_WRITEABLE) != 0 && - TAILQ_EMPTY(&om->md.pv_list)) + TAILQ_EMPTY(&om->md.pv_list) && + ((om->flags & PG_FICTITIOUS) != 0 || + TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) vm_page_aflag_clear(om, PGA_WRITEABLE); } pmap_invalidate_page(pmap, va); From owner-svn-src-all@freebsd.org Sun Oct 13 15:57:09 2019 Return-Path: Delivered-To: svn-src-all@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 E737F133D01; Sun, 13 Oct 2019 15:57:09 +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 46rmXj5sYZz4FJH; Sun, 13 Oct 2019 15:57:09 +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 ADCE81F2AB; Sun, 13 Oct 2019 15:57:09 +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 x9DFv9B9064847; Sun, 13 Oct 2019 15:57:09 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9DFv9WO064846; Sun, 13 Oct 2019 15:57:09 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910131557.x9DFv9WO064846@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 13 Oct 2019 15:57:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353476 - stable/12/contrib/elftoolchain/nm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/contrib/elftoolchain/nm X-SVN-Commit-Revision: 353476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 15:57:10 -0000 Author: markj Date: Sun Oct 13 15:57:09 2019 New Revision: 353476 URL: https://svnweb.freebsd.org/changeset/base/353476 Log: MFC r352908: nm: Adjust argc and argv in get_opt(). Modified: stable/12/contrib/elftoolchain/nm/nm.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/elftoolchain/nm/nm.c ============================================================================== --- stable/12/contrib/elftoolchain/nm/nm.c Sun Oct 13 15:54:22 2019 (r353475) +++ stable/12/contrib/elftoolchain/nm/nm.c Sun Oct 13 15:57:09 2019 (r353476) @@ -179,7 +179,7 @@ static int cmp_size(const void *, const void *); static int cmp_value(const void *, const void *); static void filter_dest(void); static int filter_insert(fn_filter); -static void get_opt(int, char **); +static void get_opt(int *, char ***); static int get_sym(Elf *, struct sym_head *, int, size_t, size_t, const char *, const char **, int); static const char * get_sym_name(Elf *, const GElf_Sym *, size_t, @@ -441,18 +441,18 @@ parse_demangle_option(const char *opt) } static void -get_opt(int argc, char **argv) +get_opt(int *argc, char ***argv) { int ch; bool is_posix, oflag; - if (argc <= 0 || argv == NULL) + if (*argc <= 0 || *argv == NULL) return; oflag = is_posix = false; nm_opts.t = RADIX_HEX; - while ((ch = getopt_long(argc, argv, "ABCDF:PSVaefghlnoprst:uvx", - nm_longopts, NULL)) != -1) { + while ((ch = getopt_long(*argc, *argv, "ABCDF:PSVaefghlnoprst:uvx", + nm_longopts, NULL)) != -1) { switch (ch) { case 'A': nm_opts.print_name = PRINT_NAME_FULL; @@ -573,6 +573,8 @@ get_opt(int argc, char **argv) usage(1); } } + *argc -= optind; + *argv += optind; /* * In POSIX mode, the '-o' option controls the output radix. @@ -2115,8 +2117,8 @@ main(int argc, char **argv) int rtn; global_init(); - get_opt(argc, argv); - rtn = read_files(argc - optind, argv + optind); + get_opt(&argc, &argv); + rtn = read_files(argc, argv); global_dest(); exit(rtn); From owner-svn-src-all@freebsd.org Sun Oct 13 16:14:05 2019 Return-Path: Delivered-To: svn-src-all@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 6CC70134FD0; Sun, 13 Oct 2019 16:14:05 +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 46rmwF2H1zz4Gny; Sun, 13 Oct 2019 16:14:05 +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 3234F1F636; Sun, 13 Oct 2019 16:14:05 +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 x9DGE5Hq077008; Sun, 13 Oct 2019 16:14:05 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9DGE4ZB077005; Sun, 13 Oct 2019 16:14:04 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910131614.x9DGE4ZB077005@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 13 Oct 2019 16:14:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353477 - in head/sys: conf netinet X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: conf netinet X-SVN-Commit-Revision: 353477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 16:14:05 -0000 Author: markj Date: Sun Oct 13 16:14:04 2019 New Revision: 353477 URL: https://svnweb.freebsd.org/changeset/base/353477 Log: Move SCTP DTrace probe definitions into a .c file. Previously they were defined in a header which was included exactly once. Change this to follow the usual practice of putting definitions in C files. No functional change intended. Discussed with: tuexen MFC after: 1 week Sponsored by: The FreeBSD Foundation Added: head/sys/netinet/sctp_kdtrace.c - copied, changed from r353476, head/sys/netinet/sctp_dtrace_define.h Deleted: head/sys/netinet/sctp_dtrace_define.h Modified: head/sys/conf/files head/sys/netinet/sctp_pcb.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Oct 13 15:57:09 2019 (r353476) +++ head/sys/conf/files Sun Oct 13 16:14:04 2019 (r353477) @@ -4258,6 +4258,7 @@ netinet/sctp_cc_functions.c optional inet sctp | inet6 netinet/sctp_crc32.c optional inet | inet6 netinet/sctp_indata.c optional inet sctp | inet6 sctp netinet/sctp_input.c optional inet sctp | inet6 sctp +netinet/sctp_kdtrace.c optional inet sctp | inet6 sctp netinet/sctp_output.c optional inet sctp | inet6 sctp netinet/sctp_pcb.c optional inet sctp | inet6 sctp netinet/sctp_peeloff.c optional inet sctp | inet6 sctp Copied and modified: head/sys/netinet/sctp_kdtrace.c (from r353476, head/sys/netinet/sctp_dtrace_define.h) ============================================================================== --- head/sys/netinet/sctp_dtrace_define.h Sun Oct 13 15:57:09 2019 (r353476, copy source) +++ head/sys/netinet/sctp_kdtrace.c Sun Oct 13 16:14:04 2019 (r353477) @@ -34,9 +34,7 @@ #include __FBSDID("$FreeBSD$"); -#ifndef _NETINET_SCTP_DTRACE_DEFINE_H_ -#define _NETINET_SCTP_DTRACE_DEFINE_H_ - +#include #include #include @@ -173,5 +171,3 @@ SDT_PROBE_DEFINE4(sctp, flightsize, assoc, val, * order. */ "int", /* The up/down amount */ "int"); /* The new value of the cwnd */ - -#endif Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sun Oct 13 15:57:09 2019 (r353476) +++ head/sys/netinet/sctp_pcb.c Sun Oct 13 16:14:04 2019 (r353477) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #if defined(INET) || defined(INET6) #include #endif From owner-svn-src-all@freebsd.org Sun Oct 13 16:21:48 2019 Return-Path: Delivered-To: svn-src-all@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 C13741359C9; Sun, 13 Oct 2019 16:21:48 +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 46rn584mcKz4HN7; Sun, 13 Oct 2019 16:21:48 +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 852CF1F7EB; Sun, 13 Oct 2019 16:21:48 +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 x9DGLmXA081990; Sun, 13 Oct 2019 16:21:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9DGLm9X081989; Sun, 13 Oct 2019 16:21:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910131621.x9DGLm9X081989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 13 Oct 2019 16:21:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353478 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 353478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 16:21:48 -0000 Author: markj Date: Sun Oct 13 16:21:48 2019 New Revision: 353478 URL: https://svnweb.freebsd.org/changeset/base/353478 Log: MFC r352829: Fix some problems with the SPARSE_MAPPING option in the kernel linker. Modified: stable/12/sys/kern/link_elf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/link_elf.c ============================================================================== --- stable/12/sys/kern/link_elf.c Sun Oct 13 16:14:04 2019 (r353477) +++ stable/12/sys/kern/link_elf.c Sun Oct 13 16:21:48 2019 (r353478) @@ -40,6 +40,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef SPARSE_MAPPING +#include +#endif #include #include #include @@ -423,7 +426,7 @@ link_elf_init(void* arg) ef->address = 0; #endif #ifdef SPARSE_MAPPING - ef->object = 0; + ef->object = NULL; #endif ef->dynamic = dp; @@ -728,7 +731,7 @@ link_elf_link_preload(linker_class_t cls, ef->modptr = modptr; ef->address = *(caddr_t *)baseptr; #ifdef SPARSE_MAPPING - ef->object = 0; + ef->object = NULL; #endif dp = (vm_offset_t)ef->address + *(vm_offset_t *)dynptr; ef->dynamic = (Elf_Dyn *)dp; @@ -782,7 +785,7 @@ link_elf_load_file(linker_class_t cls, const char* fil struct nameidata nd; struct thread* td = curthread; /* XXX */ Elf_Ehdr *hdr; - caddr_t firstpage; + caddr_t firstpage, segbase; int nbytes, i; Elf_Phdr *phdr; Elf_Phdr *phlimit; @@ -949,47 +952,61 @@ link_elf_load_file(linker_class_t cls, const char* fil error = ENOMEM; goto out; } - ef->address = (caddr_t) vm_map_min(kernel_map); +#ifdef __amd64__ + mapbase = (caddr_t)KERNBASE; +#else + mapbase = (caddr_t)vm_map_min(kernel_map); +#endif + /* + * Mapping protections are downgraded after relocation processing. + */ error = vm_map_find(kernel_map, ef->object, 0, - (vm_offset_t *) &ef->address, mapsize, 0, VMFS_OPTIMAL_SPACE, + (vm_offset_t *)&mapbase, mapsize, 0, VMFS_OPTIMAL_SPACE, VM_PROT_ALL, VM_PROT_ALL, 0); if (error != 0) { vm_object_deallocate(ef->object); - ef->object = 0; + ef->object = NULL; goto out; } #else - ef->address = malloc(mapsize, M_LINKER, M_EXEC | M_WAITOK); + mapbase = malloc(mapsize, M_LINKER, M_EXEC | M_WAITOK); #endif - mapbase = ef->address; + ef->address = mapbase; /* * Read the text and data sections and zero the bss. */ for (i = 0; i < nsegs; i++) { - caddr_t segbase = mapbase + segs[i]->p_vaddr - base_vaddr; - error = vn_rdwr(UIO_READ, nd.ni_vp, - segbase, segs[i]->p_filesz, segs[i]->p_offset, - UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, NOCRED, - &resid, td); - if (error != 0) - goto out; - bzero(segbase + segs[i]->p_filesz, - segs[i]->p_memsz - segs[i]->p_filesz); + segbase = mapbase + segs[i]->p_vaddr - base_vaddr; #ifdef SPARSE_MAPPING /* - * Wire down the pages + * Consecutive segments may have different mapping permissions, + * so be strict and verify that their mappings do not overlap. */ + if (((vm_offset_t)segbase & PAGE_MASK) != 0) { + error = EINVAL; + goto out; + } + error = vm_map_wire(kernel_map, - (vm_offset_t) segbase, - (vm_offset_t) segbase + segs[i]->p_memsz, - VM_MAP_WIRE_SYSTEM|VM_MAP_WIRE_NOHOLES); + (vm_offset_t)segbase, + (vm_offset_t)segbase + round_page(segs[i]->p_memsz), + VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); if (error != KERN_SUCCESS) { error = ENOMEM; goto out; } #endif + + error = vn_rdwr(UIO_READ, nd.ni_vp, + segbase, segs[i]->p_filesz, segs[i]->p_offset, + UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, NOCRED, + &resid, td); + if (error != 0) + goto out; + bzero(segbase + segs[i]->p_filesz, + segs[i]->p_memsz - segs[i]->p_filesz); } #ifdef GPROF @@ -1026,6 +1043,34 @@ link_elf_load_file(linker_class_t cls, const char* fil error = relocate_file(ef); if (error != 0) goto out; + +#ifdef SPARSE_MAPPING + /* + * Downgrade permissions on text segment mappings now that relocation + * processing is complete. Restrict permissions on read-only segments. + */ + for (i = 0; i < nsegs; i++) { + vm_prot_t prot; + + if (segs[i]->p_type != PT_LOAD) + continue; + + prot = VM_PROT_READ; + if ((segs[i]->p_flags & PF_W) != 0) + prot |= VM_PROT_WRITE; + if ((segs[i]->p_flags & PF_X) != 0) + prot |= VM_PROT_EXECUTE; + segbase = mapbase + segs[i]->p_vaddr - base_vaddr; + error = vm_map_protect(kernel_map, + (vm_offset_t)segbase, + (vm_offset_t)segbase + round_page(segs[i]->p_memsz), + prot, FALSE); + if (error != KERN_SUCCESS) { + error = ENOMEM; + goto out; + } + } +#endif /* * Try and load the symbol table if it's present. (you can From owner-svn-src-all@freebsd.org Sun Oct 13 18:03:24 2019 Return-Path: Delivered-To: svn-src-all@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 B9F14138A71; Sun, 13 Oct 2019 18:03:24 +0000 (UTC) (envelope-from samm@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 46rqLN4Wjbz4MVC; Sun, 13 Oct 2019 18:03:24 +0000 (UTC) (envelope-from samm@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 7F79A209E5; Sun, 13 Oct 2019 18:03:24 +0000 (UTC) (envelope-from samm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9DI3OYK041026; Sun, 13 Oct 2019 18:03:24 GMT (envelope-from samm@FreeBSD.org) Received: (from samm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9DI3OgF041024; Sun, 13 Oct 2019 18:03:24 GMT (envelope-from samm@FreeBSD.org) Message-Id: <201910131803.x9DI3OgF041024@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: samm set sender to samm@FreeBSD.org using -f From: Oleksii Samorukov Date: Sun, 13 Oct 2019 18:03:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353479 - in head: share/misc usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: samm X-SVN-Commit-Paths: in head: share/misc usr.bin/calendar/calendars X-SVN-Commit-Revision: 353479 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 18:03:24 -0000 Author: samm (ports committer) Date: Sun Oct 13 18:03:23 2019 New Revision: 353479 URL: https://svnweb.freebsd.org/changeset/base/353479 Log: Add myself (samm) to calendar.freebsd Approved by: araujo (mentor), krion (mentor) Differential Revision: https://reviews.freebsd.org/D21985 Modified: head/share/misc/committers-ports.dot head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Sun Oct 13 16:21:48 2019 (r353478) +++ head/share/misc/committers-ports.dot Sun Oct 13 18:03:23 2019 (r353479) @@ -234,6 +234,7 @@ rodrigo [label="Rodrigo Osorio\nrodrigo@FreeBSD.org\n2 romain [label="Romain Tartiere\nromain@FreeBSD.org\n2010/01/24"] rpaulo [label="Rui Paulo\nrpaulo@FreeBSD.org\n2014/07/15"] sahil [label="Sahil Tandon\nsahil@FreeBSD.org\n2010/04/11"] +samm [label="Alex Samorukov\nsamm@FreeBSD.org\n2019/10/09"] sat [label="Andrew Pantyukhin\nsat@FreeBSD.org\n2006/05/06"] sbruno [label="Sean Bruno\nsbruno@FreeBSD.org\n2014/09/14"] sbz [label="Sofian Brabez\nsbz@FreeBSD.org\n2011/03/14"] @@ -311,6 +312,7 @@ araujo -> jhixson araujo -> lippe araujo -> pclin araujo -> pgollucci +araujo -> samm arved -> markus arved -> stefan @@ -507,6 +509,7 @@ krion -> kbowling krion -> miwi krion -> novel krion -> philip +krion -> samm krion -> sat krion -> sem krion -> sergei Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Sun Oct 13 16:21:48 2019 (r353478) +++ head/usr.bin/calendar/calendars/calendar.freebsd Sun Oct 13 18:03:23 2019 (r353479) @@ -85,6 +85,7 @@ 02/18 Christoph Moench-Tegeder born in Hannover, Niedersachsen, Germany, 1980 02/19 Murray Stokely born in Jacksonville, Florida, United States, 1979 02/20 Anders Nordby born in Oslo, Norway, 1976 +02/21 Alex Samorukov born in Kyiv, Ukraine, 1981 02/21 Alexey Zelkin born in Simferopol, Ukraine, 1978 02/22 Brooks Davis born in Longview, Washington, United States, 1976 02/22 Jake Burkholder born in Maynooth, Ontario, Canada, 1979 From owner-svn-src-all@freebsd.org Sun Oct 13 18:17:10 2019 Return-Path: Delivered-To: svn-src-all@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 60ADB138E4F; Sun, 13 Oct 2019 18:17:10 +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 46rqfG1Vp0z4NCq; Sun, 13 Oct 2019 18:17:10 +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 17CBA20C58; Sun, 13 Oct 2019 18:17:10 +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 x9DIH9Rc047804; Sun, 13 Oct 2019 18:17:09 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9DIH9YQ047799; Sun, 13 Oct 2019 18:17:09 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910131817.x9DIH9YQ047799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 13 Oct 2019 18:17:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353480 - in head/sys: net netinet sys X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head/sys: net netinet sys X-SVN-Commit-Revision: 353480 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 18:17:10 -0000 Author: tuexen Date: Sun Oct 13 18:17:08 2019 New Revision: 353480 URL: https://svnweb.freebsd.org/changeset/base/353480 Log: Use an event handler to notify the SCTP about IP address changes instead of calling an SCTP specific function from the IP code. This is a requirement of supporting SCTP as a kernel loadable module. This patch was developed by markj@, I tweaked a bit the SCTP related code. Submitted by: markj@ MFC after: 3 days Modified: head/sys/net/route.c head/sys/netinet/sctp_bsd_addr.c head/sys/netinet/sctp_bsd_addr.h head/sys/netinet/sctp_usrreq.c head/sys/sys/eventhandler.h Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Sun Oct 13 18:03:23 2019 (r353479) +++ head/sys/net/route.c Sun Oct 13 18:17:08 2019 (r353480) @@ -38,10 +38,9 @@ #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_route.h" -#include "opt_sctp.h" #include "opt_mrouting.h" #include "opt_mpath.h" +#include "opt_route.h" #include #include @@ -90,13 +89,6 @@ #define RT_NUMFIBS 1 #endif -#if defined(INET) || defined(INET6) -#ifdef SCTP -extern void sctp_addr_change(struct ifaddr *ifa, int cmd); -#endif /* SCTP */ -#endif - - /* This is read-only.. */ u_int rt_numfibs = RT_NUMFIBS; SYSCTL_UINT(_net, OID_AUTO, fibs, CTLFLAG_RDTUN, &rt_numfibs, 0, ""); @@ -140,6 +132,8 @@ VNET_DEFINE(int, rttrash); /* routes not in table but VNET_DEFINE_STATIC(uma_zone_t, rtzone); /* Routing table UMA zone. */ #define V_rtzone VNET(rtzone) +EVENTHANDLER_LIST_DEFINE(rt_addrmsg); + static int rtrequest1_fib_change(struct rib_head *, struct rt_addrinfo *, struct rtentry **, u_int); static void rt_setmetrics(const struct rt_addrinfo *, struct rtentry *); @@ -2224,20 +2218,10 @@ rt_addrmsg(int cmd, struct ifaddr *ifa, int fibnum) KASSERT(cmd == RTM_ADD || cmd == RTM_DELETE, ("unexpected cmd %d", cmd)); - KASSERT(fibnum == RT_ALL_FIBS || (fibnum >= 0 && fibnum < rt_numfibs), ("%s: fib out of range 0 <=%d<%d", __func__, fibnum, rt_numfibs)); -#if defined(INET) || defined(INET6) -#ifdef SCTP - /* - * notify the SCTP stack - * this will only get called when an address is added/deleted - * XXX pass the ifaddr struct instead if ifa->ifa_addr... - */ - sctp_addr_change(ifa, cmd); -#endif /* SCTP */ -#endif + EVENTHANDLER_DIRECT_INVOKE(rt_addrmsg, ifa, cmd); return (rtsock_addrmsg(cmd, ifa, fibnum)); } Modified: head/sys/netinet/sctp_bsd_addr.c ============================================================================== --- head/sys/netinet/sctp_bsd_addr.c Sun Oct 13 18:03:23 2019 (r353479) +++ head/sys/netinet/sctp_bsd_addr.c Sun Oct 13 18:17:08 2019 (r353480) @@ -358,6 +358,12 @@ sctp_addr_change(struct ifaddr *ifa, int cmd) } void +sctp_addr_change_event_handler(void *arg __unused, struct ifaddr *ifa, int cmd) +{ + sctp_addr_change(ifa, cmd); +} + +void sctp_add_or_del_interfaces(int (*pred) (struct ifnet *), int add){ struct ifnet *ifn; struct ifaddr *ifa; Modified: head/sys/netinet/sctp_bsd_addr.h ============================================================================== --- head/sys/netinet/sctp_bsd_addr.h Sun Oct 13 18:03:23 2019 (r353479) +++ head/sys/netinet/sctp_bsd_addr.h Sun Oct 13 18:17:08 2019 (r353480) @@ -61,6 +61,8 @@ int sctp_copy_out_packet_log(uint8_t *target, int leng void sctp_addr_change(struct ifaddr *ifa, int cmd); +void sctp_addr_change_event_handler(void *, struct ifaddr *, int); + void sctp_add_or_del_interfaces(int (*pred) (struct ifnet *), int add); #endif Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sun Oct 13 18:03:23 2019 (r353479) +++ head/sys/netinet/sctp_usrreq.c Sun Oct 13 18:17:08 2019 (r353480) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include @@ -89,6 +90,8 @@ sctp_init(void) SCTP_BASE_VAR(packet_log_end) = 0; memset(&SCTP_BASE_VAR(packet_log_buffer), 0, SCTP_PACKET_LOG_SIZE); #endif + EVENTHANDLER_REGISTER(rt_addrmsg, sctp_addr_change_event_handler, + NULL, EVENTHANDLER_PRI_FIRST); } #ifdef VIMAGE Modified: head/sys/sys/eventhandler.h ============================================================================== --- head/sys/sys/eventhandler.h Sun Oct 13 18:03:23 2019 (r353479) +++ head/sys/sys/eventhandler.h Sun Oct 13 18:17:08 2019 (r353480) @@ -312,4 +312,9 @@ typedef void (*device_detach_fn)(void *, device_t, enu EVENTHANDLER_DECLARE(device_attach, device_attach_fn); EVENTHANDLER_DECLARE(device_detach, device_detach_fn); +/* Interface address addition and removal event */ +struct ifaddr; +typedef void (*rt_addrmsg_fn)(void *, struct ifaddr *, int); +EVENTHANDLER_DECLARE(rt_addrmsg, rt_addrmsg_fn); + #endif /* _SYS_EVENTHANDLER_H_ */ From owner-svn-src-all@freebsd.org Sun Oct 13 19:18:22 2019 Return-Path: Delivered-To: svn-src-all@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 56CAE13AC13; Sun, 13 Oct 2019 19:18:22 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 46rs0t1dFpz4QyV; Sun, 13 Oct 2019 19:18:22 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id DFBF8F10; Sun, 13 Oct 2019 19:18:21 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from [10.1.10.14] (unknown [IPv6:2603:3024:1575:0:19b4:b98e:9b8d:854e]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id D415531299; Sun, 13 Oct 2019 21:18:18 +0200 (CEST) From: "Kristof Provost" To: "Gleb Smirnoff" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353467 - head/sys/net Date: Sun, 13 Oct 2019 12:18:42 -0700 X-Mailer: MailMate (2.0BETAr6142) Message-ID: <84E533EF-01FC-445D-8B31-31E52BD9EDDA@FreeBSD.org> In-Reply-To: <201910131515.x9DFF9It040916@repo.freebsd.org> References: <201910131515.x9DFF9It040916@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 19:18:22 -0000 On 13 Oct 2019, at 8:15, Gleb Smirnoff wrote: > Author: glebius > Date: Sun Oct 13 15:15:09 2019 > New Revision: 353467 > URL: https://svnweb.freebsd.org/changeset/base/353467 > > Log: > vlan_config() isn't always called in epoch context. > > Reported by: kp > > Modified: > head/sys/net/if_vlan.c > Thanks. I still see another panic now: panic: Assertion in_epoch(net_epoch_preempt) failed at /usr/src/sys/net/if.c:3624 cpuid = 6 time = 1570986933 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0061ea1f30 vpanic() at vpanic+0x17e/frame 0xfffffe0061ea1f90 panic() at panic+0x43/frame 0xfffffe0061ea1ff0 if_delmulti() at if_delmulti+0x154/frame 0xfffffe0061ea2020 vlan_setmulti() at vlan_setmulti+0xa7/frame 0xfffffe0061ea2070 vlan_ioctl() at vlan_ioctl+0x82/frame 0xfffffe0061ea20d0 if_addmulti() at if_addmulti+0x2ae/frame 0xfffffe0061ea2170 in6_joingroup_locked() at in6_joingroup_locked+0x25c/frame 0xfffffe0061ea2230 in6_joingroup() at in6_joingroup+0x44/frame 0xfffffe0061ea2260 in6_update_ifa() at in6_update_ifa+0x11c9/frame 0xfffffe0061ea2410 in6_ifattach() at in6_ifattach+0x5b5/frame 0xfffffe0061ea2590 in6_if_up() at in6_if_up+0x7e/frame 0xfffffe0061ea25d0 if_up() at if_up+0x69/frame 0xfffffe0061ea2600 ifhwioctl() at ifhwioctl+0xc0d/frame 0xfffffe0061ea2680 ifioctl() at ifioctl+0x3ba/frame 0xfffffe0061ea2750 kern_ioctl() at kern_ioctl+0x295/frame 0xfffffe0061ea27b0 sys_ioctl() at sys_ioctl+0x15c/frame 0xfffffe0061ea2880 amd64_syscall() at amd64_syscall+0x2b5/frame 0xfffffe0061ea29b0 fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe0061ea29b0 --- syscall (54, FreeBSD ELF64, sys_ioctl), rip = 0x80047dc2a, rsp = 0x7fffffffe1d8, rbp = 0x7fffffffe230 --- Best regards, Kristof From owner-svn-src-all@freebsd.org Sun Oct 13 19:33:01 2019 Return-Path: Delivered-To: svn-src-all@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 6F5FC13BD97; Sun, 13 Oct 2019 19:33:01 +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 46rsKn2N7bz4Rmj; Sun, 13 Oct 2019 19:33:01 +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 3574A21BA9; Sun, 13 Oct 2019 19:33:01 +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 x9DJX0qQ094344; Sun, 13 Oct 2019 19:33:00 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9DJX0cv094343; Sun, 13 Oct 2019 19:33:00 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201910131933.x9DJX0cv094343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 13 Oct 2019 19:33:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353481 - 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: 353481 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 19:33:01 -0000 Author: jhibbits Date: Sun Oct 13 19:33:00 2019 New Revision: 353481 URL: https://svnweb.freebsd.org/changeset/base/353481 Log: powerpc/pmap: Tighten condition for removing tracked pages in Book-E pmap There are cases where there's no vm_page_t structure for a given physical address, such as the CCSR. In this case, trying to obtain the md.page_tracked struct member would lead to a NULL dereference, and panic. Tighten this up by checking for kernel_pmap AND that the page structure actually exists before dereferencing. The flag can only be set when it's tracked in the kernel pmap anyway. MFC after: 3 weeks Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Sun Oct 13 18:17:08 2019 (r353480) +++ head/sys/powerpc/booke/pmap.c Sun Oct 13 19:33:00 2019 (r353481) @@ -1177,7 +1177,7 @@ pte_remove(mmu_t mmu, pmap_t pmap, vm_offset_t va, u_i /* Remove pv_entry from pv_list. */ pv_remove(pmap, va, m); - } else if (m->md.pv_tracked) { + } else if (pmap == kernel_pmap && m && m->md.pv_tracked) { pv_remove(pmap, va, m); if (TAILQ_EMPTY(&m->md.pv_list)) m->md.pv_tracked = false; @@ -1373,7 +1373,7 @@ pte_remove(mmu_t mmu, pmap_t pmap, vm_offset_t va, uin vm_page_aflag_set(m, PGA_REFERENCED); pv_remove(pmap, va, m); - } else if (m->md.pv_tracked) { + } else if (pmap == kernel_pmap && m && m->md.pv_tracked) { /* * Always pv_insert()/pv_remove() on MPC85XX, in case DPAA is * used. This is needed by the NCSW support code for fast From owner-svn-src-all@freebsd.org Sun Oct 13 19:58:38 2019 Return-Path: Delivered-To: svn-src-all@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 785C813D1C5; Sun, 13 Oct 2019 19:58:38 +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 46rsvL2dHWz4TYT; Sun, 13 Oct 2019 19:58:38 +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 3D9E221F7D; Sun, 13 Oct 2019 19:58:38 +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 x9DJwcGp006775; Sun, 13 Oct 2019 19:58:38 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9DJwchV006774; Sun, 13 Oct 2019 19:58:38 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910131958.x9DJwchV006774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 13 Oct 2019 19:58:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353482 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353482 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 19:58:38 -0000 Author: tuexen Date: Sun Oct 13 19:58:37 2019 New Revision: 353482 URL: https://svnweb.freebsd.org/changeset/base/353482 Log: Add missing include which breaks builds without VIMAGE. The bug was introduced by me in r353480. Reported by: Michael Butler MFC after: 3 days Modified: head/sys/net/route.c Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Sun Oct 13 19:33:00 2019 (r353481) +++ head/sys/net/route.c Sun Oct 13 19:58:37 2019 (r353482) @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include From owner-svn-src-all@freebsd.org Sun Oct 13 22:26:55 2019 Return-Path: Delivered-To: svn-src-all@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 F3C0AB8F7E; Sun, 13 Oct 2019 22:26:55 +0000 (UTC) (envelope-from mmacy@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 46rxBR67djz4dgF; Sun, 13 Oct 2019 22:26:55 +0000 (UTC) (envelope-from mmacy@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 B241B23B79; Sun, 13 Oct 2019 22:26:55 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9DMQt6n095051; Sun, 13 Oct 2019 22:26:55 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9DMQta7095050; Sun, 13 Oct 2019 22:26:55 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201910132226.x9DMQta7095050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Sun, 13 Oct 2019 22:26:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353483 - head/sys/dev/hwpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/dev/hwpmc X-SVN-Commit-Revision: 353483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 22:26:56 -0000 Author: mmacy Date: Sun Oct 13 22:26:55 2019 New Revision: 353483 URL: https://svnweb.freebsd.org/changeset/base/353483 Log: Fix sample check in hwpmc Don't drop samples with callchain pending Tested by: mjg@ Submitted by: Rajeeb Barman at amd.com MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D17011 Modified: head/sys/dev/hwpmc/hwpmc_mod.c Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Sun Oct 13 19:58:37 2019 (r353482) +++ head/sys/dev/hwpmc/hwpmc_mod.c Sun Oct 13 22:26:55 2019 (r353483) @@ -4828,7 +4828,7 @@ pmc_capture_user_callchain(int cpu, int ring, struct t nfree++; #endif if (ps->ps_td != td || - ps->ps_nsamples == PMC_USER_CALLCHAIN_PENDING || + ps->ps_nsamples != PMC_USER_CALLCHAIN_PENDING || ps->ps_pmc->pm_state != PMC_STATE_RUNNING) continue; From owner-svn-src-all@freebsd.org Mon Oct 14 04:10:01 2019 Return-Path: Delivered-To: svn-src-all@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 46207BF1B8; Mon, 14 Oct 2019 04:10: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 46s4pK152Tz3PfR; Mon, 14 Oct 2019 04:10: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 096BC277C4; Mon, 14 Oct 2019 04:10: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 x9E4A0nu094670; Mon, 14 Oct 2019 04:10:00 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9E4A0pp094669; Mon, 14 Oct 2019 04:10:00 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910140410.x9E4A0pp094669@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 04:10:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353484 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 353484 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 04:10:01 -0000 Author: glebius Date: Mon Oct 14 04:10:00 2019 New Revision: 353484 URL: https://svnweb.freebsd.org/changeset/base/353484 Log: Revert r353313. It is not needed with r353357 and is actually incorrect. Modified: head/sys/netinet/in_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Sun Oct 13 22:26:55 2019 (r353483) +++ head/sys/netinet/in_mcast.c Mon Oct 14 04:10:00 2019 (r353484) @@ -2193,14 +2193,12 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt * Begin state merge transaction at IGMP layer. */ if (is_new) { - struct epoch_tracker et; - in_pcbref(inp); INP_WUNLOCK(inp); - NET_EPOCH_ENTER(et); + error = in_joingroup_locked(ifp, &gsa->sin.sin_addr, imf, &imf->imf_inm); - NET_EPOCH_EXIT(et); + INP_WLOCK(inp); if (in_pcbrele_wlocked(inp)) { error = ENXIO; From owner-svn-src-all@freebsd.org Mon Oct 14 04:17:57 2019 Return-Path: Delivered-To: svn-src-all@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 345CBBF62F; Mon, 14 Oct 2019 04:17:57 +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 46s4zT0ZYfz3Q8v; Mon, 14 Oct 2019 04:17:57 +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 EC0C32797C; Mon, 14 Oct 2019 04:17:56 +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 x9E4HuuR000264; Mon, 14 Oct 2019 04:17:56 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9E4HuA2000261; Mon, 14 Oct 2019 04:17:56 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910140417.x9E4HuA2000261@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 04:17:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353485 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 353485 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 04:17:57 -0000 Author: glebius Date: Mon Oct 14 04:17:56 2019 New Revision: 353485 URL: https://svnweb.freebsd.org/changeset/base/353485 Log: Since EPOCH_TRACE had been moved to opt_global.h, we don't need to waste extra space in struct thread. Modified: head/sys/kern/kern_thread.c head/sys/kern/subr_epoch.c head/sys/sys/proc.h Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Mon Oct 14 04:10:00 2019 (r353484) +++ head/sys/kern/kern_thread.c Mon Oct 14 04:17:56 2019 (r353485) @@ -668,7 +668,9 @@ thread_link(struct thread *td, struct proc *p) LIST_INIT(&td->td_contested); LIST_INIT(&td->td_lprof[0]); LIST_INIT(&td->td_lprof[1]); +#ifdef EPOCH_TRACE SLIST_INIT(&td->td_epochs); +#endif sigqueue_init(&td->td_sigqueue, p); callout_init(&td->td_slpcallout, 1); TAILQ_INSERT_TAIL(&p->p_threads, td, td_plist); @@ -685,7 +687,9 @@ thread_unlink(struct thread *td) struct proc *p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); +#ifdef EPOCH_TRACE MPASS(SLIST_EMPTY(&td->td_epochs)); +#endif TAILQ_REMOVE(&p->p_threads, td, td_plist); p->p_numthreads--; Modified: head/sys/kern/subr_epoch.c ============================================================================== --- head/sys/kern/subr_epoch.c Mon Oct 14 04:10:00 2019 (r353484) +++ head/sys/kern/subr_epoch.c Mon Oct 14 04:17:56 2019 (r353485) @@ -258,7 +258,9 @@ epoch_init(void *arg __unused) DPCPU_ID_PTR(cpu, epoch_cb_task), NULL, cpu, NULL, NULL, "epoch call task"); } +#ifdef EPOCH_TRACE SLIST_INIT(&thread0.td_epochs); +#endif inited = 1; global_epoch = epoch_alloc("Global", 0); global_epoch_preempt = epoch_alloc("Global preemptible", EPOCH_PREEMPT); Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Mon Oct 14 04:10:00 2019 (r353484) +++ head/sys/sys/proc.h Mon Oct 14 04:17:56 2019 (r353485) @@ -367,7 +367,9 @@ struct thread { void *td_lkpi_task; /* LinuxKPI task struct pointer */ struct epoch_tracker *td_et; /* (k) compat KPI spare tracker */ int td_pmcpend; +#ifdef EPOCH_TRACE SLIST_HEAD(, epoch_tracker) td_epochs; +#endif }; struct thread0_storage { From owner-svn-src-all@freebsd.org Mon Oct 14 05:26:43 2019 Return-Path: Delivered-To: svn-src-all@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 AF2A6F0800; Mon, 14 Oct 2019 05:26:43 +0000 (UTC) (envelope-from lstewart@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 46s6Vq47pyz3xkn; Mon, 14 Oct 2019 05:26:43 +0000 (UTC) (envelope-from lstewart@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 6CC9261C; Mon, 14 Oct 2019 05:26:43 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9E5QhMj041345; Mon, 14 Oct 2019 05:26:43 GMT (envelope-from lstewart@FreeBSD.org) Received: (from lstewart@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9E5QhMu041344; Mon, 14 Oct 2019 05:26:43 GMT (envelope-from lstewart@FreeBSD.org) Message-Id: <201910140526.x9E5QhMu041344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lstewart set sender to lstewart@FreeBSD.org using -f From: Lawrence Stewart Date: Mon, 14 Oct 2019 05:26:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353486 - head/share/man/man3 X-SVN-Group: head X-SVN-Commit-Author: lstewart X-SVN-Commit-Paths: head/share/man/man3 X-SVN-Commit-Revision: 353486 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 05:26:43 -0000 Author: lstewart Date: Mon Oct 14 05:26:42 2019 New Revision: 353486 URL: https://svnweb.freebsd.org/changeset/base/353486 Log: Fix some "RB_" -> "ARB_" copy and paste nits for text sourced from tree(3). Modified: head/share/man/man3/arb.3 Modified: head/share/man/man3/arb.3 ============================================================================== --- head/share/man/man3/arb.3 Mon Oct 14 04:17:56 2019 (r353485) +++ head/share/man/man3/arb.3 Mon Oct 14 05:26:42 2019 (r353486) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 2, 2019 +.Dd October 14, 2019 .Dt ARB 3 .Os .Sh NAME @@ -399,7 +399,7 @@ macros can be used to find a particular element in the .Bd -literal -offset indent struct TYPE find, *res; find.key = 30; -res = RB_FIND(NAME, head, &find); +res = ARB_FIND(NAME, head, &find); .Ed .Pp The @@ -411,7 +411,7 @@ and .Fn ARB_PREV macros can be used to traverse the tree: .Pp -.Dl "for (np = RB_MIN(NAME, &head); np != NULL; np = RB_NEXT(NAME, &head, np))" +.Dl "for (np = ARB_MIN(NAME, &head); np != NULL; np = ARB_NEXT(NAME, &head, np))" .Pp Or, for simplicity, one can use the .Fn ARB_FOREACH @@ -419,7 +419,7 @@ or .Fn ARB_FOREACH_REVERSE macro: .Bd -ragged -offset indent -.Fn RB_FOREACH np NAME head +.Fn ARB_FOREACH np NAME head .Ed .Pp The macros From owner-svn-src-all@freebsd.org Mon Oct 14 09:29:57 2019 Return-Path: Delivered-To: svn-src-all@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 717DAF51F0; Mon, 14 Oct 2019 09:29:57 +0000 (UTC) (envelope-from andrew@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 46sCvT2RjSz48d1; Mon, 14 Oct 2019 09:29:57 +0000 (UTC) (envelope-from andrew@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 3749E3090; Mon, 14 Oct 2019 09:29:57 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9E9Tvhh081652; Mon, 14 Oct 2019 09:29:57 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9E9Tv5G081651; Mon, 14 Oct 2019 09:29:57 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910140929.x9E9Tv5G081651@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 14 Oct 2019 09:29:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353487 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 353487 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 09:29:57 -0000 Author: andrew Date: Mon Oct 14 09:29:56 2019 New Revision: 353487 URL: https://svnweb.freebsd.org/changeset/base/353487 Log: Sort the id_aa64*_fields arrays to be in alphanumerical order. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/identcpu.c Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Mon Oct 14 05:26:42 2019 (r353486) +++ head/sys/arm64/arm64/identcpu.c Mon Oct 14 09:29:56 2019 (r353487) @@ -219,6 +219,17 @@ struct mrs_field { #define MRS_FIELD_END { .type = MRS_INVALID, } +static struct mrs_field id_aa64dfr0_fields[] = { + MRS_FIELD(false, MRS_EXACT, ID_AA64DFR0_PMSVer_SHIFT), + MRS_FIELD(false, MRS_EXACT, ID_AA64DFR0_CTX_CMPs_SHIFT), + MRS_FIELD(false, MRS_EXACT, ID_AA64DFR0_WRPs_SHIFT), + MRS_FIELD(false, MRS_EXACT, ID_AA64DFR0_BRPs_SHIFT), + MRS_FIELD(false, MRS_EXACT, ID_AA64DFR0_PMUVer_SHIFT), + MRS_FIELD(false, MRS_EXACT, ID_AA64DFR0_TraceVer_SHIFT), + MRS_FIELD(false, MRS_EXACT_VAL(0x6), ID_AA64DFR0_DebugVer_SHIFT), + MRS_FIELD_END, +}; + static struct mrs_field id_aa64isar0_fields[] = { MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR0_DP_SHIFT), MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR0_SM4_SHIFT), @@ -255,17 +266,6 @@ static struct mrs_field id_aa64pfr0_fields[] = { MRS_FIELD(false, MRS_EXACT, ID_AA64PFR0_EL2_SHIFT), MRS_FIELD(false, MRS_LOWER, ID_AA64PFR0_EL1_SHIFT), MRS_FIELD(false, MRS_LOWER, ID_AA64PFR0_EL0_SHIFT), - MRS_FIELD_END, -}; - -static struct mrs_field id_aa64dfr0_fields[] = { - MRS_FIELD(false, MRS_EXACT, ID_AA64DFR0_PMSVer_SHIFT), - MRS_FIELD(false, MRS_EXACT, ID_AA64DFR0_CTX_CMPs_SHIFT), - MRS_FIELD(false, MRS_EXACT, ID_AA64DFR0_WRPs_SHIFT), - MRS_FIELD(false, MRS_EXACT, ID_AA64DFR0_BRPs_SHIFT), - MRS_FIELD(false, MRS_EXACT, ID_AA64DFR0_PMUVer_SHIFT), - MRS_FIELD(false, MRS_EXACT, ID_AA64DFR0_TraceVer_SHIFT), - MRS_FIELD(false, MRS_EXACT_VAL(0x6), ID_AA64DFR0_DebugVer_SHIFT), MRS_FIELD_END, }; From owner-svn-src-all@freebsd.org Mon Oct 14 10:04:45 2019 Return-Path: Delivered-To: svn-src-all@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 8B37BF5E1D; Mon, 14 Oct 2019 10:04:45 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (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 46sDgc4mcCz4BVq; Mon, 14 Oct 2019 10:04:44 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id A6BDF2600D5; Mon, 14 Oct 2019 12:04:35 +0200 (CEST) Subject: Re: svn commit: r353292 - in head/sys: contrib/ipfilter/netinet dev/firewire dev/iicbus dev/usb/net kern net netgraph netinet netinet6 netipsec netpfil/ipfw netpfil/pf ofed/drivers/infiniband/ulp/ipoib To: Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910072240.x97Me60x065650@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <4e5b6b75-b230-8aa0-61db-077bfbf7cf1f@selasky.org> Date: Mon, 14 Oct 2019 12:03:42 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: <201910072240.x97Me60x065650@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46sDgc4mcCz4BVq X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 2a01:4f8:c17:6c4b::2 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-4.91 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(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)[+a:mail.turbocat.net]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; IP_SCORE(-2.61)[ip: (-9.15), ipnet: 2a01:4f8::/29(-2.09), asn: 24940(-1.81), country: DE(-0.01)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 10:04:45 -0000 On 2019-10-08 00:40, Gleb Smirnoff wrote: > Author: glebius > Date: Mon Oct 7 22:40:05 2019 > New Revision: 353292 > URL: https://svnweb.freebsd.org/changeset/base/353292 > > Log: > Widen NET_EPOCH coverage. > > When epoch(9) was introduced to network stack, it was basically > dropped in place of existing locking, which was mutexes and > rwlocks. For the sake of performance mutex covered areas were > as small as possible, so became epoch covered areas. > Hi Gleb, There are several callers of arpresolve() outside sys/net, which now require EPOCH(), which appears missing in your patch: Same for nd6_resolve() I believe. --HPS > (kgdb) #0 __curthread () at /usr/src/sys/amd64/include/pcpu_aux.h:55 > #1 doadump (textdump=0) at /usr/src/sys/kern/kern_shutdown.c:392 > #2 0xffffffff804948fa in db_dump (dummy=, > dummy2=, dummy3=, dummy4=) > at /usr/src/sys/ddb/db_command.c:575 > #3 0xffffffff804946bc in db_command (last_cmdp=, > cmd_table=, dopager=1) at /usr/src/sys/ddb/db_command.c:482 > #4 0xffffffff8049442d in db_command_loop () > at /usr/src/sys/ddb/db_command.c:535 > #5 0xffffffff80497658 in db_trap (type=, code=) > at /usr/src/sys/ddb/db_main.c:252 > #6 0xffffffff80c09e27 in kdb_trap (type=3, code=0, tf=) > at /usr/src/sys/kern/subr_kdb.c:692 > #7 0xffffffff8102de77 in trap (frame=0xfffffe00600dfbe0) > at /usr/src/sys/amd64/amd64/trap.c:585 > #8 > #9 kdb_enter (why=0xffffffff811d7eaa "panic", msg=) > at /usr/src/sys/kern/subr_kdb.c:479 > #10 0xffffffff80bbe96a in vpanic (fmt=, ap=) > at /usr/src/sys/kern/kern_shutdown.c:897 > #11 0xffffffff80bbe703 in panic ( > fmt=0xffffffff81c85638 "G\320\031\201\377\377\377\377") > at /usr/src/sys/kern/kern_shutdown.c:835 > #12 0xffffffff80d4484f in arpresolve (ifp=0xfffff8000496b000, is_gw=0, m=0x0, > dst=0xfffffe00600dfe68, desten=0xfffffe00600dfe50 "", pflags=0x0, plle=0x0) > at /usr/src/sys/netinet/if_ether.c:628 > #13 0xffffffff82408243 in addr4_resolve (src_in=0xfffff80007ef5210, > dst_in=0xfffff80007ef5290, addr=, edst=, > ifpp=) > at /usr/src/sys/ofed/drivers/infiniband/core/ib_addr.c:401 > #14 addr_resolve (src_in=0xfffff80007ef5210, dst_in=0xfffff80007ef5290, > addr=0xfffff80108f20520) > at /usr/src/sys/ofed/drivers/infiniband/core/ib_addr.c:688 > #15 0xffffffff82407872 in rdma_resolve_ip ( > client=0xffffffff82456450 , src_addr=, > dst_addr=0xfffffe00600e0054, addr=0xfffff80108f20520, timeout_ms=2000, > callback=0xffffffff82416b40 , context=0xfffff80108f20400) > at /usr/src/sys/ofed/drivers/infiniband/core/ib_addr.c:789 > #16 0xffffffff82416352 in rdma_resolve_addr (id=0xfffff80108f20400, > src_addr=, dst_addr=0xfffffe00600e0054, timeout_ms=2000) > at /usr/src/sys/ofed/drivers/infiniband/core/ib_cma.c:3039 > #17 0xffffffff8243786b in ucma_resolve_ip (linux_file=0xfffff80135c08400, > inbuf=, in_len=, out_len=) > at /usr/src/sys/ofed/drivers/infiniband/core/ib_ucma.c:694 > #18 0xffffffff82436ee4 in ucma_write (filp=, > buf=, len=72, pos=) > at /usr/src/sys/ofed/drivers/infiniband/core/ib_ucma.c:1625 > #19 0xffffffff823a1ad3 in linux_file_write (file=0xfffff8015403c0a0, > uio=0xfffffe00600e01c0, active_cred=, > flags=, td=) > at /usr/src/sys/compat/linuxkpi/common/src/linux_compat.c:1445 > #20 0xffffffff80c2f511 in fo_write (fp=0xfffff8015403c0a0, > uio=0xfffffe00600e01c0, active_cred=0xfffffe00600dfba0, flags=1999, > td=0xfffff8002e4cf000) at /usr/src/sys/sys/file.h:324 > #21 dofilewrite (td=0xfffff8002e4cf000, fd=7, fp=0xfffff8015403c0a0, > auio=0xfffffe00600e01c0, offset=, flags=) > at /usr/src/sys/kern/sys_generic.c:564 > #22 0xffffffff80c2f149 in kern_writev (td=0xfffff8002e4cf000, fd=7, > auio=0xfffffe00600e01c0) at /usr/src/sys/kern/sys_generic.c:491 > #23 0xffffffff80c2f0f3 in sys_write (td=0xffffffff81c85638 , > uap=) at /usr/src/sys/kern/sys_generic.c:406 > #24 0xffffffff8102ee45 in syscallenter (td=0xfffff8002e4cf000) > at /usr/src/sys/amd64/amd64/../../kern/subr_syscall.c:144 > #25 amd64_syscall (td=0xfffff8002e4cf000, traced=0) > at /usr/src/sys/amd64/amd64/trap.c:1162 From owner-svn-src-all@freebsd.org Mon Oct 14 10:25:03 2019 Return-Path: Delivered-To: svn-src-all@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 E6A66F64E6; Mon, 14 Oct 2019 10:25:03 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (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 46sF730PhPz4CYH; Mon, 14 Oct 2019 10:25:02 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 6A9B7262041; Mon, 14 Oct 2019 12:25:00 +0200 (CEST) Subject: Re: svn commit: r353292 - in head/sys: contrib/ipfilter/netinet dev/firewire dev/iicbus dev/usb/net kern net netgraph netinet netinet6 netipsec netpfil/ipfw netpfil/pf ofed/drivers/infiniband/ulp/ipoib From: Hans Petter Selasky To: Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910072240.x97Me60x065650@repo.freebsd.org> <4e5b6b75-b230-8aa0-61db-077bfbf7cf1f@selasky.org> Message-ID: Date: Mon, 14 Oct 2019 12:24:03 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: <4e5b6b75-b230-8aa0-61db-077bfbf7cf1f@selasky.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 46sF730PhPz4CYH X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 2a01:4f8:c17:6c4b::2 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-4.91 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(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)[+a:mail.turbocat.net:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; IP_SCORE(-2.61)[ip: (-9.15), ipnet: 2a01:4f8::/29(-2.09), asn: 24940(-1.81), country: DE(-0.01)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 10:25:04 -0000 On 2019-10-14 12:03, Hans Petter Selasky wrote: > On 2019-10-08 00:40, Gleb Smirnoff wrote: >> Author: glebius >> Date: Mon Oct  7 22:40:05 2019 >> New Revision: 353292 >> URL: https://svnweb.freebsd.org/changeset/base/353292 >> >> Log: >>    Widen NET_EPOCH coverage. >>    When epoch(9) was introduced to network stack, it was basically >>    dropped in place of existing locking, which was mutexes and >>    rwlocks. For the sake of performance mutex covered areas were >>    as small as possible, so became epoch covered areas. > > Hi Gleb, > > There are several callers of arpresolve() outside sys/net, which now > require EPOCH(), which appears missing in your patch: > > Same for nd6_resolve() I believe. > > --HPS > >> (kgdb) #0  __curthread () at /usr/src/sys/amd64/include/pcpu_aux.h:55 >> #1  doadump (textdump=0) at /usr/src/sys/kern/kern_shutdown.c:392 >> #2  0xffffffff804948fa in db_dump (dummy=, >> dummy2=, dummy3=, dummy4=) >>     at /usr/src/sys/ddb/db_command.c:575 >> #3  0xffffffff804946bc in db_command (last_cmdp=, >> cmd_table=, dopager=1) at >> /usr/src/sys/ddb/db_command.c:482 >> #4  0xffffffff8049442d in db_command_loop () >>     at /usr/src/sys/ddb/db_command.c:535 >> #5  0xffffffff80497658 in db_trap (type=, >> code=) >>     at /usr/src/sys/ddb/db_main.c:252 >> #6  0xffffffff80c09e27 in kdb_trap (type=3, code=0, tf=) >>     at /usr/src/sys/kern/subr_kdb.c:692 >> #7  0xffffffff8102de77 in trap (frame=0xfffffe00600dfbe0) >>     at /usr/src/sys/amd64/amd64/trap.c:585 >> #8  >> #9  kdb_enter (why=0xffffffff811d7eaa "panic", msg=) >>     at /usr/src/sys/kern/subr_kdb.c:479 >> #10 0xffffffff80bbe96a in vpanic (fmt=, ap=> out>) >>     at /usr/src/sys/kern/kern_shutdown.c:897 >> #11 0xffffffff80bbe703 in panic ( >>     fmt=0xffffffff81c85638 "G\320\031\201\377\377\377\377") >>     at /usr/src/sys/kern/kern_shutdown.c:835 >> #12 0xffffffff80d4484f in arpresolve (ifp=0xfffff8000496b000, is_gw=0, >> m=0x0,     dst=0xfffffe00600dfe68, desten=0xfffffe00600dfe50 "", >> pflags=0x0, plle=0x0) >>     at /usr/src/sys/netinet/if_ether.c:628 >> #13 0xffffffff82408243 in addr4_resolve (src_in=0xfffff80007ef5210, >>     dst_in=0xfffff80007ef5290, addr=, edst=> out>,     ifpp=) >>     at /usr/src/sys/ofed/drivers/infiniband/core/ib_addr.c:401 >> #14 addr_resolve (src_in=0xfffff80007ef5210, >> dst_in=0xfffff80007ef5290,     addr=0xfffff80108f20520) >>     at /usr/src/sys/ofed/drivers/infiniband/core/ib_addr.c:688 >> #15 0xffffffff82407872 in rdma_resolve_ip ( >>     client=0xffffffff82456450 , src_addr=, >>     dst_addr=0xfffffe00600e0054, addr=0xfffff80108f20520, >> timeout_ms=2000,     callback=0xffffffff82416b40 , >> context=0xfffff80108f20400) >>     at /usr/src/sys/ofed/drivers/infiniband/core/ib_addr.c:789 >> #16 0xffffffff82416352 in rdma_resolve_addr (id=0xfffff80108f20400, >>     src_addr=, dst_addr=0xfffffe00600e0054, >> timeout_ms=2000) >>     at /usr/src/sys/ofed/drivers/infiniband/core/ib_cma.c:3039 >> #17 0xffffffff8243786b in ucma_resolve_ip >> (linux_file=0xfffff80135c08400,     inbuf=, >> in_len=, out_len=) >>     at /usr/src/sys/ofed/drivers/infiniband/core/ib_ucma.c:694 >> #18 0xffffffff82436ee4 in ucma_write (filp=, >> buf=, len=72, pos=) >>     at /usr/src/sys/ofed/drivers/infiniband/core/ib_ucma.c:1625 >> #19 0xffffffff823a1ad3 in linux_file_write (file=0xfffff8015403c0a0, >>     uio=0xfffffe00600e01c0, active_cred=, >> flags=, td=) >>     at /usr/src/sys/compat/linuxkpi/common/src/linux_compat.c:1445 >> #20 0xffffffff80c2f511 in fo_write (fp=0xfffff8015403c0a0, >> uio=0xfffffe00600e01c0, active_cred=0xfffffe00600dfba0, flags=1999, >>     td=0xfffff8002e4cf000) at /usr/src/sys/sys/file.h:324 >> #21 dofilewrite (td=0xfffff8002e4cf000, fd=7, fp=0xfffff8015403c0a0, >>     auio=0xfffffe00600e01c0, offset=, flags=> out>) >>     at /usr/src/sys/kern/sys_generic.c:564 >> #22 0xffffffff80c2f149 in kern_writev (td=0xfffff8002e4cf000, fd=7, >>     auio=0xfffffe00600e01c0) at /usr/src/sys/kern/sys_generic.c:491 >> #23 0xffffffff80c2f0f3 in sys_write (td=0xffffffff81c85638 >> ,     uap=) at >> /usr/src/sys/kern/sys_generic.c:406 >> #24 0xffffffff8102ee45 in syscallenter (td=0xfffff8002e4cf000) >>     at /usr/src/sys/amd64/amd64/../../kern/subr_syscall.c:144 >> #25 amd64_syscall (td=0xfffff8002e4cf000, traced=0) >>     at /usr/src/sys/amd64/amd64/trap.c:1162 Maybe you could keep arpresolve() w/o need for locking epoch, and then create a new function arpresolve_epoched() which has the assert. --HPS From owner-svn-src-all@freebsd.org Mon Oct 14 13:02:50 2019 Return-Path: Delivered-To: svn-src-all@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 E1A90FA983; Mon, 14 Oct 2019 13:02:50 +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 46sJd64yL4z4Lpy; Mon, 14 Oct 2019 13:02:50 +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 8EAF05A61; Mon, 14 Oct 2019 13:02:50 +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 x9ED2oZ5010412; Mon, 14 Oct 2019 13:02:50 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ED2oV0010410; Mon, 14 Oct 2019 13:02:50 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910141302.x9ED2oV0010410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 14 Oct 2019 13:02:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353488 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 353488 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 13:02:50 -0000 Author: tuexen Date: Mon Oct 14 13:02:49 2019 New Revision: 353488 URL: https://svnweb.freebsd.org/changeset/base/353488 Log: Rename sctp_dtrace_declare.h to sctp_kdtrace.h for consistentcy. MFC after: 3 days Added: head/sys/netinet/sctp_kdtrace.h - copied unchanged from r353487, head/sys/netinet/sctp_dtrace_declare.h Deleted: head/sys/netinet/sctp_dtrace_declare.h Modified: head/sys/netinet/sctp_cc_functions.c Modified: head/sys/netinet/sctp_cc_functions.c ============================================================================== --- head/sys/netinet/sctp_cc_functions.c Mon Oct 14 09:29:56 2019 (r353487) +++ head/sys/netinet/sctp_cc_functions.c Mon Oct 14 13:02:49 2019 (r353488) @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #define SHIFT_MPTCP_MULTI_N 40 #define SHIFT_MPTCP_MULTI_Z 16 Copied: head/sys/netinet/sctp_kdtrace.h (from r353487, head/sys/netinet/sctp_dtrace_declare.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netinet/sctp_kdtrace.h Mon Oct 14 13:02:49 2019 (r353488, copy of r353487, head/sys/netinet/sctp_dtrace_declare.h) @@ -0,0 +1,81 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * a) Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * b) 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. + * + * c) Neither the name of Cisco Systems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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$"); + +#ifndef _NETINET_SCTP_DTRACE_DECLARE_H_ +#define _NETINET_SCTP_DTRACE_DECLARE_H_ + +#include +#include + +/* Declare the SCTP provider */ +SDT_PROVIDER_DECLARE(sctp); + +/* The probes we have so far: */ + +/* One to track a net's cwnd */ +/* initial */ +SDT_PROBE_DECLARE(sctp, cwnd, net, init); +/* update at a ack -- increase */ +SDT_PROBE_DECLARE(sctp, cwnd, net, ack); +/* update at a fast retransmit -- decrease */ +SDT_PROBE_DECLARE(sctp, cwnd, net, fr); +/* update at a time-out -- decrease */ +SDT_PROBE_DECLARE(sctp, cwnd, net, to); +/* update at a burst-limit -- decrease */ +SDT_PROBE_DECLARE(sctp, cwnd, net, bl); +/* update at a ECN -- decrease */ +SDT_PROBE_DECLARE(sctp, cwnd, net, ecn); +/* update at a Packet-Drop -- decrease */ +SDT_PROBE_DECLARE(sctp, cwnd, net, pd); +/* Rttvar probe declaration */ +SDT_PROBE_DECLARE(sctp, cwnd, net, rttvar); +SDT_PROBE_DECLARE(sctp, cwnd, net, rttstep); + +/* One to track an associations rwnd */ +SDT_PROBE_DECLARE(sctp, rwnd, assoc, val); + +/* One to track a net's flight size */ +SDT_PROBE_DECLARE(sctp, flightsize, net, val); + +/* One to track an associations flight size */ +SDT_PROBE_DECLARE(sctp, flightsize, assoc, val); + + + + + + +#endif From owner-svn-src-all@freebsd.org Mon Oct 14 13:04:07 2019 Return-Path: Delivered-To: svn-src-all@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 CAFC7FAA41; Mon, 14 Oct 2019 13:04:07 +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 46sJfb5jJfz4Lxs; Mon, 14 Oct 2019 13:04:07 +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 8E0DB5A62; Mon, 14 Oct 2019 13:04:07 +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 x9ED47Ed010524; Mon, 14 Oct 2019 13:04:07 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ED44nv010510; Mon, 14 Oct 2019 13:04:04 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201910141304.x9ED44nv010510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Mon, 14 Oct 2019 13:04:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353489 - in head/sys: conf kern powerpc/aim powerpc/include powerpc/powerpc powerpc/pseries vm X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: in head/sys: conf kern powerpc/aim powerpc/include powerpc/powerpc powerpc/pseries vm X-SVN-Commit-Revision: 353489 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 13:04:07 -0000 Author: luporl Date: Mon Oct 14 13:04:04 2019 New Revision: 353489 URL: https://svnweb.freebsd.org/changeset/base/353489 Log: [PPC64] Initial kernel minidump implementation Based on POWER9BSD implementation, with all POWER9 specific code removed and addition of new methods in PPC64 MMU interface, to isolate platform specific code. Currently, the new methods are implemented on pseries and PowerNV (D21643). Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D21551 Added: head/sys/powerpc/include/minidump.h (contents, props changed) head/sys/powerpc/powerpc/minidump_machdep.c (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/kern/kern_dump.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/aim/mmu_oea64.h head/sys/powerpc/include/dump.h head/sys/powerpc/include/md_var.h head/sys/powerpc/include/pmap.h head/sys/powerpc/powerpc/mmu_if.m head/sys/powerpc/powerpc/pmap_dispatch.c head/sys/powerpc/powerpc/uma_machdep.c head/sys/powerpc/pseries/mmu_phyp.c head/sys/vm/vm_page.c Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Mon Oct 14 13:02:49 2019 (r353488) +++ head/sys/conf/files.powerpc Mon Oct 14 13:04:04 2019 (r353489) @@ -224,6 +224,7 @@ powerpc/powerpc/intr_machdep.c standard powerpc/powerpc/iommu_if.m standard powerpc/powerpc/machdep.c standard powerpc/powerpc/mem.c optional mem +powerpc/powerpc/minidump_machdep.c optional powerpc64 powerpc/powerpc/mmu_if.m standard powerpc/powerpc/mp_machdep.c optional smp powerpc/powerpc/nexus.c standard Modified: head/sys/kern/kern_dump.c ============================================================================== --- head/sys/kern/kern_dump.c Mon Oct 14 13:02:49 2019 (r353488) +++ head/sys/kern/kern_dump.c Mon Oct 14 13:04:04 2019 (r353489) @@ -292,7 +292,7 @@ dumpsys_generic(struct dumperinfo *di) size_t hdrsz; int error; -#ifndef __powerpc__ +#if !defined(__powerpc__) || defined(__powerpc64__) if (do_minidump) return (minidumpsys(di)); #endif Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Mon Oct 14 13:02:49 2019 (r353488) +++ head/sys/powerpc/aim/mmu_oea64.c Mon Oct 14 13:04:04 2019 (r353489) @@ -307,6 +307,8 @@ static int moea64_map_user_ptr(mmu_t mmu, pmap_t pm, volatile const void *uaddr, void **kaddr, size_t ulen, size_t *klen); static int moea64_decode_kernel_ptr(mmu_t mmu, vm_offset_t addr, int *is_user, vm_offset_t *decoded_addr); +static size_t moea64_scan_pmap(mmu_t mmu); +static void *moea64_dump_pmap_init(mmu_t mmu, unsigned blkpgs); static mmu_method_t moea64_methods[] = { @@ -356,6 +358,8 @@ static mmu_method_t moea64_methods[] = { MMUMETHOD(mmu_kenter_attr, moea64_kenter_attr), MMUMETHOD(mmu_dev_direct_mapped,moea64_dev_direct_mapped), MMUMETHOD(mmu_scan_init, moea64_scan_init), + MMUMETHOD(mmu_scan_pmap, moea64_scan_pmap), + MMUMETHOD(mmu_dump_pmap_init, moea64_dump_pmap_init), MMUMETHOD(mmu_dumpsys_map, moea64_dumpsys_map), MMUMETHOD(mmu_map_user_ptr, moea64_map_user_ptr), MMUMETHOD(mmu_decode_kernel_ptr, moea64_decode_kernel_ptr), @@ -798,6 +802,8 @@ moea64_early_bootstrap(mmu_t mmup, vm_offset_t kernels hwphyssz - physsz; physsz = hwphyssz; phys_avail_count++; + dump_avail[j] = phys_avail[j]; + dump_avail[j + 1] = phys_avail[j + 1]; } break; } @@ -805,6 +811,8 @@ moea64_early_bootstrap(mmu_t mmup, vm_offset_t kernels phys_avail[j + 1] = regions[i].mr_start + regions[i].mr_size; phys_avail_count++; physsz += regions[i].mr_size; + dump_avail[j] = phys_avail[j]; + dump_avail[j + 1] = phys_avail[j + 1]; } /* Check for overlap with the kernel and exception vectors */ @@ -982,7 +990,7 @@ moea64_late_bootstrap(mmu_t mmup, vm_offset_t kernelst * Set the start and end of kva. */ virtual_avail = VM_MIN_KERNEL_ADDRESS; - virtual_end = VM_MAX_SAFE_KERNEL_ADDRESS; + virtual_end = VM_MAX_SAFE_KERNEL_ADDRESS; /* * Map the entire KVA range into the SLB. We must not fault there. @@ -1056,6 +1064,9 @@ moea64_late_bootstrap(mmu_t mmup, vm_offset_t kernelst } dpcpu_init(dpcpu, curcpu); + crashdumpmap = (caddr_t)virtual_avail; + virtual_avail += MAXDUMPPGS * PAGE_SIZE; + /* * Allocate some things for page zeroing. We put this directly * in the page table and use MOEA64_PTE_REPLACE to avoid any @@ -2932,3 +2943,69 @@ moea64_scan_init(mmu_t mmu) } } +static size_t +moea64_scan_pmap(mmu_t mmu) +{ + struct pvo_entry *pvo; + vm_paddr_t pa, pa_end; + vm_offset_t va, pgva, kstart, kend, kstart_lp, kend_lp; + uint64_t lpsize; + + lpsize = moea64_large_page_size; + kstart = trunc_page((vm_offset_t)_etext); + kend = round_page((vm_offset_t)_end); + kstart_lp = kstart & ~moea64_large_page_mask; + kend_lp = (kend + moea64_large_page_mask) & ~moea64_large_page_mask; + + CTR4(KTR_PMAP, "moea64_scan_pmap: kstart=0x%016lx, kend=0x%016lx, " + "kstart_lp=0x%016lx, kend_lp=0x%016lx", + kstart, kend, kstart_lp, kend_lp); + + PMAP_LOCK(kernel_pmap); + RB_FOREACH(pvo, pvo_tree, &kernel_pmap->pmap_pvo) { + va = pvo->pvo_vaddr; + + if (va & PVO_DEAD) + continue; + + /* Skip DMAP (except kernel area) */ + if (va >= DMAP_BASE_ADDRESS && va <= DMAP_MAX_ADDRESS) { + if (va & PVO_LARGE) { + pgva = va & ~moea64_large_page_mask; + if (pgva < kstart_lp || pgva >= kend_lp) + continue; + } else { + pgva = trunc_page(va); + if (pgva < kstart || pgva >= kend) + continue; + } + } + + pa = pvo->pvo_pte.pa & LPTE_RPGN; + + if (va & PVO_LARGE) { + pa_end = pa + lpsize; + for (; pa < pa_end; pa += PAGE_SIZE) { + if (is_dumpable(pa)) + dump_add_page(pa); + } + } else { + if (is_dumpable(pa)) + dump_add_page(pa); + } + } + PMAP_UNLOCK(kernel_pmap); + + return (sizeof(struct lpte) * moea64_pteg_count * 8); +} + +static struct dump_context dump_ctx; + +static void * +moea64_dump_pmap_init(mmu_t mmu, unsigned blkpgs) +{ + dump_ctx.ptex = 0; + dump_ctx.ptex_end = moea64_pteg_count * 8; + dump_ctx.blksz = blkpgs * PAGE_SIZE; + return (&dump_ctx); +} Modified: head/sys/powerpc/aim/mmu_oea64.h ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.h Mon Oct 14 13:02:49 2019 (r353488) +++ head/sys/powerpc/aim/mmu_oea64.h Mon Oct 14 13:04:04 2019 (r353489) @@ -34,6 +34,12 @@ #include +struct dump_context { + u_long ptex; + u_long ptex_end; + size_t blksz; +}; + extern mmu_def_t oea64_mmu; /* Modified: head/sys/powerpc/include/dump.h ============================================================================== --- head/sys/powerpc/include/dump.h Mon Oct 14 13:02:49 2019 (r353488) +++ head/sys/powerpc/include/dump.h Mon Oct 14 13:04:04 2019 (r353489) @@ -37,6 +37,9 @@ void dumpsys_pa_init(void); void dumpsys_unmap_chunk(vm_paddr_t, size_t, void *); +size_t dumpsys_scan_pmap(void); +void *dumpsys_dump_pmap_init(unsigned blkpgs); +void *dumpsys_dump_pmap(void *ctx, void *buf, u_long *nbytes); static inline struct dump_pa * dumpsys_pa_next(struct dump_pa *p) Modified: head/sys/powerpc/include/md_var.h ============================================================================== --- head/sys/powerpc/include/md_var.h Mon Oct 14 13:02:49 2019 (r353488) +++ head/sys/powerpc/include/md_var.h Mon Oct 14 13:04:04 2019 (r353489) @@ -41,6 +41,15 @@ extern int szsigcode32; #ifdef __powerpc64__ extern char sigcode64[], sigcode64_elfv2[]; extern int szsigcode64, szsigcode64_elfv2; + +extern uint64_t *vm_page_dump; +extern int vm_page_dump_size; + +struct dumperinfo; +int minidumpsys(struct dumperinfo *); +int is_dumpable(vm_paddr_t); +void dump_add_page(vm_paddr_t); +void dump_drop_page(vm_paddr_t); #endif extern long Maxmem; Added: head/sys/powerpc/include/minidump.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/include/minidump.h Mon Oct 14 13:04:04 2019 (r353489) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2006 Peter Wemm + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * From i386: FreeBSD: 157909 2006-04-21 04:28:43Z peter + * $FreeBSD$ + */ + +#ifndef _MACHINE_MINIDUMP_H_ +#define _MACHINE_MINIDUMP_H_ 1 + +#define MINIDUMP_MAGIC "minidump FreeBSD/powerpc64" +#define MINIDUMP_VERSION 1 + +struct minidumphdr { + char magic[32]; + char mmu_name[32]; + uint32_t version; + uint32_t msgbufsize; + uint32_t bitmapsize; + uint32_t pmapsize; + uint64_t kernbase; + uint64_t kernend; + uint64_t dmapbase; + uint64_t dmapend; + int hw_direct_map; + uint64_t startkernel; + uint64_t endkernel; +}; + +#endif /* _MACHINE_MINIDUMP_H_ */ Modified: head/sys/powerpc/include/pmap.h ============================================================================== --- head/sys/powerpc/include/pmap.h Mon Oct 14 13:02:49 2019 (r353488) +++ head/sys/powerpc/include/pmap.h Mon Oct 14 13:04:04 2019 (r353489) @@ -266,11 +266,13 @@ void pmap_deactivate(struct thread *); vm_paddr_t pmap_kextract(vm_offset_t); int pmap_dev_direct_mapped(vm_paddr_t, vm_size_t); boolean_t pmap_mmu_install(char *name, int prio); +const char *pmap_mmu_name(void); #define vtophys(va) pmap_kextract((vm_offset_t)(va)) extern vm_offset_t virtual_avail; extern vm_offset_t virtual_end; +extern caddr_t crashdumpmap; extern vm_offset_t msgbuf_phys; Added: head/sys/powerpc/powerpc/minidump_machdep.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powerpc/minidump_machdep.c Mon Oct 14 13:04:04 2019 (r353489) @@ -0,0 +1,442 @@ +/*- + * Copyright (c) 2019 Leandro Lupori + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * $FreeBSD$ + */ + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +/* + * bit to physical address + * + * bm - bitmap + * i - bitmap entry index + * bit - bit number + */ +#define BTOP(bm, i, bit) \ + (((uint64_t)(i) * sizeof(*(bm)) * NBBY + (bit)) * PAGE_SIZE) + +/* Debugging stuff */ +#define MINIDUMP_DEBUG 0 +#if MINIDUMP_DEBUG +#define dprintf(fmt, ...) printf(fmt, ## __VA_ARGS__) +#define DBG(...) __VA_ARGS__ +static size_t total, dumptotal; +static void dump_total(const char *id, size_t sz); +#else +#define dprintf(fmt, ...) +#define DBG(...) +#define dump_total(...) +#endif + + +extern vm_offset_t __startkernel, __endkernel; + +int vm_page_dump_size; +uint64_t *vm_page_dump; + +static int dump_retry_count = 5; +SYSCTL_INT(_machdep, OID_AUTO, dump_retry_count, CTLFLAG_RWTUN, + &dump_retry_count, 0, + "Number of times dump has to retry before bailing out"); + +static struct kerneldumpheader kdh; +static char pgbuf[PAGE_SIZE]; + +static struct { + int min_per; + int max_per; + int visited; +} progress_track[10] = { + { 0, 10, 0}, + { 10, 20, 0}, + { 20, 30, 0}, + { 30, 40, 0}, + { 40, 50, 0}, + { 50, 60, 0}, + { 60, 70, 0}, + { 70, 80, 0}, + { 80, 90, 0}, + { 90, 100, 0} +}; + +static size_t counter, dumpsize, progress; + +/* Handle chunked writes. */ +static size_t fragsz; + +void +dump_add_page(vm_paddr_t pa) +{ + int idx, bit; + + pa >>= PAGE_SHIFT; + idx = pa >> 6; /* 2^6 = 64 */ + bit = pa & 63; + atomic_set_long(&vm_page_dump[idx], 1ul << bit); +} + +void +dump_drop_page(vm_paddr_t pa) +{ + int idx, bit; + + pa >>= PAGE_SHIFT; + idx = pa >> 6; /* 2^6 = 64 */ + bit = pa & 63; + atomic_clear_long(&vm_page_dump[idx], 1ul << bit); +} + +int +is_dumpable(vm_paddr_t pa) +{ + vm_page_t m; + int i; + + if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL) + return ((m->flags & PG_NODUMP) == 0); + for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { + if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) + return (1); + } + return (0); +} + +static void +pmap_kenter_temporary(vm_offset_t va, vm_paddr_t pa) +{ + pmap_kremove(va); + pmap_kenter(va, pa); +} + +static void +report_progress(void) +{ + int sofar, i; + + sofar = 100 - ((progress * 100) / dumpsize); + for (i = 0; i < nitems(progress_track); i++) { + if (sofar < progress_track[i].min_per || + sofar > progress_track[i].max_per) + continue; + if (progress_track[i].visited) + return; + progress_track[i].visited = 1; + printf("..%d%%", sofar); + return; + } +} + +static int +blk_flush(struct dumperinfo *di) +{ + int error; + + if (fragsz == 0) + return (0); + + error = dump_append(di, crashdumpmap, 0, fragsz); + DBG(dumptotal += fragsz;) + fragsz = 0; + return (error); +} + +static int +blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz) +{ + size_t len, maxdumpsz; + int error, i, c; + + maxdumpsz = MIN(di->maxiosize, MAXDUMPPGS * PAGE_SIZE); + if (maxdumpsz == 0) /* seatbelt */ + maxdumpsz = PAGE_SIZE; + error = 0; + if ((sz % PAGE_SIZE) != 0) { + printf("Size not page aligned\n"); + return (EINVAL); + } + if (ptr != NULL && pa != 0) { + printf("Can't have both va and pa!\n"); + return (EINVAL); + } + if ((pa % PAGE_SIZE) != 0) { + printf("Address not page aligned 0x%lx\n", pa); + return (EINVAL); + } + if (ptr != NULL) { + /* + * If we're doing a virtual dump, flush any pre-existing + * pa pages + */ + error = blk_flush(di); + if (error) + return (error); + } + while (sz) { + len = maxdumpsz - fragsz; + if (len > sz) + len = sz; + counter += len; + progress -= len; + if (counter >> 20) { + report_progress(); + counter &= (1<<20) - 1; + } + + if (ptr) { + error = dump_append(di, ptr, 0, len); + if (error) + return (error); + DBG(dumptotal += len;) + ptr += len; + } else { + for (i = 0; i < len; i += PAGE_SIZE) + pmap_kenter_temporary( + (vm_offset_t)crashdumpmap + fragsz + i, + pa + i); + + fragsz += len; + pa += len; + if (fragsz == maxdumpsz) { + error = blk_flush(di); + if (error) + return (error); + } + } + sz -= len; + + /* Check for user abort. */ + c = cncheckc(); + if (c == 0x03) + return (ECANCELED); + if (c != -1) + printf(" (CTRL-C to abort) "); + } + + return (0); +} + +static int +dump_pmap(struct dumperinfo *di) +{ + void *ctx; + char *buf; + u_long nbytes; + int error; + + ctx = dumpsys_dump_pmap_init(sizeof(pgbuf) / PAGE_SIZE); + + for (;;) { + buf = dumpsys_dump_pmap(ctx, pgbuf, &nbytes); + if (buf == NULL) + break; + error = blk_write(di, buf, 0, nbytes); + if (error) + return (error); + } + + return (0); +} + +int +minidumpsys(struct dumperinfo *di) +{ + vm_paddr_t pa; + int bit, error, i, retry_count; + uint32_t pmapsize; + uint64_t bits; + struct minidumphdr mdhdr; + + retry_count = 0; +retry: + retry_count++; + fragsz = 0; + DBG(total = dumptotal = 0;) + + /* Reset progress */ + counter = 0; + for (i = 0; i < nitems(progress_track); i++) + progress_track[i].visited = 0; + + /* Build set of dumpable pages from kernel pmap */ + pmapsize = dumpsys_scan_pmap(); + if (pmapsize % PAGE_SIZE != 0) { + printf("pmapsize not page aligned: 0x%x\n", pmapsize); + return (EINVAL); + } + + /* Calculate dump size */ + dumpsize = PAGE_SIZE; /* header */ + dumpsize += round_page(msgbufp->msg_size); + dumpsize += round_page(vm_page_dump_size); + dumpsize += pmapsize; + for (i = 0; i < vm_page_dump_size / sizeof(*vm_page_dump); i++) { + bits = vm_page_dump[i]; + /* TODO optimize with bit manipulation instructions */ + if (bits == 0) + continue; + for (bit = 0; bit < 64; bit++) { + if ((bits & (1ul<msg_size; + mdhdr.bitmapsize = vm_page_dump_size; + mdhdr.pmapsize = pmapsize; + mdhdr.kernbase = VM_MIN_KERNEL_ADDRESS; + mdhdr.kernend = VM_MAX_SAFE_KERNEL_ADDRESS; + mdhdr.dmapbase = DMAP_BASE_ADDRESS; + mdhdr.dmapend = DMAP_MAX_ADDRESS; + mdhdr.hw_direct_map = hw_direct_map; + mdhdr.startkernel = __startkernel; + mdhdr.endkernel = __endkernel; + + dump_init_header(di, &kdh, KERNELDUMPMAGIC, KERNELDUMP_POWERPC_VERSION, + dumpsize); + + error = dump_start(di, &kdh); + if (error) + goto fail; + + printf("Dumping %lu out of %ju MB:", dumpsize >> 20, + ptoa((uintmax_t)physmem) / 1048576); + + /* Dump minidump header */ + bzero(pgbuf, sizeof(pgbuf)); + memcpy(pgbuf, &mdhdr, sizeof(mdhdr)); + error = blk_write(di, pgbuf, 0, PAGE_SIZE); + if (error) + goto fail; + dump_total("header", PAGE_SIZE); + + /* Dump msgbuf up front */ + error = blk_write(di, (char *)msgbufp->msg_ptr, 0, + round_page(msgbufp->msg_size)); + dump_total("msgbuf", round_page(msgbufp->msg_size)); + + /* Dump bitmap */ + error = blk_write(di, (char *)vm_page_dump, 0, + round_page(vm_page_dump_size)); + if (error) + goto fail; + dump_total("bitmap", round_page(vm_page_dump_size)); + + /* Dump kernel page directory pages */ + error = dump_pmap(di); + if (error) + goto fail; + dump_total("pmap", pmapsize); + + /* Dump memory chunks */ + /* XXX cluster it up and use blk_dump() */ + for (i = 0; i < vm_page_dump_size / sizeof(*vm_page_dump); i++) { + bits = vm_page_dump[i]; + /* TODO optimize with bit manipulation instructions */ + if (bits == 0) + continue; + for (bit = 0; bit < 64; bit++) { + if ((bits & (1ul<ops->cls->name); } int unmapped_buf_allowed; Modified: head/sys/powerpc/powerpc/uma_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/uma_machdep.c Mon Oct 14 13:02:49 2019 (r353488) +++ head/sys/powerpc/powerpc/uma_machdep.c Mon Oct 14 13:04:04 2019 (r353489) @@ -71,6 +71,9 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int if ((vm_offset_t)pa != pa) return (NULL); + if ((wait & M_NODUMP) == 0) + dump_add_page(pa); + if (!hw_direct_map) { pmap_kenter(pa, pa); va = (void *)(vm_offset_t)pa; @@ -100,6 +103,7 @@ uma_small_free(void *mem, vm_size_t size, u_int8_t fla m = PHYS_TO_VM_PAGE((vm_offset_t)mem); KASSERT(m != NULL, ("Freeing UMA block at %p with no associated page", mem)); + dump_add_page(VM_PAGE_TO_PHYS(m)); vm_page_unwire_noq(m); vm_page_free(m); atomic_subtract_int(&hw_uma_mdpages, 1); Modified: head/sys/powerpc/pseries/mmu_phyp.c ============================================================================== --- head/sys/powerpc/pseries/mmu_phyp.c Mon Oct 14 13:02:49 2019 (r353488) +++ head/sys/powerpc/pseries/mmu_phyp.c Mon Oct 14 13:04:04 2019 (r353489) @@ -78,6 +78,8 @@ static struct rmlock mphyp_eviction_lock; static void mphyp_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend); static void mphyp_cpu_bootstrap(mmu_t mmup, int ap); +static void *mphyp_dump_pmap(mmu_t mmu, void *ctx, void *buf, + u_long *nbytes); static int64_t mphyp_pte_synch(mmu_t, struct pvo_entry *pvo); static int64_t mphyp_pte_clear(mmu_t, struct pvo_entry *pvo, uint64_t ptebit); static int64_t mphyp_pte_unset(mmu_t, struct pvo_entry *pvo); @@ -86,6 +88,7 @@ static int mphyp_pte_insert(mmu_t, struct pvo_entry *p static mmu_method_t mphyp_methods[] = { MMUMETHOD(mmu_bootstrap, mphyp_bootstrap), MMUMETHOD(mmu_cpu_bootstrap, mphyp_cpu_bootstrap), + MMUMETHOD(mmu_dump_pmap, mphyp_dump_pmap), MMUMETHOD(moea64_pte_synch, mphyp_pte_synch), MMUMETHOD(moea64_pte_clear, mphyp_pte_clear), @@ -505,3 +508,32 @@ mphyp_pte_insert(mmu_t mmu, struct pvo_entry *pvo) return (result); } +static void * +mphyp_dump_pmap(mmu_t mmu, void *ctx, void *buf, u_long *nbytes) +{ + struct dump_context *dctx; + struct lpte p, *pbuf; + int bufidx; + uint64_t junk; + u_long ptex, ptex_end; + + dctx = (struct dump_context *)ctx; + pbuf = (struct lpte *)buf; + bufidx = 0; + ptex = dctx->ptex; + ptex_end = ptex + dctx->blksz / sizeof(struct lpte); + ptex_end = MIN(ptex_end, dctx->ptex_end); + *nbytes = (ptex_end - ptex) * sizeof(struct lpte); + + if (*nbytes == 0) + return (NULL); + + for (; ptex < ptex_end; ptex++) { + phyp_pft_hcall(H_READ, 0, ptex, 0, 0, + &p.pte_hi, &p.pte_lo, &junk); + pbuf[bufidx++] = p; + } + + dctx->ptex = ptex; + return (buf); +} Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Oct 14 13:02:49 2019 (r353488) +++ head/sys/vm/vm_page.c Mon Oct 14 13:04:04 2019 (r353489) @@ -658,7 +658,8 @@ vm_page_startup(vm_offset_t vaddr) #endif #if defined(__aarch64__) || defined(__amd64__) || defined(__arm__) || \ - defined(__i386__) || defined(__mips__) || defined(__riscv) + defined(__i386__) || defined(__mips__) || defined(__riscv) || \ + defined(__powerpc64__) /* * Allocate a bitmap to indicate that a random physical page * needs to be included in a minidump. @@ -684,7 +685,7 @@ vm_page_startup(vm_offset_t vaddr) (void)last_pa; #endif #if defined(__aarch64__) || defined(__amd64__) || defined(__mips__) || \ - defined(__riscv) + defined(__riscv) || defined(__powerpc64__) /* * Include the UMA bootstrap pages, witness pages and vm_page_dump * in a crash dump. When pmap_map() uses the direct map, they are @@ -789,7 +790,7 @@ vm_page_startup(vm_offset_t vaddr) new_end = vm_reserv_startup(&vaddr, new_end); #endif #if defined(__aarch64__) || defined(__amd64__) || defined(__mips__) || \ - defined(__riscv) + defined(__riscv) || defined(__powerpc64__) /* * Include vm_page_array and vm_reserv_array in a crash dump. */ From owner-svn-src-all@freebsd.org Mon Oct 14 13:10:30 2019 Return-Path: Delivered-To: svn-src-all@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 23609FAF3F; Mon, 14 Oct 2019 13:10:30 +0000 (UTC) (envelope-from rrs@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 46sJny06xnz4MTJ; Mon, 14 Oct 2019 13:10:30 +0000 (UTC) (envelope-from rrs@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 DBB1C5A95; Mon, 14 Oct 2019 13:10:29 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9EDATUl010901; Mon, 14 Oct 2019 13:10:29 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EDATvi010900; Mon, 14 Oct 2019 13:10:29 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <201910141310.x9EDATvi010900@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Mon, 14 Oct 2019 13:10:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353490 - head/sys/netinet/tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: rrs X-SVN-Commit-Paths: head/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 353490 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 13:10:30 -0000 Author: rrs Date: Mon Oct 14 13:10:29 2019 New Revision: 353490 URL: https://svnweb.freebsd.org/changeset/base/353490 Log: if_hw_tsomaxsegsize needs to be initialized to zero, just like in bbr.c and tcp_output.c Modified: head/sys/netinet/tcp_stacks/rack.c Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Mon Oct 14 13:04:04 2019 (r353489) +++ head/sys/netinet/tcp_stacks/rack.c Mon Oct 14 13:10:29 2019 (r353490) @@ -8115,7 +8115,7 @@ rack_output(struct tcpcb *tp) struct mbuf *m; struct mbuf *mb; uint32_t if_hw_tsomaxsegcount = 0; - uint32_t if_hw_tsomaxsegsize; + uint32_t if_hw_tsomaxsegsize = 0; int32_t maxseg; long tot_len_this_send = 0; struct ip *ip = NULL; From owner-svn-src-all@freebsd.org Mon Oct 14 14:31:22 2019 Return-Path: Delivered-To: svn-src-all@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 65A07FD236; Mon, 14 Oct 2019 14:31:22 +0000 (UTC) (envelope-from eugen@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 46sLbG25PMz4RS1; Mon, 14 Oct 2019 14:31:22 +0000 (UTC) (envelope-from eugen@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 2CA3769ED; Mon, 14 Oct 2019 14:31:22 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9EEVMuN061130; Mon, 14 Oct 2019 14:31:22 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EEVMxG061129; Mon, 14 Oct 2019 14:31:22 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201910141431.x9EEVMxG061129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Mon, 14 Oct 2019 14:31:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353491 - head/tools/tools/locale X-SVN-Group: head X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: head/tools/tools/locale X-SVN-Commit-Revision: 353491 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 14:31:22 -0000 Author: eugen Date: Mon Oct 14 14:31:21 2019 New Revision: 353491 URL: https://svnweb.freebsd.org/changeset/base/353491 Log: Add missing port to the list of needed tools in the README file describing locale rebuild process: devel/apache-ant Modified: head/tools/tools/locale/README Modified: head/tools/tools/locale/README ============================================================================== --- head/tools/tools/locale/README Mon Oct 14 13:10:29 2019 (r353490) +++ head/tools/tools/locale/README Mon Oct 14 14:31:21 2019 (r353491) @@ -6,6 +6,7 @@ Tools needed: java (openjdk >= 8) perl converters/p5-Text-Iconv + devel/apache-ant devel/p5-Tie-IxHash textproc/p5-XML-Parser From owner-svn-src-all@freebsd.org Mon Oct 14 15:33:54 2019 Return-Path: Delivered-To: svn-src-all@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 A2BE3FE8C0; Mon, 14 Oct 2019 15:33:54 +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 46sMzQ35gXz4VHD; Mon, 14 Oct 2019 15:33:54 +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 4D872750F; Mon, 14 Oct 2019 15:33:54 +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 x9EFXsZh098354; Mon, 14 Oct 2019 15:33:54 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EFXsvK098353; Mon, 14 Oct 2019 15:33:54 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910141533.x9EFXsvK098353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 15:33:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353492 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 353492 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 15:33:54 -0000 Author: glebius Date: Mon Oct 14 15:33:53 2019 New Revision: 353492 URL: https://svnweb.freebsd.org/changeset/base/353492 Log: in6ifa_llaonifp() is never called from fast path, so do not require epoch being entered. Modified: head/sys/netinet6/in6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Mon Oct 14 14:31:21 2019 (r353491) +++ head/sys/netinet6/in6.c Mon Oct 14 15:33:53 2019 (r353492) @@ -1548,13 +1548,14 @@ in6ifa_ifpwithaddr(struct ifnet *ifp, const struct in6 struct in6_ifaddr * in6ifa_llaonifp(struct ifnet *ifp) { + struct epoch_tracker et; struct sockaddr_in6 *sin6; struct ifaddr *ifa; - NET_EPOCH_ASSERT(); if (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) return (NULL); + NET_EPOCH_ENTER(et); CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; @@ -1564,6 +1565,7 @@ in6ifa_llaonifp(struct ifnet *ifp) IN6_IS_ADDR_MC_NODELOCAL(&sin6->sin6_addr)) break; } + NET_EPOCH_EXIT(et); return ((struct in6_ifaddr *)ifa); } From owner-svn-src-all@freebsd.org Mon Oct 14 15:53:00 2019 Return-Path: Delivered-To: svn-src-all@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 A8E7FFF0D5; Mon, 14 Oct 2019 15:53:00 +0000 (UTC) (envelope-from br@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 46sNPS3wmwz4WFf; Mon, 14 Oct 2019 15:53:00 +0000 (UTC) (envelope-from br@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 528147884; Mon, 14 Oct 2019 15:53:00 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9EFr0ft010168; Mon, 14 Oct 2019 15:53:00 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EFr0Zb010167; Mon, 14 Oct 2019 15:53:00 GMT (envelope-from br@FreeBSD.org) Message-Id: <201910141553.x9EFr0Zb010167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 14 Oct 2019 15:53:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353493 - head/sys/dev/mmc/host X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/dev/mmc/host X-SVN-Commit-Revision: 353493 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 15:53:00 -0000 Author: br Date: Mon Oct 14 15:52:59 2019 New Revision: 353493 URL: https://svnweb.freebsd.org/changeset/base/353493 Log: Fix the driver attachment in cases when the external resource devices (resets, regulators, clocks) are not available. Rely on a system initialization done by a bootloader in that cases. This fixes operation on Terasic DE10-Pro (an Intel Stratix 10 development kit). Sponsored by: DARPA, AFRL Modified: head/sys/dev/mmc/host/dwmmc.c Modified: head/sys/dev/mmc/host/dwmmc.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc.c Mon Oct 14 15:33:53 2019 (r353492) +++ head/sys/dev/mmc/host/dwmmc.c Mon Oct 14 15:52:59 2019 (r353493) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Ruslan Bukin + * Copyright (c) 2014-2019 Ruslan Bukin * All rights reserved. * * This software was developed by SRI International and the University of @@ -457,26 +457,20 @@ parse_fdt(struct dwmmc_softc *sc) /* IP block reset is optional */ error = hwreset_get_by_ofw_name(sc->dev, 0, "reset", &sc->hwreset); - if (error != 0 && error != ENOENT) { + if (error != 0 && error != ENOENT) device_printf(sc->dev, "Cannot get reset\n"); - goto fail; - } /* vmmc regulator is optional */ error = regulator_get_by_ofw_property(sc->dev, 0, "vmmc-supply", &sc->vmmc); - if (error != 0 && error != ENOENT) { + if (error != 0 && error != ENOENT) device_printf(sc->dev, "Cannot get regulator 'vmmc-supply'\n"); - goto fail; - } /* vqmmc regulator is optional */ error = regulator_get_by_ofw_property(sc->dev, 0, "vqmmc-supply", &sc->vqmmc); - if (error != 0 && error != ENOENT) { + if (error != 0 && error != ENOENT) device_printf(sc->dev, "Cannot get regulator 'vqmmc-supply'\n"); - goto fail; - } /* Assert reset first */ if (sc->hwreset != NULL) { @@ -489,10 +483,9 @@ parse_fdt(struct dwmmc_softc *sc) /* BIU (Bus Interface Unit clock) is optional */ error = clk_get_by_ofw_name(sc->dev, 0, "biu", &sc->biu); - if (error != 0 && error != ENOENT) { + if (error != 0 && error != ENOENT) device_printf(sc->dev, "Cannot get 'biu' clock\n"); - goto fail; - } + if (sc->biu) { error = clk_enable(sc->biu); if (error != 0) { @@ -506,10 +499,9 @@ parse_fdt(struct dwmmc_softc *sc) * if no clock-frequency property is given */ error = clk_get_by_ofw_name(sc->dev, 0, "ciu", &sc->ciu); - if (error != 0 && error != ENOENT) { - device_printf(sc->dev, "Cannot get 'ciu'clock\n"); - goto fail; - } + if (error != 0 && error != ENOENT) + device_printf(sc->dev, "Cannot get 'ciu' clock\n"); + if (sc->ciu) { if (bus_hz != 0) { error = clk_set_freq(sc->ciu, bus_hz, 0); From owner-svn-src-all@freebsd.org Mon Oct 14 16:11:01 2019 Return-Path: Delivered-To: svn-src-all@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 938E1FF652; Mon, 14 Oct 2019 16:11:01 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46sNpD0RfTz4X04; Mon, 14 Oct 2019 16:10:59 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 63d169eb; Mon, 14 Oct 2019 18:10:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=epLA7UcjgU8LNSV4rrmkA9Rf6e0=; b=d7fhfC5vKHhF0rRtAxL4wDp4ImyR +I0jCp92kpZRJbuNYNWmEFZ2/nGBlTPOm868gX6O8B4vF5V8PNZcd3VX8t5AMkzx 3QIyy1Qoji1sWMBOZ7+Fi5wbqbRQcUaGRmCL9swraew1efGuwfzZ+o5sHKjXHOLi 1TNg3eKuS6+35Cc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=bbZ8ubPUasdcYmK+ve30xaELYVL6SUpaal0LcyoqiRpwcdZ7VsLqZNfa E7IuXOAPHb8DYQjIr2BomV2pxQO4pYExYMZDvmQe3u4j6kaXQHbBwGTKaNKr6LpJ 2la1wedIPNke1ewpYuMVThBj5Cyb3RRoA7PTrwHgW1s4+WgeR6Y= Received: from skull.home.blih.net (ip-9.net-89-3-105.rev.numericable.fr [89.3.105.9]) by mail.blih.net (OpenSMTPD) with ESMTPSA id dd50d674 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Mon, 14 Oct 2019 18:10:52 +0200 (CEST) Date: Mon, 14 Oct 2019 18:10:51 +0200 From: Emmanuel Vadot To: Ruslan Bukin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353493 - head/sys/dev/mmc/host Message-Id: <20191014181051.bd8c7a3dbb7b07a636d81ed9@bidouilliste.com> In-Reply-To: <201910141553.x9EFr0Zb010167@repo.freebsd.org> References: <201910141553.x9EFr0Zb010167@repo.freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46sNpD0RfTz4X04 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bidouilliste.com header.s=mail header.b=d7fhfC5v; dmarc=none; spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates 212.83.177.182 as permitted sender) smtp.mailfrom=manu@bidouilliste.com X-Spamd-Result: default: False [-0.53 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mail]; NEURAL_HAM_MEDIUM(-0.14)[-0.145,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:212.83.177.182/32]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MV_CASE(0.50)[]; DMARC_NA(0.00)[bidouilliste.com]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-0.86)[-0.861,0]; DKIM_TRACE(0.00)[bidouilliste.com:+]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; IP_SCORE(0.38)[ip: (-0.70), ipnet: 212.83.160.0/19(2.47), asn: 12876(0.12), country: FR(-0.00)]; ASN(0.00)[asn:12876, ipnet:212.83.160.0/19, country:FR]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 16:11:01 -0000 Hi Ruslan, On Mon, 14 Oct 2019 15:53:00 +0000 (UTC) Ruslan Bukin wrote: > Author: br > Date: Mon Oct 14 15:52:59 2019 > New Revision: 353493 > URL: https://svnweb.freebsd.org/changeset/base/353493 > > Log: > Fix the driver attachment in cases when the external resource devices > (resets, regulators, clocks) are not available. > > Rely on a system initialization done by a bootloader in that cases. > > This fixes operation on Terasic DE10-Pro (an Intel Stratix 10 > development kit). > > Sponsored by: DARPA, AFRL > > Modified: > head/sys/dev/mmc/host/dwmmc.c > > Modified: head/sys/dev/mmc/host/dwmmc.c > ============================================================================== > --- head/sys/dev/mmc/host/dwmmc.c Mon Oct 14 15:33:53 2019 (r353492) > +++ head/sys/dev/mmc/host/dwmmc.c Mon Oct 14 15:52:59 2019 (r353493) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2014 Ruslan Bukin > + * Copyright (c) 2014-2019 Ruslan Bukin > * All rights reserved. > * > * This software was developed by SRI International and the University of > @@ -457,26 +457,20 @@ parse_fdt(struct dwmmc_softc *sc) > > /* IP block reset is optional */ > error = hwreset_get_by_ofw_name(sc->dev, 0, "reset", &sc->hwreset); > - if (error != 0 && error != ENOENT) { > + if (error != 0 && error != ENOENT) > device_printf(sc->dev, "Cannot get reset\n"); > - goto fail; > - } This is not correct, on a system without reset/clock/regulator support you will get ENODEV as the phandle is present but no device is associated with it. This is the case that you want to test. Currently this hide all errors. But you should really consider implementing reset/clock/regulator the correct way for your platform otherwise a lot of thing will not work and relying on bootloader leftover is a bad habit. Even simple thing like sd probing can fail is the sd module clock is really high and the controller internal divider cannot be large enough to reach the 400khz discovery frequency. > /* vmmc regulator is optional */ > error = regulator_get_by_ofw_property(sc->dev, 0, "vmmc-supply", > &sc->vmmc); > - if (error != 0 && error != ENOENT) { > + if (error != 0 && error != ENOENT) > device_printf(sc->dev, "Cannot get regulator 'vmmc-supply'\n"); > - goto fail; > - } > > /* vqmmc regulator is optional */ > error = regulator_get_by_ofw_property(sc->dev, 0, "vqmmc-supply", > &sc->vqmmc); > - if (error != 0 && error != ENOENT) { > + if (error != 0 && error != ENOENT) > device_printf(sc->dev, "Cannot get regulator 'vqmmc-supply'\n"); > - goto fail; > - } > > /* Assert reset first */ > if (sc->hwreset != NULL) { > @@ -489,10 +483,9 @@ parse_fdt(struct dwmmc_softc *sc) > > /* BIU (Bus Interface Unit clock) is optional */ > error = clk_get_by_ofw_name(sc->dev, 0, "biu", &sc->biu); > - if (error != 0 && error != ENOENT) { > + if (error != 0 && error != ENOENT) > device_printf(sc->dev, "Cannot get 'biu' clock\n"); > - goto fail; > - } > + > if (sc->biu) { > error = clk_enable(sc->biu); > if (error != 0) { > @@ -506,10 +499,9 @@ parse_fdt(struct dwmmc_softc *sc) > * if no clock-frequency property is given > */ > error = clk_get_by_ofw_name(sc->dev, 0, "ciu", &sc->ciu); > - if (error != 0 && error != ENOENT) { > - device_printf(sc->dev, "Cannot get 'ciu'clock\n"); > - goto fail; > - } > + if (error != 0 && error != ENOENT) > + device_printf(sc->dev, "Cannot get 'ciu' clock\n"); > + > if (sc->ciu) { > if (bus_hz != 0) { > error = clk_set_freq(sc->ciu, bus_hz, 0); -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Mon Oct 14 16:31:41 2019 Return-Path: Delivered-To: svn-src-all@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 BE98FFFDD9; Mon, 14 Oct 2019 16:31:41 +0000 (UTC) (envelope-from br@bsdpad.com) Received: from sc1.bsdpad.com (sc1.bsdpad.com [163.172.212.18]) (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 46sPG40cgNz4Y5x; Mon, 14 Oct 2019 16:31:39 +0000 (UTC) (envelope-from br@bsdpad.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bsdpad.com; s=20190317; h=Subject:To:From; bh=PnzxJBXcNYZyKLNT0ICLx+7wpgLU7E5iapjJsD+uMJs=; b=Jh0yNKEjjN9OlhzcXcbjLO/leW hcVp4Xu2adKyw5l134A+sQVL2jWYAT/vL6jJ9X3pq+GFy/u9PZJDAMLglQ2qCz8eIQF/1jkIy8Yhc M7g+g9tNNDPM0KkE3WxdenrRRm3X3BLtB+z02QGCvjVTskzIWLO2b/wVKRWw14uG0UmHBe7YrFNL+ 8uPSdqd9uP4gZGP+hKYG2fAcHgQgzRVJydT2kJZqJLDkaMz+VOes3himzhIkhQmQTPL8lrCojYagJ q5dMdkuRuoNEP25lf0cs14HhAyA0h2EqDoXj/whRCNP9xGQsaYUDLwk+EoFcAoBcOp/YJqdpEe6ue Be3nCMiw==; Received: from localhost ([127.0.0.1] helo=bsdpad.com) by sc1.bsdpad.com with smtp (Exim 4.91 (FreeBSD)) (envelope-from ) id 1iK3CJ-000805-3U; Mon, 14 Oct 2019 17:27:51 +0100 Received: by bsdpad.com (nbSMTP-1.00) for uid 1001 br@bsdpad.com; Mon, 14 Oct 2019 17:27:51 +0100 (BST) Date: Mon, 14 Oct 2019 17:27:51 +0100 From: Ruslan Bukin To: Emmanuel Vadot Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353493 - head/sys/dev/mmc/host Message-ID: <20191014162751.GA30496@bsdpad.com> References: <201910141553.x9EFr0Zb010167@repo.freebsd.org> <20191014181051.bd8c7a3dbb7b07a636d81ed9@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191014181051.bd8c7a3dbb7b07a636d81ed9@bidouilliste.com> User-Agent: Mutt/1.11.2 (2019-01-07) X-Rspamd-Queue-Id: 46sPG40cgNz4Y5x X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdpad.com header.s=20190317 header.b=Jh0yNKEj; dmarc=none; spf=pass (mx1.freebsd.org: domain of br@bsdpad.com designates 163.172.212.18 as permitted sender) smtp.mailfrom=br@bsdpad.com X-Spamd-Result: default: False [-5.02 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[bsdpad.com:s=20190317]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdpad.com:+]; IP_SCORE(-2.82)[ip: (-9.45), ipnet: 163.172.208.0/20(-4.74), asn: 12876(0.12), country: FR(-0.00)]; FORGED_SENDER(0.30)[br@freebsd.org,br@bsdpad.com]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:12876, ipnet:163.172.208.0/20, country:FR]; FROM_NEQ_ENVFROM(0.00)[br@freebsd.org,br@bsdpad.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 16:31:41 -0000 On Mon, Oct 14, 2019 at 06:10:51PM +0200, Emmanuel Vadot wrote: > > On Mon, 14 Oct 2019 15:53:00 +0000 (UTC) > Ruslan Bukin wrote: > > > Author: br > > Date: Mon Oct 14 15:52:59 2019 > > New Revision: 353493 > > URL: https://svnweb.freebsd.org/changeset/base/353493 > > > > Log: > > Fix the driver attachment in cases when the external resource devices > > (resets, regulators, clocks) are not available. > > > > Rely on a system initialization done by a bootloader in that cases. > > > > This fixes operation on Terasic DE10-Pro (an Intel Stratix 10 > > development kit). > > > > Sponsored by: DARPA, AFRL > > > > Modified: > > head/sys/dev/mmc/host/dwmmc.c > > > > Modified: head/sys/dev/mmc/host/dwmmc.c > > ============================================================================== > > --- head/sys/dev/mmc/host/dwmmc.c Mon Oct 14 15:33:53 2019 (r353492) > > +++ head/sys/dev/mmc/host/dwmmc.c Mon Oct 14 15:52:59 2019 (r353493) > > @@ -1,5 +1,5 @@ > > /*- > > - * Copyright (c) 2014 Ruslan Bukin > > + * Copyright (c) 2014-2019 Ruslan Bukin > > * All rights reserved. > > * > > * This software was developed by SRI International and the University of > > @@ -457,26 +457,20 @@ parse_fdt(struct dwmmc_softc *sc) > > > > /* IP block reset is optional */ > > error = hwreset_get_by_ofw_name(sc->dev, 0, "reset", &sc->hwreset); > > - if (error != 0 && error != ENOENT) { > > + if (error != 0 && error != ENOENT) > > device_printf(sc->dev, "Cannot get reset\n"); > > - goto fail; > > - } > > This is not correct, on a system without reset/clock/regulator support > you will get ENODEV as the phandle is present but no device is > associated with it. This is the case that you want to test. Currently > this hide all errors. The change means that the driver will be attached regardless of the return value from ext resources. Why it is not correct? It does not hide all errors, the printf will be called and a user will be warned. Ruslan From owner-svn-src-all@freebsd.org Mon Oct 14 16:37:00 2019 Return-Path: Delivered-To: svn-src-all@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 DDF40FFEB0; Mon, 14 Oct 2019 16:37:00 +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 46sPND5YY0z4YVL; Mon, 14 Oct 2019 16:37:00 +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 A1FEC7F9E; Mon, 14 Oct 2019 16:37:00 +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 x9EGb0fK034093; Mon, 14 Oct 2019 16:37:00 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EGb08Y034092; Mon, 14 Oct 2019 16:37:00 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910141637.x9EGb08Y034092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 16:37:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353494 - head/sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netpfil/ipfw X-SVN-Commit-Revision: 353494 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 16:37:00 -0000 Author: glebius Date: Mon Oct 14 16:37:00 2019 New Revision: 353494 URL: https://svnweb.freebsd.org/changeset/base/353494 Log: ipfw(4) rule matching always happens in network epoch. Modified: head/sys/netpfil/ipfw/ip_fw2.c Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Mon Oct 14 15:52:59 2019 (r353493) +++ head/sys/netpfil/ipfw/ip_fw2.c Mon Oct 14 16:37:00 2019 (r353494) @@ -408,17 +408,15 @@ iface_match(struct ifnet *ifp, ipfw_insn_if *cmd, stru #if !defined(USERSPACE) && defined(__FreeBSD__) /* and OSX too ? */ struct ifaddr *ia; - if_addr_rlock(ifp); + NET_EPOCH_ASSERT(); + CK_STAILQ_FOREACH(ia, &ifp->if_addrhead, ifa_link) { if (ia->ifa_addr->sa_family != AF_INET) continue; if (cmd->p.ip.s_addr == ((struct sockaddr_in *) - (ia->ifa_addr))->sin_addr.s_addr) { - if_addr_runlock(ifp); - return(1); /* match */ - } + (ia->ifa_addr))->sin_addr.s_addr) + return (1); /* match */ } - if_addr_runlock(ifp); #endif /* __FreeBSD__ */ } return(0); /* no match, fail ... */ From owner-svn-src-all@freebsd.org Mon Oct 14 16:37:42 2019 Return-Path: Delivered-To: svn-src-all@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 D21D0FFF7A; Mon, 14 Oct 2019 16:37:42 +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 46sPP252S9z4YjR; Mon, 14 Oct 2019 16:37:42 +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 8F5627F9F; Mon, 14 Oct 2019 16:37:42 +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 x9EGbgsu034167; Mon, 14 Oct 2019 16:37:42 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EGbgQW034166; Mon, 14 Oct 2019 16:37:42 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910141637.x9EGbgQW034166@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 16:37:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353495 - in head/sys/netpfil/ipfw: . nptv6 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys/netpfil/ipfw: . nptv6 X-SVN-Commit-Revision: 353495 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 16:37:42 -0000 Author: glebius Date: Mon Oct 14 16:37:41 2019 New Revision: 353495 URL: https://svnweb.freebsd.org/changeset/base/353495 Log: Use epoch(9) directly instead of obsoleted KPI. Modified: head/sys/netpfil/ipfw/ip_fw_nat.c head/sys/netpfil/ipfw/nptv6/nptv6.c Modified: head/sys/netpfil/ipfw/ip_fw_nat.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_nat.c Mon Oct 14 16:37:00 2019 (r353494) +++ head/sys/netpfil/ipfw/ip_fw_nat.c Mon Oct 14 16:37:41 2019 (r353495) @@ -114,10 +114,12 @@ ifaddr_change(void *arg __unused, struct ifnet *ifp) IPFW_UH_WLOCK(chain); /* Check every nat entry... */ LIST_FOREACH(ptr, &chain->nat, _next) { + struct epoch_tracker et; + /* ...using nic 'ifp->if_xname' as dynamic alias address. */ if (strncmp(ptr->if_name, ifp->if_xname, IF_NAMESIZE) != 0) continue; - if_addr_rlock(ifp); + NET_EPOCH_ENTER(et); CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr == NULL) continue; @@ -129,7 +131,7 @@ ifaddr_change(void *arg __unused, struct ifnet *ifp) LibAliasSetAddress(ptr->lib, ptr->ip); IPFW_WUNLOCK(chain); } - if_addr_runlock(ifp); + NET_EPOCH_EXIT(et); } IPFW_UH_WUNLOCK(chain); } Modified: head/sys/netpfil/ipfw/nptv6/nptv6.c ============================================================================== --- head/sys/netpfil/ipfw/nptv6/nptv6.c Mon Oct 14 16:37:00 2019 (r353494) +++ head/sys/netpfil/ipfw/nptv6/nptv6.c Mon Oct 14 16:37:41 2019 (r353495) @@ -534,6 +534,7 @@ static void nptv6_find_prefix(struct ip_fw_chain *ch, struct nptv6_cfg *cfg, struct ifnet *ifp) { + struct epoch_tracker et; struct ifaddr *ifa; struct in6_ifaddr *ia; @@ -545,7 +546,7 @@ nptv6_find_prefix(struct ip_fw_chain *ch, struct nptv6 if (ifp == NULL) return; } - if_addr_rlock(ifp); + NET_EPOCH_ENTER(et); CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; @@ -558,7 +559,7 @@ nptv6_find_prefix(struct ip_fw_chain *ch, struct nptv6 nptv6_set_external(cfg, &ia->ia_addr.sin6_addr); break; } - if_addr_runlock(ifp); + NET_EPOCH_EXIT(et); if_rele(ifp); } From owner-svn-src-all@freebsd.org Mon Oct 14 16:45:29 2019 Return-Path: Delivered-To: svn-src-all@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 D11D6130351; Mon, 14 Oct 2019 16:45:29 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46sPZ04S1Bz4ZJc; Mon, 14 Oct 2019 16:45:28 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 3e7095a9; Mon, 14 Oct 2019 18:45:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=iGGZD919yCZ3EAJs3ifLlk2isaQ=; b=izF4fEPdnS1r9OI9BwT08lv2LtNo 4l0VhmGs5HyOy98ZrlBu1bp2U5NLixrThwHDG3tpb3HDZWlfT6AapWVWZbZQHexD ddWPZT1aIYB5meD+SeK/PogECNYfi2Y6XZIXvVfwGva4vaMI3EP7WNH+VCI6144V Y+iMX2y82tU+05c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=IGQBqLEhopbYENfXeINc9m3v9A3uskXRtOxjSVn2RyzghQEATBdj1W4D 4aEwKkUZasiIOHe/6eTUpwJEpHRbTTikSWp4F/Fq0FgvbpwaKXCw+ic4gz7CjcHm t/3dHauByFt3A2Hz6hlnt8EEfH1k7RJSZmNVs5VrjZ7Xtg5tlz0= Received: from skull.home.blih.net (ip-9.net-89-3-105.rev.numericable.fr [89.3.105.9]) by mail.blih.net (OpenSMTPD) with ESMTPSA id b8d2786e TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Mon, 14 Oct 2019 18:45:26 +0200 (CEST) Date: Mon, 14 Oct 2019 18:45:26 +0200 From: Emmanuel Vadot To: Ruslan Bukin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353493 - head/sys/dev/mmc/host Message-Id: <20191014184526.e5f3798fd4d4f9c744f4a491@bidouilliste.com> In-Reply-To: <20191014162751.GA30496@bsdpad.com> References: <201910141553.x9EFr0Zb010167@repo.freebsd.org> <20191014181051.bd8c7a3dbb7b07a636d81ed9@bidouilliste.com> <20191014162751.GA30496@bsdpad.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46sPZ04S1Bz4ZJc X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bidouilliste.com header.s=mail header.b=izF4fEPd; dmarc=none; spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates 212.83.177.182 as permitted sender) smtp.mailfrom=manu@bidouilliste.com X-Spamd-Result: default: False [-0.54 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mail]; NEURAL_HAM_MEDIUM(-0.15)[-0.149,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:212.83.177.182/32]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MV_CASE(0.50)[]; DMARC_NA(0.00)[bidouilliste.com]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-0.86)[-0.864,0]; DKIM_TRACE(0.00)[bidouilliste.com:+]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; IP_SCORE(0.38)[ip: (-0.70), ipnet: 212.83.160.0/19(2.47), asn: 12876(0.12), country: FR(-0.00)]; ASN(0.00)[asn:12876, ipnet:212.83.160.0/19, country:FR]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 16:45:29 -0000 On Mon, 14 Oct 2019 17:27:51 +0100 Ruslan Bukin wrote: > On Mon, Oct 14, 2019 at 06:10:51PM +0200, Emmanuel Vadot wrote: > > > > On Mon, 14 Oct 2019 15:53:00 +0000 (UTC) > > Ruslan Bukin wrote: > > > > > Author: br > > > Date: Mon Oct 14 15:52:59 2019 > > > New Revision: 353493 > > > URL: https://svnweb.freebsd.org/changeset/base/353493 > > > > > > Log: > > > Fix the driver attachment in cases when the external resource devices > > > (resets, regulators, clocks) are not available. > > > > > > Rely on a system initialization done by a bootloader in that cases. > > > > > > This fixes operation on Terasic DE10-Pro (an Intel Stratix 10 > > > development kit). > > > > > > Sponsored by: DARPA, AFRL > > > > > > Modified: > > > head/sys/dev/mmc/host/dwmmc.c > > > > > > Modified: head/sys/dev/mmc/host/dwmmc.c > > > ============================================================================== > > > --- head/sys/dev/mmc/host/dwmmc.c Mon Oct 14 15:33:53 2019 (r353492) > > > +++ head/sys/dev/mmc/host/dwmmc.c Mon Oct 14 15:52:59 2019 (r353493) > > > @@ -1,5 +1,5 @@ > > > /*- > > > - * Copyright (c) 2014 Ruslan Bukin > > > + * Copyright (c) 2014-2019 Ruslan Bukin > > > * All rights reserved. > > > * > > > * This software was developed by SRI International and the University of > > > @@ -457,26 +457,20 @@ parse_fdt(struct dwmmc_softc *sc) > > > > > > /* IP block reset is optional */ > > > error = hwreset_get_by_ofw_name(sc->dev, 0, "reset", &sc->hwreset); > > > - if (error != 0 && error != ENOENT) { > > > + if (error != 0 && error != ENOENT) > > > device_printf(sc->dev, "Cannot get reset\n"); > > > - goto fail; > > > - } > > > > This is not correct, on a system without reset/clock/regulator support > > you will get ENODEV as the phandle is present but no device is > > associated with it. This is the case that you want to test. Currently > > this hide all errors. > > The change means that the driver will be attached regardless of the return value from ext resources. Yes and this is a problem. > Why it is not correct? Because if a reset/clock/regulator is present but we failed to parse the node (bad #clock-cell for example) this just assume that the resource isn't present which is not correct. Or worse the underlying gpio cannot be mapped, you now have a non functional driver because you cannot switch the regulator. > It does not hide all errors, the printf will be called and a user will be warned. If the ressources are present in the DTB and the system support them but they cannot be used the driver should fail. Which is why I suggest you to make an extra case on ENODEV even if I don't like that because it's hacky even for a platform that is, to my knowledge, not really supported (no u-boot port, dtb aren't build, not part of GENERIC). > Ruslan -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Mon Oct 14 17:15:43 2019 Return-Path: Delivered-To: svn-src-all@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 7BE751310CC; Mon, 14 Oct 2019 17:15:43 +0000 (UTC) (envelope-from dougm@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 46sQDv2f9lz4by0; Mon, 14 Oct 2019 17:15:43 +0000 (UTC) (envelope-from dougm@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 3E1E786C5; Mon, 14 Oct 2019 17:15:43 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9EHFhvf057672; Mon, 14 Oct 2019 17:15:43 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EHFh6M057671; Mon, 14 Oct 2019 17:15:43 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201910141715.x9EHFh6M057671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Mon, 14 Oct 2019 17:15:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353496 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353496 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 17:15:43 -0000 Author: dougm Date: Mon Oct 14 17:15:42 2019 New Revision: 353496 URL: https://svnweb.freebsd.org/changeset/base/353496 Log: Move the definition of _vm_map_assert_consistent so that it can use vm_map_free_{left,right} rather than re-implementing them. Use the VM_MAP_FOREACH macro where applicable. Fix some indentation. Suggested by: kib (in a comment on D21964) Tested by: pho (as part of D21964) Differential Revision: https://reviews.freebsd.org/D22011 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Mon Oct 14 16:37:41 2019 (r353495) +++ head/sys/vm/vm_map.c Mon Oct 14 17:15:42 2019 (r353496) @@ -739,47 +739,8 @@ static int enable_vmmap_check = 0; SYSCTL_INT(_debug, OID_AUTO, vmmap_check, CTLFLAG_RWTUN, &enable_vmmap_check, 0, "Enable vm map consistency checking"); -static void -_vm_map_assert_consistent(vm_map_t map) -{ - vm_map_entry_t child, entry, prev; - vm_size_t max_left, max_right; +static void _vm_map_assert_consistent(vm_map_t map); - if (!enable_vmmap_check) - return; - - for (prev = &map->header; (entry = prev->next) != &map->header; - prev = entry) { - KASSERT(prev->end <= entry->start, - ("map %p prev->end = %jx, start = %jx", map, - (uintmax_t)prev->end, (uintmax_t)entry->start)); - KASSERT(entry->start < entry->end, - ("map %p start = %jx, end = %jx", map, - (uintmax_t)entry->start, (uintmax_t)entry->end)); - KASSERT(entry->end <= entry->next->start, - ("map %p end = %jx, next->start = %jx", map, - (uintmax_t)entry->end, (uintmax_t)entry->next->start)); - KASSERT(entry->left == NULL || - entry->left->start < entry->start, - ("map %p left->start = %jx, start = %jx", map, - (uintmax_t)entry->left->start, (uintmax_t)entry->start)); - KASSERT(entry->right == NULL || - entry->start < entry->right->start, - ("map %p start = %jx, right->start = %jx", map, - (uintmax_t)entry->start, (uintmax_t)entry->right->start)); - child = entry->left; - max_left = (child != NULL) ? child->max_free : - entry->start - prev->end; - child = entry->right; - max_right = (child != NULL) ? child->max_free : - entry->next->start - entry->end; - KASSERT(entry->max_free == MAX(max_left, max_right), - ("map %p max = %jx, max_left = %jx, max_right = %jx", map, - (uintmax_t)entry->max_free, - (uintmax_t)max_left, (uintmax_t)max_right)); - } -} - #define VM_MAP_ASSERT_CONSISTENT(map) \ _vm_map_assert_consistent(map) #else @@ -4823,6 +4784,49 @@ vm_map_pmap_KBI(vm_map_t map) return (map->pmap); } +#ifdef INVARIANTS +static void +_vm_map_assert_consistent(vm_map_t map) +{ + vm_map_entry_t entry, prev; + vm_size_t max_left, max_right; + + if (!enable_vmmap_check) + return; + + prev = &map->header; + VM_MAP_ENTRY_FOREACH(entry, map) { + KASSERT(prev->end <= entry->start, + ("map %p prev->end = %jx, start = %jx", map, + (uintmax_t)prev->end, (uintmax_t)entry->start)); + KASSERT(entry->start < entry->end, + ("map %p start = %jx, end = %jx", map, + (uintmax_t)entry->start, (uintmax_t)entry->end)); + KASSERT(entry->end <= entry->next->start, + ("map %p end = %jx, next->start = %jx", map, + (uintmax_t)entry->end, (uintmax_t)entry->next->start)); + KASSERT(entry->left == NULL || + entry->left->start < entry->start, + ("map %p left->start = %jx, start = %jx", map, + (uintmax_t)entry->left->start, (uintmax_t)entry->start)); + KASSERT(entry->right == NULL || + entry->start < entry->right->start, + ("map %p start = %jx, right->start = %jx", map, + (uintmax_t)entry->start, (uintmax_t)entry->right->start)); + max_left = vm_map_entry_max_free_left(entry, lbound); + max_right = vm_map_entry_max_free_right(entry, ubound); + KASSERT(entry->max_free == MAX(max_left, max_right), + ("map %p max = %jx, max_left = %jx, max_right = %jx", map, + (uintmax_t)entry->max_free, + (uintmax_t)max_left, (uintmax_t)max_right)); + prev = entry; + } + KASSERT(prev->end <= entry->start, + ("map %p prev->end = %jx, start = %jx", map, + (uintmax_t)prev->end, (uintmax_t)entry->start)); +} +#endif + #include "opt_ddb.h" #ifdef DDB #include @@ -4839,8 +4843,8 @@ vm_map_print(vm_map_t map) (void *)map->pmap, map->nentries, map->timestamp); db_indent += 2; - for (prev = &map->header; (entry = prev->next) != &map->header; - prev = entry) { + prev = &map->header; + VM_MAP_ENTRY_FOREACH(entry, map) { db_iprintf("map entry %p: start=%p, end=%p, eflags=%#x, \n", (void *)entry, (void *)entry->start, (void *)entry->end, entry->eflags); @@ -4892,6 +4896,7 @@ vm_map_print(vm_map_t map) db_indent -= 2; } } + prev = entry; } db_indent -= 2; } From owner-svn-src-all@freebsd.org Mon Oct 14 17:51:58 2019 Return-Path: Delivered-To: svn-src-all@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 41E61131B78; Mon, 14 Oct 2019 17:51:58 +0000 (UTC) (envelope-from dougm@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 46sR2k15Yfz4djf; Mon, 14 Oct 2019 17:51:58 +0000 (UTC) (envelope-from dougm@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 0A68E8DE1; Mon, 14 Oct 2019 17:51:58 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9EHpvO6081309; Mon, 14 Oct 2019 17:51:57 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EHpvv9081308; Mon, 14 Oct 2019 17:51:57 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201910141751.x9EHpvv9081308@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Mon, 14 Oct 2019 17:51:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353497 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353497 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 17:51:58 -0000 Author: dougm Date: Mon Oct 14 17:51:57 2019 New Revision: 353497 URL: https://svnweb.freebsd.org/changeset/base/353497 Log: Correct a transcription error that broke GENERIC introduced in r353496. Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Mon Oct 14 17:15:42 2019 (r353496) +++ head/sys/vm/vm_map.c Mon Oct 14 17:51:57 2019 (r353497) @@ -4813,8 +4813,8 @@ _vm_map_assert_consistent(vm_map_t map) entry->start < entry->right->start, ("map %p start = %jx, right->start = %jx", map, (uintmax_t)entry->start, (uintmax_t)entry->right->start)); - max_left = vm_map_entry_max_free_left(entry, lbound); - max_right = vm_map_entry_max_free_right(entry, ubound); + max_left = vm_map_entry_max_free_left(entry, entry->prev); + max_right = vm_map_entry_max_free_right(entry, entry->next); KASSERT(entry->max_free == MAX(max_left, max_right), ("map %p max = %jx, max_left = %jx, max_right = %jx", map, (uintmax_t)entry->max_free, From owner-svn-src-all@freebsd.org Mon Oct 14 18:02:56 2019 Return-Path: Delivered-To: svn-src-all@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 CEA8A131E44; Mon, 14 Oct 2019 18:02:56 +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 46sRHN4Jfmz4fQk; Mon, 14 Oct 2019 18:02:56 +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 76FDB8FDE; Mon, 14 Oct 2019 18:02:56 +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 x9EI2unH087089; Mon, 14 Oct 2019 18:02:56 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EI2uj3087088; Mon, 14 Oct 2019 18:02:56 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910141802.x9EI2uj3087088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 14 Oct 2019 18:02:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353498 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 353498 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 18:02:56 -0000 Author: jhb Date: Mon Oct 14 18:02:56 2019 New Revision: 353498 URL: https://svnweb.freebsd.org/changeset/base/353498 Log: Remove an unused parameter from get_new_keyid(). Modified: head/sys/dev/cxgbe/tom/t4_tls.c Modified: head/sys/dev/cxgbe/tom/t4_tls.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tls.c Mon Oct 14 17:51:57 2019 (r353497) +++ head/sys/dev/cxgbe/tom/t4_tls.c Mon Oct 14 18:02:56 2019 (r353498) @@ -440,7 +440,7 @@ prepare_txkey_wr(struct tls_keyctx *kwr, struct tls_ke /* TLS Key memory management */ static int -get_new_keyid(struct toepcb *toep, struct tls_key_context *k_ctx) +get_new_keyid(struct toepcb *toep) { struct adapter *sc = td_adapter(toep->td); vmem_addr_t addr; @@ -511,7 +511,7 @@ tls_program_key_id(struct toepcb *toep, struct tls_key /* Dont initialize key for re-neg */ if (!G_KEY_CLR_LOC(k_ctx->l_p_key)) { - if ((keyid = get_new_keyid(toep, k_ctx)) < 0) { + if ((keyid = get_new_keyid(toep)) < 0) { return (ENOSPC); } } else { From owner-svn-src-all@freebsd.org Mon Oct 14 18:31:12 2019 Return-Path: Delivered-To: svn-src-all@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 4B96F132CA7; Mon, 14 Oct 2019 18:31:12 +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 46sRw00zWqz3CZh; Mon, 14 Oct 2019 18:31:12 +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 058FA94D9; Mon, 14 Oct 2019 18:31:12 +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 x9EIVB8Z001733; Mon, 14 Oct 2019 18:31:11 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EIVBnf001732; Mon, 14 Oct 2019 18:31:11 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910141831.x9EIVBnf001732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 14 Oct 2019 18:31:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353499 - head X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 353499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 18:31:12 -0000 Author: jhb Date: Mon Oct 14 18:31:11 2019 New Revision: 353499 URL: https://svnweb.freebsd.org/changeset/base/353499 Log: Remove the aarch64 libclang_rt.profile library from llvm 8.0.1. Reported by: np Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Mon Oct 14 18:02:56 2019 (r353498) +++ head/ObsoleteFiles.inc Mon Oct 14 18:31:11 2019 (r353499) @@ -167,6 +167,7 @@ OLD_FILES+=usr/lib/clang/8.0.1/lib/freebsd/libclang_rt OLD_FILES+=usr/lib/clang/8.0.1/lib/freebsd/libclang_rt.asan_cxx-x86_64.a OLD_FILES+=usr/lib/clang/8.0.1/lib/freebsd/libclang_rt.msan-x86_64.a OLD_FILES+=usr/lib/clang/8.0.1/lib/freebsd/libclang_rt.msan_cxx-x86_64.a +OLD_FILES+=usr/lib/clang/8.0.1/lib/freebsd/libclang_rt.profile-aarch64.a OLD_FILES+=usr/lib/clang/8.0.1/lib/freebsd/libclang_rt.profile-arm.a OLD_FILES+=usr/lib/clang/8.0.1/lib/freebsd/libclang_rt.profile-armhf.a OLD_FILES+=usr/lib/clang/8.0.1/lib/freebsd/libclang_rt.profile-i386.a From owner-svn-src-all@freebsd.org Mon Oct 14 19:06:18 2019 Return-Path: Delivered-To: svn-src-all@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 C48041345AF; Mon, 14 Oct 2019 19:06:18 +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 46sShV4nBvz3GDJ; Mon, 14 Oct 2019 19:06:18 +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 82C8E9B05; Mon, 14 Oct 2019 19:06:18 +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 x9EJ6ISn023570; Mon, 14 Oct 2019 19:06:18 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EJ6Ins023569; Mon, 14 Oct 2019 19:06:18 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201910141906.x9EJ6Ins023569@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Mon, 14 Oct 2019 19:06:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353500 - in head/sys/powerpc: aim powerpc X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: in head/sys/powerpc: aim powerpc X-SVN-Commit-Revision: 353500 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 19:06:18 -0000 Author: luporl Date: Mon Oct 14 19:06:17 2019 New Revision: 353500 URL: https://svnweb.freebsd.org/changeset/base/353500 Log: Fix powerpc/powerpcspe builds Revision 353489 introduced some new function calls in common powerpc code, but these must be called only on powerpc64. Modified: head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/powerpc/uma_machdep.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Mon Oct 14 18:31:11 2019 (r353499) +++ head/sys/powerpc/aim/mmu_oea64.c Mon Oct 14 19:06:17 2019 (r353500) @@ -2943,6 +2943,8 @@ moea64_scan_init(mmu_t mmu) } } +#ifdef __powerpc64__ + static size_t moea64_scan_pmap(mmu_t mmu) { @@ -3009,3 +3011,19 @@ moea64_dump_pmap_init(mmu_t mmu, unsigned blkpgs) dump_ctx.blksz = blkpgs * PAGE_SIZE; return (&dump_ctx); } + +#else + +static size_t +moea64_scan_pmap(mmu_t mmu) +{ + return (0); +} + +static void * +moea64_dump_pmap_init(mmu_t mmu, unsigned blkpgs) +{ + return (NULL); +} + +#endif Modified: head/sys/powerpc/powerpc/uma_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/uma_machdep.c Mon Oct 14 18:31:11 2019 (r353499) +++ head/sys/powerpc/powerpc/uma_machdep.c Mon Oct 14 19:06:17 2019 (r353500) @@ -71,8 +71,10 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int if ((vm_offset_t)pa != pa) return (NULL); +#ifdef __powerpc64__ if ((wait & M_NODUMP) == 0) dump_add_page(pa); +#endif if (!hw_direct_map) { pmap_kenter(pa, pa); @@ -103,7 +105,9 @@ uma_small_free(void *mem, vm_size_t size, u_int8_t fla m = PHYS_TO_VM_PAGE((vm_offset_t)mem); KASSERT(m != NULL, ("Freeing UMA block at %p with no associated page", mem)); - dump_add_page(VM_PAGE_TO_PHYS(m)); +#ifdef __powerpc64__ + dump_drop_page(VM_PAGE_TO_PHYS(m)); +#endif vm_page_unwire_noq(m); vm_page_free(m); atomic_subtract_int(&hw_uma_mdpages, 1); From owner-svn-src-all@freebsd.org Mon Oct 14 19:17:02 2019 Return-Path: Delivered-To: svn-src-all@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 094751348BD; Mon, 14 Oct 2019 19:17: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 46sSwt02GBz3Gp5; Mon, 14 Oct 2019 19:17: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 D835B9CBF; Mon, 14 Oct 2019 19:17:01 +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 x9EJH1QV029333; Mon, 14 Oct 2019 19:17:01 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EJH0vQ029327; Mon, 14 Oct 2019 19:17:00 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201910141917.x9EJH0vQ029327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 14 Oct 2019 19:17:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353501 - in stable/12/stand: efi/boot1 efi/include efi/libefi efi/loader efi/loader/arch/i386 libsa X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in stable/12/stand: efi/boot1 efi/include efi/libefi efi/loader efi/loader/arch/i386 libsa X-SVN-Commit-Revision: 353501 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 19:17:02 -0000 Author: tsoome Date: Mon Oct 14 19:17:00 2019 New Revision: 353501 URL: https://svnweb.freebsd.org/changeset/base/353501 Log: loader.efi: Block IO should honor align_io MFC: r347195, r350654, r350655, r350656, r351274, r351630, r351637 r352421, r352439, r352443, r352444, r352445, r352446, r352451 We need to bring in a bit more than just align_io change. Modified: stable/12/stand/efi/boot1/boot1.c stable/12/stand/efi/include/efilib.h stable/12/stand/efi/libefi/devpath.c stable/12/stand/efi/libefi/efinet.c stable/12/stand/efi/libefi/efipart.c stable/12/stand/efi/libefi/libefi.c stable/12/stand/efi/loader/arch/i386/efimd.c stable/12/stand/efi/loader/efi_main.c stable/12/stand/efi/loader/framebuffer.c stable/12/stand/efi/loader/main.c stable/12/stand/libsa/stand.h stable/12/stand/libsa/zalloc.c stable/12/stand/libsa/zalloc_defs.h stable/12/stand/libsa/zalloc_malloc.c stable/12/stand/libsa/zalloc_mem.h stable/12/stand/libsa/zalloc_protos.h Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/boot1/boot1.c ============================================================================== --- stable/12/stand/efi/boot1/boot1.c Mon Oct 14 19:06:17 2019 (r353500) +++ stable/12/stand/efi/boot1/boot1.c Mon Oct 14 19:17:00 2019 (r353501) @@ -246,8 +246,9 @@ try_boot(void) 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; @@ -306,7 +307,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B UINTN i; /* 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 (status); @@ -322,7 +323,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B efi_free_devpath_name(text); } #endif - status = BS->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); + status = OpenProtocolByHandle(h, &BlockIoProtocolGUID, (void **)&blkio); if (status == EFI_UNSUPPORTED) return (status); @@ -445,7 +446,7 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) putchar('\n'); /* 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); @@ -455,8 +456,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)); Modified: stable/12/stand/efi/include/efilib.h ============================================================================== --- stable/12/stand/efi/include/efilib.h Mon Oct 14 19:06:17 2019 (r353500) +++ stable/12/stand/efi/include/efilib.h Mon Oct 14 19:17:00 2019 (r353501) @@ -69,6 +69,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); @@ -92,6 +93,7 @@ CHAR16 *efi_devpath_name(EFI_DEVICE_PATH *); void efi_free_devpath_name(CHAR16 *); EFI_DEVICE_PATH *efi_devpath_to_media_path(EFI_DEVICE_PATH *); UINTN efi_devpath_length(EFI_DEVICE_PATH *); +EFI_HANDLE efi_devpath_to_handle(EFI_DEVICE_PATH *path, EFI_HANDLE *handles, unsigned nhandles); int efi_status_to_errno(EFI_STATUS); EFI_STATUS errno_to_efi_status(int errno); Modified: stable/12/stand/efi/libefi/devpath.c ============================================================================== --- stable/12/stand/efi/libefi/devpath.c Mon Oct 14 19:06:17 2019 (r353500) +++ stable/12/stand/efi/libefi/devpath.c Mon Oct 14 19:17:00 2019 (r353501) @@ -42,8 +42,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); @@ -55,7 +55,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); @@ -228,4 +229,26 @@ efi_devpath_length(EFI_DEVICE_PATH *path) while (!IsDevicePathEnd(path)) path = NextDevicePathNode(path); return ((UINTN)path - (UINTN)start) + DevicePathNodeLength(path); +} + +EFI_HANDLE +efi_devpath_to_handle(EFI_DEVICE_PATH *path, EFI_HANDLE *handles, unsigned nhandles) +{ + unsigned i; + EFI_DEVICE_PATH *media, *devpath; + EFI_HANDLE h; + + media = efi_devpath_to_media_path(path); + if (media == NULL) + return (NULL); + for (i = 0; i < nhandles; i++) { + h = handles[i]; + devpath = efi_lookup_devpath(h); + if (devpath == NULL) + continue; + if (!efi_devpath_match_node(media, efi_devpath_to_media_path(devpath))) + continue; + return (h); + } + return (NULL); } Modified: stable/12/stand/efi/libefi/efinet.c ============================================================================== --- stable/12/stand/efi/libefi/efinet.c Mon Oct 14 19:06:17 2019 (r353500) +++ stable/12/stand/efi/libefi/efinet.c Mon Oct 14 19:17:00 2019 (r353501) @@ -195,7 +195,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: stable/12/stand/efi/libefi/efipart.c ============================================================================== --- stable/12/stand/efi/libefi/efipart.c Mon Oct 14 19:06:17 2019 (r353500) +++ stable/12/stand/efi/libefi/efipart.c Mon Oct 14 19:17:00 2019 (r353501) @@ -64,6 +64,9 @@ static int efipart_printhd(int); #define PNP0700 0x700 #define PNP0701 0x701 +/* Bounce buffer max size */ +#define BIO_BUFFER_SIZE 0x4000 + struct devsw efipart_fddev = { .dv_name = "fd", .dv_type = DEVT_FD, @@ -100,12 +103,18 @@ struct devsw efipart_hddev = { .dv_cleanup = NULL }; -static pdinfo_list_t fdinfo; -static pdinfo_list_t cdinfo; -static pdinfo_list_t hdinfo; +static pdinfo_list_t fdinfo = STAILQ_HEAD_INITIALIZER(fdinfo); +static pdinfo_list_t cdinfo = STAILQ_HEAD_INITIALIZER(cdinfo); +static pdinfo_list_t hdinfo = STAILQ_HEAD_INITIALIZER(hdinfo); -static EFI_HANDLE *efipart_handles = NULL; -static UINTN efipart_nhandles = 0; +/* + * efipart_inithandles() is used to build up the pdinfo list from + * block device handles. Then each devsw init callback is used to + * pick items from pdinfo and move to proper device list. + * In ideal world, we should end up with empty pdinfo once all + * devsw initializers are called. + */ +static pdinfo_list_t pdinfo = STAILQ_HEAD_INITIALIZER(pdinfo); pdinfo_list_t * efiblk_get_pdinfo_list(struct devsw *dev) @@ -140,23 +149,14 @@ efiblk_get_pdinfo(struct devdesc *dev) pdinfo_t * efiblk_get_pdinfo_by_device_path(EFI_DEVICE_PATH *path) { - unsigned i; - EFI_DEVICE_PATH *media, *devpath; EFI_HANDLE h; + EFI_STATUS status; + EFI_DEVICE_PATH *devp = path; - media = efi_devpath_to_media_path(path); - if (media == NULL) + status = BS->LocateDevicePath(&blkio_guid, &devp, &h); + if (EFI_ERROR(status)) return (NULL); - for (i = 0; i < efipart_nhandles; i++) { - h = efipart_handles[i]; - devpath = efi_lookup_devpath(h); - if (devpath == NULL) - continue; - if (!efi_devpath_match_node(media, efi_devpath_to_media_path(devpath))) - continue; - return (efiblk_get_pdinfo_by_handle(h)); - } - return (NULL); + return (efiblk_get_pdinfo_by_handle(h)); } static bool @@ -185,6 +185,10 @@ efiblk_get_pdinfo_by_handle(EFI_HANDLE h) STAILQ_FOREACH(dp, &cdinfo, pd_link) { if (same_handle(dp, h)) return (dp); + STAILQ_FOREACH(pp, &dp->pd_part, pd_link) { + if (same_handle(pp, h)) + return (pp); + } } STAILQ_FOREACH(dp, &fdinfo, pd_link) { if (same_handle(dp, h)) @@ -208,15 +212,16 @@ efiblk_pdinfo_count(pdinfo_list_t *pdi) int efipart_inithandles(void) { + unsigned i, nin; UINTN sz; EFI_HANDLE *hin; + EFI_DEVICE_PATH *devpath; + EFI_BLOCK_IO *blkio; EFI_STATUS status; + pdinfo_t *pd; - if (efipart_nhandles != 0) { - free(efipart_handles); - efipart_handles = NULL; - efipart_nhandles = 0; - } + if (!STAILQ_EMPTY(&pdinfo)) + return (0); sz = 0; hin = NULL; @@ -231,12 +236,60 @@ efipart_inithandles(void) if (EFI_ERROR(status)) return (efi_status_to_errno(status)); - efipart_handles = hin; - efipart_nhandles = sz / sizeof(*hin); + nin = sz / sizeof(*hin); #ifdef EFIPART_DEBUG - printf("%s: Got %d BLOCK IO MEDIA handle(s)\n", __func__, - efipart_nhandles); + printf("%s: Got %d BLOCK IO MEDIA handle(s)\n", __func__, nin); #endif + + for (i = 0; i < nin; i++) { + /* + * Get devpath and open protocol. + * We should not get errors here + */ + if ((devpath = efi_lookup_devpath(hin[i])) == NULL) + continue; + + status = OpenProtocolByHandle(hin[i], &blkio_guid, + (void **)&blkio); + if (EFI_ERROR(status)) { + printf("error %lu\n", EFI_ERROR_CODE(status)); + continue; + } + + /* + * We assume the block size 512 or greater power of 2. + * Also skip devices with block size > 64k (16 is max + * ashift supported by zfs). + * iPXE is known to insert stub BLOCK IO device with + * BlockSize 1. + */ + if (blkio->Media->BlockSize < 512 || + blkio->Media->BlockSize > (1 << 16) || + !powerof2(blkio->Media->BlockSize)) { + continue; + } + + /* Allowed values are 0, 1 and power of 2. */ + if (blkio->Media->IoAlign > 1 && + !powerof2(blkio->Media->IoAlign)) { + continue; + } + + /* This is bad. */ + if ((pd = calloc(1, sizeof(*pd))) == NULL) { + printf("efipart_inithandles: Out of memory.\n"); + free(hin); + return (ENOMEM); + } + STAILQ_INIT(&pd->pd_part); + + pd->pd_handle = hin[i]; + pd->pd_devpath = devpath; + pd->pd_blkio = blkio; + STAILQ_INSERT_TAIL(&pdinfo, pd, pd_link); + } + + free(hin); return (0); } @@ -257,134 +310,49 @@ efipart_floppy(EFI_DEVICE_PATH *node) return (NULL); } -/* - * Determine if the provided device path is hdd. - * - * There really is no simple fool proof way to classify the devices. - * Since we do build three lists of devices - floppy, cd and hdd, we - * will try to see if the device is floppy or cd, and list anything else - * as hdd. - */ -static bool -efipart_hdd(EFI_DEVICE_PATH *dp) +static pdinfo_t * +efipart_find_parent(pdinfo_list_t *pdi, EFI_DEVICE_PATH *devpath) { - unsigned i; - EFI_DEVICE_PATH *devpath, *node; - EFI_BLOCK_IO *blkio; - EFI_STATUS status; + pdinfo_t *pd; - if (dp == NULL) - return (false); - - if ((node = efi_devpath_last_node(dp)) == NULL) - return (false); - - if (efipart_floppy(node) != NULL) - return (false); - - /* - * Test every EFI BLOCK IO handle to make sure dp is not device path - * for CD/DVD. - */ - for (i = 0; i < efipart_nhandles; i++) { - devpath = efi_lookup_devpath(efipart_handles[i]); - if (devpath == NULL) - return (false); - - /* Only continue testing when dp is prefix in devpath. */ - if (!efi_devpath_is_prefix(dp, devpath)) - continue; - - /* - * The device path has to have last node describing the - * device, or we can not test the type. - */ - if ((node = efi_devpath_last_node(devpath)) == NULL) - return (false); - - if (DevicePathType(node) == MEDIA_DEVICE_PATH && - DevicePathSubType(node) == MEDIA_CDROM_DP) { - return (false); - } - - /* Make sure we do have the media. */ - status = BS->HandleProtocol(efipart_handles[i], - &blkio_guid, (void **)&blkio); - if (EFI_ERROR(status)) - return (false); - - /* USB or SATA cd without the media. */ - if (blkio->Media->RemovableMedia && - !blkio->Media->MediaPresent) { - return (false); - } - - /* - * We assume the block size 512 or greater power of 2. - * iPXE is known to insert stub BLOCK IO device with - * BlockSize 1. - */ - if (blkio->Media->BlockSize < 512 || - !powerof2(blkio->Media->BlockSize)) { - return (false); - } + STAILQ_FOREACH(pd, pdi, pd_link) { + if (efi_devpath_is_prefix(pd->pd_devpath, devpath)) + return (pd); } - return (true); + return (NULL); } -/* - * Add or update entries with new handle data. - */ static int -efipart_fdinfo_add(EFI_HANDLE handle, uint32_t uid, EFI_DEVICE_PATH *devpath) +efipart_initfd(void) { - pdinfo_t *fd; - - fd = calloc(1, sizeof(pdinfo_t)); - if (fd == NULL) { - printf("Failed to register floppy %d, out of memory\n", uid); - return (ENOMEM); - } - STAILQ_INIT(&fd->pd_part); - - fd->pd_unit = uid; - fd->pd_handle = handle; - fd->pd_devpath = devpath; - fd->pd_parent = NULL; - fd->pd_devsw = &efipart_fddev; - STAILQ_INSERT_TAIL(&fdinfo, fd, pd_link); - return (0); -} - -static void -efipart_updatefd(void) -{ - EFI_DEVICE_PATH *devpath, *node; + EFI_DEVICE_PATH *node; ACPI_HID_DEVICE_PATH *acpi; - int i; + pdinfo_t *parent, *fd; - for (i = 0; i < efipart_nhandles; i++) { - devpath = efi_lookup_devpath(efipart_handles[i]); - if (devpath == NULL) +restart: + STAILQ_FOREACH(fd, &pdinfo, pd_link) { + if ((node = efi_devpath_last_node(fd->pd_devpath)) == NULL) continue; - if ((node = efi_devpath_last_node(devpath)) == NULL) + if ((acpi = efipart_floppy(node)) == NULL) continue; - if ((acpi = efipart_floppy(node)) != NULL) { - efipart_fdinfo_add(efipart_handles[i], acpi->UID, - devpath); + + STAILQ_REMOVE(&pdinfo, fd, pdinfo, pd_link); + parent = efipart_find_parent(&pdinfo, fd->pd_devpath); + if (parent != NULL) { + STAILQ_REMOVE(&pdinfo, parent, pdinfo, pd_link); + parent->pd_alias = fd->pd_handle; + parent->pd_unit = acpi->UID; + free(fd); + fd = parent; + } else { + fd->pd_unit = acpi->UID; } + fd->pd_devsw = &efipart_fddev; + STAILQ_INSERT_TAIL(&fdinfo, fd, pd_link); + goto restart; } -} -static int -efipart_initfd(void) -{ - - STAILQ_INIT(&fdinfo); - - efipart_updatefd(); - bcache_add_dev(efiblk_pdinfo_count(&fdinfo)); return (0); } @@ -392,68 +360,90 @@ efipart_initfd(void) /* * Add or update entries with new handle data. */ -static int -efipart_cdinfo_add(EFI_HANDLE handle, EFI_HANDLE alias, - EFI_DEVICE_PATH *devpath) +static void +efipart_cdinfo_add(pdinfo_t *cd) { - int unit; - pdinfo_t *cd; - pdinfo_t *pd; + pdinfo_t *pd, *last; - unit = 0; STAILQ_FOREACH(pd, &cdinfo, pd_link) { - if (efi_devpath_match(pd->pd_devpath, devpath) == true) { - pd->pd_handle = handle; - pd->pd_alias = alias; - return (0); + if (efi_devpath_is_prefix(pd->pd_devpath, cd->pd_devpath)) { + last = STAILQ_LAST(&pd->pd_part, pdinfo, pd_link); + if (last != NULL) + cd->pd_unit = last->pd_unit + 1; + else + cd->pd_unit = 0; + cd->pd_parent = pd; + cd->pd_devsw = &efipart_cddev; + STAILQ_INSERT_TAIL(&pd->pd_part, cd, pd_link); + return; } - unit++; } - cd = calloc(1, sizeof(pdinfo_t)); - if (cd == NULL) { - printf("Failed to add cd %d, out of memory\n", unit); - return (ENOMEM); - } - STAILQ_INIT(&cd->pd_part); + last = STAILQ_LAST(&cdinfo, pdinfo, pd_link); + if (last != NULL) + cd->pd_unit = last->pd_unit + 1; + else + cd->pd_unit = 0; - cd->pd_handle = handle; - cd->pd_unit = unit; - cd->pd_alias = alias; - cd->pd_devpath = devpath; cd->pd_parent = NULL; cd->pd_devsw = &efipart_cddev; STAILQ_INSERT_TAIL(&cdinfo, cd, pd_link); - return (0); } +static bool +efipart_testcd(EFI_DEVICE_PATH *node, EFI_BLOCK_IO *blkio) +{ + if (DevicePathType(node) == MEDIA_DEVICE_PATH && + DevicePathSubType(node) == MEDIA_CDROM_DP) { + return (true); + } + + /* cd drive without the media. */ + if (blkio->Media->RemovableMedia && + !blkio->Media->MediaPresent) { + return (true); + } + + return (false); +} + static void efipart_updatecd(void) { - int i; - EFI_DEVICE_PATH *devpath, *devpathcpy, *tmpdevpath, *node; - EFI_HANDLE handle; - EFI_BLOCK_IO *blkio; + EFI_DEVICE_PATH *devpath, *node; EFI_STATUS status; + pdinfo_t *parent, *cd; - for (i = 0; i < efipart_nhandles; i++) { - devpath = efi_lookup_devpath(efipart_handles[i]); - if (devpath == NULL) +restart: + STAILQ_FOREACH(cd, &pdinfo, pd_link) { + if ((node = efi_devpath_last_node(cd->pd_devpath)) == NULL) continue; - if ((node = efi_devpath_last_node(devpath)) == NULL) - continue; - if (efipart_floppy(node) != NULL) continue; - if (efipart_hdd(devpath)) - continue; + /* Is parent of this device already registered? */ + parent = efipart_find_parent(&cdinfo, cd->pd_devpath); + if (parent != NULL) { + STAILQ_REMOVE(&pdinfo, cd, pdinfo, pd_link); + efipart_cdinfo_add(cd); + goto restart; + } - status = BS->HandleProtocol(efipart_handles[i], - &blkio_guid, (void **)&blkio); - if (EFI_ERROR(status)) + if (!efipart_testcd(node, cd->pd_blkio)) continue; + + /* Find parent and unlink both parent and cd from pdinfo */ + STAILQ_REMOVE(&pdinfo, cd, pdinfo, pd_link); + parent = efipart_find_parent(&pdinfo, cd->pd_devpath); + if (parent != NULL) { + STAILQ_REMOVE(&pdinfo, parent, pdinfo, pd_link); + efipart_cdinfo_add(parent); + } + + if (parent == NULL) + parent = efipart_find_parent(&cdinfo, cd->pd_devpath); + /* * If we come across a logical partition of subtype CDROM * it doesn't refer to the CD filesystem itself, but rather @@ -462,132 +452,79 @@ efipart_updatecd(void) * that will be the CD filesystem. */ if (DevicePathType(node) == MEDIA_DEVICE_PATH && - DevicePathSubType(node) == MEDIA_CDROM_DP) { - devpathcpy = efi_devpath_trim(devpath); - if (devpathcpy == NULL) - continue; - tmpdevpath = devpathcpy; - status = BS->LocateDevicePath(&blkio_guid, &tmpdevpath, - &handle); - free(devpathcpy); - if (EFI_ERROR(status)) - continue; - devpath = efi_lookup_devpath(handle); - efipart_cdinfo_add(handle, efipart_handles[i], - devpath); - continue; - } + DevicePathSubType(node) == MEDIA_CDROM_DP && + parent == NULL) { + parent = calloc(1, sizeof(*parent)); + if (parent == NULL) { + printf("efipart_updatecd: out of memory\n"); + /* this device is lost but try again. */ + free(cd); + goto restart; + } - if (DevicePathType(node) == MESSAGING_DEVICE_PATH && - DevicePathSubType(node) == MSG_ATAPI_DP) { - efipart_cdinfo_add(efipart_handles[i], NULL, - devpath); - continue; + devpath = efi_devpath_trim(cd->pd_devpath); + if (devpath == NULL) { + printf("efipart_updatecd: out of memory\n"); + /* this device is lost but try again. */ + free(parent); + free(cd); + goto restart; + } + parent->pd_devpath = devpath; + status = BS->LocateDevicePath(&blkio_guid, + &parent->pd_devpath, &parent->pd_handle); + free(devpath); + if (EFI_ERROR(status)) { + printf("efipart_updatecd: error %lu\n", + EFI_ERROR_CODE(status)); + free(parent); + free(cd); + goto restart; + } + parent->pd_devpath = + efi_lookup_devpath(parent->pd_handle); + efipart_cdinfo_add(parent); } - /* USB or SATA cd without the media. */ - if (blkio->Media->RemovableMedia && - !blkio->Media->MediaPresent) { - efipart_cdinfo_add(efipart_handles[i], NULL, - devpath); - } + efipart_cdinfo_add(cd); + goto restart; } } static int efipart_initcd(void) { - - STAILQ_INIT(&cdinfo); - efipart_updatecd(); bcache_add_dev(efiblk_pdinfo_count(&cdinfo)); return (0); } -static int -efipart_hdinfo_add(EFI_HANDLE disk_handle, EFI_HANDLE part_handle) +static void +efipart_hdinfo_add(pdinfo_t *hd, HARDDRIVE_DEVICE_PATH *node) { - EFI_DEVICE_PATH *disk_devpath, *part_devpath; - HARDDRIVE_DEVICE_PATH *node; - int unit; - pdinfo_t *hd, *pd, *last; + pdinfo_t *pd, *last; - disk_devpath = efi_lookup_devpath(disk_handle); - if (disk_devpath == NULL) - return (ENOENT); - - if (part_handle != NULL) { - part_devpath = efi_lookup_devpath(part_handle); - if (part_devpath == NULL) - return (ENOENT); - node = (HARDDRIVE_DEVICE_PATH *) - efi_devpath_last_node(part_devpath); - if (node == NULL) - return (ENOENT); /* This should not happen. */ - } else { - part_devpath = NULL; - node = NULL; - } - - pd = calloc(1, sizeof(pdinfo_t)); - if (pd == NULL) { - printf("Failed to add disk, out of memory\n"); - return (ENOMEM); - } - STAILQ_INIT(&pd->pd_part); - - STAILQ_FOREACH(hd, &hdinfo, pd_link) { - if (efi_devpath_match(hd->pd_devpath, disk_devpath) == true) { - if (part_devpath == NULL) - return (0); - + STAILQ_FOREACH(pd, &hdinfo, pd_link) { + if (efi_devpath_is_prefix(pd->pd_devpath, hd->pd_devpath)) { /* Add the partition. */ - pd->pd_handle = part_handle; - pd->pd_unit = node->PartitionNumber; - pd->pd_devpath = part_devpath; - pd->pd_parent = hd; - pd->pd_devsw = &efipart_hddev; - STAILQ_INSERT_TAIL(&hd->pd_part, pd, pd_link); - return (0); + hd->pd_unit = node->PartitionNumber; + hd->pd_parent = pd; + hd->pd_devsw = &efipart_hddev; + STAILQ_INSERT_TAIL(&pd->pd_part, hd, pd_link); + return; } } last = STAILQ_LAST(&hdinfo, pdinfo, pd_link); if (last != NULL) - unit = last->pd_unit + 1; + hd->pd_unit = last->pd_unit + 1; else - unit = 0; + hd->pd_unit = 0; /* Add the disk. */ - hd = pd; - hd->pd_handle = disk_handle; - hd->pd_unit = unit; - hd->pd_devpath = disk_devpath; - hd->pd_parent = NULL; hd->pd_devsw = &efipart_hddev; STAILQ_INSERT_TAIL(&hdinfo, hd, pd_link); - - if (part_devpath == NULL) - return (0); - - pd = calloc(1, sizeof(pdinfo_t)); - if (pd == NULL) { - printf("Failed to add partition, out of memory\n"); - return (ENOMEM); - } - STAILQ_INIT(&pd->pd_part); - - /* Add the partition. */ - pd->pd_handle = part_handle; - pd->pd_unit = node->PartitionNumber; - pd->pd_devpath = part_devpath; - pd->pd_parent = hd; - pd->pd_devsw = &efipart_hddev; - STAILQ_INSERT_TAIL(&hd->pd_part, pd, pd_link); - - return (0); } /* @@ -596,40 +533,25 @@ efipart_hdinfo_add(EFI_HANDLE disk_handle, EFI_HANDLE * of typeN:M, where type is interface type, N is disk id * and M is partition id. */ -static int -efipart_hdinfo_add_filepath(EFI_HANDLE disk_handle) +static void +efipart_hdinfo_add_filepath(pdinfo_t *hd, FILEPATH_DEVICE_PATH *node) { - EFI_DEVICE_PATH *devpath; - FILEPATH_DEVICE_PATH *node; char *pathname, *p; - int unit, len; - pdinfo_t *pd, *last; + int len; + pdinfo_t *last; - /* First collect and verify all the data */ - if ((devpath = efi_lookup_devpath(disk_handle)) == NULL) - return (ENOENT); - node = (FILEPATH_DEVICE_PATH *)efi_devpath_last_node(devpath); - if (node == NULL) - return (ENOENT); /* This should not happen. */ - - pd = calloc(1, sizeof(pdinfo_t)); - if (pd == NULL) { - printf("Failed to add disk, out of memory\n"); - return (ENOMEM); - } - STAILQ_INIT(&pd->pd_part); last = STAILQ_LAST(&hdinfo, pdinfo, pd_link); if (last != NULL) - unit = last->pd_unit + 1; + hd->pd_unit = last->pd_unit + 1; else - unit = 0; + hd->pd_unit = 0; /* FILEPATH_DEVICE_PATH has 0 terminated string */ len = ucs2len(node->PathName); if ((pathname = malloc(len + 1)) == NULL) { printf("Failed to add disk, out of memory\n"); - free(pd); - return (ENOMEM); + free(hd); + return; } cpy16to8(node->PathName, pathname, len + 1); p = strchr(pathname, ':'); @@ -640,23 +562,19 @@ efipart_hdinfo_add_filepath(EFI_HANDLE disk_handle) * false, this code would need update. */ if (p == NULL) { /* no colon, add the disk */ - pd->pd_handle = disk_handle; - pd->pd_unit = unit; - pd->pd_devpath = devpath; - pd->pd_parent = NULL; - pd->pd_devsw = &efipart_hddev; - STAILQ_INSERT_TAIL(&hdinfo, pd, pd_link); + hd->pd_devsw = &efipart_hddev; + STAILQ_INSERT_TAIL(&hdinfo, hd, pd_link); free(pathname); - return (0); + return; } p++; /* skip the colon */ errno = 0; - unit = (int)strtol(p, NULL, 0); + hd->pd_unit = (int)strtol(p, NULL, 0); if (errno != 0) { printf("Bad unit number for partition \"%s\"\n", pathname); free(pathname); - free(pd); - return (EUNIT); + free(hd); + return; } /* @@ -668,80 +586,99 @@ efipart_hdinfo_add_filepath(EFI_HANDLE disk_handle) if (last == NULL) { printf("BUG: No disk for partition \"%s\"\n", pathname); free(pathname); - free(pd); - return (EINVAL); + free(hd); + return; } /* Add the partition. */ - pd->pd_handle = disk_handle; - pd->pd_unit = unit; - pd->pd_devpath = devpath; - pd->pd_parent = last; - pd->pd_devsw = &efipart_hddev; - STAILQ_INSERT_TAIL(&last->pd_part, pd, pd_link); + hd->pd_parent = last; + hd->pd_devsw = &efipart_hddev; + STAILQ_INSERT_TAIL(&last->pd_part, hd, pd_link); free(pathname); - return (0); } static void efipart_updatehd(void) { - int i; - EFI_DEVICE_PATH *devpath, *devpathcpy, *tmpdevpath, *node; - EFI_HANDLE handle; - EFI_BLOCK_IO *blkio; + EFI_DEVICE_PATH *devpath, *node; EFI_STATUS status; + pdinfo_t *parent, *hd; - for (i = 0; i < efipart_nhandles; i++) { - devpath = efi_lookup_devpath(efipart_handles[i]); - if (devpath == NULL) +restart: + STAILQ_FOREACH(hd, &pdinfo, pd_link) { + if ((node = efi_devpath_last_node(hd->pd_devpath)) == NULL) continue; - if ((node = efi_devpath_last_node(devpath)) == NULL) + if (efipart_floppy(node) != NULL) continue; - if (!efipart_hdd(devpath)) + if (efipart_testcd(node, hd->pd_blkio)) continue; - status = BS->HandleProtocol(efipart_handles[i], - &blkio_guid, (void **)&blkio); - if (EFI_ERROR(status)) - continue; + if (DevicePathType(node) == HARDWARE_DEVICE_PATH && + (DevicePathSubType(node) == HW_PCI_DP || + DevicePathSubType(node) == HW_VENDOR_DP)) { + STAILQ_REMOVE(&pdinfo, hd, pdinfo, pd_link); + efipart_hdinfo_add(hd, NULL); + goto restart; + } if (DevicePathType(node) == MEDIA_DEVICE_PATH && DevicePathSubType(node) == MEDIA_FILEPATH_DP) { - efipart_hdinfo_add_filepath(efipart_handles[i]); - continue; + STAILQ_REMOVE(&pdinfo, hd, pdinfo, pd_link); + efipart_hdinfo_add_filepath(hd, + (FILEPATH_DEVICE_PATH *)node); + goto restart; } + STAILQ_REMOVE(&pdinfo, hd, pdinfo, pd_link); + parent = efipart_find_parent(&pdinfo, hd->pd_devpath); + if (parent != NULL) { + STAILQ_REMOVE(&pdinfo, parent, pdinfo, pd_link); + efipart_hdinfo_add(parent, NULL); + } else { + parent = efipart_find_parent(&hdinfo, hd->pd_devpath); + } + if (DevicePathType(node) == MEDIA_DEVICE_PATH && - DevicePathSubType(node) == MEDIA_HARDDRIVE_DP) { - devpathcpy = efi_devpath_trim(devpath); - if (devpathcpy == NULL) - continue; - tmpdevpath = devpathcpy; - status = BS->LocateDevicePath(&blkio_guid, &tmpdevpath, - &handle); - free(devpathcpy); - if (EFI_ERROR(status)) - continue; - /* - * We do not support nested partitions. - */ - devpathcpy = efi_lookup_devpath(handle); - if (devpathcpy == NULL) - continue; - if ((node = efi_devpath_last_node(devpathcpy)) == NULL) - continue; + DevicePathSubType(node) == MEDIA_HARDDRIVE_DP && + parent == NULL) { + parent = calloc(1, sizeof(*parent)); + if (parent == NULL) { + printf("efipart_updatehd: out of memory\n"); + /* this device is lost but try again. */ + free(hd); + goto restart; + } - if (DevicePathType(node) == MEDIA_DEVICE_PATH && - DevicePathSubType(node) == MEDIA_HARDDRIVE_DP) - continue; + devpath = efi_devpath_trim(hd->pd_devpath); + if (devpath == NULL) { + printf("efipart_updatehd: out of memory\n"); + /* this device is lost but try again. */ + free(parent); + free(hd); + goto restart; + } - efipart_hdinfo_add(handle, efipart_handles[i]); - continue; + parent->pd_devpath = devpath; + status = BS->LocateDevicePath(&blkio_guid, + &parent->pd_devpath, &parent->pd_handle); + free(devpath); + if (EFI_ERROR(status)) { + printf("efipart_updatehd: error %lu\n", + EFI_ERROR_CODE(status)); + free(parent); + free(hd); + goto restart; + } + + parent->pd_devpath = + efi_lookup_devpath(&parent->pd_handle); + + efipart_hdinfo_add(parent, NULL); } - efipart_hdinfo_add(efipart_handles[i], NULL); + efipart_hdinfo_add(hd, (HARDDRIVE_DEVICE_PATH *)node); + goto restart; } } @@ -749,8 +686,6 @@ static int efipart_inithd(void) { - STAILQ_INIT(&hdinfo); - efipart_updatehd(); bcache_add_dev(efiblk_pdinfo_count(&hdinfo)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Oct 14 20:18:36 2019 Return-Path: Delivered-To: svn-src-all@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 E519D135F69; Mon, 14 Oct 2019 20:18:36 +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 46sVHw5VfQz3KW1; Mon, 14 Oct 2019 20:18:36 +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 9BDB7A759; Mon, 14 Oct 2019 20:18:36 +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 x9EKIaXC064518; Mon, 14 Oct 2019 20:18:36 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKIaFu064517; Mon, 14 Oct 2019 20:18:36 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142018.x9EKIaFu064517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 20:18:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353502 - head/sys/dev/mxge X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/mxge X-SVN-Commit-Revision: 353502 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:18:37 -0000 Author: glebius Date: Mon Oct 14 20:18:36 2019 New Revision: 353502 URL: https://svnweb.freebsd.org/changeset/base/353502 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: gallatin Modified: head/sys/dev/mxge/if_mxge.c Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Mon Oct 14 19:17:00 2019 (r353501) +++ head/sys/dev/mxge/if_mxge.c Mon Oct 14 20:18:36 2019 (r353502) @@ -1091,12 +1091,35 @@ mxge_change_promisc(mxge_softc_t *sc, int promisc) } } +struct mxge_add_maddr_ctx { + mxge_softc_t *sc; + int error; +}; + +static u_int +mxge_add_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct mxge_add_maddr_ctx *ctx = arg; + mxge_cmd_t cmd; + + if (ctx->error != 0) + return (0); + bcopy(LLADDR(sdl), &cmd.data0, 4); + bcopy(LLADDR(sdl) + 4, &cmd.data1, 2); + cmd.data0 = htonl(cmd.data0); + cmd.data1 = htonl(cmd.data1); + + ctx->error = mxge_send_cmd(ctx->sc, MXGEFW_JOIN_MULTICAST_GROUP, &cmd); + + return (1); +} + static void mxge_set_multicast_list(mxge_softc_t *sc) { - mxge_cmd_t cmd; - struct ifmultiaddr *ifma; + struct mxge_add_maddr_ctx ctx; struct ifnet *ifp = sc->ifp; + mxge_cmd_t cmd; int err; /* This firmware is known to not support multicast */ @@ -1129,28 +1152,16 @@ mxge_set_multicast_list(mxge_softc_t *sc) } /* Walk the multicast list, and add each address */ - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - &cmd.data0, 4); - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr) + 4, - &cmd.data1, 2); - cmd.data0 = htonl(cmd.data0); - cmd.data1 = htonl(cmd.data1); - err = mxge_send_cmd(sc, MXGEFW_JOIN_MULTICAST_GROUP, &cmd); - if (err != 0) { - device_printf(sc->dev, "Failed " - "MXGEFW_JOIN_MULTICAST_GROUP, error status:" - "%d\t", err); - /* abort, leaving multicast filtering off */ - if_maddr_runlock(ifp); - return; - } + ctx.sc = sc; + ctx.error = 0; + if_foreach_llmaddr(ifp, mxge_add_maddr, &ctx); + if (ctx.error != 0) { + device_printf(sc->dev, "Failed MXGEFW_JOIN_MULTICAST_GROUP, " + "error status:" "%d\t", ctx.error); + /* abort, leaving multicast filtering off */ + return; } - if_maddr_runlock(ifp); + /* Enable multicast filtering */ err = mxge_send_cmd(sc, MXGEFW_DISABLE_ALLMULTI, &cmd); if (err != 0) { From owner-svn-src-all@freebsd.org Mon Oct 14 20:21:03 2019 Return-Path: Delivered-To: svn-src-all@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 7BA821361BE; Mon, 14 Oct 2019 20:21:03 +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 46sVLl2mYgz3KgP; Mon, 14 Oct 2019 20:21:03 +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 42756A786; Mon, 14 Oct 2019 20:21:03 +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 x9EKL3hQ066106; Mon, 14 Oct 2019 20:21:03 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKL2s3066102; Mon, 14 Oct 2019 20:21:02 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142021.x9EKL2s3066102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 20:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353503 - in head/sys/dev: ixgbe ixl X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys/dev: ixgbe ixl X-SVN-Commit-Revision: 353503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:21:03 -0000 Author: glebius Date: Mon Oct 14 20:21:02 2019 New Revision: 353503 URL: https://svnweb.freebsd.org/changeset/base/353503 Log: Convert if_foreach_llmaddr() KPI. Reviewed by: erj Modified: head/sys/dev/ixgbe/if_ix.c head/sys/dev/ixl/if_iavf.c head/sys/dev/ixl/if_ixl.c head/sys/dev/ixl/ixl_pf_main.c Modified: head/sys/dev/ixgbe/if_ix.c ============================================================================== --- head/sys/dev/ixgbe/if_ix.c Mon Oct 14 20:18:36 2019 (r353502) +++ head/sys/dev/ixgbe/if_ix.c Mon Oct 14 20:21:02 2019 (r353503) @@ -2333,7 +2333,7 @@ ixgbe_if_promisc_set(if_ctx_t ctx, int flags) if (ifp->if_flags & IFF_ALLMULTI) mcnt = MAX_NUM_MULTICAST_ADDRESSES; else { - mcnt = if_multiaddr_count(ifp, MAX_NUM_MULTICAST_ADDRESSES); + mcnt = min(if_llmaddr_count(ifp), MAX_NUM_MULTICAST_ADDRESSES); } if (mcnt < MAX_NUM_MULTICAST_ADDRESSES) rctl &= (~IXGBE_FCTRL_MPE); @@ -3207,18 +3207,15 @@ ixgbe_config_delay_values(struct adapter *adapter) * * Called whenever multicast address list is updated. ************************************************************************/ -static int -ixgbe_mc_filter_apply(void *arg, struct ifmultiaddr *ifma, int count) +static u_int +ixgbe_mc_filter_apply(void *arg, struct sockaddr_dl *sdl, u_int count) { struct adapter *adapter = arg; struct ixgbe_mc_addr *mta = adapter->mta; - if (ifma->ifma_addr->sa_family != AF_LINK) - return (0); if (count == MAX_NUM_MULTICAST_ADDRESSES) return (0); - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - mta[count].addr, IXGBE_ETH_LENGTH_OF_ADDRESS); + bcopy(LLADDR(sdl), mta[count].addr, IXGBE_ETH_LENGTH_OF_ADDRESS); mta[count].vmdq = adapter->pool; return (1); @@ -3231,15 +3228,16 @@ ixgbe_if_multi_set(if_ctx_t ctx) struct ixgbe_mc_addr *mta; struct ifnet *ifp = iflib_get_ifp(ctx); u8 *update_ptr; - int mcnt = 0; u32 fctrl; + u_int mcnt; IOCTL_DEBUGOUT("ixgbe_if_multi_set: begin"); mta = adapter->mta; bzero(mta, sizeof(*mta) * MAX_NUM_MULTICAST_ADDRESSES); - mcnt = if_multi_apply(iflib_get_ifp(ctx), ixgbe_mc_filter_apply, adapter); + mcnt = if_foreach_llmaddr(iflib_get_ifp(ctx), ixgbe_mc_filter_apply, + adapter); fctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_FCTRL); fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); Modified: head/sys/dev/ixl/if_iavf.c ============================================================================== --- head/sys/dev/ixl/if_iavf.c Mon Oct 14 20:18:36 2019 (r353502) +++ head/sys/dev/ixl/if_iavf.c Mon Oct 14 20:21:02 2019 (r353503) @@ -1225,18 +1225,13 @@ iavf_if_update_admin_status(if_ctx_t ctx) iavf_enable_adminq_irq(hw); } -static int -iavf_mc_filter_apply(void *arg, struct ifmultiaddr *ifma, int count __unused) +static u_int +iavf_mc_filter_apply(void *arg, struct sockaddr_dl *sdl, u_int count __unused) { struct iavf_sc *sc = arg; - int error = 0; + int error; - if (ifma->ifma_addr->sa_family != AF_LINK) - return (0); - error = iavf_add_mac_filter(sc, - (u8*)LLADDR((struct sockaddr_dl *) ifma->ifma_addr), - IXL_FILTER_MC); - + error = iavf_add_mac_filter(sc, (u8*)LLADDR(sdl), IXL_FILTER_MC); return (!error); } @@ -1244,12 +1239,11 @@ static void iavf_if_multi_set(if_ctx_t ctx) { struct iavf_sc *sc = iflib_get_softc(ctx); - int mcnt = 0; IOCTL_DEBUGOUT("iavf_if_multi_set: begin"); - mcnt = if_multiaddr_count(iflib_get_ifp(ctx), MAX_MULTICAST_ADDR); - if (__predict_false(mcnt == MAX_MULTICAST_ADDR)) { + if (__predict_false(if_llmaddr_count(iflib_get_ifp(ctx)) >= + MAX_MULTICAST_ADDR)) { /* Delete MC filters and enable mulitcast promisc instead */ iavf_init_multi(sc); sc->promisc_flags |= FLAG_VF_MULTICAST_PROMISC; @@ -1261,9 +1255,8 @@ iavf_if_multi_set(if_ctx_t ctx) iavf_init_multi(sc); /* And (re-)install filters for all mcast addresses */ - mcnt = if_multi_apply(iflib_get_ifp(ctx), iavf_mc_filter_apply, sc); - - if (mcnt > 0) + if (if_foreach_llmaddr(iflib_get_ifp(ctx), iavf_mc_filter_apply, sc) > + 0) iavf_send_vc_msg(sc, IAVF_FLAG_AQ_ADD_MAC_FILTER); } @@ -1358,8 +1351,8 @@ iavf_if_promisc_set(if_ctx_t ctx, int flags) sc->promisc_flags = 0; - if (flags & IFF_ALLMULTI || - if_multiaddr_count(ifp, MAX_MULTICAST_ADDR) == MAX_MULTICAST_ADDR) + if (flags & IFF_ALLMULTI || if_llmaddr_count(ifp) >= + MAX_MULTICAST_ADDR) sc->promisc_flags |= FLAG_VF_MULTICAST_PROMISC; if (flags & IFF_PROMISC) sc->promisc_flags |= FLAG_VF_UNICAST_PROMISC; Modified: head/sys/dev/ixl/if_ixl.c ============================================================================== --- head/sys/dev/ixl/if_ixl.c Mon Oct 14 20:18:36 2019 (r353502) +++ head/sys/dev/ixl/if_ixl.c Mon Oct 14 20:21:02 2019 (r353503) @@ -122,7 +122,7 @@ static void ixl_if_vflr_handle(if_ctx_t ctx); #endif /*** Other ***/ -static int ixl_mc_filter_apply(void *arg, struct ifmultiaddr *ifma, int); +static u_int ixl_mc_filter_apply(void *, struct sockaddr_dl *, u_int); static void ixl_save_pf_tunables(struct ixl_pf *); static int ixl_allocate_pci_resources(struct ixl_pf *); @@ -1298,12 +1298,12 @@ ixl_if_multi_set(if_ctx_t ctx) struct ixl_pf *pf = iflib_get_softc(ctx); struct ixl_vsi *vsi = &pf->vsi; struct i40e_hw *hw = vsi->hw; - int mcnt = 0, flags; + int mcnt, flags; int del_mcnt; IOCTL_DEBUGOUT("ixl_if_multi_set: begin"); - mcnt = if_multiaddr_count(iflib_get_ifp(ctx), MAX_MULTICAST_ADDR); + mcnt = min(if_llmaddr_count(iflib_get_ifp(ctx)), MAX_MULTICAST_ADDR); /* Delete filters for removed multicast addresses */ del_mcnt = ixl_del_multi(vsi); vsi->num_macs -= del_mcnt; @@ -1315,8 +1315,7 @@ ixl_if_multi_set(if_ctx_t ctx) } /* (re-)install filters for all mcast addresses */ /* XXX: This bypasses filter count tracking code! */ - mcnt = if_multi_apply(iflib_get_ifp(ctx), ixl_mc_filter_apply, vsi); - + mcnt = if_foreach_llmaddr(iflib_get_ifp(ctx), ixl_mc_filter_apply, vsi); if (mcnt > 0) { vsi->num_macs += mcnt; flags = (IXL_FILTER_ADD | IXL_FILTER_USED | IXL_FILTER_MC); @@ -1504,8 +1503,8 @@ ixl_if_promisc_set(if_ctx_t ctx, int flags) if (flags & IFF_PROMISC) uni = multi = TRUE; - else if (flags & IFF_ALLMULTI || - if_multiaddr_count(ifp, MAX_MULTICAST_ADDR) == MAX_MULTICAST_ADDR) + else if (flags & IFF_ALLMULTI || if_llmaddr_count(ifp) >= + MAX_MULTICAST_ADDR) multi = TRUE; err = i40e_aq_set_vsi_unicast_promiscuous(hw, @@ -1634,15 +1633,12 @@ ixl_if_priv_ioctl(if_ctx_t ctx, u_long command, caddr_ return (error); } -static int -ixl_mc_filter_apply(void *arg, struct ifmultiaddr *ifma, int count __unused) +static u_int +ixl_mc_filter_apply(void *arg, struct sockaddr_dl *sdl, u_int count __unused) { struct ixl_vsi *vsi = arg; - if (ifma->ifma_addr->sa_family != AF_LINK) - return (0); - ixl_add_mc_filter(vsi, - (u8*)LLADDR((struct sockaddr_dl *) ifma->ifma_addr)); + ixl_add_mc_filter(vsi, (u8*)LLADDR(sdl)); return (1); } Modified: head/sys/dev/ixl/ixl_pf_main.c ============================================================================== --- head/sys/dev/ixl/ixl_pf_main.c Mon Oct 14 20:18:36 2019 (r353502) +++ head/sys/dev/ixl/ixl_pf_main.c Mon Oct 14 20:21:02 2019 (r353503) @@ -637,6 +637,16 @@ ixl_msix_adminq(void *arg) return (FILTER_HANDLED); } +static u_int +ixl_add_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct ixl_vsi *vsi = arg; + + ixl_add_mc_filter(vsi, (u8*)LLADDR(sdl)); + + return (1); +} + /********************************************************************* * Filter Routines * @@ -646,25 +656,17 @@ ixl_msix_adminq(void *arg) void ixl_add_multi(struct ixl_vsi *vsi) { - struct ifmultiaddr *ifma; struct ifnet *ifp = vsi->ifp; struct i40e_hw *hw = vsi->hw; int mcnt = 0, flags; IOCTL_DEBUGOUT("ixl_add_multi: begin"); - if_maddr_rlock(ifp); /* ** First just get a count, to decide if we ** we simply use multicast promiscuous. */ - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - mcnt++; - } - if_maddr_runlock(ifp); - + mcnt = if_llmaddr_count(ifp); if (__predict_false(mcnt >= MAX_MULTICAST_ADDR)) { /* delete existing MC filters */ ixl_del_hw_filters(vsi, mcnt); @@ -673,16 +675,7 @@ ixl_add_multi(struct ixl_vsi *vsi) return; } - mcnt = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - ixl_add_mc_filter(vsi, - (u8*)LLADDR((struct sockaddr_dl *) ifma->ifma_addr)); - mcnt++; - } - if_maddr_runlock(ifp); + mcnt = if_foreach_llmaddr(ifp, ixl_add_maddr, vsi); if (mcnt > 0) { flags = (IXL_FILTER_ADD | IXL_FILTER_USED | IXL_FILTER_MC); ixl_add_hw_filters(vsi, flags, mcnt); @@ -691,38 +684,33 @@ ixl_add_multi(struct ixl_vsi *vsi) IOCTL_DEBUGOUT("ixl_add_multi: end"); } +static u_int +ixl_match_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct ixl_mac_filter *f = arg; + + if (cmp_etheraddr(f->macaddr, (u8 *)LLADDR(sdl))) + return (1); + else + return (0); +} + int ixl_del_multi(struct ixl_vsi *vsi) { struct ifnet *ifp = vsi->ifp; - struct ifmultiaddr *ifma; struct ixl_mac_filter *f; int mcnt = 0; - bool match = FALSE; IOCTL_DEBUGOUT("ixl_del_multi: begin"); - /* Search for removed multicast addresses */ - if_maddr_rlock(ifp); - SLIST_FOREACH(f, &vsi->ftl, next) { - if ((f->flags & IXL_FILTER_USED) && (f->flags & IXL_FILTER_MC)) { - match = FALSE; - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - u8 *mc_addr = (u8 *)LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - if (cmp_etheraddr(f->macaddr, mc_addr)) { - match = TRUE; - break; - } - } - if (match == FALSE) { - f->flags |= IXL_FILTER_DEL; - mcnt++; - } + SLIST_FOREACH(f, &vsi->ftl, next) + if ((f->flags & IXL_FILTER_USED) && + (f->flags & IXL_FILTER_MC) && + (if_foreach_llmaddr(ifp, ixl_match_maddr, f) == 0)) { + f->flags |= IXL_FILTER_DEL; + mcnt++; } - } - if_maddr_runlock(ifp); if (mcnt > 0) ixl_del_hw_filters(vsi, mcnt); From owner-svn-src-all@freebsd.org Mon Oct 14 20:22:26 2019 Return-Path: Delivered-To: svn-src-all@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 C3E3513655C; Mon, 14 Oct 2019 20:22:26 +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 46sVNL4jYKz3LJY; Mon, 14 Oct 2019 20:22:26 +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 3BB0CA8FE; Mon, 14 Oct 2019 20:22:26 +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 x9EKMQIs069894; Mon, 14 Oct 2019 20:22:26 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKMQeo069893; Mon, 14 Oct 2019 20:22:26 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142022.x9EKMQeo069893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 20:22:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353504 - head/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Commit-Revision: 353504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:22:26 -0000 Author: glebius Date: Mon Oct 14 20:22:25 2019 New Revision: 353504 URL: https://svnweb.freebsd.org/changeset/base/353504 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: hselasky Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c Mon Oct 14 20:21:02 2019 (r353503) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c Mon Oct 14 20:22:25 2019 (r353504) @@ -734,21 +734,87 @@ void ipoib_mcast_restart_task(struct work_struct *work ipoib_mcast_restart(priv); } +struct ipoib_mcast_ctx { + struct ipoib_dev_priv *priv; + struct list_head remove_list; +}; + +static u_int +ipoib_process_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct ipoib_mcast_ctx *ctx = arg; + struct ipoib_dev_priv *priv = ctx->priv; + struct ipoib_mcast *mcast; + struct ib_sa_mcmember_rec rec; + union ib_gid mgid; + uint8_t *addr; + int addrlen; + + addr = LLADDR(sdl); + addrlen = sdl->sdl_alen; + if (!ipoib_mcast_addr_is_valid(addr, addrlen, + priv->dev->if_broadcastaddr)) + return (0); + + memcpy(mgid.raw, addr + 4, sizeof mgid); + + mcast = __ipoib_mcast_find(priv, &mgid); + if (!mcast || test_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags)) { + struct ipoib_mcast *nmcast; + + /* ignore group which is directly joined by userspace */ + if (test_bit(IPOIB_FLAG_UMCAST, &priv->flags) && + !ib_sa_get_mcmember_rec(priv->ca, priv->port, &mgid, &rec)) { + ipoib_dbg_mcast(priv, "ignoring multicast entry for mgid %16D\n", + mgid.raw, ":"); + return (0); + } + + /* Not found or send-only group, let's add a new entry */ + ipoib_dbg_mcast(priv, "adding multicast entry for mgid %16D\n", + mgid.raw, ":"); + + nmcast = ipoib_mcast_alloc(priv, 0); + if (!nmcast) { + ipoib_warn(priv, "unable to allocate memory for multicast structure\n"); + return (0); + } + + set_bit(IPOIB_MCAST_FLAG_FOUND, &nmcast->flags); + + nmcast->mcmember.mgid = mgid; + + if (mcast) { + /* Destroy the send only entry */ + list_move_tail(&mcast->list, &ctx->remove_list); + + rb_replace_node(&mcast->rb_node, + &nmcast->rb_node, + &priv->multicast_tree); + } else + __ipoib_mcast_add(priv, nmcast); + + list_add_tail(&nmcast->list, &priv->multicast_list); + } + + if (mcast) + set_bit(IPOIB_MCAST_FLAG_FOUND, &mcast->flags); + + return (1); +} + void ipoib_mcast_restart(struct ipoib_dev_priv *priv) { + struct ipoib_mcast_ctx ctx = { priv, + { &ctx.remove_list, &ctx.remove_list }}; struct ifnet *dev = priv->dev; - struct ifmultiaddr *ifma; struct ipoib_mcast *mcast, *tmcast; - LIST_HEAD(remove_list); - struct ib_sa_mcmember_rec rec; - int addrlen; ipoib_dbg_mcast(priv, "restarting multicast task flags 0x%lX\n", priv->flags); ipoib_mcast_stop_thread(priv, 0); - if_maddr_rlock(dev); spin_lock(&priv->lock); /* @@ -762,65 +828,9 @@ void ipoib_mcast_restart(struct ipoib_dev_priv *priv) clear_bit(IPOIB_MCAST_FLAG_FOUND, &mcast->flags); /* Mark all of the entries that are found or don't exist */ + ctx.priv = priv; + if_foreach_llmaddr(dev, ipoib_process_maddr, &ctx); - - CK_STAILQ_FOREACH(ifma, &dev->if_multiaddrs, ifma_link) { - union ib_gid mgid; - uint8_t *addr; - - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - addr = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - addrlen = ((struct sockaddr_dl *)ifma->ifma_addr)->sdl_alen; - if (!ipoib_mcast_addr_is_valid(addr, addrlen, - dev->if_broadcastaddr)) - continue; - - memcpy(mgid.raw, addr + 4, sizeof mgid); - - mcast = __ipoib_mcast_find(priv, &mgid); - if (!mcast || test_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags)) { - struct ipoib_mcast *nmcast; - - /* ignore group which is directly joined by userspace */ - if (test_bit(IPOIB_FLAG_UMCAST, &priv->flags) && - !ib_sa_get_mcmember_rec(priv->ca, priv->port, &mgid, &rec)) { - ipoib_dbg_mcast(priv, "ignoring multicast entry for mgid %16D\n", - mgid.raw, ":"); - continue; - } - - /* Not found or send-only group, let's add a new entry */ - ipoib_dbg_mcast(priv, "adding multicast entry for mgid %16D\n", - mgid.raw, ":"); - - nmcast = ipoib_mcast_alloc(priv, 0); - if (!nmcast) { - ipoib_warn(priv, "unable to allocate memory for multicast structure\n"); - continue; - } - - set_bit(IPOIB_MCAST_FLAG_FOUND, &nmcast->flags); - - nmcast->mcmember.mgid = mgid; - - if (mcast) { - /* Destroy the send only entry */ - list_move_tail(&mcast->list, &remove_list); - - rb_replace_node(&mcast->rb_node, - &nmcast->rb_node, - &priv->multicast_tree); - } else - __ipoib_mcast_add(priv, nmcast); - - list_add_tail(&nmcast->list, &priv->multicast_list); - } - - if (mcast) - set_bit(IPOIB_MCAST_FLAG_FOUND, &mcast->flags); - } - /* Remove all of the entries don't exist anymore */ list_for_each_entry_safe(mcast, tmcast, &priv->multicast_list, list) { if (!test_bit(IPOIB_MCAST_FLAG_FOUND, &mcast->flags) && @@ -831,15 +841,14 @@ void ipoib_mcast_restart(struct ipoib_dev_priv *priv) rb_erase(&mcast->rb_node, &priv->multicast_tree); /* Move to the remove list */ - list_move_tail(&mcast->list, &remove_list); + list_move_tail(&mcast->list, &ctx.remove_list); } } spin_unlock(&priv->lock); - if_maddr_runlock(dev); /* We have to cancel outside of the spinlock */ - list_for_each_entry_safe(mcast, tmcast, &remove_list, list) { + list_for_each_entry_safe(mcast, tmcast, &ctx.remove_list, list) { ipoib_mcast_leave(mcast->priv, mcast); ipoib_mcast_free(mcast); } From owner-svn-src-all@freebsd.org Mon Oct 14 20:23:16 2019 Return-Path: Delivered-To: svn-src-all@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 EA28D1367A7; Mon, 14 Oct 2019 20:23:16 +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 46sVPJ5rkjz3LW6; Mon, 14 Oct 2019 20:23:16 +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 AC04FA910; Mon, 14 Oct 2019 20:23:16 +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 x9EKNGls069982; Mon, 14 Oct 2019 20:23:16 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKNGUj069980; Mon, 14 Oct 2019 20:23:16 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142023.x9EKNGUj069980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 20:23:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353505 - in head/sys/dev: mlx4/mlx4_en mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys/dev: mlx4/mlx4_en mlx5/mlx5_en X-SVN-Commit-Revision: 353505 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:23:17 -0000 Author: glebius Date: Mon Oct 14 20:23:16 2019 New Revision: 353505 URL: https://svnweb.freebsd.org/changeset/base/353505 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: hselasky Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Mon Oct 14 20:22:25 2019 (r353504) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Mon Oct 14 20:23:16 2019 (r353505) @@ -617,31 +617,30 @@ static void mlx4_en_clear_uclist(struct net_device *de } } +static u_int mlx4_copy_addr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct mlx4_en_priv *priv = arg; + struct mlx4_en_addr_list *tmp; + + if (sdl->sdl_alen != ETHER_ADDR_LEN) /* XXXGL: can that happen? */ + return (0); + tmp = kzalloc(sizeof(struct mlx4_en_addr_list), GFP_ATOMIC); + if (tmp == NULL) { + en_err(priv, "Failed to allocate address list\n"); + return (0); + } + memcpy(tmp->addr, LLADDR(sdl), ETH_ALEN); + list_add_tail(&tmp->list, &priv->uc_list); + + return (1); +} + static void mlx4_en_cache_uclist(struct net_device *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); - struct mlx4_en_addr_list *tmp; - struct ifaddr *ifa; mlx4_en_clear_uclist(dev); - - if_addr_rlock(dev); - CK_STAILQ_FOREACH(ifa, &dev->if_addrhead, ifa_link) { - if (ifa->ifa_addr->sa_family != AF_LINK) - continue; - if (((struct sockaddr_dl *)ifa->ifa_addr)->sdl_alen != - ETHER_ADDR_LEN) - continue; - tmp = kzalloc(sizeof(struct mlx4_en_addr_list), GFP_ATOMIC); - if (tmp == NULL) { - en_err(priv, "Failed to allocate address list\n"); - break; - } - memcpy(tmp->addr, - LLADDR((struct sockaddr_dl *)ifa->ifa_addr), ETH_ALEN); - list_add_tail(&tmp->list, &priv->uc_list); - } - if_addr_runlock(dev); + if_foreach_lladdr(dev, mlx4_copy_addr, priv); } static void mlx4_en_clear_mclist(struct net_device *dev) @@ -655,31 +654,29 @@ static void mlx4_en_clear_mclist(struct net_device *de } } +static u_int mlx4_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int count) +{ + struct mlx4_en_priv *priv = arg; + struct mlx4_en_addr_list *tmp; + + if (sdl->sdl_alen != ETHER_ADDR_LEN) /* XXXGL: can that happen? */ + return (0); + tmp = kzalloc(sizeof(struct mlx4_en_addr_list), GFP_ATOMIC); + if (tmp == NULL) { + en_err(priv, "Failed to allocate address list\n"); + return (0); + } + memcpy(tmp->addr, LLADDR(sdl), ETH_ALEN); + list_add_tail(&tmp->list, &priv->mc_list); + return (1); +} + static void mlx4_en_cache_mclist(struct net_device *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); - struct mlx4_en_addr_list *tmp; - struct ifmultiaddr *ifma; mlx4_en_clear_mclist(dev); - - if_maddr_rlock(dev); - CK_STAILQ_FOREACH(ifma, &dev->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - if (((struct sockaddr_dl *)ifma->ifma_addr)->sdl_alen != - ETHER_ADDR_LEN) - continue; - tmp = kzalloc(sizeof(struct mlx4_en_addr_list), GFP_ATOMIC); - if (tmp == NULL) { - en_err(priv, "Failed to allocate address list\n"); - break; - } - memcpy(tmp->addr, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr), ETH_ALEN); - list_add_tail(&tmp->list, &priv->mc_list); - } - if_maddr_runlock(dev); + if_foreach_llmaddr(dev, mlx4_copy_maddr, priv); } static void update_addr_list_flags(struct mlx4_en_priv *priv, Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Oct 14 20:22:25 2019 (r353504) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Oct 14 20:23:16 2019 (r353505) @@ -787,44 +787,48 @@ mlx5e_remove_hn(struct mlx5e_eth_addr_hash_head *fh) return (hn); } +struct mlx5e_copy_addr_ctx { + struct mlx5e_eth_addr_hash_head *free; + struct mlx5e_eth_addr_hash_head *fill; + bool success; +}; + +static u_int +mlx5e_copy_addr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct mlx5e_copy_addr_ctx *ctx = arg; + struct mlx5e_eth_addr_hash_node *hn; + + hn = mlx5e_move_hn(ctx->free, ctx->fill); + if (hn == NULL) { + ctx->success = false; + return (0); + } + ether_addr_copy(hn->ai.addr, LLADDR(sdl)); + + return (1); +} + static void mlx5e_sync_ifp_addr(struct mlx5e_priv *priv) { + struct mlx5e_copy_addr_ctx ctx; struct mlx5e_eth_addr_hash_head head_free; struct mlx5e_eth_addr_hash_head head_uc; struct mlx5e_eth_addr_hash_head head_mc; struct mlx5e_eth_addr_hash_node *hn; struct ifnet *ifp = priv->ifp; - struct ifaddr *ifa; - struct ifmultiaddr *ifma; - bool success = false; size_t x; size_t num; PRIV_ASSERT_LOCKED(priv); +retry: LIST_INIT(&head_free); LIST_INIT(&head_uc); LIST_INIT(&head_mc); -retry: - num = 1; + num = 1 + if_lladdr_count(ifp) + if_llmaddr_count(ifp); - if_addr_rlock(ifp); - CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if (ifa->ifa_addr->sa_family != AF_LINK) - continue; - num++; - } - if_addr_runlock(ifp); - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - num++; - } - if_maddr_runlock(ifp); - /* allocate place holders */ for (x = 0; x != num; x++) { hn = malloc(sizeof(*hn), M_MLX5EN, M_WAITOK | M_ZERO); @@ -834,38 +838,21 @@ retry: } hn = mlx5e_move_hn(&head_free, &head_uc); - if (hn == NULL) - goto cleanup; + MPASS(hn != NULL); ether_addr_copy(hn->ai.addr, LLADDR((struct sockaddr_dl *)(ifp->if_addr->ifa_addr))); - if_addr_rlock(ifp); - CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if (ifa->ifa_addr->sa_family != AF_LINK) - continue; - hn = mlx5e_move_hn(&head_free, &head_uc); - if (hn == NULL) - break; - ether_addr_copy(hn->ai.addr, - LLADDR((struct sockaddr_dl *)ifa->ifa_addr)); - } - if_addr_runlock(ifp); - if (ifa != NULL) + ctx.free = &head_free; + ctx.fill = &head_uc; + ctx.success = true; + if_foreach_lladdr(ifp, mlx5e_copy_addr, &ctx); + if (ctx.success == false) goto cleanup; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - hn = mlx5e_move_hn(&head_free, &head_mc); - if (hn == NULL) - break; - ether_addr_copy(hn->ai.addr, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - } - if_maddr_runlock(ifp); - if (ifma != NULL) + ctx.fill = &head_mc; + if_foreach_llmaddr(ifp, mlx5e_copy_addr, &ctx); + if (ctx.success == false) goto cleanup; /* insert L2 unicast addresses into hash list */ @@ -884,8 +871,6 @@ retry: continue; } - success = true; - cleanup: while ((hn = mlx5e_remove_hn(&head_uc)) != NULL) free(hn, M_MLX5EN); @@ -894,7 +879,7 @@ cleanup: while ((hn = mlx5e_remove_hn(&head_free)) != NULL) free(hn, M_MLX5EN); - if (success == false) + if (ctx.success == false) goto retry; } From owner-svn-src-all@freebsd.org Mon Oct 14 20:26:18 2019 Return-Path: Delivered-To: svn-src-all@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 840BD1368DC; Mon, 14 Oct 2019 20:26:18 +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 46sVSp2zqmz3LgS; Mon, 14 Oct 2019 20:26:18 +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 45A89A911; Mon, 14 Oct 2019 20:26:18 +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 x9EKQIpT070183; Mon, 14 Oct 2019 20:26:18 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKQIqn070182; Mon, 14 Oct 2019 20:26:18 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142026.x9EKQIqn070182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 20:26:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353506 - head/sys/dev/usb/wlan X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/usb/wlan X-SVN-Commit-Revision: 353506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:26:18 -0000 Author: glebius Date: Mon Oct 14 20:26:17 2019 New Revision: 353506 URL: https://svnweb.freebsd.org/changeset/base/353506 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: hselasky Modified: head/sys/dev/usb/wlan/if_zyd.c Modified: head/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- head/sys/dev/usb/wlan/if_zyd.c Mon Oct 14 20:23:16 2019 (r353505) +++ head/sys/dev/usb/wlan/if_zyd.c Mon Oct 14 20:26:17 2019 (r353506) @@ -1970,49 +1970,48 @@ fail: return (error); } +static u_int +zyd_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *hash = arg; + uint8_t v; + + v = ((uint8_t *)LLADDR(sdl))[5] >> 2; + if (v < 32) + hash[0] |= 1 << v; + else + hash[1] |= 1 << (v - 32); + + return (1); +} + static void zyd_set_multi(struct zyd_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; - uint32_t low, high; + uint32_t hash[2]; int error; if ((sc->sc_flags & ZYD_FLAG_RUNNING) == 0) return; - low = 0x00000000; - high = 0x80000000; + hash[0] = 0x00000000; + hash[1] = 0x80000000; if (ic->ic_opmode == IEEE80211_M_MONITOR || ic->ic_allmulti > 0 || ic->ic_promisc > 0) { - low = 0xffffffff; - high = 0xffffffff; + hash[0] = 0xffffffff; + hash[1] = 0xffffffff; } else { struct ieee80211vap *vap; - struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint8_t v; - TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { - ifp = vap->iv_ifp; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - v = ((uint8_t *)LLADDR((struct sockaddr_dl *) - ifma->ifma_addr))[5] >> 2; - if (v < 32) - low |= 1 << v; - else - high |= 1 << (v - 32); - } - if_maddr_runlock(ifp); - } + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) + if_foreach_llmaddr(vap->iv_ifp, zyd_hash_maddr, &hash); } /* reprogram multicast global hash table */ - zyd_write32_m(sc, ZYD_MAC_GHTBL, low); - zyd_write32_m(sc, ZYD_MAC_GHTBH, high); + zyd_write32_m(sc, ZYD_MAC_GHTBL, hash[0]); + zyd_write32_m(sc, ZYD_MAC_GHTBH, hash[1]); fail: if (error != 0) device_printf(sc->sc_dev, From owner-svn-src-all@freebsd.org Mon Oct 14 20:26:54 2019 Return-Path: Delivered-To: svn-src-all@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 0B51613696D; Mon, 14 Oct 2019 20:26:54 +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 46sVTT6cBRz3LpM; Mon, 14 Oct 2019 20:26:53 +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 C6406A912; Mon, 14 Oct 2019 20:26:53 +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 x9EKQrWM070249; Mon, 14 Oct 2019 20:26:53 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKQrhk070248; Mon, 14 Oct 2019 20:26:53 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142026.x9EKQrhk070248@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 20:26:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353507 - head/sys/dev/usb/wlan X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/usb/wlan X-SVN-Commit-Revision: 353507 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:26:54 -0000 Author: glebius Date: Mon Oct 14 20:26:53 2019 New Revision: 353507 URL: https://svnweb.freebsd.org/changeset/base/353507 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: hselasky Modified: head/sys/dev/usb/wlan/if_rsu.c Modified: head/sys/dev/usb/wlan/if_rsu.c ============================================================================== --- head/sys/dev/usb/wlan/if_rsu.c Mon Oct 14 20:26:17 2019 (r353506) +++ head/sys/dev/usb/wlan/if_rsu.c Mon Oct 14 20:26:53 2019 (r353507) @@ -857,6 +857,18 @@ rsu_get_multi_pos(const uint8_t maddr[]) return (pos); } +static u_int +rsu_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *mfilt = arg; + uint8_t pos; + + pos = rsu_get_multi_pos(LLADDR(sdl)); + mfilt[pos / 32] |= (1 << (pos % 32)); + + return (1); +} + static void rsu_set_multi(struct rsu_softc *sc) { @@ -868,28 +880,13 @@ rsu_set_multi(struct rsu_softc *sc) /* general structure was copied from ath(4). */ if (ic->ic_allmulti == 0) { struct ieee80211vap *vap; - struct ifnet *ifp; - struct ifmultiaddr *ifma; /* * Merge multicast addresses to form the hardware filter. */ mfilt[0] = mfilt[1] = 0; - TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { - ifp = vap->iv_ifp; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - caddr_t dl; - uint8_t pos; - - dl = LLADDR((struct sockaddr_dl *) - ifma->ifma_addr); - pos = rsu_get_multi_pos(dl); - - mfilt[pos / 32] |= (1 << (pos % 32)); - } - if_maddr_runlock(ifp); - } + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) + if_foreach_llmaddr(vap->iv_ifp, rsu_hash_maddr, &mfilt); } else mfilt[0] = mfilt[1] = ~0; From owner-svn-src-all@freebsd.org Mon Oct 14 20:29:15 2019 Return-Path: Delivered-To: svn-src-all@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 796CA136AAA; Mon, 14 Oct 2019 20:29:15 +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 46sVXC2ZdCz3Lyj; Mon, 14 Oct 2019 20:29:15 +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 3C1BBA91B; Mon, 14 Oct 2019 20:29:15 +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 x9EKTFwY070417; Mon, 14 Oct 2019 20:29:15 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKTFB9070416; Mon, 14 Oct 2019 20:29:15 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142029.x9EKTFB9070416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 20:29:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353508 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 353508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:29:15 -0000 Author: glebius Date: Mon Oct 14 20:29:14 2019 New Revision: 353508 URL: https://svnweb.freebsd.org/changeset/base/353508 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: hselasky Modified: head/sys/dev/usb/net/if_ure.c Modified: head/sys/dev/usb/net/if_ure.c ============================================================================== --- head/sys/dev/usb/net/if_ure.c Mon Oct 14 20:26:53 2019 (r353507) +++ head/sys/dev/usb/net/if_ure.c Mon Oct 14 20:29:14 2019 (r353508) @@ -792,6 +792,19 @@ ure_tick(struct usb_ether *ue) } } +static u_int +ure_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t h, *hashes = arg; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + return (1); +} + /* * Program the 64-bit multicast hash filter. */ @@ -800,9 +813,8 @@ ure_rxfilter(struct usb_ether *ue) { struct ure_softc *sc = uether_getsc(ue); struct ifnet *ifp = uether_getifp(ue); - struct ifmultiaddr *ifma; - uint32_t h, rxmode; - uint32_t hashes[2] = { 0, 0 }; + uint32_t rxmode; + uint32_t h, hashes[2] = { 0, 0 }; URE_LOCK_ASSERT(sc, MA_OWNED); @@ -818,18 +830,7 @@ ure_rxfilter(struct usb_ether *ue) } rxmode |= URE_RCR_AM; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, ure_hash_maddr, &hashes); h = bswap32(hashes[0]); hashes[0] = bswap32(hashes[1]); From owner-svn-src-all@freebsd.org Mon Oct 14 20:29:33 2019 Return-Path: Delivered-To: svn-src-all@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 4C2F6136B21; Mon, 14 Oct 2019 20:29:33 +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 46sVXY0s4Lz3M68; Mon, 14 Oct 2019 20:29:33 +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 00954A91C; Mon, 14 Oct 2019 20:29:33 +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 x9EKTWgO070476; Mon, 14 Oct 2019 20:29:32 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKTWH7070475; Mon, 14 Oct 2019 20:29:32 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142029.x9EKTWH7070475@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 20:29:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353509 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 353509 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:29:33 -0000 Author: glebius Date: Mon Oct 14 20:29:32 2019 New Revision: 353509 URL: https://svnweb.freebsd.org/changeset/base/353509 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: hselasky Modified: head/sys/dev/usb/net/if_udav.c Modified: head/sys/dev/usb/net/if_udav.c ============================================================================== --- head/sys/dev/usb/net/if_udav.c Mon Oct 14 20:29:14 2019 (r353508) +++ head/sys/dev/usb/net/if_udav.c Mon Oct 14 20:29:32 2019 (r353509) @@ -504,15 +504,24 @@ udav_reset(struct udav_softc *sc) uether_pause(&sc->sc_ue, hz / 100); } -#define UDAV_BITS 6 +static u_int +udav_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint8_t *hashtbl = arg; + int h; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + hashtbl[h / 8] |= 1 << (h % 8); + + return (1); +} + static void udav_setmulti(struct usb_ether *ue) { struct udav_softc *sc = ue->ue_sc; struct ifnet *ifp = uether_getifp(&sc->sc_ue); - struct ifmultiaddr *ifma; uint8_t hashtbl[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - int h = 0; UDAV_LOCK_ASSERT(sc, MA_OWNED); @@ -527,16 +536,7 @@ udav_setmulti(struct usb_ether *ue) udav_csr_write(sc, UDAV_MAR, hashtbl, sizeof(hashtbl)); /* now program new ones */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) - { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - hashtbl[h / 8] |= 1 << (h % 8); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, udav_hash_maddr, hashtbl); /* disable all multicast */ UDAV_CLRBIT(sc, UDAV_RCR, UDAV_RCR_ALL); From owner-svn-src-all@freebsd.org Mon Oct 14 20:29:51 2019 Return-Path: Delivered-To: svn-src-all@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 928CF136BA3; Mon, 14 Oct 2019 20:29:51 +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 46sVXv3Npdz3MDp; Mon, 14 Oct 2019 20:29:51 +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 3F9B3A91D; Mon, 14 Oct 2019 20:29:51 +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 x9EKTpw1070532; Mon, 14 Oct 2019 20:29:51 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKTp3S070531; Mon, 14 Oct 2019 20:29:51 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142029.x9EKTp3S070531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 20:29:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353510 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 353510 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:29:51 -0000 Author: glebius Date: Mon Oct 14 20:29:50 2019 New Revision: 353510 URL: https://svnweb.freebsd.org/changeset/base/353510 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: hselasky Modified: head/sys/dev/usb/net/if_smsc.c Modified: head/sys/dev/usb/net/if_smsc.c ============================================================================== --- head/sys/dev/usb/net/if_smsc.c Mon Oct 14 20:29:32 2019 (r353509) +++ head/sys/dev/usb/net/if_smsc.c Mon Oct 14 20:29:50 2019 (r353510) @@ -691,6 +691,18 @@ smsc_hash(uint8_t addr[ETHER_ADDR_LEN]) return (ether_crc32_be(addr, ETHER_ADDR_LEN) >> 26) & 0x3f; } +static u_int +smsc_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t hash, *hashtbl = arg; + + hash = smsc_hash(LLADDR(sdl)); + hashtbl[hash >> 5] |= 1 << (hash & 0x1F); + + return (1); +} + + /** * smsc_setmulti - Setup multicast * @ue: usb ethernet device context @@ -706,9 +718,7 @@ smsc_setmulti(struct usb_ether *ue) { struct smsc_softc *sc = uether_getsc(ue); struct ifnet *ifp = uether_getifp(ue); - struct ifmultiaddr *ifma; uint32_t hashtbl[2] = { 0, 0 }; - uint32_t hash; SMSC_LOCK_ASSERT(sc, MA_OWNED); @@ -718,29 +728,19 @@ smsc_setmulti(struct usb_ether *ue) sc->sc_mac_csr &= ~SMSC_MAC_CSR_HPFILT; } else { - /* Take the lock of the mac address list before hashing each of them */ - if_maddr_rlock(ifp); - - if (!CK_STAILQ_EMPTY(&ifp->if_multiaddrs)) { - /* We are filtering on a set of address so calculate hashes of each - * of the address and set the corresponding bits in the register. + if (if_foreach_llmaddr(ifp, smsc_hash_maddr, &hashtbl) > 0) { + /* We are filtering on a set of address so calculate + * hashes of each of the address and set the + * corresponding bits in the register. */ sc->sc_mac_csr |= SMSC_MAC_CSR_HPFILT; sc->sc_mac_csr &= ~(SMSC_MAC_CSR_PRMS | SMSC_MAC_CSR_MCPAS); - - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - hash = smsc_hash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - hashtbl[hash >> 5] |= 1 << (hash & 0x1F); - } } else { - /* Only receive packets with destination set to our mac address */ + /* Only receive packets with destination set to + * our mac address + */ sc->sc_mac_csr &= ~(SMSC_MAC_CSR_MCPAS | SMSC_MAC_CSR_HPFILT); } - - if_maddr_runlock(ifp); /* Debug */ if (sc->sc_mac_csr & SMSC_MAC_CSR_HPFILT) From owner-svn-src-all@freebsd.org Mon Oct 14 20:30:07 2019 Return-Path: Delivered-To: svn-src-all@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 4B445136C35; Mon, 14 Oct 2019 20:30:07 +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 46sVYC1Cg4z3MMY; Mon, 14 Oct 2019 20:30:07 +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 0E322A922; Mon, 14 Oct 2019 20:30:07 +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 x9EKU6oX070631; Mon, 14 Oct 2019 20:30:06 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKU6l0070630; Mon, 14 Oct 2019 20:30:06 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142030.x9EKU6l0070630@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 20:30:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353511 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 353511 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:30:07 -0000 Author: glebius Date: Mon Oct 14 20:30:06 2019 New Revision: 353511 URL: https://svnweb.freebsd.org/changeset/base/353511 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: hselasky Modified: head/sys/dev/usb/net/if_rue.c Modified: head/sys/dev/usb/net/if_rue.c ============================================================================== --- head/sys/dev/usb/net/if_rue.c Mon Oct 14 20:29:50 2019 (r353510) +++ head/sys/dev/usb/net/if_rue.c Mon Oct 14 20:30:06 2019 (r353511) @@ -473,6 +473,21 @@ rue_setpromisc(struct usb_ether *ue) RUE_CLRBIT(sc, RUE_RCR, RUE_RCR_AAP); } +static u_int +rue_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *hashes = arg; + int h; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + + return (1); +} + /* * Program the 64-bit multicast hash filter. */ @@ -482,10 +497,8 @@ rue_setmulti(struct usb_ether *ue) struct rue_softc *sc = uether_getsc(ue); struct ifnet *ifp = uether_getifp(ue); uint16_t rxcfg; - int h = 0; uint32_t hashes[2] = { 0, 0 }; - struct ifmultiaddr *ifma; - int mcnt = 0; + int mcnt; RUE_LOCK_ASSERT(sc, MA_OWNED); @@ -505,20 +518,7 @@ rue_setmulti(struct usb_ether *ue) rue_csr_write_4(sc, RUE_MAR4, 0); /* now program new ones */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH (ifma, &ifp->if_multiaddrs, ifma_link) - { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - mcnt++; - } - if_maddr_runlock(ifp); + mcnt = if_foreach_llmaddr(ifp, rue_hash_maddr, &hashes); if (mcnt) rxcfg |= RUE_RCR_AM; From owner-svn-src-all@freebsd.org Mon Oct 14 20:30:31 2019 Return-Path: Delivered-To: svn-src-all@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 7C3BF136CDC; Mon, 14 Oct 2019 20:30:31 +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 46sVYg2kk2z3MVG; Mon, 14 Oct 2019 20:30:31 +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 4226AA923; Mon, 14 Oct 2019 20:30:31 +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 x9EKUVUq070700; Mon, 14 Oct 2019 20:30:31 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKUVAC070699; Mon, 14 Oct 2019 20:30:31 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142030.x9EKUVAC070699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 20:30:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353512 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 353512 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:30:31 -0000 Author: glebius Date: Mon Oct 14 20:30:30 2019 New Revision: 353512 URL: https://svnweb.freebsd.org/changeset/base/353512 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: hselasky Modified: head/sys/dev/usb/net/if_muge.c Modified: head/sys/dev/usb/net/if_muge.c ============================================================================== --- head/sys/dev/usb/net/if_muge.c Mon Oct 14 20:30:06 2019 (r353511) +++ head/sys/dev/usb/net/if_muge.c Mon Oct 14 20:30:30 2019 (r353512) @@ -1862,6 +1862,24 @@ muge_hash(uint8_t addr[ETHER_ADDR_LEN]) return (ether_crc32_be(addr, ETHER_ADDR_LEN) >> 23) & 0x1ff; } +static u_int +muge_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct muge_softc *sc = arg; + uint32_t bitnum; + + /* First fill up the perfect address table. */ + if (cnt < 32 /* XXX */) + muge_set_addr_filter(sc, cnt + 1, LLADDR(sdl)); + else { + bitnum = muge_hash(LLADDR(sdl)); + sc->sc_mchash_table[bitnum / 32] |= (1 << (bitnum % 32)); + sc->sc_rfe_ctl |= ETH_RFE_CTL_MCAST_HASH_; + } + + return (1); +} + /** * muge_setmulti - Setup multicast * @ue: usb ethernet device context @@ -1877,8 +1895,7 @@ muge_setmulti(struct usb_ether *ue) { struct muge_softc *sc = uether_getsc(ue); struct ifnet *ifp = uether_getifp(ue); - uint8_t i, *addr; - struct ifmultiaddr *ifma; + uint8_t i; MUGE_LOCK_ASSERT(sc, MA_OWNED); @@ -1904,28 +1921,7 @@ muge_setmulti(struct usb_ether *ue) muge_dbg_printf(sc, "receive all multicast enabled\n"); sc->sc_rfe_ctl |= ETH_RFE_CTL_MCAST_EN_; } else { - /* Lock the mac address list before hashing each of them. */ - if_maddr_rlock(ifp); - if (!CK_STAILQ_EMPTY(&ifp->if_multiaddrs)) { - i = 1; - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, - ifma_link) { - /* First fill up the perfect address table. */ - addr = LLADDR((struct sockaddr_dl *) - ifma->ifma_addr); - if (i < 33 /* XXX */) { - muge_set_addr_filter(sc, i, addr); - } else { - uint32_t bitnum = muge_hash(addr); - sc->sc_mchash_table[bitnum / 32] |= - (1 << (bitnum % 32)); - sc->sc_rfe_ctl |= - ETH_RFE_CTL_MCAST_HASH_; - } - i++; - } - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, muge_hash_maddr, sc); muge_multicast_write(sc); } lan78xx_write_reg(sc, ETH_RFE_CTL, sc->sc_rfe_ctl); From owner-svn-src-all@freebsd.org Mon Oct 14 20:30:45 2019 Return-Path: Delivered-To: svn-src-all@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 5DE43136D3A; Mon, 14 Oct 2019 20:30:45 +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 46sVYx1QKNz3Mdg; Mon, 14 Oct 2019 20:30:45 +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 14599A93C; Mon, 14 Oct 2019 20:30:45 +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 x9EKUi6a070753; Mon, 14 Oct 2019 20:30:44 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKUiYO070752; Mon, 14 Oct 2019 20:30:44 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142030.x9EKUiYO070752@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 20:30:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353513 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 353513 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:30:45 -0000 Author: glebius Date: Mon Oct 14 20:30:44 2019 New Revision: 353513 URL: https://svnweb.freebsd.org/changeset/base/353513 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: hselasky Modified: head/sys/dev/usb/net/if_mos.c Modified: head/sys/dev/usb/net/if_mos.c ============================================================================== --- head/sys/dev/usb/net/if_mos.c Mon Oct 14 20:30:30 2019 (r353512) +++ head/sys/dev/usb/net/if_mos.c Mon Oct 14 20:30:44 2019 (r353513) @@ -589,16 +589,23 @@ mos_setpromisc(struct usb_ether *ue) mos_reg_write_1(sc, MOS_CTL, rxmode); } +static u_int +mos_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint8_t *hashtbl = arg; + uint32_t h; + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + hashtbl[h / 8] |= 1 << (h % 8); + return (1); +} + static void mos_setmulti(struct usb_ether *ue) { struct mos_softc *sc = uether_getsc(ue); struct ifnet *ifp = uether_getifp(ue); - struct ifmultiaddr *ifma; - - uint32_t h = 0; uint8_t rxmode; uint8_t hashtbl[8] = {0, 0, 0, 0, 0, 0, 0, 0}; int allmulti = 0; @@ -611,17 +618,7 @@ mos_setmulti(struct usb_ether *ue) allmulti = 1; /* get all new ones */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) { - allmulti = 1; - continue; - } - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - hashtbl[h / 8] |= 1 << (h % 8); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, mos_hash_maddr, &hashtbl); /* now program new ones */ if (allmulti == 1) { From owner-svn-src-all@freebsd.org Mon Oct 14 20:31:29 2019 Return-Path: Delivered-To: svn-src-all@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 89C871371AB; Mon, 14 Oct 2019 20:31:29 +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 46sVZn2BJVz3N28; Mon, 14 Oct 2019 20:31:29 +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 8F538A975; Mon, 14 Oct 2019 20:31:28 +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 x9EKVSIQ072859; Mon, 14 Oct 2019 20:31:28 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKVS0R072858; Mon, 14 Oct 2019 20:31:28 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142031.x9EKVS0R072858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 20:31:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353514 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 353514 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:31:29 -0000 Author: glebius Date: Mon Oct 14 20:31:28 2019 New Revision: 353514 URL: https://svnweb.freebsd.org/changeset/base/353514 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: hselasky Modified: head/sys/dev/usb/net/if_kue.c Modified: head/sys/dev/usb/net/if_kue.c ============================================================================== --- head/sys/dev/usb/net/if_kue.c Mon Oct 14 20:30:44 2019 (r353513) +++ head/sys/dev/usb/net/if_kue.c Mon Oct 14 20:31:28 2019 (r353514) @@ -357,13 +357,25 @@ kue_setpromisc(struct usb_ether *ue) kue_setword(sc, KUE_CMD_SET_PKT_FILTER, sc->sc_rxfilt); } +static u_int +kue_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct kue_softc *sc = arg; + + if (cnt >= KUE_MCFILTCNT(sc)) + return (1); + + memcpy(KUE_MCFILT(sc, cnt), LLADDR(sdl), ETHER_ADDR_LEN); + + return (1); +} + static void kue_setmulti(struct usb_ether *ue) { struct kue_softc *sc = uether_getsc(ue); struct ifnet *ifp = uether_getifp(ue); - struct ifmultiaddr *ifma; - int i = 0; + int i; KUE_LOCK_ASSERT(sc, MA_OWNED); @@ -376,25 +388,9 @@ kue_setmulti(struct usb_ether *ue) sc->sc_rxfilt &= ~KUE_RXFILT_ALLMULTI; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) - { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - /* - * If there are too many addresses for the - * internal filter, switch over to allmulti mode. - */ - if (i == KUE_MCFILTCNT(sc)) - break; - memcpy(KUE_MCFILT(sc, i), - LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - ETHER_ADDR_LEN); - i++; - } - if_maddr_runlock(ifp); + i = if_foreach_llmaddr(ifp, kue_copy_maddr, sc); - if (i == KUE_MCFILTCNT(sc)) + if (i >= KUE_MCFILTCNT(sc)) sc->sc_rxfilt |= KUE_RXFILT_ALLMULTI; else { sc->sc_rxfilt |= KUE_RXFILT_MULTICAST; From owner-svn-src-all@freebsd.org Mon Oct 14 20:31:44 2019 Return-Path: Delivered-To: svn-src-all@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 8C0821372AE; Mon, 14 Oct 2019 20:31:44 +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 46sVb42bYzz3NBd; Mon, 14 Oct 2019 20:31:44 +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 3DE52A988; Mon, 14 Oct 2019 20:31:44 +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 x9EKViu0075157; Mon, 14 Oct 2019 20:31:44 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKVi1N075156; Mon, 14 Oct 2019 20:31:44 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142031.x9EKVi1N075156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 20:31:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353515 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 353515 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:31:44 -0000 Author: glebius Date: Mon Oct 14 20:31:43 2019 New Revision: 353515 URL: https://svnweb.freebsd.org/changeset/base/353515 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: hselasky Modified: head/sys/dev/usb/net/if_cue.c Modified: head/sys/dev/usb/net/if_cue.c ============================================================================== --- head/sys/dev/usb/net/if_cue.c Mon Oct 14 20:31:28 2019 (r353514) +++ head/sys/dev/usb/net/if_cue.c Mon Oct 14 20:31:43 2019 (r353515) @@ -307,13 +307,24 @@ cue_setpromisc(struct usb_ether *ue) cue_setmulti(ue); } +static u_int +cue_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint8_t *hashtbl = arg; + uint32_t h; + + h = cue_mchash(LLADDR(sdl)); + hashtbl[h >> 3] |= 1 << (h & 0x7); + + return (1); +} + static void cue_setmulti(struct usb_ether *ue) { struct cue_softc *sc = uether_getsc(ue); struct ifnet *ifp = uether_getifp(ue); - struct ifmultiaddr *ifma; - uint32_t h = 0, i; + uint32_t h, i; uint8_t hashtbl[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; CUE_LOCK_ASSERT(sc, MA_OWNED); @@ -327,15 +338,7 @@ cue_setmulti(struct usb_ether *ue) } /* now program new ones */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) - { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = cue_mchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - hashtbl[h >> 3] |= 1 << (h & 0x7); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, cue_hash_maddr, hashtbl); /* * Also include the broadcast address in the filter From owner-svn-src-all@freebsd.org Mon Oct 14 20:31:58 2019 Return-Path: Delivered-To: svn-src-all@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 D692413738C; Mon, 14 Oct 2019 20:31:58 +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 46sVbL4Ndmz3NLD; Mon, 14 Oct 2019 20:31:58 +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 6C301A99B; Mon, 14 Oct 2019 20:31:58 +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 x9EKVwmn075213; Mon, 14 Oct 2019 20:31:58 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKVwkq075212; Mon, 14 Oct 2019 20:31:58 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142031.x9EKVwkq075212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 20:31:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353516 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 353516 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:31:58 -0000 Author: glebius Date: Mon Oct 14 20:31:57 2019 New Revision: 353516 URL: https://svnweb.freebsd.org/changeset/base/353516 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: hselasky Modified: head/sys/dev/usb/net/if_axge.c Modified: head/sys/dev/usb/net/if_axge.c ============================================================================== --- head/sys/dev/usb/net/if_axge.c Mon Oct 14 20:31:43 2019 (r353515) +++ head/sys/dev/usb/net/if_axge.c Mon Oct 14 20:31:57 2019 (r353516) @@ -756,19 +756,28 @@ axge_tick(struct usb_ether *ue) mii_tick(mii); } +static u_int +axge_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint8_t *hashtbl = arg; + uint32_t h; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + hashtbl[h / 8] |= 1 << (h % 8); + + return (1); +} + static void axge_rxfilter(struct usb_ether *ue) { struct axge_softc *sc; struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t h; uint16_t rxmode; uint8_t hashtbl[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; sc = uether_getsc(ue); ifp = uether_getifp(ue); - h = 0; AXGE_LOCK_ASSERT(sc, MA_OWNED); /* @@ -791,15 +800,7 @@ axge_rxfilter(struct usb_ether *ue) } rxmode |= RCR_ACPT_MCAST; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - hashtbl[h / 8] |= 1 << (h % 8); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, axge_hash_maddr, &hashtbl); axge_write_mem(sc, AXGE_ACCESS_MAC, 8, AXGE_MFA, (void *)&hashtbl, 8); axge_write_cmd_2(sc, AXGE_ACCESS_MAC, 2, AXGE_RCR, rxmode); From owner-svn-src-all@freebsd.org Mon Oct 14 20:32:09 2019 Return-Path: Delivered-To: svn-src-all@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 6AF3F1373FC; Mon, 14 Oct 2019 20:32:09 +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 46sVbY1H7mz3NTW; Mon, 14 Oct 2019 20:32:09 +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 0C76CAAC0; Mon, 14 Oct 2019 20:32:09 +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 x9EKW8xt075276; Mon, 14 Oct 2019 20:32:08 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKW8XI075275; Mon, 14 Oct 2019 20:32:08 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142032.x9EKW8XI075275@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 20:32:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353517 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 353517 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:32:09 -0000 Author: glebius Date: Mon Oct 14 20:32:08 2019 New Revision: 353517 URL: https://svnweb.freebsd.org/changeset/base/353517 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: hselasky Modified: head/sys/dev/usb/net/if_axe.c Modified: head/sys/dev/usb/net/if_axe.c ============================================================================== --- head/sys/dev/usb/net/if_axe.c Mon Oct 14 20:31:57 2019 (r353516) +++ head/sys/dev/usb/net/if_axe.c Mon Oct 14 20:32:08 2019 (r353517) @@ -481,13 +481,23 @@ axe_ifmedia_sts(struct ifnet *ifp, struct ifmediareq * AXE_UNLOCK(sc); } +static u_int +axe_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint8_t *hashtbl = arg; + uint32_t h; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + hashtbl[h / 8] |= 1 << (h % 8); + + return (1); +} + static void axe_setmulti(struct usb_ether *ue) { struct axe_softc *sc = uether_getsc(ue); struct ifnet *ifp = uether_getifp(ue); - struct ifmultiaddr *ifma; - uint32_t h = 0; uint16_t rxmode; uint8_t hashtbl[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -503,16 +513,7 @@ axe_setmulti(struct usb_ether *ue) } rxmode &= ~AXE_RXCMD_ALLMULTI; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) - { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - hashtbl[h / 8] |= 1 << (h % 8); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, axe_hash_maddr, &hashtbl); axe_cmd(sc, AXE_CMD_WRITE_MCAST, 0, 0, (void *)&hashtbl); axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL); From owner-svn-src-all@freebsd.org Mon Oct 14 20:32:14 2019 Return-Path: Delivered-To: svn-src-all@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 56200137447; Mon, 14 Oct 2019 20:32:14 +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 46sVbd6pGrz3NWm; Mon, 14 Oct 2019 20:32:13 +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 197DEAACA; Mon, 14 Oct 2019 20:32:13 +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 x9EKWCZQ076129; Mon, 14 Oct 2019 20:32:12 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKWBBM075324; Mon, 14 Oct 2019 20:32:11 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910142032.x9EKWBBM075324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 14 Oct 2019 20:32:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353518 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 353518 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:32:14 -0000 Author: tuexen Date: Mon Oct 14 20:32:11 2019 New Revision: 353518 URL: https://svnweb.freebsd.org/changeset/base/353518 Log: Separate out SCTP related dtrace code. This is based on work done by markj@. Discussed with: markj@ MFC after: 3 days Modified: head/sys/netinet/in_kdtrace.c head/sys/netinet/in_kdtrace.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_kdtrace.c head/sys/netinet/sctp_kdtrace.h head/sys/netinet/sctp_output.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/in_kdtrace.c ============================================================================== --- head/sys/netinet/in_kdtrace.c Mon Oct 14 20:32:08 2019 (r353517) +++ head/sys/netinet/in_kdtrace.c Mon Oct 14 20:32:11 2019 (r353518) @@ -31,16 +31,11 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_sctp.h" - #include #include #include SDT_PROVIDER_DEFINE(ip); -#ifdef SCTP -SDT_PROVIDER_DEFINE(sctp); -#endif SDT_PROVIDER_DEFINE(tcp); SDT_PROVIDER_DEFINE(udp); SDT_PROVIDER_DEFINE(udplite); @@ -60,30 +55,6 @@ SDT_PROBE_DEFINE6_XLATE(ip, , , send, "struct ifnet *", "ifinfo_t *", "struct ip *", "ipv4info_t *", "struct ip6_hdr *", "ipv6info_t *"); - -#ifdef SCTP -SDT_PROBE_DEFINE5_XLATE(sctp, , , receive, - "void *", "pktinfo_t *", - "struct sctp_tcb *", "csinfo_t *", - "struct mbuf *", "ipinfo_t *", - "struct sctp_tcb *", "sctpsinfo_t *" , - "struct sctphdr *", "sctpinfo_t *"); - -SDT_PROBE_DEFINE5_XLATE(sctp, , , send, - "void *", "pktinfo_t *", - "struct sctp_tcb *", "csinfo_t *", - "uint8_t *", "ipinfo_t *", - "struct sctp_tcb *", "sctpsinfo_t *" , - "struct sctphdr *", "sctpinfo_t *"); - -SDT_PROBE_DEFINE6_XLATE(sctp, , , state__change, - "void *", "void *", - "struct sctp_tcb *", "csinfo_t *", - "void *", "void *", - "struct sctp_tcb *", "sctpsinfo_t *", - "void *", "void *", - "int", "sctplsinfo_t *"); -#endif SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__established, "void *", "pktinfo_t *", Modified: head/sys/netinet/in_kdtrace.h ============================================================================== --- head/sys/netinet/in_kdtrace.h Mon Oct 14 20:32:08 2019 (r353517) +++ head/sys/netinet/in_kdtrace.h Mon Oct 14 20:32:11 2019 (r353518) @@ -48,31 +48,14 @@ SDT_PROBE5(tcp, , , probe, arg0, arg1, arg2, arg3, arg4) #define TCP_PROBE6(probe, arg0, arg1, arg2, arg3, arg4, arg5) \ SDT_PROBE6(tcp, , , probe, arg0, arg1, arg2, arg3, arg4, arg5) -#define SCTP_PROBE1(probe, arg0) \ - SDT_PROBE1(sctp, , , probe, arg0) -#define SCTP_PROBE2(probe, arg0, arg1) \ - SDT_PROBE2(sctp, , , probe, arg0, arg1) -#define SCTP_PROBE3(probe, arg0, arg1, arg2) \ - SDT_PROBE3(sctp, , , probe, arg0, arg1, arg2) -#define SCTP_PROBE4(probe, arg0, arg1, arg2, arg3) \ - SDT_PROBE4(sctp, , , probe, arg0, arg1, arg2, arg3) -#define SCTP_PROBE5(probe, arg0, arg1, arg2, arg3, arg4) \ - SDT_PROBE5(sctp, , , probe, arg0, arg1, arg2, arg3, arg4) -#define SCTP_PROBE6(probe, arg0, arg1, arg2, arg3, arg4, arg5) \ - SDT_PROBE6(sctp, , , probe, arg0, arg1, arg2, arg3, arg4, arg5) SDT_PROVIDER_DECLARE(ip); -SDT_PROVIDER_DECLARE(sctp); SDT_PROVIDER_DECLARE(tcp); SDT_PROVIDER_DECLARE(udp); SDT_PROVIDER_DECLARE(udplite); SDT_PROBE_DECLARE(ip, , , receive); SDT_PROBE_DECLARE(ip, , , send); - -SDT_PROBE_DECLARE(sctp, , , receive); -SDT_PROBE_DECLARE(sctp, , , send); -SDT_PROBE_DECLARE(sctp, , , state__change); SDT_PROBE_DECLARE(tcp, , , accept__established); SDT_PROBE_DECLARE(tcp, , , accept__refused); Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Mon Oct 14 20:32:08 2019 (r353517) +++ head/sys/netinet/sctp_input.c Mon Oct 14 20:32:11 2019 (r353518) @@ -49,10 +49,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #if defined(INET) || defined(INET6) #include #endif -#include #include Modified: head/sys/netinet/sctp_kdtrace.c ============================================================================== --- head/sys/netinet/sctp_kdtrace.c Mon Oct 14 20:32:08 2019 (r353517) +++ head/sys/netinet/sctp_kdtrace.c Mon Oct 14 20:32:11 2019 (r353518) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include -SDT_PROVIDER_DECLARE(sctp); +SDT_PROVIDER_DEFINE(sctp); /********************************************************/ /* Cwnd probe - tracks changes in the congestion window on a netp */ @@ -171,3 +171,29 @@ SDT_PROBE_DEFINE4(sctp, flightsize, assoc, val, * order. */ "int", /* The up/down amount */ "int"); /* The new value of the cwnd */ + +/* + * Standard Solaris-compatible probes. + */ + +SDT_PROBE_DEFINE5_XLATE(sctp,,, receive, + "void *", "pktinfo_t *", + "struct sctp_tcb *", "csinfo_t *", + "struct mbuf *", "ipinfo_t *", + "struct sctp_tcb *", "sctpsinfo_t *", + "struct sctphdr *", "sctpinfo_t *"); + +SDT_PROBE_DEFINE5_XLATE(sctp,,, send, + "void *", "pktinfo_t *", + "struct sctp_tcb *", "csinfo_t *", + "uint8_t *", "ipinfo_t *", + "struct sctp_tcb *", "sctpsinfo_t *", + "struct sctphdr *", "sctpinfo_t *"); + +SDT_PROBE_DEFINE6_XLATE(sctp,,, state__change, + "void *", "void *", + "struct sctp_tcb *", "csinfo_t *", + "void *", "void *", + "struct sctp_tcb *", "sctpsinfo_t *", + "void *", "void *", + "int", "sctplsinfo_t *"); Modified: head/sys/netinet/sctp_kdtrace.h ============================================================================== --- head/sys/netinet/sctp_kdtrace.h Mon Oct 14 20:32:08 2019 (r353517) +++ head/sys/netinet/sctp_kdtrace.h Mon Oct 14 20:32:11 2019 (r353518) @@ -34,12 +34,25 @@ #include __FBSDID("$FreeBSD$"); -#ifndef _NETINET_SCTP_DTRACE_DECLARE_H_ -#define _NETINET_SCTP_DTRACE_DECLARE_H_ +#ifndef _NETINET_SCTP_KDTRACE_H_ +#define _NETINET_SCTP_KDTRACE_H_ #include #include +#define SCTP_PROBE1(probe, arg0) \ + SDT_PROBE1(sctp, , , probe, arg0) +#define SCTP_PROBE2(probe, arg0, arg1) \ + SDT_PROBE2(sctp, , , probe, arg0, arg1) +#define SCTP_PROBE3(probe, arg0, arg1, arg2) \ + SDT_PROBE3(sctp, , , probe, arg0, arg1, arg2) +#define SCTP_PROBE4(probe, arg0, arg1, arg2, arg3) \ + SDT_PROBE4(sctp, , , probe, arg0, arg1, arg2, arg3) +#define SCTP_PROBE5(probe, arg0, arg1, arg2, arg3, arg4) \ + SDT_PROBE5(sctp, , , probe, arg0, arg1, arg2, arg3, arg4) +#define SCTP_PROBE6(probe, arg0, arg1, arg2, arg3, arg4, arg5) \ + SDT_PROBE6(sctp, , , probe, arg0, arg1, arg2, arg3, arg4, arg5) + /* Declare the SCTP provider */ SDT_PROVIDER_DECLARE(sctp); @@ -63,19 +76,15 @@ SDT_PROBE_DECLARE(sctp, cwnd, net, pd); /* Rttvar probe declaration */ SDT_PROBE_DECLARE(sctp, cwnd, net, rttvar); SDT_PROBE_DECLARE(sctp, cwnd, net, rttstep); - /* One to track an associations rwnd */ SDT_PROBE_DECLARE(sctp, rwnd, assoc, val); - /* One to track a net's flight size */ SDT_PROBE_DECLARE(sctp, flightsize, net, val); - /* One to track an associations flight size */ SDT_PROBE_DECLARE(sctp, flightsize, assoc, val); - - - - - +/* Standard Solaris compatible probes */ +SDT_PROBE_DECLARE(sctp,,, receive); +SDT_PROBE_DECLARE(sctp,,, send); +SDT_PROBE_DECLARE(sctp,,, state__change); #endif Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Mon Oct 14 20:32:08 2019 (r353517) +++ head/sys/netinet/sctp_output.c Mon Oct 14 20:32:11 2019 (r353518) @@ -52,12 +52,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #if defined(INET) || defined(INET6) #include #endif #include #include -#include Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Mon Oct 14 20:32:08 2019 (r353517) +++ head/sys/netinet/sctputil.c Mon Oct 14 20:32:11 2019 (r353518) @@ -51,12 +51,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #if defined(INET6) || defined(INET) #include #endif #include #include -#include #include #ifdef INET6 #include From owner-svn-src-all@freebsd.org Mon Oct 14 20:32:29 2019 Return-Path: Delivered-To: svn-src-all@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 C0F4D13753F; Mon, 14 Oct 2019 20:32:29 +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 46sVbx2nd8z3Nm8; Mon, 14 Oct 2019 20:32:29 +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 38DB5AAEC; Mon, 14 Oct 2019 20:32:29 +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 x9EKWTYf076185; Mon, 14 Oct 2019 20:32:29 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKWTLq076184; Mon, 14 Oct 2019 20:32:29 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142032.x9EKWTLq076184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 20:32:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353519 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 353519 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:32:29 -0000 Author: glebius Date: Mon Oct 14 20:32:28 2019 New Revision: 353519 URL: https://svnweb.freebsd.org/changeset/base/353519 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: hselasky Modified: head/sys/dev/usb/net/if_aue.c Modified: head/sys/dev/usb/net/if_aue.c ============================================================================== --- head/sys/dev/usb/net/if_aue.c Mon Oct 14 20:32:11 2019 (r353518) +++ head/sys/dev/usb/net/if_aue.c Mon Oct 14 20:32:28 2019 (r353519) @@ -540,13 +540,23 @@ aue_miibus_statchg(device_t dev) } #define AUE_BITS 6 +static u_int +aue_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint8_t *hashtbl = arg; + uint32_t h; + + h = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN) & ((1 << AUE_BITS) - 1); + hashtbl[(h >> 3)] |= 1 << (h & 0x7); + + return (1); +} + static void aue_setmulti(struct usb_ether *ue) { struct aue_softc *sc = uether_getsc(ue); struct ifnet *ifp = uether_getifp(ue); - struct ifmultiaddr *ifma; - uint32_t h = 0; uint32_t i; uint8_t hashtbl[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -560,15 +570,7 @@ aue_setmulti(struct usb_ether *ue) AUE_CLRBIT(sc, AUE_CTL0, AUE_CTL0_ALLMULTI); /* now program new ones */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_le(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) & ((1 << AUE_BITS) - 1); - hashtbl[(h >> 3)] |= 1 << (h & 0x7); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, aue_hash_maddr, hashtbl); /* write the hashtable */ for (i = 0; i != 8; i++) From owner-svn-src-all@freebsd.org Mon Oct 14 20:33:15 2019 Return-Path: Delivered-To: svn-src-all@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 AF1AD137718; Mon, 14 Oct 2019 20:33:15 +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 46sVcq3nrfz3Nwq; Mon, 14 Oct 2019 20:33:15 +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 65162AAF0; Mon, 14 Oct 2019 20:33:15 +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 x9EKXFSj076295; Mon, 14 Oct 2019 20:33:15 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKXFaW076294; Mon, 14 Oct 2019 20:33:15 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142033.x9EKXFaW076294@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 20:33:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353520 - head/sys/dev/sfxge X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/sfxge X-SVN-Commit-Revision: 353520 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:33:15 -0000 Author: glebius Date: Mon Oct 14 20:33:14 2019 New Revision: 353520 URL: https://svnweb.freebsd.org/changeset/base/353520 Log: Convert to if_foreach_llmaddr() KPI. Reviewed by: philip Modified: head/sys/dev/sfxge/sfxge_port.c Modified: head/sys/dev/sfxge/sfxge_port.c ============================================================================== --- head/sys/dev/sfxge/sfxge_port.c Mon Oct 14 20:32:28 2019 (r353519) +++ head/sys/dev/sfxge/sfxge_port.c Mon Oct 14 20:33:14 2019 (r353520) @@ -358,36 +358,35 @@ done: SFXGE_PORT_UNLOCK(port); } +static u_int +sfxge_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint8_t *mcast_addr = arg; + + if (cnt == EFX_MAC_MULTICAST_LIST_MAX) + return (0); + + memcpy(mcast_addr + (cnt * EFX_MAC_ADDR_LEN), LLADDR(sdl), + EFX_MAC_ADDR_LEN); + + return (1); +} + static int sfxge_mac_multicast_list_set(struct sfxge_softc *sc) { struct ifnet *ifp = sc->ifnet; struct sfxge_port *port = &sc->port; - uint8_t *mcast_addr = port->mcast_addrs; - struct ifmultiaddr *ifma; - struct sockaddr_dl *sa; int rc = 0; mtx_assert(&port->lock, MA_OWNED); - port->mcast_count = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family == AF_LINK) { - if (port->mcast_count == EFX_MAC_MULTICAST_LIST_MAX) { - device_printf(sc->dev, - "Too many multicast addresses\n"); - rc = EINVAL; - break; - } - - sa = (struct sockaddr_dl *)ifma->ifma_addr; - memcpy(mcast_addr, LLADDR(sa), EFX_MAC_ADDR_LEN); - mcast_addr += EFX_MAC_ADDR_LEN; - ++port->mcast_count; - } + port->mcast_count = if_foreach_llmaddr(ifp, sfxge_copy_maddr, + port->mcast_addrs); + if (port->mcast_count == EFX_MAC_MULTICAST_LIST_MAX) { + device_printf(sc->dev, "Too many multicast addresses\n"); + rc = EINVAL; } - if_maddr_runlock(ifp); if (rc == 0) { rc = efx_mac_multicast_list_set(sc->enp, port->mcast_addrs, @@ -485,6 +484,7 @@ int sfxge_port_start(struct sfxge_softc *sc) { uint8_t mac_addr[ETHER_ADDR_LEN]; + struct epoch_tracker et; struct ifnet *ifp = sc->ifnet; struct sfxge_port *port; efx_nic_t *enp; @@ -518,10 +518,10 @@ sfxge_port_start(struct sfxge_softc *sc) goto fail3; /* Set the unicast address */ - if_addr_rlock(ifp); + NET_EPOCH_ENTER(et); bcopy(LLADDR((struct sockaddr_dl *)ifp->if_addr->ifa_addr), mac_addr, sizeof(mac_addr)); - if_addr_runlock(ifp); + NET_EPOCH_EXIT(et); if ((rc = efx_mac_addr_set(enp, mac_addr)) != 0) goto fail4; From owner-svn-src-all@freebsd.org Mon Oct 14 20:55:01 2019 Return-Path: Delivered-To: svn-src-all@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 E67B8137DDB; Mon, 14 Oct 2019 20:55:01 +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 46sW5x5p7sz3PpZ; Mon, 14 Oct 2019 20:55:01 +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 AA627AE70; Mon, 14 Oct 2019 20:55:01 +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 x9EKt1tG088440; Mon, 14 Oct 2019 20:55:01 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EKt1hT088438; Mon, 14 Oct 2019 20:55:01 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910142055.x9EKt1hT088438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 14 Oct 2019 20:55:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353521 - in head/sys/x86: include x86 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys/x86: include x86 X-SVN-Commit-Revision: 353521 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 20:55:02 -0000 Author: cem Date: Mon Oct 14 20:55:01 2019 New Revision: 353521 URL: https://svnweb.freebsd.org/changeset/base/353521 Log: x86: Use canonical spelling of MOVDIR64B feature/instruction The former spelling probably confused MOVDIR64B with MOVDIRI64. MOVDIR_64B is the 64-*byte* direct store instruction; MOVDIR_I64 is the 64-*bit* direct store instruction (underscores added here for clarity; they are not part of the canonical instruction name). No functional change. Sponsored by: Dell EMC Isilon Modified: head/sys/x86/include/specialreg.h head/sys/x86/x86/identcpu.c Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Mon Oct 14 20:33:14 2019 (r353520) +++ head/sys/x86/include/specialreg.h Mon Oct 14 20:55:01 2019 (r353521) @@ -449,7 +449,7 @@ #define CPUID_STDEXT2_RDPID 0x00400000 #define CPUID_STDEXT2_CLDEMOTE 0x02000000 #define CPUID_STDEXT2_MOVDIRI 0x08000000 -#define CPUID_STDEXT2_MOVDIRI64B 0x10000000 +#define CPUID_STDEXT2_MOVDIR64B 0x10000000 #define CPUID_STDEXT2_ENQCMD 0x20000000 #define CPUID_STDEXT2_SGXLC 0x40000000 Modified: head/sys/x86/x86/identcpu.c ============================================================================== --- head/sys/x86/x86/identcpu.c Mon Oct 14 20:33:14 2019 (r353520) +++ head/sys/x86/x86/identcpu.c Mon Oct 14 20:55:01 2019 (r353521) @@ -993,7 +993,7 @@ printcpuinfo(void) "\027RDPID" "\032CLDEMOTE" "\034MOVDIRI" - "\035MOVDIRI64B" + "\035MOVDIR64B" "\036ENQCMD" "\037SGXLC" ); From owner-svn-src-all@freebsd.org Mon Oct 14 21:18:37 2019 Return-Path: Delivered-To: svn-src-all@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 B58EC1403FB; Mon, 14 Oct 2019 21:18:37 +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 46sWd94LT3z3QkK; Mon, 14 Oct 2019 21:18:37 +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 784A3B1FC; Mon, 14 Oct 2019 21:18:37 +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 x9ELIbpX000309; Mon, 14 Oct 2019 21:18:37 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ELIblW000308; Mon, 14 Oct 2019 21:18:37 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910142118.x9ELIblW000308@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 14 Oct 2019 21:18:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353522 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353522 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 21:18:37 -0000 Author: glebius Date: Mon Oct 14 21:18:37 2019 New Revision: 353522 URL: https://svnweb.freebsd.org/changeset/base/353522 Log: if_delmulti() is never called without ifp argument, assert this instead of doing a useless search through interfaces. Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon Oct 14 20:55:01 2019 (r353521) +++ head/sys/net/if.c Mon Oct 14 21:18:37 2019 (r353522) @@ -3614,21 +3614,8 @@ if_delmulti(struct ifnet *ifp, struct sockaddr *sa) { struct ifmultiaddr *ifma; int lastref; -#ifdef INVARIANTS - struct ifnet *oifp; - NET_EPOCH_ASSERT(); - - CK_STAILQ_FOREACH(oifp, &V_ifnet, if_link) - if (ifp == oifp) - break; - if (ifp != oifp) - ifp = NULL; - - KASSERT(ifp != NULL, ("%s: ifnet went away", __func__)); -#endif - if (ifp == NULL) - return (ENOENT); + KASSERT(ifp, ("%s: NULL ifp", __func__)); IF_ADDR_WLOCK(ifp); lastref = 0; From owner-svn-src-all@freebsd.org Mon Oct 14 21:22:43 2019 Return-Path: Delivered-To: svn-src-all@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 5BD09140797; Mon, 14 Oct 2019 21:22:43 +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 46sWjv1k2Hz3RGS; Mon, 14 Oct 2019 21:22:43 +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 1FCDEB3B6; Mon, 14 Oct 2019 21:22:43 +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 x9ELMgpQ006104; Mon, 14 Oct 2019 21:22:42 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ELMgNj006103; Mon, 14 Oct 2019 21:22:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910142122.x9ELMgNj006103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 14 Oct 2019 21:22:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353523 - head X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 353523 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 21:22:43 -0000 Author: jhb Date: Mon Oct 14 21:22:42 2019 New Revision: 353523 URL: https://svnweb.freebsd.org/changeset/base/353523 Log: Disconnect powerpc from the default tinderbox for now. The wrong toolchain was set in MAKE_PARAMS_powerpc, however, there are some other issues preventing powerpc from building in tinderbox: 1) There is no powerpc-gcc and powerpc-xtoolchain-gcc port that provides an external 32-bit powerpc GCC toolchain. 2) On other targets, the same toolchain can build all of the architectures for a given target. MIPS achieves this by always setting -mabi and -EB/-EL explicitly instead of relying on the compiler's default architecture. PowerPC might be able to do the same thing, but as of today, powerpc-gcc would be required for powerpc and powerpcspe and powerpc64-gcc would be required for powerpc64. Our existing logic for make universe does not permit per-MACHINE_ARCH toolchains. I tried hacking TARGETS_powerpc to only include powerpc64 when powerpc64-gcc was present, and while that skipped the 32-bit worlds, it tried to build all the kernels. Reported by: jeff Discussed with: imp Modified: head/Makefile Modified: head/Makefile ============================================================================== --- head/Makefile Mon Oct 14 21:18:37 2019 (r353522) +++ head/Makefile Mon Oct 14 21:22:42 2019 (r353523) @@ -485,12 +485,15 @@ worlds: .PHONY .if make(universe) || make(universe_kernels) || make(tinderbox) || \ make(targets) || make(universe-toolchain) # -# By default, build only the known-good clang-supporting platforms. -# If MAKE_OBSOLETE_GCC is defined, built all the old GCC architectures. +# Always build architectures supported by clang. Only build architectures +# only supported by GCC if a suitable toolchain is present or enabled. # In all cases, if the user specifies TARGETS on the command line, # honor that most of all. # -_OBSOLETE_GCC_TARGETS=mips powerpc sparc64 +_OBSOLETE_GCC_TARGETS=mips sparc64 +.if defined(MAKE_OBSOLETE_GCC) +_OBSOLETE_GCC_TARGETS+=powerpc +.endif TARGETS?=amd64 arm arm64 i386 riscv ${_OBSOLETE_GCC_TARGETS} _UNIVERSE_TARGETS= ${TARGETS} TARGET_ARCHES_arm?= arm armv6 armv7 @@ -507,7 +510,7 @@ MAKE_PARAMS_riscv?= CROSS_TOOLCHAIN=riscv64-gcc .if !defined(MAKE_OBSOLETE_GCC) OBSOLETE_GCC_TARGETS=${_OBSOLETE_GCC_TARGETS} MAKE_PARAMS_mips?= CROSS_TOOLCHAIN=mips-gcc -MAKE_PARAMS_powerpc?= CROSS_TOOLCHAIN=powerpc-gcc +MAKE_PARAMS_powerpc?= CROSS_TOOLCHAIN=powerpc64-gcc MAKE_PARAMS_sparc64?= CROSS_TOOLCHAIN=sparc64-gcc .endif From owner-svn-src-all@freebsd.org Mon Oct 14 21:45:16 2019 Return-Path: Delivered-To: svn-src-all@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 1D2971410D3; Mon, 14 Oct 2019 21:45:16 +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 46sXCv72fxz3xJF; Mon, 14 Oct 2019 21:45:15 +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 D63E2B73F; Mon, 14 Oct 2019 21:45:15 +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 x9ELjFAV017595; Mon, 14 Oct 2019 21:45:15 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ELjFe6017594; Mon, 14 Oct 2019 21:45:15 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910142145.x9ELjFe6017594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 14 Oct 2019 21:45:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353524 - 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: 353524 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 21:45:16 -0000 Author: manu Date: Mon Oct 14 21:45:15 2019 New Revision: 353524 URL: https://svnweb.freebsd.org/changeset/base/353524 Log: aw_ccung: Add more debug printfs No functional changes MFC after: 1 month Modified: head/sys/arm/allwinner/clkng/aw_ccung.c Modified: head/sys/arm/allwinner/clkng/aw_ccung.c ============================================================================== --- head/sys/arm/allwinner/clkng/aw_ccung.c Mon Oct 14 21:22:42 2019 (r353523) +++ head/sys/arm/allwinner/clkng/aw_ccung.c Mon Oct 14 21:45:15 2019 (r353524) @@ -132,10 +132,12 @@ aw_ccung_reset_assert(device_t dev, intptr_t id, bool mtx_lock(&sc->mtx); val = CCU_READ4(sc, sc->resets[id].offset); + dprintf("offset=%x Read %x\n", sc->resets[id].offset, val); if (reset) val &= ~(1 << sc->resets[id].shift); else val |= 1 << sc->resets[id].shift; + dprintf("offset=%x Write %x\n", sc->resets[id].offset, val); CCU_WRITE4(sc, sc->resets[id].offset, val); mtx_unlock(&sc->mtx); @@ -155,6 +157,7 @@ aw_ccung_reset_is_asserted(device_t dev, intptr_t id, mtx_lock(&sc->mtx); val = CCU_READ4(sc, sc->resets[id].offset); + dprintf("offset=%x Read %x\n", sc->resets[id].offset, val); *reset = (val & (1 << sc->resets[id].shift)) != 0 ? false : true; mtx_unlock(&sc->mtx); From owner-svn-src-all@freebsd.org Mon Oct 14 21:47:22 2019 Return-Path: Delivered-To: svn-src-all@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 085FA1412C2; Mon, 14 Oct 2019 21:47:22 +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 46sXGK6MLgz3xW7; Mon, 14 Oct 2019 21:47:21 +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 A4283B74E; Mon, 14 Oct 2019 21:47:21 +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 x9ELlL85017730; Mon, 14 Oct 2019 21:47:21 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ELlKP5017725; Mon, 14 Oct 2019 21:47:20 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910142147.x9ELlKP5017725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 14 Oct 2019 21:47:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353525 - in head/sys: arm/allwinner/clkng conf X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm/allwinner/clkng conf X-SVN-Commit-Revision: 353525 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 21:47:22 -0000 Author: manu Date: Mon Oct 14 21:47:20 2019 New Revision: 353525 URL: https://svnweb.freebsd.org/changeset/base/353525 Log: arm64: allwinner: Add new clock aw_clk_np This is a clock type present in Allwinner H6 where the formula is : f = fparent * N / P MFC after: 1 month Added: head/sys/arm/allwinner/clkng/aw_clk_np.c (contents, props changed) head/sys/arm/allwinner/clkng/aw_clk_np.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/conf/files.arm64 Modified: head/sys/arm/allwinner/clkng/aw_ccung.c ============================================================================== --- head/sys/arm/allwinner/clkng/aw_ccung.c Mon Oct 14 21:45:15 2019 (r353524) +++ head/sys/arm/allwinner/clkng/aw_ccung.c Mon Oct 14 21:47:20 2019 (r353525) @@ -316,6 +316,10 @@ aw_ccung_attach(device_t dev) break; case AW_CLK_MIPI: aw_clk_mipi_register(sc->clkdom, sc->clks[i].clk.mipi); + break; + case AW_CLK_NP: + aw_clk_np_register(sc->clkdom, sc->clks[i].clk.np); + break; } } Modified: head/sys/arm/allwinner/clkng/aw_ccung.h ============================================================================== --- head/sys/arm/allwinner/clkng/aw_ccung.h Mon Oct 14 21:45:15 2019 (r353524) +++ head/sys/arm/allwinner/clkng/aw_ccung.h Mon Oct 14 21:47:20 2019 (r353525) @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -52,6 +53,7 @@ enum aw_ccung_clk_type { AW_CLK_FRAC, AW_CLK_M, AW_CLK_MIPI, + AW_CLK_NP, }; struct aw_ccung_clk { @@ -66,6 +68,7 @@ struct aw_ccung_clk { struct aw_clk_frac_def *frac; struct aw_clk_m_def *m; struct aw_clk_mipi_def *mipi; + struct aw_clk_np_def *np; } clk; }; Modified: head/sys/arm/allwinner/clkng/aw_clk.h ============================================================================== --- head/sys/arm/allwinner/clkng/aw_clk.h Mon Oct 14 21:45:15 2019 (r353524) +++ head/sys/arm/allwinner/clkng/aw_clk.h Mon Oct 14 21:47:20 2019 (r353525) @@ -407,6 +407,35 @@ aw_clk_factor_get_value(struct aw_clk_factor *factor, .flags = _flags, \ } +#define NP_CLK(_clkname, _id, _name, _pnames, \ + _offset, \ + _nshift, _nwidth, _nvalue, _nflags, \ + _pshift, _pwidth, _pvalue, _pflags, \ + _gate_shift, \ + _lock, _lock_retries, \ + _flags) \ + static struct aw_clk_np_def _clkname = { \ + .clkdef = { \ + .id = _id, \ + .name = _name, \ + .parent_names = _pnames, \ + .parent_cnt = nitems(_pnames), \ + }, \ + .offset = _offset, \ + .n.shift = _nshift, \ + .n.width = _nwidth, \ + .n.value = _nvalue, \ + .n.flags = _nflags, \ + .p.shift = _pshift, \ + .p.width = _pwidth, \ + .p.value = _pvalue, \ + .p.flags = _pflags, \ + .gate_shift = _gate_shift, \ + .lock_shift = _lock, \ + .lock_retries = _lock_retries, \ + .flags = _flags, \ + } + #define PREDIV_CLK(_clkname, _id, _name, _pnames, \ _offset, \ _mux_shift, _mux_width, \ Added: head/sys/arm/allwinner/clkng/aw_clk_np.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/clkng/aw_clk_np.c Mon Oct 14 21:47:20 2019 (r353525) @@ -0,0 +1,267 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * 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 * n / p + * + */ + +struct aw_clk_np_sc { + uint32_t offset; + + struct aw_clk_factor n; + struct aw_clk_factor p; + + uint32_t gate_shift; + uint32_t lock_shift; + uint32_t lock_retries; + + 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_np_init(struct clknode *clk, device_t dev) +{ + struct aw_clk_np_sc *sc; + + sc = clknode_get_softc(clk); + + clknode_init_parent_idx(clk, 0); + return (0); +} + +static int +aw_clk_np_set_gate(struct clknode *clk, bool enable) +{ + struct aw_clk_np_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 uint64_t +aw_clk_np_find_best(struct aw_clk_np_sc *sc, uint64_t fparent, uint64_t *fout, + uint32_t *factor_n, uint32_t *factor_p) +{ + uint64_t cur, best; + uint32_t n, p, max_n, max_p, min_n, min_p; + + *factor_n = *factor_p = 0; + + max_n = aw_clk_factor_get_max(&sc->n); + max_p = aw_clk_factor_get_max(&sc->p); + min_n = aw_clk_factor_get_min(&sc->n); + min_p = aw_clk_factor_get_min(&sc->p); + + for (p = min_p; p <= max_p; ) { + for (n = min_n; n <= max_n; ) { + cur = fparent * n / p; + if (abs(*fout - cur) < abs(*fout - best)) { + best = cur; + *factor_n = n; + *factor_p = p; + } + + n++; + } + p++; + } + + return (best); +} + +static int +aw_clk_np_set_freq(struct clknode *clk, uint64_t fparent, uint64_t *fout, + int flags, int *stop) +{ + struct aw_clk_np_sc *sc; + uint64_t cur, best; + uint32_t val, n, p, best_n, best_p; + int retry; + + sc = clknode_get_softc(clk); + + best = cur = 0; + + best = aw_clk_np_find_best(sc, fparent, fout, + &best_n, &best_p); + + 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); + + n = aw_clk_factor_get_value(&sc->n, best_n); + p = aw_clk_factor_get_value(&sc->p, best_p); + val &= ~sc->n.mask; + val &= ~sc->p.mask; + val |= n << sc->n.shift; + val |= p << sc->p.shift; + + WRITE4(clk, sc->offset, val); + DEVICE_UNLOCK(clk); + + if ((sc->flags & AW_CLK_HAS_LOCK) != 0) { + for (retry = 0; retry < sc->lock_retries; retry++) { + READ4(clk, sc->offset, &val); + if ((val & (1 << sc->lock_shift)) != 0) + break; + DELAY(1000); + } + } + + *fout = best; + *stop = 1; + + return (0); +} + +static int +aw_clk_np_recalc(struct clknode *clk, uint64_t *freq) +{ + struct aw_clk_np_sc *sc; + uint32_t val, n, p; + + sc = clknode_get_softc(clk); + + DEVICE_LOCK(clk); + READ4(clk, sc->offset, &val); + DEVICE_UNLOCK(clk); + + n = aw_clk_get_factor(val, &sc->n); + p = aw_clk_get_factor(val, &sc->p); + + *freq = *freq * n / p; + + return (0); +} + +static clknode_method_t aw_np_clknode_methods[] = { + /* Device interface */ + CLKNODEMETHOD(clknode_init, aw_clk_np_init), + CLKNODEMETHOD(clknode_set_gate, aw_clk_np_set_gate), + CLKNODEMETHOD(clknode_recalc_freq, aw_clk_np_recalc), + CLKNODEMETHOD(clknode_set_freq, aw_clk_np_set_freq), + CLKNODEMETHOD_END +}; + +DEFINE_CLASS_1(aw_np_clknode, aw_np_clknode_class, aw_np_clknode_methods, + sizeof(struct aw_clk_np_sc), clknode_class); + +int +aw_clk_np_register(struct clkdom *clkdom, struct aw_clk_np_def *clkdef) +{ + struct clknode *clk; + struct aw_clk_np_sc *sc; + + clk = clknode_create(clkdom, &aw_np_clknode_class, &clkdef->clkdef); + if (clk == NULL) + return (1); + + sc = clknode_get_softc(clk); + + sc->offset = clkdef->offset; + + sc->n.shift = clkdef->n.shift; + sc->n.width = clkdef->n.width; + sc->n.mask = ((1 << sc->n.width) - 1) << sc->n.shift; + sc->n.value = clkdef->n.value; + sc->n.flags = clkdef->n.flags; + + sc->p.shift = clkdef->p.shift; + sc->p.width = clkdef->p.width; + sc->p.mask = ((1 << sc->p.width) - 1) << sc->p.shift; + sc->p.value = clkdef->p.value; + sc->p.flags = clkdef->p.flags; + + sc->gate_shift = clkdef->gate_shift; + + sc->lock_shift = clkdef->lock_shift; + sc->lock_retries = clkdef->lock_retries; + + sc->flags = clkdef->flags; + + clknode_register(clkdom, clk); + + return (0); +} Added: head/sys/arm/allwinner/clkng/aw_clk_np.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/clkng/aw_clk_np.h Mon Oct 14 21:47:20 2019 (r353525) @@ -0,0 +1,51 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * 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_NP_H__ +#define __AW_CLK_NP_H__ + +#include + +struct aw_clk_np_def { + struct clknode_init_def clkdef; + uint32_t offset; + + struct aw_clk_factor n; + struct aw_clk_factor p; + + uint32_t gate_shift; + uint32_t lock_shift; + uint32_t lock_retries; + + uint32_t flags; +}; + +int aw_clk_np_register(struct clkdom *clkdom, struct aw_clk_np_def *clkdef); + +#endif /* __AW_CLK_NP_H__ */ Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Mon Oct 14 21:45:15 2019 (r353524) +++ head/sys/conf/files.arm64 Mon Oct 14 21:47:20 2019 (r353525) @@ -53,6 +53,7 @@ arm/allwinner/clkng/aw_clk_m.c optional aw_ccu fdt arm/allwinner/clkng/aw_clk_mipi.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_np.c optional aw_ccu fdt arm/allwinner/clkng/aw_clk_prediv_mux.c optional aw_ccu fdt arm/allwinner/clkng/ccu_a64.c optional soc_allwinner_a64 aw_ccu fdt arm/allwinner/clkng/ccu_h3.c optional soc_allwinner_h5 aw_ccu fdt From owner-svn-src-all@freebsd.org Mon Oct 14 21:49:09 2019 Return-Path: Delivered-To: svn-src-all@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 23D981413C5; Mon, 14 Oct 2019 21:49:09 +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 46sXJN66xyz3xfj; Mon, 14 Oct 2019 21:49:08 +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 9CFC4B753; Mon, 14 Oct 2019 21:49:08 +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 x9ELn8fo017854; Mon, 14 Oct 2019 21:49:08 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ELn7eR017848; Mon, 14 Oct 2019 21:49:07 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910142149.x9ELn7eR017848@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 14 Oct 2019 21:49:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353526 - in head/sys: arm/allwinner/clkng conf X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm/allwinner/clkng conf X-SVN-Commit-Revision: 353526 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 21:49:09 -0000 Author: manu Date: Mon Oct 14 21:49:07 2019 New Revision: 353526 URL: https://svnweb.freebsd.org/changeset/base/353526 Log: arm64: allwinner: Add aw_clk_nmm clock This is a clock type present on Allwinner H6 where the formula is : f = fparent * n / m0 / m1 MFC after: 1 month Added: head/sys/arm/allwinner/clkng/aw_clk_nmm.c (contents, props changed) head/sys/arm/allwinner/clkng/aw_clk_nmm.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/conf/files.arm64 Modified: head/sys/arm/allwinner/clkng/aw_ccung.c ============================================================================== --- head/sys/arm/allwinner/clkng/aw_ccung.c Mon Oct 14 21:47:20 2019 (r353525) +++ head/sys/arm/allwinner/clkng/aw_ccung.c Mon Oct 14 21:49:07 2019 (r353526) @@ -320,6 +320,9 @@ aw_ccung_attach(device_t dev) case AW_CLK_NP: aw_clk_np_register(sc->clkdom, sc->clks[i].clk.np); break; + case AW_CLK_NMM: + aw_clk_nmm_register(sc->clkdom, sc->clks[i].clk.nmm); + break; } } Modified: head/sys/arm/allwinner/clkng/aw_ccung.h ============================================================================== --- head/sys/arm/allwinner/clkng/aw_ccung.h Mon Oct 14 21:47:20 2019 (r353525) +++ head/sys/arm/allwinner/clkng/aw_ccung.h Mon Oct 14 21:49:07 2019 (r353526) @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -54,6 +55,7 @@ enum aw_ccung_clk_type { AW_CLK_M, AW_CLK_MIPI, AW_CLK_NP, + AW_CLK_NMM, }; struct aw_ccung_clk { @@ -69,6 +71,7 @@ struct aw_ccung_clk { struct aw_clk_m_def *m; struct aw_clk_mipi_def *mipi; struct aw_clk_np_def *np; + struct aw_clk_nmm_def *nmm; } clk; }; Modified: head/sys/arm/allwinner/clkng/aw_clk.h ============================================================================== --- head/sys/arm/allwinner/clkng/aw_clk.h Mon Oct 14 21:47:20 2019 (r353525) +++ head/sys/arm/allwinner/clkng/aw_clk.h Mon Oct 14 21:49:07 2019 (r353526) @@ -407,6 +407,40 @@ aw_clk_factor_get_value(struct aw_clk_factor *factor, .flags = _flags, \ } +#define NMM_CLK(_clkname, _id, _name, _pnames, \ + _offset, \ + _nshift, _nwidth, _nvalue, _nflags, \ + _m0shift, _m0width, _m0value, _m0flags, \ + _m1shift, _m1width, _m1value, _m1flags, \ + _gate_shift, \ + _lock, _lock_retries, \ + _flags) \ + static struct aw_clk_nmm_def _clkname = { \ + .clkdef = { \ + .id = _id, \ + .name = _name, \ + .parent_names = _pnames, \ + .parent_cnt = nitems(_pnames), \ + }, \ + .offset = _offset, \ + .n.shift = _nshift, \ + .n.width = _nwidth, \ + .n.value = _nvalue, \ + .n.flags = _nflags, \ + .m0.shift = _m0shift, \ + .m0.width = _m0width, \ + .m0.value = _m0value, \ + .m0.flags = _m0flags, \ + .m1.shift = _m1shift, \ + .m1.width = _m1width, \ + .m1.value = _m1value, \ + .m1.flags = _m1flags, \ + .gate_shift = _gate_shift, \ + .lock_shift = _lock, \ + .lock_retries = _lock_retries, \ + .flags = _flags, \ + } + #define NP_CLK(_clkname, _id, _name, _pnames, \ _offset, \ _nshift, _nwidth, _nvalue, _nflags, \ Added: head/sys/arm/allwinner/clkng/aw_clk_nmm.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/clkng/aw_clk_nmm.c Mon Oct 14 21:49:07 2019 (r353526) @@ -0,0 +1,285 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * 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 * n / m0 / m1 + * + */ + +struct aw_clk_nmm_sc { + uint32_t offset; + + struct aw_clk_factor n; + struct aw_clk_factor m0; + struct aw_clk_factor m1; + + uint32_t gate_shift; + uint32_t lock_shift; + uint32_t lock_retries; + + 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_nmm_init(struct clknode *clk, device_t dev) +{ + struct aw_clk_nmm_sc *sc; + + sc = clknode_get_softc(clk); + + clknode_init_parent_idx(clk, 0); + return (0); +} + +static int +aw_clk_nmm_set_gate(struct clknode *clk, bool enable) +{ + struct aw_clk_nmm_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 uint64_t +aw_clk_nmm_find_best(struct aw_clk_nmm_sc *sc, uint64_t fparent, uint64_t *fout, + uint32_t *factor_n, uint32_t *factor_m0, uint32_t *factor_m1) +{ + uint64_t cur, best; + uint32_t n, m0, m1; + uint32_t max_n, max_m0, max_m1; + uint32_t min_n, min_m0, min_m1; + + *factor_n = *factor_m0 = *factor_m1 = 0; + + max_n = aw_clk_factor_get_max(&sc->n); + min_n = aw_clk_factor_get_min(&sc->n); + max_m0 = aw_clk_factor_get_max(&sc->m0); + min_m0 = aw_clk_factor_get_min(&sc->m0); + max_m1 = aw_clk_factor_get_max(&sc->m1); + min_m1 = aw_clk_factor_get_min(&sc->m1); + + for (m0 = min_m0; m0 <= max_m0; ) { + for (m1 = min_m1; m1 <= max_m1; ) { + for (n = min_n; n <= max_n; ) { + cur = fparent * n / m0 / m1; + if (abs(*fout - cur) < abs(*fout - best)) { + best = cur; + *factor_n = n; + *factor_m0 = m0; + *factor_m1 = m1; + } + n++; + } + m1++; + } + m0++; + } + + return (best); +} + +static int +aw_clk_nmm_set_freq(struct clknode *clk, uint64_t fparent, uint64_t *fout, + int flags, int *stop) +{ + struct aw_clk_nmm_sc *sc; + uint64_t cur, best; + uint32_t val, n, m0, m1, best_n, best_m0, best_m1; + int retry; + + sc = clknode_get_softc(clk); + + best = cur = 0; + + best = aw_clk_nmm_find_best(sc, fparent, fout, + &best_n, &best_m0, &best_m1); + + 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); + + n = aw_clk_factor_get_value(&sc->n, best_n); + m0 = aw_clk_factor_get_value(&sc->m0, best_m0); + m1 = aw_clk_factor_get_value(&sc->m1, best_m1); + val &= ~sc->n.mask; + val &= ~sc->m0.mask; + val &= ~sc->m1.mask; + val |= n << sc->n.shift; + val |= m0 << sc->m0.shift; + val |= m1 << sc->m1.shift; + + WRITE4(clk, sc->offset, val); + DEVICE_UNLOCK(clk); + + if ((sc->flags & AW_CLK_HAS_LOCK) != 0) { + for (retry = 0; retry < sc->lock_retries; retry++) { + READ4(clk, sc->offset, &val); + if ((val & (1 << sc->lock_shift)) != 0) + break; + DELAY(1000); + } + } + + *fout = best; + *stop = 1; + + return (0); +} + +static int +aw_clk_nmm_recalc(struct clknode *clk, uint64_t *freq) +{ + struct aw_clk_nmm_sc *sc; + uint32_t val, n, m0, m1; + + sc = clknode_get_softc(clk); + + DEVICE_LOCK(clk); + READ4(clk, sc->offset, &val); + DEVICE_UNLOCK(clk); + + n = aw_clk_get_factor(val, &sc->n); + m0 = aw_clk_get_factor(val, &sc->m0); + m1 = aw_clk_get_factor(val, &sc->m1); + + *freq = *freq * n / m0 / m1; + + return (0); +} + +static clknode_method_t aw_nmm_clknode_methods[] = { + /* Device interface */ + CLKNODEMETHOD(clknode_init, aw_clk_nmm_init), + CLKNODEMETHOD(clknode_set_gate, aw_clk_nmm_set_gate), + CLKNODEMETHOD(clknode_recalc_freq, aw_clk_nmm_recalc), + CLKNODEMETHOD(clknode_set_freq, aw_clk_nmm_set_freq), + CLKNODEMETHOD_END +}; + +DEFINE_CLASS_1(aw_nmm_clknode, aw_nmm_clknode_class, aw_nmm_clknode_methods, + sizeof(struct aw_clk_nmm_sc), clknode_class); + +int +aw_clk_nmm_register(struct clkdom *clkdom, struct aw_clk_nmm_def *clkdef) +{ + struct clknode *clk; + struct aw_clk_nmm_sc *sc; + + clk = clknode_create(clkdom, &aw_nmm_clknode_class, &clkdef->clkdef); + if (clk == NULL) + return (1); + + sc = clknode_get_softc(clk); + + sc->offset = clkdef->offset; + + sc->n.shift = clkdef->n.shift; + sc->n.width = clkdef->n.width; + sc->n.mask = ((1 << sc->n.width) - 1) << sc->n.shift; + sc->n.value = clkdef->n.value; + sc->n.flags = clkdef->n.flags; + + sc->m0.shift = clkdef->m0.shift; + sc->m0.width = clkdef->m0.width; + sc->m0.mask = ((1 << sc->m0.width) - 1) << sc->m0.shift; + sc->m0.value = clkdef->m0.value; + sc->m0.flags = clkdef->m0.flags; + + sc->m1.shift = clkdef->m1.shift; + sc->m1.width = clkdef->m1.width; + sc->m1.mask = ((1 << sc->m1.width) - 1) << sc->m1.shift; + sc->m1.value = clkdef->m1.value; + sc->m1.flags = clkdef->m1.flags; + + sc->gate_shift = clkdef->gate_shift; + + sc->lock_shift = clkdef->lock_shift; + sc->lock_retries = clkdef->lock_retries; + + sc->flags = clkdef->flags; + + clknode_register(clkdom, clk); + + return (0); +} Added: head/sys/arm/allwinner/clkng/aw_clk_nmm.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/clkng/aw_clk_nmm.h Mon Oct 14 21:49:07 2019 (r353526) @@ -0,0 +1,52 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * 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_NMM_H__ +#define __AW_CLK_NMM_H__ + +#include + +struct aw_clk_nmm_def { + struct clknode_init_def clkdef; + uint32_t offset; + + struct aw_clk_factor n; + struct aw_clk_factor m0; + struct aw_clk_factor m1; + + uint32_t gate_shift; + uint32_t lock_shift; + uint32_t lock_retries; + + uint32_t flags; +}; + +int aw_clk_nmm_register(struct clkdom *clkdom, struct aw_clk_nmm_def *clkdef); + +#endif /* __AW_CLK_NMM_H__ */ Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Mon Oct 14 21:47:20 2019 (r353525) +++ head/sys/conf/files.arm64 Mon Oct 14 21:49:07 2019 (r353526) @@ -53,6 +53,7 @@ arm/allwinner/clkng/aw_clk_m.c optional aw_ccu fdt arm/allwinner/clkng/aw_clk_mipi.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_nmm.c optional aw_ccu fdt arm/allwinner/clkng/aw_clk_np.c optional aw_ccu fdt arm/allwinner/clkng/aw_clk_prediv_mux.c optional aw_ccu fdt arm/allwinner/clkng/ccu_a64.c optional soc_allwinner_a64 aw_ccu fdt From owner-svn-src-all@freebsd.org Mon Oct 14 21:50:45 2019 Return-Path: Delivered-To: svn-src-all@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 3CB741415DC; Mon, 14 Oct 2019 21:50:45 +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 46sXLF0xknz3y3j; Mon, 14 Oct 2019 21:50:45 +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 02B06B761; Mon, 14 Oct 2019 21:50:45 +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 x9ELoiFH017998; Mon, 14 Oct 2019 21:50:44 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ELoi6o017997; Mon, 14 Oct 2019 21:50:44 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910142150.x9ELoi6o017997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 14 Oct 2019 21:50:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353527 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 353527 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 21:50:45 -0000 Author: manu Date: Mon Oct 14 21:50:44 2019 New Revision: 353527 URL: https://svnweb.freebsd.org/changeset/base/353527 Log: arm: allwinner: Disable the clock before changing it's freq You aren't supposed to changing the freq of a clock when it is enable so disable the clock before changing the freq and then re-enable it. MFC after: 1 month Modified: head/sys/arm/allwinner/aw_mmc.c Modified: head/sys/arm/allwinner/aw_mmc.c ============================================================================== --- head/sys/arm/allwinner/aw_mmc.c Mon Oct 14 21:49:07 2019 (r353526) +++ head/sys/arm/allwinner/aw_mmc.c Mon Oct 14 21:50:44 2019 (r353527) @@ -1433,6 +1433,10 @@ aw_mmc_update_ios(device_t bus, device_t child) } /* Set the MMC clock. */ + error = clk_disable(sc->aw_clk_mmc); + if (error != 0 && bootverbose) + device_printf(sc->aw_dev, + "failed to disable mmc clock: %d\n", error); error = clk_set_freq(sc->aw_clk_mmc, clock, CLK_SET_ROUND_DOWN); if (error != 0) { @@ -1441,6 +1445,10 @@ aw_mmc_update_ios(device_t bus, device_t child) clock, error); return (error); } + error = clk_enable(sc->aw_clk_mmc); + if (error != 0 && bootverbose) + device_printf(sc->aw_dev, + "failed to re-enable mmc clock: %d\n", error); if (sc->aw_mmc_conf->can_calibrate) AW_MMC_WRITE_4(sc, AW_MMC_SAMP_DL, AW_MMC_SAMP_DL_SW_EN); From owner-svn-src-all@freebsd.org Mon Oct 14 21:53:55 2019 Return-Path: Delivered-To: svn-src-all@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 47D8A14186B; Mon, 14 Oct 2019 21:53:55 +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 46sXPv1s54z3yK9; Mon, 14 Oct 2019 21:53:55 +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 22BE5B90B; Mon, 14 Oct 2019 21:53:55 +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 x9ELrtJB023572; Mon, 14 Oct 2019 21:53:55 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ELrs6D023567; Mon, 14 Oct 2019 21:53:54 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910142153.x9ELrs6D023567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 14 Oct 2019 21:53:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353528 - in head/sys: arm/allwinner/clkng arm64/conf conf X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm/allwinner/clkng arm64/conf conf X-SVN-Commit-Revision: 353528 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 21:53:55 -0000 Author: manu Date: Mon Oct 14 21:53:53 2019 New Revision: 353528 URL: https://svnweb.freebsd.org/changeset/base/353528 Log: arm64: allwinner: Add Allwinner H6 Support This adds support for H6 SoC. Add a CCU driver for H6 that support all PLLs and most of the clocks that we are intersted in for now (i2c, mmc, usb, etc ...) MFC after: 1 month Added: head/sys/arm/allwinner/clkng/ccu_h6.c (contents, props changed) head/sys/arm/allwinner/clkng/ccu_h6_r.c (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 head/sys/conf/options.arm64 Added: head/sys/arm/allwinner/clkng/ccu_h6.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/clkng/ccu_h6.c Mon Oct 14 21:53:53 2019 (r353528) @@ -0,0 +1,501 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * 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 + +#include + +#include +#include + +#include +#include +#include + +#include + +#include +#include + +/* Non-exported clocks */ +#define CLK_OSC_12M 0 +#define CLK_PLL_CPUX 1 +#define CLK_PLL_DDR0 2 +#define CLK_PLL_PERIPH0_2X 4 +#define CLK_PLL_PERIPH0_4X 5 +#define CLK_PLL_PERIPH1 6 +#define CLK_PLL_PERIPH1_2X 7 +#define CLK_PLL_PERIPH1_4X 8 +#define CLK_PLL_GPU 9 +#define CLK_PLL_VIDEO0 10 +#define CLK_PLL_VIDEO0_4X 11 +#define CLK_PLL_VIDEO1 12 +#define CLK_PLL_VIDEO1_4X 13 +#define CLK_PLL_VE 14 +#define CLK_PLL_DE 14 +#define CLK_PLL_HSIC 16 + +#define CLK_PSI_AHB1_AHB2 24 +#define CLK_AHB3 25 +#define CLK_APB2 27 + +static struct aw_ccung_reset h6_ccu_resets[] = { + /* PSI_BGR_REG */ + CCU_RESET(RST_BUS_PSI, 0x79c, 16) + + /* SMHC_BGR_REG */ + CCU_RESET(RST_BUS_MMC0, 0x84c, 16) + CCU_RESET(RST_BUS_MMC1, 0x84c, 17) + CCU_RESET(RST_BUS_MMC2, 0x84c, 18) + + /* UART_BGR_REG */ + CCU_RESET(RST_BUS_UART0, 0x90c, 16) + CCU_RESET(RST_BUS_UART1, 0x90c, 17) + CCU_RESET(RST_BUS_UART2, 0x90c, 18) + CCU_RESET(RST_BUS_UART3, 0x90c, 19) + + /* TWI_BGR_REG */ + CCU_RESET(RST_BUS_I2C0, 0x91c, 16) + CCU_RESET(RST_BUS_I2C1, 0x91c, 17) + CCU_RESET(RST_BUS_I2C2, 0x91c, 18) + CCU_RESET(RST_BUS_I2C3, 0x91c, 19) + + /* EMAC_BGR_REG */ + CCU_RESET(RST_BUS_EMAC, 0x97c, 16) + + /* USB0_CLK_REG */ + CCU_RESET(RST_USB_PHY0, 0xa70, 30) + + /* USB1_CLK_REG */ + CCU_RESET(RST_USB_PHY1, 0xa74, 30) + + /* USB3_CLK_REG */ + CCU_RESET(RST_USB_HSIC, 0xa7c, 28) + CCU_RESET(RST_USB_PHY3, 0xa7c, 30) + + /* USB_BGR_REG */ + CCU_RESET(RST_BUS_OHCI0, 0xa8c, 16) + CCU_RESET(RST_BUS_OHCI3, 0xa8c, 19) + CCU_RESET(RST_BUS_EHCI0, 0xa8c, 20) + CCU_RESET(RST_BUS_XHCI, 0xa8c, 21) + CCU_RESET(RST_BUS_EHCI3, 0xa8c, 23) + CCU_RESET(RST_BUS_OTG, 0xa8c, 24) +}; + +static struct aw_ccung_gate h6_ccu_gates[] = { + /* PSI_BGR_REG */ + CCU_GATE(CLK_BUS_PSI, "bus-psi", "psi_ahb1_ahb2", 0x79c, 0) + + /* SMHC_BGR_REG */ + CCU_GATE(CLK_BUS_MMC0, "bus-mmc0", "ahb3", 0x84c, 0) + CCU_GATE(CLK_BUS_MMC1, "bus-mmc1", "ahb3", 0x84c, 1) + CCU_GATE(CLK_BUS_MMC2, "bus-mmc2", "ahb3", 0x84c, 2) + + /* UART_BGR_REG Enabling the gate enable weir behavior ... */ + /* CCU_GATE(CLK_BUS_UART0, "bus-uart0", "apb2", 0x90c, 0) */ + /* CCU_GATE(CLK_BUS_UART1, "bus-uart1", "apb2", 0x90c, 1) */ + /* CCU_GATE(CLK_BUS_UART2, "bus-uart2", "apb2", 0x90c, 2) */ + /* CCU_GATE(CLK_BUS_UART3, "bus-uart3", "apb2", 0x90c, 3) */ + + /* TWI_BGR_REG */ + CCU_GATE(CLK_BUS_I2C0, "bus-i2c0", "apb2", 0x91c, 0) + CCU_GATE(CLK_BUS_I2C1, "bus-i2c1", "apb2", 0x91c, 1) + CCU_GATE(CLK_BUS_I2C2, "bus-i2c2", "apb2", 0x91c, 2) + CCU_GATE(CLK_BUS_I2C3, "bus-i2c3", "apb2", 0x91c, 3) + + /* EMAC_BGR_REG */ + CCU_GATE(CLK_BUS_EMAC, "bus-emac", "ahb3", 0x97c, 0) + + /* USB0_CLK_REG */ + CCU_GATE(CLK_USB_PHY0, "usb-phy0", "ahb3", 0xa70, 29) + CCU_GATE(CLK_USB_OHCI0, "usb-ohci0", "ahb3", 0xa70, 31) + + /* USB1_CLK_REG */ + CCU_GATE(CLK_USB_PHY1, "usb-phy1", "ahb3", 0xa74, 29) + + /* USB3_CLK_REG */ + CCU_GATE(CLK_USB_HSIC, "usb-hsic", "ahb3", 0xa7c, 26) + CCU_GATE(CLK_USB_HSIC_12M, "usb-hsic-12M", "ahb3", 0xa7c, 27) + CCU_GATE(CLK_USB_PHY3, "usb-phy3", "ahb3", 0xa7c, 29) + CCU_GATE(CLK_USB_OHCI3, "usb-ohci3", "ahb3", 0xa7c, 31) + + /* USB_BGR_REG */ + CCU_GATE(CLK_BUS_OHCI0, "bus-ohci0", "ahb3", 0xa8c, 0) + CCU_GATE(CLK_BUS_OHCI3, "bus-ohci3", "ahb3", 0xa8c, 3) + CCU_GATE(CLK_BUS_EHCI0, "bus-ehci0", "ahb3", 0xa8c, 4) + CCU_GATE(CLK_BUS_XHCI, "bus-xhci", "ahb3", 0xa8c, 5) + CCU_GATE(CLK_BUS_EHCI3, "bus-ehci3", "ahb3", 0xa8c, 7) + CCU_GATE(CLK_BUS_OTG, "bus-otg", "ahb3", 0xa8c, 8) +}; + +static const char *osc12m_parents[] = {"osc24M"}; +FIXED_CLK(osc12m_clk, + CLK_OSC_12M, /* id */ + "osc12M", /* name */ + osc12m_parents, /* parent */ + 0, /* freq */ + 1, /* mult */ + 2, /* div */ + 0); /* flags */ + +static const char *pll_cpux_parents[] = {"osc24M"}; +NP_CLK(pll_cpux_clk, + CLK_PLL_CPUX, /* id */ + "pll_cpux", pll_cpux_parents, /* name, parents */ + 0x00, /* offset */ + 8, 7, 0, 0, /* n factor */ + 0, 2, 0, 0, /* p factor */ + 31, /* gate */ + 28, 1000, /* lock */ + AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */ + +static const char *pll_ddr0_parents[] = {"osc24M"}; +NMM_CLK(pll_ddr0_clk, + CLK_PLL_DDR0, /* id */ + "pll_ddr0", pll_ddr0_parents, /* name, parents */ + 0x10, /* offset */ + 8, 7, 0, 0, /* n factor */ + 0, 1, 0, 0, /* m0 factor */ + 1, 1, 0, 0, /* m1 factor */ + 31, /* gate */ + 28, 1000, /* lock */ + AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */ + +static const char *pll_peri0_parents[] = {"osc24M"}; +NMM_CLK(pll_peri0_clk, + CLK_PLL_PERIPH0, /* id */ + "pll_periph0", pll_peri0_parents, /* name, parents */ + 0x20, /* offset */ + 8, 7, 0, 0, /* n factor */ + 0, 1, 0, 0, /* m0 factor */ + 1, 1, 0, 0, /* m1 factor */ + 31, /* gate */ + 28, 1000, /* lock */ + AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */ +static const char *pll_peri0_2x_parents[] = {"pll_periph0"}; +FIXED_CLK(pll_peri0_2x_clk, + CLK_PLL_PERIPH0_2X, /* id */ + "pll_periph0_2x", /* name */ + pll_peri0_2x_parents, /* parent */ + 0, /* freq */ + 1, /* mult */ + 2, /* div */ + 0); /* flags */ +static const char *pll_peri0_4x_parents[] = {"pll_periph0"}; +FIXED_CLK(pll_peri0_4x_clk, + CLK_PLL_PERIPH0_4X, /* id */ + "pll_periph0_4x", /* name */ + pll_peri0_4x_parents, /* parent */ + 0, /* freq */ + 1, /* mult */ + 4, /* div */ + 0); /* flags */ + +static const char *pll_peri1_parents[] = {"osc24M"}; +NMM_CLK(pll_peri1_clk, + CLK_PLL_PERIPH1, /* id */ + "pll_periph1", pll_peri1_parents, /* name, parents */ + 0x28, /* offset */ + 8, 7, 0, 0, /* n factor */ + 0, 1, 0, 0, /* m0 factor */ + 1, 1, 0, 0, /* m1 factor */ + 31, /* gate */ + 28, 1000, /* lock */ + AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */ +static const char *pll_peri1_2x_parents[] = {"pll_periph1"}; +FIXED_CLK(pll_peri1_2x_clk, + CLK_PLL_PERIPH1_2X, /* id */ + "pll_periph1_2x", /* name */ + pll_peri1_2x_parents, /* parent */ + 0, /* freq */ + 1, /* mult */ + 2, /* div */ + 0); /* flags */ +static const char *pll_peri1_4x_parents[] = {"pll_periph1"}; +FIXED_CLK(pll_peri1_4x_clk, + CLK_PLL_PERIPH1_4X, /* id */ + "pll_periph1_4x", /* name */ + pll_peri1_4x_parents, /* parent */ + 0, /* freq */ + 1, /* mult */ + 4, /* div */ + 0); /* flags */ + +static const char *pll_gpu_parents[] = {"osc24M"}; +NMM_CLK(pll_gpu_clk, + CLK_PLL_GPU, /* id */ + "pll_gpu", pll_gpu_parents, /* name, parents */ + 0x30, /* offset */ + 8, 7, 0, 0, /* n factor */ + 0, 1, 0, 0, /* m0 factor */ + 1, 1, 0, 0, /* m1 factor */ + 31, /* gate */ + 28, 1000, /* lock */ + AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */ + +static const char *pll_video0_parents[] = {"osc24M"}; +NMM_CLK(pll_video0_clk, + CLK_PLL_VIDEO0, /* id */ + "pll_video0", pll_video0_parents, /* name, parents */ + 0x40, /* offset */ + 8, 7, 0, 0, /* n factor */ + 0, 1, 0, 0, /* m0 factor */ + 1, 1, 0, 0, /* m1 factor */ + 31, /* gate */ + 28, 1000, /* lock */ + AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */ +static const char *pll_video0_4x_parents[] = {"pll_video0"}; +FIXED_CLK(pll_video0_4x_clk, + CLK_PLL_VIDEO0_4X, /* id */ + "pll_video0_4x", /* name */ + pll_video0_4x_parents, /* parent */ + 0, /* freq */ + 1, /* mult */ + 4, /* div */ + 0); /* flags */ + +static const char *pll_video1_parents[] = {"osc24M"}; +NMM_CLK(pll_video1_clk, + CLK_PLL_VIDEO1, /* id */ + "pll_video1", pll_video1_parents, /* name, parents */ + 0x48, /* offset */ + 8, 7, 0, 0, /* n factor */ + 0, 1, 0, 0, /* m0 factor */ + 1, 1, 0, 0, /* m1 factor */ + 31, /* gate */ + 28, 1000, /* lock */ + AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */ +static const char *pll_video1_4x_parents[] = {"pll_video1"}; +FIXED_CLK(pll_video1_4x_clk, + CLK_PLL_VIDEO1_4X, /* id */ + "pll_video1_4x", /* name */ + pll_video1_4x_parents, /* parent */ + 0, /* freq */ + 1, /* mult */ + 4, /* div */ + 0); /* flags */ + +static const char *pll_ve_parents[] = {"osc24M"}; +NMM_CLK(pll_ve_clk, + CLK_PLL_VE, /* id */ + "pll_ve", pll_ve_parents, /* name, parents */ + 0x58, /* offset */ + 8, 7, 0, 0, /* n factor */ + 0, 1, 0, 0, /* m0 factor */ + 1, 1, 0, 0, /* m1 factor */ + 31, /* gate */ + 28, 1000, /* lock */ + AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */ + +static const char *pll_de_parents[] = {"osc24M"}; +NMM_CLK(pll_de_clk, + CLK_PLL_DE, /* id */ + "pll_de", pll_de_parents, /* name, parents */ + 0x60, /* offset */ + 8, 7, 0, 0, /* n factor */ + 0, 1, 0, 0, /* m0 factor */ + 1, 1, 0, 0, /* m1 factor */ + 31, /* gate */ + 28, 1000, /* lock */ + AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */ + +static const char *pll_hsic_parents[] = {"osc24M"}; +NMM_CLK(pll_hsic_clk, + CLK_PLL_HSIC, /* id */ + "pll_hsic", pll_hsic_parents, /* name, parents */ + 0x70, /* offset */ + 8, 7, 0, 0, /* n factor */ + 0, 1, 0, 0, /* m0 factor */ + 1, 1, 0, 0, /* m1 factor */ + 31, /* gate */ + 28, 1000, /* lock */ + AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */ + +/* PLL_AUDIO missing */ + +/* CPUX_AXI missing */ + +static const char *psi_ahb1_ahb2_parents[] = {"osc24M", "osc32k", "iosc", "pll_periph0"}; +NM_CLK(psi_ahb1_ahb2_clk, + CLK_PSI_AHB1_AHB2, "psi_ahb1_ahb2", psi_ahb1_ahb2_parents, /* id, name, parents */ + 0x510, /* offset */ + 8, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO, /* n factor */ + 0, 2, 0, 0, /* m factor */ + 24, 2, /* mux */ + 0, /* gate */ + AW_CLK_HAS_MUX | AW_CLK_REPARENT); /* flags */ + +static const char *ahb3_parents[] = {"osc24M", "osc32k", "psi_ahb1_ahb2", "pll_periph0"}; +NM_CLK(ahb3_clk, + CLK_AHB3, "ahb3", ahb3_parents, /* id, name, parents */ + 0x51C, /* offset */ + 8, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO, /* n factor */ + 0, 2, 0, 0, /* m factor */ + 24, 2, /* mux */ + 0, /* gate */ + AW_CLK_HAS_MUX | AW_CLK_REPARENT); /* flags */ + +static const char *apb1_parents[] = {"osc24M", "osc32k", "psi_ahb1_ahb2", "pll_periph0"}; +NM_CLK(apb1_clk, + CLK_APB1, "apb1", apb1_parents, /* id, name, parents */ + 0x520, /* offset */ + 8, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO, /* n factor */ + 0, 2, 0, 0, /* m factor */ + 24, 2, /* mux */ + 0, /* gate */ + AW_CLK_HAS_MUX | AW_CLK_REPARENT); /* flags */ + +static const char *apb2_parents[] = {"osc24M", "osc32k", "psi_ahb1_ahb2", "pll_periph0"}; +NM_CLK(apb2_clk, + CLK_APB2, "apb2", apb2_parents, /* id, name, parents */ + 0x524, /* offset */ + 8, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO, /* n factor */ + 0, 2, 0, 0, /* m factor */ + 24, 2, /* mux */ + 0, /* gate */ + AW_CLK_HAS_MUX | AW_CLK_REPARENT); /* flags */ + +/* Missing MBUS clock */ + +static const char *mod_parents[] = {"osc24M", "pll_periph0_2x", "pll_periph1_2x"}; +NM_CLK(mmc0_clk, + CLK_MMC0, "mmc0", mod_parents, /* id, name, parents */ + 0x830, /* offset */ + 8, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO, /* n factor */ + 0, 4, 0, 0, /* m factor */ + 24, 2, /* mux */ + 31, /* gate */ + AW_CLK_HAS_GATE | AW_CLK_HAS_MUX | + AW_CLK_REPARENT); /* flags */ + +NM_CLK(mmc1_clk, + CLK_MMC1, "mmc1", mod_parents, /* id, name, parents */ + 0x834, /* offset */ + 8, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO, /* n factor */ + 0, 4, 0, 0, /* m factor */ + 24, 2, /* mux */ + 31, /* gate */ + AW_CLK_HAS_GATE | AW_CLK_HAS_MUX | + AW_CLK_REPARENT); /* flags */ + +NM_CLK(mmc2_clk, + CLK_MMC2, "mmc2", mod_parents, /* id, name, parents */ + 0x838, /* offset */ + 8, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO, /* n factor */ + 0, 4, 0, 0, /* m factor */ + 24, 2, /* mux */ + 31, /* gate */ + AW_CLK_HAS_GATE | AW_CLK_HAS_MUX | + AW_CLK_REPARENT); /* flags */ + +static struct aw_ccung_clk h6_ccu_clks[] = { + { .type = AW_CLK_NP, .clk.np = &pll_cpux_clk}, + { .type = AW_CLK_NMM, .clk.nmm = &pll_ddr0_clk}, + { .type = AW_CLK_NMM, .clk.nmm = &pll_peri0_clk}, + { .type = AW_CLK_NMM, .clk.nmm = &pll_peri1_clk}, + { .type = AW_CLK_NMM, .clk.nmm = &pll_gpu_clk}, + { .type = AW_CLK_NMM, .clk.nmm = &pll_video0_clk}, + { .type = AW_CLK_NMM, .clk.nmm = &pll_video1_clk}, + { .type = AW_CLK_NMM, .clk.nmm = &pll_ve_clk}, + { .type = AW_CLK_NMM, .clk.nmm = &pll_de_clk}, + { .type = AW_CLK_NMM, .clk.nmm = &pll_hsic_clk}, + + { .type = AW_CLK_NM, .clk.nm = &psi_ahb1_ahb2_clk}, + { .type = AW_CLK_NM, .clk.nm = &ahb3_clk}, + { .type = AW_CLK_NM, .clk.nm = &apb1_clk}, + { .type = AW_CLK_NM, .clk.nm = &apb2_clk}, + + { .type = AW_CLK_NM, .clk.nm = &mmc0_clk}, + { .type = AW_CLK_NM, .clk.nm = &mmc1_clk}, + { .type = AW_CLK_NM, .clk.nm = &mmc2_clk}, + + { .type = AW_CLK_FIXED, .clk.fixed = &osc12m_clk}, + { .type = AW_CLK_FIXED, .clk.fixed = &pll_peri0_2x_clk}, + { .type = AW_CLK_FIXED, .clk.fixed = &pll_peri0_4x_clk}, + { .type = AW_CLK_FIXED, .clk.fixed = &pll_peri1_2x_clk}, + { .type = AW_CLK_FIXED, .clk.fixed = &pll_peri1_4x_clk}, + { .type = AW_CLK_FIXED, .clk.fixed = &pll_video0_4x_clk}, + { .type = AW_CLK_FIXED, .clk.fixed = &pll_video1_4x_clk}, +}; + +static int +ccu_h6_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "allwinner,sun50i-h6-ccu")) + return (ENXIO); + + device_set_desc(dev, "Allwinner H6 Clock Control Unit NG"); + return (BUS_PROBE_DEFAULT); +} + +static int +ccu_h6_attach(device_t dev) +{ + struct aw_ccung_softc *sc; + + sc = device_get_softc(dev); + + sc->resets = h6_ccu_resets; + sc->nresets = nitems(h6_ccu_resets); + sc->gates = h6_ccu_gates; + sc->ngates = nitems(h6_ccu_gates); + sc->clks = h6_ccu_clks; + sc->nclks = nitems(h6_ccu_clks); + + return (aw_ccung_attach(dev)); +} + +static device_method_t ccu_h6ng_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ccu_h6_probe), + DEVMETHOD(device_attach, ccu_h6_attach), + + DEVMETHOD_END +}; + +static devclass_t ccu_h6ng_devclass; + +DEFINE_CLASS_1(ccu_h6ng, ccu_h6ng_driver, ccu_h6ng_methods, + sizeof(struct aw_ccung_softc), aw_ccung_driver); + +EARLY_DRIVER_MODULE(ccu_h6ng, simplebus, ccu_h6ng_driver, + ccu_h6ng_devclass, 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); Added: head/sys/arm/allwinner/clkng/ccu_h6_r.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/clkng/ccu_h6_r.c Mon Oct 14 21:53:53 2019 (r353528) @@ -0,0 +1,172 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * 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 + +#include + +#include +#include + +#include +#include +#include + +#include + +#include +#include + +/* Non-exported clocks */ +#define CLK_R_AHB 1 +#define CLK_R_APB2 3 + +static struct aw_ccung_reset ccu_sun50i_h6_r_resets[] = { + CCU_RESET(RST_R_APB1_TIMER, 0x11c, 16) + CCU_RESET(RST_R_APB1_TWD, 0x12c, 16) + CCU_RESET(RST_R_APB1_PWM, 0x13c, 16) + CCU_RESET(RST_R_APB2_UART, 0x18c, 16) + CCU_RESET(RST_R_APB2_I2C, 0x19c, 16) + CCU_RESET(RST_R_APB1_IR, 0x1cc, 16) + CCU_RESET(RST_R_APB1_W1, 0x1ec, 16) +}; + +static struct aw_ccung_gate ccu_sun50i_h6_r_gates[] = { + CCU_GATE(CLK_R_APB1_TIMER, "r_apb1-timer", "r_apb1", 0x11c, 0) + CCU_GATE(CLK_R_APB1_TWD, "r_apb1-twd", "r_apb1", 0x12c, 0) + CCU_GATE(CLK_R_APB1_PWM, "r_apb1-pwm", "r_apb1", 0x13c, 0) + CCU_GATE(CLK_R_APB2_UART, "r_apb1-uart", "r_apb2", 0x18c, 0) + CCU_GATE(CLK_R_APB2_I2C, "r_apb1-i2c", "r_apb2", 0x19c, 0) + CCU_GATE(CLK_R_APB1_IR, "r_apb1-ir", "r_apb1", 0x1cc, 0) + CCU_GATE(CLK_R_APB1_W1, "r_apb1-w1", "r_apb1", 0x1ec, 0) +}; + +static const char *ar100_parents[] = {"osc24M", "osc32k", "pll_periph0", "iosc"}; +PREDIV_CLK(ar100_clk, CLK_AR100, /* id */ + "ar100", ar100_parents, /* name, parents */ + 0x00, /* offset */ + 16, 2, /* mux */ + 4, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO, /* div */ + 8, 5, 0, AW_CLK_FACTOR_HAS_COND, /* prediv */ + 16, 2, 2); /* prediv condition */ + +static const char *r_ahb_parents[] = {"ar100"}; +FIXED_CLK(r_ahb_clk, + CLK_R_AHB, /* id */ + "r_ahb", /* name */ + r_ahb_parents, /* parent */ + 0, /* freq */ + 1, /* mult */ + 1, /* div */ + 0); /* flags */ + +static const char *r_apb1_parents[] = {"r_ahb"}; +DIV_CLK(r_apb1_clk, + CLK_R_APB1, /* id */ + "r_apb1", r_apb1_parents, /* name, parents */ + 0x0c, /* offset */ + 0, 2, /* shift, width */ + 0, NULL); /* flags, div table */ + +static const char *r_apb2_parents[] = {"osc24M", "osc32k", "pll_periph0", "iosc"}; +PREDIV_CLK(r_apb2_clk, CLK_R_APB2, /* id */ + "r_apb2", r_apb2_parents, /* name, parents */ + 0x10, /* offset */ + 16, 2, /* mux */ + 4, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO, /* div */ + 8, 5, 0, AW_CLK_FACTOR_HAS_COND, /* prediv */ + 16, 2, 2); /* prediv condition */ + +static struct aw_ccung_clk clks[] = { + { .type = AW_CLK_PREDIV_MUX, .clk.prediv_mux = &ar100_clk}, + { .type = AW_CLK_FIXED, .clk.fixed = &r_ahb_clk}, + { .type = AW_CLK_DIV, .clk.div = &r_apb1_clk}, + { .type = AW_CLK_PREDIV_MUX, .clk.prediv_mux = &r_apb2_clk}, +}; + +static struct ofw_compat_data compat_data[] = { + { "allwinner,sun50i-h6-r-ccu", 1 }, + { NULL, 0}, +}; + +static int +ccu_sun50i_h6_r_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Allwinner SUN50I_H6_R Clock Control Unit NG"); + return (BUS_PROBE_DEFAULT); +} + +static int +ccu_sun50i_h6_r_attach(device_t dev) +{ + struct aw_ccung_softc *sc; + + sc = device_get_softc(dev); + + sc->resets = ccu_sun50i_h6_r_resets; + sc->nresets = nitems(ccu_sun50i_h6_r_resets); + sc->gates = ccu_sun50i_h6_r_gates; + sc->ngates = nitems(ccu_sun50i_h6_r_gates); + sc->clks = clks; + sc->nclks = nitems(clks); + + return (aw_ccung_attach(dev)); +} + +static device_method_t ccu_sun50i_h6_r_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ccu_sun50i_h6_r_probe), + DEVMETHOD(device_attach, ccu_sun50i_h6_r_attach), + + DEVMETHOD_END +}; + +static devclass_t ccu_sun50i_h6_r_devclass; + +DEFINE_CLASS_1(ccu_sun50i_h6_r, ccu_sun50i_h6_r_driver, ccu_sun50i_h6_r_methods, + sizeof(struct aw_ccung_softc), aw_ccung_driver); + +EARLY_DRIVER_MODULE(ccu_sun50i_h6_r, simplebus, ccu_sun50i_h6_r_driver, + ccu_sun50i_h6_r_devclass, 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Mon Oct 14 21:50:44 2019 (r353527) +++ head/sys/arm64/conf/GENERIC Mon Oct 14 21:53:53 2019 (r353528) @@ -108,6 +108,7 @@ options NETDUMP # netdump(4) client support # SoC support options SOC_ALLWINNER_A64 options SOC_ALLWINNER_H5 +options SOC_ALLWINNER_H6 options SOC_CAVM_THUNDERX options SOC_HISI_HI6220 options SOC_INTEL_STRATIX10 Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Mon Oct 14 21:50:44 2019 (r353527) +++ head/sys/conf/files.arm64 Mon Oct 14 21:53:53 2019 (r353528) @@ -58,6 +58,8 @@ arm/allwinner/clkng/aw_clk_np.c optional aw_ccu fdt arm/allwinner/clkng/aw_clk_prediv_mux.c optional aw_ccu fdt arm/allwinner/clkng/ccu_a64.c optional soc_allwinner_a64 aw_ccu fdt arm/allwinner/clkng/ccu_h3.c optional soc_allwinner_h5 aw_ccu fdt +arm/allwinner/clkng/ccu_h6.c optional soc_allwinner_h6 aw_ccu fdt +arm/allwinner/clkng/ccu_h6_r.c optional soc_allwinner_h6 aw_ccu fdt arm/allwinner/clkng/ccu_sun8i_r.c optional aw_ccu fdt arm/allwinner/clkng/ccu_de2.c optional aw_ccu fdt Modified: head/sys/conf/options.arm64 ============================================================================== --- head/sys/conf/options.arm64 Mon Oct 14 21:50:44 2019 (r353527) +++ head/sys/conf/options.arm64 Mon Oct 14 21:53:53 2019 (r353528) @@ -16,6 +16,7 @@ EFIRT opt_efirt.h # SoC Support SOC_ALLWINNER_A64 opt_soc.h SOC_ALLWINNER_H5 opt_soc.h +SOC_ALLWINNER_H6 opt_soc.h SOC_BRCM_BCM2837 opt_soc.h SOC_CAVM_THUNDERX opt_soc.h SOC_HISI_HI6220 opt_soc.h From owner-svn-src-all@freebsd.org Mon Oct 14 21:55:46 2019 Return-Path: Delivered-To: svn-src-all@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 B87BF141933; Mon, 14 Oct 2019 21:55:46 +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 46sXS255rMz3ySY; Mon, 14 Oct 2019 21:55:46 +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 921C1B90D; Mon, 14 Oct 2019 21:55:46 +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 x9ELtkld023739; Mon, 14 Oct 2019 21:55:46 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ELtjoK023735; Mon, 14 Oct 2019 21:55:45 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910142155.x9ELtjoK023735@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 14 Oct 2019 21:55:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353529 - in head/sys: arm/allwinner arm/allwinner/h6 conf X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm/allwinner arm/allwinner/h6 conf X-SVN-Commit-Revision: 353529 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 21:55:46 -0000 Author: manu Date: Mon Oct 14 21:55:45 2019 New Revision: 353529 URL: https://svnweb.freebsd.org/changeset/base/353529 Log: arm64: allwinner: Add H6 GPIO/Pinctrl driver This adds support for Allwinner H6 GPIO and pinctrl driver for both the main pinctrl unit and the 'r_' one. MFC after: 1 month Added: head/sys/arm/allwinner/h6/ head/sys/arm/allwinner/h6/h6_padconf.c (contents, props changed) head/sys/arm/allwinner/h6/h6_r_padconf.c (contents, props changed) Modified: head/sys/arm/allwinner/aw_gpio.c head/sys/conf/files.arm64 Modified: head/sys/arm/allwinner/aw_gpio.c ============================================================================== --- head/sys/arm/allwinner/aw_gpio.c Mon Oct 14 21:53:53 2019 (r353528) +++ head/sys/arm/allwinner/aw_gpio.c Mon Oct 14 21:55:45 2019 (r353529) @@ -130,6 +130,12 @@ extern const struct allwinner_padconf a64_padconf; extern const struct allwinner_padconf a64_r_padconf; #endif +/* Defined in h6_padconf.c */ +#ifdef SOC_ALLWINNER_H6 +extern const struct allwinner_padconf h6_padconf; +extern const struct allwinner_padconf h6_r_padconf; +#endif + static struct ofw_compat_data compat_data[] = { #ifdef SOC_ALLWINNER_A10 {"allwinner,sun4i-a10-pinctrl", (uintptr_t)&a10_padconf}, @@ -164,6 +170,10 @@ static struct ofw_compat_data compat_data[] = { #ifdef SOC_ALLWINNER_A64 {"allwinner,sun50i-a64-pinctrl", (uintptr_t)&a64_padconf}, {"allwinner,sun50i-a64-r-pinctrl", (uintptr_t)&a64_r_padconf}, +#endif +#ifdef SOC_ALLWINNER_H6 + {"allwinner,sun50i-h6-pinctrl", (uintptr_t)&h6_padconf}, + {"allwinner,sun50i-h6-r-pinctrl", (uintptr_t)&h6_r_padconf}, #endif {NULL, 0} }; Added: head/sys/arm/allwinner/h6/h6_padconf.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/h6/h6_padconf.c Mon Oct 14 21:55:45 2019 (r353529) @@ -0,0 +1,126 @@ +/*- + * 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 AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include + +#include "opt_soc.h" + +static const struct allwinner_pins h6_pins[] = { + { "PC0", 2, 0, { "gpio_in", "gpio_out", "nand", NULL, "spi0" } }, + { "PC1", 2, 1, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC2", 2, 2, { "gpio_in", "gpio_out", "nand", NULL, "spi0" } }, + { "PC3", 2, 3, { "gpio_in", "gpio_out", "nand", NULL, "spi0" } }, + { "PC4", 2, 4, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC5", 2, 5, { "gpio_in", "gpio_out", "nand", "mmc2", "spi0" } }, + { "PC6", 2, 6, { "gpio_in", "gpio_out", "nand", "mmc2", "spi0" } }, + { "PC7", 2, 7, { "gpio_in", "gpio_out", "nand", "mmc2", "spi0" } }, + { "PC8", 2, 8, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC9", 2, 9, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC10", 2, 10, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC11", 2, 11, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC12", 2, 12, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC13", 2, 13, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC14", 2, 14, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC15", 2, 15, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC16", 2, 16, { "gpio_in", "gpio_out", "nand", } }, + + { "PD0", 3, 0, { "gpio_in", "gpio_out", "lcd0", "ts0", "csi", "emac" } }, + { "PD1", 3, 1, { "gpio_in", "gpio_out", "lcd0", "ts0", "csi", "emac" } }, + { "PD2", 3, 2, { "gpio_in", "gpio_out", "lcd0", "ts0", "csi", "emac" } }, + { "PD3", 3, 3, { "gpio_in", "gpio_out", "lcd0", "ts0", "csi", "emac" } }, + { "PD4", 3, 4, { "gpio_in", "gpio_out", "lcd0", "ts0", "csi", "emac" } }, + { "PD5", 3, 5, { "gpio_in", "gpio_out", "lcd0", "ts0", "csi", "emac" } }, + { "PD6", 3, 6, { "gpio_in", "gpio_out", "lcd0", "ts0", "csi", "emac" } }, + { "PD7", 3, 7, { "gpio_in", "gpio_out", "lcd0", "ts0", "csi", "emac" } }, + { "PD8", 3, 8, { "gpio_in", "gpio_out", "lcd0", "ts0", "csi", "emac" } }, + { "PD9", 3, 9, { "gpio_in", "gpio_out", "lcd0", "ts0", "csi", "emac" } }, + { "PD10", 3, 10, { "gpio_in", "gpio_out", "lcd0", "ts0", "csi", "emac" } }, + { "PD11", 3, 11, { "gpio_in", "gpio_out", "lcd0", "ts0", "csi", "emac" } }, + { "PD12", 3, 12, { "gpio_in", "gpio_out", "lcd0", "ts1", "csi", "emac" } }, + { "PD13", 3, 13, { "gpio_in", "gpio_out", "lcd0", "ts1", "csi", "emac" } }, + { "PD14", 3, 14, { "gpio_in", "gpio_out", "lcd0", "ts1", "dmic", "csi" } }, + { "PD15", 3, 15, { "gpio_in", "gpio_out", "lcd0", "ts1", "dmic", "csi" } }, + { "PD16", 3, 16, { "gpio_in", "gpio_out", "lcd0", "ts1", "dmic" } }, + { "PD17", 3, 17, { "gpio_in", "gpio_out", "lcd0", "ts2", "dmic" } }, + { "PD18", 3, 18, { "gpio_in", "gpio_out", "lcd0", "ts2", "dmic" } }, + { "PD19", 3, 19, { "gpio_in", "gpio_out", "lcd0", "ts2", "uart2", "emac" } }, + { "PD20", 3, 20, { "gpio_in", "gpio_out", "lcd0", "ts2", "uart2", "emac" } }, + { "PD21", 3, 21, { "gpio_in", "gpio_out", "lcd0", "ts2", "uart2" } }, + { "PD22", 3, 22, { "gpio_in", "gpio_out", "pwm0", "ts3", "uart2" } }, + { "PD23", 3, 23, { "gpio_in", "gpio_out", "i2c2", "ts3", "uart3", "jtag" } }, + { "PD24", 3, 24, { "gpio_in", "gpio_out", "i2c2", "ts3", "uart3", "jtag" } }, + { "PD25", 3, 25, { "gpio_in", "gpio_out", "i2c0", "ts3", "uart3", "jtag" } }, + { "PD26", 3, 26, { "gpio_in", "gpio_out", "i2c0", "ts3", "uart3", "jtag" } }, + + { "PF0", 5, 0, { "gpio_in", "gpio_out", "mmc0", "jtag", NULL, NULL, "pf_eint0" } }, + { "PF1", 5, 1, { "gpio_in", "gpio_out", "mmc0", "jtag", NULL, NULL, "pf_eint1" } }, + { "PF2", 5, 2, { "gpio_in", "gpio_out", "mmc0", "uart0", NULL, NULL, "pf_eint2" } }, + { "PF3", 5, 3, { "gpio_in", "gpio_out", "mmc0", "jtag", NULL, NULL, "pf_eint3" } }, + { "PF4", 5, 4, { "gpio_in", "gpio_out", "mmc0", "uart0", NULL, NULL, "pf_eint4" } }, + { "PF5", 5, 5, { "gpio_in", "gpio_out", "mmc0", "jtag", NULL, NULL, "pf_eint5" } }, + { "PF6", 5, 6, { "gpio_in", "gpio_out", NULL, NULL, NULL, NULL, "pf_eint6" } }, + + { "PG0", 6, 0, { "gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "pg_eint0" }, 6, 0 }, + { "PG1", 6, 1, { "gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "pg_eint1" }, 6, 1 }, + { "PG2", 6, 2, { "gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "pg_eint2" }, 6, 2 }, + { "PG3", 6, 3, { "gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "pg_eint3" }, 6, 3 }, + { "PG4", 6, 4, { "gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "pg_eint4" }, 6, 4 }, + { "PG5", 6, 5, { "gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "pg_eint5" }, 6, 5 }, + { "PG6", 6, 6, { "gpio_in", "gpio_out", "uart1", NULL, NULL, NULL, "pg_eint6" }, 6, 6 }, + { "PG7", 6, 7, { "gpio_in", "gpio_out", "uart1", NULL, NULL, NULL, "pg_eint7" }, 6, 7 }, + { "PG8", 6, 8, { "gpio_in", "gpio_out", "uart1", NULL, "sim0", NULL, "pg_eint8" }, 6, 8 }, + { "PG9", 6, 9, { "gpio_in", "gpio_out", "uart1", NULL, "sim0", NULL, "pg_eint9" }, 6, 9 }, + { "PG10", 6, 10, { "gpio_in", "gpio_out", "i2s2", "h_i2s2", "sim0", NULL, "pg_eint10" }, 6, 10 }, + { "PG11", 6, 11, { "gpio_in", "gpio_out", "i2s2", "h_i2s2", "sim0", NULL, "pg_eint11" }, 6, 11 }, + { "PG12", 6, 12, { "gpio_in", "gpio_out", "i2s2", "h_i2s2", "sim0", NULL, "pg_eint12" }, 6, 12 }, + { "PG13", 6, 13, { "gpio_in", "gpio_out", "i2s2", "h_i2s2", "sim0", NULL, "pg_eint13" }, 6, 13 }, + { "PG14", 6, 14, { "gpio_in", "gpio_out", "i2s2", "h_i2s2", "sim0", NULL, "pg_eint14" }, 6, 13 }, + + { "PH0", 7, 0, { "gpio_in", "gpio_out", "uart0", "i2s0", "h_i2s0", "sim1", "ph_eint0" }, 6, 0 }, + { "PH1", 7, 1, { "gpio_in", "gpio_out", "uart0", "i2s0", "h_i2s0", "sim1", "ph_eint1" }, 6, 1 }, + { "PH2", 7, 2, { "gpio_in", "gpio_out", "cir", "i2s0", "h_i2s0", "sim1", "ph_eint2" }, 6, 2 }, + { "PH3", 7, 3, { "gpio_in", "gpio_out", "spi1", "i2s0", "h_i2s0", "sim1", "ph_eint3" }, 6, 3 }, + { "PH4", 7, 4, { "gpio_in", "gpio_out", "spi1", "i2s0", "h_i2s0", "sim1", "ph_eint4" }, 6, 4 }, + { "PH5", 7, 5, { "gpio_in", "gpio_out", "spi1", "spdif", "i2c1", "sim1", "ph_eint5" }, 6, 5 }, + { "PH6", 7, 6, { "gpio_in", "gpio_out", "spi1", "spdif", "i2c1", "sim1", "ph_eint6" }, 6, 6 }, + { "PH7", 7, 7, { "gpio_in", "gpio_out", NULL, "spdif", NULL, NULL, "ph_eint7" }, 6, 7 }, + { "PH8", 7, 8, { "gpio_in", "gpio_out", "hdmi", NULL, NULL, NULL, "ph_eint8" }, 6, 8 }, + { "PH9", 7, 9, { "gpio_in", "gpio_out", "hdmi", NULL, NULL, NULL, "ph_eint9" }, 6, 9 }, + { "PH10", 7, 10, { "gpio_in", "gpio_out", "hdmi", NULL, NULL, NULL, "ph_eint10" }, 6, 10 }, +}; + +const struct allwinner_padconf h6_padconf = { + .npins = nitems(h6_pins), + .pins = h6_pins, +}; Added: head/sys/arm/allwinner/h6/h6_r_padconf.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/h6/h6_r_padconf.c Mon Oct 14 21:55:45 2019 (r353529) @@ -0,0 +1,60 @@ +/*- + * 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 AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include + +const static struct allwinner_pins h6_r_pins[] = { + {"PL0", 0, 0, {"gpio_in", "gpio_out", NULL, "s_i2c", NULL, NULL, "pl_eint0", NULL}, 6, 0}, + {"PL1", 0, 1, {"gpio_in", "gpio_out", NULL, "s_i2c", NULL, NULL, "pl_eint1", NULL}, 6, 1}, + {"PL2", 0, 2, {"gpio_in", "gpio_out", "s_uart", NULL, NULL, NULL, "pl_eint2", NULL}, 6, 2}, + {"PL3", 0, 3, {"gpio_in", "gpio_out", "s_uart", NULL, NULL, NULL, "pl_eint3", NULL}, 6, 3}, + {"PL4", 0, 4, {"gpio_in", "gpio_out", "s_jtag", NULL, NULL, NULL, "pl_eint4", NULL}, 6, 4}, + {"PL5", 0, 5, {"gpio_in", "gpio_out", "s_jtag", NULL, NULL, NULL, "pl_eint5", NULL}, 6, 5}, + {"PL6", 0, 6, {"gpio_in", "gpio_out", "s_jtag", NULL, NULL, NULL, "pl_eint6", NULL}, 6, 6}, + {"PL7", 0, 7, {"gpio_in", "gpio_out", "s_jtag", NULL, NULL, NULL, "pl_eint7", NULL}, 6, 7}, + {"PL8", 0, 8, {"gpio_in", "gpio_out", "s_i2c", NULL, NULL, NULL, "pl_eint8", NULL}, 6, 8}, + {"PL9", 0, 9, {"gpio_in", "gpio_out", "s_cir", NULL, NULL, NULL, "pl_eint9", NULL}, 6, 9}, + {"PL10", 0, 10, {"gpio_in", "gpio_out", "s_spdif", NULL, NULL, NULL, "pl_eint10", NULL}, 6, 10}, + + {"PM0", 0, 0, {"gpio_in", "gpio_out", NULL, NULL, NULL, NULL, "pm_eint0", NULL}, 6, 0}, + {"PM1", 0, 0, {"gpio_in", "gpio_out", NULL, NULL, NULL, NULL, "pm_eint1", NULL}, 6, 1}, + {"PM2", 0, 0, {"gpio_in", "gpio_out", NULL, NULL, NULL, NULL, "pm_eint2", NULL}, 6, 2}, + {"PM3", 0, 0, {"gpio_in", "gpio_out", NULL, NULL, NULL, NULL, "pm_eint3", NULL}, 6, 3}, + {"PM4", 0, 0, {"gpio_in", "gpio_out", NULL, NULL, NULL, NULL, "pm_eint4", NULL}, 6, 4}, +}; + +const struct allwinner_padconf h6_r_padconf = { + .npins = nitems(h6_r_pins), + .pins = h6_r_pins, +}; Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Mon Oct 14 21:53:53 2019 (r353528) +++ head/sys/conf/files.arm64 Mon Oct 14 21:55:45 2019 (r353529) @@ -68,6 +68,8 @@ arm/allwinner/a64/a64_padconf.c optional soc_allwinner arm/allwinner/a64/a64_r_padconf.c optional soc_allwinner_a64 fdt arm/allwinner/h3/h3_padconf.c optional soc_allwinner_h5 fdt arm/allwinner/h3/h3_r_padconf.c optional soc_allwinner_h5 fdt +arm/allwinner/h6/h6_padconf.c optional soc_allwinner_h6 fdt +arm/allwinner/h6/h6_r_padconf.c optional soc_allwinner_h6 fdt arm/annapurna/alpine/alpine_ccu.c optional al_ccu fdt arm/annapurna/alpine/alpine_nb_service.c optional al_nb_service fdt From owner-svn-src-all@freebsd.org Mon Oct 14 21:56:42 2019 Return-Path: Delivered-To: svn-src-all@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 8098E1419E1; Mon, 14 Oct 2019 21:56:42 +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 46sXT62pl9z3ybL; Mon, 14 Oct 2019 21:56:42 +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 43CDAB90E; Mon, 14 Oct 2019 21:56:42 +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 x9ELugeQ023820; Mon, 14 Oct 2019 21:56:42 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ELugOx023819; Mon, 14 Oct 2019 21:56:42 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910142156.x9ELugOx023819@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 14 Oct 2019 21:56:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353530 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 353530 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 21:56:42 -0000 Author: manu Date: Mon Oct 14 21:56:41 2019 New Revision: 353530 URL: https://svnweb.freebsd.org/changeset/base/353530 Log: arm64: allwinner: aw_usbphy: Add support for H6 PHY MFC after: 1 month Modified: head/sys/arm/allwinner/aw_usbphy.c Modified: head/sys/arm/allwinner/aw_usbphy.c ============================================================================== --- head/sys/arm/allwinner/aw_usbphy.c Mon Oct 14 21:55:45 2019 (r353529) +++ head/sys/arm/allwinner/aw_usbphy.c Mon Oct 14 21:56:41 2019 (r353530) @@ -60,7 +60,8 @@ enum awusbphy_type { AWUSBPHY_TYPE_A31, AWUSBPHY_TYPE_H3, AWUSBPHY_TYPE_A64, - AWUSBPHY_TYPE_A83T + AWUSBPHY_TYPE_A83T, + AWUSBPHY_TYPE_H6, }; struct aw_usbphy_conf { @@ -119,6 +120,13 @@ static const struct aw_usbphy_conf a83t_usbphy_conf = .phy0_route = false, }; +static const struct aw_usbphy_conf h6_usbphy_conf = { + .num_phys = 4, + .phy_type = AWUSBPHY_TYPE_H6, + .pmu_unk1 = false, + .phy0_route = true, +}; + static struct ofw_compat_data compat_data[] = { { "allwinner,sun4i-a10-usb-phy", (uintptr_t)&a10_usbphy_conf }, { "allwinner,sun5i-a13-usb-phy", (uintptr_t)&a13_usbphy_conf }, @@ -127,6 +135,7 @@ static struct ofw_compat_data compat_data[] = { { "allwinner,sun8i-h3-usb-phy", (uintptr_t)&h3_usbphy_conf }, { "allwinner,sun50i-a64-usb-phy", (uintptr_t)&a64_usbphy_conf }, { "allwinner,sun8i-a83t-usb-phy", (uintptr_t)&a83t_usbphy_conf }, + { "allwinner,sun50i-h6-usb-phy", (uintptr_t)&h6_usbphy_conf }, { NULL, 0 } }; From owner-svn-src-all@freebsd.org Mon Oct 14 21:58:47 2019 Return-Path: Delivered-To: svn-src-all@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 84D47141A76; Mon, 14 Oct 2019 21:58:47 +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 46sXWW2zwjz3ykL; Mon, 14 Oct 2019 21:58:47 +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 49F4CB918; Mon, 14 Oct 2019 21:58:47 +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 x9ELwllS023945; Mon, 14 Oct 2019 21:58:47 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ELwkIM023944; Mon, 14 Oct 2019 21:58:46 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910142158.x9ELwkIM023944@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 14 Oct 2019 21:58:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353531 - in head/sys: arm/allwinner conf X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm/allwinner conf X-SVN-Commit-Revision: 353531 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 21:58:47 -0000 Author: manu Date: Mon Oct 14 21:58:46 2019 New Revision: 353531 URL: https://svnweb.freebsd.org/changeset/base/353531 Log: arm64: allwinner: Add support for the usb3 phy The usb 3 controller in the H6 SoC have a dedicated phy. Add support for it. Mostly imported from NetBSD MFC after: 1 month Added: head/sys/arm/allwinner/aw_usb3phy.c (contents, props changed) Modified: head/sys/conf/files.arm64 Added: head/sys/arm/allwinner/aw_usb3phy.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/aw_usb3phy.c Mon Oct 14 21:58:46 2019 (r353531) @@ -0,0 +1,299 @@ +/* $NetBSD: sunxi_usb3phy.c,v 1.1 2018/05/01 23:59:42 jmcneill Exp $ */ + +/*- + * Copyright (c) 2018 Jared McNeill + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +/* + * Allwinner USB3PHY + */ + +#include +__FBSDID("$FreeBSD$"); +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include "phynode_if.h" + +#define USB3PHY_APP 0x00 +#define APP_FORCE_VBUS (0x3 << 12) + +#define USB3PHY_PIPE_CLOCK_CONTROL 0x14 +#define PCC_PIPE_CLK_OPEN (1 << 6) + +#define USB3PHY_PHY_TUNE_LOW 0x18 +#define PTL_MAGIC 0x0047fc87 + +#define USB3PHY_PHY_TUNE_HIGH 0x1c +#define PTH_TX_DEEMPH_3P5DB (0x1F << 19) +#define PTH_TX_DEEMPH_6DB (0x3F << 13) +#define PTH_TX_SWING_FULL (0x7F << 6) +#define PTH_LOS_BIAS (0x7 << 3) +#define PTH_TX_BOOST_LVL (0x7 << 0) + +#define USB3PHY_PHY_EXTERNAL_CONTROL 0x20 +#define PEC_REF_SSP_EN (1 << 26) +#define PEC_SSC_EN (1 << 24) +#define PEC_EXTERN_VBUS (0x3 << 1) + +#define __LOWEST_SET_BIT(__mask) ((((__mask) - 1) & (__mask)) ^ (__mask)) +#define __SHIFTIN(__x, __mask) ((__x) * __LOWEST_SET_BIT(__mask)) + +static struct ofw_compat_data compat_data[] = { + { "allwinner,sun50i-h6-usb3-phy", 1 }, + { NULL, 0 } +}; + +static struct resource_spec aw_usb3phy_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +struct awusb3phy_softc { + struct resource * res; + regulator_t reg; + int mode; +}; + + /* Phy class and methods. */ +static int awusb3phy_phy_enable(struct phynode *phy, bool enable); +static int awusb3phy_get_mode(struct phynode *phy, int *mode); +static int awusb3phy_set_mode(struct phynode *phy, int mode); +static phynode_usb_method_t awusb3phy_phynode_methods[] = { + PHYNODEMETHOD(phynode_enable, awusb3phy_phy_enable), + PHYNODEMETHOD(phynode_usb_get_mode, awusb3phy_get_mode), + PHYNODEMETHOD(phynode_usb_set_mode, awusb3phy_set_mode), + + PHYNODEMETHOD_END +}; +DEFINE_CLASS_1(awusb3phy_phynode, awusb3phy_phynode_class, awusb3phy_phynode_methods, + sizeof(struct phynode_usb_sc), phynode_usb_class); + +#define RD4(res, o) bus_read_4(res, (o)) +#define WR4(res, o, v) bus_write_4(res, (o), (v)) + +static int +awusb3phy_phy_enable(struct phynode *phynode, bool enable) +{ + struct awusb3phy_softc *sc; + device_t dev; + uint32_t val; + int error = 0; + + dev = phynode_get_device(phynode); + sc = device_get_softc(dev); + + device_printf(dev, "%s: called\n", __func__); + + if (enable) { + val = RD4(sc->res, USB3PHY_PHY_EXTERNAL_CONTROL); + device_printf(dev, "EXTERNAL_CONTROL: %x\n", val); + val |= PEC_EXTERN_VBUS; + val |= PEC_SSC_EN; + val |= PEC_REF_SSP_EN; + device_printf(dev, "EXTERNAL_CONTROL: %x\n", val); + WR4(sc->res, USB3PHY_PHY_EXTERNAL_CONTROL, val); + + val = RD4(sc->res, USB3PHY_PIPE_CLOCK_CONTROL); + device_printf(dev, "PIPE_CONTROL: %x\n", val); + val |= PCC_PIPE_CLK_OPEN; + device_printf(dev, "PIPE_CONTROL: %x\n", val); + WR4(sc->res, USB3PHY_PIPE_CLOCK_CONTROL, val); + + val = RD4(sc->res, USB3PHY_APP); + device_printf(dev, "APP: %x\n", val); + val |= APP_FORCE_VBUS; + device_printf(dev, "APP: %x\n", val); + WR4(sc->res, USB3PHY_APP, val); + + WR4(sc->res, USB3PHY_PHY_TUNE_LOW, PTL_MAGIC); + + val = RD4(sc->res, USB3PHY_PHY_TUNE_HIGH); + device_printf(dev, "PHY_TUNE_HIGH: %x\n", val); + val |= PTH_TX_BOOST_LVL; + val |= PTH_LOS_BIAS; + val &= ~PTH_TX_SWING_FULL; + val |= __SHIFTIN(0x55, PTH_TX_SWING_FULL); + val &= ~PTH_TX_DEEMPH_6DB; + val |= __SHIFTIN(0x20, PTH_TX_DEEMPH_6DB); + val &= ~PTH_TX_DEEMPH_3P5DB; + val |= __SHIFTIN(0x15, PTH_TX_DEEMPH_3P5DB); + device_printf(dev, "PHY_TUNE_HIGH: %x\n", val); + WR4(sc->res, USB3PHY_PHY_TUNE_HIGH, val); + + if (sc->reg) + error = regulator_enable(sc->reg); + } else { + if (sc->reg) + error = regulator_disable(sc->reg); + } + + if (error != 0) { + device_printf(dev, + "couldn't %s regulator for phy\n", + enable ? "enable" : "disable"); + return (error); + } + + return (0); +} + +static int +awusb3phy_get_mode(struct phynode *phynode, int *mode) +{ + struct awusb3phy_softc *sc; + device_t dev; + + dev = phynode_get_device(phynode); + sc = device_get_softc(dev); + + *mode = sc->mode; + + return (0); +} + +static int +awusb3phy_set_mode(struct phynode *phynode, int mode) +{ + device_t dev; + intptr_t phy; + struct awusb3phy_softc *sc; + + dev = phynode_get_device(phynode); + phy = phynode_get_id(phynode); + sc = device_get_softc(dev); + + if (mode != PHY_USB_MODE_HOST) + return (EINVAL); + + sc->mode = mode; + + return (0); +} + +static int +awusb3phy_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Allwinner USB3PHY"); + return (BUS_PROBE_DEFAULT); +} + +static int +awusb3phy_attach(device_t dev) +{ + struct phynode *phynode; + struct phynode_init_def phy_init; + struct awusb3phy_softc *sc; + clk_t clk; + hwreset_t rst; + phandle_t node; + int error, i; + + sc = device_get_softc(dev); + node = ofw_bus_get_node(dev); + + if (bus_alloc_resources(dev, aw_usb3phy_spec, &sc->res) != 0) { + device_printf(dev, "cannot allocate resources for device\n"); + return (ENXIO); + } + + /* Enable clocks */ + for (i = 0; clk_get_by_ofw_index(dev, 0, i, &clk) == 0; i++) { + error = clk_enable(clk); + if (error != 0) { + device_printf(dev, "couldn't enable clock %s\n", + clk_get_name(clk)); + return (error); + } + } + + /* De-assert resets */ + for (i = 0; hwreset_get_by_ofw_idx(dev, 0, i, &rst) == 0; i++) { + error = hwreset_deassert(rst); + if (error != 0) { + device_printf(dev, "couldn't de-assert reset %d\n", + i); + return (error); + } + } + + /* Get regulators */ + regulator_get_by_ofw_property(dev, node, "phy-supply", &sc->reg); + + /* Create the phy */ + phy_init.ofw_node = ofw_bus_get_node(dev); + phynode = phynode_create(dev, &awusb3phy_phynode_class, + &phy_init); + if (phynode == NULL) { + device_printf(dev, "failed to create USB PHY\n"); + return (ENXIO); + } + if (phynode_register(phynode) == NULL) { + device_printf(dev, "failed to create USB PHY\n"); + return (ENXIO); + } + + return (error); +} + +static device_method_t awusb3phy_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, awusb3phy_probe), + DEVMETHOD(device_attach, awusb3phy_attach), + + DEVMETHOD_END +}; + +static driver_t awusb3phy_driver = { + "awusb3phy", + awusb3phy_methods, + sizeof(struct awusb3phy_softc) +}; + +static devclass_t awusb3phy_devclass; +/* aw_usb3phy needs to come up after regulators/gpio/etc, but before ehci/ohci */ +EARLY_DRIVER_MODULE(awusb3phy, simplebus, awusb3phy_driver, awusb3phy_devclass, + 0, 0, BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_MIDDLE); +MODULE_VERSION(awusb3phy, 1); Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Mon Oct 14 21:56:41 2019 (r353530) +++ head/sys/conf/files.arm64 Mon Oct 14 21:58:46 2019 (r353531) @@ -42,6 +42,7 @@ arm/allwinner/aw_spi.c optional aw_spi fdt arm/allwinner/aw_syscon.c optional aw_syscon ext_resources syscon fdt arm/allwinner/aw_thermal.c optional aw_thermal nvmem fdt arm/allwinner/aw_usbphy.c optional ehci aw_usbphy fdt +arm/allwinner/aw_usb3phy.c optional xhci aw_usbphy fdt arm/allwinner/aw_wdog.c optional aw_wdog fdt arm/allwinner/axp81x.c optional axp81x fdt arm/allwinner/if_awg.c optional awg ext_resources syscon aw_sid nvmem fdt From owner-svn-src-all@freebsd.org Mon Oct 14 21:58:50 2019 Return-Path: Delivered-To: svn-src-all@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 A0248141A97; Mon, 14 Oct 2019 21:58:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 46sXWZ3n6tz3ylr; Mon, 14 Oct 2019 21:58:50 +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 D7EA0C767; Mon, 14 Oct 2019 21:58:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r353523 - head From: John Baldwin To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910142122.x9ELMgNj006103@repo.freebsd.org> 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: Date: Mon, 14 Oct 2019 14:58:48 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <201910142122.x9ELMgNj006103@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 21:58:50 -0000 On 10/14/19 2:22 PM, John Baldwin wrote: > Author: jhb > Date: Mon Oct 14 21:22:42 2019 > New Revision: 353523 > URL: https://svnweb.freebsd.org/changeset/base/353523 > > Log: > Disconnect powerpc from the default tinderbox for now. > > The wrong toolchain was set in MAKE_PARAMS_powerpc, however, there are > some other issues preventing powerpc from building in tinderbox: > > 1) There is no powerpc-gcc and powerpc-xtoolchain-gcc port that > provides an external 32-bit powerpc GCC toolchain. > > 2) On other targets, the same toolchain can build all of the > architectures for a given target. MIPS achieves this by always > setting -mabi and -EB/-EL explicitly instead of relying on the > compiler's default architecture. PowerPC might be able to do the > same thing, but as of today, powerpc-gcc would be required for > powerpc and powerpcspe and powerpc64-gcc would be required for > powerpc64. Our existing logic for make universe does not permit > per-MACHINE_ARCH toolchains. > > I tried hacking TARGETS_powerpc to only include powerpc64 when > powerpc64-gcc was present, and while that skipped the 32-bit worlds, > it tried to build all the kernels. There are some options we could try for powerpc. If passing explicit compiler flags to select 32-bit vs 64-bit, etc. works so that we can use a single toolchain for all powerpc archs, then that would be the simplest approach. For MIPS this entailed changes in share/mk/bsd.cpu.mk (and some changes I now have in review in sys/conf/Makefile.mips). Some other gross hacks are that all the 32-bit kernel configs could be marked #NO_UNIVERSE=yes but this would turn them off always, not just unconditionally. At some point we might need to rework this file to require toolchains for a given TARGET_ARCH instead of a TARGET which would let us be more fine-grained. We might need this regardless as I expect mips n32 won't work with clang anytime soon even if other mips configs do, for example. -- John Baldwin From owner-svn-src-all@freebsd.org Mon Oct 14 22:22:20 2019 Return-Path: Delivered-To: svn-src-all@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 A97BA142199; Mon, 14 Oct 2019 22:22:20 +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 46sY2h3ZYHz40wH; Mon, 14 Oct 2019 22:22:20 +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 5DFB4BFEE; Mon, 14 Oct 2019 22:22:20 +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 x9EMMKc9040816; Mon, 14 Oct 2019 22:22:20 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EMMJLO040814; Mon, 14 Oct 2019 22:22:19 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910142222.x9EMMJLO040814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 14 Oct 2019 22:22:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353532 - in head/sys: arm/allwinner arm64/conf conf X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm/allwinner arm64/conf conf X-SVN-Commit-Revision: 353532 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 22:22:20 -0000 Author: manu Date: Mon Oct 14 22:22:19 2019 New Revision: 353532 URL: https://svnweb.freebsd.org/changeset/base/353532 Log: arm64: allwinner: Add aw_dwc3 driver This is a simplebus like driver that just deal with clocks and resets and attach the dwc3 child node. MFC after: 1 month Added: head/sys/arm/allwinner/aw_dwc3.c (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Added: head/sys/arm/allwinner/aw_dwc3.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/aw_dwc3.c Mon Oct 14 22:22:19 2019 (r353532) @@ -0,0 +1,147 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * 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 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. + */ + +/* + * Rockchip DWC3 glue + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + + +#include + +#include +#include +#include +#include + +#include +#include +#include + +static struct ofw_compat_data compat_data[] = { + { "allwinner,sun50i-h6-dwc3", 1 }, + { NULL, 0 } +}; + +struct aw_dwc3_softc { + struct simplebus_softc sc; + device_t dev; + clk_t clk_bus; + hwreset_t rst_bus; +}; + +static int +aw_dwc3_probe(device_t dev) +{ + phandle_t node; + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + /* Binding says that we need a child node for the actual dwc3 controller */ + node = ofw_bus_get_node(dev); + if (OF_child(node) <= 0) + return (ENXIO); + + device_set_desc(dev, "Allwinner H6 DWC3"); + return (BUS_PROBE_DEFAULT); +} + +static int +aw_dwc3_attach(device_t dev) +{ + struct aw_dwc3_softc *sc; + device_t cdev; + phandle_t node, child; + int err; + + sc = device_get_softc(dev); + sc->dev = dev; + node = ofw_bus_get_node(dev); + + /* Enable the clocks */ + if (clk_get_by_ofw_name(dev, 0, "bus", &sc->clk_bus) != 0) { + device_printf(dev, "Cannot get bus clock\n"); + return (ENXIO); + } + err = clk_enable(sc->clk_bus); + if (err != 0) { + device_printf(dev, "Could not enable clock %s\n", + clk_get_name(sc->clk_bus)); + return (ENXIO); + } + + /* Put module out of reset */ + if (hwreset_get_by_ofw_name(dev, node, "bus", &sc->rst_bus) == 0) { + if (hwreset_deassert(sc->rst_bus) != 0) { + device_printf(dev, "Cannot deassert reset\n"); + return (ENXIO); + } + } + + simplebus_init(dev, node); + if (simplebus_fill_ranges(node, &sc->sc) < 0) { + device_printf(dev, "could not get ranges\n"); + return (ENXIO); + } + + for (child = OF_child(node); child > 0; child = OF_peer(child)) { + cdev = simplebus_add_device(dev, child, 0, NULL, -1, NULL); + if (cdev != NULL) + device_probe_and_attach(cdev); + } + + return (bus_generic_attach(dev)); +} + +static device_method_t aw_dwc3_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, aw_dwc3_probe), + DEVMETHOD(device_attach, aw_dwc3_attach), + + DEVMETHOD_END +}; + +static devclass_t aw_dwc3_devclass; + +DEFINE_CLASS_1(aw_dwc3, aw_dwc3_driver, aw_dwc3_methods, + sizeof(struct aw_dwc3_softc), simplebus_driver); +DRIVER_MODULE(aw_dwc3, simplebus, aw_dwc3_driver, aw_dwc3_devclass, 0, 0); Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Mon Oct 14 21:58:46 2019 (r353531) +++ head/sys/arm64/conf/GENERIC Mon Oct 14 22:22:19 2019 (r353532) @@ -211,6 +211,7 @@ device ohci # OHCI USB interface device ehci # EHCI USB interface (USB 2.0) device ehci_mv # Marvell EHCI USB interface device xhci # XHCI USB interface (USB 3.0) +device aw_dwc3 # Allwinner DWC3 controller device usb # USB Bus (required) device ukbd # Keyboard device umass # Disks/Mass storage - Requires scbus and da Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Mon Oct 14 21:58:46 2019 (r353531) +++ head/sys/conf/files.arm64 Mon Oct 14 22:22:19 2019 (r353532) @@ -30,6 +30,7 @@ arm/allwinner/a10_codec.c optional sound a10_codec arm/allwinner/a31_dmac.c optional a31_dmac arm/allwinner/sunxi_dma_if.m optional a31_dmac arm/allwinner/aw_cir.c optional evdev aw_cir fdt +arm/allwinner/aw_dwc3.c optional aw_dwc3 fdt arm/allwinner/aw_gpio.c optional gpio aw_gpio fdt arm/allwinner/aw_mmc.c optional mmc aw_mmc fdt | mmccam aw_mmc fdt arm/allwinner/aw_nmi.c optional aw_nmi fdt \ From owner-svn-src-all@freebsd.org Mon Oct 14 22:27:34 2019 Return-Path: Delivered-To: svn-src-all@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 B9EBB1422E8; Mon, 14 Oct 2019 22:27:34 +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 46sY8k5GGrz417W; Mon, 14 Oct 2019 22:27: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 97C02C004; Mon, 14 Oct 2019 22:27: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 x9EMRYZI041112; Mon, 14 Oct 2019 22:27:34 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EMRXXa041108; Mon, 14 Oct 2019 22:27:33 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910142227.x9EMRXXa041108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 14 Oct 2019 22:27:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353533 - in head/sys: arm64/conf conf dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm64/conf conf dev/usb/controller X-SVN-Commit-Revision: 353533 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 22:27:34 -0000 Author: manu Date: Mon Oct 14 22:27:33 2019 New Revision: 353533 URL: https://svnweb.freebsd.org/changeset/base/353533 Log: arm64: Add Synopsys DWC3 driver This add a driver for the Synopsys DWC3 driver found on multiple SoCs. It only supports host mode for now. MFC after: 1 month Added: head/sys/dev/usb/controller/dwc3.c (contents, props changed) head/sys/dev/usb/controller/dwc3.h (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Mon Oct 14 22:22:19 2019 (r353532) +++ head/sys/arm64/conf/GENERIC Mon Oct 14 22:27:33 2019 (r353533) @@ -211,6 +211,7 @@ device ohci # OHCI USB interface device ehci # EHCI USB interface (USB 2.0) device ehci_mv # Marvell EHCI USB interface device xhci # XHCI USB interface (USB 3.0) +device dwc3 # Synopsys DWC controller device aw_dwc3 # Allwinner DWC3 controller device usb # USB Bus (required) device ukbd # Keyboard Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Mon Oct 14 22:22:19 2019 (r353532) +++ head/sys/conf/files.arm64 Mon Oct 14 22:27:33 2019 (r353533) @@ -251,6 +251,7 @@ dev/uart/uart_cpu_arm64.c optional uart dev/uart/uart_dev_mu.c optional uart uart_mu dev/uart/uart_dev_pl011.c optional uart pl011 dev/usb/controller/dwc_otg_hisi.c optional dwcotg fdt soc_hisi_hi6220 +dev/usb/controller/dwc3.c optional fdt dwc3 dev/usb/controller/ehci_mv.c optional ehci_mv fdt dev/usb/controller/generic_ehci.c optional ehci dev/usb/controller/generic_ehci_acpi.c optional ehci acpi Added: head/sys/dev/usb/controller/dwc3.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/usb/controller/dwc3.c Mon Oct 14 22:27:33 2019 (r353533) @@ -0,0 +1,349 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * 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 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 +__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 "generic_xhci.h" + +static struct ofw_compat_data compat_data[] = { + { "snps,dwc3", 1 }, + { NULL, 0 } +}; + +struct snps_dwc3_softc { + struct xhci_softc sc; + device_t dev; + char dr_mode[16]; + struct resource * mem_res; + bus_space_tag_t bst; + bus_space_handle_t bsh; + phandle_t node; + phy_t usb2_phy; + phy_t usb3_phy; +}; + +#define DWC3_WRITE(_sc, _off, _val) \ + bus_space_write_4(_sc->bst, _sc->bsh, _off, _val) +#define DWC3_READ(_sc, _off) \ + bus_space_read_4(_sc->bst, _sc->bsh, _off) + +static int +snps_dwc3_attach_xhci(device_t dev) +{ + struct snps_dwc3_softc *snps_sc = device_get_softc(dev); + struct xhci_softc *sc = &snps_sc->sc; + int err = 0, rid = 0; + + sc->sc_io_res = snps_sc->mem_res; + sc->sc_io_tag = snps_sc->bst; + sc->sc_io_hdl = snps_sc->bsh; + sc->sc_io_size = rman_get_size(snps_sc->mem_res); + + sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_SHAREABLE | RF_ACTIVE); + if (sc->sc_irq_res == NULL) { + device_printf(dev, "Failed to allocate IRQ\n"); + return (ENXIO); + } + + sc->sc_bus.bdev = device_add_child(dev, "usbus", -1); + if (sc->sc_bus.bdev == NULL) { + device_printf(dev, "Failed to add USB device\n"); + return (ENXIO); + } + + device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus); + + sprintf(sc->sc_vendor, "Synopsys"); + device_set_desc(sc->sc_bus.bdev, "Synopsys"); + + err = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, + NULL, (driver_intr_t *)xhci_interrupt, sc, &sc->sc_intr_hdl); + if (err != 0) { + device_printf(dev, "Failed to setup IRQ, %d\n", err); + sc->sc_intr_hdl = NULL; + return (err); + } + + err = xhci_init(sc, dev, 1); + if (err != 0) { + device_printf(dev, "Failed to init XHCI, with error %d\n", err); + return (ENXIO); + } + + err = xhci_start_controller(sc); + if (err != 0) { + device_printf(dev, "Failed to start XHCI controller, with error %d\n", err); + return (ENXIO); + } + + device_printf(sc->sc_bus.bdev, "trying to attach\n"); + err = device_probe_and_attach(sc->sc_bus.bdev); + if (err != 0) { + device_printf(dev, "Failed to initialize USB, with error %d\n", err); + return (ENXIO); + } + + return (0); +} + +#if 0 +static void +snsp_dwc3_dump_regs(struct snps_dwc3_softc *sc) +{ + uint32_t reg; + + reg = DWC3_READ(sc, DWC3_GCTL); + device_printf(sc->dev, "GCTL: %x\n", reg); + reg = DWC3_READ(sc, DWC3_GUCTL1); + device_printf(sc->dev, "GUCTL1: %x\n", reg); + reg = DWC3_READ(sc, DWC3_GUSB2PHYCFG0); + device_printf(sc->dev, "GUSB2PHYCFG0: %x\n", reg); + reg = DWC3_READ(sc, DWC3_GUSB3PIPECTL0); + device_printf(sc->dev, "GUSB3PIPECTL0: %x\n", reg); + reg = DWC3_READ(sc, DWC3_DCFG); + device_printf(sc->dev, "DCFG: %x\n", reg); +} +#endif + +static void +snps_dwc3_reset(struct snps_dwc3_softc *sc) +{ + uint32_t gctl, phy2, phy3; + + if (sc->usb2_phy) + phy_enable(sc->usb2_phy); + if (sc->usb3_phy) + phy_enable(sc->usb3_phy); + + gctl = DWC3_READ(sc, DWC3_GCTL); + gctl |= DWC3_GCTL_CORESOFTRESET; + DWC3_WRITE(sc, DWC3_GCTL, gctl); + + phy2 = DWC3_READ(sc, DWC3_GUSB2PHYCFG0); + phy2 |= DWC3_GUSB2PHYCFG0_PHYSOFTRST; + DWC3_WRITE(sc, DWC3_GUSB2PHYCFG0, phy2); + + phy3 = DWC3_READ(sc, DWC3_GUSB3PIPECTL0); + phy3 |= DWC3_GUSB3PIPECTL0_PHYSOFTRST; + DWC3_WRITE(sc, DWC3_GUSB3PIPECTL0, phy3); + + DELAY(1000); + + phy2 &= ~DWC3_GUSB2PHYCFG0_PHYSOFTRST; + DWC3_WRITE(sc, DWC3_GUSB2PHYCFG0, phy2); + + phy3 &= ~DWC3_GUSB3PIPECTL0_PHYSOFTRST; + DWC3_WRITE(sc, DWC3_GUSB3PIPECTL0, phy3); + + gctl &= ~DWC3_GCTL_CORESOFTRESET; + DWC3_WRITE(sc, DWC3_GCTL, gctl); + +} + +static void +snps_dwc3_configure_host(struct snps_dwc3_softc *sc) +{ + uint32_t reg; + + reg = DWC3_READ(sc, DWC3_GCTL); + reg &= ~DWC3_GCTL_PRTCAPDIR_MASK; + reg |= DWC3_GCTL_PRTCAPDIR_HOST; + DWC3_WRITE(sc, DWC3_GCTL, reg); +} + +static void +snps_dwc3_configure_phy(struct snps_dwc3_softc *sc) +{ + char *phy_type; + uint32_t reg; + int nphy_types; + + phy_type = NULL; + nphy_types = OF_getprop_alloc(sc->node, "phy_type", (void **)&phy_type); + if (nphy_types <= 0) + return; + + reg = DWC3_READ(sc, DWC3_GUSB2PHYCFG0); + if (strncmp(phy_type, "utmi_wide", 9) == 0) { + reg &= ~(DWC3_GUSB2PHYCFG0_PHYIF | DWC3_GUSB2PHYCFG0_USBTRDTIM(0xf)); + reg |= DWC3_GUSB2PHYCFG0_PHYIF | + DWC3_GUSB2PHYCFG0_USBTRDTIM(DWC3_GUSB2PHYCFG0_USBTRDTIM_16BITS); + } else { + reg &= ~(DWC3_GUSB2PHYCFG0_PHYIF | DWC3_GUSB2PHYCFG0_USBTRDTIM(0xf)); + reg |= DWC3_GUSB2PHYCFG0_PHYIF | + DWC3_GUSB2PHYCFG0_USBTRDTIM(DWC3_GUSB2PHYCFG0_USBTRDTIM_8BITS); + } + DWC3_WRITE(sc, DWC3_GUSB2PHYCFG0, reg); +} + +static void +snps_dwc3_do_quirks(struct snps_dwc3_softc *sc) +{ + uint32_t reg; + + reg = DWC3_READ(sc, DWC3_GUSB2PHYCFG0); + if (OF_hasprop(sc->node, "snps,dis-u2-freeclk-exists-quirk")) + reg &= ~DWC3_GUSB2PHYCFG0_U2_FREECLK_EXISTS; + else + reg |= DWC3_GUSB2PHYCFG0_U2_FREECLK_EXISTS; + if (OF_hasprop(sc->node, "snps,dis_u2_susphy_quirk")) + reg &= ~DWC3_GUSB2PHYCFG0_SUSPENDUSB20; + else + reg |= DWC3_GUSB2PHYCFG0_SUSPENDUSB20; + if (OF_hasprop(sc->node, "snps,dis_enblslpm_quirk")) + reg &= ~DWC3_GUSB2PHYCFG0_ENBLSLPM; + else + reg |= DWC3_GUSB2PHYCFG0_ENBLSLPM; + + DWC3_WRITE(sc, DWC3_GUSB2PHYCFG0, reg); + + reg = DWC3_READ(sc, DWC3_GUCTL1); + if (OF_hasprop(sc->node, "snps,dis-tx-ipgap-linecheck-quirk")) + reg |= DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS; + DWC3_WRITE(sc, DWC3_GUCTL1, reg); + + if (OF_hasprop(sc->node, "snps,dis-del-phy-power-chg-quirk")) { + reg = DWC3_READ(sc, DWC3_GUSB3PIPECTL0); + reg |= DWC3_GUSB3PIPECTL0_DELAYP1TRANS; + DWC3_WRITE(sc, DWC3_GUSB3PIPECTL0, reg); + } +} + +static int +snps_dwc3_probe(device_t dev) +{ + struct snps_dwc3_softc *sc; + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + sc = device_get_softc(dev); + sc->node = ofw_bus_get_node(dev); + OF_getprop(sc->node, "dr_mode", sc->dr_mode, sizeof(sc->dr_mode)); + if (strcmp(sc->dr_mode, "host") != 0) { + device_printf(dev, "Only host mode is supported\n"); + return (ENXIO); + } + + device_set_desc(dev, "Synopsys Designware DWC3"); + return (BUS_PROBE_DEFAULT); +} + +static int +snps_dwc3_attach(device_t dev) +{ + struct snps_dwc3_softc *sc; + int rid = 0; + + sc = device_get_softc(dev); + sc->dev = dev; + + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->mem_res == NULL) { + device_printf(dev, "Failed to map memory\n"); + return (ENXIO); + } + sc->bst = rman_get_bustag(sc->mem_res); + sc->bsh = rman_get_bushandle(sc->mem_res); + + if (bootverbose) + device_printf(dev, "snps id: %x\n", DWC3_READ(sc, DWC3_GSNPSID)); + + /* Get the phys */ + phy_get_by_ofw_name(dev, sc->node, "usb2-phy", &sc->usb2_phy); + phy_get_by_ofw_name(dev, sc->node, "usb3-phy", &sc->usb3_phy); + + snps_dwc3_reset(sc); + snps_dwc3_configure_host(sc); + snps_dwc3_configure_phy(sc); + snps_dwc3_do_quirks(sc); +#if 0 + snsp_dwc3_dump_regs(sc); +#endif + snps_dwc3_attach_xhci(dev); + + return (0); +} + +static device_method_t snps_dwc3_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, snps_dwc3_probe), + DEVMETHOD(device_attach, snps_dwc3_attach), + + DEVMETHOD_END +}; + +static driver_t snps_dwc3_driver = { + "xhci", + snps_dwc3_methods, + sizeof(struct snps_dwc3_softc) +}; + +static devclass_t snps_dwc3_devclass; +DRIVER_MODULE(snps_dwc3, simplebus, snps_dwc3_driver, snps_dwc3_devclass, 0, 0); +MODULE_DEPEND(snps_dwc3, xhci, 1, 1, 1); Added: head/sys/dev/usb/controller/dwc3.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/usb/controller/dwc3.h Mon Oct 14 22:27:33 2019 (r353533) @@ -0,0 +1,116 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * 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 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$ + * + */ + +#ifndef _DWC3_H_ +#define _DWC3_H_ + +#define DWC3_GSBUSCFG0 0xc100 +#define DWC3_GSBUSCFG1 0xc104 +#define DWC3_GTXTHRCFG 0xc108 +#define DWC3_GRXTHRCFG 0xc10C + +/* Global Core Control Register */ +#define DWC3_GCTL 0xc110 +#define DWC3_GCTL_PRTCAPDIR_MASK (0x3 << 12) +#define DWC3_GCTL_PRTCAPDIR_HOST (0x1 << 12) +#define DWC3_GCTL_PRTCAPDIR_DEVICE (0x2 << 12) +#define DWC3_GCTL_CORESOFTRESET (1 << 11) +#define DWC3_GCTL_DSBLCLKGTNG (1 << 0) + +#define DWC3_GPMSTS 0xc114 +#define DWC3_GSTS 0xc118 + +#define DWC3_GUCTL1 0xc11c +#define DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS (1 << 28) + +#define DWC3_GSNPSID 0xc120 +#define DWC3_GGPIO 0xc124 +#define DWC3_GUID 0xc128 +#define DWC3_GUCTL 0xc12C +#define DWC3_GBUSERRADDRLO 0xc130 +#define DWC3_GBUSERRADDRHI 0xc134 +#define DWC3_GPRTBIMAPLO 0xc138 +#define DWC3_GHWPARAMS0 0xc140 +#define DWC3_GHWPARAMS1 0xc144 +#define DWC3_GHWPARAMS2 0xc148 +#define DWC3_GHWPARAMS3 0xc14C +#define DWC3_GHWPARAMS4 0xc150 +#define DWC3_GHWPARAMS5 0xc154 +#define DWC3_GHWPARAMS6 0xc158 +#define DWC3_GHWPARAMS7 0xc15C +#define DWC3_GDBGFIFOSPACE 0xc160 +#define DWC3_GDBGLTSSM 0xc164 +#define DWC3_GDBGLNMCC 0xc168 +#define DWC3_GDBGBMU 0xc16C +#define DWC3_GDBGLSPMUX 0xc170 +#define DWC3_GDBGLSP 0xc174 +#define DWC3_GDBGEPINFO0 0xc178 +#define DWC3_GDBGEPINFO1 0xc17C +#define DWC3_GPRTBIMAP_HSLO 0xc180 +#define DWC3_GPRTBIMAP_FSLO 0xc188 + +#define DWC3_GUSB2PHYCFG0 0xc200 +#define DWC3_GUSB2PHYCFG0_PHYSOFTRST (1 << 31) +#define DWC3_GUSB2PHYCFG0_U2_FREECLK_EXISTS (1 << 30) +#define DWC3_GUSB2PHYCFG0_USBTRDTIM(n) ((n) << 10) +#define DWC3_GUSB2PHYCFG0_USBTRDTIM_8BITS 9 +#define DWC3_GUSB2PHYCFG0_USBTRDTIM_16BITS 5 +#define DWC3_GUSB2PHYCFG0_ENBLSLPM (1 << 8) +#define DWC3_GUSB2PHYCFG0_PHYSEL(x) ((x >> 7) & 0x1) /* 0 = USB2.0, 1 = USB1.1 */ +#define DWC3_GUSB2PHYCFG0_SUSPENDUSB20 (1 << 6) +#define DWC3_GUSB2PHYCFG0_ULPI_UTMI_SEL (1 << 4) +#define DWC3_GUSB2PHYCFG0_PHYIF (1 << 3) + +#define DWC3_GUSB3PIPECTL0 0xc2c0 +#define DWC3_GUSB3PIPECTL0_PHYSOFTRST (1 << 31) +#define DWC3_GUSB3PIPECTL0_DELAYP1TRANS (1 << 18) + +#define DWC3_GTXFIFOSIZ(x) (0xc300 + 0x4 * x) +#define DWC3_GRXFIFOSIZ(x) (0xc380 + 0x4 * x) +#define DWC3_GEVNTADRLO0 0xc400 +#define DWC3_GEVNTADRHI0 0xc404 +#define DWC3_GEVNTSIZ0 0xc408 +#define DWC3_GEVNTCOUNT0 0xc40C +#define DWC3_GHWPARAMS8 0xc600 +#define DWC3_GTXFIFOPRIDEV 0xc610 +#define DWC3_GTXFIFOPRIHST 0xc618 +#define DWC3_GRXFIFOPRIHST 0xc61c +#define DWC3_GFIFOPRIDBC 0xc620 +#define DWC3_GDMAHLRATIO 0xc624 +#define DWC3_GFLADJ 0xc630 +#define DWC3_DCFG 0xc700 +#define DWC3_DCTL 0xc704 +#define DWC3_DEVTEN 0xc708 +#define DWC3_DSTS 0xc70C +#define DWC3_DGCMDPAR 0xc710 +#define DWC3_DGCMD 0xc714 +#define DWC3_DALEPENA 0xc720 + +#endif /* _DWC3_H_ */ From owner-svn-src-all@freebsd.org Mon Oct 14 22:29:20 2019 Return-Path: Delivered-To: svn-src-all@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 AF880142390; Mon, 14 Oct 2019 22:29:20 +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 46sYBm4BPJz41Hx; Mon, 14 Oct 2019 22:29:20 +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 7320BC006; Mon, 14 Oct 2019 22:29:20 +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 x9EMTK4q041224; Mon, 14 Oct 2019 22:29:20 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EMTKuG041223; Mon, 14 Oct 2019 22:29:20 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910142229.x9EMTKuG041223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 14 Oct 2019 22:29:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353534 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 353534 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2019 22:29:20 -0000 Author: manu Date: Mon Oct 14 22:29:20 2019 New Revision: 353534 URL: https://svnweb.freebsd.org/changeset/base/353534 Log: arm: allwinner: Add np and nmm clock file to the build MFC after: 1 month Modified: head/sys/arm/allwinner/files.allwinner Modified: head/sys/arm/allwinner/files.allwinner ============================================================================== --- head/sys/arm/allwinner/files.allwinner Mon Oct 14 22:27:33 2019 (r353533) +++ head/sys/arm/allwinner/files.allwinner Mon Oct 14 22:29:20 2019 (r353534) @@ -41,4 +41,6 @@ arm/allwinner/clkng/aw_clk_m.c standard arm/allwinner/clkng/aw_clk_mipi.c standard arm/allwinner/clkng/aw_clk_nkmp.c standard arm/allwinner/clkng/aw_clk_nm.c standard +arm/allwinner/clkng/aw_clk_np.c standard +arm/allwinner/clkng/aw_clk_nmm.c standard arm/allwinner/clkng/aw_clk_prediv_mux.c standard From owner-svn-src-all@freebsd.org Tue Oct 15 03:35:14 2019 Return-Path: Delivered-To: svn-src-all@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 A3A5E152484; Tue, 15 Oct 2019 03:35:14 +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 46sgzk4875z4cVQ; Tue, 15 Oct 2019 03:35:14 +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 5726D189FC; Tue, 15 Oct 2019 03:35:14 +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 x9F3ZEZC022803; Tue, 15 Oct 2019 03:35:14 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9F3ZBEs022788; Tue, 15 Oct 2019 03:35:11 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201910150335.x9F3ZBEs022788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 15 Oct 2019 03:35:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353535 - in head/sys: dev/xen/gntdev dev/xen/privcmd fs/tmpfs kern sys vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: dev/xen/gntdev dev/xen/privcmd fs/tmpfs kern sys vm X-SVN-Commit-Revision: 353535 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 03:35:14 -0000 Author: jeff Date: Tue Oct 15 03:35:11 2019 New Revision: 353535 URL: https://svnweb.freebsd.org/changeset/base/353535 Log: (1/6) Replace busy checks with acquires where it is trival to do so. This is the first in a series of patches that promotes the page busy field to a first class lock that no longer requires the object lock for consistency. Reviewed by: kib, markj Tested by: pho Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D21548 Modified: head/sys/dev/xen/gntdev/gntdev.c head/sys/dev/xen/privcmd/privcmd.c head/sys/fs/tmpfs/tmpfs_subr.c head/sys/kern/kern_exec.c head/sys/kern/uipc_shm.c head/sys/kern/vfs_bio.c head/sys/kern/vfs_cluster.c head/sys/sys/buf.h head/sys/vm/phys_pager.c head/sys/vm/vm_fault.c head/sys/vm/vm_object.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_pageout.c head/sys/vm/vm_swapout.c Modified: head/sys/dev/xen/gntdev/gntdev.c ============================================================================== --- head/sys/dev/xen/gntdev/gntdev.c Mon Oct 14 22:29:20 2019 (r353534) +++ head/sys/dev/xen/gntdev/gntdev.c Tue Oct 15 03:35:11 2019 (r353535) @@ -835,9 +835,9 @@ gntdev_gmap_pg_fault(vm_object_t object, vm_ooffset_t *mres = NULL; } + vm_page_busy_acquire(page, 0); vm_page_insert(page, object, pidx); page->valid = VM_PAGE_BITS_ALL; - vm_page_xbusy(page); *mres = page; return (VM_PAGER_OK); } Modified: head/sys/dev/xen/privcmd/privcmd.c ============================================================================== --- head/sys/dev/xen/privcmd/privcmd.c Mon Oct 14 22:29:20 2019 (r353534) +++ head/sys/dev/xen/privcmd/privcmd.c Tue Oct 15 03:35:11 2019 (r353535) @@ -178,9 +178,9 @@ privcmd_pg_fault(vm_object_t object, vm_ooffset_t offs *mres = NULL; } + vm_page_busy_acquire(page, 0); vm_page_insert(page, object, pidx); page->valid = VM_PAGE_BITS_ALL; - vm_page_xbusy(page); *mres = page; return (VM_PAGER_OK); } Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Mon Oct 14 22:29:20 2019 (r353534) +++ head/sys/fs/tmpfs/tmpfs_subr.c Tue Oct 15 03:35:11 2019 (r353535) @@ -1406,10 +1406,8 @@ tmpfs_reg_resize(struct vnode *vp, off_t newsize, bool if (base != 0) { idx = OFF_TO_IDX(newsize); retry: - m = vm_page_lookup(uobj, idx); + m = vm_page_grab(uobj, idx, VM_ALLOC_NOCREAT); if (m != NULL) { - if (vm_page_sleep_if_busy(m, "tmfssz")) - goto retry; MPASS(m->valid == VM_PAGE_BITS_ALL); } else if (vm_pager_has_page(uobj, idx, NULL, NULL)) { m = vm_page_alloc(uobj, idx, VM_ALLOC_NORMAL | @@ -1430,7 +1428,6 @@ retry: vm_page_lock(m); vm_page_launder(m); vm_page_unlock(m); - vm_page_xunbusy(m); } else { vm_page_free(m); if (ignerr) @@ -1444,6 +1441,7 @@ retry: if (m != NULL) { pmap_zero_page_area(m, base, PAGE_SIZE - base); vm_page_dirty(m); + vm_page_xunbusy(m); vm_pager_page_unswapped(m); } } Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Mon Oct 14 22:29:20 2019 (r353534) +++ head/sys/kern/kern_exec.c Tue Oct 15 03:35:11 2019 (r353535) @@ -976,10 +976,14 @@ exec_map_first_page(struct image_params *imgp) #if VM_NRESERVLEVEL > 0 vm_object_color(object, 0); #endif +retry: ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED); if (ma[0]->valid != VM_PAGE_BITS_ALL) { - vm_page_xbusy(ma[0]); + if (vm_page_busy_acquire(ma[0], VM_ALLOC_WAITFAIL) == 0) { + vm_page_unwire_noq(ma[0]); + goto retry; + } if (!vm_pager_has_page(object, 0, NULL, &after)) { if (vm_page_unwire_noq(ma[0])) vm_page_free(ma[0]); Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Mon Oct 14 22:29:20 2019 (r353534) +++ head/sys/kern/uipc_shm.c Tue Oct 15 03:35:11 2019 (r353535) @@ -457,10 +457,9 @@ shm_dotruncate_locked(struct shmfd *shmfd, off_t lengt if (base != 0) { idx = OFF_TO_IDX(length); retry: - m = vm_page_lookup(object, idx); + m = vm_page_grab(object, idx, VM_ALLOC_NOCREAT); if (m != NULL) { - if (vm_page_sleep_if_busy(m, "shmtrc")) - goto retry; + MPASS(m->valid == VM_PAGE_BITS_ALL); } else if (vm_pager_has_page(object, idx, NULL, NULL)) { m = vm_page_alloc(object, idx, VM_ALLOC_NORMAL | VM_ALLOC_WAITFAIL); @@ -478,7 +477,6 @@ retry: * as an access. */ vm_page_launder(m); - vm_page_xunbusy(m); } else { vm_page_free(m); VM_OBJECT_WUNLOCK(object); @@ -490,6 +488,7 @@ retry: KASSERT(m->valid == VM_PAGE_BITS_ALL, ("shm_dotruncate: page %p is invalid", m)); vm_page_dirty(m); + vm_page_xunbusy(m); vm_pager_page_unswapped(m); } } Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Mon Oct 14 22:29:20 2019 (r353534) +++ head/sys/kern/vfs_bio.c Tue Oct 15 03:35:11 2019 (r353535) @@ -2945,10 +2945,10 @@ vfs_vmio_invalidate(struct buf *bp) presid = resid > (PAGE_SIZE - poffset) ? (PAGE_SIZE - poffset) : resid; KASSERT(presid >= 0, ("brelse: extra page")); - while (vm_page_xbusied(m)) - vm_page_sleep_if_xbusy(m, "mbncsh"); + vm_page_busy_acquire(m, VM_ALLOC_SBUSY); if (pmap_page_wired_mappings(m) == 0) vm_page_set_invalid(m, poffset, presid); + vm_page_sunbusy(m); vm_page_release_locked(m, flags); resid -= presid; poffset = 0; @@ -3651,7 +3651,7 @@ vfs_clean_pages_dirty_buf(struct buf *bp) ("vfs_clean_pages_dirty_buf: no buffer offset")); VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); - vfs_drain_busy_pages(bp); + vfs_busy_pages_acquire(bp); vfs_setdirty_locked_object(bp); for (i = 0; i < bp->b_npages; i++) { noff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; @@ -3663,6 +3663,7 @@ vfs_clean_pages_dirty_buf(struct buf *bp) /* vm_page_clear_dirty(m, foff & PAGE_MASK, eoff - foff); */ foff = noff; } + vfs_busy_pages_release(bp); VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); } @@ -4559,28 +4560,25 @@ vfs_page_set_validclean(struct buf *bp, vm_ooffset_t o } /* - * Ensure that all buffer pages are not exclusive busied. If any page is - * exclusive busy, drain it. + * Acquire a shared busy on all pages in the buf. */ void -vfs_drain_busy_pages(struct buf *bp) +vfs_busy_pages_acquire(struct buf *bp) { - vm_page_t m; - int i, last_busied; + int i; VM_OBJECT_ASSERT_WLOCKED(bp->b_bufobj->bo_object); - last_busied = 0; - for (i = 0; i < bp->b_npages; i++) { - m = bp->b_pages[i]; - if (vm_page_xbusied(m)) { - for (; last_busied < i; last_busied++) - vm_page_sbusy(bp->b_pages[last_busied]); - while (vm_page_xbusied(m)) { - vm_page_sleep_if_xbusy(m, "vbpage"); - } - } - } - for (i = 0; i < last_busied; i++) + for (i = 0; i < bp->b_npages; i++) + vm_page_busy_acquire(bp->b_pages[i], VM_ALLOC_SBUSY); +} + +void +vfs_busy_pages_release(struct buf *bp) +{ + int i; + + VM_OBJECT_ASSERT_WLOCKED(bp->b_bufobj->bo_object); + for (i = 0; i < bp->b_npages; i++) vm_page_sunbusy(bp->b_pages[i]); } @@ -4613,17 +4611,17 @@ vfs_busy_pages(struct buf *bp, int clear_modify) KASSERT(bp->b_offset != NOOFFSET, ("vfs_busy_pages: no buffer offset")); VM_OBJECT_WLOCK(obj); - vfs_drain_busy_pages(bp); + if ((bp->b_flags & B_CLUSTER) == 0) { + vm_object_pip_add(obj, bp->b_npages); + vfs_busy_pages_acquire(bp); + } if (bp->b_bufsize != 0) vfs_setdirty_locked_object(bp); bogus = false; for (i = 0; i < bp->b_npages; i++) { m = bp->b_pages[i]; + vm_page_assert_sbusied(m); - if ((bp->b_flags & B_CLUSTER) == 0) { - vm_object_pip_add(obj, 1); - vm_page_sbusy(m); - } /* * When readying a buffer for a read ( i.e * clear_modify == 0 ), it is important to do Modified: head/sys/kern/vfs_cluster.c ============================================================================== --- head/sys/kern/vfs_cluster.c Mon Oct 14 22:29:20 2019 (r353534) +++ head/sys/kern/vfs_cluster.c Tue Oct 15 03:35:11 2019 (r353535) @@ -418,11 +418,9 @@ cluster_rbuild(struct vnode *vp, u_quad_t filesize, da for (bn = blkno, i = 0; i < run; ++i, bn += inc) { if (i == 0) { VM_OBJECT_WLOCK(tbp->b_bufobj->bo_object); - vfs_drain_busy_pages(tbp); vm_object_pip_add(tbp->b_bufobj->bo_object, tbp->b_npages); - for (k = 0; k < tbp->b_npages; k++) - vm_page_sbusy(tbp->b_pages[k]); + vfs_busy_pages_acquire(tbp); VM_OBJECT_WUNLOCK(tbp->b_bufobj->bo_object); } else { if ((bp->b_npages * PAGE_SIZE) + @@ -470,10 +468,9 @@ cluster_rbuild(struct vnode *vp, u_quad_t filesize, da if ((tbp->b_pages[j]->valid & vm_page_bits(toff, tinc)) != 0) break; - if (vm_page_xbusied(tbp->b_pages[j])) + if (vm_page_trysbusy(tbp->b_pages[j]) == 0) break; vm_object_pip_add(tbp->b_bufobj->bo_object, 1); - vm_page_sbusy(tbp->b_pages[j]); off += tinc; tsize -= tinc; } @@ -991,11 +988,14 @@ cluster_wbuild(struct vnode *vp, long size, daddr_t st VM_OBJECT_WLOCK(tbp->b_bufobj->bo_object); if (i == 0) { - vfs_drain_busy_pages(tbp); + vfs_busy_pages_acquire(tbp); } else { /* if not first buffer */ for (j = 0; j < tbp->b_npages; j += 1) { m = tbp->b_pages[j]; - if (vm_page_xbusied(m)) { + if (vm_page_trysbusy(m) == 0) { + for (j--; j >= 0; j--) + vm_page_sunbusy( + tbp->b_pages[j]); VM_OBJECT_WUNLOCK( tbp->b_object); bqrelse(tbp); @@ -1003,10 +1003,10 @@ cluster_wbuild(struct vnode *vp, long size, daddr_t st } } } + vm_object_pip_add(tbp->b_bufobj->bo_object, + tbp->b_npages); for (j = 0; j < tbp->b_npages; j += 1) { m = tbp->b_pages[j]; - vm_page_sbusy(m); - vm_object_pip_add(m->object, 1); if ((bp->b_npages == 0) || (bp->b_pages[bp->b_npages - 1] != m)) { bp->b_pages[bp->b_npages] = m; Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Mon Oct 14 22:29:20 2019 (r353534) +++ head/sys/sys/buf.h Tue Oct 15 03:35:11 2019 (r353535) @@ -539,7 +539,8 @@ void bufstrategy(struct bufobj *, struct buf *); void brelse(struct buf *); void bqrelse(struct buf *); int vfs_bio_awrite(struct buf *); -void vfs_drain_busy_pages(struct buf *bp); +void vfs_busy_pages_acquire(struct buf *bp); +void vfs_busy_pages_release(struct buf *bp); struct buf *incore(struct bufobj *, daddr_t); struct buf *gbincore(struct bufobj *, daddr_t); struct buf *getblk(struct vnode *, daddr_t, int, int, int, int); Modified: head/sys/vm/phys_pager.c ============================================================================== --- head/sys/vm/phys_pager.c Mon Oct 14 22:29:20 2019 (r353534) +++ head/sys/vm/phys_pager.c Tue Oct 15 03:35:11 2019 (r353535) @@ -206,29 +206,13 @@ phys_pager_populate(vm_object_t object, vm_pindex_t pi *last = end; for (i = base; i <= end; i++) { -retry: - m = vm_page_lookup(object, i); - if (m == NULL) { - ahead = MIN(end - i, PHYSALLOC); - m = vm_page_alloc(object, i, VM_ALLOC_NORMAL | - VM_ALLOC_ZERO | VM_ALLOC_WAITFAIL | - VM_ALLOC_COUNT(ahead)); - if (m == NULL) - goto retry; - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); + ahead = MIN(end - i, PHYSALLOC); + m = vm_page_grab(object, i, + VM_ALLOC_NORMAL | VM_ALLOC_COUNT(ahead)); + if (m->valid != VM_PAGE_BITS_ALL) { + vm_page_zero_invalid(m, TRUE); m->valid = VM_PAGE_BITS_ALL; - } else if (vm_page_xbusied(m)) { - vm_page_sleep_if_xbusy(m, "physb"); - goto retry; - } else { - vm_page_xbusy(m); - if (m->valid != VM_PAGE_BITS_ALL) - vm_page_zero_invalid(m, TRUE); } - - KASSERT(m->valid == VM_PAGE_BITS_ALL, - ("phys_pager_populate: partially valid page %p", m)); KASSERT(m->dirty == 0, ("phys_pager_populate: dirty page %p", m)); } Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Mon Oct 14 22:29:20 2019 (r353534) +++ head/sys/vm/vm_fault.c Tue Oct 15 03:35:11 2019 (r353535) @@ -787,7 +787,7 @@ RetryFault_oom: * around with a shared busied page except, perhaps, * to pmap it. */ - if (vm_page_busied(fs.m)) { + if (vm_page_tryxbusy(fs.m) == 0) { /* * Reference the page before unlocking and * sleeping so that the page daemon is less @@ -819,12 +819,11 @@ RetryFault_oom: } /* - * Mark page busy for other processes, and the + * The page is marked busy for other processes and the * pagedaemon. If it still isn't completely valid * (readable), jump to readrest, else break-out ( we * found the page ). */ - vm_page_xbusy(fs.m); if (fs.m->valid != VM_PAGE_BITS_ALL) goto readrest; break; /* break to PAGE HAS BEEN FOUND */ @@ -1826,16 +1825,17 @@ again: dst_m->dirty = dst_m->valid = src_m->valid; } else { dst_m = src_m; - if (vm_page_sleep_if_busy(dst_m, "fltupg")) + if (vm_page_busy_acquire(dst_m, VM_ALLOC_WAITFAIL) == 0) goto again; - if (dst_m->pindex >= dst_object->size) + if (dst_m->pindex >= dst_object->size) { /* * We are upgrading. Index can occur * out of bounds if the object type is * vnode and the file was truncated. */ + vm_page_xunbusy(dst_m); break; - vm_page_xbusy(dst_m); + } } VM_OBJECT_WUNLOCK(dst_object); Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Mon Oct 14 22:29:20 2019 (r353534) +++ head/sys/vm/vm_object.c Tue Oct 15 03:35:11 2019 (r353535) @@ -838,7 +838,7 @@ rescan: np = TAILQ_NEXT(p, listq); if (p->valid == 0) continue; - if (vm_page_sleep_if_busy(p, "vpcwai")) { + if (vm_page_busy_acquire(p, VM_ALLOC_WAITFAIL) == 0) { if (object->generation != curgeneration) { if ((flags & OBJPC_SYNC) != 0) goto rescan; @@ -848,8 +848,10 @@ rescan: np = vm_page_find_least(object, pi); continue; } - if (!vm_object_page_remove_write(p, flags, &clearobjflags)) + if (!vm_object_page_remove_write(p, flags, &clearobjflags)) { + vm_page_xunbusy(p); continue; + } n = vm_object_page_collect_flush(object, p, pagerflags, flags, &clearobjflags, &eio); @@ -899,6 +901,7 @@ vm_object_page_collect_flush(vm_object_t object, vm_pa int count, i, mreq, runlen; vm_page_lock_assert(p, MA_NOTOWNED); + vm_page_assert_xbusied(p); VM_OBJECT_ASSERT_WLOCKED(object); count = 1; @@ -906,18 +909,22 @@ vm_object_page_collect_flush(vm_object_t object, vm_pa for (tp = p; count < vm_pageout_page_count; count++) { tp = vm_page_next(tp); - if (tp == NULL || vm_page_busied(tp)) + if (tp == NULL || vm_page_tryxbusy(tp) == 0) break; - if (!vm_object_page_remove_write(tp, flags, clearobjflags)) + if (!vm_object_page_remove_write(tp, flags, clearobjflags)) { + vm_page_xunbusy(tp); break; + } } for (p_first = p; count < vm_pageout_page_count; count++) { tp = vm_page_prev(p_first); - if (tp == NULL || vm_page_busied(tp)) + if (tp == NULL || vm_page_tryxbusy(tp) == 0) break; - if (!vm_object_page_remove_write(tp, flags, clearobjflags)) + if (!vm_object_page_remove_write(tp, flags, clearobjflags)) { + vm_page_xunbusy(tp); break; + } p_first = tp; mreq++; } @@ -1158,7 +1165,7 @@ next_page: ("vm_object_madvise: page %p is fictitious", tm)); KASSERT((tm->oflags & VPO_UNMANAGED) == 0, ("vm_object_madvise: page %p is not managed", tm)); - if (vm_page_busied(tm)) { + if (vm_page_tryxbusy(tm) == 0) { if (object != tobject) VM_OBJECT_WUNLOCK(object); if (advice == MADV_WILLNEED) { @@ -1175,6 +1182,7 @@ next_page: vm_page_lock(tm); vm_page_advise(tm, advice); vm_page_unlock(tm); + vm_page_xunbusy(tm); vm_object_madvise_freespace(tobject, advice, tm->pindex, 1); next_pindex: if (tobject != object) @@ -1341,7 +1349,7 @@ retry: * We do not have to VM_PROT_NONE the page as mappings should * not be changed by this operation. */ - if (vm_page_busied(m)) { + if (vm_page_tryxbusy(m) == 0) { VM_OBJECT_WUNLOCK(new_object); vm_page_sleep_if_busy(m, "spltwt"); VM_OBJECT_WLOCK(new_object); @@ -1350,6 +1358,7 @@ retry: /* vm_page_rename() will dirty the page. */ if (vm_page_rename(m, new_object, idx)) { + vm_page_xunbusy(m); VM_OBJECT_WUNLOCK(new_object); VM_OBJECT_WUNLOCK(orig_object); vm_radix_wait(); @@ -1357,6 +1366,8 @@ retry: VM_OBJECT_WLOCK(new_object); goto retry; } + /* Rename released the xbusy lock. */ + #if VM_NRESERVLEVEL > 0 /* * If some of the reservation's allocated pages remain with @@ -1405,7 +1416,6 @@ vm_object_collapse_scan_wait(vm_object_t object, vm_pa backing_object = object->backing_object; VM_OBJECT_ASSERT_WLOCKED(backing_object); - KASSERT(p == NULL || vm_page_busied(p), ("unbusy page %p", p)); KASSERT(p == NULL || p->object == object || p->object == backing_object, ("invalid ownership %p %p %p", p, object, backing_object)); if ((op & OBSC_COLLAPSE_NOWAIT) != 0) @@ -1510,7 +1520,7 @@ vm_object_collapse_scan(vm_object_t object, int op) /* * Check for busy page */ - if (vm_page_busied(p)) { + if (vm_page_tryxbusy(p) == 0) { next = vm_object_collapse_scan_wait(object, p, next, op); continue; } @@ -1532,7 +1542,8 @@ vm_object_collapse_scan(vm_object_t object, int op) } pp = vm_page_lookup(object, new_pindex); - if (pp != NULL && vm_page_busied(pp)) { + if (pp != NULL && vm_page_tryxbusy(pp) == 0) { + vm_page_xunbusy(p); /* * The page in the parent is busy and possibly not * (yet) valid. Until its state is finalized by the @@ -1568,6 +1579,8 @@ vm_object_collapse_scan(vm_object_t object, int op) ("freeing mapped page %p", p)); if (vm_page_remove(p)) vm_page_free(p); + if (pp != NULL) + vm_page_xunbusy(pp); continue; } @@ -1579,10 +1592,14 @@ vm_object_collapse_scan(vm_object_t object, int op) * through the rename. vm_page_rename() will dirty the page. */ if (vm_page_rename(p, object, new_pindex)) { + vm_page_xunbusy(p); + if (pp != NULL) + vm_page_xunbusy(pp); next = vm_object_collapse_scan_wait(object, NULL, next, op); continue; } + /* Rename released the xbusy lock. */ /* Use the old pindex to free the right page. */ if (backing_object->type == OBJT_SWAP) @@ -1859,7 +1876,7 @@ again: * however, be invalidated if the option OBJPR_CLEANONLY is * not specified. */ - if (vm_page_busied(p)) { + if (vm_page_tryxbusy(p) == 0) { vm_page_sleep_if_busy(p, "vmopar"); goto again; } @@ -1872,6 +1889,7 @@ wired: p->valid = 0; vm_page_undirty(p); } + vm_page_xunbusy(p); continue; } KASSERT((p->flags & PG_FICTITIOUS) == 0, @@ -1881,8 +1899,10 @@ wired: object->ref_count != 0 && !vm_page_try_remove_write(p)) goto wired; - if (p->dirty != 0) + if (p->dirty != 0) { + vm_page_xunbusy(p); continue; + } } if ((options & OBJPR_NOTMAPPED) == 0 && object->ref_count != 0 && !vm_page_try_remove_all(p)) @@ -2168,7 +2188,7 @@ again: tm = m; m = TAILQ_NEXT(m, listq); } - if (vm_page_xbusied(tm)) { + if (vm_page_trysbusy(tm) == 0) { for (tobject = object; locked_depth >= 1; locked_depth--) { t1object = tobject->backing_object; @@ -2180,6 +2200,7 @@ again: goto again; } vm_page_unwire(tm, queue); + vm_page_sunbusy(tm); next_page: pindex++; } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Oct 14 22:29:20 2019 (r353534) +++ head/sys/vm/vm_page.c Tue Oct 15 03:35:11 2019 (r353535) @@ -972,6 +972,32 @@ vm_page_busy_downgrade(vm_page_t m) } /* + * + * vm_page_busy_tryupgrade: + * + * Attempt to upgrade a single shared busy into an exclusive busy. + */ +int +vm_page_busy_tryupgrade(vm_page_t m) +{ + u_int x; + + vm_page_assert_sbusied(m); + + x = m->busy_lock; + for (;;) { + if (VPB_SHARERS(x) > 1) + return (0); + KASSERT((x & ~VPB_BIT_WAITERS) == VPB_SHARERS_WORD(1), + ("vm_page_busy_tryupgrade: invalid lock state")); + if (!atomic_fcmpset_acq_int(&m->busy_lock, &x, + VPB_SINGLE_EXCLUSIVER | (x & VPB_BIT_WAITERS))) + continue; + return (1); + } +} + +/* * vm_page_sbusied: * * Return a positive value if the page is shared busied, 0 otherwise. @@ -2570,7 +2596,12 @@ retry: else if (object->memattr != VM_MEMATTR_DEFAULT) error = EINVAL; else if (vm_page_queue(m) != PQ_NONE && - !vm_page_busied(m) && !vm_page_wired(m)) { + vm_page_tryxbusy(m) != 0) { + if (vm_page_wired(m)) { + vm_page_xunbusy(m); + error = EBUSY; + goto unlock; + } KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, ("page %p has an unexpected memattr", m)); @@ -2616,6 +2647,7 @@ retry: VM_MEMATTR_DEFAULT); } if (m_new == NULL) { + vm_page_xunbusy(m); error = ENOMEM; goto unlock; } @@ -2647,7 +2679,6 @@ retry: m_new->valid = m->valid; m_new->dirty = m->dirty; m->flags &= ~PG_ZERO; - vm_page_xbusy(m); vm_page_dequeue(m); vm_page_replace_checked(m_new, object, m->pindex, m); @@ -4046,8 +4077,8 @@ vm_page_try_blocked_op(vm_page_t m, void (*op)(vm_page KASSERT(m->object != NULL && (m->oflags & VPO_UNMANAGED) == 0, ("vm_page_try_blocked_op: page %p has no object", m)); - KASSERT(!vm_page_busied(m), - ("vm_page_try_blocked_op: page %p is busy", m)); + KASSERT(vm_page_busied(m), + ("vm_page_try_blocked_op: page %p is not busy", m)); VM_OBJECT_ASSERT_LOCKED(m->object); old = m->ref_count; @@ -4163,13 +4194,18 @@ vm_page_grab(vm_object_t object, vm_pindex_t pindex, i (allocflags & VM_ALLOC_IGN_SBUSY) != 0, ("vm_page_grab: VM_ALLOC_SBUSY/VM_ALLOC_IGN_SBUSY mismatch")); pflags = allocflags & - ~(VM_ALLOC_NOWAIT | VM_ALLOC_WAITOK | VM_ALLOC_WAITFAIL); + ~(VM_ALLOC_NOWAIT | VM_ALLOC_WAITOK | VM_ALLOC_WAITFAIL | + VM_ALLOC_NOBUSY); if ((allocflags & VM_ALLOC_NOWAIT) == 0) pflags |= VM_ALLOC_WAITFAIL; + if ((allocflags & VM_ALLOC_IGN_SBUSY) != 0) + pflags |= VM_ALLOC_SBUSY; retrylookup: if ((m = vm_page_lookup(object, pindex)) != NULL) { - sleep = (allocflags & VM_ALLOC_IGN_SBUSY) != 0 ? - vm_page_xbusied(m) : vm_page_busied(m); + if ((allocflags & (VM_ALLOC_IGN_SBUSY | VM_ALLOC_SBUSY)) != 0) + sleep = !vm_page_trysbusy(m); + else + sleep = !vm_page_tryxbusy(m); if (sleep) { if ((allocflags & VM_ALLOC_NOWAIT) != 0) return (NULL); @@ -4189,12 +4225,7 @@ retrylookup: } else { if ((allocflags & VM_ALLOC_WIRED) != 0) vm_page_wire(m); - if ((allocflags & - (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)) == 0) - vm_page_xbusy(m); - else if ((allocflags & VM_ALLOC_SBUSY) != 0) - vm_page_sbusy(m); - return (m); + goto out; } } if ((allocflags & VM_ALLOC_NOCREAT) != 0) @@ -4207,6 +4238,14 @@ retrylookup: } if (allocflags & VM_ALLOC_ZERO && (m->flags & PG_ZERO) == 0) pmap_zero_page(m); + +out: + if ((allocflags & VM_ALLOC_NOBUSY) != 0) { + if ((allocflags & VM_ALLOC_IGN_SBUSY) != 0) + vm_page_sunbusy(m); + else + vm_page_xunbusy(m); + } return (m); } @@ -4359,10 +4398,13 @@ vm_page_grab_pages(vm_object_t object, vm_pindex_t pin ("vm_page_grab_pages: VM_ALLOC_SBUSY/IGN_SBUSY mismatch")); if (count == 0) return (0); - pflags = allocflags & ~(VM_ALLOC_NOWAIT | VM_ALLOC_WAITOK | - VM_ALLOC_WAITFAIL | VM_ALLOC_IGN_SBUSY); + pflags = allocflags & + ~(VM_ALLOC_NOWAIT | VM_ALLOC_WAITOK | VM_ALLOC_WAITFAIL | + VM_ALLOC_NOBUSY); if ((allocflags & VM_ALLOC_NOWAIT) == 0) pflags |= VM_ALLOC_WAITFAIL; + if ((allocflags & VM_ALLOC_IGN_SBUSY) != 0) + pflags |= VM_ALLOC_SBUSY; i = 0; retrylookup: m = vm_radix_lookup_le(&object->rtree, pindex + i); @@ -4373,8 +4415,11 @@ retrylookup: mpred = TAILQ_PREV(m, pglist, listq); for (; i < count; i++) { if (m != NULL) { - sleep = (allocflags & VM_ALLOC_IGN_SBUSY) != 0 ? - vm_page_xbusied(m) : vm_page_busied(m); + if ((allocflags & + (VM_ALLOC_SBUSY | VM_ALLOC_IGN_SBUSY)) != 0) + sleep = !vm_page_trysbusy(m); + else + sleep = !vm_page_tryxbusy(m); if (sleep) { if ((allocflags & VM_ALLOC_NOWAIT) != 0) break; @@ -4392,11 +4437,6 @@ retrylookup: } if ((allocflags & VM_ALLOC_WIRED) != 0) vm_page_wire(m); - if ((allocflags & (VM_ALLOC_NOBUSY | - VM_ALLOC_SBUSY)) == 0) - vm_page_xbusy(m); - if ((allocflags & VM_ALLOC_SBUSY) != 0) - vm_page_sbusy(m); } else { if ((allocflags & VM_ALLOC_NOCREAT) != 0) break; @@ -4412,6 +4452,12 @@ retrylookup: if ((m->flags & PG_ZERO) == 0) pmap_zero_page(m); m->valid = VM_PAGE_BITS_ALL; + } + if ((allocflags & VM_ALLOC_NOBUSY) != 0) { + if ((allocflags & VM_ALLOC_IGN_SBUSY) != 0) + vm_page_sunbusy(m); + else + vm_page_xunbusy(m); } ma[i] = mpred = m; m = vm_page_next(m); Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Mon Oct 14 22:29:20 2019 (r353534) +++ head/sys/vm/vm_page.h Tue Oct 15 03:35:11 2019 (r353535) @@ -542,6 +542,7 @@ malloc2vm_flags(int malloc_flags) int vm_page_busy_acquire(vm_page_t m, int allocflags); void vm_page_busy_downgrade(vm_page_t m); +int vm_page_busy_tryupgrade(vm_page_t m); void vm_page_busy_sleep(vm_page_t m, const char *msg, bool nonshared); void vm_page_free(vm_page_t m); void vm_page_free_zero(vm_page_t m); Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Mon Oct 14 22:29:20 2019 (r353534) +++ head/sys/vm/vm_pageout.c Tue Oct 15 03:35:11 2019 (r353535) @@ -334,7 +334,7 @@ vm_pageout_cluster(vm_page_t m) VM_OBJECT_ASSERT_WLOCKED(object); pindex = m->pindex; - vm_page_assert_unbusied(m); + vm_page_assert_xbusied(m); mc[vm_pageout_page_count] = pb = ps = m; pageout_count = 1; @@ -360,19 +360,26 @@ more: ib = 0; break; } - if ((p = vm_page_prev(pb)) == NULL || vm_page_busied(p) || - vm_page_wired(p)) { + if ((p = vm_page_prev(pb)) == NULL || + vm_page_tryxbusy(p) == 0) { ib = 0; break; } + if (vm_page_wired(p)) { + ib = 0; + vm_page_xunbusy(p); + break; + } vm_page_test_dirty(p); if (p->dirty == 0) { ib = 0; + vm_page_xunbusy(p); break; } vm_page_lock(p); if (!vm_page_in_laundry(p) || !vm_page_try_remove_write(p)) { vm_page_unlock(p); + vm_page_xunbusy(p); ib = 0; break; } @@ -390,15 +397,22 @@ more: } while (pageout_count < vm_pageout_page_count && pindex + is < object->size) { - if ((p = vm_page_next(ps)) == NULL || vm_page_busied(p) || - vm_page_wired(p)) + if ((p = vm_page_next(ps)) == NULL || + vm_page_tryxbusy(p) == 0) break; + if (vm_page_wired(p)) { + vm_page_xunbusy(p); + break; + } vm_page_test_dirty(p); - if (p->dirty == 0) + if (p->dirty == 0) { + vm_page_xunbusy(p); break; + } vm_page_lock(p); if (!vm_page_in_laundry(p) || !vm_page_try_remove_write(p)) { vm_page_unlock(p); + vm_page_xunbusy(p); break; } vm_page_unlock(p); @@ -445,8 +459,8 @@ vm_pageout_flush(vm_page_t *mc, int count, int flags, VM_OBJECT_ASSERT_WLOCKED(object); /* - * Initiate I/O. Mark the pages busy and verify that they're valid - * and read-only. + * Initiate I/O. Mark the pages shared busy and verify that they're + * valid and read-only. * * We do not have to fixup the clean/dirty bits here... we can * allow the pager to do it after the I/O completes. @@ -460,7 +474,7 @@ vm_pageout_flush(vm_page_t *mc, int count, int flags, mc[i], i, count)); KASSERT((mc[i]->aflags & PGA_WRITEABLE) == 0, ("vm_pageout_flush: writeable page %p", mc[i])); - vm_page_sbusy(mc[i]); + vm_page_busy_downgrade(mc[i]); } vm_object_pip_add(object, count); @@ -598,6 +612,7 @@ vm_pageout_clean(vm_page_t m, int *numpagedout) */ if (object->type == OBJT_VNODE) { vm_page_unlock(m); + vm_page_xunbusy(m); vp = object->handle; if (vp->v_type == VREG && vn_start_write(vp, &mp, V_NOWAIT) != 0) { @@ -648,7 +663,7 @@ vm_pageout_clean(vm_page_t m, int *numpagedout) * The page may have been busied while the object and page * locks were released. */ - if (vm_page_busied(m)) { + if (vm_page_tryxbusy(m) == 0) { vm_page_unlock(m); error = EBUSY; goto unlock_all; @@ -659,6 +674,7 @@ vm_pageout_clean(vm_page_t m, int *numpagedout) * Remove all writeable mappings, failing if the page is wired. */ if (!vm_page_try_remove_write(m)) { + vm_page_xunbusy(m); vm_page_unlock(m); error = EBUSY; goto unlock_all; @@ -792,7 +808,7 @@ recheck: KASSERT(m->object == object, ("page %p does not belong to %p", m, object)); - if (vm_page_busied(m)) + if (vm_page_tryxbusy(m) == 0) continue; /* @@ -804,6 +820,7 @@ recheck: * wire count is guaranteed not to increase. */ if (__predict_false(vm_page_wired(m))) { + vm_page_xunbusy(m); vm_page_dequeue_deferred(m); continue; } @@ -837,6 +854,7 @@ recheck: } if (act_delta != 0) { if (object->ref_count != 0) { + vm_page_xunbusy(m); VM_CNT_INC(v_reactivated); vm_page_activate(m); @@ -861,6 +879,7 @@ recheck: launder--; continue; } else if ((object->flags & OBJ_DEAD) == 0) { + vm_page_xunbusy(m); vm_page_requeue(m); continue; } @@ -876,6 +895,7 @@ recheck: if (object->ref_count != 0) { vm_page_test_dirty(m); if (m->dirty == 0 && !vm_page_try_remove_all(m)) { + vm_page_xunbusy(m); vm_page_dequeue_deferred(m); continue; } @@ -900,6 +920,7 @@ free_page: else pageout_ok = true; if (!pageout_ok) { + vm_page_xunbusy(m); vm_page_requeue(m); continue; } @@ -927,7 +948,8 @@ free_page: } mtx = NULL; object = NULL; - } + } else + vm_page_xunbusy(m); } if (mtx != NULL) { mtx_unlock(mtx); @@ -1507,7 +1529,7 @@ recheck: KASSERT(m->object == object, ("page %p does not belong to %p", m, object)); - if (vm_page_busied(m)) { + if (vm_page_tryxbusy(m) == 0) { /* * Don't mess with busy pages. Leave them at * the front of the queue. Most likely, they @@ -1529,6 +1551,7 @@ recheck: * wire count is guaranteed not to increase. */ if (__predict_false(vm_page_wired(m))) { + vm_page_xunbusy(m); vm_page_dequeue_deferred(m); continue; } @@ -1562,6 +1585,7 @@ recheck: } if (act_delta != 0) { if (object->ref_count != 0) { + vm_page_xunbusy(m); VM_CNT_INC(v_reactivated); vm_page_activate(m); @@ -1575,6 +1599,7 @@ recheck: m->act_count += act_delta + ACT_ADVANCE; continue; } else if ((object->flags & OBJ_DEAD) == 0) { + vm_page_xunbusy(m); vm_page_aflag_set(m, PGA_REQUEUE); goto reinsert; } @@ -1590,6 +1615,7 @@ recheck: if (object->ref_count != 0) { vm_page_test_dirty(m); if (m->dirty == 0 && !vm_page_try_remove_all(m)) { + vm_page_xunbusy(m); vm_page_dequeue_deferred(m); continue; } @@ -1615,7 +1641,10 @@ free_page: m->queue = PQ_NONE; vm_page_free(m); page_shortage--; - } else if ((object->flags & OBJ_DEAD) == 0) + continue; + } + vm_page_xunbusy(m); + if ((object->flags & OBJ_DEAD) == 0) vm_page_launder(m); continue; reinsert: Modified: head/sys/vm/vm_swapout.c ============================================================================== --- head/sys/vm/vm_swapout.c Mon Oct 14 22:29:20 2019 (r353534) +++ head/sys/vm/vm_swapout.c Tue Oct 15 03:35:11 2019 (r353535) @@ -208,6 +208,9 @@ vm_swapout_object_deactivate_pages(pmap_t pmap, vm_obj goto unlock_return; if (should_yield()) goto unlock_return; + if (vm_page_tryxbusy(p) == 0) + continue; + VM_CNT_INC(v_pdpages); /* * The page may acquire a wiring after this check. @@ -215,11 +218,10 @@ vm_swapout_object_deactivate_pages(pmap_t pmap, vm_obj * no harm done if a wiring appears while we are * attempting to deactivate the page. */ - if (vm_page_busied(p) || vm_page_wired(p)) + if (vm_page_wired(p) || !pmap_page_exists_quick(pmap, p)) { + vm_page_xunbusy(p); continue; - VM_CNT_INC(v_pdpages); - if (!pmap_page_exists_quick(pmap, p)) - continue; + } act_delta = pmap_ts_referenced(p); vm_page_lock(p); if ((p->aflags & PGA_REFERENCED) != 0) { @@ -251,6 +253,7 @@ vm_swapout_object_deactivate_pages(pmap_t pmap, vm_obj } else if (vm_page_inactive(p)) (void)vm_page_try_remove_all(p); vm_page_unlock(p); + vm_page_xunbusy(p); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Oct 15 03:37:21 2019 Return-Path: Delivered-To: svn-src-all@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 BABEB15257B; Tue, 15 Oct 2019 03:37:21 +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 46sh294HSNz4cfZ; Tue, 15 Oct 2019 03:37:21 +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 7736818A06; Tue, 15 Oct 2019 03:37:21 +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 x9F3bL7f022943; Tue, 15 Oct 2019 03:37:21 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9F3bLMT022942; Tue, 15 Oct 2019 03:37:21 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201910150337.x9F3bLMT022942@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 15 Oct 2019 03:37:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353536 - head/sys/powerpc/include X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/include X-SVN-Commit-Revision: 353536 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 03:37:21 -0000 Author: jhibbits Date: Tue Oct 15 03:37:21 2019 New Revision: 353536 URL: https://svnweb.freebsd.org/changeset/base/353536 Log: powerpc/atomic: Fix atomic_cmpset_rel() Need a release barrier, not an acquire barrier, else bad things happen. Modified: head/sys/powerpc/include/atomic.h Modified: head/sys/powerpc/include/atomic.h ============================================================================== --- head/sys/powerpc/include/atomic.h Tue Oct 15 03:35:11 2019 (r353535) +++ head/sys/powerpc/include/atomic.h Tue Oct 15 03:37:21 2019 (r353536) @@ -682,7 +682,7 @@ atomic_cmpset_long(volatile u_long* p, u_long cmpval, atomic_cmpset_rel_##type(volatile u_##type *p, \ u_##type cmpval, u_##type newval)\ {\ - __ATOMIC_ACQ();\ + __ATOMIC_REL();\ return (atomic_cmpset_##type(p, cmpval, newval));\ }\ struct hack From owner-svn-src-all@freebsd.org Tue Oct 15 03:38:04 2019 Return-Path: Delivered-To: svn-src-all@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 63A961525F6; Tue, 15 Oct 2019 03:38:04 +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 46sh301rg5z4cnQ; Tue, 15 Oct 2019 03:38:04 +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 229CD18A07; Tue, 15 Oct 2019 03:38:04 +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 x9F3c3q0023022; Tue, 15 Oct 2019 03:38:03 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9F3c31W023017; Tue, 15 Oct 2019 03:38:03 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201910150338.x9F3c31W023017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 15 Oct 2019 03:38:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353537 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353537 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 03:38:04 -0000 Author: jeff Date: Tue Oct 15 03:38:02 2019 New Revision: 353537 URL: https://svnweb.freebsd.org/changeset/base/353537 Log: (2/6) Don't release xbusy in vm_page_remove(), defer to vm_page_free_prep(). This persists busy state across operations like rename and replace. Reviewed by: kib, markj Tested by: pho Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D21549 Modified: head/sys/vm/device_pager.c head/sys/vm/vm_fault.c head/sys/vm/vm_object.c head/sys/vm/vm_page.c Modified: head/sys/vm/device_pager.c ============================================================================== --- head/sys/vm/device_pager.c Tue Oct 15 03:37:21 2019 (r353536) +++ head/sys/vm/device_pager.c Tue Oct 15 03:38:02 2019 (r353537) @@ -236,6 +236,7 @@ cdev_pager_free_page(vm_object_t object, vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("unmanaged %p", m)); pmap_remove_all(m); (void)vm_page_remove(m); + vm_page_xunbusy(m); } else if (object->type == OBJT_DEVICE) dev_pager_free_page(object, m); } Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Tue Oct 15 03:37:21 2019 (r353536) +++ head/sys/vm/vm_fault.c Tue Oct 15 03:38:02 2019 (r353537) @@ -1231,11 +1231,6 @@ readrest: fs.object, OFF_TO_IDX( fs.first_object->backing_object_offset)); #endif - /* - * Removing the page from the backing object - * unbusied it. - */ - vm_page_xbusy(fs.m); fs.first_m = fs.m; fs.m = NULL; VM_CNT_INC(v_cow_optim); Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Tue Oct 15 03:37:21 2019 (r353536) +++ head/sys/vm/vm_object.c Tue Oct 15 03:38:02 2019 (r353537) @@ -1366,7 +1366,6 @@ retry: VM_OBJECT_WLOCK(new_object); goto retry; } - /* Rename released the xbusy lock. */ #if VM_NRESERVLEVEL > 0 /* @@ -1383,8 +1382,8 @@ retry: */ vm_reserv_rename(m, new_object, orig_object, offidxstart); #endif - if (orig_object->type == OBJT_SWAP) - vm_page_xbusy(m); + if (orig_object->type != OBJT_SWAP) + vm_page_xunbusy(m); } if (orig_object->type == OBJT_SWAP) { /* @@ -1538,6 +1537,8 @@ vm_object_collapse_scan(vm_object_t object, int op) ("freeing mapped page %p", p)); if (vm_page_remove(p)) vm_page_free(p); + else + vm_page_xunbusy(p); continue; } @@ -1579,6 +1580,8 @@ vm_object_collapse_scan(vm_object_t object, int op) ("freeing mapped page %p", p)); if (vm_page_remove(p)) vm_page_free(p); + else + vm_page_xunbusy(p); if (pp != NULL) vm_page_xunbusy(pp); continue; @@ -1599,7 +1602,6 @@ vm_object_collapse_scan(vm_object_t object, int op) op); continue; } - /* Rename released the xbusy lock. */ /* Use the old pindex to free the right page. */ if (backing_object->type == OBJT_SWAP) @@ -1613,6 +1615,7 @@ vm_object_collapse_scan(vm_object_t object, int op) vm_reserv_rename(p, object, backing_object, backing_offset_index); #endif + vm_page_xunbusy(p); } return (true); } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue Oct 15 03:37:21 2019 (r353536) +++ head/sys/vm/vm_page.c Tue Oct 15 03:38:02 2019 (r353537) @@ -1227,6 +1227,8 @@ vm_page_putfake(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) != 0, ("managed %p", m)); KASSERT((m->flags & PG_FICTITIOUS) != 0, ("vm_page_putfake: bad page %p", m)); + if (vm_page_xbusied(m)) + vm_page_xunbusy(m); uma_zfree(fakepg_zone, m); } @@ -1519,8 +1521,7 @@ vm_page_object_remove(vm_page_t m) VM_OBJECT_ASSERT_WLOCKED(object); KASSERT((m->ref_count & VPRC_OBJREF) != 0, ("page %p is missing its object ref", m)); - if (vm_page_xbusied(m)) - vm_page_xunbusy(m); + mrem = vm_radix_remove(&object->rtree, m->pindex); KASSERT(mrem == m, ("removed page %p, expected page %p", mrem, m)); @@ -3590,7 +3591,7 @@ vm_page_free_prep(vm_page_t m) VM_CNT_INC(v_tfree); if (vm_page_sbusied(m)) - panic("vm_page_free_prep: freeing busy page %p", m); + panic("vm_page_free_prep: freeing shared busy page %p", m); if (m->object != NULL) { vm_page_object_remove(m); @@ -3606,6 +3607,9 @@ vm_page_free_prep(vm_page_t m) m->object = NULL; m->ref_count -= VPRC_OBJREF; } + + if (vm_page_xbusied(m)) + vm_page_xunbusy(m); /* * If fictitious remove object association and From owner-svn-src-all@freebsd.org Tue Oct 15 03:41:40 2019 Return-Path: Delivered-To: svn-src-all@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 89F401527D6; Tue, 15 Oct 2019 03:41:40 +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 46sh783rS1z4d7K; Tue, 15 Oct 2019 03:41:40 +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 6883818B70; Tue, 15 Oct 2019 03:41:40 +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 x9F3feYJ024060; Tue, 15 Oct 2019 03:41:40 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9F3fbWY024041; Tue, 15 Oct 2019 03:41:37 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201910150341.x9F3fbWY024041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 15 Oct 2019 03:41:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353538 - in head/sys: amd64/amd64 arm/arm arm64/arm64 i386/i386 mips/mips powerpc/aim powerpc/booke riscv/riscv sparc64/sparc64 vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: amd64/amd64 arm/arm arm64/arm64 i386/i386 mips/mips powerpc/aim powerpc/booke riscv/riscv sparc64/sparc64 vm X-SVN-Commit-Revision: 353538 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 03:41:40 -0000 Author: jeff Date: Tue Oct 15 03:41:36 2019 New Revision: 353538 URL: https://svnweb.freebsd.org/changeset/base/353538 Log: (3/6) Add a shared object busy synchronization mechanism that blocks new page busy acquires while held. This allows code that would need to acquire and release a very large number of page busy locks to use the old mechanism where busy is only checked and not held. This comes at the cost of false positives but never false negatives which the single consumer, vm_fault_soft_fast(), handles. Reviewed by: kib Tested by: pho Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D21592 Modified: head/sys/amd64/amd64/pmap.c head/sys/arm/arm/pmap-v4.c head/sys/arm/arm/pmap-v6.c head/sys/arm64/arm64/pmap.c head/sys/i386/i386/pmap.c head/sys/mips/mips/pmap.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/booke/pmap.c head/sys/riscv/riscv/pmap.c head/sys/sparc64/sparc64/pmap.c head/sys/vm/vm_fault.c head/sys/vm/vm_object.c head/sys/vm/vm_object.h head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Oct 15 03:38:02 2019 (r353537) +++ head/sys/amd64/amd64/pmap.c Tue Oct 15 03:41:36 2019 (r353538) @@ -5805,8 +5805,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v KASSERT((m->oflags & VPO_UNMANAGED) != 0 || va < kmi.clean_sva || va >= kmi.clean_eva, ("pmap_enter: managed mapping within the clean submap")); - if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) - VM_OBJECT_ASSERT_LOCKED(m->object); + if ((m->oflags & VPO_UNMANAGED) == 0) + VM_PAGE_OBJECT_BUSY_ASSERT(m); KASSERT((flags & PMAP_ENTER_RESERVED) == 0, ("pmap_enter: flags %u has reserved bits set", flags)); pa = VM_PAGE_TO_PHYS(m); Modified: head/sys/arm/arm/pmap-v4.c ============================================================================== --- head/sys/arm/arm/pmap-v4.c Tue Oct 15 03:38:02 2019 (r353537) +++ head/sys/arm/arm/pmap-v4.c Tue Oct 15 03:41:36 2019 (r353538) @@ -2979,8 +2979,8 @@ pmap_enter_locked(pmap_t pmap, vm_offset_t va, vm_page pa = systempage.pv_pa; m = NULL; } else { - if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) - VM_OBJECT_ASSERT_LOCKED(m->object); + if ((m->oflags & VPO_UNMANAGED) == 0) + VM_PAGE_OBJECT_BUSY_ASSERT(m); pa = VM_PAGE_TO_PHYS(m); } nflags = 0; Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Tue Oct 15 03:38:02 2019 (r353537) +++ head/sys/arm/arm/pmap-v6.c Tue Oct 15 03:41:36 2019 (r353538) @@ -3876,8 +3876,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v KASSERT((m->oflags & VPO_UNMANAGED) != 0 || va < kmi.clean_sva || va >= kmi.clean_eva, ("%s: managed mapping within the clean submap", __func__)); - if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) - VM_OBJECT_ASSERT_LOCKED(m->object); + if ((m->oflags & VPO_UNMANAGED) == 0) + VM_PAGE_OBJECT_BUSY_ASSERT(m); KASSERT((flags & PMAP_ENTER_RESERVED) == 0, ("%s: flags %u has reserved bits set", __func__, flags)); pa = VM_PAGE_TO_PHYS(m); Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Tue Oct 15 03:38:02 2019 (r353537) +++ head/sys/arm64/arm64/pmap.c Tue Oct 15 03:41:36 2019 (r353538) @@ -3181,8 +3181,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v int lvl, rv; va = trunc_page(va); - if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) - VM_OBJECT_ASSERT_LOCKED(m->object); + if ((m->oflags & VPO_UNMANAGED) == 0) + VM_PAGE_OBJECT_BUSY_ASSERT(m); pa = VM_PAGE_TO_PHYS(m); new_l3 = (pt_entry_t)(pa | ATTR_DEFAULT | ATTR_IDX(m->md.pv_memattr) | L3_PAGE); Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Tue Oct 15 03:38:02 2019 (r353537) +++ head/sys/i386/i386/pmap.c Tue Oct 15 03:41:36 2019 (r353538) @@ -3634,8 +3634,8 @@ __CONCAT(PMTYPE, enter)(pmap_t pmap, vm_offset_t va, v KASSERT(pmap != kernel_pmap || (m->oflags & VPO_UNMANAGED) != 0 || va < kmi.clean_sva || va >= kmi.clean_eva, ("pmap_enter: managed mapping within the clean submap")); - if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) - VM_OBJECT_ASSERT_LOCKED(m->object); + if ((m->oflags & VPO_UNMANAGED) == 0) + VM_PAGE_OBJECT_BUSY_ASSERT(m); KASSERT((flags & PMAP_ENTER_RESERVED) == 0, ("pmap_enter: flags %u has reserved bits set", flags)); pa = VM_PAGE_TO_PHYS(m); Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Tue Oct 15 03:38:02 2019 (r353537) +++ head/sys/mips/mips/pmap.c Tue Oct 15 03:41:36 2019 (r353538) @@ -2057,8 +2057,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v KASSERT((m->oflags & VPO_UNMANAGED) != 0 || va < kmi.clean_sva || va >= kmi.clean_eva, ("pmap_enter: managed mapping within the clean submap")); - if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) - VM_OBJECT_ASSERT_LOCKED(m->object); + if ((m->oflags & VPO_UNMANAGED) == 0) + VM_PAGE_OBJECT_BUSY_ASSERT(m); pa = VM_PAGE_TO_PHYS(m); newpte = TLBLO_PA_TO_PFN(pa) | init_pte_prot(m, flags, prot); if ((flags & PMAP_ENTER_WIRED) != 0) Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Tue Oct 15 03:38:02 2019 (r353537) +++ head/sys/powerpc/aim/mmu_oea.c Tue Oct 15 03:41:36 2019 (r353538) @@ -1149,8 +1149,8 @@ moea_enter_locked(pmap_t pmap, vm_offset_t va, vm_page if (pmap_bootstrapped) rw_assert(&pvh_global_lock, RA_WLOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) - VM_OBJECT_ASSERT_LOCKED(m->object); + if ((m->oflags & VPO_UNMANAGED) == 0) + VM_PAGE_OBJECT_BUSY_ASSERT(m); if ((m->oflags & VPO_UNMANAGED) != 0 || !moea_initialized) { pvo_head = &moea_pvo_kunmanaged; Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Tue Oct 15 03:38:02 2019 (r353537) +++ head/sys/powerpc/aim/mmu_oea64.c Tue Oct 15 03:41:36 2019 (r353538) @@ -1406,8 +1406,8 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_offset_t va, v uint64_t pte_lo; int error; - if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) - VM_OBJECT_ASSERT_LOCKED(m->object); + if ((m->oflags & VPO_UNMANAGED) == 0) + VM_PAGE_OBJECT_BUSY_ASSERT(m); pvo = alloc_pvo_entry(0); if (pvo == NULL) Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Tue Oct 15 03:38:02 2019 (r353537) +++ head/sys/powerpc/booke/pmap.c Tue Oct 15 03:41:36 2019 (r353538) @@ -2278,8 +2278,8 @@ mmu_booke_enter_locked(mmu_t mmu, pmap_t pmap, vm_offs KASSERT((va <= VM_MAXUSER_ADDRESS), ("mmu_booke_enter_locked: user pmap, non user va")); } - if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) - VM_OBJECT_ASSERT_LOCKED(m->object); + if ((m->oflags & VPO_UNMANAGED) == 0) + VM_PAGE_OBJECT_BUSY_ASSERT(m); PMAP_LOCK_ASSERT(pmap, MA_OWNED); Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Tue Oct 15 03:38:02 2019 (r353537) +++ head/sys/riscv/riscv/pmap.c Tue Oct 15 03:41:36 2019 (r353538) @@ -2650,8 +2650,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v bool nosleep; va = trunc_page(va); - if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) - VM_OBJECT_ASSERT_LOCKED(m->object); + if ((m->oflags & VPO_UNMANAGED) == 0) + VM_PAGE_OBJECT_BUSY_ASSERT(m); pa = VM_PAGE_TO_PHYS(m); pn = (pa / PAGE_SIZE); Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Tue Oct 15 03:38:02 2019 (r353537) +++ head/sys/sparc64/sparc64/pmap.c Tue Oct 15 03:41:36 2019 (r353538) @@ -1500,8 +1500,8 @@ pmap_enter_locked(pmap_t pm, vm_offset_t va, vm_page_t rw_assert(&tte_list_global_lock, RA_WLOCKED); PMAP_LOCK_ASSERT(pm, MA_OWNED); - if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) - VM_OBJECT_ASSERT_LOCKED(m->object); + if ((m->oflags & VPO_UNMANAGED) == 0) + VM_PAGE_OBJECT_BUSY_ASSERT(m); PMAP_STATS_INC(pmap_nenter); pa = VM_PAGE_TO_PHYS(m); wired = (flags & PMAP_ENTER_WIRED) != 0; Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Tue Oct 15 03:38:02 2019 (r353537) +++ head/sys/vm/vm_fault.c Tue Oct 15 03:41:36 2019 (r353538) @@ -281,11 +281,14 @@ vm_fault_soft_fast(struct faultstate *fs, vm_offset_t int psind, rv; MPASS(fs->vp == NULL); + vm_object_busy(fs->first_object); m = vm_page_lookup(fs->first_object, fs->first_pindex); /* A busy page can be mapped for read|execute access. */ if (m == NULL || ((prot & VM_PROT_WRITE) != 0 && - vm_page_busied(m)) || m->valid != VM_PAGE_BITS_ALL) - return (KERN_FAILURE); + vm_page_busied(m)) || m->valid != VM_PAGE_BITS_ALL) { + rv = KERN_FAILURE; + goto out; + } m_map = m; psind = 0; #if (defined(__aarch64__) || defined(__amd64__) || (defined(__arm__) && \ @@ -323,7 +326,7 @@ vm_fault_soft_fast(struct faultstate *fs, vm_offset_t rv = pmap_enter(fs->map->pmap, vaddr, m_map, prot, fault_type | PMAP_ENTER_NOSLEEP | (wired ? PMAP_ENTER_WIRED : 0), psind); if (rv != KERN_SUCCESS) - return (rv); + goto out; if (m_hold != NULL) { *m_hold = m; vm_page_wire(m); @@ -334,7 +337,10 @@ vm_fault_soft_fast(struct faultstate *fs, vm_offset_t VM_OBJECT_RUNLOCK(fs->first_object); vm_map_lookup_done(fs->map, fs->entry); curthread->td_ru.ru_minflt++; - return (KERN_SUCCESS); + +out: + vm_object_unbusy(fs->first_object); + return (rv); } static void @@ -1351,8 +1357,8 @@ readrest: if (hardfault) fs.entry->next_read = vaddr + ptoa(ahead) + PAGE_SIZE; - vm_fault_dirty(fs.entry, fs.m, prot, fault_type, fault_flags, true); vm_page_assert_xbusied(fs.m); + vm_fault_dirty(fs.entry, fs.m, prot, fault_type, fault_flags, true); /* * Page must be completely valid or it is not fit to Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Tue Oct 15 03:38:02 2019 (r353537) +++ head/sys/vm/vm_object.c Tue Oct 15 03:41:36 2019 (r353538) @@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -198,6 +199,9 @@ vm_object_zdtor(void *mem, int size, void *arg) KASSERT(REFCOUNT_COUNT(object->paging_in_progress) == 0, ("object %p paging_in_progress = %d", object, REFCOUNT_COUNT(object->paging_in_progress))); + KASSERT(object->busy == 0, + ("object %p busy = %d", + object, object->busy)); KASSERT(object->resident_page_count == 0, ("object %p resident_page_count = %d", object, object->resident_page_count)); @@ -223,6 +227,7 @@ vm_object_zinit(void *mem, int size, int flags) object->ref_count = 0; vm_radix_init(&object->rtree); refcount_init(&object->paging_in_progress, 0); + refcount_init(&object->busy, 0); object->resident_page_count = 0; object->shadow_count = 0; object->flags = OBJ_DEAD; @@ -2237,6 +2242,42 @@ vm_object_vnode(vm_object_t object) vp = NULL; } return (vp); +} + + +/* + * Busy the vm object. This prevents new pages belonging to the object from + * becoming busy. Existing pages persist as busy. Callers are responsible + * for checking page state before proceeding. + */ +void +vm_object_busy(vm_object_t obj) +{ + + VM_OBJECT_ASSERT_LOCKED(obj); + + refcount_acquire(&obj->busy); + /* The fence is required to order loads of page busy. */ + atomic_thread_fence_acq_rel(); +} + +void +vm_object_unbusy(vm_object_t obj) +{ + + VM_OBJECT_ASSERT_LOCKED(obj); + + refcount_release(&obj->busy); +} + +void +vm_object_busy_wait(vm_object_t obj, const char *wmesg) +{ + + VM_OBJECT_ASSERT_UNLOCKED(obj); + + if (obj->busy) + refcount_sleep(&obj->busy, wmesg, PVM); } /* Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Tue Oct 15 03:38:02 2019 (r353537) +++ head/sys/vm/vm_object.h Tue Oct 15 03:41:36 2019 (r353538) @@ -84,6 +84,7 @@ * vm_object_t Virtual memory object. * * List of locks + * (a) atomic * (c) const until freed * (o) per-object lock * (f) free pages queue mutex @@ -112,6 +113,7 @@ struct vm_object { u_short flags; /* see below */ u_short pg_color; /* (c) color of first page in obj */ volatile u_int paging_in_progress; /* Paging (in or out) so don't collapse or destroy */ + volatile u_int busy; /* (a) object is busy, disallow page busy. */ int resident_page_count; /* number of resident pages */ struct vm_object *backing_object; /* object that I'm a shadow of */ vm_ooffset_t backing_object_offset;/* Offset in backing object */ @@ -312,6 +314,18 @@ void vm_object_pip_wakeup(vm_object_t object); void vm_object_pip_wakeupn(vm_object_t object, short i); void vm_object_pip_wait(vm_object_t object, char *waitid); void vm_object_pip_wait_unlocked(vm_object_t object, char *waitid); + +void vm_object_busy(vm_object_t object); +void vm_object_unbusy(vm_object_t object); +void vm_object_busy_wait(vm_object_t object, const char *wmesg); + +static inline bool +vm_object_busied(vm_object_t object) +{ + + return (object->busy != 0); +} +#define VM_OBJECT_ASSERT_BUSY(object) MPASS(vm_object_busied((object))) void umtx_shm_object_init(vm_object_t object); void umtx_shm_object_terminated(vm_object_t object); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue Oct 15 03:38:02 2019 (r353537) +++ head/sys/vm/vm_page.c Tue Oct 15 03:41:36 2019 (r353538) @@ -180,6 +180,8 @@ SYSCTL_PROC(_vm, OID_AUTO, page_blacklist, CTLTYPE_STR static uma_zone_t fakepg_zone; static void vm_page_alloc_check(vm_page_t m); +static void _vm_page_busy_sleep(vm_object_t obj, vm_page_t m, + const char *wmesg, bool nonshared, bool locked); static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); static void vm_page_dequeue_complete(vm_page_t m); static void vm_page_enqueue(vm_page_t m, uint8_t queue); @@ -899,7 +901,6 @@ int vm_page_busy_acquire(vm_page_t m, int allocflags) { vm_object_t obj; - u_int x; bool locked; /* @@ -920,28 +921,14 @@ vm_page_busy_acquire(vm_page_t m, int allocflags) } if ((allocflags & VM_ALLOC_NOWAIT) != 0) return (FALSE); - if (obj != NULL) { + if (obj != NULL) locked = VM_OBJECT_WOWNED(obj); - } else { - MPASS(vm_page_wired(m)); + else locked = FALSE; - } - sleepq_lock(m); - x = m->busy_lock; - if (x == VPB_UNBUSIED || - ((allocflags & VM_ALLOC_SBUSY) != 0 && - (x & VPB_BIT_SHARED) != 0) || - ((x & VPB_BIT_WAITERS) == 0 && - !atomic_cmpset_int(&m->busy_lock, x, - x | VPB_BIT_WAITERS))) { - sleepq_release(m); - continue; - } + MPASS(locked || vm_page_wired(m)); + _vm_page_busy_sleep(obj, m, "vmpba", + (allocflags & VM_ALLOC_SBUSY) != 0, locked); if (locked) - VM_OBJECT_WUNLOCK(obj); - sleepq_add(m, NULL, "vmpba", 0, 0); - sleepq_wait(m, PVM); - if (locked) VM_OBJECT_WLOCK(obj); MPASS(m->object == obj || m->object == NULL); if ((allocflags & VM_ALLOC_WAITFAIL) != 0) @@ -1056,22 +1043,42 @@ void vm_page_busy_sleep(vm_page_t m, const char *wmesg, bool nonshared) { vm_object_t obj; - u_int x; obj = m->object; - vm_page_lock_assert(m, MA_NOTOWNED); VM_OBJECT_ASSERT_LOCKED(obj); + vm_page_lock_assert(m, MA_NOTOWNED); + _vm_page_busy_sleep(obj, m, wmesg, nonshared, true); +} + +static void +_vm_page_busy_sleep(vm_object_t obj, vm_page_t m, const char *wmesg, + bool nonshared, bool locked) +{ + u_int x; + + /* + * If the object is busy we must wait for that to drain to zero + * before trying the page again. + */ + if (obj != NULL && vm_object_busied(obj)) { + if (locked) + VM_OBJECT_DROP(obj); + vm_object_busy_wait(obj, wmesg); + return; + } sleepq_lock(m); x = m->busy_lock; if (x == VPB_UNBUSIED || (nonshared && (x & VPB_BIT_SHARED) != 0) || ((x & VPB_BIT_WAITERS) == 0 && !atomic_cmpset_int(&m->busy_lock, x, x | VPB_BIT_WAITERS))) { - VM_OBJECT_DROP(obj); + if (locked) + VM_OBJECT_DROP(obj); sleepq_release(m); return; } - VM_OBJECT_DROP(obj); + if (locked) + VM_OBJECT_DROP(obj); sleepq_add(m, NULL, wmesg, 0, 0); sleepq_wait(m, PVM); } @@ -1086,19 +1093,59 @@ vm_page_busy_sleep(vm_page_t m, const char *wmesg, boo int vm_page_trysbusy(vm_page_t m) { + vm_object_t obj; u_int x; + obj = m->object; x = m->busy_lock; for (;;) { if ((x & VPB_BIT_SHARED) == 0) return (0); + /* + * Reduce the window for transient busies that will trigger + * false negatives in vm_page_ps_test(). + */ + if (obj != NULL && vm_object_busied(obj)) + return (0); if (atomic_fcmpset_acq_int(&m->busy_lock, &x, x + VPB_ONE_SHARER)) - return (1); + break; } + + /* Refetch the object now that we're guaranteed that it is stable. */ + obj = m->object; + if (obj != NULL && vm_object_busied(obj)) { + vm_page_sunbusy(m); + return (0); + } + return (1); } /* + * vm_page_tryxbusy: + * + * Try to exclusive busy a page. + * If the operation succeeds 1 is returned otherwise 0. + * The operation never sleeps. + */ +int +vm_page_tryxbusy(vm_page_t m) +{ + vm_object_t obj; + + if (atomic_cmpset_acq_int(&(m)->busy_lock, VPB_UNBUSIED, + VPB_SINGLE_EXCLUSIVER) == 0) + return (0); + + obj = m->object; + if (obj != NULL && vm_object_busied(obj)) { + vm_page_xunbusy(m); + return (0); + } + return (1); +} + +/* * vm_page_xunbusy_hard: * * Called when unbusy has failed because there is a waiter. @@ -1317,15 +1364,15 @@ vm_page_sleep_if_busy(vm_page_t m, const char *msg) vm_page_lock_assert(m, MA_NOTOWNED); VM_OBJECT_ASSERT_WLOCKED(m->object); - if (vm_page_busied(m)) { - /* - * The page-specific object must be cached because page - * identity can change during the sleep, causing the - * re-lock of a different object. - * It is assumed that a reference to the object is already - * held by the callers. - */ - obj = m->object; + /* + * The page-specific object must be cached because page + * identity can change during the sleep, causing the + * re-lock of a different object. + * It is assumed that a reference to the object is already + * held by the callers. + */ + obj = m->object; + if (vm_page_busied(m) || (obj != NULL && obj->busy)) { vm_page_busy_sleep(m, msg, false); VM_OBJECT_WLOCK(obj); return (TRUE); @@ -1350,15 +1397,15 @@ vm_page_sleep_if_xbusy(vm_page_t m, const char *msg) vm_page_lock_assert(m, MA_NOTOWNED); VM_OBJECT_ASSERT_WLOCKED(m->object); - if (vm_page_xbusied(m)) { - /* - * The page-specific object must be cached because page - * identity can change during the sleep, causing the - * re-lock of a different object. - * It is assumed that a reference to the object is already - * held by the callers. - */ - obj = m->object; + /* + * The page-specific object must be cached because page + * identity can change during the sleep, causing the + * re-lock of a different object. + * It is assumed that a reference to the object is already + * held by the callers. + */ + obj = m->object; + if (vm_page_xbusied(m) || (obj != NULL && obj->busy)) { vm_page_busy_sleep(m, msg, true); VM_OBJECT_WLOCK(obj); return (TRUE); @@ -4883,17 +4930,15 @@ vm_page_lock_assert_KBI(vm_page_t m, int a, const char #ifdef INVARIANTS void -vm_page_object_lock_assert(vm_page_t m) +vm_page_object_busy_assert(vm_page_t m) { /* * Certain of the page's fields may only be modified by the - * holder of the containing object's lock or the exclusive busy. - * holder. Unfortunately, the holder of the write busy is - * not recorded, and thus cannot be checked here. + * holder of a page or object busy. */ - if (m->object != NULL && !vm_page_xbusied(m)) - VM_OBJECT_ASSERT_WLOCKED(m->object); + if (m->object != NULL && !vm_page_busied(m)) + VM_OBJECT_ASSERT_BUSY(m->object); } void @@ -4911,7 +4956,7 @@ vm_page_assert_pga_writeable(vm_page_t m, uint8_t bits KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("PGA_WRITEABLE on unmanaged page")); if (!vm_page_xbusied(m)) - VM_OBJECT_ASSERT_LOCKED(m->object); + VM_OBJECT_ASSERT_BUSY(m->object); } #endif Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Tue Oct 15 03:38:02 2019 (r353537) +++ head/sys/vm/vm_page.h Tue Oct 15 03:41:36 2019 (r353538) @@ -615,6 +615,7 @@ void vm_page_swapqueue(vm_page_t m, uint8_t oldq, uint bool vm_page_try_remove_all(vm_page_t m); bool vm_page_try_remove_write(vm_page_t m); int vm_page_trysbusy(vm_page_t m); +int vm_page_tryxbusy(vm_page_t m); void vm_page_unhold_pages(vm_page_t *ma, int count); void vm_page_unswappable(vm_page_t m); void vm_page_unwire(vm_page_t m, uint8_t queue); @@ -666,10 +667,6 @@ void vm_page_lock_assert_KBI(vm_page_t m, int a, const (m)); \ } while (0) -#define vm_page_tryxbusy(m) \ - (atomic_cmpset_acq_int(&(m)->busy_lock, VPB_UNBUSIED, \ - VPB_SINGLE_EXCLUSIVER)) - #define vm_page_xbusied(m) \ (((m)->busy_lock & VPB_SINGLE_EXCLUSIVER) != 0) @@ -687,13 +684,13 @@ void vm_page_lock_assert_KBI(vm_page_t m, int a, const } while (0) #ifdef INVARIANTS -void vm_page_object_lock_assert(vm_page_t m); -#define VM_PAGE_OBJECT_LOCK_ASSERT(m) vm_page_object_lock_assert(m) +void vm_page_object_busy_assert(vm_page_t m); +#define VM_PAGE_OBJECT_BUSY_ASSERT(m) vm_page_object_busy_assert(m) void vm_page_assert_pga_writeable(vm_page_t m, uint8_t bits); #define VM_PAGE_ASSERT_PGA_WRITEABLE(m, bits) \ vm_page_assert_pga_writeable(m, bits) #else -#define VM_PAGE_OBJECT_LOCK_ASSERT(m) (void)0 +#define VM_PAGE_OBJECT_BUSY_ASSERT(m) (void)0 #define VM_PAGE_ASSERT_PGA_WRITEABLE(m, bits) (void)0 #endif @@ -835,7 +832,7 @@ static __inline void vm_page_undirty(vm_page_t m) { - VM_PAGE_OBJECT_LOCK_ASSERT(m); + VM_PAGE_OBJECT_BUSY_ASSERT(m); m->dirty = 0; } From owner-svn-src-all@freebsd.org Tue Oct 15 03:45:47 2019 Return-Path: Delivered-To: svn-src-all@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 9277F152889; Tue, 15 Oct 2019 03:45:47 +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 46shCv460yz4dLl; Tue, 15 Oct 2019 03:45:47 +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 57F7118BCA; Tue, 15 Oct 2019 03:45:47 +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 x9F3jlRg028794; Tue, 15 Oct 2019 03:45:47 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9F3jgYw028767; Tue, 15 Oct 2019 03:45:42 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201910150345.x9F3jgYw028767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 15 Oct 2019 03:45:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353539 - in head/sys: amd64/sgx cddl/contrib/opensolaris/uts/common/fs/zfs compat/linuxkpi/common/src dev/drm2/ttm dev/md dev/netmap dev/xen/gntdev dev/xen/privcmd fs/nfsclient fs/smbf... X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: amd64/sgx cddl/contrib/opensolaris/uts/common/fs/zfs compat/linuxkpi/common/src dev/drm2/ttm dev/md dev/netmap dev/xen/gntdev dev/xen/privcmd fs/nfsclient fs/smbfs fs/tmpfs kern vm X-SVN-Commit-Revision: 353539 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 03:45:47 -0000 Author: jeff Date: Tue Oct 15 03:45:41 2019 New Revision: 353539 URL: https://svnweb.freebsd.org/changeset/base/353539 Log: (4/6) Protect page valid with the busy lock. Atomics are used for page busy and valid state when the shared busy is held. The details of the locking protocol and valid and dirty synchronization are in the updated vm_page.h comments. Reviewed by: kib, markj Tested by: pho Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D21594 Modified: head/sys/amd64/sgx/sgx.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/compat/linuxkpi/common/src/linux_compat.c head/sys/dev/drm2/ttm/ttm_bo_vm.c head/sys/dev/drm2/ttm/ttm_tt.c head/sys/dev/md/md.c head/sys/dev/netmap/netmap_freebsd.c head/sys/dev/xen/gntdev/gntdev.c head/sys/dev/xen/privcmd/privcmd.c head/sys/fs/nfsclient/nfs_clbio.c head/sys/fs/smbfs/smbfs_io.c head/sys/fs/tmpfs/tmpfs_subr.c head/sys/kern/kern_exec.c head/sys/kern/uipc_shm.c head/sys/kern/vfs_bio.c head/sys/kern/vfs_cluster.c head/sys/vm/device_pager.c head/sys/vm/phys_pager.c head/sys/vm/sg_pager.c head/sys/vm/swap_pager.c head/sys/vm/vm_fault.c head/sys/vm/vm_map.c head/sys/vm/vm_mmap.c head/sys/vm/vm_object.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_pageout.c head/sys/vm/vm_swapout.c head/sys/vm/vnode_pager.c Modified: head/sys/amd64/sgx/sgx.c ============================================================================== --- head/sys/amd64/sgx/sgx.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/amd64/sgx/sgx.c Tue Oct 15 03:45:41 2019 (r353539) @@ -220,8 +220,8 @@ sgx_va_slot_init_by_index(struct sgx_softc *sc, vm_obj page = PHYS_TO_VM_PAGE(epc->phys); - vm_page_insert(page, object, idx); page->valid = VM_PAGE_BITS_ALL; + vm_page_insert(page, object, idx); } return (0); @@ -610,8 +610,8 @@ sgx_insert_epc_page_by_index(vm_page_t page, vm_object VM_OBJECT_ASSERT_WLOCKED(object); - vm_page_insert(page, object, pidx); page->valid = VM_PAGE_BITS_ALL; + vm_page_insert(page, object, pidx); } static void Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Oct 15 03:45:41 2019 (r353539) @@ -1731,11 +1731,13 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_ db = dbp[0]; for (i = 0; i < *rbehind; i++) { m = vm_page_grab(vmobj, ma[0]->pindex - 1 - i, - VM_ALLOC_NORMAL | VM_ALLOC_NOWAIT | VM_ALLOC_NOBUSY); + VM_ALLOC_NORMAL | VM_ALLOC_NOWAIT | + VM_ALLOC_SBUSY | VM_ALLOC_IGN_SBUSY); if (m == NULL) break; - if (m->valid != 0) { + if (!vm_page_none_valid(m)) { ASSERT3U(m->valid, ==, VM_PAGE_BITS_ALL); + vm_page_sunbusy(m); break; } ASSERT(m->dirty == 0); @@ -1746,13 +1748,14 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_ va = zfs_map_page(m, &sf); bcopy((char *)db->db_data + bufoff, va, PAGESIZE); zfs_unmap_page(sf); - m->valid = VM_PAGE_BITS_ALL; + vm_page_valid(m); vm_page_lock(m); if ((m->busy_lock & VPB_BIT_WAITERS) != 0) vm_page_activate(m); else vm_page_deactivate(m); vm_page_unlock(m); + vm_page_sunbusy(m); } *rbehind = i; @@ -1763,7 +1766,7 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_ m = ma[mi]; if (m != bogus_page) { vm_page_assert_xbusied(m); - ASSERT(m->valid == 0); + ASSERT(vm_page_none_valid(m)); ASSERT(m->dirty == 0); ASSERT(!pmap_page_is_mapped(m)); va = zfs_map_page(m, &sf); @@ -1791,7 +1794,7 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_ if (pgoff == PAGESIZE) { if (m != bogus_page) { zfs_unmap_page(sf); - m->valid = VM_PAGE_BITS_ALL; + vm_page_valid(m); } ASSERT(mi < count); mi++; @@ -1840,16 +1843,18 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_ ASSERT(m != bogus_page); bzero(va + pgoff, PAGESIZE - pgoff); zfs_unmap_page(sf); - m->valid = VM_PAGE_BITS_ALL; + vm_page_valid(m); } for (i = 0; i < *rahead; i++) { m = vm_page_grab(vmobj, ma[count - 1]->pindex + 1 + i, - VM_ALLOC_NORMAL | VM_ALLOC_NOWAIT | VM_ALLOC_NOBUSY); + VM_ALLOC_NORMAL | VM_ALLOC_NOWAIT | + VM_ALLOC_SBUSY | VM_ALLOC_IGN_SBUSY); if (m == NULL) break; - if (m->valid != 0) { + if (!vm_page_none_valid(m)) { ASSERT3U(m->valid, ==, VM_PAGE_BITS_ALL); + vm_page_sunbusy(m); break; } ASSERT(m->dirty == 0); @@ -1866,13 +1871,14 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_ bzero(va + tocpy, PAGESIZE - tocpy); } zfs_unmap_page(sf); - m->valid = VM_PAGE_BITS_ALL; + vm_page_valid(m); vm_page_lock(m); if ((m->busy_lock & VPB_BIT_WAITERS) != 0) vm_page_activate(m); else vm_page_deactivate(m); vm_page_unlock(m); + vm_page_sunbusy(m); } *rahead = i; zfs_vmobject_wunlock(vmobj); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Oct 15 03:45:41 2019 (r353539) @@ -534,7 +534,7 @@ mappedread_sf(vnode_t *vp, int nbytes, uio_t *uio) pp = vm_page_grab(obj, OFF_TO_IDX(start), VM_ALLOC_SBUSY | VM_ALLOC_NORMAL | VM_ALLOC_IGN_SBUSY); - if (pp->valid == 0) { + if (vm_page_none_valid(pp)) { zfs_vmobject_wunlock(obj); va = zfs_map_page(pp, &sf); error = dmu_read(os, zp->z_id, start, bytes, va, @@ -543,17 +543,16 @@ mappedread_sf(vnode_t *vp, int nbytes, uio_t *uio) bzero(va + bytes, PAGESIZE - bytes); zfs_unmap_page(sf); zfs_vmobject_wlock(obj); - vm_page_sunbusy(pp); - if (error) { - if (!vm_page_busied(pp) && !vm_page_wired(pp) && - pp->valid == 0) - vm_page_free(pp); - } else { - pp->valid = VM_PAGE_BITS_ALL; + if (error == 0) { + vm_page_valid(pp); vm_page_lock(pp); vm_page_activate(pp); vm_page_unlock(pp); } + vm_page_sunbusy(pp); + if (error != 0 && !vm_page_wired(pp) == 0 && + pp->valid == 0 && vm_page_tryxbusy(pp)) + vm_page_free(pp); } else { ASSERT3U(pp->valid, ==, VM_PAGE_BITS_ALL); vm_page_sunbusy(pp); Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Tue Oct 15 03:45:41 2019 (r353539) @@ -514,7 +514,7 @@ linux_cdev_pager_fault(vm_object_t vm_obj, vm_ooffset_ vm_page_free(*mres); *mres = page; } - page->valid = VM_PAGE_BITS_ALL; + vm_page_valid(page); return (VM_PAGER_OK); } return (VM_PAGER_FAIL); Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_bo_vm.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/dev/drm2/ttm/ttm_bo_vm.c Tue Oct 15 03:45:41 2019 (r353539) @@ -252,7 +252,7 @@ reserve: ("inconsistent insert bo %p m %p m1 %p offset %jx", bo, m, m1, (uintmax_t)offset)); } - m->valid = VM_PAGE_BITS_ALL; + vm_page_valid(m); if (*mres != NULL) { KASSERT(*mres != m, ("losing %p %p", *mres, m)); vm_page_free(*mres); Modified: head/sys/dev/drm2/ttm/ttm_tt.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_tt.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/dev/drm2/ttm/ttm_tt.c Tue Oct 15 03:45:41 2019 (r353539) @@ -344,7 +344,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, vm_object_t per continue; to_page = vm_page_grab(obj, i, VM_ALLOC_NORMAL); pmap_copy_page(from_page, to_page); - to_page->valid = VM_PAGE_BITS_ALL; + vm_page_valid(to_page); vm_page_dirty(to_page); vm_page_xunbusy(to_page); } Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/dev/md/md.c Tue Oct 15 03:45:41 2019 (r353539) @@ -1074,7 +1074,7 @@ mdstart_swap(struct md_s *sc, struct bio *bp) len = ((i == lastp) ? lastend : PAGE_SIZE) - offs; m = vm_page_grab(sc->object, i, VM_ALLOC_SYSTEM); if (bp->bio_cmd == BIO_READ) { - if (m->valid == VM_PAGE_BITS_ALL) + if (vm_page_all_valid(m)) rv = VM_PAGER_OK; else rv = vm_pager_get_pages(sc->object, &m, 1, @@ -1090,7 +1090,7 @@ mdstart_swap(struct md_s *sc, struct bio *bp) * can be recreated if thrown out. */ pmap_zero_page(m); - m->valid = VM_PAGE_BITS_ALL; + vm_page_valid(m); } if ((bp->bio_flags & BIO_UNMAPPED) != 0) { pmap_copy_pages(&m, offs, bp->bio_ma, @@ -1104,7 +1104,7 @@ mdstart_swap(struct md_s *sc, struct bio *bp) cpu_flush_dcache(p, len); } } else if (bp->bio_cmd == BIO_WRITE) { - if (len == PAGE_SIZE || m->valid == VM_PAGE_BITS_ALL) + if (len == PAGE_SIZE || vm_page_all_valid(m)) rv = VM_PAGER_OK; else rv = vm_pager_get_pages(sc->object, &m, 1, @@ -1125,13 +1125,13 @@ mdstart_swap(struct md_s *sc, struct bio *bp) physcopyin(p, VM_PAGE_TO_PHYS(m) + offs, len); } - m->valid = VM_PAGE_BITS_ALL; + vm_page_valid(m); if (m->dirty != VM_PAGE_BITS_ALL) { vm_page_dirty(m); vm_pager_page_unswapped(m); } } else if (bp->bio_cmd == BIO_DELETE) { - if (len == PAGE_SIZE || m->valid == VM_PAGE_BITS_ALL) + if (len == PAGE_SIZE || vm_page_all_valid(m)) rv = VM_PAGER_OK; else rv = vm_pager_get_pages(sc->object, &m, 1, Modified: head/sys/dev/netmap/netmap_freebsd.c ============================================================================== --- head/sys/dev/netmap/netmap_freebsd.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/dev/netmap/netmap_freebsd.c Tue Oct 15 03:45:41 2019 (r353539) @@ -1056,7 +1056,7 @@ netmap_dev_pager_fault(vm_object_t object, vm_ooffset_ *mres = page; vm_page_insert(page, object, pidx); } - page->valid = VM_PAGE_BITS_ALL; + vm_page_valid(page); return (VM_PAGER_OK); } Modified: head/sys/dev/xen/gntdev/gntdev.c ============================================================================== --- head/sys/dev/xen/gntdev/gntdev.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/dev/xen/gntdev/gntdev.c Tue Oct 15 03:45:41 2019 (r353539) @@ -836,8 +836,8 @@ gntdev_gmap_pg_fault(vm_object_t object, vm_ooffset_t } vm_page_busy_acquire(page, 0); + vm_page_valid(page); vm_page_insert(page, object, pidx); - page->valid = VM_PAGE_BITS_ALL; *mres = page; return (VM_PAGER_OK); } Modified: head/sys/dev/xen/privcmd/privcmd.c ============================================================================== --- head/sys/dev/xen/privcmd/privcmd.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/dev/xen/privcmd/privcmd.c Tue Oct 15 03:45:41 2019 (r353539) @@ -179,8 +179,8 @@ privcmd_pg_fault(vm_object_t object, vm_ooffset_t offs } vm_page_busy_acquire(page, 0); + vm_page_valid(page); vm_page_insert(page, object, pidx); - page->valid = VM_PAGE_BITS_ALL; *mres = page; return (VM_PAGER_OK); } Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/fs/nfsclient/nfs_clbio.c Tue Oct 15 03:45:41 2019 (r353539) @@ -174,7 +174,7 @@ ncl_getpages(struct vop_getpages_args *ap) * XXXGL: is that true for NFS, where short read can occur??? */ VM_OBJECT_WLOCK(object); - if (pages[npages - 1]->valid != 0 && --npages == 0) + if (!vm_page_none_valid(pages[npages - 1]) && --npages == 0) goto out; VM_OBJECT_WUNLOCK(object); @@ -227,14 +227,14 @@ ncl_getpages(struct vop_getpages_args *ap) /* * Read operation filled an entire page */ - m->valid = VM_PAGE_BITS_ALL; + vm_page_valid(m); KASSERT(m->dirty == 0, ("nfs_getpages: page %p is dirty", m)); } else if (size > toff) { /* * Read operation filled a partial page. */ - m->valid = 0; + vm_page_invalid(m); vm_page_set_valid_range(m, 0, size - toff); KASSERT(m->dirty == 0, ("nfs_getpages: page %p is dirty", m)); Modified: head/sys/fs/smbfs/smbfs_io.c ============================================================================== --- head/sys/fs/smbfs/smbfs_io.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/fs/smbfs/smbfs_io.c Tue Oct 15 03:45:41 2019 (r353539) @@ -457,7 +457,7 @@ smbfs_getpages(ap) * XXXGL: is that true for SMB filesystem? */ VM_OBJECT_WLOCK(object); - if (pages[npages - 1]->valid != 0 && --npages == 0) + if (!vm_page_none_valid(pages[npages - 1]) && --npages == 0) goto out; VM_OBJECT_WUNLOCK(object); @@ -505,14 +505,14 @@ smbfs_getpages(ap) /* * Read operation filled an entire page */ - m->valid = VM_PAGE_BITS_ALL; + vm_page_valid(m); KASSERT(m->dirty == 0, ("smbfs_getpages: page %p is dirty", m)); } else if (size > toff) { /* * Read operation filled a partial page. */ - m->valid = 0; + vm_page_invalid(m); vm_page_set_valid_range(m, 0, size - toff); KASSERT(m->dirty == 0, ("smbfs_getpages: page %p is dirty", m)); Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/fs/tmpfs/tmpfs_subr.c Tue Oct 15 03:45:41 2019 (r353539) @@ -1408,7 +1408,7 @@ tmpfs_reg_resize(struct vnode *vp, off_t newsize, bool retry: m = vm_page_grab(uobj, idx, VM_ALLOC_NOCREAT); if (m != NULL) { - MPASS(m->valid == VM_PAGE_BITS_ALL); + MPASS(vm_page_all_valid(m)); } else if (vm_pager_has_page(uobj, idx, NULL, NULL)) { m = vm_page_alloc(uobj, idx, VM_ALLOC_NORMAL | VM_ALLOC_WAITFAIL); Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/kern/kern_exec.c Tue Oct 15 03:45:41 2019 (r353539) @@ -979,11 +979,15 @@ exec_map_first_page(struct image_params *imgp) retry: ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED); - if (ma[0]->valid != VM_PAGE_BITS_ALL) { + if (!vm_page_all_valid(ma[0])) { if (vm_page_busy_acquire(ma[0], VM_ALLOC_WAITFAIL) == 0) { vm_page_unwire_noq(ma[0]); goto retry; } + if (vm_page_all_valid(ma[0])) { + vm_page_xunbusy(ma[0]); + goto out; + } if (!vm_pager_has_page(object, 0, NULL, &after)) { if (vm_page_unwire_noq(ma[0])) vm_page_free(ma[0]); @@ -1029,6 +1033,8 @@ retry: for (i = 1; i < initial_pagein; i++) vm_page_readahead_finish(ma[i]); } + +out: VM_OBJECT_WUNLOCK(object); imgp->firstpage = sf_buf_alloc(ma[0], 0); Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/kern/uipc_shm.c Tue Oct 15 03:45:41 2019 (r353539) @@ -459,7 +459,7 @@ shm_dotruncate_locked(struct shmfd *shmfd, off_t lengt retry: m = vm_page_grab(object, idx, VM_ALLOC_NOCREAT); if (m != NULL) { - MPASS(m->valid == VM_PAGE_BITS_ALL); + MPASS(vm_page_all_valid(m)); } else if (vm_pager_has_page(object, idx, NULL, NULL)) { m = vm_page_alloc(object, idx, VM_ALLOC_NORMAL | VM_ALLOC_WAITFAIL); @@ -485,7 +485,7 @@ retry: } if (m != NULL) { pmap_zero_page_area(m, base, PAGE_SIZE - base); - KASSERT(m->valid == VM_PAGE_BITS_ALL, + KASSERT(vm_page_all_valid(m), ("shm_dotruncate: page %p is invalid", m)); vm_page_dirty(m); vm_page_xunbusy(m); Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/kern/vfs_bio.c Tue Oct 15 03:45:41 2019 (r353539) @@ -956,6 +956,12 @@ vfs_buf_test_cache(struct buf *bp, vm_ooffset_t foff, { VM_OBJECT_ASSERT_LOCKED(m->object); + + /* + * This function and its results are protected by higher level + * synchronization requiring vnode and buf locks to page in and + * validate pages. + */ if (bp->b_flags & B_CACHE) { int base = (foff + off) & PAGE_MASK; if (vm_page_is_valid(m, base, size) == 0) @@ -4640,7 +4646,7 @@ vfs_busy_pages(struct buf *bp, int clear_modify) if (clear_modify) { pmap_remove_write(m); vfs_page_set_validclean(bp, foff, m); - } else if (m->valid == VM_PAGE_BITS_ALL && + } else if (vm_page_all_valid(m) && (bp->b_flags & B_CACHE) == 0) { bp->b_pages[i] = bogus_page; bogus = true; @@ -4681,6 +4687,14 @@ vfs_bio_set_valid(struct buf *bp, int base, int size) n = PAGE_SIZE - (base & PAGE_MASK); VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); + + /* + * Busy may not be strictly necessary here because the pages are + * unlikely to be fully valid and the vnode lock will synchronize + * their access via getpages. It is grabbed for consistency with + * other page validation. + */ + vfs_busy_pages_acquire(bp); for (i = base / PAGE_SIZE; size > 0 && i < bp->b_npages; ++i) { m = bp->b_pages[i]; if (n > size) @@ -4690,6 +4704,7 @@ vfs_bio_set_valid(struct buf *bp, int base, int size) size -= n; n = PAGE_SIZE; } + vfs_busy_pages_release(bp); VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); } @@ -4717,6 +4732,7 @@ vfs_bio_clrbuf(struct buf *bp) bp->b_flags &= ~B_INVAL; bp->b_ioflags &= ~BIO_ERROR; VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); + vfs_busy_pages_acquire(bp); if ((bp->b_npages == 1) && (bp->b_bufsize < PAGE_SIZE) && (bp->b_offset & PAGE_MASK) == 0) { if (bp->b_pages[0] == bogus_page) @@ -4758,6 +4774,7 @@ vfs_bio_clrbuf(struct buf *bp) bp->b_pages[i]->valid |= mask; } unlock: + vfs_busy_pages_release(bp); VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); bp->b_resid = 0; } @@ -5189,7 +5206,7 @@ again: * the end of the function catches the race in a * reliable way (protected by the object lock). */ - if (m->valid == VM_PAGE_BITS_ALL) + if (vm_page_all_valid(m)) continue; poff = IDX_TO_OFF(m->pindex); @@ -5219,7 +5236,7 @@ again: * cache pressure. */ if (buf_pager_relbuf || - m->valid != VM_PAGE_BITS_ALL) + !vm_page_all_valid(m)) bp->b_flags |= B_RELBUF; bp->b_flags &= ~B_NOCACHE; @@ -5229,12 +5246,12 @@ again: } } KASSERT(1 /* racy, enable for debugging */ || - m->valid == VM_PAGE_BITS_ALL || i == count - 1, + vm_page_all_valid(m) || i == count - 1, ("buf %d %p invalid", i, m)); if (i == count - 1 && lpart) { VM_OBJECT_WLOCK(object); - if (m->valid != 0 && - m->valid != VM_PAGE_BITS_ALL) + if (!vm_page_none_valid(m) && + !vm_page_all_valid(m)) vm_page_zero_invalid(m, TRUE); VM_OBJECT_WUNLOCK(object); } @@ -5261,7 +5278,7 @@ end_pages: * invalidated or removed, so we must restart for * safety as well. */ - if (ma[i]->valid != VM_PAGE_BITS_ALL) + if (!vm_page_all_valid(ma[i])) redo = true; } if (redo && error == 0) Modified: head/sys/kern/vfs_cluster.c ============================================================================== --- head/sys/kern/vfs_cluster.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/kern/vfs_cluster.c Tue Oct 15 03:45:41 2019 (r353539) @@ -465,11 +465,13 @@ cluster_rbuild(struct vnode *vp, u_quad_t filesize, da if (toff + tinc > PAGE_SIZE) tinc = PAGE_SIZE - toff; VM_OBJECT_ASSERT_WLOCKED(tbp->b_pages[j]->object); - if ((tbp->b_pages[j]->valid & - vm_page_bits(toff, tinc)) != 0) - break; if (vm_page_trysbusy(tbp->b_pages[j]) == 0) break; + if ((tbp->b_pages[j]->valid & + vm_page_bits(toff, tinc)) != 0) { + vm_page_sunbusy(tbp->b_pages[j]); + break; + } vm_object_pip_add(tbp->b_bufobj->bo_object, 1); off += tinc; tsize -= tinc; @@ -524,7 +526,7 @@ clean_sbusy: bp->b_pages[bp->b_npages] = m; bp->b_npages++; } - if (m->valid == VM_PAGE_BITS_ALL) + if (vm_page_all_valid(m)) tbp->b_pages[j] = bogus_page; } VM_OBJECT_WUNLOCK(tbp->b_bufobj->bo_object); @@ -548,7 +550,7 @@ clean_sbusy: VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); for (j = 0; j < bp->b_npages; j++) { VM_OBJECT_ASSERT_WLOCKED(bp->b_pages[j]->object); - if (bp->b_pages[j]->valid == VM_PAGE_BITS_ALL) + if (vm_page_all_valid(bp->b_pages[j])) bp->b_pages[j] = bogus_page; } VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); Modified: head/sys/vm/device_pager.c ============================================================================== --- head/sys/vm/device_pager.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/vm/device_pager.c Tue Oct 15 03:45:41 2019 (r353539) @@ -395,7 +395,7 @@ old_dev_pager_fault(vm_object_t object, vm_ooffset_t o vm_page_free(*mres); *mres = page; } - page->valid = VM_PAGE_BITS_ALL; + vm_page_valid(page); return (VM_PAGER_OK); } Modified: head/sys/vm/phys_pager.c ============================================================================== --- head/sys/vm/phys_pager.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/vm/phys_pager.c Tue Oct 15 03:45:41 2019 (r353539) @@ -145,12 +145,12 @@ phys_pager_getpages(vm_object_t object, vm_page_t *m, VM_OBJECT_ASSERT_WLOCKED(object); for (i = 0; i < count; i++) { - if (m[i]->valid == 0) { + if (vm_page_none_valid(m[i])) { if ((m[i]->flags & PG_ZERO) == 0) pmap_zero_page(m[i]); - m[i]->valid = VM_PAGE_BITS_ALL; + vm_page_valid(m[i]); } - KASSERT(m[i]->valid == VM_PAGE_BITS_ALL, + KASSERT(vm_page_all_valid(m[i]), ("phys_pager_getpages: partially valid page %p", m[i])); KASSERT(m[i]->dirty == 0, ("phys_pager_getpages: dirty page %p", m[i])); @@ -209,10 +209,8 @@ phys_pager_populate(vm_object_t object, vm_pindex_t pi ahead = MIN(end - i, PHYSALLOC); m = vm_page_grab(object, i, VM_ALLOC_NORMAL | VM_ALLOC_COUNT(ahead)); - if (m->valid != VM_PAGE_BITS_ALL) { + if (!vm_page_all_valid(m)) vm_page_zero_invalid(m, TRUE); - m->valid = VM_PAGE_BITS_ALL; - } KASSERT(m->dirty == 0, ("phys_pager_populate: dirty page %p", m)); } Modified: head/sys/vm/sg_pager.c ============================================================================== --- head/sys/vm/sg_pager.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/vm/sg_pager.c Tue Oct 15 03:45:41 2019 (r353539) @@ -198,7 +198,7 @@ sg_pager_getpages(vm_object_t object, vm_page_t *m, in vm_page_free(m[0]); vm_page_unlock(m[0]); m[0] = page; - page->valid = VM_PAGE_BITS_ALL; + vm_page_valid(page); if (rbehind) *rbehind = 0; Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/vm/swap_pager.c Tue Oct 15 03:45:41 2019 (r353539) @@ -1554,7 +1554,7 @@ swp_pager_async_iodone(struct buf *bp) * be overridden by the original caller of * getpages so don't play cute tricks here. */ - m->valid = 0; + vm_page_invalid(m); } else { /* * If a write error occurs, reactivate page @@ -1582,7 +1582,7 @@ swp_pager_async_iodone(struct buf *bp) KASSERT(m->dirty == 0, ("swp_pager_async_iodone: page %p is dirty", m)); - m->valid = VM_PAGE_BITS_ALL; + vm_page_valid(m); if (i < bp->b_pgbefore || i >= bp->b_npages - bp->b_pgafter) vm_page_readahead_finish(m); Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/vm/vm_fault.c Tue Oct 15 03:45:41 2019 (r353539) @@ -211,6 +211,7 @@ vm_fault_dirty(vm_map_entry_t entry, vm_page_t m, vm_p return; VM_OBJECT_ASSERT_LOCKED(m->object); + VM_PAGE_OBJECT_BUSY_ASSERT(m); need_dirty = ((fault_type & VM_PROT_WRITE) != 0 && (fault_flags & VM_FAULT_WIRE) == 0) || @@ -285,7 +286,7 @@ vm_fault_soft_fast(struct faultstate *fs, vm_offset_t m = vm_page_lookup(fs->first_object, fs->first_pindex); /* A busy page can be mapped for read|execute access. */ if (m == NULL || ((prot & VM_PROT_WRITE) != 0 && - vm_page_busied(m)) || m->valid != VM_PAGE_BITS_ALL) { + vm_page_busied(m)) || !vm_page_all_valid(m)) { rv = KERN_FAILURE; goto out; } @@ -368,7 +369,7 @@ vm_fault_populate_check_page(vm_page_t m) * valid, and exclusively busied. */ MPASS(m != NULL); - MPASS(m->valid == VM_PAGE_BITS_ALL); + MPASS(vm_page_all_valid(m)); MPASS(vm_page_xbusied(m)); } @@ -830,7 +831,7 @@ RetryFault_oom: * (readable), jump to readrest, else break-out ( we * found the page ). */ - if (fs.m->valid != VM_PAGE_BITS_ALL) + if (!vm_page_all_valid(fs.m)) goto readrest; break; /* break to PAGE HAS BEEN FOUND */ } @@ -1154,7 +1155,7 @@ readrest: VM_CNT_INC(v_ozfod); } VM_CNT_INC(v_zfod); - fs.m->valid = VM_PAGE_BITS_ALL; + vm_page_valid(fs.m); /* Don't try to prefault neighboring pages. */ faultcount = 1; break; /* break to PAGE HAS BEEN FOUND */ @@ -1245,7 +1246,7 @@ readrest: * Oh, well, lets copy it. */ pmap_copy_page(fs.m, fs.first_m); - fs.first_m->valid = VM_PAGE_BITS_ALL; + vm_page_valid(fs.first_m); if (wired && (fault_flags & VM_FAULT_WIRE) == 0) { vm_page_wire(fs.first_m); @@ -1364,7 +1365,7 @@ readrest: * Page must be completely valid or it is not fit to * map into user space. vm_pager_get_pages() ensures this. */ - KASSERT(fs.m->valid == VM_PAGE_BITS_ALL, + KASSERT(vm_page_all_valid(fs.m), ("vm_fault: page %p partially invalid", fs.m)); VM_OBJECT_WUNLOCK(fs.object); @@ -1480,7 +1481,7 @@ vm_fault_dontneed(const struct faultstate *fs, vm_offs entry->start); while ((m = m_next) != NULL && m->pindex < pend) { m_next = TAILQ_NEXT(m, listq); - if (m->valid != VM_PAGE_BITS_ALL || + if (!vm_page_all_valid(m) || vm_page_busied(m)) continue; @@ -1577,7 +1578,7 @@ vm_fault_prefault(const struct faultstate *fs, vm_offs VM_OBJECT_RUNLOCK(lobject); break; } - if (m->valid == VM_PAGE_BITS_ALL && + if (vm_page_all_valid(m) && (m->flags & PG_FICTITIOUS) == 0) pmap_enter_quick(pmap, addr, m, entry->protection); if (!obj_locked || lobject != entry->object.vm_object) @@ -1852,7 +1853,7 @@ again: * all copies of the wired map entry have similar * backing pages. */ - if (dst_m->valid == VM_PAGE_BITS_ALL) { + if (vm_page_all_valid(dst_m)) { pmap_enter(dst_map->pmap, vaddr, dst_m, prot, access | (upgrade ? PMAP_ENTER_WIRED : 0), 0); } Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/vm/vm_map.c Tue Oct 15 03:45:41 2019 (r353539) @@ -2358,7 +2358,7 @@ vm_map_pmap_enter(vm_map_t map, vm_offset_t addr, vm_p psize = tmpidx; break; } - if (p->valid == VM_PAGE_BITS_ALL) { + if (vm_page_all_valid(p)) { if (p_start == NULL) { start = addr + ptoa(tmpidx); p_start = p; Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/vm/vm_mmap.c Tue Oct 15 03:45:41 2019 (r353539) @@ -893,7 +893,7 @@ RestartScan: } } else vm_page_unlock(m); - KASSERT(m->valid == VM_PAGE_BITS_ALL, + KASSERT(vm_page_all_valid(m), ("mincore: page %p is mapped but invalid", m)); } else if (mincoreinfo == 0) { @@ -915,7 +915,7 @@ RestartScan: pindex = OFF_TO_IDX(current->offset + (addr - current->start)); m = vm_page_lookup(object, pindex); - if (m != NULL && m->valid == 0) + if (m != NULL && vm_page_none_valid(m)) m = NULL; if (m != NULL) mincoreinfo = MINCORE_INCORE; Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/vm/vm_object.c Tue Oct 15 03:45:41 2019 (r353539) @@ -841,7 +841,7 @@ rescan: if (pi >= tend) break; np = TAILQ_NEXT(p, listq); - if (p->valid == 0) + if (vm_page_none_valid(p)) continue; if (vm_page_busy_acquire(p, VM_ALLOC_WAITFAIL) == 0) { if (object->generation != curgeneration) { @@ -1161,10 +1161,10 @@ next_page: } /* - * If the page is not in a normal state, skip it. + * If the page is not in a normal state, skip it. The page + * can not be invalidated while the object lock is held. */ - if (tm->valid != VM_PAGE_BITS_ALL || - vm_page_wired(tm)) + if (!vm_page_all_valid(tm) || vm_page_wired(tm)) goto next_pindex; KASSERT((tm->flags & PG_FICTITIOUS) == 0, ("vm_object_madvise: page %p is fictitious", tm)); @@ -1488,7 +1488,11 @@ vm_object_scan_all_shadowed(vm_object_t object) * object and we might as well give up now. */ pp = vm_page_lookup(object, new_pindex); - if ((pp == NULL || pp->valid == 0) && + /* + * The valid check here is stable due to object lock being + * required to clear valid and initiate paging. + */ + if ((pp == NULL || vm_page_none_valid(pp)) && !vm_pager_has_page(object, new_pindex, NULL, NULL)) return (false); } @@ -1567,7 +1571,7 @@ vm_object_collapse_scan(vm_object_t object, int op) continue; } - KASSERT(pp == NULL || pp->valid != 0, + KASSERT(pp == NULL || !vm_page_none_valid(pp), ("unbusy invalid page %p", pp)); if (pp != NULL || vm_pager_has_page(object, new_pindex, NULL, @@ -1894,7 +1898,7 @@ wired: object->ref_count != 0) pmap_remove_all(p); if ((options & OBJPR_CLEANONLY) == 0) { - p->valid = 0; + vm_page_invalid(p); vm_page_undirty(p); } vm_page_xunbusy(p); @@ -1902,7 +1906,8 @@ wired: } KASSERT((p->flags & PG_FICTITIOUS) == 0, ("vm_object_page_remove: page %p is fictitious", p)); - if ((options & OBJPR_CLEANONLY) != 0 && p->valid != 0) { + if ((options & OBJPR_CLEANONLY) != 0 && + !vm_page_none_valid(p)) { if ((options & OBJPR_NOTMAPPED) == 0 && object->ref_count != 0 && !vm_page_try_remove_write(p)) Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue Oct 15 03:41:36 2019 (r353538) +++ head/sys/vm/vm_page.c Tue Oct 15 03:45:41 2019 (r353539) @@ -1330,7 +1330,7 @@ vm_page_readahead_finish(vm_page_t m) { /* We shouldn't put invalid pages on queues. */ - KASSERT(m->valid != 0, ("%s: %p is invalid", __func__, m)); + KASSERT(!vm_page_none_valid(m), ("%s: %p is invalid", __func__, m)); /* * Since the page is not the actually needed one, whether it should @@ -1430,8 +1430,7 @@ vm_page_dirty_KBI(vm_page_t m) { /* Refer to this operation by its public name. */ - KASSERT(m->valid == VM_PAGE_BITS_ALL, - ("vm_page_dirty: page is invalid!")); + KASSERT(vm_page_all_valid(m), ("vm_page_dirty: page is invalid!")); m->dirty = VM_PAGE_BITS_ALL; } @@ -2657,7 +2656,7 @@ retry: VPO_SWAPSLEEP | VPO_UNMANAGED)) == 0, ("page %p has unexpected oflags", m)); /* Don't care: VPO_NOSYNC. */ - if (m->valid != 0) { + if (!vm_page_none_valid(m)) { /* * First, try to allocate a new page * that is above "high". Failing @@ -4334,7 +4333,7 @@ retrylookup: * However, we will not end up with an invalid page and a * shared lock. */ - if (m->valid != VM_PAGE_BITS_ALL || + if (!vm_page_all_valid(m) || (allocflags & (VM_ALLOC_IGN_SBUSY | VM_ALLOC_SBUSY)) == 0) { sleep = !vm_page_tryxbusy(m); xbusy = true; @@ -4354,7 +4353,7 @@ retrylookup: goto retrylookup; } if ((allocflags & VM_ALLOC_NOCREAT) != 0 && - m->valid != VM_PAGE_BITS_ALL) { + !vm_page_all_valid(m)) { if (xbusy) vm_page_xunbusy(m); else @@ -4364,7 +4363,7 @@ retrylookup: } if ((allocflags & VM_ALLOC_WIRED) != 0) vm_page_wire(m); - if (m->valid == VM_PAGE_BITS_ALL) + if (vm_page_all_valid(m)) goto out; } else if ((allocflags & VM_ALLOC_NOCREAT) != 0) { *mp = NULL; @@ -4386,7 +4385,7 @@ retrylookup: *mp = NULL; return (rv); } - MPASS(m->valid == VM_PAGE_BITS_ALL); + MPASS(vm_page_all_valid(m)); } else { vm_page_zero_invalid(m, TRUE); } @@ -4499,10 +4498,11 @@ retrylookup: goto retrylookup; } } - if (m->valid == 0 && (allocflags & VM_ALLOC_ZERO) != 0) { + if (vm_page_none_valid(m) && + (allocflags & VM_ALLOC_ZERO) != 0) { if ((m->flags & PG_ZERO) == 0) pmap_zero_page(m); - m->valid = VM_PAGE_BITS_ALL; + vm_page_valid(m); } if ((allocflags & VM_ALLOC_NOBUSY) != 0) { if ((allocflags & VM_ALLOC_IGN_SBUSY) != 0) @@ -4542,6 +4542,72 @@ vm_page_bits(int base, int size) ((vm_page_bits_t)1 << first_bit)); } +static inline void +vm_page_bits_set(vm_page_t m, vm_page_bits_t *bits, vm_page_bits_t set) +{ + +#if PAGE_SIZE == 32768 + atomic_set_64((uint64_t *)bits, set); +#elif PAGE_SIZE == 16384 + atomic_set_32((uint32_t *)bits, set); +#elif (PAGE_SIZE == 8192) && defined(atomic_set_16) + atomic_set_16((uint16_t *)bits, set); +#elif (PAGE_SIZE == 4096) && defined(atomic_set_8) + atomic_set_8((uint8_t *)bits, set); +#else /* PAGE_SIZE <= 8192 */ + uintptr_t addr; + int shift; + + addr = (uintptr_t)bits; + /* + * Use a trick to perform a 32-bit atomic on the + * containing aligned word, to not depend on the existence + * of atomic_{set, clear}_{8, 16}. + */ + shift = addr & (sizeof(uint32_t) - 1); +#if BYTE_ORDER == BIG_ENDIAN + shift = (sizeof(uint32_t) - sizeof(vm_page_bits_t) - shift) * NBBY; +#else + shift *= NBBY; +#endif + addr &= ~(sizeof(uint32_t) - 1); + atomic_set_32((uint32_t *)addr, set << shift); +#endif /* PAGE_SIZE */ +} + +static inline void +vm_page_bits_clear(vm_page_t m, vm_page_bits_t *bits, vm_page_bits_t clear) +{ + +#if PAGE_SIZE == 32768 + atomic_clear_64((uint64_t *)bits, clear); +#elif PAGE_SIZE == 16384 + atomic_clear_32((uint32_t *)bits, clear); +#elif (PAGE_SIZE == 8192) && defined(atomic_clear_16) + atomic_clear_16((uint16_t *)bits, clear); +#elif (PAGE_SIZE == 4096) && defined(atomic_clear_8) + atomic_clear_8((uint8_t *)bits, clear); +#else /* PAGE_SIZE <= 8192 */ + uintptr_t addr; + int shift; + + addr = (uintptr_t)bits; + /* + * Use a trick to perform a 32-bit atomic on the + * containing aligned word, to not depend on the existence + * of atomic_{set, clear}_{8, 16}. + */ + shift = addr & (sizeof(uint32_t) - 1); +#if BYTE_ORDER == BIG_ENDIAN + shift = (sizeof(uint32_t) - sizeof(vm_page_bits_t) - shift) * NBBY; +#else + shift *= NBBY; +#endif + addr &= ~(sizeof(uint32_t) - 1); + atomic_clear_32((uint32_t *)addr, clear << shift); +#endif /* PAGE_SIZE */ +} + /* * vm_page_set_valid_range: * @@ -4556,8 +4622,9 @@ void vm_page_set_valid_range(vm_page_t m, int base, int size) { int endoff, frag; + vm_page_bits_t pagebits; - VM_OBJECT_ASSERT_WLOCKED(m->object); + vm_page_assert_busied(m); if (size == 0) /* handle degenerate case */ return; @@ -4591,7 +4658,11 @@ vm_page_set_valid_range(vm_page_t m, int base, int siz /* * Set valid bits inclusive of any overlap. */ - m->valid |= vm_page_bits(base, size); + pagebits = vm_page_bits(base, size); + if (vm_page_xbusied(m)) + m->valid |= pagebits; + else + vm_page_bits_set(m, &m->valid, pagebits); } /* @@ -4600,52 +4671,20 @@ vm_page_set_valid_range(vm_page_t m, int base, int siz static __inline void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits) { - uintptr_t addr; -#if PAGE_SIZE < 16384 - int shift; -#endif + vm_page_assert_busied(m); + /* - * If the object is locked and the page is neither exclusive busy nor - * write mapped, then the page's dirty field cannot possibly be - * set by a concurrent pmap operation. + * If the page is xbusied and not write mapped we are the + * only thread that can modify dirty bits. Otherwise, The pmap + * layer can call vm_page_dirty() without holding a distinguished + * lock. The combination of page busy and atomic operations + * suffice to guarantee consistency of the page dirty field. */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && !pmap_page_is_write_mapped(m)) + if (vm_page_xbusied(m) && !pmap_page_is_write_mapped(m)) m->dirty &= ~pagebits; - else { - /* - * The pmap layer can call vm_page_dirty() without - * holding a distinguished lock. The combination of - * the object's lock and an atomic operation suffice - * to guarantee consistency of the page dirty field. - * - * For PAGE_SIZE == 32768 case, compiler already - * properly aligns the dirty field, so no forcible - * alignment is needed. Only require existence of - * atomic_clear_64 when page size is 32768. - */ - addr = (uintptr_t)&m->dirty; -#if PAGE_SIZE == 32768 - atomic_clear_64((uint64_t *)addr, pagebits); -#elif PAGE_SIZE == 16384 - atomic_clear_32((uint32_t *)addr, pagebits); -#else /* PAGE_SIZE <= 8192 */ - /* - * Use a trick to perform a 32-bit atomic on the *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Oct 15 03:48:23 2019 Return-Path: Delivered-To: svn-src-all@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 A75CB152955; Tue, 15 Oct 2019 03:48:23 +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 46shGv3ylhz4dWK; Tue, 15 Oct 2019 03:48:23 +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 6B72718BD3; Tue, 15 Oct 2019 03:48:23 +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 x9F3mNhv028948; Tue, 15 Oct 2019 03:48:23 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9F3mMkk028943; Tue, 15 Oct 2019 03:48:22 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201910150348.x9F3mMkk028943@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 15 Oct 2019 03:48:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353540 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353540 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 03:48:23 -0000 Author: jeff Date: Tue Oct 15 03:48:22 2019 New Revision: 353540 URL: https://svnweb.freebsd.org/changeset/base/353540 Log: (5/6) Move the VPO_NOSYNC to PGA_NOSYNC to eliminate the dependency on the object lock in vm_page_set_validclean(). Reviewed by: kib, markj Tested by: pho Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D21595 Modified: head/sys/vm/vm_fault.c head/sys/vm/vm_object.c head/sys/vm/vm_object.h head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Tue Oct 15 03:45:41 2019 (r353539) +++ head/sys/vm/vm_fault.c Tue Oct 15 03:48:22 2019 (r353540) @@ -225,15 +225,14 @@ vm_fault_dirty(vm_map_entry_t entry, vm_page_t m, vm_p * FALSE, one for the map entry with MAP_ENTRY_NOSYNC * flag set, other with flag clear, race, it is * possible for the no-NOSYNC thread to see m->dirty - * != 0 and not clear VPO_NOSYNC. Take vm_page lock - * around manipulation of VPO_NOSYNC and - * vm_page_dirty() call, to avoid the race and keep - * m->oflags consistent. + * != 0 and not clear PGA_NOSYNC. Take vm_page lock + * around manipulation of PGA_NOSYNC and + * vm_page_dirty() call to avoid the race. */ vm_page_lock(m); /* - * If this is a NOSYNC mmap we do not want to set VPO_NOSYNC + * If this is a NOSYNC mmap we do not want to set PGA_NOSYNC * if the page is already dirty to prevent data written with * the expectation of being synced from not being synced. * Likewise if this entry does not request NOSYNC then make @@ -242,10 +241,10 @@ vm_fault_dirty(vm_map_entry_t entry, vm_page_t m, vm_p */ if ((entry->eflags & MAP_ENTRY_NOSYNC) != 0) { if (m->dirty == 0) { - m->oflags |= VPO_NOSYNC; + vm_page_aflag_set(m, PGA_NOSYNC); } } else { - m->oflags &= ~VPO_NOSYNC; + vm_page_aflag_clear(m, PGA_NOSYNC); } /* Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Tue Oct 15 03:45:41 2019 (r353539) +++ head/sys/vm/vm_object.c Tue Oct 15 03:48:22 2019 (r353540) @@ -772,12 +772,14 @@ static boolean_t vm_object_page_remove_write(vm_page_t p, int flags, boolean_t *clearobjflags) { + vm_page_assert_busied(p); + /* * If we have been asked to skip nosync pages and this is a * nosync page, skip it. Note that the object flags were not * cleared in this case so we do not have to set them. */ - if ((flags & OBJPC_NOSYNC) != 0 && (p->oflags & VPO_NOSYNC) != 0) { + if ((flags & OBJPC_NOSYNC) != 0 && (p->aflags & PGA_NOSYNC) != 0) { *clearobjflags = FALSE; return (FALSE); } else { @@ -791,7 +793,7 @@ vm_object_page_remove_write(vm_page_t p, int flags, bo * * Clean all dirty pages in the specified range of object. Leaves page * on whatever queue it is currently on. If NOSYNC is set then do not - * write out pages with VPO_NOSYNC set (originally comes from MAP_NOSYNC), + * write out pages with PGA_NOSYNC set (originally comes from MAP_NOSYNC), * leaving the object dirty. * * When stuffing pages asynchronously, allow clustering. XXX we need a @@ -2270,7 +2272,6 @@ void vm_object_unbusy(vm_object_t obj) { - VM_OBJECT_ASSERT_LOCKED(obj); refcount_release(&obj->busy); } Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Tue Oct 15 03:45:41 2019 (r353539) +++ head/sys/vm/vm_object.h Tue Oct 15 03:48:22 2019 (r353540) @@ -209,7 +209,7 @@ struct vm_object { #define OBJPC_SYNC 0x1 /* sync I/O */ #define OBJPC_INVAL 0x2 /* invalidate */ -#define OBJPC_NOSYNC 0x4 /* skip if VPO_NOSYNC */ +#define OBJPC_NOSYNC 0x4 /* skip if PGA_NOSYNC */ /* * The following options are supported by vm_object_page_remove(). Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue Oct 15 03:45:41 2019 (r353539) +++ head/sys/vm/vm_page.c Tue Oct 15 03:48:22 2019 (r353540) @@ -2506,7 +2506,7 @@ retry: KASSERT((m->oflags & (VPO_SWAPINPROG | VPO_SWAPSLEEP | VPO_UNMANAGED)) == 0, ("page %p has unexpected oflags", m)); - /* Don't care: VPO_NOSYNC. */ + /* Don't care: PGA_NOSYNC. */ run_ext = 1; } else run_ext = 0; @@ -2655,7 +2655,7 @@ retry: KASSERT((m->oflags & (VPO_SWAPINPROG | VPO_SWAPSLEEP | VPO_UNMANAGED)) == 0, ("page %p has unexpected oflags", m)); - /* Don't care: VPO_NOSYNC. */ + /* Don't care: PGA_NOSYNC. */ if (!vm_page_none_valid(m)) { /* * First, try to allocate a new page @@ -2721,7 +2721,6 @@ retry: ~PGA_QUEUE_STATE_MASK; KASSERT(m_new->oflags == VPO_UNMANAGED, ("page %p is managed", m_new)); - m_new->oflags = m->oflags & VPO_NOSYNC; pmap_copy_page(m, m_new); m_new->valid = m->valid; m_new->dirty = m->dirty; @@ -4703,8 +4702,6 @@ vm_page_set_validclean(vm_page_t m, int base, int size vm_page_bits_t oldvalid, pagebits; int endoff, frag; - /* Object lock for VPO_NOSYNC */ - VM_OBJECT_ASSERT_WLOCKED(m->object); vm_page_assert_busied(m); if (size == 0) /* handle degenerate case */ return; @@ -4732,7 +4729,7 @@ vm_page_set_validclean(vm_page_t m, int base, int size /* * Set valid, clear dirty bits. If validating the entire * page we can safely clear the pmap modify bit. We also - * use this opportunity to clear the VPO_NOSYNC flag. If a process + * use this opportunity to clear the PGA_NOSYNC flag. If a process * takes a write fault on a MAP_NOSYNC memory area the flag will * be set again. * @@ -4773,7 +4770,7 @@ vm_page_set_validclean(vm_page_t m, int base, int size */ pmap_clear_modify(m); m->dirty = 0; - m->oflags &= ~VPO_NOSYNC; + vm_page_aflag_clear(m, PGA_NOSYNC); } else if (oldvalid != VM_PAGE_BITS_ALL && vm_page_xbusied(m)) m->dirty &= ~pagebits; else Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Tue Oct 15 03:45:41 2019 (r353539) +++ head/sys/vm/vm_page.h Tue Oct 15 03:48:22 2019 (r353540) @@ -287,7 +287,6 @@ struct vm_page { #define VPO_SWAPSLEEP 0x02 /* waiting for swap to finish */ #define VPO_UNMANAGED 0x04 /* no PV management for page */ #define VPO_SWAPINPROG 0x08 /* swap I/O in progress on page */ -#define VPO_NOSYNC 0x10 /* do not collect for syncer */ /* * Busy page implementation details. @@ -390,6 +389,8 @@ extern struct mtx_padalign pa_lock[]; * PGA_EXECUTABLE may be set by pmap routines, and indicates that a page has * at least one executable mapping. It is not consumed by the MI VM layer. * + * PGA_NOSYNC must be set and cleared with the page busy lock held. + * * PGA_ENQUEUED is set and cleared when a page is inserted into or removed * from a page queue, respectively. It determines whether the plinks.q field * of the page is valid. To set or clear this flag, the queue lock for the @@ -420,6 +421,7 @@ extern struct mtx_padalign pa_lock[]; #define PGA_DEQUEUE 0x10 /* page is due to be dequeued */ #define PGA_REQUEUE 0x20 /* page is due to be requeued */ #define PGA_REQUEUE_HEAD 0x40 /* page requeue should bypass LRU */ +#define PGA_NOSYNC 0x80 /* do not collect for syncer */ #define PGA_QUEUE_STATE_MASK (PGA_ENQUEUED | PGA_DEQUEUE | PGA_REQUEUE | \ PGA_REQUEUE_HEAD) From owner-svn-src-all@freebsd.org Tue Oct 15 03:51:49 2019 Return-Path: Delivered-To: svn-src-all@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 0A17C152A0C; Tue, 15 Oct 2019 03:51:49 +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 46shLs09C6z4drV; Tue, 15 Oct 2019 03:51:49 +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 DDA3518D56; Tue, 15 Oct 2019 03:51:48 +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 x9F3pmGw034580; Tue, 15 Oct 2019 03:51:48 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9F3pkXj034568; Tue, 15 Oct 2019 03:51:46 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201910150351.x9F3pkXj034568@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 15 Oct 2019 03:51:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353541 - in head/sys: amd64/amd64 arm/arm arm64/arm64 i386/i386 mips/mips powerpc/aim powerpc/booke riscv/riscv sparc64/sparc64 X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: amd64/amd64 arm/arm arm64/arm64 i386/i386 mips/mips powerpc/aim powerpc/booke riscv/riscv sparc64/sparc64 X-SVN-Commit-Revision: 353541 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 03:51:49 -0000 Author: jeff Date: Tue Oct 15 03:51:46 2019 New Revision: 353541 URL: https://svnweb.freebsd.org/changeset/base/353541 Log: (6/6) Convert pmap to expect busy in write related operations now that all callers hold it. This simplifies pmap code and removes a dependency on the object lock. Reviewed by: kib, markj Tested by: pho Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D21596 Modified: head/sys/amd64/amd64/pmap.c head/sys/arm/arm/pmap-v4.c head/sys/arm/arm/pmap-v6.c head/sys/arm64/arm64/pmap.c head/sys/i386/i386/pmap.c head/sys/mips/mips/pmap.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/booke/pmap.c head/sys/riscv/riscv/pmap.c head/sys/sparc64/sparc64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Oct 15 03:48:22 2019 (r353540) +++ head/sys/amd64/amd64/pmap.c Tue Oct 15 03:51:46 2019 (r353541) @@ -7285,12 +7285,9 @@ pmap_is_modified(vm_page_t m) ("pmap_is_modified: page %p is not managed", m)); /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * concurrently set while the object is locked. Thus, if PGA_WRITEABLE - * is clear, no PTEs can have PG_M set. + * If the page is not busied then this check is racy. */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return (FALSE); return (pmap_page_test_mappings(m, FALSE, TRUE)); } @@ -7353,14 +7350,10 @@ pmap_remove_write(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_write: page %p is not managed", m)); - /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * set by another thread while the object is locked. Thus, - * if PGA_WRITEABLE is clear, no page table entries need updating. - */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + vm_page_assert_busied(m); + if (!pmap_page_is_write_mapped(m)) return; + lock = VM_PAGE_TO_PV_LIST_LOCK(m); pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : pa_to_pvh(VM_PAGE_TO_PHYS(m)); @@ -7833,16 +7826,9 @@ pmap_clear_modify(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); - VM_OBJECT_ASSERT_WLOCKED(m->object); - KASSERT(!vm_page_xbusied(m), - ("pmap_clear_modify: page %p is exclusive busied", m)); + vm_page_assert_busied(m); - /* - * If the page is not PGA_WRITEABLE, then no PTEs can have PG_M set. - * If the object containing the page is locked and the page is not - * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. - */ - if ((m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return; pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : pa_to_pvh(VM_PAGE_TO_PHYS(m)); Modified: head/sys/arm/arm/pmap-v4.c ============================================================================== --- head/sys/arm/arm/pmap-v4.c Tue Oct 15 03:48:22 2019 (r353540) +++ head/sys/arm/arm/pmap-v4.c Tue Oct 15 03:51:46 2019 (r353541) @@ -4095,16 +4095,9 @@ pmap_clear_modify(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); - VM_OBJECT_ASSERT_WLOCKED(m->object); - KASSERT(!vm_page_xbusied(m), - ("pmap_clear_modify: page %p is exclusive busied", m)); + vm_page_assert_busied(m); - /* - * If the page is not PGA_WRITEABLE, then no mappings can be modified. - * If the object containing the page is locked and the page is not - * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. - */ - if ((m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return; if (m->md.pvh_attrs & PVF_MOD) pmap_clearbit(m, PVF_MOD); @@ -4136,14 +4129,9 @@ pmap_remove_write(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_write: page %p is not managed", m)); + vm_page_assert_busied(m); - /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * set by another thread while the object is locked. Thus, - * if PGA_WRITEABLE is clear, no page table entries need updating. - */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (vm_page_xbusied(m) || (m->aflags & PGA_WRITEABLE) != 0) + if (pmap_page_is_write_mapped(m)) pmap_clearbit(m, PVF_WRITE); } Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Tue Oct 15 03:48:22 2019 (r353540) +++ head/sys/arm/arm/pmap-v6.c Tue Oct 15 03:51:46 2019 (r353541) @@ -5192,12 +5192,9 @@ pmap_is_modified(vm_page_t m) ("%s: page %p is not managed", __func__, m)); /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * concurrently set while the object is locked. Thus, if PGA_WRITEABLE - * is clear, no PTE2s can have PG_M set. + * If the page is not busied then this check is racy. */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return (FALSE); rw_wlock(&pvh_global_lock); rv = pmap_is_modified_pvh(&m->md) || @@ -5533,14 +5530,9 @@ pmap_remove_write(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("%s: page %p is not managed", __func__, m)); + vm_page_assert_busied(m); - /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * set by another thread while the object is locked. Thus, - * if PGA_WRITEABLE is clear, no page table entries need updating. - */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return; rw_wlock(&pvh_global_lock); sched_pin(); @@ -5691,17 +5683,9 @@ pmap_clear_modify(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("%s: page %p is not managed", __func__, m)); - VM_OBJECT_ASSERT_WLOCKED(m->object); - KASSERT(!vm_page_xbusied(m), - ("%s: page %p is exclusive busy", __func__, m)); + vm_page_assert_busied(m); - /* - * If the page is not PGA_WRITEABLE, then no PTE2s can have PTE2_NM - * cleared. If the object containing the page is locked and the page - * is not exclusive busied, then PGA_WRITEABLE cannot be concurrently - * set. - */ - if ((m->flags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return; rw_wlock(&pvh_global_lock); sched_pin(); Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Tue Oct 15 03:48:22 2019 (r353540) +++ head/sys/arm64/arm64/pmap.c Tue Oct 15 03:51:46 2019 (r353541) @@ -4548,12 +4548,9 @@ pmap_is_modified(vm_page_t m) ("pmap_is_modified: page %p is not managed", m)); /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * concurrently set while the object is locked. Thus, if PGA_WRITEABLE - * is clear, no PTEs can have PG_M set. + * If the page is not busied then this check is racy. */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return (FALSE); return (pmap_page_test_mappings(m, FALSE, TRUE)); } @@ -4612,14 +4609,9 @@ pmap_remove_write(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_write: page %p is not managed", m)); + vm_page_assert_busied(m); - /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * set by another thread while the object is locked. Thus, - * if PGA_WRITEABLE is clear, no page table entries need updating. - */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return; lock = VM_PAGE_TO_PV_LIST_LOCK(m); pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : @@ -4987,16 +4979,9 @@ pmap_clear_modify(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); - VM_OBJECT_ASSERT_WLOCKED(m->object); - KASSERT(!vm_page_xbusied(m), - ("pmap_clear_modify: page %p is exclusive busied", m)); + vm_page_assert_busied(m); - /* - * If the page is not PGA_WRITEABLE, then no PTEs can have ATTR_SW_DBM - * set. If the object containing the page is locked and the page is not - * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. - */ - if ((m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return; pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : pa_to_pvh(VM_PAGE_TO_PHYS(m)); Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Tue Oct 15 03:48:22 2019 (r353540) +++ head/sys/i386/i386/pmap.c Tue Oct 15 03:51:46 2019 (r353541) @@ -4874,12 +4874,9 @@ __CONCAT(PMTYPE, is_modified)(vm_page_t m) ("pmap_is_modified: page %p is not managed", m)); /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * concurrently set while the object is locked. Thus, if PGA_WRITEABLE - * is clear, no PTEs can have PG_M set. + * If the page is not busied then this check is racy. */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return (FALSE); rw_wlock(&pvh_global_lock); rv = pmap_is_modified_pvh(&m->md) || @@ -5003,14 +5000,9 @@ __CONCAT(PMTYPE, remove_write)(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_write: page %p is not managed", m)); + vm_page_assert_busied(m); - /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * set by another thread while the object is locked. Thus, - * if PGA_WRITEABLE is clear, no page table entries need updating. - */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return; rw_wlock(&pvh_global_lock); sched_pin(); @@ -5313,16 +5305,9 @@ __CONCAT(PMTYPE, clear_modify)(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); - VM_OBJECT_ASSERT_WLOCKED(m->object); - KASSERT(!vm_page_xbusied(m), - ("pmap_clear_modify: page %p is exclusive busied", m)); + vm_page_assert_busied(m); - /* - * If the page is not PGA_WRITEABLE, then no PTEs can have PG_M set. - * If the object containing the page is locked and the page is not - * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. - */ - if ((m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return; rw_wlock(&pvh_global_lock); sched_pin(); Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Tue Oct 15 03:48:22 2019 (r353540) +++ head/sys/mips/mips/pmap.c Tue Oct 15 03:51:46 2019 (r353541) @@ -2893,14 +2893,9 @@ pmap_remove_write(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_write: page %p is not managed", m)); + vm_page_assert_busied(m); - /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * set by another thread while the object is locked. Thus, - * if PGA_WRITEABLE is clear, no page table entries need updating. - */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return; rw_wlock(&pvh_global_lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { @@ -2960,13 +2955,11 @@ pmap_is_modified(vm_page_t m) ("pmap_is_modified: page %p is not managed", m)); /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * concurrently set while the object is locked. Thus, if PGA_WRITEABLE - * is clear, no PTEs can have PTE_D set. + * If the page is not busied then this check is racy. */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return (FALSE); + rw_wlock(&pvh_global_lock); rv = pmap_testbit(m, PTE_D); rw_wunlock(&pvh_global_lock); @@ -3101,15 +3094,9 @@ pmap_clear_modify(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); VM_OBJECT_ASSERT_WLOCKED(m->object); - KASSERT(!vm_page_xbusied(m), - ("pmap_clear_modify: page %p is exclusive busied", m)); + vm_page_assert_busied(m); - /* - * If the page is not PGA_WRITEABLE, then no PTEs can have PTE_D set. - * If the object containing the page is locked and the page is not - * write busied, then PGA_WRITEABLE cannot be concurrently set. - */ - if ((m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return; rw_wlock(&pvh_global_lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Tue Oct 15 03:48:22 2019 (r353540) +++ head/sys/powerpc/aim/mmu_oea.c Tue Oct 15 03:51:46 2019 (r353541) @@ -1314,13 +1314,11 @@ moea_is_modified(mmu_t mmu, vm_page_t m) ("moea_is_modified: page %p is not managed", m)); /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * concurrently set while the object is locked. Thus, if PGA_WRITEABLE - * is clear, no PTEs can have PTE_CHG set. + * If the page is not busied then this check is racy. */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return (FALSE); + rw_wlock(&pvh_global_lock); rv = moea_query_bit(m, PTE_CHG); rw_wunlock(&pvh_global_lock); @@ -1346,16 +1344,9 @@ moea_clear_modify(mmu_t mmu, vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("moea_clear_modify: page %p is not managed", m)); - VM_OBJECT_ASSERT_WLOCKED(m->object); - KASSERT(!vm_page_xbusied(m), - ("moea_clear_modify: page %p is exclusive busy", m)); + vm_page_assert_busied(m); - /* - * If the page is not PGA_WRITEABLE, then no PTEs can have PTE_CHG - * set. If the object containing the page is locked and the page is - * not exclusive busied, then PGA_WRITEABLE cannot be concurrently set. - */ - if ((m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return; rw_wlock(&pvh_global_lock); moea_clear_bit(m, PTE_CHG); @@ -1375,14 +1366,9 @@ moea_remove_write(mmu_t mmu, vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("moea_remove_write: page %p is not managed", m)); + vm_page_assert_busied(m); - /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * set by another thread while the object is locked. Thus, - * if PGA_WRITEABLE is clear, no page table entries need updating. - */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return; rw_wlock(&pvh_global_lock); lo = moea_attr_fetch(m); Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Tue Oct 15 03:48:22 2019 (r353540) +++ head/sys/powerpc/aim/mmu_oea64.c Tue Oct 15 03:51:46 2019 (r353541) @@ -1694,13 +1694,11 @@ moea64_is_modified(mmu_t mmu, vm_page_t m) ("moea64_is_modified: page %p is not managed", m)); /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * concurrently set while the object is locked. Thus, if PGA_WRITEABLE - * is clear, no PTEs can have LPTE_CHG set. + * If the page is not busied then this check is racy. */ - VM_OBJECT_ASSERT_LOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return (FALSE); + return (moea64_query_bit(mmu, m, LPTE_CHG)); } @@ -1724,16 +1722,9 @@ moea64_clear_modify(mmu_t mmu, vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("moea64_clear_modify: page %p is not managed", m)); - VM_OBJECT_ASSERT_WLOCKED(m->object); - KASSERT(!vm_page_xbusied(m), - ("moea64_clear_modify: page %p is exclusive busied", m)); + vm_page_assert_busied(m); - /* - * If the page is not PGA_WRITEABLE, then no PTEs can have LPTE_CHG - * set. If the object containing the page is locked and the page is - * not exclusive busied, then PGA_WRITEABLE cannot be concurrently set. - */ - if ((m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return; moea64_clear_bit(mmu, m, LPTE_CHG); } @@ -1750,15 +1741,11 @@ moea64_remove_write(mmu_t mmu, vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("moea64_remove_write: page %p is not managed", m)); + vm_page_assert_busied(m); - /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * set by another thread while the object is locked. Thus, - * if PGA_WRITEABLE is clear, no page table entries need updating. - */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) - return; + if (!pmap_page_is_write_mapped(m)) + return + powerpc_sync(); PV_PAGE_LOCK(m); refchg = 0; Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Tue Oct 15 03:48:22 2019 (r353540) +++ head/sys/powerpc/booke/pmap.c Tue Oct 15 03:51:46 2019 (r353541) @@ -2687,15 +2687,10 @@ mmu_booke_remove_write(mmu_t mmu, vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("mmu_booke_remove_write: page %p is not managed", m)); + vm_page_assert_busied(m); - /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * set by another thread while the object is locked. Thus, - * if PGA_WRITEABLE is clear, no page table entries need updating. - */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) - return; + if (!pmap_page_is_write_mapped(m)) + return; rw_wlock(&pvh_global_lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_link) { PMAP_LOCK(pv->pv_pmap); @@ -3035,13 +3030,11 @@ mmu_booke_is_modified(mmu_t mmu, vm_page_t m) rv = FALSE; /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * concurrently set while the object is locked. Thus, if PGA_WRITEABLE - * is clear, no PTEs can be modified. + * If the page is not busied then this check is racy. */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) - return (rv); + if (!pmap_page_is_write_mapped(m)) + return (FALSE); + rw_wlock(&pvh_global_lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_link) { PMAP_LOCK(pv->pv_pmap); @@ -3110,17 +3103,11 @@ mmu_booke_clear_modify(mmu_t mmu, vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("mmu_booke_clear_modify: page %p is not managed", m)); - VM_OBJECT_ASSERT_WLOCKED(m->object); - KASSERT(!vm_page_xbusied(m), - ("mmu_booke_clear_modify: page %p is exclusive busied", m)); + vm_page_assert_busied(m); - /* - * If the page is not PG_AWRITEABLE, then no PTEs can be modified. - * If the object containing the page is locked and the page is not - * exclusive busied, then PG_AWRITEABLE cannot be concurrently set. - */ - if ((m->aflags & PGA_WRITEABLE) == 0) - return; + if (!pmap_page_is_write_mapped(m)) + return; + rw_wlock(&pvh_global_lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_link) { PMAP_LOCK(pv->pv_pmap); Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Tue Oct 15 03:48:22 2019 (r353540) +++ head/sys/riscv/riscv/pmap.c Tue Oct 15 03:51:46 2019 (r353541) @@ -3814,12 +3814,9 @@ pmap_is_modified(vm_page_t m) ("pmap_is_modified: page %p is not managed", m)); /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * concurrently set while the object is locked. Thus, if PGA_WRITEABLE - * is clear, no PTEs can have PG_M set. + * If the page is not busied then this check is racy. */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return (FALSE); return (pmap_page_test_mappings(m, FALSE, TRUE)); } @@ -3878,14 +3875,9 @@ pmap_remove_write(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_write: page %p is not managed", m)); + vm_page_assert_busied(m); - /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * set by another thread while the object is locked. Thus, - * if PGA_WRITEABLE is clear, no page table entries need updating. - */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return; lock = VM_PAGE_TO_PV_LIST_LOCK(m); pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : @@ -4136,9 +4128,10 @@ pmap_clear_modify(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); - VM_OBJECT_ASSERT_WLOCKED(m->object); - KASSERT(!vm_page_xbusied(m), - ("pmap_clear_modify: page %p is exclusive busied", m)); + vm_page_assert_busied(m); + + if (!pmap_page_is_write_mapped(m)) + return; /* * If the page is not PGA_WRITEABLE, then no PTEs can have PG_M set. Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Tue Oct 15 03:48:22 2019 (r353540) +++ head/sys/sparc64/sparc64/pmap.c Tue Oct 15 03:51:46 2019 (r353541) @@ -2116,12 +2116,9 @@ pmap_is_modified(vm_page_t m) rv = FALSE; /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * concurrently set while the object is locked. Thus, if PGA_WRITEABLE - * is clear, no TTEs can have TD_W set. + * If the page is not busied then this check is racy. */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return (rv); rw_wlock(&tte_list_global_lock); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) { @@ -2195,17 +2192,11 @@ pmap_clear_modify(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); - VM_OBJECT_ASSERT_WLOCKED(m->object); - KASSERT(!vm_page_xbusied(m), - ("pmap_clear_modify: page %p is exclusive busied", m)); + vm_page_assert_busied(m); - /* - * If the page is not PGA_WRITEABLE, then no TTEs can have TD_W set. - * If the object containing the page is locked and the page is not - * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. - */ - if ((m->aflags & PGA_WRITEABLE) == 0) + if (!pmap_page_is_write_mapped(m)) return; + rw_wlock(&tte_list_global_lock); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) { if ((tp->tte_data & TD_PV) == 0) @@ -2225,15 +2216,11 @@ pmap_remove_write(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_write: page %p is not managed", m)); + vm_page_assert_busied(m); - /* - * If the page is not exclusive busied, then PGA_WRITEABLE cannot be - * set by another thread while the object is locked. Thus, - * if PGA_WRITEABLE is clear, no page table entries need updating. - */ - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) - return; + if (!pmap_page_is_write_mapped(m)) + return; + rw_wlock(&tte_list_global_lock); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) { if ((tp->tte_data & TD_PV) == 0) From owner-svn-src-all@freebsd.org Tue Oct 15 04:50:09 2019 Return-Path: Delivered-To: svn-src-all@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 D0F30153A03; Tue, 15 Oct 2019 04:50:09 +0000 (UTC) (envelope-from kp@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 46sjf94xKrz3C79; Tue, 15 Oct 2019 04:50:09 +0000 (UTC) (envelope-from kp@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 8CAD11969A; Tue, 15 Oct 2019 04:50:09 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9F4o9LL063870; Tue, 15 Oct 2019 04:50:09 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9F4o982063867; Tue, 15 Oct 2019 04:50:09 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201910150450.x9F4o982063867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 15 Oct 2019 04:50:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353542 - head/tests/sys/net X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/net X-SVN-Commit-Revision: 353542 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 04:50:09 -0000 Author: kp Date: Tue Oct 15 04:50:08 2019 New Revision: 353542 URL: https://svnweb.freebsd.org/changeset/base/353542 Log: tests: basic VLAN test Set up two jails connected by an epair. Create VLAN interfaces in both jails and check connectivity. This is a very basic test, but exposed panics during the network stack epoch work, so this is worth testing. Added: head/tests/sys/net/if_vlan.sh (contents, props changed) Modified: head/tests/sys/net/Makefile Modified: head/tests/sys/net/Makefile ============================================================================== --- head/tests/sys/net/Makefile Tue Oct 15 03:51:46 2019 (r353541) +++ head/tests/sys/net/Makefile Tue Oct 15 04:50:08 2019 (r353542) @@ -8,6 +8,7 @@ BINDIR= ${TESTSDIR} ATF_TESTS_SH+= if_lagg_test ATF_TESTS_SH+= if_clone_test ATF_TESTS_SH+= if_tun_test +ATF_TESTS_SH+= if_vlan # The tests are written to be run in parallel, but doing so leads to random # panics. I think it's because the kernel's list of interfaces isn't properly Added: head/tests/sys/net/if_vlan.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/net/if_vlan.sh Tue Oct 15 04:50:08 2019 (r353542) @@ -0,0 +1,42 @@ +# $FreeBSD$ + +. $(atf_get_srcdir)/../common/vnet.subr + +atf_test_case "basic" "cleanup" +basic_head() +{ + atf_set descr 'Basic VLAN test' + atf_set require.user root +} + +basic_body() +{ + vnet_init + + epair_vlan=$(vnet_mkepair) + + vnet_mkjail alcatraz ${epair_vlan}a + vnet_mkjail singsing ${epair_vlan}b + + vlan0=$(jexec alcatraz ifconfig vlan create vlandev ${epair_vlan}a \ + vlan 42) + jexec alcatraz ifconfig ${epair_vlan}a up + jexec alcatraz ifconfig ${vlan0} 10.0.0.1/24 up + + vlan1=$(jexec singsing ifconfig vlan create vlandev ${epair_vlan}b \ + vlan 42) + jexec singsing ifconfig ${epair_vlan}b up + jexec singsing ifconfig ${vlan1} 10.0.0.2/24 up + + atf_check -s exit:0 -o ignore jexec singsing ping -c 1 10.0.0.1 +} + +basic_cleanup() +{ + vnet_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "basic" +} From owner-svn-src-all@freebsd.org Tue Oct 15 06:19:34 2019 Return-Path: Delivered-To: svn-src-all@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 97C9D1549CC; Tue, 15 Oct 2019 06:19:34 +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 46sldL4Bs2z3Fr8; Tue, 15 Oct 2019 06:19:34 +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 746061A646; Tue, 15 Oct 2019 06:19:34 +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 x9F6JYwG016025; Tue, 15 Oct 2019 06:19:34 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9F6JXLi016019; Tue, 15 Oct 2019 06:19:33 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201910150619.x9F6JXLi016019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 15 Oct 2019 06:19:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r353543 - in releng/12.1/stand: efi/boot1 efi/include efi/libefi efi/loader efi/loader/arch/i386 libsa X-SVN-Group: releng X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in releng/12.1/stand: efi/boot1 efi/include efi/libefi efi/loader efi/loader/arch/i386 libsa X-SVN-Commit-Revision: 353543 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 06:19:34 -0000 Author: tsoome Date: Tue Oct 15 06:19:33 2019 New Revision: 353543 URL: https://svnweb.freebsd.org/changeset/base/353543 Log: loader.efi: efipart needs to use ioalign UEFI specification 2.7A, EFI_BLOCK_IO_PROTOCOL, page 566. The ioalign property does define the alignment of data buffer. If the alignment is required and our buffer is not aligned, or if the data buffer is not multiple of Blocksize, we need to use bounce buffer to perform the block IO. This is much like with BIOS version, except there the INT13 needs buffer to be located in low memory. MFS: r353501 MFC: r347195,350654-350656,351274,351630,351637,352421,352439,352443-352446,352451 Approved by: re (gjb) Modified: releng/12.1/stand/efi/boot1/boot1.c releng/12.1/stand/efi/include/efilib.h releng/12.1/stand/efi/libefi/devpath.c releng/12.1/stand/efi/libefi/efinet.c releng/12.1/stand/efi/libefi/efipart.c releng/12.1/stand/efi/libefi/libefi.c releng/12.1/stand/efi/loader/arch/i386/efimd.c releng/12.1/stand/efi/loader/efi_main.c releng/12.1/stand/efi/loader/framebuffer.c releng/12.1/stand/efi/loader/main.c releng/12.1/stand/libsa/stand.h releng/12.1/stand/libsa/zalloc.c releng/12.1/stand/libsa/zalloc_defs.h releng/12.1/stand/libsa/zalloc_malloc.c releng/12.1/stand/libsa/zalloc_mem.h releng/12.1/stand/libsa/zalloc_protos.h Directory Properties: releng/12.1/ (props changed) Modified: releng/12.1/stand/efi/boot1/boot1.c ============================================================================== --- releng/12.1/stand/efi/boot1/boot1.c Tue Oct 15 04:50:08 2019 (r353542) +++ releng/12.1/stand/efi/boot1/boot1.c Tue Oct 15 06:19:33 2019 (r353543) @@ -246,8 +246,9 @@ try_boot(void) 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; @@ -306,7 +307,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B UINTN i; /* 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 (status); @@ -322,7 +323,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B efi_free_devpath_name(text); } #endif - status = BS->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); + status = OpenProtocolByHandle(h, &BlockIoProtocolGUID, (void **)&blkio); if (status == EFI_UNSUPPORTED) return (status); @@ -445,7 +446,7 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) putchar('\n'); /* 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); @@ -455,8 +456,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)); Modified: releng/12.1/stand/efi/include/efilib.h ============================================================================== --- releng/12.1/stand/efi/include/efilib.h Tue Oct 15 04:50:08 2019 (r353542) +++ releng/12.1/stand/efi/include/efilib.h Tue Oct 15 06:19:33 2019 (r353543) @@ -69,6 +69,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); @@ -92,6 +93,7 @@ CHAR16 *efi_devpath_name(EFI_DEVICE_PATH *); void efi_free_devpath_name(CHAR16 *); EFI_DEVICE_PATH *efi_devpath_to_media_path(EFI_DEVICE_PATH *); UINTN efi_devpath_length(EFI_DEVICE_PATH *); +EFI_HANDLE efi_devpath_to_handle(EFI_DEVICE_PATH *path, EFI_HANDLE *handles, unsigned nhandles); int efi_status_to_errno(EFI_STATUS); EFI_STATUS errno_to_efi_status(int errno); Modified: releng/12.1/stand/efi/libefi/devpath.c ============================================================================== --- releng/12.1/stand/efi/libefi/devpath.c Tue Oct 15 04:50:08 2019 (r353542) +++ releng/12.1/stand/efi/libefi/devpath.c Tue Oct 15 06:19:33 2019 (r353543) @@ -42,8 +42,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); @@ -55,7 +55,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); @@ -228,4 +229,26 @@ efi_devpath_length(EFI_DEVICE_PATH *path) while (!IsDevicePathEnd(path)) path = NextDevicePathNode(path); return ((UINTN)path - (UINTN)start) + DevicePathNodeLength(path); +} + +EFI_HANDLE +efi_devpath_to_handle(EFI_DEVICE_PATH *path, EFI_HANDLE *handles, unsigned nhandles) +{ + unsigned i; + EFI_DEVICE_PATH *media, *devpath; + EFI_HANDLE h; + + media = efi_devpath_to_media_path(path); + if (media == NULL) + return (NULL); + for (i = 0; i < nhandles; i++) { + h = handles[i]; + devpath = efi_lookup_devpath(h); + if (devpath == NULL) + continue; + if (!efi_devpath_match_node(media, efi_devpath_to_media_path(devpath))) + continue; + return (h); + } + return (NULL); } Modified: releng/12.1/stand/efi/libefi/efinet.c ============================================================================== --- releng/12.1/stand/efi/libefi/efinet.c Tue Oct 15 04:50:08 2019 (r353542) +++ releng/12.1/stand/efi/libefi/efinet.c Tue Oct 15 06:19:33 2019 (r353543) @@ -195,7 +195,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: releng/12.1/stand/efi/libefi/efipart.c ============================================================================== --- releng/12.1/stand/efi/libefi/efipart.c Tue Oct 15 04:50:08 2019 (r353542) +++ releng/12.1/stand/efi/libefi/efipart.c Tue Oct 15 06:19:33 2019 (r353543) @@ -64,6 +64,9 @@ static int efipart_printhd(int); #define PNP0700 0x700 #define PNP0701 0x701 +/* Bounce buffer max size */ +#define BIO_BUFFER_SIZE 0x4000 + struct devsw efipart_fddev = { .dv_name = "fd", .dv_type = DEVT_FD, @@ -100,12 +103,18 @@ struct devsw efipart_hddev = { .dv_cleanup = NULL }; -static pdinfo_list_t fdinfo; -static pdinfo_list_t cdinfo; -static pdinfo_list_t hdinfo; +static pdinfo_list_t fdinfo = STAILQ_HEAD_INITIALIZER(fdinfo); +static pdinfo_list_t cdinfo = STAILQ_HEAD_INITIALIZER(cdinfo); +static pdinfo_list_t hdinfo = STAILQ_HEAD_INITIALIZER(hdinfo); -static EFI_HANDLE *efipart_handles = NULL; -static UINTN efipart_nhandles = 0; +/* + * efipart_inithandles() is used to build up the pdinfo list from + * block device handles. Then each devsw init callback is used to + * pick items from pdinfo and move to proper device list. + * In ideal world, we should end up with empty pdinfo once all + * devsw initializers are called. + */ +static pdinfo_list_t pdinfo = STAILQ_HEAD_INITIALIZER(pdinfo); pdinfo_list_t * efiblk_get_pdinfo_list(struct devsw *dev) @@ -140,23 +149,14 @@ efiblk_get_pdinfo(struct devdesc *dev) pdinfo_t * efiblk_get_pdinfo_by_device_path(EFI_DEVICE_PATH *path) { - unsigned i; - EFI_DEVICE_PATH *media, *devpath; EFI_HANDLE h; + EFI_STATUS status; + EFI_DEVICE_PATH *devp = path; - media = efi_devpath_to_media_path(path); - if (media == NULL) + status = BS->LocateDevicePath(&blkio_guid, &devp, &h); + if (EFI_ERROR(status)) return (NULL); - for (i = 0; i < efipart_nhandles; i++) { - h = efipart_handles[i]; - devpath = efi_lookup_devpath(h); - if (devpath == NULL) - continue; - if (!efi_devpath_match_node(media, efi_devpath_to_media_path(devpath))) - continue; - return (efiblk_get_pdinfo_by_handle(h)); - } - return (NULL); + return (efiblk_get_pdinfo_by_handle(h)); } static bool @@ -185,6 +185,10 @@ efiblk_get_pdinfo_by_handle(EFI_HANDLE h) STAILQ_FOREACH(dp, &cdinfo, pd_link) { if (same_handle(dp, h)) return (dp); + STAILQ_FOREACH(pp, &dp->pd_part, pd_link) { + if (same_handle(pp, h)) + return (pp); + } } STAILQ_FOREACH(dp, &fdinfo, pd_link) { if (same_handle(dp, h)) @@ -208,15 +212,16 @@ efiblk_pdinfo_count(pdinfo_list_t *pdi) int efipart_inithandles(void) { + unsigned i, nin; UINTN sz; EFI_HANDLE *hin; + EFI_DEVICE_PATH *devpath; + EFI_BLOCK_IO *blkio; EFI_STATUS status; + pdinfo_t *pd; - if (efipart_nhandles != 0) { - free(efipart_handles); - efipart_handles = NULL; - efipart_nhandles = 0; - } + if (!STAILQ_EMPTY(&pdinfo)) + return (0); sz = 0; hin = NULL; @@ -231,12 +236,60 @@ efipart_inithandles(void) if (EFI_ERROR(status)) return (efi_status_to_errno(status)); - efipart_handles = hin; - efipart_nhandles = sz / sizeof(*hin); + nin = sz / sizeof(*hin); #ifdef EFIPART_DEBUG - printf("%s: Got %d BLOCK IO MEDIA handle(s)\n", __func__, - efipart_nhandles); + printf("%s: Got %d BLOCK IO MEDIA handle(s)\n", __func__, nin); #endif + + for (i = 0; i < nin; i++) { + /* + * Get devpath and open protocol. + * We should not get errors here + */ + if ((devpath = efi_lookup_devpath(hin[i])) == NULL) + continue; + + status = OpenProtocolByHandle(hin[i], &blkio_guid, + (void **)&blkio); + if (EFI_ERROR(status)) { + printf("error %lu\n", EFI_ERROR_CODE(status)); + continue; + } + + /* + * We assume the block size 512 or greater power of 2. + * Also skip devices with block size > 64k (16 is max + * ashift supported by zfs). + * iPXE is known to insert stub BLOCK IO device with + * BlockSize 1. + */ + if (blkio->Media->BlockSize < 512 || + blkio->Media->BlockSize > (1 << 16) || + !powerof2(blkio->Media->BlockSize)) { + continue; + } + + /* Allowed values are 0, 1 and power of 2. */ + if (blkio->Media->IoAlign > 1 && + !powerof2(blkio->Media->IoAlign)) { + continue; + } + + /* This is bad. */ + if ((pd = calloc(1, sizeof(*pd))) == NULL) { + printf("efipart_inithandles: Out of memory.\n"); + free(hin); + return (ENOMEM); + } + STAILQ_INIT(&pd->pd_part); + + pd->pd_handle = hin[i]; + pd->pd_devpath = devpath; + pd->pd_blkio = blkio; + STAILQ_INSERT_TAIL(&pdinfo, pd, pd_link); + } + + free(hin); return (0); } @@ -257,134 +310,49 @@ efipart_floppy(EFI_DEVICE_PATH *node) return (NULL); } -/* - * Determine if the provided device path is hdd. - * - * There really is no simple fool proof way to classify the devices. - * Since we do build three lists of devices - floppy, cd and hdd, we - * will try to see if the device is floppy or cd, and list anything else - * as hdd. - */ -static bool -efipart_hdd(EFI_DEVICE_PATH *dp) +static pdinfo_t * +efipart_find_parent(pdinfo_list_t *pdi, EFI_DEVICE_PATH *devpath) { - unsigned i; - EFI_DEVICE_PATH *devpath, *node; - EFI_BLOCK_IO *blkio; - EFI_STATUS status; + pdinfo_t *pd; - if (dp == NULL) - return (false); - - if ((node = efi_devpath_last_node(dp)) == NULL) - return (false); - - if (efipart_floppy(node) != NULL) - return (false); - - /* - * Test every EFI BLOCK IO handle to make sure dp is not device path - * for CD/DVD. - */ - for (i = 0; i < efipart_nhandles; i++) { - devpath = efi_lookup_devpath(efipart_handles[i]); - if (devpath == NULL) - return (false); - - /* Only continue testing when dp is prefix in devpath. */ - if (!efi_devpath_is_prefix(dp, devpath)) - continue; - - /* - * The device path has to have last node describing the - * device, or we can not test the type. - */ - if ((node = efi_devpath_last_node(devpath)) == NULL) - return (false); - - if (DevicePathType(node) == MEDIA_DEVICE_PATH && - DevicePathSubType(node) == MEDIA_CDROM_DP) { - return (false); - } - - /* Make sure we do have the media. */ - status = BS->HandleProtocol(efipart_handles[i], - &blkio_guid, (void **)&blkio); - if (EFI_ERROR(status)) - return (false); - - /* USB or SATA cd without the media. */ - if (blkio->Media->RemovableMedia && - !blkio->Media->MediaPresent) { - return (false); - } - - /* - * We assume the block size 512 or greater power of 2. - * iPXE is known to insert stub BLOCK IO device with - * BlockSize 1. - */ - if (blkio->Media->BlockSize < 512 || - !powerof2(blkio->Media->BlockSize)) { - return (false); - } + STAILQ_FOREACH(pd, pdi, pd_link) { + if (efi_devpath_is_prefix(pd->pd_devpath, devpath)) + return (pd); } - return (true); + return (NULL); } -/* - * Add or update entries with new handle data. - */ static int -efipart_fdinfo_add(EFI_HANDLE handle, uint32_t uid, EFI_DEVICE_PATH *devpath) +efipart_initfd(void) { - pdinfo_t *fd; - - fd = calloc(1, sizeof(pdinfo_t)); - if (fd == NULL) { - printf("Failed to register floppy %d, out of memory\n", uid); - return (ENOMEM); - } - STAILQ_INIT(&fd->pd_part); - - fd->pd_unit = uid; - fd->pd_handle = handle; - fd->pd_devpath = devpath; - fd->pd_parent = NULL; - fd->pd_devsw = &efipart_fddev; - STAILQ_INSERT_TAIL(&fdinfo, fd, pd_link); - return (0); -} - -static void -efipart_updatefd(void) -{ - EFI_DEVICE_PATH *devpath, *node; + EFI_DEVICE_PATH *node; ACPI_HID_DEVICE_PATH *acpi; - int i; + pdinfo_t *parent, *fd; - for (i = 0; i < efipart_nhandles; i++) { - devpath = efi_lookup_devpath(efipart_handles[i]); - if (devpath == NULL) +restart: + STAILQ_FOREACH(fd, &pdinfo, pd_link) { + if ((node = efi_devpath_last_node(fd->pd_devpath)) == NULL) continue; - if ((node = efi_devpath_last_node(devpath)) == NULL) + if ((acpi = efipart_floppy(node)) == NULL) continue; - if ((acpi = efipart_floppy(node)) != NULL) { - efipart_fdinfo_add(efipart_handles[i], acpi->UID, - devpath); + + STAILQ_REMOVE(&pdinfo, fd, pdinfo, pd_link); + parent = efipart_find_parent(&pdinfo, fd->pd_devpath); + if (parent != NULL) { + STAILQ_REMOVE(&pdinfo, parent, pdinfo, pd_link); + parent->pd_alias = fd->pd_handle; + parent->pd_unit = acpi->UID; + free(fd); + fd = parent; + } else { + fd->pd_unit = acpi->UID; } + fd->pd_devsw = &efipart_fddev; + STAILQ_INSERT_TAIL(&fdinfo, fd, pd_link); + goto restart; } -} -static int -efipart_initfd(void) -{ - - STAILQ_INIT(&fdinfo); - - efipart_updatefd(); - bcache_add_dev(efiblk_pdinfo_count(&fdinfo)); return (0); } @@ -392,68 +360,90 @@ efipart_initfd(void) /* * Add or update entries with new handle data. */ -static int -efipart_cdinfo_add(EFI_HANDLE handle, EFI_HANDLE alias, - EFI_DEVICE_PATH *devpath) +static void +efipart_cdinfo_add(pdinfo_t *cd) { - int unit; - pdinfo_t *cd; - pdinfo_t *pd; + pdinfo_t *pd, *last; - unit = 0; STAILQ_FOREACH(pd, &cdinfo, pd_link) { - if (efi_devpath_match(pd->pd_devpath, devpath) == true) { - pd->pd_handle = handle; - pd->pd_alias = alias; - return (0); + if (efi_devpath_is_prefix(pd->pd_devpath, cd->pd_devpath)) { + last = STAILQ_LAST(&pd->pd_part, pdinfo, pd_link); + if (last != NULL) + cd->pd_unit = last->pd_unit + 1; + else + cd->pd_unit = 0; + cd->pd_parent = pd; + cd->pd_devsw = &efipart_cddev; + STAILQ_INSERT_TAIL(&pd->pd_part, cd, pd_link); + return; } - unit++; } - cd = calloc(1, sizeof(pdinfo_t)); - if (cd == NULL) { - printf("Failed to add cd %d, out of memory\n", unit); - return (ENOMEM); - } - STAILQ_INIT(&cd->pd_part); + last = STAILQ_LAST(&cdinfo, pdinfo, pd_link); + if (last != NULL) + cd->pd_unit = last->pd_unit + 1; + else + cd->pd_unit = 0; - cd->pd_handle = handle; - cd->pd_unit = unit; - cd->pd_alias = alias; - cd->pd_devpath = devpath; cd->pd_parent = NULL; cd->pd_devsw = &efipart_cddev; STAILQ_INSERT_TAIL(&cdinfo, cd, pd_link); - return (0); } +static bool +efipart_testcd(EFI_DEVICE_PATH *node, EFI_BLOCK_IO *blkio) +{ + if (DevicePathType(node) == MEDIA_DEVICE_PATH && + DevicePathSubType(node) == MEDIA_CDROM_DP) { + return (true); + } + + /* cd drive without the media. */ + if (blkio->Media->RemovableMedia && + !blkio->Media->MediaPresent) { + return (true); + } + + return (false); +} + static void efipart_updatecd(void) { - int i; - EFI_DEVICE_PATH *devpath, *devpathcpy, *tmpdevpath, *node; - EFI_HANDLE handle; - EFI_BLOCK_IO *blkio; + EFI_DEVICE_PATH *devpath, *node; EFI_STATUS status; + pdinfo_t *parent, *cd; - for (i = 0; i < efipart_nhandles; i++) { - devpath = efi_lookup_devpath(efipart_handles[i]); - if (devpath == NULL) +restart: + STAILQ_FOREACH(cd, &pdinfo, pd_link) { + if ((node = efi_devpath_last_node(cd->pd_devpath)) == NULL) continue; - if ((node = efi_devpath_last_node(devpath)) == NULL) - continue; - if (efipart_floppy(node) != NULL) continue; - if (efipart_hdd(devpath)) - continue; + /* Is parent of this device already registered? */ + parent = efipart_find_parent(&cdinfo, cd->pd_devpath); + if (parent != NULL) { + STAILQ_REMOVE(&pdinfo, cd, pdinfo, pd_link); + efipart_cdinfo_add(cd); + goto restart; + } - status = BS->HandleProtocol(efipart_handles[i], - &blkio_guid, (void **)&blkio); - if (EFI_ERROR(status)) + if (!efipart_testcd(node, cd->pd_blkio)) continue; + + /* Find parent and unlink both parent and cd from pdinfo */ + STAILQ_REMOVE(&pdinfo, cd, pdinfo, pd_link); + parent = efipart_find_parent(&pdinfo, cd->pd_devpath); + if (parent != NULL) { + STAILQ_REMOVE(&pdinfo, parent, pdinfo, pd_link); + efipart_cdinfo_add(parent); + } + + if (parent == NULL) + parent = efipart_find_parent(&cdinfo, cd->pd_devpath); + /* * If we come across a logical partition of subtype CDROM * it doesn't refer to the CD filesystem itself, but rather @@ -462,132 +452,79 @@ efipart_updatecd(void) * that will be the CD filesystem. */ if (DevicePathType(node) == MEDIA_DEVICE_PATH && - DevicePathSubType(node) == MEDIA_CDROM_DP) { - devpathcpy = efi_devpath_trim(devpath); - if (devpathcpy == NULL) - continue; - tmpdevpath = devpathcpy; - status = BS->LocateDevicePath(&blkio_guid, &tmpdevpath, - &handle); - free(devpathcpy); - if (EFI_ERROR(status)) - continue; - devpath = efi_lookup_devpath(handle); - efipart_cdinfo_add(handle, efipart_handles[i], - devpath); - continue; - } + DevicePathSubType(node) == MEDIA_CDROM_DP && + parent == NULL) { + parent = calloc(1, sizeof(*parent)); + if (parent == NULL) { + printf("efipart_updatecd: out of memory\n"); + /* this device is lost but try again. */ + free(cd); + goto restart; + } - if (DevicePathType(node) == MESSAGING_DEVICE_PATH && - DevicePathSubType(node) == MSG_ATAPI_DP) { - efipart_cdinfo_add(efipart_handles[i], NULL, - devpath); - continue; + devpath = efi_devpath_trim(cd->pd_devpath); + if (devpath == NULL) { + printf("efipart_updatecd: out of memory\n"); + /* this device is lost but try again. */ + free(parent); + free(cd); + goto restart; + } + parent->pd_devpath = devpath; + status = BS->LocateDevicePath(&blkio_guid, + &parent->pd_devpath, &parent->pd_handle); + free(devpath); + if (EFI_ERROR(status)) { + printf("efipart_updatecd: error %lu\n", + EFI_ERROR_CODE(status)); + free(parent); + free(cd); + goto restart; + } + parent->pd_devpath = + efi_lookup_devpath(parent->pd_handle); + efipart_cdinfo_add(parent); } - /* USB or SATA cd without the media. */ - if (blkio->Media->RemovableMedia && - !blkio->Media->MediaPresent) { - efipart_cdinfo_add(efipart_handles[i], NULL, - devpath); - } + efipart_cdinfo_add(cd); + goto restart; } } static int efipart_initcd(void) { - - STAILQ_INIT(&cdinfo); - efipart_updatecd(); bcache_add_dev(efiblk_pdinfo_count(&cdinfo)); return (0); } -static int -efipart_hdinfo_add(EFI_HANDLE disk_handle, EFI_HANDLE part_handle) +static void +efipart_hdinfo_add(pdinfo_t *hd, HARDDRIVE_DEVICE_PATH *node) { - EFI_DEVICE_PATH *disk_devpath, *part_devpath; - HARDDRIVE_DEVICE_PATH *node; - int unit; - pdinfo_t *hd, *pd, *last; + pdinfo_t *pd, *last; - disk_devpath = efi_lookup_devpath(disk_handle); - if (disk_devpath == NULL) - return (ENOENT); - - if (part_handle != NULL) { - part_devpath = efi_lookup_devpath(part_handle); - if (part_devpath == NULL) - return (ENOENT); - node = (HARDDRIVE_DEVICE_PATH *) - efi_devpath_last_node(part_devpath); - if (node == NULL) - return (ENOENT); /* This should not happen. */ - } else { - part_devpath = NULL; - node = NULL; - } - - pd = calloc(1, sizeof(pdinfo_t)); - if (pd == NULL) { - printf("Failed to add disk, out of memory\n"); - return (ENOMEM); - } - STAILQ_INIT(&pd->pd_part); - - STAILQ_FOREACH(hd, &hdinfo, pd_link) { - if (efi_devpath_match(hd->pd_devpath, disk_devpath) == true) { - if (part_devpath == NULL) - return (0); - + STAILQ_FOREACH(pd, &hdinfo, pd_link) { + if (efi_devpath_is_prefix(pd->pd_devpath, hd->pd_devpath)) { /* Add the partition. */ - pd->pd_handle = part_handle; - pd->pd_unit = node->PartitionNumber; - pd->pd_devpath = part_devpath; - pd->pd_parent = hd; - pd->pd_devsw = &efipart_hddev; - STAILQ_INSERT_TAIL(&hd->pd_part, pd, pd_link); - return (0); + hd->pd_unit = node->PartitionNumber; + hd->pd_parent = pd; + hd->pd_devsw = &efipart_hddev; + STAILQ_INSERT_TAIL(&pd->pd_part, hd, pd_link); + return; } } last = STAILQ_LAST(&hdinfo, pdinfo, pd_link); if (last != NULL) - unit = last->pd_unit + 1; + hd->pd_unit = last->pd_unit + 1; else - unit = 0; + hd->pd_unit = 0; /* Add the disk. */ - hd = pd; - hd->pd_handle = disk_handle; - hd->pd_unit = unit; - hd->pd_devpath = disk_devpath; - hd->pd_parent = NULL; hd->pd_devsw = &efipart_hddev; STAILQ_INSERT_TAIL(&hdinfo, hd, pd_link); - - if (part_devpath == NULL) - return (0); - - pd = calloc(1, sizeof(pdinfo_t)); - if (pd == NULL) { - printf("Failed to add partition, out of memory\n"); - return (ENOMEM); - } - STAILQ_INIT(&pd->pd_part); - - /* Add the partition. */ - pd->pd_handle = part_handle; - pd->pd_unit = node->PartitionNumber; - pd->pd_devpath = part_devpath; - pd->pd_parent = hd; - pd->pd_devsw = &efipart_hddev; - STAILQ_INSERT_TAIL(&hd->pd_part, pd, pd_link); - - return (0); } /* @@ -596,40 +533,25 @@ efipart_hdinfo_add(EFI_HANDLE disk_handle, EFI_HANDLE * of typeN:M, where type is interface type, N is disk id * and M is partition id. */ -static int -efipart_hdinfo_add_filepath(EFI_HANDLE disk_handle) +static void +efipart_hdinfo_add_filepath(pdinfo_t *hd, FILEPATH_DEVICE_PATH *node) { - EFI_DEVICE_PATH *devpath; - FILEPATH_DEVICE_PATH *node; char *pathname, *p; - int unit, len; - pdinfo_t *pd, *last; + int len; + pdinfo_t *last; - /* First collect and verify all the data */ - if ((devpath = efi_lookup_devpath(disk_handle)) == NULL) - return (ENOENT); - node = (FILEPATH_DEVICE_PATH *)efi_devpath_last_node(devpath); - if (node == NULL) - return (ENOENT); /* This should not happen. */ - - pd = calloc(1, sizeof(pdinfo_t)); - if (pd == NULL) { - printf("Failed to add disk, out of memory\n"); - return (ENOMEM); - } - STAILQ_INIT(&pd->pd_part); last = STAILQ_LAST(&hdinfo, pdinfo, pd_link); if (last != NULL) - unit = last->pd_unit + 1; + hd->pd_unit = last->pd_unit + 1; else - unit = 0; + hd->pd_unit = 0; /* FILEPATH_DEVICE_PATH has 0 terminated string */ len = ucs2len(node->PathName); if ((pathname = malloc(len + 1)) == NULL) { printf("Failed to add disk, out of memory\n"); - free(pd); - return (ENOMEM); + free(hd); + return; } cpy16to8(node->PathName, pathname, len + 1); p = strchr(pathname, ':'); @@ -640,23 +562,19 @@ efipart_hdinfo_add_filepath(EFI_HANDLE disk_handle) * false, this code would need update. */ if (p == NULL) { /* no colon, add the disk */ - pd->pd_handle = disk_handle; - pd->pd_unit = unit; - pd->pd_devpath = devpath; - pd->pd_parent = NULL; - pd->pd_devsw = &efipart_hddev; - STAILQ_INSERT_TAIL(&hdinfo, pd, pd_link); + hd->pd_devsw = &efipart_hddev; + STAILQ_INSERT_TAIL(&hdinfo, hd, pd_link); free(pathname); - return (0); + return; } p++; /* skip the colon */ errno = 0; - unit = (int)strtol(p, NULL, 0); + hd->pd_unit = (int)strtol(p, NULL, 0); if (errno != 0) { printf("Bad unit number for partition \"%s\"\n", pathname); free(pathname); - free(pd); - return (EUNIT); + free(hd); + return; } /* @@ -668,80 +586,99 @@ efipart_hdinfo_add_filepath(EFI_HANDLE disk_handle) if (last == NULL) { printf("BUG: No disk for partition \"%s\"\n", pathname); free(pathname); - free(pd); - return (EINVAL); + free(hd); + return; } /* Add the partition. */ - pd->pd_handle = disk_handle; - pd->pd_unit = unit; - pd->pd_devpath = devpath; - pd->pd_parent = last; - pd->pd_devsw = &efipart_hddev; - STAILQ_INSERT_TAIL(&last->pd_part, pd, pd_link); + hd->pd_parent = last; + hd->pd_devsw = &efipart_hddev; + STAILQ_INSERT_TAIL(&last->pd_part, hd, pd_link); free(pathname); - return (0); } static void efipart_updatehd(void) { - int i; - EFI_DEVICE_PATH *devpath, *devpathcpy, *tmpdevpath, *node; - EFI_HANDLE handle; - EFI_BLOCK_IO *blkio; + EFI_DEVICE_PATH *devpath, *node; EFI_STATUS status; + pdinfo_t *parent, *hd; - for (i = 0; i < efipart_nhandles; i++) { - devpath = efi_lookup_devpath(efipart_handles[i]); - if (devpath == NULL) +restart: + STAILQ_FOREACH(hd, &pdinfo, pd_link) { + if ((node = efi_devpath_last_node(hd->pd_devpath)) == NULL) continue; - if ((node = efi_devpath_last_node(devpath)) == NULL) + if (efipart_floppy(node) != NULL) continue; - if (!efipart_hdd(devpath)) + if (efipart_testcd(node, hd->pd_blkio)) continue; - status = BS->HandleProtocol(efipart_handles[i], - &blkio_guid, (void **)&blkio); - if (EFI_ERROR(status)) - continue; + if (DevicePathType(node) == HARDWARE_DEVICE_PATH && + (DevicePathSubType(node) == HW_PCI_DP || + DevicePathSubType(node) == HW_VENDOR_DP)) { + STAILQ_REMOVE(&pdinfo, hd, pdinfo, pd_link); + efipart_hdinfo_add(hd, NULL); + goto restart; + } if (DevicePathType(node) == MEDIA_DEVICE_PATH && DevicePathSubType(node) == MEDIA_FILEPATH_DP) { - efipart_hdinfo_add_filepath(efipart_handles[i]); - continue; + STAILQ_REMOVE(&pdinfo, hd, pdinfo, pd_link); + efipart_hdinfo_add_filepath(hd, + (FILEPATH_DEVICE_PATH *)node); + goto restart; } + STAILQ_REMOVE(&pdinfo, hd, pdinfo, pd_link); + parent = efipart_find_parent(&pdinfo, hd->pd_devpath); + if (parent != NULL) { + STAILQ_REMOVE(&pdinfo, parent, pdinfo, pd_link); + efipart_hdinfo_add(parent, NULL); + } else { + parent = efipart_find_parent(&hdinfo, hd->pd_devpath); + } + if (DevicePathType(node) == MEDIA_DEVICE_PATH && - DevicePathSubType(node) == MEDIA_HARDDRIVE_DP) { - devpathcpy = efi_devpath_trim(devpath); - if (devpathcpy == NULL) - continue; - tmpdevpath = devpathcpy; - status = BS->LocateDevicePath(&blkio_guid, &tmpdevpath, - &handle); - free(devpathcpy); - if (EFI_ERROR(status)) - continue; - /* - * We do not support nested partitions. - */ - devpathcpy = efi_lookup_devpath(handle); - if (devpathcpy == NULL) - continue; - if ((node = efi_devpath_last_node(devpathcpy)) == NULL) - continue; + DevicePathSubType(node) == MEDIA_HARDDRIVE_DP && + parent == NULL) { + parent = calloc(1, sizeof(*parent)); + if (parent == NULL) { + printf("efipart_updatehd: out of memory\n"); + /* this device is lost but try again. */ + free(hd); + goto restart; + } - if (DevicePathType(node) == MEDIA_DEVICE_PATH && - DevicePathSubType(node) == MEDIA_HARDDRIVE_DP) - continue; + devpath = efi_devpath_trim(hd->pd_devpath); + if (devpath == NULL) { + printf("efipart_updatehd: out of memory\n"); + /* this device is lost but try again. */ + free(parent); + free(hd); + goto restart; + } - efipart_hdinfo_add(handle, efipart_handles[i]); - continue; + parent->pd_devpath = devpath; + status = BS->LocateDevicePath(&blkio_guid, + &parent->pd_devpath, &parent->pd_handle); + free(devpath); + if (EFI_ERROR(status)) { + printf("efipart_updatehd: error %lu\n", + EFI_ERROR_CODE(status)); + free(parent); + free(hd); + goto restart; + } + + parent->pd_devpath = + efi_lookup_devpath(&parent->pd_handle); + + efipart_hdinfo_add(parent, NULL); } - efipart_hdinfo_add(efipart_handles[i], NULL); + efipart_hdinfo_add(hd, (HARDDRIVE_DEVICE_PATH *)node); + goto restart; } } @@ -749,8 +686,6 @@ static int efipart_inithd(void) { - STAILQ_INIT(&hdinfo); - efipart_updatehd(); bcache_add_dev(efiblk_pdinfo_count(&hdinfo)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Oct 15 07:35:22 2019 Return-Path: Delivered-To: svn-src-all@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 DFF4B15640C; Tue, 15 Oct 2019 07:35:22 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (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 46snJp5d6Vz3KVF; Tue, 15 Oct 2019 07:35:22 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 2AD242602C4; Tue, 15 Oct 2019 09:35:19 +0200 (CEST) Subject: Re: svn commit: r353533 - in head/sys: arm64/conf conf dev/usb/controller To: Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910142227.x9EMRXXa041108@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <2b985ecf-967d-13b7-8ae0-97481e415225@selasky.org> Date: Tue, 15 Oct 2019 09:34:27 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: <201910142227.x9EMRXXa041108@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46snJp5d6Vz3KVF X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 07:35:22 -0000 On 2019-10-15 00:27, Emmanuel Vadot wrote: > +#define DWC3_GTXFIFOSIZ(x) (0xc300 + 0x4 * x) > +#define DWC3_GRXFIFOSIZ(x) (0xc380 + 0x4 * x) Use a pair of ()'s around arguments: #define DWC3_GRXFIFOSIZ(x) (0xc380 + 0x4 * (x)) --HPS From owner-svn-src-all@freebsd.org Tue Oct 15 08:33:06 2019 Return-Path: Delivered-To: svn-src-all@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 75B7B157B3E; Tue, 15 Oct 2019 08:33: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 46spbQ2bY1z3NpC; Tue, 15 Oct 2019 08:33: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 3BF231BF55; Tue, 15 Oct 2019 08:33: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 x9F8X6PF097373; Tue, 15 Oct 2019 08:33:06 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9F8X6Wn097372; Tue, 15 Oct 2019 08:33:06 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201910150833.x9F8X6Wn097372@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 15 Oct 2019 08:33:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353544 - 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: 353544 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 08:33:06 -0000 Author: tsoome Date: Tue Oct 15 08:33:05 2019 New Revision: 353544 URL: https://svnweb.freebsd.org/changeset/base/353544 Log: boot1.efi: provide generic exit() and stub getchar() panic() is expecting us to have exit and getchar, lets provide those. Modified: head/stand/efi/boot1/boot1.c Modified: head/stand/efi/boot1/boot1.c ============================================================================== --- head/stand/efi/boot1/boot1.c Tue Oct 15 06:19:33 2019 (r353543) +++ head/stand/efi/boot1/boot1.c Tue Oct 15 08:33:05 2019 (r353544) @@ -293,6 +293,18 @@ add_device(dev_info_t **devinfop, dev_info_t *devinfo) dev->next = devinfo; } +void +efi_exit(EFI_STATUS s) +{ + BS->Exit(IH, s, 0, NULL); +} + +void +exit(int error __unused) +{ + efi_exit(EFI_LOAD_ERROR); +} + /* * OK. We totally give up. Exit back to EFI with a sensible status so * it can try the next option on the list. @@ -308,7 +320,12 @@ efi_panic(EFI_STATUS s, const char *fmt, ...) va_end(ap); printf("\n"); - BS->Exit(IH, s, 0, NULL); + efi_exit(s); +} + +int getchar(void) +{ + return (-1); } void From owner-svn-src-all@freebsd.org Tue Oct 15 09:50:02 2019 Return-Path: Delivered-To: svn-src-all@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 C2F8F159ED4; Tue, 15 Oct 2019 09:50:02 +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 46srJB4mRKz3yPV; Tue, 15 Oct 2019 09:50:02 +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 877B31CBED; Tue, 15 Oct 2019 09:50:02 +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 x9F9o299039457; Tue, 15 Oct 2019 09:50:02 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9F9o2Yg039456; Tue, 15 Oct 2019 09:50:02 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201910150950.x9F9o2Yg039456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 15 Oct 2019 09:50:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353545 - head/sbin/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sbin/ipfw X-SVN-Commit-Revision: 353545 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 09:50:02 -0000 Author: ae Date: Tue Oct 15 09:50:02 2019 New Revision: 353545 URL: https://svnweb.freebsd.org/changeset/base/353545 Log: Explicitly initialize the memory buffer to store O_ICMP6TYPE opcode. By default next_cmd() initializes only first u32 of opcode. O_ICMP6TYPE opcode has array of bit masks to store corresponding ICMPv6 types. An opcode that precedes O_ICMP6TYPE, e.g. O_IP6_DST, can have variable length and during opcode filling it can modify memory that will be used by O_ICMP6TYPE opcode. Without explicit initialization this leads to creation of wrong opcode. Reported by: Boris N. Lytochkin Obtained from: Yandex LLC MFC after: 3 days Modified: head/sbin/ipfw/ipv6.c Modified: head/sbin/ipfw/ipv6.c ============================================================================== --- head/sbin/ipfw/ipv6.c Tue Oct 15 08:33:05 2019 (r353544) +++ head/sbin/ipfw/ipv6.c Tue Oct 15 09:50:02 2019 (r353545) @@ -143,6 +143,7 @@ fill_icmp6types(ipfw_insn_icmp6 *cmd, char *av, int cb uint8_t type; CHECK_LENGTH(cblen, F_INSN_SIZE(ipfw_insn_icmp6)); + memset(cmd, 0, sizeof(*cmd)); while (*av) { if (*av == ',') av++; From owner-svn-src-all@freebsd.org Tue Oct 15 10:00:32 2019 Return-Path: Delivered-To: svn-src-all@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 972CD15A1DF; Tue, 15 Oct 2019 10:00:32 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward102o.mail.yandex.net (forward102o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::602]) (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 46srXH0k5Yz3yw7; Tue, 15 Oct 2019 10:00:30 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward103q.mail.yandex.net (forward103q.mail.yandex.net [IPv6:2a02:6b8:c0e:50:0:640:b21c:d009]) by forward102o.mail.yandex.net (Yandex) with ESMTP id E211766816D9; Tue, 15 Oct 2019 13:00:25 +0300 (MSK) Received: from mxback3q.mail.yandex.net (mxback3q.mail.yandex.net [IPv6:2a02:6b8:c0e:39:0:640:4545:437c]) by forward103q.mail.yandex.net (Yandex) with ESMTP id DFCE261E0016; Tue, 15 Oct 2019 13:00:25 +0300 (MSK) Received: from vla5-63eb7479a3c9.qloud-c.yandex.net (vla5-63eb7479a3c9.qloud-c.yandex.net [2a02:6b8:c18:3411:0:640:63eb:7479]) by mxback3q.mail.yandex.net (nwsmtp/Yandex) with ESMTP id pnvX9pt3Eu-0PG80xu5; Tue, 15 Oct 2019 13:00:25 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1571133625; bh=6Y6LOCsweZ6et4C3CIoIHRD0312Q9/SDA32TD9wh/ls=; h=In-Reply-To:From:Date:References:To:Subject:Message-ID; b=isZHpDAggy93mze3slnJm+8hrEa/hiz/Ja0ZaTW4x+jKisTSQ0W59MerOwkOJ9h81 B6nJiIkFtfsMekHXMyOKVDI4YQHWT0K2a05Tcn8gb24RLcy2ebmPD1N+r1A6e0wnjJ 6soFoaySeE0VfJdGIB+eVHxi/tg0N3+zTMsN4Y2Q= Received: by vla5-63eb7479a3c9.qloud-c.yandex.net (nwsmtp/Yandex) with ESMTPSA id TIgp7oVjuQ-0PK4kHFG; Tue, 15 Oct 2019 13:00:25 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Subject: Re: svn commit: r353480 - in head/sys: net netinet sys To: Michael Tuexen , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910131817.x9DIH9YQ047799@repo.freebsd.org> From: "Andrey V. Elsukov" Openpgp: id=E6591E1B41DA1516F0C9BC0001C5EA0410C8A17A Autocrypt: addr=bu7cher@yandex.ru; prefer-encrypt=mutual; keydata= mQENBEwBF1kBCADB9sXFhBEUy8qQ4X63Y8eBatYMHGEFWN9ypS5lI3RE6qQW2EYbxNk7qUC5 21YIIS1mMFVBEfvR7J9uc7yaYgFCEb6Sce1RSO4ULN2mRKGHP3/Sl0ijZEjWHV91hY1YTHEF ZW/0GYinDf56sYpDDehaBF5wkWIo1+QK5nmj3vl0DIDCMNd7QEiWpyLVwECgLX2eOAXByT8B bCqVhJGcG6iFP7/B9Ll6uX5gb8thM9LM+ibwErDBVDGiOgvfxqidab7fdkh893IBCXa82H9N CNwnEtcgzh+BSKK5BgvPohFMgRwjti37TSxwLu63QejRGbZWSz3OK3jMOoF63tCgn7FvABEB AAG0JUFuZHJleSBWLiBFbHN1a292IDxidTdjaGVyQHlhbmRleC5ydT6JATgEEwECACIFAkwB F1kCGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEAHF6gQQyKF6qmYIAI6ekfm1VA4T vqankI1ISE6ku4jV7UlpIQlEbE7/8n3Zd6teJ+pGOQhN5qk8QE7utdPdbktAzi+x7LIJVzUw 4TywZLXGrkP7VKYkfg6oyCGyzITghefQeJtr2TN4hYCkzPWpylkue8MtmqfZv/6royqwTbN+ +E09FQNvTgRUYJYTeQ1qOsxNRycwvw3dr2rOfuxShbzaHBB1pBIjGrMg8fC5pd65ACH5zuFV A0CoTNGMDrEZSfBkTW604UUHFFXeCoC3dwDZRKOWJ3GmMXns65Ai5YkA63BSHEE1Qle3VBhd cG1w0CB5FBV3pB27UVnf0jEbysrDqW4qN7XMRFSWNAy5AQ0ETAEXWQEIAJ2p6l9LBoqdH/0J PEFDY2t2gTvAuzz+8zs3R03dFuHcNbOwjvWCG0aOmVpAzkRa8egn5JB4sZaFUtKPYJEQ1Iu+ LUBwgvtXf4vWpzC67zs2dDuiW4LamH5p6xkTD61aHR7mCB3bg2TUjrDWn2Jt44cvoYxj3dz4 S49U1rc9ZPgD5axCNv45j72tggWlZvpefThP7xT1OlNTUqye2gAwQravXpZkl5JG4eOqJVIU X316iE3qso0iXRUtO7OseBf0PiVmk+wCahdreHOeOxK5jMhYkPKVn7z1sZiB7W2H2TojbmcK HZC22sz7Z/H36Lhg1+/RCnGzdEcjGc8oFHXHCxUAEQEAAYkBHwQYAQIACQUCTAEXWQIbDAAK CRABxeoEEMihegkYCAC3ivGYNe2taNm/4Nx5GPdzuaAJGKWksV+w9mo7dQvU+NmI2az5w8vw 98OmX7G0OV9snxMW+6cyNqBrVFTu33VVNzz9pnqNCHxGvj5dL5ltP160JV2zw2bUwJBYsgYQ WfyJJIM7l3gv5ZS3DGqaGIm9gOK1ANxfrR5PgPzvI9VxDhlr2juEVMZYAqPLEJe+SSxbwLoz BcFCNdDAyXcaAzXsx/E02YWm1hIWNRxanAe7Vlg7OL+gvLpdtrYCMg28PNqKNyrQ87LQ49O9 50IIZDOtNFeR0FGucjcLPdS9PiEqCoH7/waJxWp6ydJ+g4OYRBYNM0EmMgy1N85JJrV1mi5i Message-ID: <846a796c-1119-c401-e05a-b08e2eac6b72@yandex.ru> Date: Tue, 15 Oct 2019 12:59:58 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <201910131817.x9DIH9YQ047799@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="w5ggkuqZOLvSAQHLsXU3a3C9xbWh99ZZa" X-Rspamd-Queue-Id: 46srXH0k5Yz3yw7 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yandex.ru header.s=mail header.b=isZHpDAg; dmarc=pass (policy=none) header.from=yandex.ru; spf=pass (mx1.freebsd.org: domain of bu7cher@yandex.ru designates 2a02:6b8:0:1a2d::602 as permitted sender) smtp.mailfrom=bu7cher@yandex.ru X-Spamd-Result: default: False [-6.20 / 15.00]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a02:6b8:0:1000::/52]; FREEMAIL_FROM(0.00)[yandex.ru]; HAS_ATTACHMENT(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[yandex.ru:+]; DMARC_POLICY_ALLOW(-0.50)[yandex.ru,none]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:~]; RCVD_TLS_LAST(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[2.0.6.0.0.0.0.0.0.0.0.0.0.0.0.0.d.2.a.1.0.0.0.0.8.b.6.0.2.0.a.2.list.dnswl.org : 127.0.5.1]; ASN(0.00)[asn:13238, ipnet:2a02:6b8::/32, country:RU]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[yandex.ru:s=mail]; 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.20)[multipart/signed,multipart/mixed,text/plain]; IP_SCORE(0.00)[ip: (-9.43), ipnet: 2a02:6b8::/32(-4.68), asn: 13238(-3.76), country: RU(0.01)]; FREEMAIL_ENVFROM(0.00)[yandex.ru]; IP_SCORE_FREEMAIL(0.00)[]; DWL_DNSWL_LOW(-1.00)[yandex.ru.dwl.dnswl.org : 127.0.5.1] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 10:00:32 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --w5ggkuqZOLvSAQHLsXU3a3C9xbWh99ZZa Content-Type: multipart/mixed; boundary="aofk1Dx4x0svO139gk0N44aNMzA9Azai8"; protected-headers="v1" From: "Andrey V. Elsukov" To: Michael Tuexen , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <846a796c-1119-c401-e05a-b08e2eac6b72@yandex.ru> Subject: Re: svn commit: r353480 - in head/sys: net netinet sys References: <201910131817.x9DIH9YQ047799@repo.freebsd.org> In-Reply-To: <201910131817.x9DIH9YQ047799@repo.freebsd.org> --aofk1Dx4x0svO139gk0N44aNMzA9Azai8 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 13.10.2019 21:17, Michael Tuexen wrote: > Author: tuexen > Date: Sun Oct 13 18:17:08 2019 > New Revision: 353480 > URL: https://svnweb.freebsd.org/changeset/base/353480 >=20 > Log: > Use an event handler to notify the SCTP about IP address changes > instead of calling an SCTP specific function from the IP code. > This is a requirement of supporting SCTP as a kernel loadable module.= > This patch was developed by markj@, I tweaked a bit the SCTP related > code. > Modified: head/sys/sys/eventhandler.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/sys/eventhandler.h Sun Oct 13 18:03:23 2019 (r353479) > +++ head/sys/sys/eventhandler.h Sun Oct 13 18:17:08 2019 (r353480) > @@ -312,4 +312,9 @@ typedef void (*device_detach_fn)(void *, device_t, = enu > EVENTHANDLER_DECLARE(device_attach, device_attach_fn); > EVENTHANDLER_DECLARE(device_detach, device_detach_fn); > =20 > +/* Interface address addition and removal event */ > +struct ifaddr; > +typedef void (*rt_addrmsg_fn)(void *, struct ifaddr *, int); > +EVENTHANDLER_DECLARE(rt_addrmsg, rt_addrmsg_fn); > + > #endif /* _SYS_EVENTHANDLER_H_ */ Hi, it looks like duplicate functional of ifaddr_event_ext event handler. --=20 WBR, Andrey V. Elsukov --aofk1Dx4x0svO139gk0N44aNMzA9Azai8-- --w5ggkuqZOLvSAQHLsXU3a3C9xbWh99ZZa Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQEzBAEBCAAdFiEE5lkeG0HaFRbwybwAAcXqBBDIoXoFAl2lmJ4ACgkQAcXqBBDI oXoqkQf/dpp6pEPWzRZyH1ql+Hm4zhv1DZGrFjO0ZP6DerTVqIi6eQvH07anm5NK 3skhjvqwsX6iG3tiOUVv5jnar6eWv55XUCa1hofyPVbNRPCfMJwqFruqIVtlk7nl p4N6q6208s0Ffxyhkp/Q+8WhxzN9zeleU4cwxZJ7phlju1Z6jm7BVikEfIFakDnZ 8X6F+F+sJ47pyuntmqfTF557I5okquEpweowUA+CLYfzmChN85oBL9ZSpj6QOgN3 XOda+n7504KKL2vTVxZ8yJRW1nhu5471+ZkmEwQCk3X56eRa38icZcqVx2qmX1nF 2Krsfw+nbRlNxGPceCpYKFDKAn66Xw== =RCyl -----END PGP SIGNATURE----- --w5ggkuqZOLvSAQHLsXU3a3C9xbWh99ZZa-- From owner-svn-src-all@freebsd.org Tue Oct 15 11:11:22 2019 Return-Path: Delivered-To: svn-src-all@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 AC77915B95A; Tue, 15 Oct 2019 11:11:22 +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 46st621HXwz43lR; Tue, 15 Oct 2019 11:11:22 +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 0E4B91DB4F; Tue, 15 Oct 2019 11:11:22 +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 x9FBBLol089156; Tue, 15 Oct 2019 11:11:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FBBLtk089153; Tue, 15 Oct 2019 11:11:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910151111.x9FBBLtk089153@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 15 Oct 2019 11:11:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353546 - head/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Commit-Revision: 353546 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 11:11:22 -0000 Author: hselasky Date: Tue Oct 15 11:11:21 2019 New Revision: 353546 URL: https://svnweb.freebsd.org/changeset/base/353546 Log: Fix missing epochification of the ipoib code after r353292. Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Tue Oct 15 09:50:02 2019 (r353545) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Tue Oct 15 11:11:21 2019 (r353546) @@ -845,6 +845,7 @@ static int ipoib_cm_rep_handler(struct ib_cm_id *cm_id struct ipoib_cm_tx *p = cm_id->context; struct ipoib_dev_priv *priv = p->priv; struct ipoib_cm_data *data = event->private_data; + struct epoch_tracker et; struct ifqueue mbqueue; struct ib_qp_attr qp_attr; int qp_attr_mask, ret; @@ -898,6 +899,7 @@ static int ipoib_cm_rep_handler(struct ib_cm_id *cm_id } spin_unlock_irq(&priv->lock); + NET_EPOCH_ENTER(et); for (;;) { struct ifnet *dev = p->priv->dev; _IF_DEQUEUE(&mbqueue, mb); @@ -908,6 +910,7 @@ static int ipoib_cm_rep_handler(struct ib_cm_id *cm_id ipoib_warn(priv, "dev_queue_xmit failed " "to requeue packet\n"); } + NET_EPOCH_EXIT(et); ret = ib_send_cm_rtu(cm_id, NULL, 0); if (ret) { Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Tue Oct 15 09:50:02 2019 (r353545) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Tue Oct 15 11:11:21 2019 (r353546) @@ -555,6 +555,7 @@ path_rec_completion(int status, struct ib_sa_path_rec struct ifnet *dev = priv->dev; struct ipoib_ah *ah = NULL; struct ipoib_ah *old_ah = NULL; + struct epoch_tracker et; struct ifqueue mbqueue; struct mbuf *mb; unsigned long flags; @@ -609,6 +610,7 @@ path_rec_completion(int status, struct ib_sa_path_rec if (old_ah) ipoib_put_ah(old_ah); + NET_EPOCH_ENTER(et); for (;;) { _IF_DEQUEUE(&mbqueue, mb); if (mb == NULL) @@ -618,6 +620,7 @@ path_rec_completion(int status, struct ib_sa_path_rec ipoib_warn(priv, "dev_queue_xmit failed " "to requeue packet\n"); } + NET_EPOCH_EXIT(et); } static struct ipoib_path * @@ -1482,6 +1485,8 @@ ipoib_output(struct ifnet *ifp, struct mbuf *m, struct ipoib_header *eh; int error = 0, is_gw = 0; short type; + + NET_EPOCH_ASSERT(); if (ro != NULL) is_gw = (ro->ro_flags & RT_HAS_GW) != 0; Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c Tue Oct 15 09:50:02 2019 (r353545) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c Tue Oct 15 11:11:21 2019 (r353546) @@ -157,6 +157,7 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast struct ipoib_dev_priv *priv = mcast->priv; struct ifnet *dev = priv->dev; struct ipoib_ah *ah; + struct epoch_tracker et; int ret; int set_qkey = 0; @@ -227,6 +228,8 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast } } + NET_EPOCH_ENTER(et); + /* actually send any queued packets */ while (mcast->pkt_queue.ifq_len) { struct mbuf *mb; @@ -237,6 +240,7 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast ipoib_warn(priv, "dev_queue_xmit failed to requeue packet\n"); } + NET_EPOCH_EXIT(et); return 0; } From owner-svn-src-all@freebsd.org Tue Oct 15 11:12:32 2019 Return-Path: Delivered-To: svn-src-all@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 3BD7515B9E2; Tue, 15 Oct 2019 11:12:32 +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 46st7N0qqJz444h; Tue, 15 Oct 2019 11:12:32 +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 F411E1DBBE; Tue, 15 Oct 2019 11:12:31 +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 x9FBCVZU093910; Tue, 15 Oct 2019 11:12:31 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FBCVb8093909; Tue, 15 Oct 2019 11:12:31 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910151112.x9FBCVb8093909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 15 Oct 2019 11:12:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353547 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 353547 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 11:12:32 -0000 Author: hselasky Date: Tue Oct 15 11:12:31 2019 New Revision: 353547 URL: https://svnweb.freebsd.org/changeset/base/353547 Log: Fix missing epochification of the ibcore code after r353292. Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_addr.c Modified: head/sys/ofed/drivers/infiniband/core/ib_addr.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_addr.c Tue Oct 15 11:11:21 2019 (r353546) +++ head/sys/ofed/drivers/infiniband/core/ib_addr.c Tue Oct 15 11:12:31 2019 (r353547) @@ -3,7 +3,7 @@ * * Copyright (c) 2005 Voltaire Inc. All rights reserved. * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved. - * Copyright (c) 1999-2005, Mellanox Technologies, Inc. All rights reserved. + * Copyright (c) 1999-2019, Mellanox Technologies, Inc. All rights reserved. * Copyright (c) 2005 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -676,6 +676,7 @@ static int addr_resolve(struct sockaddr *src_in, const struct sockaddr *dst_in, struct rdma_dev_addr *addr) { + struct epoch_tracker et; struct net_device *ndev = NULL; u8 edst[MAX_ADDR_LEN]; int ret; @@ -683,6 +684,7 @@ static int addr_resolve(struct sockaddr *src_in, if (dst_in->sa_family != src_in->sa_family) return -EINVAL; + NET_EPOCH_ENTER(et); switch (src_in->sa_family) { case AF_INET: ret = addr4_resolve((struct sockaddr_in *)src_in, @@ -698,6 +700,7 @@ static int addr_resolve(struct sockaddr *src_in, ret = -EADDRNOTAVAIL; break; } + NET_EPOCH_EXIT(et); /* check for error */ if (ret != 0) From owner-svn-src-all@freebsd.org Tue Oct 15 11:14:15 2019 Return-Path: Delivered-To: svn-src-all@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 7D94915BA6F; Tue, 15 Oct 2019 11:14:15 +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 46st9M2TtNz44FL; Tue, 15 Oct 2019 11:14:15 +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 38D9C1DBC1; Tue, 15 Oct 2019 11:14:15 +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 x9FBEFJN094038; Tue, 15 Oct 2019 11:14:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FBEFF2094037; Tue, 15 Oct 2019 11:14:15 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910151114.x9FBEFF2094037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 15 Oct 2019 11:14:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353548 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 353548 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 11:14:15 -0000 Author: hselasky Date: Tue Oct 15 11:14:14 2019 New Revision: 353548 URL: https://svnweb.freebsd.org/changeset/base/353548 Log: Fix missing epochification of the LinuxKPI after r353292. Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/netdevice.h Modified: head/sys/compat/linuxkpi/common/include/linux/netdevice.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/netdevice.h Tue Oct 15 11:12:31 2019 (r353547) +++ head/sys/compat/linuxkpi/common/include/linux/netdevice.h Tue Oct 15 11:14:14 2019 (r353548) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2019 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -60,11 +60,14 @@ static inline struct ifnet * dev_get_by_index(struct vnet *vnet, int if_index) { + struct epoch_tracker et; struct ifnet *retval; + NET_EPOCH_ENTER(et); CURVNET_SET(vnet); retval = ifnet_byindex_ref(if_index); CURVNET_RESTORE(); + NET_EPOCH_EXIT(et); return (retval); } From owner-svn-src-all@freebsd.org Tue Oct 15 11:20:17 2019 Return-Path: Delivered-To: svn-src-all@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 217FB15BBEE; Tue, 15 Oct 2019 11:20:17 +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 46stJK04Bcz44VF; Tue, 15 Oct 2019 11:20:17 +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 D99831DBCF; Tue, 15 Oct 2019 11:20:16 +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 x9FBKGtB094395; Tue, 15 Oct 2019 11:20:16 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FBKGof094394; Tue, 15 Oct 2019 11:20:16 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910151120.x9FBKGof094394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 15 Oct 2019 11:20:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353549 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353549 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 11:20:17 -0000 Author: hselasky Date: Tue Oct 15 11:20:16 2019 New Revision: 353549 URL: https://svnweb.freebsd.org/changeset/base/353549 Log: Exclude the network link eventhandler from epochification after r353292. This fixes the following assert when "options RATELIMIT" is used: panic() malloc() sysctl_add_oid() tcp_rl_ifnet_link() do_link_state_change() taskqueue_run_locked() Sponsored by: Mellanox Technologies Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue Oct 15 11:14:14 2019 (r353548) +++ head/sys/net/if.c Tue Oct 15 11:20:16 2019 (r353549) @@ -2353,9 +2353,9 @@ do_link_state_change(void *arg, int pending) if (log_link_state_change) if_printf(ifp, "link state changed to %s\n", (link_state == LINK_STATE_UP) ? "UP" : "DOWN" ); + NET_EPOCH_EXIT(et); EVENTHANDLER_INVOKE(ifnet_link_event, ifp, link_state); CURVNET_RESTORE(); - NET_EPOCH_EXIT(et); } /* From owner-svn-src-all@freebsd.org Tue Oct 15 12:08:10 2019 Return-Path: Delivered-To: svn-src-all@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 92C5115D150; Tue, 15 Oct 2019 12:08:10 +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 46svMZ3Pvwz46xF; Tue, 15 Oct 2019 12:08:10 +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 587761E495; Tue, 15 Oct 2019 12:08:10 +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 x9FC8AYR023093; Tue, 15 Oct 2019 12:08:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FC89b8023090; Tue, 15 Oct 2019 12:08:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910151208.x9FC89b8023090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 15 Oct 2019 12:08:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353550 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353550 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 12:08:10 -0000 Author: hselasky Date: Tue Oct 15 12:08:09 2019 New Revision: 353550 URL: https://svnweb.freebsd.org/changeset/base/353550 Log: The two functions ifnet_byindex() and ifnet_byindex_locked() are exactly the same after the network stack was epochified. Merge the two into one function and cleanup all uses of ifnet_byindex_locked(). While at it: - Add branch prediction macros. - Make sure the ifnet pointer is only deferred once, also when code optimisation is disabled. Sponsored by: Mellanox Technologies Modified: head/sys/net/if.c head/sys/net/if_var.h head/sys/net/route.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue Oct 15 11:20:16 2019 (r353549) +++ head/sys/net/if.c Tue Oct 15 12:08:09 2019 (r353550) @@ -329,23 +329,15 @@ MALLOC_DEFINE(M_IFADDR, "ifaddr", "interface address") MALLOC_DEFINE(M_IFMADDR, "ether_multi", "link-level multicast address"); struct ifnet * -ifnet_byindex_locked(u_short idx) -{ - - if (idx > V_if_index) - return (NULL); - if (V_ifindex_table[idx] == IFNET_HOLD) - return (NULL); - return (V_ifindex_table[idx]); -} - -struct ifnet * ifnet_byindex(u_short idx) { struct ifnet *ifp; - ifp = ifnet_byindex_locked(idx); - return (ifp); + if (__predict_false(idx > V_if_index)) + return (NULL); + + ifp = *(struct ifnet * const volatile *)(V_ifindex_table + idx); + return (__predict_false(ifp == IFNET_HOLD) ? NULL : ifp); } struct ifnet * @@ -355,7 +347,7 @@ ifnet_byindex_ref(u_short idx) NET_EPOCH_ASSERT(); - ifp = ifnet_byindex_locked(idx); + ifp = ifnet_byindex(idx); if (ifp == NULL || (ifp->if_flags & IFF_DYING)) return (NULL); if_ref(ifp); @@ -427,7 +419,7 @@ ifaddr_byindex(u_short idx) NET_EPOCH_ASSERT(); - ifp = ifnet_byindex_locked(idx); + ifp = ifnet_byindex(idx); if (ifp != NULL && (ifa = ifp->if_addr) != NULL) ifa_ref(ifa); return (ifa); @@ -653,7 +645,7 @@ if_free(struct ifnet *ifp) CURVNET_SET_QUIET(ifp->if_vnet); IFNET_WLOCK(); - KASSERT(ifp == ifnet_byindex_locked(ifp->if_index), + KASSERT(ifp == ifnet_byindex(ifp->if_index), ("%s: freeing unallocated ifnet", ifp->if_xname)); ifindex_free_locked(ifp->if_index); Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Tue Oct 15 11:20:16 2019 (r353549) +++ head/sys/net/if_var.h Tue Oct 15 12:08:09 2019 (r353550) @@ -629,7 +629,6 @@ extern struct sx ifnet_sxlock; * to call ifnet_byindex() instead of ifnet_byindex_ref(). */ struct ifnet *ifnet_byindex(u_short idx); -struct ifnet *ifnet_byindex_locked(u_short idx); struct ifnet *ifnet_byindex_ref(u_short idx); /* Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Tue Oct 15 11:20:16 2019 (r353549) +++ head/sys/net/route.c Tue Oct 15 12:08:09 2019 (r353550) @@ -1293,7 +1293,7 @@ rt_getifa_fib(struct rt_addrinfo *info, u_int fibnum) ifpaddr->sa_family == AF_LINK) { const struct sockaddr_dl *sdl = (const struct sockaddr_dl *)ifpaddr; if (sdl->sdl_index != 0) - info->rti_ifp = ifnet_byindex_locked(sdl->sdl_index); + info->rti_ifp = ifnet_byindex(sdl->sdl_index); } /* * If we have source address specified, try to find it From owner-svn-src-all@freebsd.org Tue Oct 15 14:13:02 2019 Return-Path: Delivered-To: svn-src-all@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 785FB15FFEB; Tue, 15 Oct 2019 14:13:02 +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 46sy7f29VBz4Fww; Tue, 15 Oct 2019 14:13:02 +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 2EB2F1FC0A; Tue, 15 Oct 2019 14:13:02 +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 x9FED294000143; Tue, 15 Oct 2019 14:13:02 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FED1IS000140; Tue, 15 Oct 2019 14:13:01 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910151413.x9FED1IS000140@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 15 Oct 2019 14:13:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353551 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 353551 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 14:13:02 -0000 Author: avg Date: Tue Oct 15 14:13:01 2019 New Revision: 353551 URL: https://svnweb.freebsd.org/changeset/base/353551 Log: 10452 ZoL: merge in large dnode feature fixes illumos/illumos-gate@946342a260bbae359b48bf142ec1fe40792ee862 https://github.com/illumos/illumos-gate/commit/946342a260bbae359b48bf142ec1fe40792ee862 https://www.illumos.org/issues/10452 illumos is missing a few small follow up ZoL bug fixes for the large dnode feature. We should pull those in. Those commits are in the ZoL tree as (newest to oldest): PR 8435 - 75d6b7ddca269542279975f716a343bb40a79baf - Add missing copyright notice to large_dnode tests PR 7433 - e14a32b1c844d924b9f093375c0badcf10f61741 - Fix object reclaim when using large dnodes PR 6616 - 48fbb9ddbf2281911560dfbc2821aa8b74127315 - Free objects when receiving full stream as clone PR 6695 - 39f56627ae988d09b4e3803c01c22b2026b2310e - receive_freeobjects() skips freeing some object Portions contributed by: Ned Bass Portions contributed by: Tom Caputi Author: Fabian Grünbichler Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_object.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_object.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_object.c Tue Oct 15 12:08:09 2019 (r353550) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_object.c Tue Oct 15 14:13:01 2019 (r353551) @@ -263,7 +263,7 @@ dmu_object_reclaim(objset_t *os, uint64_t object, dmu_ int blocksize, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx) { return (dmu_object_reclaim_dnsize(os, object, ot, blocksize, bonustype, - bonuslen, 0, tx)); + bonuslen, DNODE_MIN_SIZE, tx)); } int Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c Tue Oct 15 12:08:09 2019 (r353550) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c Tue Oct 15 14:13:01 2019 (r353551) @@ -2205,11 +2205,13 @@ receive_object(struct receive_writer_arg *rwa, struct } else if (drro->drr_type != doi.doi_type || drro->drr_blksz != doi.doi_data_block_size || drro->drr_bonustype != doi.doi_bonus_type || - drro->drr_bonuslen != doi.doi_bonus_size) { + drro->drr_bonuslen != doi.doi_bonus_size || + drro->drr_dn_slots != (doi.doi_dnodesize >> DNODE_SHIFT)) { /* currently allocated, but with different properties */ - err = dmu_object_reclaim(rwa->os, drro->drr_object, + err = dmu_object_reclaim_dnsize(rwa->os, drro->drr_object, drro->drr_type, drro->drr_blksz, - drro->drr_bonustype, drro->drr_bonuslen, tx); + drro->drr_bonustype, drro->drr_bonuslen, + drro->drr_dn_slots << DNODE_SHIFT, tx); } if (err != 0) { dmu_tx_commit(tx); @@ -2259,12 +2261,10 @@ receive_freeobjects(struct receive_writer_arg *rwa, int err; err = dmu_object_info(rwa->os, obj, NULL); - if (err == ENOENT) { - obj++; + if (err == ENOENT) continue; - } else if (err != 0) { + else if (err != 0) return (err); - } err = dmu_free_long_object(rwa->os, obj); if (err != 0) Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c Tue Oct 15 12:08:09 2019 (r353550) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c Tue Oct 15 14:13:01 2019 (r353551) @@ -683,8 +683,7 @@ dnode_reallocate(dnode_t *dn, dmu_object_type_t ot, in ASSERT(DMU_OT_IS_VALID(bonustype)); ASSERT3U(bonuslen, <=, DN_BONUS_SIZE(spa_maxdnodesize(dmu_objset_spa(dn->dn_objset)))); - - dn_slots = dn_slots > 0 ? dn_slots : DNODE_MIN_SLOTS; + ASSERT3U(bonuslen, <=, DN_BONUS_SIZE(dn_slots << DNODE_SHIFT)); dnode_free_interior_slots(dn); DNODE_STAT_BUMP(dnode_reallocate); From owner-svn-src-all@freebsd.org Tue Oct 15 14:18:02 2019 Return-Path: Delivered-To: svn-src-all@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 69404148132; Tue, 15 Oct 2019 14:18:02 +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 46syFQ27tpz4GGX; Tue, 15 Oct 2019 14:18:02 +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 2D2F61FC19; Tue, 15 Oct 2019 14:18:02 +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 x9FEI2aQ000710; Tue, 15 Oct 2019 14:18:02 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FEI27n000709; Tue, 15 Oct 2019 14:18:02 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910151418.x9FEI27n000709@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 15 Oct 2019 14:18:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353552 - stable/12/sys/netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/netinet6 X-SVN-Commit-Revision: 353552 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 14:18:02 -0000 Author: markj Date: Tue Oct 15 14:18:01 2019 New Revision: 353552 URL: https://svnweb.freebsd.org/changeset/base/353552 Log: MFC r353295: Improve locking in the IPV6_V6ONLY socket option handler. Modified: stable/12/sys/netinet6/ip6_output.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet6/ip6_output.c ============================================================================== --- stable/12/sys/netinet6/ip6_output.c Tue Oct 15 14:13:01 2019 (r353551) +++ stable/12/sys/netinet6/ip6_output.c Tue Oct 15 14:18:01 2019 (r353552) @@ -1717,21 +1717,24 @@ do { \ #endif case IPV6_V6ONLY: - /* - * make setsockopt(IPV6_V6ONLY) - * available only prior to bind(2). - * see ipng mailing list, Jun 22 2001. - */ + INP_WLOCK(inp); if (in6p->inp_lport || !IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr)) { + /* + * The socket is already bound. + */ + INP_WUNLOCK(inp); error = EINVAL; break; } - OPTSET(IN6P_IPV6_V6ONLY); - if (optval) + if (optval) { + inp->inp_flags |= IN6P_IPV6_V6ONLY; in6p->inp_vflag &= ~INP_IPV4; - else + } else { + inp->inp_flags &= ~IN6P_IPV6_V6ONLY; in6p->inp_vflag |= INP_IPV4; + } + INP_WUNLOCK(inp); break; case IPV6_RECVTCLASS: /* cannot mix with RFC2292 XXX */ From owner-svn-src-all@freebsd.org Tue Oct 15 14:18:40 2019 Return-Path: Delivered-To: svn-src-all@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 F1ABD1481C5; Tue, 15 Oct 2019 14:18:40 +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 46syG865ymz4GP1; Tue, 15 Oct 2019 14:18:40 +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 B4CAD1FC1A; Tue, 15 Oct 2019 14:18:40 +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 x9FEIeoX000785; Tue, 15 Oct 2019 14:18:40 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FEIetB000784; Tue, 15 Oct 2019 14:18:40 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910151418.x9FEIetB000784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 15 Oct 2019 14:18:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353553 - stable/12/sys/riscv/riscv X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/riscv/riscv X-SVN-Commit-Revision: 353553 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 14:18:41 -0000 Author: markj Date: Tue Oct 15 14:18:40 2019 New Revision: 353553 URL: https://svnweb.freebsd.org/changeset/base/353553 Log: MFC r353306: Clear PGA_WRITEABLE in riscv's pmap_remove_l3(). Modified: stable/12/sys/riscv/riscv/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/riscv/riscv/pmap.c ============================================================================== --- stable/12/sys/riscv/riscv/pmap.c Tue Oct 15 14:18:01 2019 (r353552) +++ stable/12/sys/riscv/riscv/pmap.c Tue Oct 15 14:18:40 2019 (r353553) @@ -2090,6 +2090,7 @@ static int pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_t va, pd_entry_t l2e, struct spglist *free, struct rwlock **lockp) { + struct md_page *pvh; pt_entry_t old_l3; vm_paddr_t phys; vm_page_t m; @@ -2109,6 +2110,12 @@ pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_ vm_page_aflag_set(m, PGA_REFERENCED); CHANGE_PV_LIST_LOCK_TO_VM_PAGE(lockp, m); pmap_pvh_free(&m->md, pmap, va); + if (TAILQ_EMPTY(&m->md.pv_list) && + (m->flags & PG_FICTITIOUS) == 0) { + pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); + if (TAILQ_EMPTY(&pvh->pv_list)) + vm_page_aflag_clear(m, PGA_WRITEABLE); + } } return (pmap_unuse_pt(pmap, va, l2e, free)); From owner-svn-src-all@freebsd.org Tue Oct 15 14:19:14 2019 Return-Path: Delivered-To: svn-src-all@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 D6D2014825F; Tue, 15 Oct 2019 14:19: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 46syGp4HCZz4GXq; Tue, 15 Oct 2019 14:19: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 762B81FC1B; Tue, 15 Oct 2019 14:19:14 +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 x9FEJEJs000859; Tue, 15 Oct 2019 14:19:14 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FEJE5Y000858; Tue, 15 Oct 2019 14:19:14 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910151419.x9FEJE5Y000858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 15 Oct 2019 14:19:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353554 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 353554 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 14:19:14 -0000 Author: markj Date: Tue Oct 15 14:19:14 2019 New Revision: 353554 URL: https://svnweb.freebsd.org/changeset/base/353554 Log: MFC r353331: Fix handling of empty SCM_RIGHTS messages. Modified: stable/12/sys/kern/uipc_usrreq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/uipc_usrreq.c ============================================================================== --- stable/12/sys/kern/uipc_usrreq.c Tue Oct 15 14:18:40 2019 (r353553) +++ stable/12/sys/kern/uipc_usrreq.c Tue Oct 15 14:19:14 2019 (r353554) @@ -2318,7 +2318,8 @@ unp_internalize(struct mbuf **controlp, struct thread goto out; } - controlp = &(*controlp)->m_next; + if (*controlp != NULL) + controlp = &(*controlp)->m_next; if (CMSG_SPACE(datalen) < clen) { clen -= CMSG_SPACE(datalen); cm = (struct cmsghdr *) From owner-svn-src-all@freebsd.org Tue Oct 15 14:19:45 2019 Return-Path: Delivered-To: svn-src-all@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 52ED4148380; Tue, 15 Oct 2019 14:19: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 46syHP1Q9Sz4Gly; Tue, 15 Oct 2019 14:19: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 EDE6C1FC20; Tue, 15 Oct 2019 14:19:44 +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 x9FEJiFT001061; Tue, 15 Oct 2019 14:19:44 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FEJix8001060; Tue, 15 Oct 2019 14:19:44 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910151419.x9FEJix8001060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 15 Oct 2019 14:19:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353555 - stable/12/tests/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/tests/sys/kern X-SVN-Commit-Revision: 353555 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 14:19:45 -0000 Author: markj Date: Tue Oct 15 14:19:44 2019 New Revision: 353555 URL: https://svnweb.freebsd.org/changeset/base/353555 Log: MFC r353332: Add a regression test for r353331. Modified: stable/12/tests/sys/kern/unix_passfd_test.c Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/kern/unix_passfd_test.c ============================================================================== --- stable/12/tests/sys/kern/unix_passfd_test.c Tue Oct 15 14:19:14 2019 (r353554) +++ stable/12/tests/sys/kern/unix_passfd_test.c Tue Oct 15 14:19:44 2019 (r353555) @@ -620,6 +620,77 @@ ATF_TC_BODY(copyout_rights_error, tc) closesocketpair(fd); } +/* + * Verify that we can handle empty rights messages. Try sending two SCM_RIGHTS + * messages with a single call, one empty and one containing a single FD. + */ +ATF_TC_WITHOUT_HEAD(empty_rights_message); +ATF_TC_BODY(empty_rights_message, tc) +{ + struct iovec iov; + struct msghdr msghdr; + char *cm, message[CMSG_SPACE(0) + CMSG_SPACE(sizeof(int))]; + ssize_t len; + int error, fd[2], putfd; + + domainsocketpair(fd); + devnull(&putfd); + + /* + * First, try sending an empty message followed by a non-empty message. + */ + cm = message; + putfds(cm, -1, 0); + cm += CMSG_SPACE(0); + putfds(cm, putfd, 1); + + memset(&msghdr, 0, sizeof(msghdr)); + iov.iov_base = NULL; + iov.iov_len = 0; + msghdr.msg_control = message; + msghdr.msg_controllen = sizeof(message); + msghdr.msg_iov = &iov; + msghdr.msg_iovlen = 1; + + len = sendmsg(fd[0], &msghdr, 0); + ATF_REQUIRE_MSG(len == 0, "sendmsg failed: %s", strerror(errno)); + + /* Only the non-empty message should be received. */ + len = recvmsg(fd[1], &msghdr, 0); + ATF_REQUIRE_MSG(len == 0, "recvmsg failed: %s", strerror(errno)); + ATF_REQUIRE(msghdr.msg_controllen = CMSG_SPACE(sizeof(int))); + error = close((int *)CMSG_DATA(msghdr.msg_control)); + ATF_REQUIRE_MSG(error == 0, "close failed: %s", strerror(errno)); + + /* + * Now try sending with the non-empty message before the empty message. + */ + cm = message; + putfds(cm, putfd, 1); + cm += CMSG_SPACE(sizeof(int)); + putfds(cm, -1, 0); + + memset(&msghdr, 0, sizeof(msghdr)); + iov.iov_base = NULL; + iov.iov_len = 0; + msghdr.msg_control = message; + msghdr.msg_controllen = CMSG_SPACE(sizeof(int)); + msghdr.msg_iov = &iov; + msghdr.msg_iovlen = 1; + + len = sendmsg(fd[0], &msghdr, 0); + ATF_REQUIRE_MSG(len == 0, "sendmsg failed: %s", strerror(errno)); + + /* Only the non-empty message should be received. */ + len = recvmsg(fd[1], &msghdr, 0); + ATF_REQUIRE_MSG(len == 0, "recvmsg failed: %s", strerror(errno)); + ATF_REQUIRE(msghdr.msg_controllen = CMSG_SPACE(sizeof(int))); + error = close((int *)CMSG_DATA(msghdr.msg_control)); + ATF_REQUIRE_MSG(error == 0, "close failed: %s", strerror(errno)); + + (void)close(putfd); +} + ATF_TP_ADD_TCS(tp) { @@ -633,6 +704,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, rights_creds_payload); ATF_TP_ADD_TC(tp, truncated_rights); ATF_TP_ADD_TC(tp, copyout_rights_error); + ATF_TP_ADD_TC(tp, empty_rights_message); return (atf_no_error()); } From owner-svn-src-all@freebsd.org Tue Oct 15 14:20:12 2019 Return-Path: Delivered-To: svn-src-all@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 A148E14841D; Tue, 15 Oct 2019 14:20:12 +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 46syHw3Zzbz4GtL; Tue, 15 Oct 2019 14:20:12 +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 5E4B61FC24; Tue, 15 Oct 2019 14:20:12 +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 x9FEKCk1001178; Tue, 15 Oct 2019 14:20:12 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FEKBXj001175; Tue, 15 Oct 2019 14:20:11 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910151420.x9FEKBXj001175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 15 Oct 2019 14:20:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353556 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 353556 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 14:20:12 -0000 Author: avg Date: Tue Oct 15 14:20:11 2019 New Revision: 353556 URL: https://svnweb.freebsd.org/changeset/base/353556 Log: MFV r353551: 10452 ZoL: merge in large dnode feature fixes illumos/illumos-gate@946342a260bbae359b48bf142ec1fe40792ee862 https://github.com/illumos/illumos-gate/commit/946342a260bbae359b48bf142ec1fe40792ee862 https://www.illumos.org/issues/10452 illumos is missing a few small follow up ZoL bug fixes for the large dnode feature. We should pull those in. Those commits are in the ZoL tree as (newest to oldest): PR 8435 - 75d6b7ddca269542279975f716a343bb40a79baf - Add missing copyright notice to large_dnode tests PR 7433 - e14a32b1c844d924b9f093375c0badcf10f61741 - Fix object reclaim when using large dnodes PR 6616 - 48fbb9ddbf2281911560dfbc2821aa8b74127315 - Free objects when receiving full stream as clone PR 6695 - 39f56627ae988d09b4e3803c01c22b2026b2310e - receive_freeobjects() skips freeing some object Portions contributed by: Ned Bass Portions contributed by: Tom Caputi Author: Fabian Grünbichler Obtained from: illumos, ZoL MFC after: 2 weeks X-MFC with: r353176 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c Tue Oct 15 14:19:44 2019 (r353555) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c Tue Oct 15 14:20:11 2019 (r353556) @@ -267,7 +267,7 @@ dmu_object_reclaim(objset_t *os, uint64_t object, dmu_ int blocksize, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx) { return (dmu_object_reclaim_dnsize(os, object, ot, blocksize, bonustype, - bonuslen, 0, tx)); + bonuslen, DNODE_MIN_SIZE, tx)); } int Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Tue Oct 15 14:19:44 2019 (r353555) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Tue Oct 15 14:20:11 2019 (r353556) @@ -2268,11 +2268,13 @@ receive_object(struct receive_writer_arg *rwa, struct } else if (drro->drr_type != doi.doi_type || drro->drr_blksz != doi.doi_data_block_size || drro->drr_bonustype != doi.doi_bonus_type || - drro->drr_bonuslen != doi.doi_bonus_size) { + drro->drr_bonuslen != doi.doi_bonus_size || + drro->drr_dn_slots != (doi.doi_dnodesize >> DNODE_SHIFT)) { /* currently allocated, but with different properties */ - err = dmu_object_reclaim(rwa->os, drro->drr_object, + err = dmu_object_reclaim_dnsize(rwa->os, drro->drr_object, drro->drr_type, drro->drr_blksz, - drro->drr_bonustype, drro->drr_bonuslen, tx); + drro->drr_bonustype, drro->drr_bonuslen, + drro->drr_dn_slots << DNODE_SHIFT, tx); } if (err != 0) { dmu_tx_commit(tx); @@ -2323,12 +2325,10 @@ receive_freeobjects(struct receive_writer_arg *rwa, int err; err = dmu_object_info(rwa->os, obj, NULL); - if (err == ENOENT) { - obj++; + if (err == ENOENT) continue; - } else if (err != 0) { + else if (err != 0) return (err); - } err = dmu_free_long_object(rwa->os, obj); if (err != 0) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Oct 15 14:19:44 2019 (r353555) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Oct 15 14:20:11 2019 (r353556) @@ -680,8 +680,7 @@ dnode_reallocate(dnode_t *dn, dmu_object_type_t ot, in ASSERT(DMU_OT_IS_VALID(bonustype)); ASSERT3U(bonuslen, <=, DN_BONUS_SIZE(spa_maxdnodesize(dmu_objset_spa(dn->dn_objset)))); - - dn_slots = dn_slots > 0 ? dn_slots : DNODE_MIN_SLOTS; + ASSERT3U(bonuslen, <=, DN_BONUS_SIZE(dn_slots << DNODE_SHIFT)); dnode_free_interior_slots(dn); DNODE_STAT_BUMP(dnode_reallocate); From owner-svn-src-all@freebsd.org Tue Oct 15 14:23:17 2019 Return-Path: Delivered-To: svn-src-all@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 54BB51487A0; Tue, 15 Oct 2019 14:23:17 +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 46syMT1RNKz4HRM; Tue, 15 Oct 2019 14:23:17 +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 14A881FDF2; Tue, 15 Oct 2019 14:23:17 +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 x9FENGci006850; Tue, 15 Oct 2019 14:23:16 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FENG1s006849; Tue, 15 Oct 2019 14:23:16 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910151423.x9FENG1s006849@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 15 Oct 2019 14:23:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353557 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 353557 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 14:23:17 -0000 Author: markj Date: Tue Oct 15 14:23:16 2019 New Revision: 353557 URL: https://svnweb.freebsd.org/changeset/base/353557 Log: MFC r353294: Assert that the PGA_{WRITEABLE,EXECUTABLE} flags do not leak. Modified: stable/12/sys/vm/vm_page.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_page.c ============================================================================== --- stable/12/sys/vm/vm_page.c Tue Oct 15 14:20:11 2019 (r353556) +++ stable/12/sys/vm/vm_page.c Tue Oct 15 14:23:16 2019 (r353557) @@ -3401,9 +3401,12 @@ vm_page_free_prep(vm_page_t m) vm_page_lock_assert(m, MA_OWNED); KASSERT(!pmap_page_is_mapped(m), ("vm_page_free_prep: freeing mapped page %p", m)); - } else + KASSERT((m->aflags & (PGA_EXECUTABLE | PGA_WRITEABLE)) == 0, + ("vm_page_free_prep: mapping flags set in page %p", m)); + } else { KASSERT(m->queue == PQ_NONE, ("vm_page_free_prep: unmanaged page %p is queued", m)); + } VM_CNT_INC(v_tfree); if (vm_page_sbusied(m)) From owner-svn-src-all@freebsd.org Tue Oct 15 14:24:34 2019 Return-Path: Delivered-To: svn-src-all@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 2D701148886; Tue, 15 Oct 2019 14:24:34 +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 46syNy0SlLz4HbD; Tue, 15 Oct 2019 14:24:34 +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 E757B1FE00; Tue, 15 Oct 2019 14:24:33 +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 x9FEOXxd006950; Tue, 15 Oct 2019 14:24:33 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FEOWV3006945; Tue, 15 Oct 2019 14:24:32 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910151424.x9FEOWV3006945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 15 Oct 2019 14:24:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353558 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 353558 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 14:24:34 -0000 Author: avg Date: Tue Oct 15 14:24:32 2019 New Revision: 353558 URL: https://svnweb.freebsd.org/changeset/base/353558 Log: 10572 10579 Fix race in dnode_check_slots_free() illumos/illumos-gate@aa02ea01948372a32cbf08bfc31c72c32e3fc81e https://github.com/illumos/illumos-gate/commit/aa02ea01948372a32cbf08bfc31c72c32e3fc81e 10572 Fix race in dnode_check_slots_free() https://www.illumos.org/issues/10572 The Fix from ZoL: Currently, dnode_check_slots_free() works by checking dn->dn_type in the dnode to determine if the dnode is reclaimable. However, there is a small window of time between dnode_free_sync() in the first call to dsl_dataset_sync() and when the useraccounting code is run when the type is set DMU_OT_NONE, but the dnode is not yet evictable, leading to crashes. This patch adds the ability for dnodes to track which txg they were last dirtied in and adds a check for this before performing the reclaim. This patch also corrects several instances when dn_dirty_link was treated as a list_node_t when it is technically a multilist_node_t. 10579 Don't allow dnode allocation if dn_holds != 0 https://www.illumos.org/issues/10579 The fix from ZoL: This patch simply fixes a small bug where dnode_hold_impl() could attempt to allocate a dnode that was in the process of being freed, but which still had active references. This patch simply adds the required check. Author: Tom Caputi Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c Tue Oct 15 14:23:16 2019 (r353557) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c Tue Oct 15 14:24:32 2019 (r353558) @@ -1570,6 +1570,9 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx) FTAG); } } + + if (tx->tx_txg > dn->dn_dirty_txg) + dn->dn_dirty_txg = tx->tx_txg; mutex_exit(&dn->dn_mtx); if (db->db_blkid == DMU_SPILL_BLKID) Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c Tue Oct 15 14:23:16 2019 (r353557) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c Tue Oct 15 14:24:32 2019 (r353558) @@ -1247,10 +1247,23 @@ dmu_objset_sync_dnodes(multilist_sublist_t *list, dmu_ ASSERT3U(dn->dn_nlevels, <=, DN_MAX_LEVELS); multilist_sublist_remove(list, dn); + /* + * If we are not doing useraccounting (os_synced_dnodes == NULL) + * we are done with this dnode for this txg. Unset dn_dirty_txg + * if later txgs aren't dirtying it so that future holders do + * not get a stale value. Otherwise, we will do this in + * userquota_updates_task() when processing has completely + * finished for this txg. + */ multilist_t *newlist = dn->dn_objset->os_synced_dnodes; if (newlist != NULL) { (void) dnode_add_ref(dn, newlist); multilist_insert(newlist, dn); + } else { + mutex_enter(&dn->dn_mtx); + if (dn->dn_dirty_txg == tx->tx_txg) + dn->dn_dirty_txg = 0; + mutex_exit(&dn->dn_mtx); } dnode_sync(dn, tx); @@ -1610,6 +1623,8 @@ userquota_updates_task(void *arg) dn->dn_id_flags |= DN_ID_CHKED_BONUS; } dn->dn_id_flags &= ~(DN_ID_NEW_EXIST); + if (dn->dn_dirty_txg == spa_syncing_txg(os->os_spa)) + dn->dn_dirty_txg = 0; mutex_exit(&dn->dn_mtx); multilist_sublist_remove(list, dn); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c Tue Oct 15 14:23:16 2019 (r353557) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c Tue Oct 15 14:24:32 2019 (r353558) @@ -150,7 +150,7 @@ dnode_cons(void *arg, void *unused, int kmflag) bzero(&dn->dn_next_blksz[0], sizeof (dn->dn_next_blksz)); for (i = 0; i < TXG_SIZE; i++) { - list_link_init(&dn->dn_dirty_link[i]); + multilist_link_init(&dn->dn_dirty_link[i]); dn->dn_free_ranges[i] = NULL; list_create(&dn->dn_dirty_records[i], sizeof (dbuf_dirty_record_t), @@ -160,6 +160,7 @@ dnode_cons(void *arg, void *unused, int kmflag) dn->dn_allocated_txg = 0; dn->dn_free_txg = 0; dn->dn_assigned_txg = 0; + dn->dn_dirty_txg = 0; dn->dn_dirtyctx = 0; dn->dn_dirtyctx_firstset = NULL; dn->dn_bonus = NULL; @@ -197,7 +198,7 @@ dnode_dest(void *arg, void *unused) ASSERT(!list_link_active(&dn->dn_link)); for (i = 0; i < TXG_SIZE; i++) { - ASSERT(!list_link_active(&dn->dn_dirty_link[i])); + ASSERT(!multilist_link_active(&dn->dn_dirty_link[i])); ASSERT3P(dn->dn_free_ranges[i], ==, NULL); list_destroy(&dn->dn_dirty_records[i]); ASSERT0(dn->dn_next_nblkptr[i]); @@ -212,6 +213,7 @@ dnode_dest(void *arg, void *unused) ASSERT0(dn->dn_allocated_txg); ASSERT0(dn->dn_free_txg); ASSERT0(dn->dn_assigned_txg); + ASSERT0(dn->dn_dirty_txg); ASSERT0(dn->dn_dirtyctx); ASSERT3P(dn->dn_dirtyctx_firstset, ==, NULL); ASSERT3P(dn->dn_bonus, ==, NULL); @@ -543,6 +545,7 @@ dnode_destroy(dnode_t *dn) dn->dn_allocated_txg = 0; dn->dn_free_txg = 0; dn->dn_assigned_txg = 0; + dn->dn_dirty_txg = 0; dn->dn_dirtyctx = 0; if (dn->dn_dirtyctx_firstset != NULL) { @@ -612,6 +615,7 @@ dnode_allocate(dnode_t *dn, dmu_object_type_t ot, int ASSERT(dn->dn_type == DMU_OT_NONE); ASSERT0(dn->dn_maxblkid); ASSERT0(dn->dn_allocated_txg); + ASSERT0(dn->dn_dirty_txg); ASSERT0(dn->dn_assigned_txg); ASSERT(refcount_is_zero(&dn->dn_tx_holds)); ASSERT3U(refcount_count(&dn->dn_holds), <=, 1); @@ -625,7 +629,7 @@ dnode_allocate(dnode_t *dn, dmu_object_type_t ot, int ASSERT0(dn->dn_next_bonustype[i]); ASSERT0(dn->dn_rm_spillblk[i]); ASSERT0(dn->dn_next_blksz[i]); - ASSERT(!list_link_active(&dn->dn_dirty_link[i])); + ASSERT(!multilist_link_active(&dn->dn_dirty_link[i])); ASSERT3P(list_head(&dn->dn_dirty_records[i]), ==, NULL); ASSERT3P(dn->dn_free_ranges[i], ==, NULL); } @@ -802,6 +806,7 @@ dnode_move_impl(dnode_t *odn, dnode_t *ndn) ndn->dn_allocated_txg = odn->dn_allocated_txg; ndn->dn_free_txg = odn->dn_free_txg; ndn->dn_assigned_txg = odn->dn_assigned_txg; + ndn->dn_dirty_txg = odn->dn_dirty_txg; ndn->dn_dirtyctx = odn->dn_dirtyctx; ndn->dn_dirtyctx_firstset = odn->dn_dirtyctx_firstset; ASSERT(refcount_count(&odn->dn_tx_holds) == 0); @@ -868,6 +873,7 @@ dnode_move_impl(dnode_t *odn, dnode_t *ndn) odn->dn_allocated_txg = 0; odn->dn_free_txg = 0; odn->dn_assigned_txg = 0; + odn->dn_dirty_txg = 0; odn->dn_dirtyctx = 0; odn->dn_dirtyctx_firstset = NULL; odn->dn_have_spill = B_FALSE; @@ -1092,6 +1098,10 @@ dnode_check_slots_free(dnode_children_t *children, int { ASSERT3S(idx + slots, <=, DNODES_PER_BLOCK); + /* + * If all dnode slots are either already free or + * evictable return B_TRUE. + */ for (int i = idx; i < idx + slots; i++) { dnode_handle_t *dnh = &children->dnc_children[i]; dnode_t *dn = dnh->dnh_dnode; @@ -1100,18 +1110,18 @@ dnode_check_slots_free(dnode_children_t *children, int continue; } else if (DN_SLOT_IS_PTR(dn)) { mutex_enter(&dn->dn_mtx); - dmu_object_type_t type = dn->dn_type; + boolean_t can_free = (dn->dn_type == DMU_OT_NONE && + zfs_refcount_is_zero(&dn->dn_holds) && + !DNODE_IS_DIRTY(dn)); mutex_exit(&dn->dn_mtx); - if (type != DMU_OT_NONE) + if (!can_free) return (B_FALSE); - - continue; + else + continue; } else { return (B_FALSE); } - - return (B_FALSE); } return (B_TRUE); @@ -1634,7 +1644,7 @@ dnode_setdirty(dnode_t *dn, dmu_tx_t *tx) /* * If we are already marked dirty, we're done. */ - if (list_link_active(&dn->dn_dirty_link[txg & TXG_MASK])) { + if (multilist_link_active(&dn->dn_dirty_link[txg & TXG_MASK])) { multilist_sublist_unlock(mls); return; } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_impl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_impl.h Tue Oct 15 14:23:16 2019 (r353557) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_impl.h Tue Oct 15 14:24:32 2019 (r353558) @@ -162,7 +162,7 @@ extern "C" { * dn_allocated_txg * dn_free_txg * dn_assigned_txg - * dd_assigned_tx + * dn_dirty_txg * dn_notxholds * dn_dirtyctx * dn_dirtyctx_firstset Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h Tue Oct 15 14:23:16 2019 (r353557) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h Tue Oct 15 14:24:32 2019 (r353558) @@ -296,6 +296,7 @@ struct dnode { uint64_t dn_allocated_txg; uint64_t dn_free_txg; uint64_t dn_assigned_txg; + uint64_t dn_dirty_txg; /* txg dnode was last dirtied */ kcondvar_t dn_notxholds; enum dnode_dirtycontext dn_dirtyctx; uint8_t *dn_dirtyctx_firstset; /* dbg: contents meaningless */ @@ -398,6 +399,9 @@ void dnode_evict_dbufs(dnode_t *dn); void dnode_evict_bonus(dnode_t *dn); void dnode_free_interior_slots(dnode_t *dn); boolean_t dnode_needs_remap(const dnode_t *dn); + +#define DNODE_IS_DIRTY(_dn) \ + ((_dn)->dn_dirty_txg >= spa_syncing_txg((_dn)->dn_objset->os_spa)) #define DNODE_IS_CACHEABLE(_dn) \ ((_dn)->dn_objset->os_primary_cache == ZFS_CACHE_ALL || \ From owner-svn-src-all@freebsd.org Tue Oct 15 14:29:19 2019 Return-Path: Delivered-To: svn-src-all@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 CF4FD1489D3; Tue, 15 Oct 2019 14:29:19 +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 46syVR58KTz4Hlx; Tue, 15 Oct 2019 14:29:19 +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 8F9731FE0B; Tue, 15 Oct 2019 14:29:19 +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 x9FETJC6007240; Tue, 15 Oct 2019 14:29:19 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FETIni007235; Tue, 15 Oct 2019 14:29:18 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910151429.x9FETIni007235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 15 Oct 2019 14:29:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353559 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 353559 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 14:29:19 -0000 Author: avg Date: Tue Oct 15 14:29:18 2019 New Revision: 353559 URL: https://svnweb.freebsd.org/changeset/base/353559 Log: MFV r353558: 10572 10579 Fix race in dnode_check_slots_free() illumos/illumos-gate@aa02ea01948372a32cbf08bfc31c72c32e3fc81e https://github.com/illumos/illumos-gate/commit/aa02ea01948372a32cbf08bfc31c72c32e3fc81e 10572 Fix race in dnode_check_slots_free() https://www.illumos.org/issues/10572 The Fix from ZoL: Currently, dnode_check_slots_free() works by checking dn->dn_type in the dnode to determine if the dnode is reclaimable. However, there is a small window of time between dnode_free_sync() in the first call to dsl_dataset_sync() and when the useraccounting code is run when the type is set DMU_OT_NONE, but the dnode is not yet evictable, leading to crashes. This patch adds the ability for dnodes to track which txg they were last dirtied in and adds a check for this before performing the reclaim. This patch also corrects several instances when dn_dirty_link was treated as a list_node_t when it is technically a multilist_node_t. 10579 Don't allow dnode allocation if dn_holds != 0 https://www.illumos.org/issues/10579 The fix from ZoL: This patch simply fixes a small bug where dnode_hold_impl() could attempt to allocate a dnode that was in the process of being freed, but which still had active references. This patch simply adds the required check. Author: Tom Caputi Reported by: delphij MFC after: 2 weeks X-MFC with: r353176 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Tue Oct 15 14:24:32 2019 (r353558) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Tue Oct 15 14:29:18 2019 (r353559) @@ -1812,6 +1812,9 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx) FTAG); } } + + if (tx->tx_txg > dn->dn_dirty_txg) + dn->dn_dirty_txg = tx->tx_txg; mutex_exit(&dn->dn_mtx); if (db->db_blkid == DMU_SPILL_BLKID) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Tue Oct 15 14:24:32 2019 (r353558) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Tue Oct 15 14:29:18 2019 (r353559) @@ -1249,10 +1249,23 @@ dmu_objset_sync_dnodes(multilist_sublist_t *list, dmu_ ASSERT3U(dn->dn_nlevels, <=, DN_MAX_LEVELS); multilist_sublist_remove(list, dn); + /* + * If we are not doing useraccounting (os_synced_dnodes == NULL) + * we are done with this dnode for this txg. Unset dn_dirty_txg + * if later txgs aren't dirtying it so that future holders do + * not get a stale value. Otherwise, we will do this in + * userquota_updates_task() when processing has completely + * finished for this txg. + */ multilist_t *newlist = dn->dn_objset->os_synced_dnodes; if (newlist != NULL) { (void) dnode_add_ref(dn, newlist); multilist_insert(newlist, dn); + } else { + mutex_enter(&dn->dn_mtx); + if (dn->dn_dirty_txg == tx->tx_txg) + dn->dn_dirty_txg = 0; + mutex_exit(&dn->dn_mtx); } dnode_sync(dn, tx); @@ -1617,6 +1630,8 @@ userquota_updates_task(void *arg) dn->dn_id_flags |= DN_ID_CHKED_BONUS; } dn->dn_id_flags &= ~(DN_ID_NEW_EXIST); + if (dn->dn_dirty_txg == spa_syncing_txg(os->os_spa)) + dn->dn_dirty_txg = 0; mutex_exit(&dn->dn_mtx); multilist_sublist_remove(list, dn); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Oct 15 14:24:32 2019 (r353558) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Oct 15 14:29:18 2019 (r353559) @@ -146,7 +146,7 @@ dnode_cons(void *arg, void *unused, int kmflag) bzero(&dn->dn_next_blksz[0], sizeof (dn->dn_next_blksz)); for (i = 0; i < TXG_SIZE; i++) { - list_link_init(&dn->dn_dirty_link[i]); + multilist_link_init(&dn->dn_dirty_link[i]); dn->dn_free_ranges[i] = NULL; list_create(&dn->dn_dirty_records[i], sizeof (dbuf_dirty_record_t), @@ -156,6 +156,7 @@ dnode_cons(void *arg, void *unused, int kmflag) dn->dn_allocated_txg = 0; dn->dn_free_txg = 0; dn->dn_assigned_txg = 0; + dn->dn_dirty_txg = 0; dn->dn_dirtyctx = 0; dn->dn_dirtyctx_firstset = NULL; dn->dn_bonus = NULL; @@ -194,7 +195,7 @@ dnode_dest(void *arg, void *unused) ASSERT(!list_link_active(&dn->dn_link)); for (i = 0; i < TXG_SIZE; i++) { - ASSERT(!list_link_active(&dn->dn_dirty_link[i])); + ASSERT(!multilist_link_active(&dn->dn_dirty_link[i])); ASSERT3P(dn->dn_free_ranges[i], ==, NULL); list_destroy(&dn->dn_dirty_records[i]); ASSERT0(dn->dn_next_nblkptr[i]); @@ -209,6 +210,7 @@ dnode_dest(void *arg, void *unused) ASSERT0(dn->dn_allocated_txg); ASSERT0(dn->dn_free_txg); ASSERT0(dn->dn_assigned_txg); + ASSERT0(dn->dn_dirty_txg); ASSERT0(dn->dn_dirtyctx); ASSERT3P(dn->dn_dirtyctx_firstset, ==, NULL); ASSERT3P(dn->dn_bonus, ==, NULL); @@ -540,6 +542,7 @@ dnode_destroy(dnode_t *dn) dn->dn_allocated_txg = 0; dn->dn_free_txg = 0; dn->dn_assigned_txg = 0; + dn->dn_dirty_txg = 0; dn->dn_dirtyctx = 0; if (dn->dn_dirtyctx_firstset != NULL) { @@ -609,6 +612,7 @@ dnode_allocate(dnode_t *dn, dmu_object_type_t ot, int ASSERT(dn->dn_type == DMU_OT_NONE); ASSERT0(dn->dn_maxblkid); ASSERT0(dn->dn_allocated_txg); + ASSERT0(dn->dn_dirty_txg); ASSERT0(dn->dn_assigned_txg); ASSERT(refcount_is_zero(&dn->dn_tx_holds)); ASSERT3U(refcount_count(&dn->dn_holds), <=, 1); @@ -622,7 +626,7 @@ dnode_allocate(dnode_t *dn, dmu_object_type_t ot, int ASSERT0(dn->dn_next_bonustype[i]); ASSERT0(dn->dn_rm_spillblk[i]); ASSERT0(dn->dn_next_blksz[i]); - ASSERT(!list_link_active(&dn->dn_dirty_link[i])); + ASSERT(!multilist_link_active(&dn->dn_dirty_link[i])); ASSERT3P(list_head(&dn->dn_dirty_records[i]), ==, NULL); ASSERT3P(dn->dn_free_ranges[i], ==, NULL); } @@ -799,6 +803,7 @@ dnode_move_impl(dnode_t *odn, dnode_t *ndn) ndn->dn_allocated_txg = odn->dn_allocated_txg; ndn->dn_free_txg = odn->dn_free_txg; ndn->dn_assigned_txg = odn->dn_assigned_txg; + ndn->dn_dirty_txg = odn->dn_dirty_txg; ndn->dn_dirtyctx = odn->dn_dirtyctx; ndn->dn_dirtyctx_firstset = odn->dn_dirtyctx_firstset; ASSERT(refcount_count(&odn->dn_tx_holds) == 0); @@ -865,6 +870,7 @@ dnode_move_impl(dnode_t *odn, dnode_t *ndn) odn->dn_allocated_txg = 0; odn->dn_free_txg = 0; odn->dn_assigned_txg = 0; + odn->dn_dirty_txg = 0; odn->dn_dirtyctx = 0; odn->dn_dirtyctx_firstset = NULL; odn->dn_have_spill = B_FALSE; @@ -1091,6 +1097,10 @@ dnode_check_slots_free(dnode_children_t *children, int { ASSERT3S(idx + slots, <=, DNODES_PER_BLOCK); + /* + * If all dnode slots are either already free or + * evictable return B_TRUE. + */ for (int i = idx; i < idx + slots; i++) { dnode_handle_t *dnh = &children->dnc_children[i]; dnode_t *dn = dnh->dnh_dnode; @@ -1099,18 +1109,18 @@ dnode_check_slots_free(dnode_children_t *children, int continue; } else if (DN_SLOT_IS_PTR(dn)) { mutex_enter(&dn->dn_mtx); - dmu_object_type_t type = dn->dn_type; + boolean_t can_free = (dn->dn_type == DMU_OT_NONE && + refcount_is_zero(&dn->dn_holds) && + !DNODE_IS_DIRTY(dn)); mutex_exit(&dn->dn_mtx); - if (type != DMU_OT_NONE) + if (!can_free) return (B_FALSE); - - continue; + else + continue; } else { return (B_FALSE); } - - return (B_FALSE); } return (B_TRUE); @@ -1634,7 +1644,7 @@ dnode_setdirty(dnode_t *dn, dmu_tx_t *tx) /* * If we are already marked dirty, we're done. */ - if (list_link_active(&dn->dn_dirty_link[txg & TXG_MASK])) { + if (multilist_link_active(&dn->dn_dirty_link[txg & TXG_MASK])) { multilist_sublist_unlock(mls); return; } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h Tue Oct 15 14:24:32 2019 (r353558) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h Tue Oct 15 14:29:18 2019 (r353559) @@ -163,7 +163,7 @@ extern "C" { * dn_allocated_txg * dn_free_txg * dn_assigned_txg - * dd_assigned_tx + * dn_dirty_txg * dn_notxholds * dn_dirtyctx * dn_dirtyctx_firstset Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Tue Oct 15 14:24:32 2019 (r353558) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Tue Oct 15 14:29:18 2019 (r353559) @@ -303,6 +303,7 @@ struct dnode { uint64_t dn_allocated_txg; uint64_t dn_free_txg; uint64_t dn_assigned_txg; + uint64_t dn_dirty_txg; /* txg dnode was last dirtied */ kcondvar_t dn_notxholds; enum dnode_dirtycontext dn_dirtyctx; uint8_t *dn_dirtyctx_firstset; /* dbg: contents meaningless */ @@ -405,6 +406,9 @@ void dnode_evict_dbufs(dnode_t *dn); void dnode_evict_bonus(dnode_t *dn); void dnode_free_interior_slots(dnode_t *dn); boolean_t dnode_needs_remap(const dnode_t *dn); + +#define DNODE_IS_DIRTY(_dn) \ + ((_dn)->dn_dirty_txg >= spa_syncing_txg((_dn)->dn_objset->os_spa)) #define DNODE_IS_CACHEABLE(_dn) \ ((_dn)->dn_objset->os_primary_cache == ZFS_CACHE_ALL || \ From owner-svn-src-all@freebsd.org Tue Oct 15 14:29:30 2019 Return-Path: Delivered-To: svn-src-all@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 D410C148A18; Tue, 15 Oct 2019 14:29:30 +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 46syVf5K5lz4Ht3; Tue, 15 Oct 2019 14:29:30 +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 9A8C51FE0C; Tue, 15 Oct 2019 14:29:30 +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 x9FETU84007294; Tue, 15 Oct 2019 14:29:30 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FETUOr007293; Tue, 15 Oct 2019 14:29:30 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910151429.x9FETUOr007293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 15 Oct 2019 14:29:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353560 - stable/12/sys/netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/netinet6 X-SVN-Commit-Revision: 353560 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 14:29:30 -0000 Author: markj Date: Tue Oct 15 14:29:30 2019 New Revision: 353560 URL: https://svnweb.freebsd.org/changeset/base/353560 Log: Revert r353552 for now. ip6_ctloutput() is missing some requisite changes. Reported by: Jenkins Modified: stable/12/sys/netinet6/ip6_output.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet6/ip6_output.c ============================================================================== --- stable/12/sys/netinet6/ip6_output.c Tue Oct 15 14:29:18 2019 (r353559) +++ stable/12/sys/netinet6/ip6_output.c Tue Oct 15 14:29:30 2019 (r353560) @@ -1717,24 +1717,21 @@ do { \ #endif case IPV6_V6ONLY: - INP_WLOCK(inp); + /* + * make setsockopt(IPV6_V6ONLY) + * available only prior to bind(2). + * see ipng mailing list, Jun 22 2001. + */ if (in6p->inp_lport || !IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr)) { - /* - * The socket is already bound. - */ - INP_WUNLOCK(inp); error = EINVAL; break; } - if (optval) { - inp->inp_flags |= IN6P_IPV6_V6ONLY; + OPTSET(IN6P_IPV6_V6ONLY); + if (optval) in6p->inp_vflag &= ~INP_IPV4; - } else { - inp->inp_flags &= ~IN6P_IPV6_V6ONLY; + else in6p->inp_vflag |= INP_IPV4; - } - INP_WUNLOCK(inp); break; case IPV6_RECVTCLASS: /* cannot mix with RFC2292 XXX */ From owner-svn-src-all@freebsd.org Tue Oct 15 14:33:44 2019 Return-Path: Delivered-To: svn-src-all@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 1F9A5148CA6; Tue, 15 Oct 2019 14:33:44 +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 46sybX0lKMz4JJL; Tue, 15 Oct 2019 14:33:44 +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 D6FAB1FFC2; Tue, 15 Oct 2019 14:33:43 +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 x9FEXhVv013065; Tue, 15 Oct 2019 14:33:43 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FEXhfn013061; Tue, 15 Oct 2019 14:33:43 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910151433.x9FEXhfn013061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 15 Oct 2019 14:33:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353561 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 353561 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 14:33:44 -0000 Author: avg Date: Tue Oct 15 14:33:42 2019 New Revision: 353561 URL: https://svnweb.freebsd.org/changeset/base/353561 Log: 10343 ZoL: Prefix all refcount functions with zfs_ illumos/illumos-gate@e914ace2e9d9bf2dbf9a1f1ce81cb776022096f5 https://github.com/illumos/illumos-gate/commit/e914ace2e9d9bf2dbf9a1f1ce81cb776022096f5 https://www.illumos.org/issues/10343 On the openzfs feature/porting matrix, this is listed as: prefix to refcount funcs/types Having these changes will make it easier to share other work across the different ZFS operating systems. PR 7963 424fd7c3e Prefix all refcount functions with zfs_ PR 7885 & 7932 c13060e47 Linux 4.19-rc3+ compat: Remove refcount_t compat PR 5823 & 5842 4859fe796 Linux 4.11 compat: avoid refcount_t name conflict Author: Tim Schumacher Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/abd.c vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c vendor-sys/illumos/dist/uts/common/fs/zfs/dnode_sync.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c vendor-sys/illumos/dist/uts/common/fs/zfs/refcount.c vendor-sys/illumos/dist/uts/common/fs/zfs/rrwlock.c vendor-sys/illumos/dist/uts/common/fs/zfs/sa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/abd.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_tx.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/refcount.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/rrwlock.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/sa_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zap.h vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/abd.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/abd.c Tue Oct 15 14:29:30 2019 (r353560) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/abd.c Tue Oct 15 14:33:42 2019 (r353561) @@ -291,7 +291,7 @@ abd_alloc(size_t size, boolean_t is_metadata) } abd->abd_size = size; abd->abd_parent = NULL; - refcount_create(&abd->abd_children); + zfs_refcount_create(&abd->abd_children); abd->abd_u.abd_scatter.abd_offset = 0; abd->abd_u.abd_scatter.abd_chunk_size = zfs_abd_chunk_size; @@ -318,7 +318,7 @@ abd_free_scatter(abd_t *abd) abd_free_chunk(abd->abd_u.abd_scatter.abd_chunks[i]); } - refcount_destroy(&abd->abd_children); + zfs_refcount_destroy(&abd->abd_children); ABDSTAT_BUMPDOWN(abdstat_scatter_cnt); ABDSTAT_INCR(abdstat_scatter_data_size, -(int)abd->abd_size); ABDSTAT_INCR(abdstat_scatter_chunk_waste, @@ -345,7 +345,7 @@ abd_alloc_linear(size_t size, boolean_t is_metadata) } abd->abd_size = size; abd->abd_parent = NULL; - refcount_create(&abd->abd_children); + zfs_refcount_create(&abd->abd_children); if (is_metadata) { abd->abd_u.abd_linear.abd_buf = zio_buf_alloc(size); @@ -368,7 +368,7 @@ abd_free_linear(abd_t *abd) zio_data_buf_free(abd->abd_u.abd_linear.abd_buf, abd->abd_size); } - refcount_destroy(&abd->abd_children); + zfs_refcount_destroy(&abd->abd_children); ABDSTAT_BUMPDOWN(abdstat_linear_cnt); ABDSTAT_INCR(abdstat_linear_data_size, -(int)abd->abd_size); @@ -474,8 +474,8 @@ abd_get_offset(abd_t *sabd, size_t off) abd->abd_size = sabd->abd_size - off; abd->abd_parent = sabd; - refcount_create(&abd->abd_children); - (void) refcount_add_many(&sabd->abd_children, abd->abd_size, abd); + zfs_refcount_create(&abd->abd_children); + (void) zfs_refcount_add_many(&sabd->abd_children, abd->abd_size, abd); return (abd); } @@ -499,7 +499,7 @@ abd_get_from_buf(void *buf, size_t size) abd->abd_flags = ABD_FLAG_LINEAR; abd->abd_size = size; abd->abd_parent = NULL; - refcount_create(&abd->abd_children); + zfs_refcount_create(&abd->abd_children); abd->abd_u.abd_linear.abd_buf = buf; @@ -517,11 +517,11 @@ abd_put(abd_t *abd) ASSERT(!(abd->abd_flags & ABD_FLAG_OWNER)); if (abd->abd_parent != NULL) { - (void) refcount_remove_many(&abd->abd_parent->abd_children, + (void) zfs_refcount_remove_many(&abd->abd_parent->abd_children, abd->abd_size, abd); } - refcount_destroy(&abd->abd_children); + zfs_refcount_destroy(&abd->abd_children); abd_free_struct(abd); } @@ -553,7 +553,7 @@ abd_borrow_buf(abd_t *abd, size_t n) } else { buf = zio_buf_alloc(n); } - (void) refcount_add_many(&abd->abd_children, n, buf); + (void) zfs_refcount_add_many(&abd->abd_children, n, buf); return (buf); } @@ -585,7 +585,7 @@ abd_return_buf(abd_t *abd, void *buf, size_t n) ASSERT0(abd_cmp_buf(abd, buf, n)); zio_buf_free(buf, n); } - (void) refcount_remove_many(&abd->abd_children, n, buf); + (void) zfs_refcount_remove_many(&abd->abd_children, n, buf); } void Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Tue Oct 15 14:29:30 2019 (r353560) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Tue Oct 15 14:33:42 2019 (r353561) @@ -428,12 +428,12 @@ typedef struct arc_state { /* * total amount of evictable data in this state */ - refcount_t arcs_esize[ARC_BUFC_NUMTYPES]; + zfs_refcount_t arcs_esize[ARC_BUFC_NUMTYPES]; /* * total amount of data in this state; this includes: evictable, * non-evictable, ARC_BUFC_DATA, and ARC_BUFC_METADATA. */ - refcount_t arcs_size; + zfs_refcount_t arcs_size; } arc_state_t; /* The 6 states: */ @@ -947,7 +947,7 @@ typedef struct l1arc_buf_hdr { clock_t b_arc_access; /* self protecting */ - refcount_t b_refcnt; + zfs_refcount_t b_refcnt; arc_callback_t *b_acb; abd_t *b_pabd; @@ -1124,7 +1124,7 @@ struct l2arc_dev { kmutex_t l2ad_mtx; /* lock for buffer list */ list_t l2ad_buflist; /* buffer list */ list_node_t l2ad_node; /* device list node */ - refcount_t l2ad_alloc; /* allocated bytes */ + zfs_refcount_t l2ad_alloc; /* allocated bytes */ }; static list_t L2ARC_dev_list; /* device list */ @@ -1341,7 +1341,7 @@ hdr_full_cons(void *vbuf, void *unused, int kmflag) bzero(hdr, HDR_FULL_SIZE); cv_init(&hdr->b_l1hdr.b_cv, NULL, CV_DEFAULT, NULL); - refcount_create(&hdr->b_l1hdr.b_refcnt); + zfs_refcount_create(&hdr->b_l1hdr.b_refcnt); mutex_init(&hdr->b_l1hdr.b_freeze_lock, NULL, MUTEX_DEFAULT, NULL); multilist_link_init(&hdr->b_l1hdr.b_arc_node); arc_space_consume(HDR_FULL_SIZE, ARC_SPACE_HDRS); @@ -1386,7 +1386,7 @@ hdr_full_dest(void *vbuf, void *unused) ASSERT(HDR_EMPTY(hdr)); cv_destroy(&hdr->b_l1hdr.b_cv); - refcount_destroy(&hdr->b_l1hdr.b_refcnt); + zfs_refcount_destroy(&hdr->b_l1hdr.b_refcnt); mutex_destroy(&hdr->b_l1hdr.b_freeze_lock); ASSERT(!multilist_link_active(&hdr->b_l1hdr.b_arc_node)); arc_space_return(HDR_FULL_SIZE, ARC_SPACE_HDRS); @@ -2065,21 +2065,21 @@ arc_evictable_space_increment(arc_buf_hdr_t *hdr, arc_ ASSERT0(hdr->b_l1hdr.b_bufcnt); ASSERT3P(hdr->b_l1hdr.b_buf, ==, NULL); ASSERT3P(hdr->b_l1hdr.b_pabd, ==, NULL); - (void) refcount_add_many(&state->arcs_esize[type], + (void) zfs_refcount_add_many(&state->arcs_esize[type], HDR_GET_LSIZE(hdr), hdr); return; } ASSERT(!GHOST_STATE(state)); if (hdr->b_l1hdr.b_pabd != NULL) { - (void) refcount_add_many(&state->arcs_esize[type], + (void) zfs_refcount_add_many(&state->arcs_esize[type], arc_hdr_size(hdr), hdr); } for (arc_buf_t *buf = hdr->b_l1hdr.b_buf; buf != NULL; buf = buf->b_next) { if (arc_buf_is_shared(buf)) continue; - (void) refcount_add_many(&state->arcs_esize[type], + (void) zfs_refcount_add_many(&state->arcs_esize[type], arc_buf_size(buf), buf); } } @@ -2100,21 +2100,21 @@ arc_evictable_space_decrement(arc_buf_hdr_t *hdr, arc_ ASSERT0(hdr->b_l1hdr.b_bufcnt); ASSERT3P(hdr->b_l1hdr.b_buf, ==, NULL); ASSERT3P(hdr->b_l1hdr.b_pabd, ==, NULL); - (void) refcount_remove_many(&state->arcs_esize[type], + (void) zfs_refcount_remove_many(&state->arcs_esize[type], HDR_GET_LSIZE(hdr), hdr); return; } ASSERT(!GHOST_STATE(state)); if (hdr->b_l1hdr.b_pabd != NULL) { - (void) refcount_remove_many(&state->arcs_esize[type], + (void) zfs_refcount_remove_many(&state->arcs_esize[type], arc_hdr_size(hdr), hdr); } for (arc_buf_t *buf = hdr->b_l1hdr.b_buf; buf != NULL; buf = buf->b_next) { if (arc_buf_is_shared(buf)) continue; - (void) refcount_remove_many(&state->arcs_esize[type], + (void) zfs_refcount_remove_many(&state->arcs_esize[type], arc_buf_size(buf), buf); } } @@ -2131,13 +2131,13 @@ add_reference(arc_buf_hdr_t *hdr, void *tag) ASSERT(HDR_HAS_L1HDR(hdr)); if (!MUTEX_HELD(HDR_LOCK(hdr))) { ASSERT(hdr->b_l1hdr.b_state == arc_anon); - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); ASSERT3P(hdr->b_l1hdr.b_buf, ==, NULL); } arc_state_t *state = hdr->b_l1hdr.b_state; - if ((refcount_add(&hdr->b_l1hdr.b_refcnt, tag) == 1) && + if ((zfs_refcount_add(&hdr->b_l1hdr.b_refcnt, tag) == 1) && (state != arc_anon)) { /* We don't use the L2-only state list. */ if (state != arc_l2c_only) { @@ -2169,7 +2169,7 @@ remove_reference(arc_buf_hdr_t *hdr, kmutex_t *hash_lo * arc_l2c_only counts as a ghost state so we don't need to explicitly * check to prevent usage of the arc_l2c_only list. */ - if (((cnt = refcount_remove(&hdr->b_l1hdr.b_refcnt, tag)) == 0) && + if (((cnt = zfs_refcount_remove(&hdr->b_l1hdr.b_refcnt, tag)) == 0) && (state != arc_anon)) { multilist_insert(state->arcs_list[arc_buf_type(hdr)], hdr); ASSERT3U(hdr->b_l1hdr.b_bufcnt, >, 0); @@ -2201,7 +2201,7 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t */ if (HDR_HAS_L1HDR(hdr)) { old_state = hdr->b_l1hdr.b_state; - refcnt = refcount_count(&hdr->b_l1hdr.b_refcnt); + refcnt = zfs_refcount_count(&hdr->b_l1hdr.b_refcnt); bufcnt = hdr->b_l1hdr.b_bufcnt; update_old = (bufcnt > 0 || hdr->b_l1hdr.b_pabd != NULL); } else { @@ -2271,7 +2271,7 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t * the reference. As a result, we use the arc * header pointer for the reference. */ - (void) refcount_add_many(&new_state->arcs_size, + (void) zfs_refcount_add_many(&new_state->arcs_size, HDR_GET_LSIZE(hdr), hdr); ASSERT3P(hdr->b_l1hdr.b_pabd, ==, NULL); } else { @@ -2297,13 +2297,15 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t if (arc_buf_is_shared(buf)) continue; - (void) refcount_add_many(&new_state->arcs_size, + (void) zfs_refcount_add_many( + &new_state->arcs_size, arc_buf_size(buf), buf); } ASSERT3U(bufcnt, ==, buffers); if (hdr->b_l1hdr.b_pabd != NULL) { - (void) refcount_add_many(&new_state->arcs_size, + (void) zfs_refcount_add_many( + &new_state->arcs_size, arc_hdr_size(hdr), hdr); } else { ASSERT(GHOST_STATE(old_state)); @@ -2325,7 +2327,7 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t * header on the ghost state. */ - (void) refcount_remove_many(&old_state->arcs_size, + (void) zfs_refcount_remove_many(&old_state->arcs_size, HDR_GET_LSIZE(hdr), hdr); } else { uint32_t buffers = 0; @@ -2350,13 +2352,13 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t if (arc_buf_is_shared(buf)) continue; - (void) refcount_remove_many( + (void) zfs_refcount_remove_many( &old_state->arcs_size, arc_buf_size(buf), buf); } ASSERT3U(bufcnt, ==, buffers); ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL); - (void) refcount_remove_many( + (void) zfs_refcount_remove_many( &old_state->arcs_size, arc_hdr_size(hdr), hdr); } } @@ -2610,8 +2612,8 @@ arc_return_buf(arc_buf_t *buf, void *tag) ASSERT3P(buf->b_data, !=, NULL); ASSERT(HDR_HAS_L1HDR(hdr)); - (void) refcount_add(&hdr->b_l1hdr.b_refcnt, tag); - (void) refcount_remove(&hdr->b_l1hdr.b_refcnt, arc_onloan_tag); + (void) zfs_refcount_add(&hdr->b_l1hdr.b_refcnt, tag); + (void) zfs_refcount_remove(&hdr->b_l1hdr.b_refcnt, arc_onloan_tag); arc_loaned_bytes_update(-arc_buf_size(buf)); } @@ -2624,8 +2626,8 @@ arc_loan_inuse_buf(arc_buf_t *buf, void *tag) ASSERT3P(buf->b_data, !=, NULL); ASSERT(HDR_HAS_L1HDR(hdr)); - (void) refcount_add(&hdr->b_l1hdr.b_refcnt, arc_onloan_tag); - (void) refcount_remove(&hdr->b_l1hdr.b_refcnt, tag); + (void) zfs_refcount_add(&hdr->b_l1hdr.b_refcnt, arc_onloan_tag); + (void) zfs_refcount_remove(&hdr->b_l1hdr.b_refcnt, tag); arc_loaned_bytes_update(arc_buf_size(buf)); } @@ -2652,13 +2654,13 @@ arc_hdr_free_on_write(arc_buf_hdr_t *hdr) /* protected by hash lock, if in the hash table */ if (multilist_link_active(&hdr->b_l1hdr.b_arc_node)) { - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); ASSERT(state != arc_anon && state != arc_l2c_only); - (void) refcount_remove_many(&state->arcs_esize[type], + (void) zfs_refcount_remove_many(&state->arcs_esize[type], size, hdr); } - (void) refcount_remove_many(&state->arcs_size, size, hdr); + (void) zfs_refcount_remove_many(&state->arcs_size, size, hdr); if (type == ARC_BUFC_METADATA) { arc_space_return(size, ARC_SPACE_META); } else { @@ -2688,7 +2690,7 @@ arc_share_buf(arc_buf_hdr_t *hdr, arc_buf_t *buf) * refcount ownership to the hdr since it always owns * the refcount whenever an arc_buf_t is shared. */ - refcount_transfer_ownership(&state->arcs_size, buf, hdr); + zfs_refcount_transfer_ownership(&state->arcs_size, buf, hdr); hdr->b_l1hdr.b_pabd = abd_get_from_buf(buf->b_data, arc_buf_size(buf)); abd_take_ownership_of_buf(hdr->b_l1hdr.b_pabd, HDR_ISTYPE_METADATA(hdr)); @@ -2718,7 +2720,7 @@ arc_unshare_buf(arc_buf_hdr_t *hdr, arc_buf_t *buf) * We are no longer sharing this buffer so we need * to transfer its ownership to the rightful owner. */ - refcount_transfer_ownership(&state->arcs_size, hdr, buf); + zfs_refcount_transfer_ownership(&state->arcs_size, hdr, buf); arc_hdr_clear_flags(hdr, ARC_FLAG_SHARED_DATA); abd_release_ownership_of_buf(hdr->b_l1hdr.b_pabd); abd_put(hdr->b_l1hdr.b_pabd); @@ -2943,7 +2945,7 @@ arc_hdr_alloc(uint64_t spa, int32_t psize, int32_t lsi * it references and compressed arc enablement. */ arc_hdr_alloc_pabd(hdr); - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); return (hdr); } @@ -3045,8 +3047,10 @@ arc_hdr_realloc(arc_buf_hdr_t *hdr, kmem_cache_t *old, * the wrong pointer address when calling arc_hdr_destroy() later. */ - (void) refcount_remove_many(&dev->l2ad_alloc, arc_hdr_size(hdr), hdr); - (void) refcount_add_many(&dev->l2ad_alloc, arc_hdr_size(nhdr), nhdr); + (void) zfs_refcount_remove_many(&dev->l2ad_alloc, arc_hdr_size(hdr), + hdr); + (void) zfs_refcount_add_many(&dev->l2ad_alloc, arc_hdr_size(nhdr), + nhdr); buf_discard_identity(hdr); kmem_cache_free(old, hdr); @@ -3126,7 +3130,7 @@ arc_hdr_l2hdr_destroy(arc_buf_hdr_t *hdr) vdev_space_update(dev->l2ad_vdev, -psize, 0, 0); - (void) refcount_remove_many(&dev->l2ad_alloc, psize, hdr); + (void) zfs_refcount_remove_many(&dev->l2ad_alloc, psize, hdr); arc_hdr_clear_flags(hdr, ARC_FLAG_HAS_L2HDR); } @@ -3136,7 +3140,7 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr) if (HDR_HAS_L1HDR(hdr)) { ASSERT(hdr->b_l1hdr.b_buf == NULL || hdr->b_l1hdr.b_bufcnt > 0); - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); ASSERT3P(hdr->b_l1hdr.b_state, ==, arc_anon); } ASSERT(!HDR_IO_IN_PROGRESS(hdr)); @@ -3297,7 +3301,7 @@ arc_evict_hdr(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) return (bytes_evicted); } - ASSERT0(refcount_count(&hdr->b_l1hdr.b_refcnt)); + ASSERT0(zfs_refcount_count(&hdr->b_l1hdr.b_refcnt)); while (hdr->b_l1hdr.b_buf) { arc_buf_t *buf = hdr->b_l1hdr.b_buf; if (!mutex_tryenter(&buf->b_evict_lock)) { @@ -3599,7 +3603,7 @@ arc_flush_state(arc_state_t *state, uint64_t spa, arc_ { uint64_t evicted = 0; - while (refcount_count(&state->arcs_esize[type]) != 0) { + while (zfs_refcount_count(&state->arcs_esize[type]) != 0) { evicted += arc_evict_state(state, spa, ARC_EVICT_ALL, type); if (!retry) @@ -3623,8 +3627,9 @@ arc_adjust_impl(arc_state_t *state, uint64_t spa, int6 { int64_t delta; - if (bytes > 0 && refcount_count(&state->arcs_esize[type]) > 0) { - delta = MIN(refcount_count(&state->arcs_esize[type]), bytes); + if (bytes > 0 && zfs_refcount_count(&state->arcs_esize[type]) > 0) { + delta = MIN(zfs_refcount_count(&state->arcs_esize[type]), + bytes); return (arc_evict_state(state, spa, delta, type)); } @@ -3649,8 +3654,8 @@ arc_adjust_meta(uint64_t meta_used) * evict some from the MRU here, and some from the MFU below. */ target = MIN((int64_t)(meta_used - arc_meta_limit), - (int64_t)(refcount_count(&arc_anon->arcs_size) + - refcount_count(&arc_mru->arcs_size) - arc_p)); + (int64_t)(zfs_refcount_count(&arc_anon->arcs_size) + + zfs_refcount_count(&arc_mru->arcs_size) - arc_p)); total_evicted += arc_adjust_impl(arc_mru, 0, target, ARC_BUFC_METADATA); @@ -3660,7 +3665,7 @@ arc_adjust_meta(uint64_t meta_used) * space allotted to the MFU (which is defined as arc_c - arc_p). */ target = MIN((int64_t)(meta_used - arc_meta_limit), - (int64_t)(refcount_count(&arc_mfu->arcs_size) - + (int64_t)(zfs_refcount_count(&arc_mfu->arcs_size) - (arc_c - arc_p))); total_evicted += arc_adjust_impl(arc_mfu, 0, target, ARC_BUFC_METADATA); @@ -3772,8 +3777,8 @@ arc_adjust(void) * arc_p here, and then evict more from the MFU below. */ target = MIN((int64_t)(asize - arc_c), - (int64_t)(refcount_count(&arc_anon->arcs_size) + - refcount_count(&arc_mru->arcs_size) + ameta - arc_p)); + (int64_t)(zfs_refcount_count(&arc_anon->arcs_size) + + zfs_refcount_count(&arc_mru->arcs_size) + ameta - arc_p)); /* * If we're below arc_meta_min, always prefer to evict data. @@ -3857,8 +3862,8 @@ arc_adjust(void) * cache. The following logic enforces these limits on the ghost * caches, and evicts from them as needed. */ - target = refcount_count(&arc_mru->arcs_size) + - refcount_count(&arc_mru_ghost->arcs_size) - arc_c; + target = zfs_refcount_count(&arc_mru->arcs_size) + + zfs_refcount_count(&arc_mru_ghost->arcs_size) - arc_c; bytes = arc_adjust_impl(arc_mru_ghost, 0, target, ARC_BUFC_DATA); total_evicted += bytes; @@ -3876,8 +3881,8 @@ arc_adjust(void) * mru + mfu + mru ghost + mfu ghost <= 2 * arc_c * mru ghost + mfu ghost <= arc_c */ - target = refcount_count(&arc_mru_ghost->arcs_size) + - refcount_count(&arc_mfu_ghost->arcs_size) - arc_c; + target = zfs_refcount_count(&arc_mru_ghost->arcs_size) + + zfs_refcount_count(&arc_mfu_ghost->arcs_size) - arc_c; bytes = arc_adjust_impl(arc_mfu_ghost, 0, target, ARC_BUFC_DATA); total_evicted += bytes; @@ -4315,8 +4320,8 @@ arc_adapt(int bytes, arc_state_t *state) { int mult; uint64_t arc_p_min = (arc_c >> arc_p_min_shift); - int64_t mrug_size = refcount_count(&arc_mru_ghost->arcs_size); - int64_t mfug_size = refcount_count(&arc_mfu_ghost->arcs_size); + int64_t mrug_size = zfs_refcount_count(&arc_mru_ghost->arcs_size); + int64_t mfug_size = zfs_refcount_count(&arc_mfu_ghost->arcs_size); if (state == arc_l2c_only) return; @@ -4493,7 +4498,7 @@ arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, v */ if (!GHOST_STATE(state)) { - (void) refcount_add_many(&state->arcs_size, size, tag); + (void) zfs_refcount_add_many(&state->arcs_size, size, tag); /* * If this is reached via arc_read, the link is @@ -4505,8 +4510,8 @@ arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, v * trying to [add|remove]_reference it. */ if (multilist_link_active(&hdr->b_l1hdr.b_arc_node)) { - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); - (void) refcount_add_many(&state->arcs_esize[type], + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + (void) zfs_refcount_add_many(&state->arcs_esize[type], size, tag); } @@ -4516,8 +4521,8 @@ arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, v */ if (aggsum_compare(&arc_size, arc_c) < 0 && hdr->b_l1hdr.b_state == arc_anon && - (refcount_count(&arc_anon->arcs_size) + - refcount_count(&arc_mru->arcs_size) > arc_p)) + (zfs_refcount_count(&arc_anon->arcs_size) + + zfs_refcount_count(&arc_mru->arcs_size) > arc_p)) arc_p = MIN(arc_c, arc_p + size); } } @@ -4554,13 +4559,13 @@ arc_free_data_impl(arc_buf_hdr_t *hdr, uint64_t size, /* protected by hash lock, if in the hash table */ if (multilist_link_active(&hdr->b_l1hdr.b_arc_node)) { - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); ASSERT(state != arc_anon && state != arc_l2c_only); - (void) refcount_remove_many(&state->arcs_esize[type], + (void) zfs_refcount_remove_many(&state->arcs_esize[type], size, tag); } - (void) refcount_remove_many(&state->arcs_size, size, tag); + (void) zfs_refcount_remove_many(&state->arcs_size, size, tag); VERIFY3U(hdr->b_type, ==, type); if (type == ARC_BUFC_METADATA) { @@ -4607,7 +4612,7 @@ arc_access(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) * another prefetch (to make it less likely to be evicted). */ if (HDR_PREFETCH(hdr)) { - if (refcount_count(&hdr->b_l1hdr.b_refcnt) == 0) { + if (zfs_refcount_count(&hdr->b_l1hdr.b_refcnt) == 0) { /* link protected by hash lock */ ASSERT(multilist_link_active( &hdr->b_l1hdr.b_arc_node)); @@ -4645,7 +4650,7 @@ arc_access(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) if (HDR_PREFETCH(hdr)) { new_state = arc_mru; - if (refcount_count(&hdr->b_l1hdr.b_refcnt) > 0) + if (zfs_refcount_count(&hdr->b_l1hdr.b_refcnt) > 0) arc_hdr_clear_flags(hdr, ARC_FLAG_PREFETCH); DTRACE_PROBE1(new_state__mru, arc_buf_hdr_t *, hdr); } else { @@ -4668,7 +4673,7 @@ arc_access(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) * the head of the list now. */ if ((HDR_PREFETCH(hdr)) != 0) { - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); /* link protected by hash_lock */ ASSERT(multilist_link_active(&hdr->b_l1hdr.b_arc_node)); } @@ -4687,7 +4692,7 @@ arc_access(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) * This is a prefetch access... * move this block back to the MRU state. */ - ASSERT0(refcount_count(&hdr->b_l1hdr.b_refcnt)); + ASSERT0(zfs_refcount_count(&hdr->b_l1hdr.b_refcnt)); new_state = arc_mru; } @@ -4869,7 +4874,7 @@ arc_read_done(zio_t *zio) ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL); } - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt) || + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt) || callback_list != NULL); if (no_zio_error) { @@ -4880,7 +4885,7 @@ arc_read_done(zio_t *zio) arc_change_state(arc_anon, hdr, hash_lock); if (HDR_IN_HASH_TABLE(hdr)) buf_hash_remove(hdr); - freeable = refcount_is_zero(&hdr->b_l1hdr.b_refcnt); + freeable = zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt); } /* @@ -4900,7 +4905,7 @@ arc_read_done(zio_t *zio) * in the cache). */ ASSERT3P(hdr->b_l1hdr.b_state, ==, arc_anon); - freeable = refcount_is_zero(&hdr->b_l1hdr.b_refcnt); + freeable = zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt); } /* execute each callback and free its structure */ @@ -5062,7 +5067,7 @@ top: VERIFY0(arc_buf_alloc_impl(hdr, private, compressed_read, B_TRUE, &buf)); } else if (*arc_flags & ARC_FLAG_PREFETCH && - refcount_count(&hdr->b_l1hdr.b_refcnt) == 0) { + zfs_refcount_count(&hdr->b_l1hdr.b_refcnt) == 0) { arc_hdr_set_flags(hdr, ARC_FLAG_PREFETCH); } DTRACE_PROBE1(arc__hit, arc_buf_hdr_t *, hdr); @@ -5118,7 +5123,7 @@ top: ASSERT3P(hdr->b_l1hdr.b_pabd, ==, NULL); ASSERT(GHOST_STATE(hdr->b_l1hdr.b_state)); ASSERT(!HDR_IO_IN_PROGRESS(hdr)); - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); ASSERT3P(hdr->b_l1hdr.b_buf, ==, NULL); ASSERT3P(hdr->b_l1hdr.b_freeze_cksum, ==, NULL); @@ -5339,7 +5344,7 @@ arc_freed(spa_t *spa, const blkptr_t *bp) * this hdr, then we don't destroy the hdr. */ if (!HDR_HAS_L1HDR(hdr) || (!HDR_IO_IN_PROGRESS(hdr) && - refcount_is_zero(&hdr->b_l1hdr.b_refcnt))) { + zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt))) { arc_change_state(arc_anon, hdr, hash_lock); arc_hdr_destroy(hdr); mutex_exit(hash_lock); @@ -5383,7 +5388,7 @@ arc_release(arc_buf_t *buf, void *tag) ASSERT(HDR_EMPTY(hdr)); ASSERT3U(hdr->b_l1hdr.b_bufcnt, ==, 1); - ASSERT3S(refcount_count(&hdr->b_l1hdr.b_refcnt), ==, 1); + ASSERT3S(zfs_refcount_count(&hdr->b_l1hdr.b_refcnt), ==, 1); ASSERT(!list_link_active(&hdr->b_l1hdr.b_arc_node)); hdr->b_l1hdr.b_arc_access = 0; @@ -5411,7 +5416,7 @@ arc_release(arc_buf_t *buf, void *tag) ASSERT3P(state, !=, arc_anon); /* this buffer is not on any list */ - ASSERT3S(refcount_count(&hdr->b_l1hdr.b_refcnt), >, 0); + ASSERT3S(zfs_refcount_count(&hdr->b_l1hdr.b_refcnt), >, 0); if (HDR_HAS_L2HDR(hdr)) { mutex_enter(&hdr->b_l2hdr.b_dev->l2ad_mtx); @@ -5501,12 +5506,13 @@ arc_release(arc_buf_t *buf, void *tag) ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL); ASSERT3P(state, !=, arc_l2c_only); - (void) refcount_remove_many(&state->arcs_size, + (void) zfs_refcount_remove_many(&state->arcs_size, arc_buf_size(buf), buf); - if (refcount_is_zero(&hdr->b_l1hdr.b_refcnt)) { + if (zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)) { ASSERT3P(state, !=, arc_l2c_only); - (void) refcount_remove_many(&state->arcs_esize[type], + (void) zfs_refcount_remove_many( + &state->arcs_esize[type], arc_buf_size(buf), buf); } @@ -5523,21 +5529,21 @@ arc_release(arc_buf_t *buf, void *tag) nhdr = arc_hdr_alloc(spa, psize, lsize, compress, type); ASSERT3P(nhdr->b_l1hdr.b_buf, ==, NULL); ASSERT0(nhdr->b_l1hdr.b_bufcnt); - ASSERT0(refcount_count(&nhdr->b_l1hdr.b_refcnt)); + ASSERT0(zfs_refcount_count(&nhdr->b_l1hdr.b_refcnt)); VERIFY3U(nhdr->b_type, ==, type); ASSERT(!HDR_SHARED_DATA(nhdr)); nhdr->b_l1hdr.b_buf = buf; nhdr->b_l1hdr.b_bufcnt = 1; - (void) refcount_add(&nhdr->b_l1hdr.b_refcnt, tag); + (void) zfs_refcount_add(&nhdr->b_l1hdr.b_refcnt, tag); buf->b_hdr = nhdr; mutex_exit(&buf->b_evict_lock); - (void) refcount_add_many(&arc_anon->arcs_size, + (void) zfs_refcount_add_many(&arc_anon->arcs_size, arc_buf_size(buf), buf); } else { mutex_exit(&buf->b_evict_lock); - ASSERT(refcount_count(&hdr->b_l1hdr.b_refcnt) == 1); + ASSERT(zfs_refcount_count(&hdr->b_l1hdr.b_refcnt) == 1); /* protected by hash lock, or hdr is on arc_anon */ ASSERT(!multilist_link_active(&hdr->b_l1hdr.b_arc_node)); ASSERT(!HDR_IO_IN_PROGRESS(hdr)); @@ -5569,7 +5575,7 @@ arc_referenced(arc_buf_t *buf) int referenced; mutex_enter(&buf->b_evict_lock); - referenced = (refcount_count(&buf->b_hdr->b_l1hdr.b_refcnt)); + referenced = (zfs_refcount_count(&buf->b_hdr->b_l1hdr.b_refcnt)); mutex_exit(&buf->b_evict_lock); return (referenced); } @@ -5584,7 +5590,7 @@ arc_write_ready(zio_t *zio) uint64_t psize = BP_IS_HOLE(zio->io_bp) ? 0 : BP_GET_PSIZE(zio->io_bp); ASSERT(HDR_HAS_L1HDR(hdr)); - ASSERT(!refcount_is_zero(&buf->b_hdr->b_l1hdr.b_refcnt)); + ASSERT(!zfs_refcount_is_zero(&buf->b_hdr->b_l1hdr.b_refcnt)); ASSERT(hdr->b_l1hdr.b_bufcnt > 0); /* @@ -5737,7 +5743,7 @@ arc_write_done(zio_t *zio) if (!BP_EQUAL(&zio->io_bp_orig, zio->io_bp)) panic("bad overwrite, hdr=%p exists=%p", (void *)hdr, (void *)exists); - ASSERT(refcount_is_zero( + ASSERT(zfs_refcount_is_zero( &exists->b_l1hdr.b_refcnt)); arc_change_state(arc_anon, exists, hash_lock); mutex_exit(hash_lock); @@ -5767,7 +5773,7 @@ arc_write_done(zio_t *zio) arc_hdr_clear_flags(hdr, ARC_FLAG_IO_IN_PROGRESS); } - ASSERT(!refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(!zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); callback->awcb_done(zio, buf, callback->awcb_private); abd_put(zio->io_abd); @@ -5912,7 +5918,7 @@ arc_tempreserve_space(spa_t *spa, uint64_t reserve, ui /* assert that it has not wrapped around */ ASSERT3S(atomic_add_64_nv(&arc_loaned_bytes, 0), >=, 0); - anon_size = MAX((int64_t)(refcount_count(&arc_anon->arcs_size) - + anon_size = MAX((int64_t)(zfs_refcount_count(&arc_anon->arcs_size) - arc_loaned_bytes), 0); /* @@ -5947,9 +5953,10 @@ arc_tempreserve_space(spa_t *spa, uint64_t reserve, ui anon_size > arc_c * zfs_arc_anon_limit_percent / 100 && spa_dirty_anon > anon_size * zfs_arc_pool_dirty_percent / 100) { uint64_t meta_esize = - refcount_count(&arc_anon->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_count( + &arc_anon->arcs_esize[ARC_BUFC_METADATA]); uint64_t data_esize = - refcount_count(&arc_anon->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_count(&arc_anon->arcs_esize[ARC_BUFC_DATA]); dprintf("failing, arc_tempreserve=%lluK anon_meta=%lluK " "anon_data=%lluK tempreserve=%lluK arc_c=%lluK\n", arc_tempreserve >> 10, meta_esize >> 10, @@ -5964,11 +5971,11 @@ static void arc_kstat_update_state(arc_state_t *state, kstat_named_t *size, kstat_named_t *evict_data, kstat_named_t *evict_metadata) { - size->value.ui64 = refcount_count(&state->arcs_size); + size->value.ui64 = zfs_refcount_count(&state->arcs_size); evict_data->value.ui64 = - refcount_count(&state->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_count(&state->arcs_esize[ARC_BUFC_DATA]); evict_metadata->value.ui64 = - refcount_count(&state->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_count(&state->arcs_esize[ARC_BUFC_METADATA]); } static int @@ -6099,25 +6106,25 @@ arc_state_init(void) offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - refcount_create(&arc_anon->arcs_esize[ARC_BUFC_METADATA]); - refcount_create(&arc_anon->arcs_esize[ARC_BUFC_DATA]); - refcount_create(&arc_mru->arcs_esize[ARC_BUFC_METADATA]); - refcount_create(&arc_mru->arcs_esize[ARC_BUFC_DATA]); - refcount_create(&arc_mru_ghost->arcs_esize[ARC_BUFC_METADATA]); - refcount_create(&arc_mru_ghost->arcs_esize[ARC_BUFC_DATA]); - refcount_create(&arc_mfu->arcs_esize[ARC_BUFC_METADATA]); - refcount_create(&arc_mfu->arcs_esize[ARC_BUFC_DATA]); - refcount_create(&arc_mfu_ghost->arcs_esize[ARC_BUFC_METADATA]); - refcount_create(&arc_mfu_ghost->arcs_esize[ARC_BUFC_DATA]); - refcount_create(&arc_l2c_only->arcs_esize[ARC_BUFC_METADATA]); - refcount_create(&arc_l2c_only->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_create(&arc_anon->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_create(&arc_anon->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_create(&arc_mru->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_create(&arc_mru->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_create(&arc_mru_ghost->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_create(&arc_mru_ghost->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_create(&arc_mfu->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_create(&arc_mfu->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_create(&arc_mfu_ghost->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_create(&arc_mfu_ghost->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_create(&arc_l2c_only->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_create(&arc_l2c_only->arcs_esize[ARC_BUFC_DATA]); - refcount_create(&arc_anon->arcs_size); - refcount_create(&arc_mru->arcs_size); - refcount_create(&arc_mru_ghost->arcs_size); - refcount_create(&arc_mfu->arcs_size); - refcount_create(&arc_mfu_ghost->arcs_size); - refcount_create(&arc_l2c_only->arcs_size); + zfs_refcount_create(&arc_anon->arcs_size); + zfs_refcount_create(&arc_mru->arcs_size); + zfs_refcount_create(&arc_mru_ghost->arcs_size); + zfs_refcount_create(&arc_mfu->arcs_size); + zfs_refcount_create(&arc_mfu_ghost->arcs_size); + zfs_refcount_create(&arc_l2c_only->arcs_size); aggsum_init(&arc_meta_used, 0); aggsum_init(&arc_size, 0); @@ -6131,25 +6138,25 @@ arc_state_init(void) static void arc_state_fini(void) { - refcount_destroy(&arc_anon->arcs_esize[ARC_BUFC_METADATA]); - refcount_destroy(&arc_anon->arcs_esize[ARC_BUFC_DATA]); - refcount_destroy(&arc_mru->arcs_esize[ARC_BUFC_METADATA]); - refcount_destroy(&arc_mru->arcs_esize[ARC_BUFC_DATA]); - refcount_destroy(&arc_mru_ghost->arcs_esize[ARC_BUFC_METADATA]); - refcount_destroy(&arc_mru_ghost->arcs_esize[ARC_BUFC_DATA]); - refcount_destroy(&arc_mfu->arcs_esize[ARC_BUFC_METADATA]); - refcount_destroy(&arc_mfu->arcs_esize[ARC_BUFC_DATA]); - refcount_destroy(&arc_mfu_ghost->arcs_esize[ARC_BUFC_METADATA]); - refcount_destroy(&arc_mfu_ghost->arcs_esize[ARC_BUFC_DATA]); - refcount_destroy(&arc_l2c_only->arcs_esize[ARC_BUFC_METADATA]); - refcount_destroy(&arc_l2c_only->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_destroy(&arc_anon->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_destroy(&arc_anon->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_destroy(&arc_mru->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_destroy(&arc_mru->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_destroy(&arc_mru_ghost->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_destroy(&arc_mru_ghost->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_destroy(&arc_mfu->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_destroy(&arc_mfu->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_destroy(&arc_mfu_ghost->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_destroy(&arc_mfu_ghost->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_destroy(&arc_l2c_only->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_destroy(&arc_l2c_only->arcs_esize[ARC_BUFC_DATA]); - refcount_destroy(&arc_anon->arcs_size); - refcount_destroy(&arc_mru->arcs_size); - refcount_destroy(&arc_mru_ghost->arcs_size); - refcount_destroy(&arc_mfu->arcs_size); - refcount_destroy(&arc_mfu_ghost->arcs_size); - refcount_destroy(&arc_l2c_only->arcs_size); + zfs_refcount_destroy(&arc_anon->arcs_size); + zfs_refcount_destroy(&arc_mru->arcs_size); + zfs_refcount_destroy(&arc_mru_ghost->arcs_size); + zfs_refcount_destroy(&arc_mfu->arcs_size); + zfs_refcount_destroy(&arc_mfu_ghost->arcs_size); + zfs_refcount_destroy(&arc_l2c_only->arcs_size); multilist_destroy(arc_mru->arcs_list[ARC_BUFC_METADATA]); multilist_destroy(arc_mru_ghost->arcs_list[ARC_BUFC_METADATA]); @@ -6729,7 +6736,7 @@ top: ARCSTAT_INCR(arcstat_l2_lsize, -HDR_GET_LSIZE(hdr)); bytes_dropped += arc_hdr_size(hdr); - (void) refcount_remove_many(&dev->l2ad_alloc, + (void) zfs_refcount_remove_many(&dev->l2ad_alloc, arc_hdr_size(hdr), hdr); } @@ -7135,7 +7142,8 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint list_insert_head(&dev->l2ad_buflist, hdr); mutex_exit(&dev->l2ad_mtx); - (void) refcount_add_many(&dev->l2ad_alloc, psize, hdr); + (void) zfs_refcount_add_many(&dev->l2ad_alloc, psize, + hdr); /* * Normally the L2ARC can use the hdr's data, but if @@ -7367,7 +7375,7 @@ l2arc_add_vdev(spa_t *spa, vdev_t *vd) offsetof(arc_buf_hdr_t, b_l2hdr.b_l2node)); vdev_space_update(vd, 0, 0, adddev->l2ad_end - adddev->l2ad_hand); - refcount_create(&adddev->l2ad_alloc); + zfs_refcount_create(&adddev->l2ad_alloc); /* * Add device to global list @@ -7413,7 +7421,7 @@ l2arc_remove_vdev(vdev_t *vd) l2arc_evict(remdev, 0, B_TRUE); list_destroy(&remdev->l2ad_buflist); mutex_destroy(&remdev->l2ad_mtx); - refcount_destroy(&remdev->l2ad_alloc); + zfs_refcount_destroy(&remdev->l2ad_alloc); kmem_free(remdev, sizeof (l2arc_dev_t)); } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c Tue Oct 15 14:29:30 2019 (r353560) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c Tue Oct 15 14:33:42 2019 (r353561) @@ -105,7 +105,7 @@ static boolean_t dbuf_evict_thread_exit; */ typedef struct dbuf_cache { multilist_t *cache; - refcount_t size; + zfs_refcount_t size; } dbuf_cache_t; dbuf_cache_t dbuf_caches[DB_CACHE_MAX]; @@ -178,7 +178,7 @@ dbuf_cons(void *vdb, void *unused, int kmflag) mutex_init(&db->db_mtx, NULL, MUTEX_DEFAULT, NULL); cv_init(&db->db_changed, NULL, CV_DEFAULT, NULL); multilist_link_init(&db->db_cache_link); - refcount_create(&db->db_holds); + zfs_refcount_create(&db->db_holds); return (0); } @@ -191,7 +191,7 @@ dbuf_dest(void *vdb, void *unused) mutex_destroy(&db->db_mtx); cv_destroy(&db->db_changed); ASSERT(!multilist_link_active(&db->db_cache_link)); - refcount_destroy(&db->db_holds); + zfs_refcount_destroy(&db->db_holds); } /* @@ -313,7 +313,7 @@ dbuf_hash_remove(dmu_buf_impl_t *db) * We musn't hold db_mtx to maintain lock ordering: * DBUF_HASH_MUTEX > db_mtx. */ - ASSERT(refcount_is_zero(&db->db_holds)); + ASSERT(zfs_refcount_is_zero(&db->db_holds)); ASSERT(db->db_state == DB_EVICTING); ASSERT(!MUTEX_HELD(&db->db_mtx)); @@ -350,7 +350,7 @@ dbuf_verify_user(dmu_buf_impl_t *db, dbvu_verify_type_ ASSERT(db->db.db_data != NULL); ASSERT3U(db->db_state, ==, DB_CACHED); - holds = refcount_count(&db->db_holds); + holds = zfs_refcount_count(&db->db_holds); if (verify_type == DBVU_EVICTING) { /* * Immediate eviction occurs when holds == dirtycnt. @@ -447,7 +447,8 @@ dbuf_include_in_metadata_cache(dmu_buf_impl_t *db) * Sanity check for small-memory systems: don't allocate too * much memory for this purpose. */ - if (refcount_count(&dbuf_caches[DB_DBUF_METADATA_CACHE].size) > + if (zfs_refcount_count( + &dbuf_caches[DB_DBUF_METADATA_CACHE].size) > dbuf_metadata_cache_max_bytes) { dbuf_metadata_cache_overflow++; DTRACE_PROBE1(dbuf__metadata__cache__overflow, @@ -496,7 +497,7 @@ dbuf_cache_above_hiwater(void) uint64_t dbuf_cache_hiwater_bytes = (dbuf_cache_max_bytes * dbuf_cache_hiwater_pct) / 100; - return (refcount_count(&dbuf_caches[DB_DBUF_CACHE].size) > + return (zfs_refcount_count(&dbuf_caches[DB_DBUF_CACHE].size) > dbuf_cache_max_bytes + dbuf_cache_hiwater_bytes); } @@ -506,7 +507,7 @@ dbuf_cache_above_lowater(void) uint64_t dbuf_cache_lowater_bytes = (dbuf_cache_max_bytes * dbuf_cache_lowater_pct) / 100; - return (refcount_count(&dbuf_caches[DB_DBUF_CACHE].size) > + return (zfs_refcount_count(&dbuf_caches[DB_DBUF_CACHE].size) > dbuf_cache_max_bytes - dbuf_cache_lowater_bytes); } @@ -533,7 +534,8 @@ dbuf_evict_one(void) if (db != NULL) { multilist_sublist_remove(mls, db); multilist_sublist_unlock(mls); - (void) refcount_remove_many(&dbuf_caches[DB_DBUF_CACHE].size, + (void) zfs_refcount_remove_many( + &dbuf_caches[DB_DBUF_CACHE].size, db->db.db_size, db); ASSERT3U(db->db_caching_status, ==, DB_DBUF_CACHE); db->db_caching_status = DB_NO_CACHE; @@ -599,7 +601,7 @@ dbuf_evict_notify(void) * because it's OK to occasionally make the wrong decision here, * and grabbing the lock results in massive lock contention. */ - if (refcount_count(&dbuf_caches[DB_DBUF_CACHE].size) > + if (zfs_refcount_count(&dbuf_caches[DB_DBUF_CACHE].size) > dbuf_cache_max_bytes) { if (dbuf_cache_above_hiwater()) dbuf_evict_one(); @@ -667,7 +669,7 @@ retry: multilist_create(sizeof (dmu_buf_impl_t), offsetof(dmu_buf_impl_t, db_cache_link), dbuf_cache_multilist_index_func); - refcount_create(&dbuf_caches[dcs].size); + zfs_refcount_create(&dbuf_caches[dcs].size); } dbuf_evict_thread_exit = B_FALSE; @@ -701,7 +703,7 @@ dbuf_fini(void) cv_destroy(&dbuf_evict_cv); for (dbuf_cached_state_t dcs = 0; dcs < DB_CACHE_MAX; dcs++) { - refcount_destroy(&dbuf_caches[dcs].size); + zfs_refcount_destroy(&dbuf_caches[dcs].size); multilist_destroy(dbuf_caches[dcs].cache); } } @@ -887,7 +889,7 @@ dbuf_loan_arcbuf(dmu_buf_impl_t *db) ASSERT(db->db_blkid != DMU_BONUS_BLKID); mutex_enter(&db->db_mtx); - if (arc_released(db->db_buf) || refcount_count(&db->db_holds) > 1) { + if (arc_released(db->db_buf) || zfs_refcount_count(&db->db_holds) > 1) { int blksz = db->db.db_size; spa_t *spa = db->db_objset->os_spa; @@ -949,7 +951,7 @@ dbuf_read_done(zio_t *zio, arc_buf_t *buf, void *vdb) /* * All reads are synchronous, so we must have a hold on the dbuf */ - ASSERT(refcount_count(&db->db_holds) > 0); + ASSERT(zfs_refcount_count(&db->db_holds) > 0); ASSERT(db->db_buf == NULL); ASSERT(db->db.db_data == NULL); if (buf == NULL) { @@ -986,7 +988,7 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_ DB_DNODE_ENTER(db); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Oct 15 14:45:33 2019 Return-Path: Delivered-To: svn-src-all@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 E0B5F14951D; Tue, 15 Oct 2019 14:45:33 +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 46sys95h5Wz4K5W; Tue, 15 Oct 2019 14:45:33 +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 A74B5201A9; Tue, 15 Oct 2019 14:45:33 +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 x9FEjXOk019088; Tue, 15 Oct 2019 14:45:33 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FEjXOu019087; Tue, 15 Oct 2019 14:45:33 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910151445.x9FEjXOu019087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 15 Oct 2019 14:45:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r353562 - releng/12.1/sys/kern X-SVN-Group: releng X-SVN-Commit-Author: markj X-SVN-Commit-Paths: releng/12.1/sys/kern X-SVN-Commit-Revision: 353562 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 14:45:33 -0000 Author: markj Date: Tue Oct 15 14:45:33 2019 New Revision: 353562 URL: https://svnweb.freebsd.org/changeset/base/353562 Log: MFS r353554: Fix handling of empty SCM_RIGHTS messages. Approved by: re (kib) Modified: releng/12.1/sys/kern/uipc_usrreq.c Directory Properties: releng/12.1/ (props changed) Modified: releng/12.1/sys/kern/uipc_usrreq.c ============================================================================== --- releng/12.1/sys/kern/uipc_usrreq.c Tue Oct 15 14:33:42 2019 (r353561) +++ releng/12.1/sys/kern/uipc_usrreq.c Tue Oct 15 14:45:33 2019 (r353562) @@ -2318,7 +2318,8 @@ unp_internalize(struct mbuf **controlp, struct thread goto out; } - controlp = &(*controlp)->m_next; + if (*controlp != NULL) + controlp = &(*controlp)->m_next; if (CMSG_SPACE(datalen) < clen) { clen -= CMSG_SPACE(datalen); cm = (struct cmsghdr *) From owner-svn-src-all@freebsd.org Tue Oct 15 14:48:01 2019 Return-Path: Delivered-To: svn-src-all@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 651721499B1; Tue, 15 Oct 2019 14:48:01 +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 46syw122yPz4KMT; Tue, 15 Oct 2019 14:48:01 +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 2559A201AA; Tue, 15 Oct 2019 14:48:01 +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 x9FEm0Qj019243; Tue, 15 Oct 2019 14:48:00 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FEm0BN019242; Tue, 15 Oct 2019 14:48:00 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910151448.x9FEm0BN019242@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 15 Oct 2019 14:48:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353563 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 353563 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 14:48:01 -0000 Author: tuexen Date: Tue Oct 15 14:48:00 2019 New Revision: 353563 URL: https://svnweb.freebsd.org/changeset/base/353563 Log: MFC r353452: Ensure that local variables are reset to their initial value when dealing with error cases in a loop over all remote addresses. This issue was found and reported by OSS_Fuzz in: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18080 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18086 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18121 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18163 Modified: stable/12/sys/netinet/sctp_output.c Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Tue Oct 15 14:45:33 2019 (r353562) +++ stable/12/sys/netinet/sctp_output.c Tue Oct 15 14:48:00 2019 (r353563) @@ -7872,8 +7872,8 @@ sctp_med_chunk_output(struct sctp_inpcb *inp, int bundle_at, ctl_cnt, no_data_chunks, eeor_mode; unsigned int mtu, r_mtu, omtu, mx_mtu, to_out; int tsns_sent = 0; - uint32_t auth_offset = 0; - struct sctp_auth_chunk *auth = NULL; + uint32_t auth_offset; + struct sctp_auth_chunk *auth; uint16_t auth_keyid; int override_ok = 1; int skip_fill_up = 0; @@ -8068,6 +8068,8 @@ again_one_more_time: } bundle_at = 0; endoutchain = outchain = NULL; + auth = NULL; + auth_offset = 0; no_fragmentflg = 1; one_chunk = 0; if (net->dest_state & SCTP_ADDR_UNCONFIRMED) { From owner-svn-src-all@freebsd.org Tue Oct 15 14:51:23 2019 Return-Path: Delivered-To: svn-src-all@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 4CA7D149C55; Tue, 15 Oct 2019 14:51:23 +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 46syzv1Mlqz4Kc0; Tue, 15 Oct 2019 14:51:23 +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 12F27202FB; Tue, 15 Oct 2019 14:51:23 +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 x9FEpMBr022354; Tue, 15 Oct 2019 14:51:22 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FEpM5K022353; Tue, 15 Oct 2019 14:51:22 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910151451.x9FEpM5K022353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 15 Oct 2019 14:51:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353564 - stable/12/tests/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/tests/sys/kern X-SVN-Commit-Revision: 353564 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 14:51:23 -0000 Author: markj Date: Tue Oct 15 14:51:22 2019 New Revision: 353564 URL: https://svnweb.freebsd.org/changeset/base/353564 Log: MFC r353333: Fix a bug in r353332 that snuck in with a last-minute adjustment. Modified: stable/12/tests/sys/kern/unix_passfd_test.c Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/kern/unix_passfd_test.c ============================================================================== --- stable/12/tests/sys/kern/unix_passfd_test.c Tue Oct 15 14:48:00 2019 (r353563) +++ stable/12/tests/sys/kern/unix_passfd_test.c Tue Oct 15 14:51:22 2019 (r353564) @@ -659,7 +659,7 @@ ATF_TC_BODY(empty_rights_message, tc) len = recvmsg(fd[1], &msghdr, 0); ATF_REQUIRE_MSG(len == 0, "recvmsg failed: %s", strerror(errno)); ATF_REQUIRE(msghdr.msg_controllen = CMSG_SPACE(sizeof(int))); - error = close((int *)CMSG_DATA(msghdr.msg_control)); + error = close(*(int *)CMSG_DATA(msghdr.msg_control)); ATF_REQUIRE_MSG(error == 0, "close failed: %s", strerror(errno)); /* @@ -685,7 +685,7 @@ ATF_TC_BODY(empty_rights_message, tc) len = recvmsg(fd[1], &msghdr, 0); ATF_REQUIRE_MSG(len == 0, "recvmsg failed: %s", strerror(errno)); ATF_REQUIRE(msghdr.msg_controllen = CMSG_SPACE(sizeof(int))); - error = close((int *)CMSG_DATA(msghdr.msg_control)); + error = close(*(int *)CMSG_DATA(msghdr.msg_control)); ATF_REQUIRE_MSG(error == 0, "close failed: %s", strerror(errno)); (void)close(putfd); From owner-svn-src-all@freebsd.org Tue Oct 15 15:09:37 2019 Return-Path: Delivered-To: svn-src-all@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 6F4E614A1F3; Tue, 15 Oct 2019 15:09:37 +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 46szNx34Xpz4Lcn; Tue, 15 Oct 2019 15:09:37 +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 4C8EC20573; Tue, 15 Oct 2019 15:09:37 +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 x9FF9b4c031351; Tue, 15 Oct 2019 15:09:37 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FF9a2B031347; Tue, 15 Oct 2019 15:09:36 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910151509.x9FF9a2B031347@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 15 Oct 2019 15:09:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353565 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 353565 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 15:09:37 -0000 Author: avg Date: Tue Oct 15 15:09:36 2019 New Revision: 353565 URL: https://svnweb.freebsd.org/changeset/base/353565 Log: MFV r353561: 10343 ZoL: Prefix all refcount functions with zfs_ illumos/illumos-gate@e914ace2e9d9bf2dbf9a1f1ce81cb776022096f5 https://github.com/illumos/illumos-gate/commit/e914ace2e9d9bf2dbf9a1f1ce81cb776022096f5 https://www.illumos.org/issues/10343 On the openzfs feature/porting matrix, this is listed as: prefix to refcount funcs/types Having these changes will make it easier to share other work across the different ZFS operating systems. PR 7963 424fd7c3e Prefix all refcount functions with zfs_ PR 7885 & 7932 c13060e47 Linux 4.19-rc3+ compat: Remove refcount_t compat PR 5823 & 5842 4859fe796 Linux 4.11 compat: avoid refcount_t name conflict Author: Tim Schumacher Obtained from: illumos, ZoL MFC after: 3 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c Tue Oct 15 14:51:22 2019 (r353564) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c Tue Oct 15 15:09:36 2019 (r353565) @@ -304,7 +304,7 @@ abd_alloc(size_t size, boolean_t is_metadata) } abd->abd_size = size; abd->abd_parent = NULL; - refcount_create(&abd->abd_children); + zfs_refcount_create(&abd->abd_children); abd->abd_u.abd_scatter.abd_offset = 0; abd->abd_u.abd_scatter.abd_chunk_size = zfs_abd_chunk_size; @@ -331,7 +331,7 @@ abd_free_scatter(abd_t *abd) abd_free_chunk(abd->abd_u.abd_scatter.abd_chunks[i]); } - refcount_destroy(&abd->abd_children); + zfs_refcount_destroy(&abd->abd_children); ABDSTAT_BUMPDOWN(abdstat_scatter_cnt); ABDSTAT_INCR(abdstat_scatter_data_size, -(int)abd->abd_size); ABDSTAT_INCR(abdstat_scatter_chunk_waste, @@ -358,7 +358,7 @@ abd_alloc_linear(size_t size, boolean_t is_metadata) } abd->abd_size = size; abd->abd_parent = NULL; - refcount_create(&abd->abd_children); + zfs_refcount_create(&abd->abd_children); if (is_metadata) { abd->abd_u.abd_linear.abd_buf = zio_buf_alloc(size); @@ -381,7 +381,7 @@ abd_free_linear(abd_t *abd) zio_data_buf_free(abd->abd_u.abd_linear.abd_buf, abd->abd_size); } - refcount_destroy(&abd->abd_children); + zfs_refcount_destroy(&abd->abd_children); ABDSTAT_BUMPDOWN(abdstat_linear_cnt); ABDSTAT_INCR(abdstat_linear_data_size, -(int)abd->abd_size); @@ -487,8 +487,8 @@ abd_get_offset(abd_t *sabd, size_t off) abd->abd_size = sabd->abd_size - off; abd->abd_parent = sabd; - refcount_create(&abd->abd_children); - (void) refcount_add_many(&sabd->abd_children, abd->abd_size, abd); + zfs_refcount_create(&abd->abd_children); + (void) zfs_refcount_add_many(&sabd->abd_children, abd->abd_size, abd); return (abd); } @@ -512,7 +512,7 @@ abd_get_from_buf(void *buf, size_t size) abd->abd_flags = ABD_FLAG_LINEAR; abd->abd_size = size; abd->abd_parent = NULL; - refcount_create(&abd->abd_children); + zfs_refcount_create(&abd->abd_children); abd->abd_u.abd_linear.abd_buf = buf; @@ -530,11 +530,11 @@ abd_put(abd_t *abd) ASSERT(!(abd->abd_flags & ABD_FLAG_OWNER)); if (abd->abd_parent != NULL) { - (void) refcount_remove_many(&abd->abd_parent->abd_children, + (void) zfs_refcount_remove_many(&abd->abd_parent->abd_children, abd->abd_size, abd); } - refcount_destroy(&abd->abd_children); + zfs_refcount_destroy(&abd->abd_children); abd_free_struct(abd); } @@ -566,7 +566,7 @@ abd_borrow_buf(abd_t *abd, size_t n) } else { buf = zio_buf_alloc(n); } - (void) refcount_add_many(&abd->abd_children, n, buf); + (void) zfs_refcount_add_many(&abd->abd_children, n, buf); return (buf); } @@ -598,7 +598,7 @@ abd_return_buf(abd_t *abd, void *buf, size_t n) ASSERT0(abd_cmp_buf(abd, buf, n)); zio_buf_free(buf, n); } - (void) refcount_remove_many(&abd->abd_children, n, buf); + (void) zfs_refcount_remove_many(&abd->abd_children, n, buf); } void Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Oct 15 14:51:22 2019 (r353564) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Oct 15 15:09:36 2019 (r353565) @@ -538,12 +538,12 @@ typedef struct arc_state { /* * total amount of evictable data in this state */ - refcount_t arcs_esize[ARC_BUFC_NUMTYPES]; + zfs_refcount_t arcs_esize[ARC_BUFC_NUMTYPES]; /* * total amount of data in this state; this includes: evictable, * non-evictable, ARC_BUFC_DATA, and ARC_BUFC_METADATA. */ - refcount_t arcs_size; + zfs_refcount_t arcs_size; /* * supports the "dbufs" kstat */ @@ -1158,7 +1158,7 @@ typedef struct l1arc_buf_hdr { uint32_t b_l2_hits; /* self protecting */ - refcount_t b_refcnt; + zfs_refcount_t b_refcnt; arc_callback_t *b_acb; abd_t *b_pabd; @@ -1534,7 +1534,7 @@ struct l2arc_dev { kmutex_t l2ad_mtx; /* lock for buffer list */ list_t l2ad_buflist; /* buffer list */ list_node_t l2ad_node; /* device list node */ - refcount_t l2ad_alloc; /* allocated bytes */ + zfs_refcount_t l2ad_alloc; /* allocated bytes */ }; static list_t L2ARC_dev_list; /* device list */ @@ -1765,7 +1765,7 @@ hdr_full_cons(void *vbuf, void *unused, int kmflag) bzero(hdr, HDR_FULL_SIZE); cv_init(&hdr->b_l1hdr.b_cv, NULL, CV_DEFAULT, NULL); - refcount_create(&hdr->b_l1hdr.b_refcnt); + zfs_refcount_create(&hdr->b_l1hdr.b_refcnt); mutex_init(&hdr->b_l1hdr.b_freeze_lock, NULL, MUTEX_DEFAULT, NULL); multilist_link_init(&hdr->b_l1hdr.b_arc_node); arc_space_consume(HDR_FULL_SIZE, ARC_SPACE_HDRS); @@ -1810,7 +1810,7 @@ hdr_full_dest(void *vbuf, void *unused) ASSERT(HDR_EMPTY(hdr)); cv_destroy(&hdr->b_l1hdr.b_cv); - refcount_destroy(&hdr->b_l1hdr.b_refcnt); + zfs_refcount_destroy(&hdr->b_l1hdr.b_refcnt); mutex_destroy(&hdr->b_l1hdr.b_freeze_lock); ASSERT(!multilist_link_active(&hdr->b_l1hdr.b_arc_node)); arc_space_return(HDR_FULL_SIZE, ARC_SPACE_HDRS); @@ -2495,21 +2495,21 @@ arc_evictable_space_increment(arc_buf_hdr_t *hdr, arc_ ASSERT0(hdr->b_l1hdr.b_bufcnt); ASSERT3P(hdr->b_l1hdr.b_buf, ==, NULL); ASSERT3P(hdr->b_l1hdr.b_pabd, ==, NULL); - (void) refcount_add_many(&state->arcs_esize[type], + (void) zfs_refcount_add_many(&state->arcs_esize[type], HDR_GET_LSIZE(hdr), hdr); return; } ASSERT(!GHOST_STATE(state)); if (hdr->b_l1hdr.b_pabd != NULL) { - (void) refcount_add_many(&state->arcs_esize[type], + (void) zfs_refcount_add_many(&state->arcs_esize[type], arc_hdr_size(hdr), hdr); } for (arc_buf_t *buf = hdr->b_l1hdr.b_buf; buf != NULL; buf = buf->b_next) { if (arc_buf_is_shared(buf)) continue; - (void) refcount_add_many(&state->arcs_esize[type], + (void) zfs_refcount_add_many(&state->arcs_esize[type], arc_buf_size(buf), buf); } } @@ -2530,21 +2530,21 @@ arc_evictable_space_decrement(arc_buf_hdr_t *hdr, arc_ ASSERT0(hdr->b_l1hdr.b_bufcnt); ASSERT3P(hdr->b_l1hdr.b_buf, ==, NULL); ASSERT3P(hdr->b_l1hdr.b_pabd, ==, NULL); - (void) refcount_remove_many(&state->arcs_esize[type], + (void) zfs_refcount_remove_many(&state->arcs_esize[type], HDR_GET_LSIZE(hdr), hdr); return; } ASSERT(!GHOST_STATE(state)); if (hdr->b_l1hdr.b_pabd != NULL) { - (void) refcount_remove_many(&state->arcs_esize[type], + (void) zfs_refcount_remove_many(&state->arcs_esize[type], arc_hdr_size(hdr), hdr); } for (arc_buf_t *buf = hdr->b_l1hdr.b_buf; buf != NULL; buf = buf->b_next) { if (arc_buf_is_shared(buf)) continue; - (void) refcount_remove_many(&state->arcs_esize[type], + (void) zfs_refcount_remove_many(&state->arcs_esize[type], arc_buf_size(buf), buf); } } @@ -2561,13 +2561,13 @@ add_reference(arc_buf_hdr_t *hdr, void *tag) ASSERT(HDR_HAS_L1HDR(hdr)); if (!MUTEX_HELD(HDR_LOCK(hdr))) { ASSERT(hdr->b_l1hdr.b_state == arc_anon); - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); ASSERT3P(hdr->b_l1hdr.b_buf, ==, NULL); } arc_state_t *state = hdr->b_l1hdr.b_state; - if ((refcount_add(&hdr->b_l1hdr.b_refcnt, tag) == 1) && + if ((zfs_refcount_add(&hdr->b_l1hdr.b_refcnt, tag) == 1) && (state != arc_anon)) { /* We don't use the L2-only state list. */ if (state != arc_l2c_only) { @@ -2599,7 +2599,7 @@ remove_reference(arc_buf_hdr_t *hdr, kmutex_t *hash_lo * arc_l2c_only counts as a ghost state so we don't need to explicitly * check to prevent usage of the arc_l2c_only list. */ - if (((cnt = refcount_remove(&hdr->b_l1hdr.b_refcnt, tag)) == 0) && + if (((cnt = zfs_refcount_remove(&hdr->b_l1hdr.b_refcnt, tag)) == 0) && (state != arc_anon)) { multilist_insert(state->arcs_list[arc_buf_type(hdr)], hdr); ASSERT3U(hdr->b_l1hdr.b_bufcnt, >, 0); @@ -2644,7 +2644,7 @@ arc_buf_info(arc_buf_t *ab, arc_buf_info_t *abi, int s abi->abi_mru_ghost_hits = l1hdr->b_mru_ghost_hits; abi->abi_mfu_hits = l1hdr->b_mfu_hits; abi->abi_mfu_ghost_hits = l1hdr->b_mfu_ghost_hits; - abi->abi_holds = refcount_count(&l1hdr->b_refcnt); + abi->abi_holds = zfs_refcount_count(&l1hdr->b_refcnt); } if (l2hdr) { @@ -2680,7 +2680,7 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t */ if (HDR_HAS_L1HDR(hdr)) { old_state = hdr->b_l1hdr.b_state; - refcnt = refcount_count(&hdr->b_l1hdr.b_refcnt); + refcnt = zfs_refcount_count(&hdr->b_l1hdr.b_refcnt); bufcnt = hdr->b_l1hdr.b_bufcnt; update_old = (bufcnt > 0 || hdr->b_l1hdr.b_pabd != NULL); } else { @@ -2750,7 +2750,7 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t * the reference. As a result, we use the arc * header pointer for the reference. */ - (void) refcount_add_many(&new_state->arcs_size, + (void) zfs_refcount_add_many(&new_state->arcs_size, HDR_GET_LSIZE(hdr), hdr); ASSERT3P(hdr->b_l1hdr.b_pabd, ==, NULL); } else { @@ -2776,13 +2776,15 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t if (arc_buf_is_shared(buf)) continue; - (void) refcount_add_many(&new_state->arcs_size, + (void) zfs_refcount_add_many( + &new_state->arcs_size, arc_buf_size(buf), buf); } ASSERT3U(bufcnt, ==, buffers); if (hdr->b_l1hdr.b_pabd != NULL) { - (void) refcount_add_many(&new_state->arcs_size, + (void) zfs_refcount_add_many( + &new_state->arcs_size, arc_hdr_size(hdr), hdr); } else { ASSERT(GHOST_STATE(old_state)); @@ -2804,7 +2806,7 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t * header on the ghost state. */ - (void) refcount_remove_many(&old_state->arcs_size, + (void) zfs_refcount_remove_many(&old_state->arcs_size, HDR_GET_LSIZE(hdr), hdr); } else { uint32_t buffers = 0; @@ -2829,13 +2831,13 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t if (arc_buf_is_shared(buf)) continue; - (void) refcount_remove_many( + (void) zfs_refcount_remove_many( &old_state->arcs_size, arc_buf_size(buf), buf); } ASSERT3U(bufcnt, ==, buffers); ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL); - (void) refcount_remove_many( + (void) zfs_refcount_remove_many( &old_state->arcs_size, arc_hdr_size(hdr), hdr); } } @@ -3101,8 +3103,8 @@ arc_return_buf(arc_buf_t *buf, void *tag) ASSERT3P(buf->b_data, !=, NULL); ASSERT(HDR_HAS_L1HDR(hdr)); - (void) refcount_add(&hdr->b_l1hdr.b_refcnt, tag); - (void) refcount_remove(&hdr->b_l1hdr.b_refcnt, arc_onloan_tag); + (void) zfs_refcount_add(&hdr->b_l1hdr.b_refcnt, tag); + (void) zfs_refcount_remove(&hdr->b_l1hdr.b_refcnt, arc_onloan_tag); arc_loaned_bytes_update(-arc_buf_size(buf)); } @@ -3115,8 +3117,8 @@ arc_loan_inuse_buf(arc_buf_t *buf, void *tag) ASSERT3P(buf->b_data, !=, NULL); ASSERT(HDR_HAS_L1HDR(hdr)); - (void) refcount_add(&hdr->b_l1hdr.b_refcnt, arc_onloan_tag); - (void) refcount_remove(&hdr->b_l1hdr.b_refcnt, tag); + (void) zfs_refcount_add(&hdr->b_l1hdr.b_refcnt, arc_onloan_tag); + (void) zfs_refcount_remove(&hdr->b_l1hdr.b_refcnt, tag); arc_loaned_bytes_update(arc_buf_size(buf)); } @@ -3143,13 +3145,13 @@ arc_hdr_free_on_write(arc_buf_hdr_t *hdr) /* protected by hash lock, if in the hash table */ if (multilist_link_active(&hdr->b_l1hdr.b_arc_node)) { - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); ASSERT(state != arc_anon && state != arc_l2c_only); - (void) refcount_remove_many(&state->arcs_esize[type], + (void) zfs_refcount_remove_many(&state->arcs_esize[type], size, hdr); } - (void) refcount_remove_many(&state->arcs_size, size, hdr); + (void) zfs_refcount_remove_many(&state->arcs_size, size, hdr); if (type == ARC_BUFC_METADATA) { arc_space_return(size, ARC_SPACE_META); } else { @@ -3179,7 +3181,7 @@ arc_share_buf(arc_buf_hdr_t *hdr, arc_buf_t *buf) * refcount ownership to the hdr since it always owns * the refcount whenever an arc_buf_t is shared. */ - refcount_transfer_ownership(&state->arcs_size, buf, hdr); + zfs_refcount_transfer_ownership(&state->arcs_size, buf, hdr); hdr->b_l1hdr.b_pabd = abd_get_from_buf(buf->b_data, arc_buf_size(buf)); abd_take_ownership_of_buf(hdr->b_l1hdr.b_pabd, HDR_ISTYPE_METADATA(hdr)); @@ -3209,7 +3211,7 @@ arc_unshare_buf(arc_buf_hdr_t *hdr, arc_buf_t *buf) * We are no longer sharing this buffer so we need * to transfer its ownership to the rightful owner. */ - refcount_transfer_ownership(&state->arcs_size, hdr, buf); + zfs_refcount_transfer_ownership(&state->arcs_size, hdr, buf); arc_hdr_clear_flags(hdr, ARC_FLAG_SHARED_DATA); abd_release_ownership_of_buf(hdr->b_l1hdr.b_pabd); abd_put(hdr->b_l1hdr.b_pabd); @@ -3436,7 +3438,7 @@ arc_hdr_alloc(uint64_t spa, int32_t psize, int32_t lsi * it references and compressed arc enablement. */ arc_hdr_alloc_pabd(hdr, B_TRUE); - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); return (hdr); } @@ -3538,8 +3540,10 @@ arc_hdr_realloc(arc_buf_hdr_t *hdr, kmem_cache_t *old, * the wrong pointer address when calling arc_hdr_destroy() later. */ - (void) refcount_remove_many(&dev->l2ad_alloc, arc_hdr_size(hdr), hdr); - (void) refcount_add_many(&dev->l2ad_alloc, arc_hdr_size(nhdr), nhdr); + (void) zfs_refcount_remove_many(&dev->l2ad_alloc, arc_hdr_size(hdr), + hdr); + (void) zfs_refcount_add_many(&dev->l2ad_alloc, arc_hdr_size(nhdr), + nhdr); buf_discard_identity(hdr); kmem_cache_free(old, hdr); @@ -3619,7 +3623,7 @@ arc_hdr_l2hdr_destroy(arc_buf_hdr_t *hdr) vdev_space_update(dev->l2ad_vdev, -psize, 0, 0); - (void) refcount_remove_many(&dev->l2ad_alloc, psize, hdr); + (void) zfs_refcount_remove_many(&dev->l2ad_alloc, psize, hdr); arc_hdr_clear_flags(hdr, ARC_FLAG_HAS_L2HDR); } @@ -3629,7 +3633,7 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr) if (HDR_HAS_L1HDR(hdr)) { ASSERT(hdr->b_l1hdr.b_buf == NULL || hdr->b_l1hdr.b_bufcnt > 0); - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); ASSERT3P(hdr->b_l1hdr.b_state, ==, arc_anon); } ASSERT(!HDR_IO_IN_PROGRESS(hdr)); @@ -3793,7 +3797,7 @@ arc_evict_hdr(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) return (bytes_evicted); } - ASSERT0(refcount_count(&hdr->b_l1hdr.b_refcnt)); + ASSERT0(zfs_refcount_count(&hdr->b_l1hdr.b_refcnt)); while (hdr->b_l1hdr.b_buf) { arc_buf_t *buf = hdr->b_l1hdr.b_buf; if (!mutex_tryenter(&buf->b_evict_lock)) { @@ -4107,7 +4111,7 @@ arc_flush_state(arc_state_t *state, uint64_t spa, arc_ { uint64_t evicted = 0; - while (refcount_count(&state->arcs_esize[type]) != 0) { + while (zfs_refcount_count(&state->arcs_esize[type]) != 0) { evicted += arc_evict_state(state, spa, ARC_EVICT_ALL, type); if (!retry) @@ -4130,7 +4134,7 @@ arc_prune_task(void *ptr) if (func != NULL) func(ap->p_adjust, ap->p_private); - refcount_remove(&ap->p_refcnt, func); + zfs_refcount_remove(&ap->p_refcnt, func); } /* @@ -4153,14 +4157,14 @@ arc_prune_async(int64_t adjust) for (ap = list_head(&arc_prune_list); ap != NULL; ap = list_next(&arc_prune_list, ap)) { - if (refcount_count(&ap->p_refcnt) >= 2) + if (zfs_refcount_count(&ap->p_refcnt) >= 2) continue; - refcount_add(&ap->p_refcnt, ap->p_pfunc); + zfs_refcount_add(&ap->p_refcnt, ap->p_pfunc); ap->p_adjust = adjust; if (taskq_dispatch(arc_prune_taskq, arc_prune_task, ap, TQ_SLEEP) == TASKQID_INVALID) { - refcount_remove(&ap->p_refcnt, ap->p_pfunc); + zfs_refcount_remove(&ap->p_refcnt, ap->p_pfunc); continue; } ARCSTAT_BUMP(arcstat_prune); @@ -4182,8 +4186,9 @@ arc_adjust_impl(arc_state_t *state, uint64_t spa, int6 { int64_t delta; - if (bytes > 0 && refcount_count(&state->arcs_esize[type]) > 0) { - delta = MIN(refcount_count(&state->arcs_esize[type]), bytes); + if (bytes > 0 && zfs_refcount_count(&state->arcs_esize[type]) > 0) { + delta = MIN(zfs_refcount_count(&state->arcs_esize[type]), + bytes); return (arc_evict_state(state, spa, delta, type)); } @@ -4226,8 +4231,9 @@ restart: */ adjustmnt = meta_used - arc_meta_limit; - if (adjustmnt > 0 && refcount_count(&arc_mru->arcs_esize[type]) > 0) { - delta = MIN(refcount_count(&arc_mru->arcs_esize[type]), + if (adjustmnt > 0 && + zfs_refcount_count(&arc_mru->arcs_esize[type]) > 0) { + delta = MIN(zfs_refcount_count(&arc_mru->arcs_esize[type]), adjustmnt); total_evicted += arc_adjust_impl(arc_mru, 0, delta, type); adjustmnt -= delta; @@ -4243,8 +4249,9 @@ restart: * simply decrement the amount of data evicted from the MRU. */ - if (adjustmnt > 0 && refcount_count(&arc_mfu->arcs_esize[type]) > 0) { - delta = MIN(refcount_count(&arc_mfu->arcs_esize[type]), + if (adjustmnt > 0 && + zfs_refcount_count(&arc_mfu->arcs_esize[type]) > 0) { + delta = MIN(zfs_refcount_count(&arc_mfu->arcs_esize[type]), adjustmnt); total_evicted += arc_adjust_impl(arc_mfu, 0, delta, type); } @@ -4252,17 +4259,17 @@ restart: adjustmnt = meta_used - arc_meta_limit; if (adjustmnt > 0 && - refcount_count(&arc_mru_ghost->arcs_esize[type]) > 0) { + zfs_refcount_count(&arc_mru_ghost->arcs_esize[type]) > 0) { delta = MIN(adjustmnt, - refcount_count(&arc_mru_ghost->arcs_esize[type])); + zfs_refcount_count(&arc_mru_ghost->arcs_esize[type])); total_evicted += arc_adjust_impl(arc_mru_ghost, 0, delta, type); adjustmnt -= delta; } if (adjustmnt > 0 && - refcount_count(&arc_mfu_ghost->arcs_esize[type]) > 0) { + zfs_refcount_count(&arc_mfu_ghost->arcs_esize[type]) > 0) { delta = MIN(adjustmnt, - refcount_count(&arc_mfu_ghost->arcs_esize[type])); + zfs_refcount_count(&arc_mfu_ghost->arcs_esize[type])); total_evicted += arc_adjust_impl(arc_mfu_ghost, 0, delta, type); } @@ -4311,8 +4318,8 @@ arc_adjust_meta_only(uint64_t meta_used) * evict some from the MRU here, and some from the MFU below. */ target = MIN((int64_t)(meta_used - arc_meta_limit), - (int64_t)(refcount_count(&arc_anon->arcs_size) + - refcount_count(&arc_mru->arcs_size) - arc_p)); + (int64_t)(zfs_refcount_count(&arc_anon->arcs_size) + + zfs_refcount_count(&arc_mru->arcs_size) - arc_p)); total_evicted += arc_adjust_impl(arc_mru, 0, target, ARC_BUFC_METADATA); @@ -4322,7 +4329,7 @@ arc_adjust_meta_only(uint64_t meta_used) * space allotted to the MFU (which is defined as arc_c - arc_p). */ target = MIN((int64_t)(meta_used - arc_meta_limit), - (int64_t)(refcount_count(&arc_mfu->arcs_size) - + (int64_t)(zfs_refcount_count(&arc_mfu->arcs_size) - (arc_c - arc_p))); total_evicted += arc_adjust_impl(arc_mfu, 0, target, ARC_BUFC_METADATA); @@ -4443,8 +4450,8 @@ arc_adjust(void) * arc_p here, and then evict more from the MFU below. */ target = MIN((int64_t)(asize - arc_c), - (int64_t)(refcount_count(&arc_anon->arcs_size) + - refcount_count(&arc_mru->arcs_size) + ameta - arc_p)); + (int64_t)(zfs_refcount_count(&arc_anon->arcs_size) + + zfs_refcount_count(&arc_mru->arcs_size) + ameta - arc_p)); /* * If we're below arc_meta_min, always prefer to evict data. @@ -4534,8 +4541,8 @@ arc_adjust(void) * cache. The following logic enforces these limits on the ghost * caches, and evicts from them as needed. */ - target = refcount_count(&arc_mru->arcs_size) + - refcount_count(&arc_mru_ghost->arcs_size) - arc_c; + target = zfs_refcount_count(&arc_mru->arcs_size) + + zfs_refcount_count(&arc_mru_ghost->arcs_size) - arc_c; bytes = arc_adjust_impl(arc_mru_ghost, 0, target, ARC_BUFC_DATA); total_evicted += bytes; @@ -4553,8 +4560,8 @@ arc_adjust(void) * mru + mfu + mru ghost + mfu ghost <= 2 * arc_c * mru ghost + mfu ghost <= arc_c */ - target = refcount_count(&arc_mru_ghost->arcs_size) + - refcount_count(&arc_mfu_ghost->arcs_size) - arc_c; + target = zfs_refcount_count(&arc_mru_ghost->arcs_size) + + zfs_refcount_count(&arc_mfu_ghost->arcs_size) - arc_c; bytes = arc_adjust_impl(arc_mfu_ghost, 0, target, ARC_BUFC_DATA); total_evicted += bytes; @@ -5069,8 +5076,8 @@ arc_adapt(int bytes, arc_state_t *state) { int mult; uint64_t arc_p_min = (arc_c >> arc_p_min_shift); - int64_t mrug_size = refcount_count(&arc_mru_ghost->arcs_size); - int64_t mfug_size = refcount_count(&arc_mfu_ghost->arcs_size); + int64_t mrug_size = zfs_refcount_count(&arc_mru_ghost->arcs_size); + int64_t mfug_size = zfs_refcount_count(&arc_mfu_ghost->arcs_size); if (state == arc_l2c_only) return; @@ -5248,7 +5255,7 @@ arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, v */ if (!GHOST_STATE(state)) { - (void) refcount_add_many(&state->arcs_size, size, tag); + (void) zfs_refcount_add_many(&state->arcs_size, size, tag); /* * If this is reached via arc_read, the link is @@ -5260,8 +5267,8 @@ arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, v * trying to [add|remove]_reference it. */ if (multilist_link_active(&hdr->b_l1hdr.b_arc_node)) { - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); - (void) refcount_add_many(&state->arcs_esize[type], + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + (void) zfs_refcount_add_many(&state->arcs_esize[type], size, tag); } @@ -5271,8 +5278,8 @@ arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, v */ if (aggsum_upper_bound(&arc_size) < arc_c && hdr->b_l1hdr.b_state == arc_anon && - (refcount_count(&arc_anon->arcs_size) + - refcount_count(&arc_mru->arcs_size) > arc_p)) + (zfs_refcount_count(&arc_anon->arcs_size) + + zfs_refcount_count(&arc_mru->arcs_size) > arc_p)) arc_p = MIN(arc_c, arc_p + size); } ARCSTAT_BUMP(arcstat_allocated); @@ -5310,13 +5317,13 @@ arc_free_data_impl(arc_buf_hdr_t *hdr, uint64_t size, /* protected by hash lock, if in the hash table */ if (multilist_link_active(&hdr->b_l1hdr.b_arc_node)) { - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); ASSERT(state != arc_anon && state != arc_l2c_only); - (void) refcount_remove_many(&state->arcs_esize[type], + (void) zfs_refcount_remove_many(&state->arcs_esize[type], size, tag); } - (void) refcount_remove_many(&state->arcs_size, size, tag); + (void) zfs_refcount_remove_many(&state->arcs_size, size, tag); VERIFY3U(hdr->b_type, ==, type); if (type == ARC_BUFC_METADATA) { @@ -5363,7 +5370,7 @@ arc_access(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) * another prefetch (to make it less likely to be evicted). */ if (HDR_PREFETCH(hdr) || HDR_PRESCIENT_PREFETCH(hdr)) { - if (refcount_count(&hdr->b_l1hdr.b_refcnt) == 0) { + if (zfs_refcount_count(&hdr->b_l1hdr.b_refcnt) == 0) { /* link protected by hash lock */ ASSERT(multilist_link_active( &hdr->b_l1hdr.b_arc_node)); @@ -5404,7 +5411,7 @@ arc_access(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) if (HDR_PREFETCH(hdr) || HDR_PRESCIENT_PREFETCH(hdr)) { new_state = arc_mru; - if (refcount_count(&hdr->b_l1hdr.b_refcnt) > 0) { + if (zfs_refcount_count(&hdr->b_l1hdr.b_refcnt) > 0) { arc_hdr_clear_flags(hdr, ARC_FLAG_PREFETCH | ARC_FLAG_PRESCIENT_PREFETCH); @@ -5678,7 +5685,7 @@ arc_read_done(zio_t *zio) ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL); } - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt) || + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt) || callback_list != NULL); if (no_zio_error) { @@ -5689,7 +5696,7 @@ arc_read_done(zio_t *zio) arc_change_state(arc_anon, hdr, hash_lock); if (HDR_IN_HASH_TABLE(hdr)) buf_hash_remove(hdr); - freeable = refcount_is_zero(&hdr->b_l1hdr.b_refcnt); + freeable = zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt); } /* @@ -5709,7 +5716,7 @@ arc_read_done(zio_t *zio) * in the cache). */ ASSERT3P(hdr->b_l1hdr.b_state, ==, arc_anon); - freeable = refcount_is_zero(&hdr->b_l1hdr.b_refcnt); + freeable = zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt); } /* execute each callback and free its structure */ @@ -5875,7 +5882,7 @@ top: ASSERT((zio_flags & ZIO_FLAG_SPECULATIVE) || rc == 0 || rc != ENOENT); } else if (*arc_flags & ARC_FLAG_PREFETCH && - refcount_count(&hdr->b_l1hdr.b_refcnt) == 0) { + zfs_refcount_count(&hdr->b_l1hdr.b_refcnt) == 0) { arc_hdr_set_flags(hdr, ARC_FLAG_PREFETCH); } DTRACE_PROBE1(arc__hit, arc_buf_hdr_t *, hdr); @@ -5933,7 +5940,7 @@ top: ASSERT3P(hdr->b_l1hdr.b_pabd, ==, NULL); ASSERT(GHOST_STATE(hdr->b_l1hdr.b_state)); ASSERT(!HDR_IO_IN_PROGRESS(hdr)); - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); ASSERT3P(hdr->b_l1hdr.b_buf, ==, NULL); ASSERT3P(hdr->b_l1hdr.b_freeze_cksum, ==, NULL); @@ -6154,10 +6161,10 @@ arc_add_prune_callback(arc_prune_func_t *func, void *p p->p_pfunc = func; p->p_private = private; list_link_init(&p->p_node); - refcount_create(&p->p_refcnt); + zfs_refcount_create(&p->p_refcnt); mutex_enter(&arc_prune_mtx); - refcount_add(&p->p_refcnt, &arc_prune_list); + zfs_refcount_add(&p->p_refcnt, &arc_prune_list); list_insert_head(&arc_prune_list, p); mutex_exit(&arc_prune_mtx); @@ -6170,15 +6177,15 @@ arc_remove_prune_callback(arc_prune_t *p) boolean_t wait = B_FALSE; mutex_enter(&arc_prune_mtx); list_remove(&arc_prune_list, p); - if (refcount_remove(&p->p_refcnt, &arc_prune_list) > 0) + if (zfs_refcount_remove(&p->p_refcnt, &arc_prune_list) > 0) wait = B_TRUE; mutex_exit(&arc_prune_mtx); /* wait for arc_prune_task to finish */ if (wait) taskq_wait(arc_prune_taskq); - ASSERT0(refcount_count(&p->p_refcnt)); - refcount_destroy(&p->p_refcnt); + ASSERT0(zfs_refcount_count(&p->p_refcnt)); + zfs_refcount_destroy(&p->p_refcnt); kmem_free(p, sizeof (*p)); } @@ -6221,7 +6228,7 @@ arc_freed(spa_t *spa, const blkptr_t *bp) * this hdr, then we don't destroy the hdr. */ if (!HDR_HAS_L1HDR(hdr) || (!HDR_IO_IN_PROGRESS(hdr) && - refcount_is_zero(&hdr->b_l1hdr.b_refcnt))) { + zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt))) { arc_change_state(arc_anon, hdr, hash_lock); arc_hdr_destroy(hdr); mutex_exit(hash_lock); @@ -6264,7 +6271,7 @@ arc_release(arc_buf_t *buf, void *tag) ASSERT(!HDR_HAS_L2HDR(hdr)); ASSERT(HDR_EMPTY(hdr)); ASSERT3U(hdr->b_l1hdr.b_bufcnt, ==, 1); - ASSERT3S(refcount_count(&hdr->b_l1hdr.b_refcnt), ==, 1); + ASSERT3S(zfs_refcount_count(&hdr->b_l1hdr.b_refcnt), ==, 1); ASSERT(!list_link_active(&hdr->b_l1hdr.b_arc_node)); hdr->b_l1hdr.b_arc_access = 0; @@ -6292,7 +6299,7 @@ arc_release(arc_buf_t *buf, void *tag) ASSERT3P(state, !=, arc_anon); /* this buffer is not on any list */ - ASSERT3S(refcount_count(&hdr->b_l1hdr.b_refcnt), >, 0); + ASSERT3S(zfs_refcount_count(&hdr->b_l1hdr.b_refcnt), >, 0); if (HDR_HAS_L2HDR(hdr)) { mutex_enter(&hdr->b_l2hdr.b_dev->l2ad_mtx); @@ -6384,12 +6391,13 @@ arc_release(arc_buf_t *buf, void *tag) ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL); ASSERT3P(state, !=, arc_l2c_only); - (void) refcount_remove_many(&state->arcs_size, + (void) zfs_refcount_remove_many(&state->arcs_size, arc_buf_size(buf), buf); - if (refcount_is_zero(&hdr->b_l1hdr.b_refcnt)) { + if (zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)) { ASSERT3P(state, !=, arc_l2c_only); - (void) refcount_remove_many(&state->arcs_esize[type], + (void) zfs_refcount_remove_many( + &state->arcs_esize[type], arc_buf_size(buf), buf); } @@ -6408,21 +6416,21 @@ arc_release(arc_buf_t *buf, void *tag) nhdr = arc_hdr_alloc(spa, psize, lsize, compress, type); ASSERT3P(nhdr->b_l1hdr.b_buf, ==, NULL); ASSERT0(nhdr->b_l1hdr.b_bufcnt); - ASSERT0(refcount_count(&nhdr->b_l1hdr.b_refcnt)); + ASSERT0(zfs_refcount_count(&nhdr->b_l1hdr.b_refcnt)); VERIFY3U(nhdr->b_type, ==, type); ASSERT(!HDR_SHARED_DATA(nhdr)); nhdr->b_l1hdr.b_buf = buf; nhdr->b_l1hdr.b_bufcnt = 1; - (void) refcount_add(&nhdr->b_l1hdr.b_refcnt, tag); + (void) zfs_refcount_add(&nhdr->b_l1hdr.b_refcnt, tag); buf->b_hdr = nhdr; mutex_exit(&buf->b_evict_lock); - (void) refcount_add_many(&arc_anon->arcs_size, + (void) zfs_refcount_add_many(&arc_anon->arcs_size, arc_buf_size(buf), buf); } else { mutex_exit(&buf->b_evict_lock); - ASSERT(refcount_count(&hdr->b_l1hdr.b_refcnt) == 1); + ASSERT(zfs_refcount_count(&hdr->b_l1hdr.b_refcnt) == 1); /* protected by hash lock, or hdr is on arc_anon */ ASSERT(!multilist_link_active(&hdr->b_l1hdr.b_arc_node)); ASSERT(!HDR_IO_IN_PROGRESS(hdr)); @@ -6454,7 +6462,7 @@ arc_referenced(arc_buf_t *buf) int referenced; mutex_enter(&buf->b_evict_lock); - referenced = (refcount_count(&buf->b_hdr->b_l1hdr.b_refcnt)); + referenced = (zfs_refcount_count(&buf->b_hdr->b_l1hdr.b_refcnt)); mutex_exit(&buf->b_evict_lock); return (referenced); } @@ -6469,7 +6477,7 @@ arc_write_ready(zio_t *zio) uint64_t psize = BP_IS_HOLE(zio->io_bp) ? 0 : BP_GET_PSIZE(zio->io_bp); ASSERT(HDR_HAS_L1HDR(hdr)); - ASSERT(!refcount_is_zero(&buf->b_hdr->b_l1hdr.b_refcnt)); + ASSERT(!zfs_refcount_is_zero(&buf->b_hdr->b_l1hdr.b_refcnt)); ASSERT(hdr->b_l1hdr.b_bufcnt > 0); /* @@ -6624,7 +6632,7 @@ arc_write_done(zio_t *zio) if (!BP_EQUAL(&zio->io_bp_orig, zio->io_bp)) panic("bad overwrite, hdr=%p exists=%p", (void *)hdr, (void *)exists); - ASSERT(refcount_is_zero( + ASSERT(zfs_refcount_is_zero( &exists->b_l1hdr.b_refcnt)); arc_change_state(arc_anon, exists, hash_lock); mutex_exit(hash_lock); @@ -6654,7 +6662,7 @@ arc_write_done(zio_t *zio) arc_hdr_clear_flags(hdr, ARC_FLAG_IO_IN_PROGRESS); } - ASSERT(!refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(!zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); callback->awcb_done(zio, buf, callback->awcb_private); abd_put(zio->io_abd); @@ -6800,7 +6808,7 @@ arc_tempreserve_space(spa_t *spa, uint64_t reserve, ui /* assert that it has not wrapped around */ ASSERT3S(atomic_add_64_nv(&arc_loaned_bytes, 0), >=, 0); - anon_size = MAX((int64_t)(refcount_count(&arc_anon->arcs_size) - + anon_size = MAX((int64_t)(zfs_refcount_count(&arc_anon->arcs_size) - arc_loaned_bytes), 0); /* @@ -6835,9 +6843,10 @@ arc_tempreserve_space(spa_t *spa, uint64_t reserve, ui anon_size > arc_c * zfs_arc_anon_limit_percent / 100 && spa_dirty_anon > anon_size * zfs_arc_pool_dirty_percent / 100) { uint64_t meta_esize = - refcount_count(&arc_anon->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_count( + &arc_anon->arcs_esize[ARC_BUFC_METADATA]); uint64_t data_esize = - refcount_count(&arc_anon->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_count(&arc_anon->arcs_esize[ARC_BUFC_DATA]); dprintf("failing, arc_tempreserve=%lluK anon_meta=%lluK " "anon_data=%lluK tempreserve=%lluK arc_c=%lluK\n", arc_tempreserve >> 10, meta_esize >> 10, @@ -6852,11 +6861,11 @@ static void arc_kstat_update_state(arc_state_t *state, kstat_named_t *size, kstat_named_t *evict_data, kstat_named_t *evict_metadata) { - size->value.ui64 = refcount_count(&state->arcs_size); + size->value.ui64 = zfs_refcount_count(&state->arcs_size); evict_data->value.ui64 = - refcount_count(&state->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_count(&state->arcs_esize[ARC_BUFC_DATA]); evict_metadata->value.ui64 = - refcount_count(&state->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_count(&state->arcs_esize[ARC_BUFC_METADATA]); } static int @@ -7025,25 +7034,25 @@ arc_state_init(void) offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - refcount_create(&arc_anon->arcs_esize[ARC_BUFC_METADATA]); - refcount_create(&arc_anon->arcs_esize[ARC_BUFC_DATA]); - refcount_create(&arc_mru->arcs_esize[ARC_BUFC_METADATA]); - refcount_create(&arc_mru->arcs_esize[ARC_BUFC_DATA]); - refcount_create(&arc_mru_ghost->arcs_esize[ARC_BUFC_METADATA]); - refcount_create(&arc_mru_ghost->arcs_esize[ARC_BUFC_DATA]); - refcount_create(&arc_mfu->arcs_esize[ARC_BUFC_METADATA]); - refcount_create(&arc_mfu->arcs_esize[ARC_BUFC_DATA]); - refcount_create(&arc_mfu_ghost->arcs_esize[ARC_BUFC_METADATA]); - refcount_create(&arc_mfu_ghost->arcs_esize[ARC_BUFC_DATA]); - refcount_create(&arc_l2c_only->arcs_esize[ARC_BUFC_METADATA]); - refcount_create(&arc_l2c_only->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_create(&arc_anon->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_create(&arc_anon->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_create(&arc_mru->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_create(&arc_mru->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_create(&arc_mru_ghost->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_create(&arc_mru_ghost->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_create(&arc_mfu->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_create(&arc_mfu->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_create(&arc_mfu_ghost->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_create(&arc_mfu_ghost->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_create(&arc_l2c_only->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_create(&arc_l2c_only->arcs_esize[ARC_BUFC_DATA]); - refcount_create(&arc_anon->arcs_size); - refcount_create(&arc_mru->arcs_size); - refcount_create(&arc_mru_ghost->arcs_size); - refcount_create(&arc_mfu->arcs_size); - refcount_create(&arc_mfu_ghost->arcs_size); - refcount_create(&arc_l2c_only->arcs_size); + zfs_refcount_create(&arc_anon->arcs_size); + zfs_refcount_create(&arc_mru->arcs_size); + zfs_refcount_create(&arc_mru_ghost->arcs_size); + zfs_refcount_create(&arc_mfu->arcs_size); + zfs_refcount_create(&arc_mfu_ghost->arcs_size); + zfs_refcount_create(&arc_l2c_only->arcs_size); aggsum_init(&arc_meta_used, 0); aggsum_init(&arc_size, 0); @@ -7059,25 +7068,25 @@ arc_state_init(void) static void arc_state_fini(void) { - refcount_destroy(&arc_anon->arcs_esize[ARC_BUFC_METADATA]); - refcount_destroy(&arc_anon->arcs_esize[ARC_BUFC_DATA]); - refcount_destroy(&arc_mru->arcs_esize[ARC_BUFC_METADATA]); - refcount_destroy(&arc_mru->arcs_esize[ARC_BUFC_DATA]); - refcount_destroy(&arc_mru_ghost->arcs_esize[ARC_BUFC_METADATA]); - refcount_destroy(&arc_mru_ghost->arcs_esize[ARC_BUFC_DATA]); - refcount_destroy(&arc_mfu->arcs_esize[ARC_BUFC_METADATA]); - refcount_destroy(&arc_mfu->arcs_esize[ARC_BUFC_DATA]); - refcount_destroy(&arc_mfu_ghost->arcs_esize[ARC_BUFC_METADATA]); - refcount_destroy(&arc_mfu_ghost->arcs_esize[ARC_BUFC_DATA]); - refcount_destroy(&arc_l2c_only->arcs_esize[ARC_BUFC_METADATA]); - refcount_destroy(&arc_l2c_only->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_destroy(&arc_anon->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_destroy(&arc_anon->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_destroy(&arc_mru->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_destroy(&arc_mru->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_destroy(&arc_mru_ghost->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_destroy(&arc_mru_ghost->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_destroy(&arc_mfu->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_destroy(&arc_mfu->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_destroy(&arc_mfu_ghost->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_destroy(&arc_mfu_ghost->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_destroy(&arc_l2c_only->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_destroy(&arc_l2c_only->arcs_esize[ARC_BUFC_DATA]); - refcount_destroy(&arc_anon->arcs_size); - refcount_destroy(&arc_mru->arcs_size); - refcount_destroy(&arc_mru_ghost->arcs_size); - refcount_destroy(&arc_mfu->arcs_size); - refcount_destroy(&arc_mfu_ghost->arcs_size); - refcount_destroy(&arc_l2c_only->arcs_size); + zfs_refcount_destroy(&arc_anon->arcs_size); + zfs_refcount_destroy(&arc_mru->arcs_size); + zfs_refcount_destroy(&arc_mru_ghost->arcs_size); + zfs_refcount_destroy(&arc_mfu->arcs_size); + zfs_refcount_destroy(&arc_mfu_ghost->arcs_size); + zfs_refcount_destroy(&arc_l2c_only->arcs_size); multilist_destroy(arc_mru->arcs_list[ARC_BUFC_METADATA]); multilist_destroy(arc_mru_ghost->arcs_list[ARC_BUFC_METADATA]); @@ -7359,8 +7368,8 @@ arc_fini(void) mutex_enter(&arc_prune_mtx); while ((p = list_head(&arc_prune_list)) != NULL) { list_remove(&arc_prune_list, p); - refcount_remove(&p->p_refcnt, &arc_prune_list); - refcount_destroy(&p->p_refcnt); + zfs_refcount_remove(&p->p_refcnt, &arc_prune_list); + zfs_refcount_destroy(&p->p_refcnt); kmem_free(p, sizeof (*p)); } mutex_exit(&arc_prune_mtx); @@ -7787,7 +7796,7 @@ top: ARCSTAT_INCR(arcstat_l2_lsize, -HDR_GET_LSIZE(hdr)); bytes_dropped += arc_hdr_size(hdr); - (void) refcount_remove_many(&dev->l2ad_alloc, + (void) zfs_refcount_remove_many(&dev->l2ad_alloc, arc_hdr_size(hdr), hdr); } @@ -8205,7 +8214,8 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint list_insert_head(&dev->l2ad_buflist, hdr); mutex_exit(&dev->l2ad_mtx); - (void) refcount_add_many(&dev->l2ad_alloc, psize, hdr); + (void) zfs_refcount_add_many(&dev->l2ad_alloc, psize, + hdr); /* * Normally the L2ARC can use the hdr's data, but if @@ -8439,7 +8449,7 @@ l2arc_add_vdev(spa_t *spa, vdev_t *vd) offsetof(arc_buf_hdr_t, b_l2hdr.b_l2node)); vdev_space_update(vd, 0, 0, adddev->l2ad_end - adddev->l2ad_hand); - refcount_create(&adddev->l2ad_alloc); + zfs_refcount_create(&adddev->l2ad_alloc); /* * Add device to global list @@ -8485,7 +8495,7 @@ l2arc_remove_vdev(vdev_t *vd) l2arc_evict(remdev, 0, B_TRUE); list_destroy(&remdev->l2ad_buflist); mutex_destroy(&remdev->l2ad_mtx); - refcount_destroy(&remdev->l2ad_alloc); + zfs_refcount_destroy(&remdev->l2ad_alloc); kmem_free(remdev, sizeof (l2arc_dev_t)); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Tue Oct 15 14:51:22 2019 (r353564) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Tue Oct 15 15:09:36 2019 (r353565) @@ -226,7 +226,7 @@ static boolean_t dbuf_evict_thread_exit; */ typedef struct dbuf_cache { multilist_t *cache; - refcount_t size; + zfs_refcount_t size; } dbuf_cache_t; dbuf_cache_t dbuf_caches[DB_CACHE_MAX]; @@ -316,7 +316,7 @@ dbuf_cons(void *vdb, void *unused, int kmflag) mutex_init(&db->db_mtx, NULL, MUTEX_DEFAULT, NULL); cv_init(&db->db_changed, NULL, CV_DEFAULT, NULL); multilist_link_init(&db->db_cache_link); - refcount_create(&db->db_holds); + zfs_refcount_create(&db->db_holds); return (0); } @@ -329,7 +329,7 @@ dbuf_dest(void *vdb, void *unused) mutex_destroy(&db->db_mtx); cv_destroy(&db->db_changed); ASSERT(!multilist_link_active(&db->db_cache_link)); - refcount_destroy(&db->db_holds); + zfs_refcount_destroy(&db->db_holds); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Oct 15 15:40:03 2019 Return-Path: Delivered-To: svn-src-all@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 DE51814AB53; Tue, 15 Oct 2019 15:40:03 +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 46t0435XCfz4N77; Tue, 15 Oct 2019 15:40:03 +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 A0FFC20AFA; Tue, 15 Oct 2019 15:40:03 +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 x9FFe3qq049056; Tue, 15 Oct 2019 15:40:03 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FFe3FZ049055; Tue, 15 Oct 2019 15:40:03 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910151540.x9FFe3FZ049055@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 15 Oct 2019 15:40:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353566 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 353566 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 15:40:03 -0000 Author: glebius Date: Tue Oct 15 15:40:03 2019 New Revision: 353566 URL: https://svnweb.freebsd.org/changeset/base/353566 Log: Remove pfctlinput2(). It came from KAME and had never ever been in use. Modified: head/sys/kern/uipc_domain.c head/sys/sys/protosw.h Modified: head/sys/kern/uipc_domain.c ============================================================================== --- head/sys/kern/uipc_domain.c Tue Oct 15 15:09:36 2019 (r353565) +++ head/sys/kern/uipc_domain.c Tue Oct 15 15:40:03 2019 (r353566) @@ -475,29 +475,6 @@ pfctlinput(int cmd, struct sockaddr *sa) (*pr->pr_ctlinput)(cmd, sa, (void *)0); } -void -pfctlinput2(int cmd, struct sockaddr *sa, void *ctlparam) -{ - struct domain *dp; - struct protosw *pr; - - if (!sa) - return; - for (dp = domains; dp; dp = dp->dom_next) { - /* - * the check must be made by xx_ctlinput() anyways, to - * make sure we use data item pointed to by ctlparam in - * correct way. the following check is made just for safety. - */ - if (dp->dom_family != sa->sa_family) - continue; - - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) - if (pr->pr_ctlinput) - (*pr->pr_ctlinput)(cmd, sa, ctlparam); - } -} - static void pfslowtimo(void *arg) { Modified: head/sys/sys/protosw.h ============================================================================== --- head/sys/sys/protosw.h Tue Oct 15 15:09:36 2019 (r353565) +++ head/sys/sys/protosw.h Tue Oct 15 15:40:03 2019 (r353566) @@ -342,7 +342,6 @@ char *prcorequests[] = { #ifdef _KERNEL void pfctlinput(int, struct sockaddr *); -void pfctlinput2(int, struct sockaddr *, void *); struct domain *pffinddomain(int family); struct protosw *pffindproto(int family, int protocol, int type); struct protosw *pffindtype(int family, int type); From owner-svn-src-all@freebsd.org Tue Oct 15 15:47:22 2019 Return-Path: Delivered-To: svn-src-all@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 C7C1114AF64; Tue, 15 Oct 2019 15:47: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 46t0DV4s75z4Nly; Tue, 15 Oct 2019 15:47: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 7099720CE7; Tue, 15 Oct 2019 15:47: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 x9FFlMDN054867; Tue, 15 Oct 2019 15:47:22 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FFlMv1054866; Tue, 15 Oct 2019 15:47:22 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910151547.x9FFlMv1054866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 15 Oct 2019 15:47:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353567 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 353567 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 15:47:22 -0000 Author: tuexen Date: Tue Oct 15 15:47:22 2019 New Revision: 353567 URL: https://svnweb.freebsd.org/changeset/base/353567 Log: Fix mergeinfo for r353563. Modified: Directory Properties: stable/12/ (props changed) From owner-svn-src-all@freebsd.org Tue Oct 15 15:51:58 2019 Return-Path: Delivered-To: svn-src-all@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 A7D7D14B686; Tue, 15 Oct 2019 15:51:58 +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 46t0Kp1hgcz4PHl; Tue, 15 Oct 2019 15:51:57 +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 x9FFpnRo032931 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 15 Oct 2019 08:51:49 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x9FFpnTh032930; Tue, 15 Oct 2019 08:51:49 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Tue, 15 Oct 2019 08:51:49 -0700 From: Gleb Smirnoff To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353566 - in head/sys: kern sys Message-ID: <20191015155149.GJ4086@FreeBSD.org> References: <201910151540.x9FFe3FZ049055@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201910151540.x9FFe3FZ049055@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46t0Kp1hgcz4PHl X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.90 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.90)[-0.903,0]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 15:51:58 -0000 On Tue, Oct 15, 2019 at 03:40:03PM +0000, Gleb Smirnoff wrote: T> Author: glebius T> Date: Tue Oct 15 15:40:03 2019 T> New Revision: 353566 T> URL: https://svnweb.freebsd.org/changeset/base/353566 T> T> Log: T> Remove pfctlinput2(). It came from KAME and had never ever been in use. The commit message is wrong. It was used in FreeBSD 10 and before. My fxr usage skills are weak. -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Tue Oct 15 15:52:03 2019 Return-Path: Delivered-To: svn-src-all@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 8103114B6A8; Tue, 15 Oct 2019 15:52:03 +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 46t0Kt6WQFz4PKR; Tue, 15 Oct 2019 15:52:02 +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 63CCD20E7B; Tue, 15 Oct 2019 15:52:02 +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 x9FFq27m058927; Tue, 15 Oct 2019 15:52:02 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FFq1Tk058922; Tue, 15 Oct 2019 15:52:01 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910151552.x9FFq1Tk058922@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 15 Oct 2019 15:52:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353568 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 353568 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 15:52:03 -0000 Author: avg Date: Tue Oct 15 15:52:01 2019 New Revision: 353568 URL: https://svnweb.freebsd.org/changeset/base/353568 Log: fix up r353565, somehow a few files did not get committed MFC after: 3 weeks X-MFC with: r353565 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf_stats.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf_stats.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf_stats.c Tue Oct 15 15:47:22 2019 (r353567) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf_stats.c Tue Oct 15 15:52:01 2019 (r353568) @@ -90,7 +90,7 @@ __dbuf_stats_hash_table_data(char *buf, size_t size, d (u_longlong_t)db->db.db_size, !!dbuf_is_metadata(db), db->db_state, - (ulong_t)refcount_count(&db->db_holds), + (ulong_t)zfs_refcount_count(&db->db_holds), /* arc_buf_info_t */ abi.abi_state_type, abi.abi_state_contents, @@ -115,7 +115,7 @@ __dbuf_stats_hash_table_data(char *buf, size_t size, d (ulong_t)doi.doi_metadata_block_size, (u_longlong_t)doi.doi_bonus_size, (ulong_t)doi.doi_indirection, - (ulong_t)refcount_count(&dn->dn_holds), + (ulong_t)zfs_refcount_count(&dn->dn_holds), (u_longlong_t)doi.doi_fill_count, (u_longlong_t)doi.doi_max_offset); buf[size] = '\0'; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Tue Oct 15 15:47:22 2019 (r353567) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Tue Oct 15 15:52:01 2019 (r353568) @@ -318,7 +318,7 @@ struct dsl_scan_io_queue { /* private data for dsl_scan_prefetch_cb() */ typedef struct scan_prefetch_ctx { - refcount_t spc_refcnt; /* refcount for memory management */ + zfs_refcount_t spc_refcnt; /* refcount for memory management */ dsl_scan_t *spc_scn; /* dsl_scan_t for the pool */ boolean_t spc_root; /* is this prefetch for an objset? */ uint8_t spc_indblkshift; /* dn_indblkshift of current dnode */ @@ -1326,8 +1326,8 @@ scan_prefetch_queue_compare(const void *a, const void static void scan_prefetch_ctx_rele(scan_prefetch_ctx_t *spc, void *tag) { - if (refcount_remove(&spc->spc_refcnt, tag) == 0) { - refcount_destroy(&spc->spc_refcnt); + if (zfs_refcount_remove(&spc->spc_refcnt, tag) == 0) { + zfs_refcount_destroy(&spc->spc_refcnt); kmem_free(spc, sizeof (scan_prefetch_ctx_t)); } } @@ -1338,8 +1338,8 @@ scan_prefetch_ctx_create(dsl_scan_t *scn, dnode_phys_t scan_prefetch_ctx_t *spc; spc = kmem_alloc(sizeof (scan_prefetch_ctx_t), KM_SLEEP); - refcount_create(&spc->spc_refcnt); - refcount_add(&spc->spc_refcnt, tag); + zfs_refcount_create(&spc->spc_refcnt); + zfs_refcount_add(&spc->spc_refcnt, tag); spc->spc_scn = scn; if (dnp != NULL) { spc->spc_datablkszsec = dnp->dn_datablkszsec; @@ -1357,7 +1357,7 @@ scan_prefetch_ctx_create(dsl_scan_t *scn, dnode_phys_t static void scan_prefetch_ctx_add_ref(scan_prefetch_ctx_t *spc, void *tag) { - refcount_add(&spc->spc_refcnt, tag); + zfs_refcount_add(&spc->spc_refcnt, tag); } static boolean_t Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Tue Oct 15 15:47:22 2019 (r353567) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Tue Oct 15 15:52:01 2019 (r353568) @@ -86,7 +86,7 @@ struct arc_prune { void *p_private; uint64_t p_adjust; list_node_t p_node; - refcount_t p_refcnt; + zfs_refcount_t p_refcnt; }; typedef enum arc_strategy { From owner-svn-src-all@freebsd.org Tue Oct 15 15:54:23 2019 Return-Path: Delivered-To: svn-src-all@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 0A78B14B853; Tue, 15 Oct 2019 15:54:23 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46t0NY5nzXz4PkB; Tue, 15 Oct 2019 15:54:21 +0000 (UTC) (envelope-from ohartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1571154854; bh=7aL/U2L5iuzCdCZyMR6oWuX5vARcPzO06SLuukVu42c=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=ePqWeI8q2cJH5ofaLmFiTawpT5ZOQgG+3JOB0sYyqsYjAnCcLHvfipa8FfJRjtysw 71SWW0HMpFOYI6e1UIP2oOdMtgSBAxlfBqVfPwkpAYypls6EKmnNYLwNBaY4eB18zd IeRNh0OoI919520kwsFhX/Ej/eP/6LfluFRJoeNs= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from thor.intern.walstatt.dynvpn.de ([77.191.155.27]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MatVh-1hnX2b1D1X-00cTJ6; Tue, 15 Oct 2019 17:54:14 +0200 Date: Tue, 15 Oct 2019 17:53:39 +0200 From: "O. Hartmann" To: Andriy Gapon Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353565 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys Message-ID: <20191015175357.3ee91a1c@thor.intern.walstatt.dynvpn.de> In-Reply-To: <201910151509.x9FF9a2B031347@repo.freebsd.org> References: <201910151509.x9FF9a2B031347@repo.freebsd.org> Organization: WALSTATT User-Agent: OutScare 3.1415926 X-Operating-System: ImNotAnOperatingSystem 3.141592527 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 X-Provags-ID: V03:K1:NhcWL/brajS0YKzXYMGMyVhZBGFi5LXs2F8nYueFbeBfXLttfHu dPBcrUyUBmEWd+jD9JNqD05GwmuD47EdV1fRP4C0a7lEV916s1ZvqAv7lRW2aKtLwjSkhjA gSsUOLRotW/18EZ26HoubLSVmYRp29SnaBRxCsGjgutmQB9ODHBT06xHNwH6zYfbDsLCLeL Vy4rjTyEqILZliAnRxtwQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:KKfgG8DC4NU=:JAHjXzdsRK394m4mPmETdT 13UODzo1rMbllJ/tkMeL/CMZgiAF7q6M1zYjrbDv5ptS/wgLa72SDoVlqxcw26OSirYKdZ5AY knlTHzD1OTDSWVu1BfW04q6lq/GQgx0kTL/wGuRK2XQlISZ2hhz+muTLv51xxUtdqT/EPhEFg Eaj8DI5Ke1On6nXoKrOP6fRl/CNncw4/hiIDE+jx09ehTReFFfo/EIcDVldkHqlmNfTyBeNSp paCMxvGKM/P0Jecju2Akk7IQ5aUB2J9ahtcse29Iv6tC0Llck0BuE0tphx0h6KUNawGiIPQRD 0S/x4U0U5tLSh3Tw733ZbHtOQOUuzywmInJxGh/+/Pa/SlIB62kkJp8Dh1uOz4e6dgzx9TODs IxzNvYNfojmEICPLIaG3VINL8yG/cHyaQanMAMU3Um19xcV8vzl/r9Gzi65DUajU8Cqlq1CgX MvUfEA5r0pbDyI9MH0yg/U37Q2a/613ZbRwBGMmdP2s3SYrGr8DkIDmW7RHW/FwUrzAsU6EDe 8+BWXHcm3+J8XA3kFM/SfyhimRbSgPwrVt3Xh4i0DrRzmTrR/fB35F+Gpxv13pLbo0at9dbaI MUxjjNBm7Bc+kXYsKLYEj5a+3LhgDanw2qYzNlM0c8ZhmHEGbpmtFkXwTuwJvIpPNc4tOc+ux m14mEmniO5k7CsZhHZmpluN2yLq96muJVFxMuTWToPolqvVLL3H2hJlRLTjr4JVnkEISW7d19 GxlA2r5lOcyjTegEN0rkoVejQOIY5FQTdZaEsy6eRcnn3O9PhCOHvcwRDeR5sMBBUz/4Nztlc WabqU0i6j/ao4VdPIPLKmZwvO2F2GiojeLOAqF0CurB9b5SE8WQl+wMHVZkRq5X3FPvQdrqD/ 21hETope71CjwNr8Nl3ttho06hRM60oEtf+U5T7mMF8dJu0WNK3hRMhR02U4kLQ4yPlYg8Msi aitqnLfLZgIQ+N6lZjPTEhKwWa43H7QtKJrgQsXTxDaRpFoZeSPd30WXr0pbIAMPVrOzGLo5j n35HhxuDlFXydFgCP+wBKBeeJgNBMqcONLn64Kg7lyavYC0BoiLp+F2ltnjNbNEp/cCco4P4m PuUw2xTKkKB2Nzh1MaLu5gAYHtFRz/5EO1HVY25a6lbB6nJTKNeMCI3ltO6BzhaimQyOfFFoq eqHfx61Gfh1+I1qe2DvHa/mmzQLiUITtnCNnsnL4Ice3+alH55G9EpfJo4FzKRE14jX/dsjhd jPvLoavTQq+fM2uwDIyMYeOPBr1WdMVGri4BK8Te4/fMCN1sWrdihgvT6OxE= X-Rspamd-Queue-Id: 46t0NY5nzXz4PkB X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.b=ePqWeI8q; dmarc=none; spf=none (mx1.freebsd.org: domain of ohartmann@walstatt.org has no SPF policy when checking 212.227.15.18) smtp.mailfrom=ohartmann@walstatt.org X-Spamd-Result: default: False [-3.52 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmx.net:s=badeba3b8450]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[walstatt.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; HAS_ORG_HEADER(0.00)[]; IP_SCORE(-1.32)[ip: (-7.30), ipnet: 212.227.0.0/16(-1.30), asn: 8560(2.02), country: DE(-0.01)]; DKIM_TRACE(0.00)[gmx.net:+]; MIME_BASE64_TEXT(0.10)[]; RCVD_IN_DNSWL_NONE(0.00)[18.15.227.212.list.dnswl.org : 127.0.3.0]; R_SPF_NA(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[27.155.191.77.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 15:54:23 -0000 LS0tLS1CRUdJTiBQR1AgU0lHTkVEIE1FU1NBR0UtLS0tLQ0KSGFzaDogU0hBMjU2DQoNCkFtIFR1 ZSwgMTUgT2N0IDIwMTkgMTU6MDk6MzYgKzAwMDAgKFVUQykNCkFuZHJpeSBHYXBvbiA8YXZnQEZy ZWVCU0Qub3JnPiBzY2hyaWViOg0KDQo+IEF1dGhvcjogYXZnDQo+IERhdGU6IFR1ZSBPY3QgMTUg MTU6MDk6MzYgMjAxOQ0KPiBOZXcgUmV2aXNpb246IDM1MzU2NQ0KPiBVUkw6IGh0dHBzOi8vc3Zu d2ViLmZyZWVic2Qub3JnL2NoYW5nZXNldC9iYXNlLzM1MzU2NQ0KPiANCj4gTG9nOg0KPiAgIE1G ViByMzUzNTYxOiAxMDM0MyBab0w6IFByZWZpeCBhbGwgcmVmY291bnQgZnVuY3Rpb25zIHdpdGgg emZzXw0KPiAgIA0KPiAgIGlsbHVtb3MvaWxsdW1vcy1nYXRlQGU5MTRhY2UyZTlkOWJmMmRiZjlh MWYxY2U4MWNiNzc2MDIyMDk2ZjUNCj4gICBodHRwczovL2dpdGh1Yi5jb20vaWxsdW1vcy9pbGx1 bW9zLWdhdGUvY29tbWl0L2U5MTRhY2UyZTlkOWJmMmRiZjlhMWYxY2U4MWNiNzc2MDIyMDk2ZjUN Cj4gICANCj4gICBodHRwczovL3d3dy5pbGx1bW9zLm9yZy9pc3N1ZXMvMTAzNDMNCj4gICAgIE9u IHRoZSBvcGVuemZzIGZlYXR1cmUvcG9ydGluZyBtYXRyaXgsIHRoaXMgaXMgbGlzdGVkIGFzOg0K PiAgICAgcHJlZml4IHRvIHJlZmNvdW50IGZ1bmNzL3R5cGVzDQo+ICAgICBIYXZpbmcgdGhlc2Ug Y2hhbmdlcyB3aWxsIG1ha2UgaXQgZWFzaWVyIHRvIHNoYXJlIG90aGVyIHdvcmsgYWNyb3NzIHRo ZQ0KPiAgICAgZGlmZmVyZW50IFpGUyBvcGVyYXRpbmcgc3lzdGVtcy4NCj4gICAgIFBSIDc5NjMg NDI0ZmQ3YzNlIFByZWZpeCBhbGwgcmVmY291bnQgZnVuY3Rpb25zIHdpdGggemZzXw0KPiAgICAg UFIgNzg4NSAmIDc5MzIgYzEzMDYwZTQ3IExpbnV4IDQuMTktcmMzKyBjb21wYXQ6IFJlbW92ZSBy ZWZjb3VudF90IGNvbXBhdA0KPiAgICAgUFIgNTgyMyAmIDU4NDIgNDg1OWZlNzk2IExpbnV4IDQu MTEgY29tcGF0OiBhdm9pZCByZWZjb3VudF90IG5hbWUgY29uZmxpY3QNCj4gICANCj4gICBBdXRo b3I6IFRpbSBTY2h1bWFjaGVyIDx0aW1zY2h1bWlAZ214LmRlPg0KPiAgIE9idGFpbmVkIGZyb206 CWlsbHVtb3MsIFpvTA0KPiAgIE1GQyBhZnRlcjoJMyB3ZWVrcw0KPiANCj4gTW9kaWZpZWQ6DQo+ ICAgaGVhZC9zeXMvY2RkbC9jb250cmliL29wZW5zb2xhcmlzL3V0cy9jb21tb24vZnMvemZzL2Fi ZC5jDQo+ICAgaGVhZC9zeXMvY2RkbC9jb250cmliL29wZW5zb2xhcmlzL3V0cy9jb21tb24vZnMv emZzL2FyYy5jDQo+ICAgaGVhZC9zeXMvY2RkbC9jb250cmliL29wZW5zb2xhcmlzL3V0cy9jb21t b24vZnMvemZzL2RidWYuYw0KPiAgIGhlYWQvc3lzL2NkZGwvY29udHJpYi9vcGVuc29sYXJpcy91 dHMvY29tbW9uL2ZzL3pmcy9kbXUuYw0KPiAgIGhlYWQvc3lzL2NkZGwvY29udHJpYi9vcGVuc29s YXJpcy91dHMvY29tbW9uL2ZzL3pmcy9kbXVfdHguYw0KPiAgIGhlYWQvc3lzL2NkZGwvY29udHJp Yi9vcGVuc29sYXJpcy91dHMvY29tbW9uL2ZzL3pmcy9kbm9kZS5jDQo+ICAgaGVhZC9zeXMvY2Rk bC9jb250cmliL29wZW5zb2xhcmlzL3V0cy9jb21tb24vZnMvemZzL2Rub2RlX3N5bmMuYw0KPiAg IGhlYWQvc3lzL2NkZGwvY29udHJpYi9vcGVuc29sYXJpcy91dHMvY29tbW9uL2ZzL3pmcy9kc2xf ZGF0YXNldC5jDQo+ICAgaGVhZC9zeXMvY2RkbC9jb250cmliL29wZW5zb2xhcmlzL3V0cy9jb21t b24vZnMvemZzL2RzbF9kZXN0cm95LmMNCj4gICBoZWFkL3N5cy9jZGRsL2NvbnRyaWIvb3BlbnNv bGFyaXMvdXRzL2NvbW1vbi9mcy96ZnMvbWV0YXNsYWIuYw0KPiAgIGhlYWQvc3lzL2NkZGwvY29u dHJpYi9vcGVuc29sYXJpcy91dHMvY29tbW9uL2ZzL3pmcy9yZWZjb3VudC5jDQo+ICAgaGVhZC9z eXMvY2RkbC9jb250cmliL29wZW5zb2xhcmlzL3V0cy9jb21tb24vZnMvemZzL3Jyd2xvY2suYw0K PiAgIGhlYWQvc3lzL2NkZGwvY29udHJpYi9vcGVuc29sYXJpcy91dHMvY29tbW9uL2ZzL3pmcy9z YS5jDQo+ICAgaGVhZC9zeXMvY2RkbC9jb250cmliL29wZW5zb2xhcmlzL3V0cy9jb21tb24vZnMv emZzL3NwYS5jDQo+ICAgaGVhZC9zeXMvY2RkbC9jb250cmliL29wZW5zb2xhcmlzL3V0cy9jb21t b24vZnMvemZzL3NwYV9taXNjLmMNCj4gICBoZWFkL3N5cy9jZGRsL2NvbnRyaWIvb3BlbnNvbGFy aXMvdXRzL2NvbW1vbi9mcy96ZnMvc3lzL2FiZC5oDQo+ICAgaGVhZC9zeXMvY2RkbC9jb250cmli L29wZW5zb2xhcmlzL3V0cy9jb21tb24vZnMvemZzL3N5cy9kYnVmLmgNCj4gICBoZWFkL3N5cy9j ZGRsL2NvbnRyaWIvb3BlbnNvbGFyaXMvdXRzL2NvbW1vbi9mcy96ZnMvc3lzL2RtdV90eC5oDQo+ ICAgaGVhZC9zeXMvY2RkbC9jb250cmliL29wZW5zb2xhcmlzL3V0cy9jb21tb24vZnMvemZzL3N5 cy9kbm9kZS5oDQo+ICAgaGVhZC9zeXMvY2RkbC9jb250cmliL29wZW5zb2xhcmlzL3V0cy9jb21t b24vZnMvemZzL3N5cy9kc2xfZGF0YXNldC5oDQo+ICAgaGVhZC9zeXMvY2RkbC9jb250cmliL29w ZW5zb2xhcmlzL3V0cy9jb21tb24vZnMvemZzL3N5cy9tZXRhc2xhYl9pbXBsLmgNCj4gICBoZWFk L3N5cy9jZGRsL2NvbnRyaWIvb3BlbnNvbGFyaXMvdXRzL2NvbW1vbi9mcy96ZnMvc3lzL3JlZmNv dW50LmgNCj4gICBoZWFkL3N5cy9jZGRsL2NvbnRyaWIvb3BlbnNvbGFyaXMvdXRzL2NvbW1vbi9m cy96ZnMvc3lzL3Jyd2xvY2suaA0KPiAgIGhlYWQvc3lzL2NkZGwvY29udHJpYi9vcGVuc29sYXJp cy91dHMvY29tbW9uL2ZzL3pmcy9zeXMvc2FfaW1wbC5oDQo+ICAgaGVhZC9zeXMvY2RkbC9jb250 cmliL29wZW5zb2xhcmlzL3V0cy9jb21tb24vZnMvemZzL3N5cy9zcGFfaW1wbC5oDQo+ICAgaGVh ZC9zeXMvY2RkbC9jb250cmliL29wZW5zb2xhcmlzL3V0cy9jb21tb24vZnMvemZzL3N5cy96YXAu aA0KPiAgIGhlYWQvc3lzL2NkZGwvY29udHJpYi9vcGVuc29sYXJpcy91dHMvY29tbW9uL2ZzL3pm cy96aW8uYw0KPiBEaXJlY3RvcnkgUHJvcGVydGllczoNCj4gICBoZWFkL3N5cy9jZGRsL2NvbnRy aWIvb3BlbnNvbGFyaXMvICAgKHByb3BzIGNoYW5nZWQpDQo+IA0KPiBNb2RpZmllZDogaGVhZC9z eXMvY2RkbC9jb250cmliL29wZW5zb2xhcmlzL3V0cy9jb21tb24vZnMvemZzL2FiZC5jDQo+ID09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PQ0KPiAtLS0gaGVhZC9zeXMvY2RkbC9jb250cmliL29wZW5zb2xh cmlzL3V0cy9jb21tb24vZnMvemZzL2FiZC5jCVR1ZSBPY3QgMTUgMTQ6NTE6MjINCj4gMjAxOQko cjM1MzU2NCkgKysrIGhlYWQvc3lzL2NkZGwvY29udHJpYi9vcGVuc29sYXJpcy91dHMvY29tbW9u L2ZzL3pmcy9hYmQuYw0KPiBUdWUgT2N0IDE1IDE1OjA5OjM2IDIwMTkJKHIzNTM1NjUpIEBAIC0z MDQsNyArMzA0LDcgQEAgYWJkX2FsbG9jKHNpemVfdCBzaXplLA0KPiBib29sZWFuX3QgaXNfbWV0 YWRhdGEpIH0NCj4gIAlhYmQtPmFiZF9zaXplID0gc2l6ZTsNCj4gIAlhYmQtPmFiZF9wYXJlbnQg PSBOVUxMOw0KPiAtCXJlZmNvdW50X2NyZWF0ZSgmYWJkLT5hYmRfY2hpbGRyZW4pOw0KPiArCXpm c19yZWZjb3VudF9jcmVhdGUoJmFiZC0+YWJkX2NoaWxkcmVuKTsNCj4gIA0KPiAgCWFiZC0+YWJk X3UuYWJkX3NjYXR0ZXIuYWJkX29mZnNldCA9IDA7DQo+ICAJYWJkLT5hYmRfdS5hYmRfc2NhdHRl ci5hYmRfY2h1bmtfc2l6ZSA9IHpmc19hYmRfY2h1bmtfc2l6ZTsNCj4gQEAgLTMzMSw3ICszMzEs NyBAQCBhYmRfZnJlZV9zY2F0dGVyKGFiZF90ICphYmQpDQo+ICAJCWFiZF9mcmVlX2NodW5rKGFi ZC0+YWJkX3UuYWJkX3NjYXR0ZXIuYWJkX2NodW5rc1tpXSk7DQo+ICAJfQ0KPiAgDQo+IC0JcmVm Y291bnRfZGVzdHJveSgmYWJkLT5hYmRfY2hpbGRyZW4pOw0KPiArCXpmc19yZWZjb3VudF9kZXN0 cm95KCZhYmQtPmFiZF9jaGlsZHJlbik7DQo+ICAJQUJEU1RBVF9CVU1QRE9XTihhYmRzdGF0X3Nj YXR0ZXJfY250KTsNCj4gIAlBQkRTVEFUX0lOQ1IoYWJkc3RhdF9zY2F0dGVyX2RhdGFfc2l6ZSwg LShpbnQpYWJkLT5hYmRfc2l6ZSk7DQo+ICAJQUJEU1RBVF9JTkNSKGFiZHN0YXRfc2NhdHRlcl9j aHVua193YXN0ZSwNCj4gQEAgLTM1OCw3ICszNTgsNyBAQCBhYmRfYWxsb2NfbGluZWFyKHNpemVf dCBzaXplLCBib29sZWFuX3QgaXNfbWV0YWRhdGEpDQo+ICAJfQ0KPiAgCWFiZC0+YWJkX3NpemUg PSBzaXplOw0KPiAgCWFiZC0+YWJkX3BhcmVudCA9IE5VTEw7DQo+IC0JcmVmY291bnRfY3JlYXRl KCZhYmQtPmFiZF9jaGlsZHJlbik7DQo+ICsJemZzX3JlZmNvdW50X2NyZWF0ZSgmYWJkLT5hYmRf Y2hpbGRyZW4pOw0KPiAgDQo+ICAJaWYgKGlzX21ldGFkYXRhKSB7DQo+ICAJCWFiZC0+YWJkX3Uu YWJkX2xpbmVhci5hYmRfYnVmID0gemlvX2J1Zl9hbGxvYyhzaXplKTsNCj4gQEAgLTM4MSw3ICsz ODEsNyBAQCBhYmRfZnJlZV9saW5lYXIoYWJkX3QgKmFiZCkNCj4gIAkJemlvX2RhdGFfYnVmX2Zy ZWUoYWJkLT5hYmRfdS5hYmRfbGluZWFyLmFiZF9idWYsIGFiZC0+YWJkX3NpemUpOw0KPiAgCX0N Cj4gIA0KPiAtCXJlZmNvdW50X2Rlc3Ryb3koJmFiZC0+YWJkX2NoaWxkcmVuKTsNCj4gKwl6ZnNf cmVmY291bnRfZGVzdHJveSgmYWJkLT5hYmRfY2hpbGRyZW4pOw0KPiAgCUFCRFNUQVRfQlVNUERP V04oYWJkc3RhdF9saW5lYXJfY250KTsNCj4gIAlBQkRTVEFUX0lOQ1IoYWJkc3RhdF9saW5lYXJf ZGF0YV9zaXplLCAtKGludClhYmQtPmFiZF9zaXplKTsNCj4gIA0KPiBAQCAtNDg3LDggKzQ4Nyw4 IEBAIGFiZF9nZXRfb2Zmc2V0KGFiZF90ICpzYWJkLCBzaXplX3Qgb2ZmKQ0KPiAgDQo+ICAJYWJk LT5hYmRfc2l6ZSA9IHNhYmQtPmFiZF9zaXplIC0gb2ZmOw0KPiAgCWFiZC0+YWJkX3BhcmVudCA9 IHNhYmQ7DQo+IC0JcmVmY291bnRfY3JlYXRlKCZhYmQtPmFiZF9jaGlsZHJlbik7DQo+IC0JKHZv aWQpIHJlZmNvdW50X2FkZF9tYW55KCZzYWJkLT5hYmRfY2hpbGRyZW4sIGFiZC0+YWJkX3NpemUs IGFiZCk7DQo+ICsJemZzX3JlZmNvdW50X2NyZWF0ZSgmYWJkLT5hYmRfY2hpbGRyZW4pOw0KPiAr CSh2b2lkKSB6ZnNfcmVmY291bnRfYWRkX21hbnkoJnNhYmQtPmFiZF9jaGlsZHJlbiwgYWJkLT5h YmRfc2l6ZSwgYWJkKTsNCj4gIA0KPiAgCXJldHVybiAoYWJkKTsNCj4gIH0NCj4gQEAgLTUxMiw3 ICs1MTIsNyBAQCBhYmRfZ2V0X2Zyb21fYnVmKHZvaWQgKmJ1Ziwgc2l6ZV90IHNpemUpDQo+ICAJ YWJkLT5hYmRfZmxhZ3MgPSBBQkRfRkxBR19MSU5FQVI7DQo+ICAJYWJkLT5hYmRfc2l6ZSA9IHNp emU7DQo+ICAJYWJkLT5hYmRfcGFyZW50ID0gTlVMTDsNCj4gLQlyZWZjb3VudF9jcmVhdGUoJmFi ZC0+YWJkX2NoaWxkcmVuKTsNCj4gKwl6ZnNfcmVmY291bnRfY3JlYXRlKCZhYmQtPmFiZF9jaGls ZHJlbik7DQo+ICANCj4gIAlhYmQtPmFiZF91LmFiZF9saW5lYXIuYWJkX2J1ZiA9IGJ1ZjsNCj4g IA0KPiBAQCAtNTMwLDExICs1MzAsMTEgQEAgYWJkX3B1dChhYmRfdCAqYWJkKQ0KPiAgCUFTU0VS VCghKGFiZC0+YWJkX2ZsYWdzICYgQUJEX0ZMQUdfT1dORVIpKTsNCj4gIA0KPiAgCWlmIChhYmQt PmFiZF9wYXJlbnQgIT0gTlVMTCkgew0KPiAtCQkodm9pZCkgcmVmY291bnRfcmVtb3ZlX21hbnko JmFiZC0+YWJkX3BhcmVudC0+YWJkX2NoaWxkcmVuLA0KPiArCQkodm9pZCkgemZzX3JlZmNvdW50 X3JlbW92ZV9tYW55KCZhYmQtPmFiZF9wYXJlbnQtPmFiZF9jaGlsZHJlbiwNCj4gIAkJICAgIGFi ZC0+YWJkX3NpemUsIGFiZCk7DQo+ICAJfQ0KPiAgDQo+IC0JcmVmY291bnRfZGVzdHJveSgmYWJk LT5hYmRfY2hpbGRyZW4pOw0KPiArCXpmc19yZWZjb3VudF9kZXN0cm95KCZhYmQtPmFiZF9jaGls ZHJlbik7DQo+ICAJYWJkX2ZyZWVfc3RydWN0KGFiZCk7DQo+ICB9DQo+ICANCj4gQEAgLTU2Niw3 ICs1NjYsNyBAQCBhYmRfYm9ycm93X2J1ZihhYmRfdCAqYWJkLCBzaXplX3QgbikNCj4gIAl9IGVs c2Ugew0KPiAgCQlidWYgPSB6aW9fYnVmX2FsbG9jKG4pOw0KPiAgCX0NCj4gLQkodm9pZCkgcmVm Y291bnRfYWRkX21hbnkoJmFiZC0+YWJkX2NoaWxkcmVuLCBuLCBidWYpOw0KPiArCSh2b2lkKSB6 ZnNfcmVmY291bnRfYWRkX21hbnkoJmFiZC0+YWJkX2NoaWxkcmVuLCBuLCBidWYpOw0KPiAgDQo+ ICAJcmV0dXJuIChidWYpOw0KPiAgfQ0KPiBAQCAtNTk4LDcgKzU5OCw3IEBAIGFiZF9yZXR1cm5f YnVmKGFiZF90ICphYmQsIHZvaWQgKmJ1Ziwgc2l6ZV90IG4pDQo+ICAJCUFTU0VSVDAoYWJkX2Nt cF9idWYoYWJkLCBidWYsIG4pKTsNCj4gIAkJemlvX2J1Zl9mcmVlKGJ1Ziwgbik7DQo+ICAJfQ0K PiAtCSh2b2lkKSByZWZjb3VudF9yZW1vdmVfbWFueSgmYWJkLT5hYmRfY2hpbGRyZW4sIG4sIGJ1 Zik7DQo+ICsJKHZvaWQpIHpmc19yZWZjb3VudF9yZW1vdmVfbWFueSgmYWJkLT5hYmRfY2hpbGRy ZW4sIG4sIGJ1Zik7DQo+ICB9DQo+ICANCj4gIHZvaWQNCj4gDQo+IE1vZGlmaWVkOiBoZWFkL3N5 cy9jZGRsL2NvbnRyaWIvb3BlbnNvbGFyaXMvdXRzL2NvbW1vbi9mcy96ZnMvYXJjLmMNCj4gPT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09DQo+IC0tLSBoZWFkL3N5cy9jZGRsL2NvbnRyaWIvb3BlbnNvbGFy aXMvdXRzL2NvbW1vbi9mcy96ZnMvYXJjLmMJVHVlIE9jdCAxNSAxNDo1MToyMg0KPiAyMDE5CShy MzUzNTY0KSArKysgaGVhZC9zeXMvY2RkbC9jb250cmliL29wZW5zb2xhcmlzL3V0cy9jb21tb24v ZnMvemZzL2FyYy5jDQo+IFR1ZSBPY3QgMTUgMTU6MDk6MzYgMjAxOQkocjM1MzU2NSkgQEAgLTUz OCwxMiArNTM4LDEyIEBAIHR5cGVkZWYgc3RydWN0IGFyY19zdGF0ZSB7DQo+ICAJLyoNCj4gIAkg KiB0b3RhbCBhbW91bnQgb2YgZXZpY3RhYmxlIGRhdGEgaW4gdGhpcyBzdGF0ZQ0KPiAgCSAqLw0K PiAtCXJlZmNvdW50X3QgYXJjc19lc2l6ZVtBUkNfQlVGQ19OVU1UWVBFU107DQo+ICsJemZzX3Jl ZmNvdW50X3QgYXJjc19lc2l6ZVtBUkNfQlVGQ19OVU1UWVBFU107DQo+ICAJLyoNCj4gIAkgKiB0 b3RhbCBhbW91bnQgb2YgZGF0YSBpbiB0aGlzIHN0YXRlOyB0aGlzIGluY2x1ZGVzOiBldmljdGFi bGUsDQo+ICAJICogbm9uLWV2aWN0YWJsZSwgQVJDX0JVRkNfREFUQSwgYW5kIEFSQ19CVUZDX01F VEFEQVRBLg0KPiAgCSAqLw0KPiAtCXJlZmNvdW50X3QgYXJjc19zaXplOw0KPiArCXpmc19yZWZj b3VudF90IGFyY3Nfc2l6ZTsNCj4gIAkvKg0KPiAgCSAqIHN1cHBvcnRzIHRoZSAiZGJ1ZnMiIGtz dGF0DQo+ICAJICovDQo+IEBAIC0xMTU4LDcgKzExNTgsNyBAQCB0eXBlZGVmIHN0cnVjdCBsMWFy Y19idWZfaGRyIHsNCj4gIAl1aW50MzJfdAkJYl9sMl9oaXRzOw0KPiAgDQo+ICAJLyogc2VsZiBw cm90ZWN0aW5nICovDQo+IC0JcmVmY291bnRfdAkJYl9yZWZjbnQ7DQo+ICsJemZzX3JlZmNvdW50 X3QJCWJfcmVmY250Ow0KPiAgDQo+ICAJYXJjX2NhbGxiYWNrX3QJCSpiX2FjYjsNCj4gIAlhYmRf dAkJCSpiX3BhYmQ7DQo+IEBAIC0xNTM0LDcgKzE1MzQsNyBAQCBzdHJ1Y3QgbDJhcmNfZGV2IHsN Cj4gIAlrbXV0ZXhfdAkJbDJhZF9tdHg7CS8qIGxvY2sgZm9yIGJ1ZmZlciBsaXN0ICovDQo+ICAJ bGlzdF90CQkJbDJhZF9idWZsaXN0OwkvKiBidWZmZXIgbGlzdCAqLw0KPiAgCWxpc3Rfbm9kZV90 CQlsMmFkX25vZGU7CS8qIGRldmljZSBsaXN0IG5vZGUgKi8NCj4gLQlyZWZjb3VudF90CQlsMmFk X2FsbG9jOwkvKiBhbGxvY2F0ZWQgYnl0ZXMgKi8NCj4gKwl6ZnNfcmVmY291bnRfdAkJbDJhZF9h bGxvYzsJLyogYWxsb2NhdGVkIGJ5dGVzICovDQo+ICB9Ow0KPiAgDQo+ICBzdGF0aWMgbGlzdF90 IEwyQVJDX2Rldl9saXN0OwkJCS8qIGRldmljZSBsaXN0ICovDQo+IEBAIC0xNzY1LDcgKzE3NjUs NyBAQCBoZHJfZnVsbF9jb25zKHZvaWQgKnZidWYsIHZvaWQgKnVudXNlZCwgaW50IGttZmxhZykN Cj4gIA0KPiAgCWJ6ZXJvKGhkciwgSERSX0ZVTExfU0laRSk7DQo+ICAJY3ZfaW5pdCgmaGRyLT5i X2wxaGRyLmJfY3YsIE5VTEwsIENWX0RFRkFVTFQsIE5VTEwpOw0KPiAtCXJlZmNvdW50X2NyZWF0 ZSgmaGRyLT5iX2wxaGRyLmJfcmVmY250KTsNCj4gKwl6ZnNfcmVmY291bnRfY3JlYXRlKCZoZHIt PmJfbDFoZHIuYl9yZWZjbnQpOw0KPiAgCW11dGV4X2luaXQoJmhkci0+Yl9sMWhkci5iX2ZyZWV6 ZV9sb2NrLCBOVUxMLCBNVVRFWF9ERUZBVUxULCBOVUxMKTsNCj4gIAltdWx0aWxpc3RfbGlua19p bml0KCZoZHItPmJfbDFoZHIuYl9hcmNfbm9kZSk7DQo+ICAJYXJjX3NwYWNlX2NvbnN1bWUoSERS X0ZVTExfU0laRSwgQVJDX1NQQUNFX0hEUlMpOw0KPiBAQCAtMTgxMCw3ICsxODEwLDcgQEAgaGRy X2Z1bGxfZGVzdCh2b2lkICp2YnVmLCB2b2lkICp1bnVzZWQpDQo+ICANCj4gIAlBU1NFUlQoSERS X0VNUFRZKGhkcikpOw0KPiAgCWN2X2Rlc3Ryb3koJmhkci0+Yl9sMWhkci5iX2N2KTsNCj4gLQly ZWZjb3VudF9kZXN0cm95KCZoZHItPmJfbDFoZHIuYl9yZWZjbnQpOw0KPiArCXpmc19yZWZjb3Vu dF9kZXN0cm95KCZoZHItPmJfbDFoZHIuYl9yZWZjbnQpOw0KPiAgCW11dGV4X2Rlc3Ryb3koJmhk ci0+Yl9sMWhkci5iX2ZyZWV6ZV9sb2NrKTsNCj4gIAlBU1NFUlQoIW11bHRpbGlzdF9saW5rX2Fj dGl2ZSgmaGRyLT5iX2wxaGRyLmJfYXJjX25vZGUpKTsNCj4gIAlhcmNfc3BhY2VfcmV0dXJuKEhE Ul9GVUxMX1NJWkUsIEFSQ19TUEFDRV9IRFJTKTsNCj4gQEAgLTI0OTUsMjEgKzI0OTUsMjEgQEAg YXJjX2V2aWN0YWJsZV9zcGFjZV9pbmNyZW1lbnQoYXJjX2J1Zl9oZHJfdCAqaGRyLCBhcmNfDQo+ ICAJCUFTU0VSVDAoaGRyLT5iX2wxaGRyLmJfYnVmY250KTsNCj4gIAkJQVNTRVJUM1AoaGRyLT5i X2wxaGRyLmJfYnVmLCA9PSwgTlVMTCk7DQo+ICAJCUFTU0VSVDNQKGhkci0+Yl9sMWhkci5iX3Bh YmQsID09LCBOVUxMKTsNCj4gLQkJKHZvaWQpIHJlZmNvdW50X2FkZF9tYW55KCZzdGF0ZS0+YXJj c19lc2l6ZVt0eXBlXSwNCj4gKwkJKHZvaWQpIHpmc19yZWZjb3VudF9hZGRfbWFueSgmc3RhdGUt PmFyY3NfZXNpemVbdHlwZV0sDQo+ICAJCSAgICBIRFJfR0VUX0xTSVpFKGhkciksIGhkcik7DQo+ ICAJCXJldHVybjsNCj4gIAl9DQo+ICANCj4gIAlBU1NFUlQoIUdIT1NUX1NUQVRFKHN0YXRlKSk7 DQo+ICAJaWYgKGhkci0+Yl9sMWhkci5iX3BhYmQgIT0gTlVMTCkgew0KPiAtCQkodm9pZCkgcmVm Y291bnRfYWRkX21hbnkoJnN0YXRlLT5hcmNzX2VzaXplW3R5cGVdLA0KPiArCQkodm9pZCkgemZz X3JlZmNvdW50X2FkZF9tYW55KCZzdGF0ZS0+YXJjc19lc2l6ZVt0eXBlXSwNCj4gIAkJICAgIGFy Y19oZHJfc2l6ZShoZHIpLCBoZHIpOw0KPiAgCX0NCj4gIAlmb3IgKGFyY19idWZfdCAqYnVmID0g aGRyLT5iX2wxaGRyLmJfYnVmOyBidWYgIT0gTlVMTDsNCj4gIAkgICAgYnVmID0gYnVmLT5iX25l eHQpIHsNCj4gIAkJaWYgKGFyY19idWZfaXNfc2hhcmVkKGJ1ZikpDQo+ICAJCQljb250aW51ZTsN Cj4gLQkJKHZvaWQpIHJlZmNvdW50X2FkZF9tYW55KCZzdGF0ZS0+YXJjc19lc2l6ZVt0eXBlXSwN Cj4gKwkJKHZvaWQpIHpmc19yZWZjb3VudF9hZGRfbWFueSgmc3RhdGUtPmFyY3NfZXNpemVbdHlw ZV0sDQo+ICAJCSAgICBhcmNfYnVmX3NpemUoYnVmKSwgYnVmKTsNCj4gIAl9DQo+ICB9DQo+IEBA IC0yNTMwLDIxICsyNTMwLDIxIEBAIGFyY19ldmljdGFibGVfc3BhY2VfZGVjcmVtZW50KGFyY19i dWZfaGRyX3QgKmhkciwgYXJjXw0KPiAgCQlBU1NFUlQwKGhkci0+Yl9sMWhkci5iX2J1ZmNudCk7 DQo+ICAJCUFTU0VSVDNQKGhkci0+Yl9sMWhkci5iX2J1ZiwgPT0sIE5VTEwpOw0KPiAgCQlBU1NF UlQzUChoZHItPmJfbDFoZHIuYl9wYWJkLCA9PSwgTlVMTCk7DQo+IC0JCSh2b2lkKSByZWZjb3Vu dF9yZW1vdmVfbWFueSgmc3RhdGUtPmFyY3NfZXNpemVbdHlwZV0sDQo+ICsJCSh2b2lkKSB6ZnNf cmVmY291bnRfcmVtb3ZlX21hbnkoJnN0YXRlLT5hcmNzX2VzaXplW3R5cGVdLA0KPiAgCQkgICAg SERSX0dFVF9MU0laRShoZHIpLCBoZHIpOw0KPiAgCQlyZXR1cm47DQo+ICAJfQ0KPiAgDQo+ICAJ QVNTRVJUKCFHSE9TVF9TVEFURShzdGF0ZSkpOw0KPiAgCWlmIChoZHItPmJfbDFoZHIuYl9wYWJk ICE9IE5VTEwpIHsNCj4gLQkJKHZvaWQpIHJlZmNvdW50X3JlbW92ZV9tYW55KCZzdGF0ZS0+YXJj c19lc2l6ZVt0eXBlXSwNCj4gKwkJKHZvaWQpIHpmc19yZWZjb3VudF9yZW1vdmVfbWFueSgmc3Rh dGUtPmFyY3NfZXNpemVbdHlwZV0sDQo+ICAJCSAgICBhcmNfaGRyX3NpemUoaGRyKSwgaGRyKTsN Cj4gIAl9DQo+ICAJZm9yIChhcmNfYnVmX3QgKmJ1ZiA9IGhkci0+Yl9sMWhkci5iX2J1ZjsgYnVm ICE9IE5VTEw7DQo+ICAJICAgIGJ1ZiA9IGJ1Zi0+Yl9uZXh0KSB7DQo+ICAJCWlmIChhcmNfYnVm X2lzX3NoYXJlZChidWYpKQ0KPiAgCQkJY29udGludWU7DQo+IC0JCSh2b2lkKSByZWZjb3VudF9y ZW1vdmVfbWFueSgmc3RhdGUtPmFyY3NfZXNpemVbdHlwZV0sDQo+ICsJCSh2b2lkKSB6ZnNfcmVm Y291bnRfcmVtb3ZlX21hbnkoJnN0YXRlLT5hcmNzX2VzaXplW3R5cGVdLA0KPiAgCQkgICAgYXJj X2J1Zl9zaXplKGJ1ZiksIGJ1Zik7DQo+ICAJfQ0KPiAgfQ0KPiBAQCAtMjU2MSwxMyArMjU2MSwx MyBAQCBhZGRfcmVmZXJlbmNlKGFyY19idWZfaGRyX3QgKmhkciwgdm9pZCAqdGFnKQ0KPiAgCUFT U0VSVChIRFJfSEFTX0wxSERSKGhkcikpOw0KPiAgCWlmICghTVVURVhfSEVMRChIRFJfTE9DSyho ZHIpKSkgew0KPiAgCQlBU1NFUlQoaGRyLT5iX2wxaGRyLmJfc3RhdGUgPT0gYXJjX2Fub24pOw0K PiAtCQlBU1NFUlQocmVmY291bnRfaXNfemVybygmaGRyLT5iX2wxaGRyLmJfcmVmY250KSk7DQo+ ICsJCUFTU0VSVCh6ZnNfcmVmY291bnRfaXNfemVybygmaGRyLT5iX2wxaGRyLmJfcmVmY250KSk7 DQo+ICAJCUFTU0VSVDNQKGhkci0+Yl9sMWhkci5iX2J1ZiwgPT0sIE5VTEwpOw0KPiAgCX0NCj4g IA0KPiAgCWFyY19zdGF0ZV90ICpzdGF0ZSA9IGhkci0+Yl9sMWhkci5iX3N0YXRlOw0KPiAgDQo+ IC0JaWYgKChyZWZjb3VudF9hZGQoJmhkci0+Yl9sMWhkci5iX3JlZmNudCwgdGFnKSA9PSAxKSAm Jg0KPiArCWlmICgoemZzX3JlZmNvdW50X2FkZCgmaGRyLT5iX2wxaGRyLmJfcmVmY250LCB0YWcp ID09IDEpICYmDQo+ICAJICAgIChzdGF0ZSAhPSBhcmNfYW5vbikpIHsNCj4gIAkJLyogV2UgZG9u J3QgdXNlIHRoZSBMMi1vbmx5IHN0YXRlIGxpc3QuICovDQo+ICAJCWlmIChzdGF0ZSAhPSBhcmNf bDJjX29ubHkpIHsNCj4gQEAgLTI1OTksNyArMjU5OSw3IEBAIHJlbW92ZV9yZWZlcmVuY2UoYXJj X2J1Zl9oZHJfdCAqaGRyLCBrbXV0ZXhfdCAqaGFzaF9sbw0KPiAgCSAqIGFyY19sMmNfb25seSBj b3VudHMgYXMgYSBnaG9zdCBzdGF0ZSBzbyB3ZSBkb24ndCBuZWVkIHRvIGV4cGxpY2l0bHkNCj4g IAkgKiBjaGVjayB0byBwcmV2ZW50IHVzYWdlIG9mIHRoZSBhcmNfbDJjX29ubHkgbGlzdC4NCj4g IAkgKi8NCj4gLQlpZiAoKChjbnQgPSByZWZjb3VudF9yZW1vdmUoJmhkci0+Yl9sMWhkci5iX3Jl ZmNudCwgdGFnKSkgPT0gMCkgJiYNCj4gKwlpZiAoKChjbnQgPSB6ZnNfcmVmY291bnRfcmVtb3Zl KCZoZHItPmJfbDFoZHIuYl9yZWZjbnQsIHRhZykpID09IDApICYmDQo+ICAJICAgIChzdGF0ZSAh PSBhcmNfYW5vbikpIHsNCj4gIAkJbXVsdGlsaXN0X2luc2VydChzdGF0ZS0+YXJjc19saXN0W2Fy Y19idWZfdHlwZShoZHIpXSwgaGRyKTsNCj4gIAkJQVNTRVJUM1UoaGRyLT5iX2wxaGRyLmJfYnVm Y250LCA+LCAwKTsNCj4gQEAgLTI2NDQsNyArMjY0NCw3IEBAIGFyY19idWZfaW5mbyhhcmNfYnVm X3QgKmFiLCBhcmNfYnVmX2luZm9fdCAqYWJpLCBpbnQgcw0KPiAgCQlhYmktPmFiaV9tcnVfZ2hv c3RfaGl0cyA9IGwxaGRyLT5iX21ydV9naG9zdF9oaXRzOw0KPiAgCQlhYmktPmFiaV9tZnVfaGl0 cyA9IGwxaGRyLT5iX21mdV9oaXRzOw0KPiAgCQlhYmktPmFiaV9tZnVfZ2hvc3RfaGl0cyA9IGwx aGRyLT5iX21mdV9naG9zdF9oaXRzOw0KPiAtCQlhYmktPmFiaV9ob2xkcyA9IHJlZmNvdW50X2Nv dW50KCZsMWhkci0+Yl9yZWZjbnQpOw0KPiArCQlhYmktPmFiaV9ob2xkcyA9IHpmc19yZWZjb3Vu dF9jb3VudCgmbDFoZHItPmJfcmVmY250KTsNCj4gIAl9DQo+ICANCj4gIAlpZiAobDJoZHIpIHsN Cj4gQEAgLTI2ODAsNyArMjY4MCw3IEBAIGFyY19jaGFuZ2Vfc3RhdGUoYXJjX3N0YXRlX3QgKm5l d19zdGF0ZSwgYXJjX2J1Zl9oZHJfdA0KPiAgCSAqLw0KPiAgCWlmIChIRFJfSEFTX0wxSERSKGhk cikpIHsNCj4gIAkJb2xkX3N0YXRlID0gaGRyLT5iX2wxaGRyLmJfc3RhdGU7DQo+IC0JCXJlZmNu dCA9IHJlZmNvdW50X2NvdW50KCZoZHItPmJfbDFoZHIuYl9yZWZjbnQpOw0KPiArCQlyZWZjbnQg PSB6ZnNfcmVmY291bnRfY291bnQoJmhkci0+Yl9sMWhkci5iX3JlZmNudCk7DQo+ICAJCWJ1ZmNu dCA9IGhkci0+Yl9sMWhkci5iX2J1ZmNudDsNCj4gIAkJdXBkYXRlX29sZCA9IChidWZjbnQgPiAw IHx8IGhkci0+Yl9sMWhkci5iX3BhYmQgIT0gTlVMTCk7DQo+ICAJfSBlbHNlIHsNCj4gQEAgLTI3 NTAsNyArMjc1MCw3IEBAIGFyY19jaGFuZ2Vfc3RhdGUoYXJjX3N0YXRlX3QgKm5ld19zdGF0ZSwg YXJjX2J1Zl9oZHJfdA0KPiAgCQkJICogdGhlIHJlZmVyZW5jZS4gQXMgYSByZXN1bHQsIHdlIHVz ZSB0aGUgYXJjDQo+ICAJCQkgKiBoZWFkZXIgcG9pbnRlciBmb3IgdGhlIHJlZmVyZW5jZS4NCj4g IAkJCSAqLw0KPiAtCQkJKHZvaWQpIHJlZmNvdW50X2FkZF9tYW55KCZuZXdfc3RhdGUtPmFyY3Nf c2l6ZSwNCj4gKwkJCSh2b2lkKSB6ZnNfcmVmY291bnRfYWRkX21hbnkoJm5ld19zdGF0ZS0+YXJj c19zaXplLA0KPiAgCQkJICAgIEhEUl9HRVRfTFNJWkUoaGRyKSwgaGRyKTsNCj4gIAkJCUFTU0VS VDNQKGhkci0+Yl9sMWhkci5iX3BhYmQsID09LCBOVUxMKTsNCj4gIAkJfSBlbHNlIHsNCj4gQEAg LTI3NzYsMTMgKzI3NzYsMTUgQEAgYXJjX2NoYW5nZV9zdGF0ZShhcmNfc3RhdGVfdCAqbmV3X3N0 YXRlLCBhcmNfYnVmX2hkcl90DQo+ICAJCQkJaWYgKGFyY19idWZfaXNfc2hhcmVkKGJ1ZikpDQo+ ICAJCQkJCWNvbnRpbnVlOw0KPiAgDQo+IC0JCQkJKHZvaWQpIHJlZmNvdW50X2FkZF9tYW55KCZu ZXdfc3RhdGUtPmFyY3Nfc2l6ZSwNCj4gKwkJCQkodm9pZCkgemZzX3JlZmNvdW50X2FkZF9tYW55 KA0KPiArCQkJCSAgICAmbmV3X3N0YXRlLT5hcmNzX3NpemUsDQo+ICAJCQkJICAgIGFyY19idWZf c2l6ZShidWYpLCBidWYpOw0KPiAgCQkJfQ0KPiAgCQkJQVNTRVJUM1UoYnVmY250LCA9PSwgYnVm ZmVycyk7DQo+ICANCj4gIAkJCWlmIChoZHItPmJfbDFoZHIuYl9wYWJkICE9IE5VTEwpIHsNCj4g LQkJCQkodm9pZCkgcmVmY291bnRfYWRkX21hbnkoJm5ld19zdGF0ZS0+YXJjc19zaXplLA0KPiAr CQkJCSh2b2lkKSB6ZnNfcmVmY291bnRfYWRkX21hbnkoDQo+ICsJCQkJICAgICZuZXdfc3RhdGUt PmFyY3Nfc2l6ZSwNCj4gIAkJCQkgICAgYXJjX2hkcl9zaXplKGhkciksIGhkcik7DQo+ICAJCQl9 IGVsc2Ugew0KPiAgCQkJCUFTU0VSVChHSE9TVF9TVEFURShvbGRfc3RhdGUpKTsNCj4gQEAgLTI4 MDQsNyArMjgwNiw3IEBAIGFyY19jaGFuZ2Vfc3RhdGUoYXJjX3N0YXRlX3QgKm5ld19zdGF0ZSwg YXJjX2J1Zl9oZHJfdA0KPiAgCQkJICogaGVhZGVyIG9uIHRoZSBnaG9zdCBzdGF0ZS4NCj4gIAkJ CSAqLw0KPiAgDQo+IC0JCQkodm9pZCkgcmVmY291bnRfcmVtb3ZlX21hbnkoJm9sZF9zdGF0ZS0+ YXJjc19zaXplLA0KPiArCQkJKHZvaWQpIHpmc19yZWZjb3VudF9yZW1vdmVfbWFueSgmb2xkX3N0 YXRlLT5hcmNzX3NpemUsDQo+ICAJCQkgICAgSERSX0dFVF9MU0laRShoZHIpLCBoZHIpOw0KPiAg CQl9IGVsc2Ugew0KPiAgCQkJdWludDMyX3QgYnVmZmVycyA9IDA7DQo+IEBAIC0yODI5LDEzICsy ODMxLDEzIEBAIGFyY19jaGFuZ2Vfc3RhdGUoYXJjX3N0YXRlX3QgKm5ld19zdGF0ZSwgYXJjX2J1 Zl9oZHJfdA0KPiAgCQkJCWlmIChhcmNfYnVmX2lzX3NoYXJlZChidWYpKQ0KPiAgCQkJCQljb250 aW51ZTsNCj4gIA0KPiAtCQkJCSh2b2lkKSByZWZjb3VudF9yZW1vdmVfbWFueSgNCj4gKwkJCQko dm9pZCkgemZzX3JlZmNvdW50X3JlbW92ZV9tYW55KA0KPiAgCQkJCSAgICAmb2xkX3N0YXRlLT5h cmNzX3NpemUsIGFyY19idWZfc2l6ZShidWYpLA0KPiAgCQkJCSAgICBidWYpOw0KPiAgCQkJfQ0K PiAgCQkJQVNTRVJUM1UoYnVmY250LCA9PSwgYnVmZmVycyk7DQo+ICAJCQlBU1NFUlQzUChoZHIt PmJfbDFoZHIuYl9wYWJkLCAhPSwgTlVMTCk7DQo+IC0JCQkodm9pZCkgcmVmY291bnRfcmVtb3Zl X21hbnkoDQo+ICsJCQkodm9pZCkgemZzX3JlZmNvdW50X3JlbW92ZV9tYW55KA0KPiAgCQkJICAg ICZvbGRfc3RhdGUtPmFyY3Nfc2l6ZSwgYXJjX2hkcl9zaXplKGhkciksIGhkcik7DQo+ICAJCX0N Cj4gIAl9DQo+IEBAIC0zMTAxLDggKzMxMDMsOCBAQCBhcmNfcmV0dXJuX2J1ZihhcmNfYnVmX3Qg KmJ1Ziwgdm9pZCAqdGFnKQ0KPiAgDQo+ICAJQVNTRVJUM1AoYnVmLT5iX2RhdGEsICE9LCBOVUxM KTsNCj4gIAlBU1NFUlQoSERSX0hBU19MMUhEUihoZHIpKTsNCj4gLQkodm9pZCkgcmVmY291bnRf YWRkKCZoZHItPmJfbDFoZHIuYl9yZWZjbnQsIHRhZyk7DQo+IC0JKHZvaWQpIHJlZmNvdW50X3Jl bW92ZSgmaGRyLT5iX2wxaGRyLmJfcmVmY250LCBhcmNfb25sb2FuX3RhZyk7DQo+ICsJKHZvaWQp IHpmc19yZWZjb3VudF9hZGQoJmhkci0+Yl9sMWhkci5iX3JlZmNudCwgdGFnKTsNCj4gKwkodm9p ZCkgemZzX3JlZmNvdW50X3JlbW92ZSgmaGRyLT5iX2wxaGRyLmJfcmVmY250LCBhcmNfb25sb2Fu X3RhZyk7DQo+ICANCj4gIAlhcmNfbG9hbmVkX2J5dGVzX3VwZGF0ZSgtYXJjX2J1Zl9zaXplKGJ1 ZikpOw0KPiAgfQ0KPiBAQCAtMzExNSw4ICszMTE3LDggQEAgYXJjX2xvYW5faW51c2VfYnVmKGFy Y19idWZfdCAqYnVmLCB2b2lkICp0YWcpDQo+ICANCj4gIAlBU1NFUlQzUChidWYtPmJfZGF0YSwg IT0sIE5VTEwpOw0KPiAgCUFTU0VSVChIRFJfSEFTX0wxSERSKGhkcikpOw0KPiAtCSh2b2lkKSBy ZWZjb3VudF9hZGQoJmhkci0+Yl9sMWhkci5iX3JlZmNudCwgYXJjX29ubG9hbl90YWcpOw0KPiAt CSh2b2lkKSByZWZjb3VudF9yZW1vdmUoJmhkci0+Yl9sMWhkci5iX3JlZmNudCwgdGFnKTsNCj4g Kwkodm9pZCkgemZzX3JlZmNvdW50X2FkZCgmaGRyLT5iX2wxaGRyLmJfcmVmY250LCBhcmNfb25s b2FuX3RhZyk7DQo+ICsJKHZvaWQpIHpmc19yZWZjb3VudF9yZW1vdmUoJmhkci0+Yl9sMWhkci5i X3JlZmNudCwgdGFnKTsNCj4gIA0KPiAgCWFyY19sb2FuZWRfYnl0ZXNfdXBkYXRlKGFyY19idWZf c2l6ZShidWYpKTsNCj4gIH0NCj4gQEAgLTMxNDMsMTMgKzMxNDUsMTMgQEAgYXJjX2hkcl9mcmVl X29uX3dyaXRlKGFyY19idWZfaGRyX3QgKmhkcikNCj4gIA0KPiAgCS8qIHByb3RlY3RlZCBieSBo YXNoIGxvY2ssIGlmIGluIHRoZSBoYXNoIHRhYmxlICovDQo+ICAJaWYgKG11bHRpbGlzdF9saW5r X2FjdGl2ZSgmaGRyLT5iX2wxaGRyLmJfYXJjX25vZGUpKSB7DQo+IC0JCUFTU0VSVChyZWZjb3Vu dF9pc196ZXJvKCZoZHItPmJfbDFoZHIuYl9yZWZjbnQpKTsNCj4gKwkJQVNTRVJUKHpmc19yZWZj b3VudF9pc196ZXJvKCZoZHItPmJfbDFoZHIuYl9yZWZjbnQpKTsNCj4gIAkJQVNTRVJUKHN0YXRl ICE9IGFyY19hbm9uICYmIHN0YXRlICE9IGFyY19sMmNfb25seSk7DQo+ICANCj4gLQkJKHZvaWQp IHJlZmNvdW50X3JlbW92ZV9tYW55KCZzdGF0ZS0+YXJjc19lc2l6ZVt0eXBlXSwNCj4gKwkJKHZv aWQpIHpmc19yZWZjb3VudF9yZW1vdmVfbWFueSgmc3RhdGUtPmFyY3NfZXNpemVbdHlwZV0sDQo+ ICAJCSAgICBzaXplLCBoZHIpOw0KPiAgCX0NCj4gLQkodm9pZCkgcmVmY291bnRfcmVtb3ZlX21h bnkoJnN0YXRlLT5hcmNzX3NpemUsIHNpemUsIGhkcik7DQo+ICsJKHZvaWQpIHpmc19yZWZjb3Vu dF9yZW1vdmVfbWFueSgmc3RhdGUtPmFyY3Nfc2l6ZSwgc2l6ZSwgaGRyKTsNCj4gIAlpZiAodHlw ZSA9PSBBUkNfQlVGQ19NRVRBREFUQSkgew0KPiAgCQlhcmNfc3BhY2VfcmV0dXJuKHNpemUsIEFS Q19TUEFDRV9NRVRBKTsNCj4gIAl9IGVsc2Ugew0KPiBAQCAtMzE3OSw3ICszMTgxLDcgQEAgYXJj X3NoYXJlX2J1ZihhcmNfYnVmX2hkcl90ICpoZHIsIGFyY19idWZfdCAqYnVmKQ0KPiAgCSAqIHJl ZmNvdW50IG93bmVyc2hpcCB0byB0aGUgaGRyIHNpbmNlIGl0IGFsd2F5cyBvd25zDQo+ICAJICog dGhlIHJlZmNvdW50IHdoZW5ldmVyIGFuIGFyY19idWZfdCBpcyBzaGFyZWQuDQo+ICAJICovDQo+ IC0JcmVmY291bnRfdHJhbnNmZXJfb3duZXJzaGlwKCZzdGF0ZS0+YXJjc19zaXplLCBidWYsIGhk cik7DQo+ICsJemZzX3JlZmNvdW50X3RyYW5zZmVyX293bmVyc2hpcCgmc3RhdGUtPmFyY3Nfc2l6 ZSwgYnVmLCBoZHIpOw0KPiAgCWhkci0+Yl9sMWhkci5iX3BhYmQgPSBhYmRfZ2V0X2Zyb21fYnVm KGJ1Zi0+Yl9kYXRhLCBhcmNfYnVmX3NpemUoYnVmKSk7DQo+ICAJYWJkX3Rha2Vfb3duZXJzaGlw X29mX2J1ZihoZHItPmJfbDFoZHIuYl9wYWJkLA0KPiAgCSAgICBIRFJfSVNUWVBFX01FVEFEQVRB KGhkcikpOw0KPiBAQCAtMzIwOSw3ICszMjExLDcgQEAgYXJjX3Vuc2hhcmVfYnVmKGFyY19idWZf aGRyX3QgKmhkciwgYXJjX2J1Zl90ICpidWYpDQo+ICAJICogV2UgYXJlIG5vIGxvbmdlciBzaGFy aW5nIHRoaXMgYnVmZmVyIHNvIHdlIG5lZWQNCj4gIAkgKiB0byB0cmFuc2ZlciBpdHMgb3duZXJz aGlwIHRvIHRoZSByaWdodGZ1bCBvd25lci4NCj4gIAkgKi8NCj4gLQlyZWZjb3VudF90cmFuc2Zl cl9vd25lcnNoaXAoJnN0YXRlLT5hcmNzX3NpemUsIGhkciwgYnVmKTsNCj4gKwl6ZnNfcmVmY291 bnRfdHJhbnNmZXJfb3duZXJzaGlwKCZzdGF0ZS0+YXJjc19zaXplLCBoZHIsIGJ1Zik7DQo+ICAJ YXJjX2hkcl9jbGVhcl9mbGFncyhoZHIsIEFSQ19GTEFHX1NIQVJFRF9EQVRBKTsNCj4gIAlhYmRf cmVsZWFzZV9vd25lcnNoaXBfb2ZfYnVmKGhkci0+Yl9sMWhkci5iX3BhYmQpOw0KPiAgCWFiZF9w dXQoaGRyLT5iX2wxaGRyLmJfcGFiZCk7DQo+IEBAIC0zNDM2LDcgKzM0MzgsNyBAQCBhcmNfaGRy X2FsbG9jKHVpbnQ2NF90IHNwYSwgaW50MzJfdCBwc2l6ZSwgaW50MzJfdCBsc2kNCj4gIAkgKiBp dCByZWZlcmVuY2VzIGFuZCBjb21wcmVzc2VkIGFyYyBlbmFibGVtZW50Lg0KPiAgCSAqLw0KPiAg CWFyY19oZHJfYWxsb2NfcGFiZChoZHIsIEJfVFJVRSk7DQo+IC0JQVNTRVJUKHJlZmNvdW50X2lz X3plcm8oJmhkci0+Yl9sMWhkci5iX3JlZmNudCkpOw0KPiArCUFTU0VSVCh6ZnNfcmVmY291bnRf aXNfemVybygmaGRyLT5iX2wxaGRyLmJfcmVmY250KSk7DQo+ICANCj4gIAlyZXR1cm4gKGhkcik7 DQo+ICB9DQo+IEBAIC0zNTM4LDggKzM1NDAsMTAgQEAgYXJjX2hkcl9yZWFsbG9jKGFyY19idWZf aGRyX3QgKmhkciwga21lbV9jYWNoZV90ICpvbGQsDQo+ICAJICogdGhlIHdyb25nIHBvaW50ZXIg YWRkcmVzcyB3aGVuIGNhbGxpbmcgYXJjX2hkcl9kZXN0cm95KCkgbGF0ZXIuDQo+ICAJICovDQo+ ICANCj4gLQkodm9pZCkgcmVmY291bnRfcmVtb3ZlX21hbnkoJmRldi0+bDJhZF9hbGxvYywgYXJj X2hkcl9zaXplKGhkciksIGhkcik7DQo+IC0JKHZvaWQpIHJlZmNvdW50X2FkZF9tYW55KCZkZXYt PmwyYWRfYWxsb2MsIGFyY19oZHJfc2l6ZShuaGRyKSwgbmhkcik7DQo+ICsJKHZvaWQpIHpmc19y ZWZjb3VudF9yZW1vdmVfbWFueSgmZGV2LT5sMmFkX2FsbG9jLCBhcmNfaGRyX3NpemUoaGRyKSwN Cj4gKwkgICAgaGRyKTsNCj4gKwkodm9pZCkgemZzX3JlZmNvdW50X2FkZF9tYW55KCZkZXYtPmwy YWRfYWxsb2MsIGFyY19oZHJfc2l6ZShuaGRyKSwNCj4gKwkgICAgbmhkcik7DQo+ICANCj4gIAli dWZfZGlzY2FyZF9pZGVudGl0eShoZHIpOw0KPiAgCWttZW1fY2FjaGVfZnJlZShvbGQsIGhkcik7 DQo+IEBAIC0zNjE5LDcgKzM2MjMsNyBAQCBhcmNfaGRyX2wyaGRyX2Rlc3Ryb3koYXJjX2J1Zl9o ZHJfdCAqaGRyKQ0KPiAgDQo+ICAJdmRldl9zcGFjZV91cGRhdGUoZGV2LT5sMmFkX3ZkZXYsIC1w c2l6ZSwgMCwgMCk7DQo+ICANCj4gLQkodm9pZCkgcmVmY291bnRfcmVtb3ZlX21hbnkoJmRldi0+ bDJhZF9hbGxvYywgcHNpemUsIGhkcik7DQo+ICsJKHZvaWQpIHpmc19yZWZjb3VudF9yZW1vdmVf bWFueSgmZGV2LT5sMmFkX2FsbG9jLCBwc2l6ZSwgaGRyKTsNCj4gIAlhcmNfaGRyX2NsZWFyX2Zs YWdzKGhkciwgQVJDX0ZMQUdfSEFTX0wySERSKTsNCj4gIH0NCj4gIA0KPiBAQCAtMzYyOSw3ICsz NjMzLDcgQEAgYXJjX2hkcl9kZXN0cm95KGFyY19idWZfaGRyX3QgKmhkcikNCj4gIAlpZiAoSERS X0hBU19MMUhEUihoZHIpKSB7DQo+ICAJCUFTU0VSVChoZHItPmJfbDFoZHIuYl9idWYgPT0gTlVM TCB8fA0KPiAgCQkgICAgaGRyLT5iX2wxaGRyLmJfYnVmY250ID4gMCk7DQo+IC0JCUFTU0VSVChy ZWZjb3VudF9pc196ZXJvKCZoZHItPmJfbDFoZHIuYl9yZWZjbnQpKTsNCj4gKwkJQVNTRVJUKHpm c19yZWZjb3VudF9pc196ZXJvKCZoZHItPmJfbDFoZHIuYl9yZWZjbnQpKTsNCj4gIAkJQVNTRVJU M1AoaGRyLT5iX2wxaGRyLmJfc3RhdGUsID09LCBhcmNfYW5vbik7DQo+ICAJfQ0KPiAgCUFTU0VS VCghSERSX0lPX0lOX1BST0dSRVNTKGhkcikpOw0KPiBAQCAtMzc5Myw3ICszNzk3LDcgQEAgYXJj X2V2aWN0X2hkcihhcmNfYnVmX2hkcl90ICpoZHIsIGttdXRleF90ICpoYXNoX2xvY2spDQo+ICAJ CXJldHVybiAoYnl0ZXNfZXZpY3RlZCk7DQo+ICAJfQ0KPiAgDQo+IC0JQVNTRVJUMChyZWZjb3Vu dF9jb3VudCgmaGRyLT5iX2wxaGRyLmJfcmVmY250KSk7DQo+ICsJQVNTRVJUMCh6ZnNfcmVmY291 bnRfY291bnQoJmhkci0+Yl9sMWhkci5iX3JlZmNudCkpOw0KPiAgCXdoaWxlIChoZHItPmJfbDFo ZHIuYl9idWYpIHsNCj4gIAkJYXJjX2J1Zl90ICpidWYgPSBoZHItPmJfbDFoZHIuYl9idWY7DQo+ ICAJCWlmICghbXV0ZXhfdHJ5ZW50ZXIoJmJ1Zi0+Yl9ldmljdF9sb2NrKSkgew0KPiBAQCAtNDEw Nyw3ICs0MTExLDcgQEAgYXJjX2ZsdXNoX3N0YXRlKGFyY19zdGF0ZV90ICpzdGF0ZSwgdWludDY0 X3Qgc3BhLCBhcmNfDQo+ICB7DQo+ICAJdWludDY0X3QgZXZpY3RlZCA9IDA7DQo+ICANCj4gLQl3 aGlsZSAocmVmY291bnRfY291bnQoJnN0YXRlLT5hcmNzX2VzaXplW3R5cGVdKSAhPSAwKSB7DQo+ ICsJd2hpbGUgKHpmc19yZWZjb3VudF9jb3VudCgmc3RhdGUtPmFyY3NfZXNpemVbdHlwZV0pICE9 IDApIHsNCj4gIAkJZXZpY3RlZCArPSBhcmNfZXZpY3Rfc3RhdGUoc3RhdGUsIHNwYSwgQVJDX0VW SUNUX0FMTCwgdHlwZSk7DQo+ICANCj4gIAkJaWYgKCFyZXRyeSkNCj4gQEAgLTQxMzAsNyArNDEz NCw3IEBAIGFyY19wcnVuZV90YXNrKHZvaWQgKnB0cikNCj4gIAlpZiAoZnVuYyAhPSBOVUxMKQ0K PiAgCQlmdW5jKGFwLT5wX2FkanVzdCwgYXAtPnBfcHJpdmF0ZSk7DQo+ICANCj4gLQlyZWZjb3Vu dF9yZW1vdmUoJmFwLT5wX3JlZmNudCwgZnVuYyk7DQo+ICsJemZzX3JlZmNvdW50X3JlbW92ZSgm YXAtPnBfcmVmY250LCBmdW5jKTsNCj4gIH0NCj4gIA0KPiAgLyoNCj4gQEAgLTQxNTMsMTQgKzQx NTcsMTQgQEAgYXJjX3BydW5lX2FzeW5jKGludDY0X3QgYWRqdXN0KQ0KPiAgCWZvciAoYXAgPSBs aXN0X2hlYWQoJmFyY19wcnVuZV9saXN0KTsgYXAgIT0gTlVMTDsNCj4gIAkgICAgYXAgPSBsaXN0 X25leHQoJmFyY19wcnVuZV9saXN0LCBhcCkpIHsNCj4gIA0KPiAtCQlpZiAocmVmY291bnRfY291 bnQoJmFwLT5wX3JlZmNudCkgPj0gMikNCj4gKwkJaWYgKHpmc19yZWZjb3VudF9jb3VudCgmYXAt PnBfcmVmY250KSA+PSAyKQ0KPiAgCQkJY29udGludWU7DQo+ICANCj4gLQkJcmVmY291bnRfYWRk KCZhcC0+cF9yZWZjbnQsIGFwLT5wX3BmdW5jKTsNCj4gKwkJemZzX3JlZmNvdW50X2FkZCgmYXAt PnBfcmVmY250LCBhcC0+cF9wZnVuYyk7DQo+ICAJCWFwLT5wX2FkanVzdCA9IGFkanVzdDsNCj4g IAkJaWYgKHRhc2txX2Rpc3BhdGNoKGFyY19wcnVuZV90YXNrcSwgYXJjX3BydW5lX3Rhc2ssDQo+ ICAJCSAgICBhcCwgVFFfU0xFRVApID09IFRBU0tRSURfSU5WQUxJRCkgew0KPiAtCQkJcmVmY291 bnRfcmVtb3ZlKCZhcC0+cF9yZWZjbnQsIGFwLT5wX3BmdW5jKTsNCj4gKwkJCXpmc19yZWZjb3Vu dF9yZW1vdmUoJmFwLT5wX3JlZmNudCwgYXAtPnBfcGZ1bmMpOw0KPiAgCQkJY29udGludWU7DQo+ ICAJCX0NCj4gIAkJQVJDU1RBVF9CVU1QKGFyY3N0YXRfcHJ1bmUpOw0KPiBAQCAtNDE4Miw4ICs0 MTg2LDkgQEAgYXJjX2FkanVzdF9pbXBsKGFyY19zdGF0ZV90ICpzdGF0ZSwgdWludDY0X3Qgc3Bh LCBpbnQ2DQo+ICB7DQo+ICAJaW50NjRfdCBkZWx0YTsNCj4gIA0KPiAtCWlmIChieXRlcyA+IDAg JiYgcmVmY291bnRfY291bnQoJnN0YXRlLT5hcmNzX2VzaXplW3R5cGVdKSA+IDApIHsNCj4gLQkJ ZGVsdGEgPSBNSU4ocmVmY291bnRfY291bnQoJnN0YXRlLT5hcmNzX2VzaXplW3R5cGVdKSwgYnl0 ZXMpOw0KPiArCWlmIChieXRlcyA+IDAgJiYgemZzX3JlZmNvdW50X2NvdW50KCZzdGF0ZS0+YXJj c19lc2l6ZVt0eXBlXSkgPiAwKSB7DQo+ICsJCWRlbHRhID0gTUlOKHpmc19yZWZjb3VudF9jb3Vu dCgmc3RhdGUtPmFyY3NfZXNpemVbdHlwZV0pLA0KPiArCQkgICAgYnl0ZXMpOw0KPiAgCQlyZXR1 cm4gKGFyY19ldmljdF9zdGF0ZShzdGF0ZSwgc3BhLCBkZWx0YSwgdHlwZSkpOw0KPiAgCX0NCj4g IA0KPiBAQCAtNDIyNiw4ICs0MjMxLDkgQEAgcmVzdGFydDoNCj4gIAkgKi8NCj4gIAlhZGp1c3Rt bnQgPSBtZXRhX3VzZWQgLSBhcmNfbWV0YV9saW1pdDsNCj4gIA0KPiAtCWlmIChhZGp1c3RtbnQg PiAwICYmIHJlZmNvdW50X2NvdW50KCZhcmNfbXJ1LT5hcmNzX2VzaXplW3R5cGVdKSA+IDApIHsN Cj4gLQkJZGVsdGEgPSBNSU4ocmVmY291bnRfY291bnQoJmFyY19tcnUtPmFyY3NfZXNpemVbdHlw ZV0pLA0KPiArCWlmIChhZGp1c3RtbnQgPiAwICYmDQo+ICsJICAgIHpmc19yZWZjb3VudF9jb3Vu dCgmYXJjX21ydS0+YXJjc19lc2l6ZVt0eXBlXSkgPiAwKSB7DQo+ICsJCWRlbHRhID0gTUlOKHpm c19yZWZjb3VudF9jb3VudCgmYXJjX21ydS0+YXJjc19lc2l6ZVt0eXBlXSksDQo+ICAJCSAgICBh ZGp1c3RtbnQpOw0KPiAgCQl0b3RhbF9ldmljdGVkICs9IGFyY19hZGp1c3RfaW1wbChhcmNfbXJ1 LCAwLCBkZWx0YSwgdHlwZSk7DQo+ICAJCWFkanVzdG1udCAtPSBkZWx0YTsNCj4gQEAgLTQyNDMs OCArNDI0OSw5IEBAIHJlc3RhcnQ6DQo+ICAJICogc2ltcGx5IGRlY3JlbWVudCB0aGUgYW1vdW50 IG9mIGRhdGEgZXZpY3RlZCBmcm9tIHRoZSBNUlUuDQo+ICAJICovDQo+ICANCj4gLQlpZiAoYWRq dXN0bW50ID4gMCAmJiByZWZjb3VudF9jb3VudCgmYXJjX21mdS0+YXJjc19lc2l6ZVt0eXBlXSkg PiAwKSB7DQo+IC0JCWRlbHRhID0gTUlOKHJlZmNvdW50X2NvdW50KCZhcmNfbWZ1LT5hcmNzX2Vz aXplW3R5cGVdKSwNCj4gKwlpZiAoYWRqdXN0bW50ID4gMCAmJg0KPiArCSAgICB6ZnNfcmVmY291 bnRfY291bnQoJmFyY19tZnUtPmFyY3NfZXNpemVbdHlwZV0pID4gMCkgew0KPiArCQlkZWx0YSA9 IE1JTih6ZnNfcmVmY291bnRfY291bnQoJmFyY19tZnUtPmFyY3NfZXNpemVbdHlwZV0pLA0KPiAg CQkgICAgYWRqdXN0bW50KTsNCj4gIAkJdG90YWxfZXZpY3RlZCArPSBhcmNfYWRqdXN0X2ltcGwo YXJjX21mdSwgMCwgZGVsdGEsIHR5cGUpOw0KPiAgCX0NCj4gQEAgLTQyNTIsMTcgKzQyNTksMTcg QEAgcmVzdGFydDoNCj4gIAlhZGp1c3RtbnQgPSBtZXRhX3VzZWQgLSBhcmNfbWV0YV9saW1pdDsN Cj4gIA0KPiAgCWlmIChhZGp1c3RtbnQgPiAwICYmDQo+IC0JICAgIHJlZmNvdW50X2NvdW50KCZh cmNfbXJ1X2dob3N0LT5hcmNzX2VzaXplW3R5cGVdKSA+IDApIHsNCj4gKwkgICAgemZzX3JlZmNv dW50X2NvdW50KCZhcmNfbXJ1X2dob3N0LT5hcmNzX2VzaXplW3R5cGVdKSA+IDApIHsNCj4gIAkJ ZGVsdGEgPSBNSU4oYWRqdXN0bW50LA0KPiAtCQkgICAgcmVmY291bnRfY291bnQoJmFyY19tcnVf Z2hvc3QtPmFyY3NfZXNpemVbdHlwZV0pKTsNCj4gKwkJICAgIHpmc19yZWZjb3VudF9jb3VudCgm YXJjX21ydV9naG9zdC0+YXJjc19lc2l6ZVt0eXBlXSkpOw0KPiAgCQl0b3RhbF9ldmljdGVkICs9 IGFyY19hZGp1c3RfaW1wbChhcmNfbXJ1X2dob3N0LCAwLCBkZWx0YSwgdHlwZSk7DQo+ICAJCWFk anVzdG1udCAtPSBkZWx0YTsNCj4gIAl9DQo+ICANCj4gIAlpZiAoYWRqdXN0bW50ID4gMCAmJg0K PiAtCSAgICByZWZjb3VudF9jb3VudCgmYXJjX21mdV9naG9zdC0+YXJjc19lc2l6ZVt0eXBlXSkg PiAwKSB7DQo+ICsJICAgIHpmc19yZWZjb3VudF9jb3VudCgmYXJjX21mdV9naG9zdC0+YXJjc19l c2l6ZVt0eXBlXSkgPiAwKSB7DQo+ICAJCWRlbHRhID0gTUlOKGFkanVzdG1udCwNCj4gLQkJICAg IHJlZmNvdW50X2NvdW50KCZhcmNfbWZ1X2dob3N0LT5hcmNzX2VzaXplW3R5cGVdKSk7DQo+ICsJ CSAgICB6ZnNfcmVmY291bnRfY291bnQoJmFyY19tZnVfZ2hvc3QtPmFyY3NfZXNpemVbdHlwZV0p KTsNCj4gIAkJdG90YWxfZXZpY3RlZCArPSBhcmNfYWRqdXN0X2ltcGwoYXJjX21mdV9naG9zdCwg MCwgZGVsdGEsIHR5cGUpOw0KPiAgCX0NCj4gIA0KPiBAQCAtNDMxMSw4ICs0MzE4LDggQEAgYXJj X2FkanVzdF9tZXRhX29ubHkodWludDY0X3QgbWV0YV91c2VkKQ0KPiAgCSAqIGV2aWN0IHNvbWUg ZnJvbSB0aGUgTVJVIGhlcmUsIGFuZCBzb21lIGZyb20gdGhlIE1GVSBiZWxvdy4NCj4gIAkgKi8N Cj4gIAl0YXJnZXQgPSBNSU4oKGludDY0X3QpKG1ldGFfdXNlZCAtIGFyY19tZXRhX2xpbWl0KSwN Cj4gLQkgICAgKGludDY0X3QpKHJlZmNvdW50X2NvdW50KCZhcmNfYW5vbi0+YXJjc19zaXplKSAr DQo+IC0JICAgIHJlZmNvdW50X2NvdW50KCZhcmNfbXJ1LT5hcmNzX3NpemUpIC0gYXJjX3ApKTsN Cj4gKwkgICAgKGludDY0X3QpKHpmc19yZWZjb3VudF9jb3VudCgmYXJjX2Fub24tPmFyY3Nfc2l6 ZSkgKw0KPiArCSAgICB6ZnNfcmVmY291bnRfY291bnQoJmFyY19tcnUtPmFyY3Nfc2l6ZSkgLSBh cmNfcCkpOw0KPiAgDQo+ICAJdG90YWxfZXZpY3RlZCArPSBhcmNfYWRqdXN0X2ltcGwoYXJjX21y dSwgMCwgdGFyZ2V0LCBBUkNfQlVGQ19NRVRBREFUQSk7DQo+ICANCj4gQEAgLTQzMjIsNyArNDMy OSw3IEBAIGFyY19hZGp1c3RfbWV0YV9vbmx5KHVpbnQ2NF90IG1ldGFfdXNlZCkNCj4gIAkgKiBz cGFjZSBhbGxvdHRlZCB0byB0aGUgTUZVICh3aGljaCBpcyBkZWZpbmVkIGFzIGFyY19jIC0gYXJj X3ApLg0KPiAgCSAqLw0KPiAgCXRhcmdldCA9IE1JTigoaW50NjRfdCkobWV0YV91c2VkIC0gYXJj X21ldGFfbGltaXQpLA0KPiAtCSAgICAoaW50NjRfdCkocmVmY291bnRfY291bnQoJmFyY19tZnUt PmFyY3Nfc2l6ZSkgLQ0KPiArCSAgICAoaW50NjRfdCkoemZzX3JlZmNvdW50X2NvdW50KCZhcmNf bWZ1LT5hcmNzX3NpemUpIC0NCj4gIAkgICAgKGFyY19jIC0gYXJjX3ApKSk7DQo+ICANCj4gIAl0 b3RhbF9ldmljdGVkICs9IGFyY19hZGp1c3RfaW1wbChhcmNfbWZ1LCAwLCB0YXJnZXQsIEFSQ19C VUZDX01FVEFEQVRBKTsNCj4gQEAgLTQ0NDMsOCArNDQ1MCw4IEBAIGFyY19hZGp1c3Qodm9pZCkN Cj4gIAkgKiBhcmNfcCBoZXJlLCBhbmQgdGhlbiBldmljdCBtb3JlIGZyb20gdGhlIE1GVSBiZWxv dy4NCj4gIAkgKi8NCj4gIAl0YXJnZXQgPSBNSU4oKGludDY0X3QpKGFzaXplIC0gYXJjX2MpLA0K PiAtCSAgICAoaW50NjRfdCkocmVmY291bnRfY291bnQoJmFyY19hbm9uLT5hcmNzX3NpemUpICsN Cj4gLQkgICAgcmVmY291bnRfY291bnQoJmFyY19tcnUtPmFyY3Nfc2l6ZSkgKyBhbWV0YSAtIGFy Y19wKSk7DQo+ICsJICAgIChpbnQ2NF90KSh6ZnNfcmVmY291bnRfY291bnQoJmFyY19hbm9uLT5h cmNzX3NpemUpICsNCj4gKwkgICAgemZzX3JlZmNvdW50X2NvdW50KCZhcmNfbXJ1LT5hcmNzX3Np emUpICsgYW1ldGEgLSBhcmNfcCkpOw0KPiAgDQo+ICAJLyoNCj4gIAkgKiBJZiB3ZSdyZSBiZWxv dyBhcmNfbWV0YV9taW4sIGFsd2F5cyBwcmVmZXIgdG8gZXZpY3QgZGF0YS4NCj4gQEAgLTQ1MzQs OCArNDU0MSw4IEBAIGFyY19hZGp1c3Qodm9pZCkNCj4gIAkgKiBjYWNoZS4gVGhlIGZvbGxvd2lu ZyBsb2dpYyBlbmZvcmNlcyB0aGVzZSBsaW1pdHMgb24gdGhlIGdob3N0DQo+ICAJICogY2FjaGVz LCBhbmQgZXZpY3RzIGZyb20gdGhlbSBhcyBuZWVkZWQuDQo+ICAJICovDQo+IC0JdGFyZ2V0ID0g cmVmY291bnRfY291bnQoJmFyY19tcnUtPmFyY3Nfc2l6ZSkgKw0KPiAtCSAgICByZWZjb3VudF9j b3VudCgmYXJjX21ydV9naG9zdC0+YXJjc19zaXplKSAtIGFyY19jOw0KPiArCXRhcmdldCA9IHpm c19yZWZjb3VudF9jb3VudCgmYXJjX21ydS0+YXJjc19zaXplKSArDQo+ICsJICAgIHpmc19yZWZj b3VudF9jb3VudCgmYXJjX21ydV9naG9zdC0+YXJjc19zaXplKSAtIGFyY19jOw0KPiAgDQo+ICAJ Ynl0ZXMgPSBhcmNfYWRqdXN0X2ltcGwoYXJjX21ydV9naG9zdCwgMCwgdGFyZ2V0LCBBUkNfQlVG Q19EQVRBKTsNCj4gIAl0b3RhbF9ldmljdGVkICs9IGJ5dGVzOw0KPiBAQCAtNDU1Myw4ICs0NTYw LDggQEAgYXJjX2FkanVzdCh2b2lkKQ0KPiAgCSAqCW1ydSArIG1mdSArIG1ydSBnaG9zdCArIG1m dSBnaG9zdCA8PSAyICogYXJjX2MNCj4gIAkgKgkJICAgIG1ydSBnaG9zdCArIG1mdSBnaG9zdCA8 PSBhcmNfYw0KPiAgCSAqLw0KPiAtCXRhcmdldCA9IHJlZmNvdW50X2NvdW50KCZhcmNfbXJ1X2do b3N0LT5hcmNzX3NpemUpICsNCj4gLQkgICAgcmVmY291bnRfY291bnQoJmFyY19tZnVfZ2hvc3Qt PmFyY3Nfc2l6ZSkgLSBhcmNfYzsNCj4gKwl0YXJnZXQgPSB6ZnNfcmVmY291bnRfY291bnQoJmFy Y19tcnVfZ2hvc3QtPmFyY3Nfc2l6ZSkgKw0KPiArCSAgICB6ZnNfcmVmY291bnRfY291bnQoJmFy Y19tZnVfZ2hvc3QtPmFyY3Nfc2l6ZSkgLSBhcmNfYzsNCj4gIA0KPiAgCWJ5dGVzID0gYXJjX2Fk anVzdF9pbXBsKGFyY19tZnVfZ2hvc3QsIDAsIHRhcmdldCwgQVJDX0JVRkNfREFUQSk7DQo+ICAJ dG90YWxfZXZpY3RlZCArPSBieXRlczsNCj4gQEAgLTUwNjksOCArNTA3Niw4IEBAIGFyY19hZGFw dChpbnQgYnl0ZXMsIGFyY19zdGF0ZV90ICpzdGF0ZSkNCj4gIHsNCj4gIAlpbnQgbXVsdDsNCj4g IAl1aW50NjRfdCBhcmNfcF9taW4gPSAoYXJjX2MgPj4gYXJjX3BfbWluX3NoaWZ0KTsNCj4gLQlp bnQ2NF90IG1ydWdfc2l6ZSA9IHJlZmNvdW50X2NvdW50KCZhcmNfbXJ1X2dob3N0LT5hcmNzX3Np emUpOw0KPiAtCWludDY0X3QgbWZ1Z19zaXplID0gcmVmY291bnRfY291bnQoJmFyY19tZnVfZ2hv c3QtPmFyY3Nfc2l6ZSk7DQo+ICsJaW50NjRfdCBtcnVnX3NpemUgPSB6ZnNfcmVmY291bnRfY291 bnQoJmFyY19tcnVfZ2hvc3QtPmFyY3Nfc2l6ZSk7DQo+ICsJaW50NjRfdCBtZnVnX3NpemUgPSB6 ZnNfcmVmY291bnRfY291bnQoJmFyY19tZnVfZ2hvc3QtPmFyY3Nfc2l6ZSk7DQo+ICANCj4gIAlp ZiAoc3RhdGUgPT0gYXJjX2wyY19vbmx5KQ0KPiAgCQlyZXR1cm47DQo+IEBAIC01MjQ4LDcgKzUy NTUsNyBAQCBhcmNfZ2V0X2RhdGFfaW1wbChhcmNfYnVmX2hkcl90ICpoZHIsIHVpbnQ2NF90IHNp emUsIHYNCj4gIAkgKi8NCj4gIAlpZiAoIUdIT1NUX1NUQVRFKHN0YXRlKSkgew0KPiAgDQo+IC0J CSh2b2lkKSByZWZjb3VudF9hZGRfbWFueSgmc3RhdGUtPmFyY3Nfc2l6ZSwgc2l6ZSwgdGFnKTsN Cj4gKwkJKHZvaWQpIHpmc19yZWZjb3VudF9hZGRfbWFueSgmc3RhdGUtPmFyY3Nfc2l6ZSwgc2l6 ZSwgdGFnKTsNCj4gIA0KPiAgCQkvKg0KPiAgCQkgKiBJZiB0aGlzIGlzIHJlYWNoZWQgdmlhIGFy Y19yZWFkLCB0aGUgbGluayBpcw0KPiBAQCAtNTI2MCw4ICs1MjY3LDggQEAgYXJjX2dldF9kYXRh X2ltcGwoYXJjX2J1Zl9oZHJfdCAqaGRyLCB1aW50NjRfdCBzaXplLCB2DQo+ICAJCSAqIHRyeWlu ZyB0byBbYWRkfHJlbW92ZV1fcmVmZXJlbmNlIGl0Lg0KPiAgCQkgKi8NCj4gIAkJaWYgKG11bHRp bGlzdF9saW5rX2FjdGl2ZSgmaGRyLT5iX2wxaGRyLmJfYXJjX25vZGUpKSB7DQo+IC0JCQlBU1NF UlQocmVmY291bnRfaXNfemVybygmaGRyLT5iX2wxaGRyLmJfcmVmY250KSk7DQo+IC0JCQkodm9p ZCkgcmVmY291bnRfYWRkX21hbnkoJnN0YXRlLT5hcmNzX2VzaXplW3R5cGVdLA0KPiArCQkJQVNT RVJUKHpmc19yZWZjb3VudF9pc196ZXJvKCZoZHItPmJfbDFoZHIuYl9yZWZjbnQpKTsNCj4gKwkJ CSh2b2lkKSB6ZnNfcmVmY291bnRfYWRkX21hbnkoJnN0YXRlLT5hcmNzX2VzaXplW3R5cGVdLA0K PiAgCQkJICAgIHNpemUsIHRhZyk7DQo+ICAJCX0NCj4gIA0KPiBAQCAtNTI3MSw4ICs1Mjc4LDgg QEAgYXJjX2dldF9kYXRhX2ltcGwoYXJjX2J1Zl9oZHJfdCAqaGRyLCB1aW50NjRfdCBzaXplLCB2 DQo+ICAJCSAqLw0KPiAgCQlpZiAoYWdnc3VtX3VwcGVyX2JvdW5kKCZhcmNfc2l6ZSkgPCBhcmNf YyAmJg0KPiAgCQkgICAgaGRyLT5iX2wxaGRyLmJfc3RhdGUgPT0gYXJjX2Fub24gJiYNCj4gLQkJ ICAgIChyZWZjb3VudF9jb3VudCgmYXJjX2Fub24tPmFyY3Nfc2l6ZSkgKw0KPiAtCQkgICAgcmVm Y291bnRfY291bnQoJmFyY19tcnUtPmFyY3Nfc2l6ZSkgPiBhcmNfcCkpDQo+ICsJCSAgICAoemZz X3JlZmNvdW50X2NvdW50KCZhcmNfYW5vbi0+YXJjc19zaXplKSArDQo+ICsJCSAgICB6ZnNfcmVm Y291bnRfY291bnQoJmFyY19tcnUtPmFyY3Nfc2l6ZSkgPiBhcmNfcCkpDQo+ICAJCQlhcmNfcCA9 IE1JTihhcmNfYywgYXJjX3AgKyBzaXplKTsNCj4gIAl9DQo+ICAJQVJDU1RBVF9CVU1QKGFyY3N0 YXRfYWxsb2NhdGVkKTsNCj4gQEAgLTUzMTAsMTMgKzUzMTcsMTMgQEAgYXJjX2ZyZWVfZGF0YV9p bXBsKGFyY19idWZfaGRyX3QgKmhkciwgdWludDY0X3Qgc2l6ZSwgDQo+ICANCj4gIAkvKiBwcm90 ZWN0ZWQgYnkgaGFzaCBsb2NrLCBpZiBpbiB0aGUgaGFzaCB0YWJsZSAqLw0KPiAgCWlmIChtdWx0 aWxpc3RfbGlua19hY3RpdmUoJmhkci0+Yl9sMWhkci5iX2FyY19ub2RlKSkgew0KPiAtCQlBU1NF UlQocmVmY291bnRfaXNfemVybygmaGRyLT5iX2wxaGRyLmJfcmVmY250KSk7DQo+ICsJCUFTU0VS VCh6ZnNfcmVmY291bnRfaXNfemVybygmaGRyLT5iX2wxaGRyLmJfcmVmY250KSk7DQo+ICAJCUFT U0VSVChzdGF0ZSAhPSBhcmNfYW5vbiAmJiBzdGF0ZSAhPSBhcmNfbDJjX29ubHkpOw0KPiAgDQo+ IC0JCSh2b2lkKSByZWZjb3VudF9yZW1vdmVfbWFueSgmc3RhdGUtPmFyY3NfZXNpemVbdHlwZV0s DQo+ICsJCSh2b2lkKSB6ZnNfcmVmY291bnRfcmVtb3ZlX21hbnkoJnN0YXRlLT5hcmNzX2VzaXpl W3R5cGVdLA0KPiAgCQkgICAgc2l6ZSwgdGFnKTsNCj4gIAl9DQo+IC0JKHZvaWQpIHJlZmNvdW50 X3JlbW92ZV9tYW55KCZzdGF0ZS0+YXJjc19zaXplLCBzaXplLCB0YWcpOw0KPiArCSh2b2lkKSB6 ZnNfcmVmY291bnRfcmVtb3ZlX21hbnkoJnN0YXRlLT5hcmNzX3NpemUsIHNpemUsIHRhZyk7DQo+ ICANCj4gIAlWRVJJRlkzVShoZHItPmJfdHlwZSwgPT0sIHR5cGUpOw0KPiAgCWlmICh0eXBlID09 IEFSQ19CVUZDX01FVEFEQVRBKSB7DQo+IEBAIC01MzYzLDcgKzUzNzAsNyBAQCBhcmNfYWNjZXNz KGFyY19idWZfaGRyX3QgKmhkciwga211dGV4X3QgKmhhc2hfbG9jaykNCj4gIAkJICogICBhbm90 aGVyIHByZWZldGNoICh0byBtYWtlIGl0IGxlc3MgbGlrZWx5IHRvIGJlIGV2aWN0ZWQpLg0KPiAg CQkgKi8NCj4gIAkJaWYgKEhEUl9QUkVGRVRDSChoZHIpIHx8IEhEUl9QUkVTQ0lFTlRfUFJFRkVU Q0goaGRyKSkgew0KPiAtCQkJaWYgKHJlZmNvdW50X2NvdW50KCZoZHItPmJfbDFoZHIuYl9yZWZj bnQpID09IDApIHsNCj4gKwkJCWlmICh6ZnNfcmVmY291bnRfY291bnQoJmhkci0+Yl9sMWhkci5i X3JlZmNudCkgPT0gMCkgew0KPiAgCQkJCS8qIGxpbmsgcHJvdGVjdGVkIGJ5IGhhc2ggbG9jayAq Lw0KPiAgCQkJCUFTU0VSVChtdWx0aWxpc3RfbGlua19hY3RpdmUoDQo+ICAJCQkJICAgICZoZHIt PmJfbDFoZHIuYl9hcmNfbm9kZSkpOw0KPiBAQCAtNTQwNCw3ICs1NDExLDcgQEAgYXJjX2FjY2Vz cyhhcmNfYnVmX2hkcl90ICpoZHIsIGttdXRleF90ICpoYXNoX2xvY2spDQo+ICANCj4gIAkJaWYg KEhEUl9QUkVGRVRDSChoZHIpIHx8IEhEUl9QUkVTQ0lFTlRfUFJFRkVUQ0goaGRyKSkgew0KPiAg CQkJbmV3X3N0YXRlID0gYXJjX21ydTsNCj4gLQkJCWlmIChyZWZjb3VudF9jb3VudCgmaGRyLT5i X2wxaGRyLmJfcmVmY250KSA+IDApIHsNCj4gKwkJCWlmICh6ZnNfcmVmY291bnRfY291bnQoJmhk ci0+Yl9sMWhkci5iX3JlZmNudCkgPiAwKSB7DQo+ICAJCQkJYXJjX2hkcl9jbGVhcl9mbGFncyho ZHIsDQo+ICAJCQkJICAgIEFSQ19GTEFHX1BSRUZFVENIIHwNCj4gIAkJCQkgICAgQVJDX0ZMQUdf UFJFU0NJRU5UX1BSRUZFVENIKTsNCj4gQEAgLTU2NzgsNyArNTY4NSw3IEBAIGFyY19yZWFkX2Rv bmUoemlvX3QgKnppbykNCj4gIAkJQVNTRVJUM1AoaGRyLT5iX2wxaGRyLmJfcGFiZCwgIT0sIE5V TEwpOw0KPiAgCX0NCj4gIA0KPiAtCUFTU0VSVChyZWZjb3VudF9pc196ZXJvKCZoZHItPmJfbDFo ZHIuYl9yZWZjbnQpIHx8DQo+ICsJQVNTRVJUKHpmc19yZWZjb3VudF9pc196ZXJvKCZoZHItPmJf bDFoZHIuYl9yZWZjbnQpIHx8DQo+ICAJICAgIGNhbGxiYWNrX2xpc3QgIT0gTlVMTCk7DQo+ICAN Cj4gIAlpZiAobm9femlvX2Vycm9yKSB7DQo+IEBAIC01Njg5LDcgKzU2OTYsNyBAQCBhcmNfcmVh ZF9kb25lKHppb190ICp6aW8pDQo+ICAJCQlhcmNfY2hhbmdlX3N0YXRlKGFyY19hbm9uLCBoZHIs IGhhc2hfbG9jayk7DQo+ICAJCWlmIChIRFJfSU5fSEFTSF9UQUJMRShoZHIpKQ0KPiAgCQkJYnVm X2hhc2hfcmVtb3ZlKGhkcik7DQo+IC0JCWZyZWVhYmxlID0gcmVmY291bnRfaXNfemVybygmaGRy LT5iX2wxaGRyLmJfcmVmY250KTsNCj4gKwkJZnJlZWFibGUgPSB6ZnNfcmVmY291bnRfaXNfemVy bygmaGRyLT5iX2wxaGRyLmJfcmVmY250KTsNCj4gIAl9DQo+ICANCj4gIAkvKg0KPiBAQCAtNTcw OSw3ICs1NzE2LDcgQEAgYXJjX3JlYWRfZG9uZSh6aW9fdCAqemlvKQ0KPiAgCQkgKiBpbiB0aGUg Y2FjaGUpLg0KPiAgCQkgKi8NCj4gIAkJQVNTRVJUM1AoaGRyLT5iX2wxaGRyLmJfc3RhdGUsID09 LCBhcmNfYW5vbik7DQo+IC0JCWZyZWVhYmxlID0gcmVmY291bnRfaXNfemVybygmaGRyLT5iX2wx aGRyLmJfcmVmY250KTsNCj4gKwkJZnJlZWFibGUgPSB6ZnNfcmVmY291bnRfaXNfemVybygmaGRy LT5iX2wxaGRyLmJfcmVmY250KTsNCj4gIAl9DQo+ICANCj4gIAkvKiBleGVjdXRlIGVhY2ggY2Fs bGJhY2sgYW5kIGZyZWUgaXRzIHN0cnVjdHVyZSAqLw0KPiBAQCAtNTg3NSw3ICs1ODgyLDcgQEAg dG9wOg0KPiAgCQkJQVNTRVJUKCh6aW9fZmxhZ3MgJiBaSU9fRkxBR19TUEVDVUxBVElWRSkgfHwN Cj4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICByYyA9PSAwIHx8IHJjICE9IEVOT0VOVCk7 DQo+ICAJCX0gZWxzZSBpZiAoKmFyY19mbGFncyAmIEFSQ19GTEFHX1BSRUZFVENIICYmDQo+IC0J CSAgICByZWZjb3VudF9jb3VudCgmaGRyLT5iX2wxaGRyLmJfcmVmY250KSA9PSAwKSB7DQo+ICsJ CSAgICB6ZnNfcmVmY291bnRfY291bnQoJmhkci0+Yl9sMWhkci5iX3JlZmNudCkgPT0gMCkgew0K PiAgCQkJYXJjX2hkcl9zZXRfZmxhZ3MoaGRyLCBBUkNfRkxBR19QUkVGRVRDSCk7DQo+ICAJCX0N Cj4gIAkJRFRSQUNFX1BST0JFMShhcmNfX2hpdCwgYXJjX2J1Zl9oZHJfdCAqLCBoZHIpOw0KPiBA QCAtNTkzMyw3ICs1OTQwLDcgQEAgdG9wOg0KPiAgCQkJQVNTRVJUM1AoaGRyLT5iX2wxaGRyLmJf cGFiZCwgPT0sIE5VTEwpOw0KPiAgCQkJQVNTRVJUKEdIT1NUX1NUQVRFKGhkci0+Yl9sMWhkci5i X3N0YXRlKSk7DQo+ICAJCQlBU1NFUlQoIUhEUl9JT19JTl9QUk9HUkVTUyhoZHIpKTsNCj4gLQkJ CUFTU0VSVChyZWZjb3VudF9pc196ZXJvKCZoZHItPmJfbDFoZHIuYl9yZWZjbnQpKTsNCj4gKwkJ CUFTU0VSVCh6ZnNfcmVmY291bnRfaXNfemVybygmaGRyLT5iX2wxaGRyLmJfcmVmY250KSk7DQo+ ICAJCQlBU1NFUlQzUChoZHItPmJfbDFoZHIuYl9idWYsID09LCBOVUxMKTsNCj4gIAkJCUFTU0VS VDNQKGhkci0+Yl9sMWhkci5iX2ZyZWV6ZV9ja3N1bSwgPT0sIE5VTEwpOw0KPiAgDQo+IEBAIC02 MTU0LDEwICs2MTYxLDEwIEBAIGFyY19hZGRfcHJ1bmVfY2FsbGJhY2soYXJjX3BydW5lX2Z1bmNf dCAqZnVuYywgdm9pZCAqcA0KPiAgCXAtPnBfcGZ1bmMgPSBmdW5jOw0KPiAgCXAtPnBfcHJpdmF0 ZSA9IHByaXZhdGU7DQo+ICAJbGlzdF9saW5rX2luaXQoJnAtPnBfbm9kZSk7DQo+IC0JcmVmY291 bnRfY3JlYXRlKCZwLT5wX3JlZmNudCk7DQo+ICsJemZzX3JlZmNvdW50X2NyZWF0ZSgmcC0+cF9y ZWZjbnQpOw0KPiAgDQo+ICAJbXV0ZXhfZW50ZXIoJmFyY19wcnVuZV9tdHgpOw0KPiAtCXJlZmNv dW50X2FkZCgmcC0+cF9yZWZjbnQsICZhcmNfcHJ1bmVfbGlzdCk7DQo+ICsJemZzX3JlZmNvdW50 X2FkZCgmcC0+cF9yZWZjbnQsICZhcmNfcHJ1bmVfbGlzdCk7DQo+ICAJbGlzdF9pbnNlcnRfaGVh ZCgmYXJjX3BydW5lX2xpc3QsIHApOw0KPiAgCW11dGV4X2V4aXQoJmFyY19wcnVuZV9tdHgpOw0K PiAgDQo+IEBAIC02MTcwLDE1ICs2MTc3LDE1IEBAIGFyY19yZW1vdmVfcHJ1bmVfY2FsbGJhY2so YXJjX3BydW5lX3QgKnApDQo+ICAJYm9vbGVhbl90IHdhaXQgPSBCX0ZBTFNFOw0KPiAgCW11dGV4 X2VudGVyKCZhcmNfcHJ1bmVfbXR4KTsNCj4gIAlsaXN0X3JlbW92ZSgmYXJjX3BydW5lX2xpc3Qs IHApOw0KPiAtCWlmIChyZWZjb3VudF9yZW1vdmUoJnAtPnBfcmVmY250LCAmYXJjX3BydW5lX2xp c3QpID4gMCkNCj4gKwlpZiAoemZzX3JlZmNvdW50X3JlbW92ZSgmcC0+cF9yZWZjbnQsICZhcmNf cHJ1bmVfbGlzdCkgPiAwKQ0KPiAgCQl3YWl0ID0gQl9UUlVFOw0KPiAgCW11dGV4X2V4aXQoJmFy Y19wcnVuZV9tdHgpOw0KPiAgDQo+ICAJLyogd2FpdCBmb3IgYXJjX3BydW5lX3Rhc2sgdG8gZmlu aXNoICovDQo+ICAJaWYgKHdhaXQpDQo+ICAJCXRhc2txX3dhaXQoYXJjX3BydW5lX3Rhc2txKTsN Cj4gLQlBU1NFUlQwKHJlZmNvdW50X2NvdW50KCZwLT5wX3JlZmNudCkpOw0KPiAtCXJlZmNvdW50 X2Rlc3Ryb3koJnAtPnBfcmVmY250KTsNCj4gKwlBU1NFUlQwKHpmc19yZWZjb3VudF9jb3VudCgm cC0+cF9yZWZjbnQpKTsNCj4gKwl6ZnNfcmVmY291bnRfZGVzdHJveSgmcC0+cF9yZWZjbnQpOw0K PiAgCWttZW1fZnJlZShwLCBzaXplb2YgKCpwKSk7DQo+ICB9DQo+ICANCj4gQEAgLTYyMjEsNyAr NjIyOCw3IEBAIGFyY19mcmVlZChzcGFfdCAqc3BhLCBjb25zdCBibGtwdHJfdCAqYnApDQo+ICAJ ICogdGhpcyBoZHIsIHRoZW4gd2UgZG9uJ3QgZGVzdHJveSB0aGUgaGRyLg0KPiAgCSAqLw0KPiAg CWlmICghSERSX0hBU19MMUhEUihoZHIpIHx8ICghSERSX0lPX0lOX1BST0dSRVNTKGhkcikgJiYN Cj4gLQkgICAgcmVmY291bnRfaXNfemVybygmaGRyLT5iX2wxaGRyLmJfcmVmY250KSkpIHsNCj4g KwkgICAgemZzX3JlZmNvdW50X2lzX3plcm8oJmhkci0+Yl9sMWhkci5iX3JlZmNudCkpKSB7DQo+ ICAJCWFyY19jaGFuZ2Vfc3RhdGUoYXJjX2Fub24sIGhkciwgaGFzaF9sb2NrKTsNCj4gIAkJYXJj X2hkcl9kZXN0cm95KGhkcik7DQo+ICAJCW11dGV4X2V4aXQoaGFzaF9sb2NrKTsNCj4gQEAgLTYy NjQsNyArNjI3MSw3IEBAIGFyY19yZWxlYXNlKGFyY19idWZfdCAqYnVmLCB2b2lkICp0YWcpDQo+ ICAJCUFTU0VSVCghSERSX0hBU19MMkhEUihoZHIpKTsNCj4gIAkJQVNTRVJUKEhEUl9FTVBUWSho ZHIpKTsNCj4gIAkJQVNTRVJUM1UoaGRyLT5iX2wxaGRyLmJfYnVmY250LCA9PSwgMSk7DQo+IC0J CUFTU0VSVDNTKHJlZmNvdW50X2NvdW50KCZoZHItPmJfbDFoZHIuYl9yZWZjbnQpLCA9PSwgMSk7 DQo+ICsJCUFTU0VSVDNTKHpmc19yZWZjb3VudF9jb3VudCgmaGRyLT5iX2wxaGRyLmJfcmVmY250 KSwgPT0sIDEpOw0KPiAgCQlBU1NFUlQoIWxpc3RfbGlua19hY3RpdmUoJmhkci0+Yl9sMWhkci5i X2FyY19ub2RlKSk7DQo+ICANCj4gIAkJaGRyLT5iX2wxaGRyLmJfYXJjX2FjY2VzcyA9IDA7DQo+ IEBAIC02MjkyLDcgKzYyOTksNyBAQCBhcmNfcmVsZWFzZShhcmNfYnVmX3QgKmJ1Ziwgdm9pZCAq dGFnKQ0KPiAgCUFTU0VSVDNQKHN0YXRlLCAhPSwgYXJjX2Fub24pOw0KPiAgDQo+ICAJLyogdGhp cyBidWZmZXIgaXMgbm90IG9uIGFueSBsaXN0ICovDQo+IC0JQVNTRVJUM1MocmVmY291bnRfY291 bnQoJmhkci0+Yl9sMWhkci5iX3JlZmNudCksID4sIDApOw0KPiArCUFTU0VSVDNTKHpmc19yZWZj b3VudF9jb3VudCgmaGRyLT5iX2wxaGRyLmJfcmVmY250KSwgPiwgMCk7DQo+ICANCj4gIAlpZiAo SERSX0hBU19MMkhEUihoZHIpKSB7DQo+ICAJCW11dGV4X2VudGVyKCZoZHItPmJfbDJoZHIuYl9k ZXYtPmwyYWRfbXR4KTsNCj4gQEAgLTYzODQsMTIgKzYzOTEsMTMgQEAgYXJjX3JlbGVhc2UoYXJj X2J1Zl90ICpidWYsIHZvaWQgKnRhZykNCj4gIAkJQVNTRVJUM1AoaGRyLT5iX2wxaGRyLmJfcGFi ZCwgIT0sIE5VTEwpOw0KPiAgCQlBU1NFUlQzUChzdGF0ZSwgIT0sIGFyY19sMmNfb25seSk7DQo+ ICANCj4gLQkJKHZvaWQpIHJlZmNvdW50X3JlbW92ZV9tYW55KCZzdGF0ZS0+YXJjc19zaXplLA0K PiArCQkodm9pZCkgemZzX3JlZmNvdW50X3JlbW92ZV9tYW55KCZzdGF0ZS0+YXJjc19zaXplLA0K PiAgCQkgICAgYXJjX2J1Zl9zaXplKGJ1ZiksIGJ1Zik7DQo+ICANCj4gLQkJaWYgKHJlZmNvdW50 X2lzX3plcm8oJmhkci0+Yl9sMWhkci5iX3JlZmNudCkpIHsNCj4gKwkJaWYgKHpmc19yZWZjb3Vu dF9pc196ZXJvKCZoZHItPmJfbDFoZHIuYl9yZWZjbnQpKSB7DQo+ICAJCQlBU1NFUlQzUChzdGF0 ZSwgIT0sIGFyY19sMmNfb25seSk7DQo+IC0JCQkodm9pZCkgcmVmY291bnRfcmVtb3ZlX21hbnko JnN0YXRlLT5hcmNzX2VzaXplW3R5cGVdLA0KPiArCQkJKHZvaWQpIHpmc19yZWZjb3VudF9yZW1v dmVfbWFueSgNCj4gKwkJCSAgICAmc3RhdGUtPmFyY3NfZXNpemVbdHlwZV0sDQo+ICAJCQkgICAg YXJjX2J1Zl9zaXplKGJ1ZiksIGJ1Zik7DQo+ICAJCX0NCj4gIA0KPiBAQCAtNjQwOCwyMSArNjQx NiwyMSBAQCBhcmNfcmVsZWFzZShhcmNfYnVmX3QgKmJ1Ziwgdm9pZCAqdGFnKQ0KPiAgCQluaGRy ID0gYXJjX2hkcl9hbGxvYyhzcGEsIHBzaXplLCBsc2l6ZSwgY29tcHJlc3MsIHR5cGUpOw0KPiAg CQlBU1NFUlQzUChuaGRyLT5iX2wxaGRyLmJfYnVmLCA9PSwgTlVMTCk7DQo+ICAJCUFTU0VSVDAo bmhkci0+Yl9sMWhkci5iX2J1ZmNudCk7DQo+IC0JCUFTU0VSVDAocmVmY291bnRfY291bnQoJm5o ZHItPmJfbDFoZHIuYl9yZWZjbnQpKTsNCj4gKwkJQVNTRVJUMCh6ZnNfcmVmY291bnRfY291bnQo Jm5oZHItPmJfbDFoZHIuYl9yZWZjbnQpKTsNCj4gIAkJVkVSSUZZM1Uobmhkci0+Yl90eXBlLCA9 PSwgdHlwZSk7DQo+ICAJCUFTU0VSVCghSERSX1NIQVJFRF9EQVRBKG5oZHIpKTsNCj4gIA0KPiAg CQluaGRyLT5iX2wxaGRyLmJfYnVmID0gYnVmOw0KPiAgCQluaGRyLT5iX2wxaGRyLmJfYnVmY250 ID0gMTsNCj4gLQkJKHZvaWQpIHJlZmNvdW50X2FkZCgmbmhkci0+Yl9sMWhkci5iX3JlZmNudCwg dGFnKTsNCj4gKwkJKHZvaWQpIHpmc19yZWZjb3VudF9hZGQoJm5oZHItPmJfbDFoZHIuYl9yZWZj bnQsIHRhZyk7DQo+ICAJCWJ1Zi0+Yl9oZHIgPSBuaGRyOw0KPiAgDQo+ICAJCW11dGV4X2V4aXQo JmJ1Zi0+Yl9ldmljdF9sb2NrKTsNCj4gLQkJKHZvaWQpIHJlZmNvdW50X2FkZF9tYW55KCZhcmNf YW5vbi0+YXJjc19zaXplLA0KPiArCQkodm9pZCkgemZzX3JlZmNvdW50X2FkZF9tYW55KCZhcmNf YW5vbi0+YXJjc19zaXplLA0KPiAgCQkgICAgYXJjX2J1Zl9zaXplKGJ1ZiksIGJ1Zik7DQo+ICAJ fSBlbHNlIHsNCj4gIAkJbXV0ZXhfZXhpdCgmYnVmLT5iX2V2aWN0X2xvY2spOw0KPiAtCQlBU1NF UlQocmVmY291bnRfY291bnQoJmhkci0+Yl9sMWhkci5iX3JlZmNudCkgPT0gMSk7DQo+ICsJCUFT U0VSVCh6ZnNfcmVmY291bnRfY291bnQoJmhkci0+Yl9sMWhkci5iX3JlZmNudCkgPT0gMSk7DQo+ ICAJCS8qIHByb3RlY3RlZCBieSBoYXNoIGxvY2ssIG9yIGhkciBpcyBvbiBhcmNfYW5vbiAqLw0K PiAgCQlBU1NFUlQoIW11bHRpbGlzdF9saW5rX2FjdGl2ZSgmaGRyLT5iX2wxaGRyLmJfYXJjX25v ZGUpKTsNCj4gIAkJQVNTRVJUKCFIRFJfSU9fSU5fUFJPR1JFU1MoaGRyKSk7DQo+IEBAIC02NDU0 LDcgKzY0NjIsNyBAQCBhcmNfcmVmZXJlbmNlZChhcmNfYnVmX3QgKmJ1ZikNCj4gIAlpbnQgcmVm ZXJlbmNlZDsNCj4gIA0KPiAgCW11dGV4X2VudGVyKCZidWYtPmJfZXZpY3RfbG9jayk7DQo+IC0J cmVmZXJlbmNlZCA9IChyZWZjb3VudF9jb3VudCgmYnVmLT5iX2hkci0+Yl9sMWhkci5iX3JlZmNu dCkpOw0KPiArCXJlZmVyZW5jZWQgPSAoemZzX3JlZmNvdW50X2NvdW50KCZidWYtPmJfaGRyLT5i X2wxaGRyLmJfcmVmY250KSk7DQo+ICAJbXV0ZXhfZXhpdCgmYnVmLT5iX2V2aWN0X2xvY2spOw0K PiAgCXJldHVybiAocmVmZXJlbmNlZCk7DQo+ICB9DQo+IEBAIC02NDY5LDcgKzY0NzcsNyBAQCBh cmNfd3JpdGVfcmVhZHkoemlvX3QgKnppbykNCj4gIAl1aW50NjRfdCBwc2l6ZSA9IEJQX0lTX0hP TEUoemlvLT5pb19icCkgPyAwIDogQlBfR0VUX1BTSVpFKHppby0+aW9fYnApOw0KPiAgDQo+ICAJ QVNTRVJUKEhEUl9IQVNfTDFIRFIoaGRyKSk7DQo+IC0JQVNTRVJUKCFyZWZjb3VudF9pc196ZXJv KCZidWYtPmJfaGRyLT5iX2wxaGRyLmJfcmVmY250KSk7DQo+ICsJQVNTRVJUKCF6ZnNfcmVmY291 bnRfaXNfemVybygmYnVmLT5iX2hkci0+Yl9sMWhkci5iX3JlZmNudCkpOw0KPiAgCUFTU0VSVCho ZHItPmJfbDFoZHIuYl9idWZjbnQgPiAwKTsNCj4gIA0KPiAgCS8qDQo+IEBAIC02NjI0LDcgKzY2 MzIsNyBAQCBhcmNfd3JpdGVfZG9uZSh6aW9fdCAqemlvKQ0KPiAgCQkJCWlmICghQlBfRVFVQUwo Jnppby0+aW9fYnBfb3JpZywgemlvLT5pb19icCkpDQo+ICAJCQkJCXBhbmljKCJiYWQgb3Zlcndy aXRlLCBoZHI9JXAgZXhpc3RzPSVwIiwNCj4gIAkJCQkJICAgICh2b2lkICopaGRyLCAodm9pZCAq KWV4aXN0cyk7DQo+IC0JCQkJQVNTRVJUKHJlZmNvdW50X2lzX3plcm8oDQo+ICsJCQkJQVNTRVJU KHpmc19yZWZjb3VudF9pc196ZXJvKA0KPiAgCQkJCSAgICAmZXhpc3RzLT5iX2wxaGRyLmJfcmVm Y250KSk7DQo+ICAJCQkJYXJjX2NoYW5nZV9zdGF0ZShhcmNfYW5vbiwgZXhpc3RzLCBoYXNoX2xv Y2spOw0KPiAgCQkJCW11dGV4X2V4aXQoaGFzaF9sb2NrKTsNCj4gQEAgLTY2NTQsNyArNjY2Miw3 IEBAIGFyY193cml0ZV9kb25lKHppb190ICp6aW8pDQo+ICAJCWFyY19oZHJfY2xlYXJfZmxhZ3Mo aGRyLCBBUkNfRkxBR19JT19JTl9QUk9HUkVTUyk7DQo+ICAJfQ0KPiAgDQo+IC0JQVNTRVJUKCFy ZWZjb3VudF9pc196ZXJvKCZoZHItPmJfbDFoZHIuYl9yZWZjbnQpKTsNCj4gKwlBU1NFUlQoIXpm c19yZWZjb3VudF9pc196ZXJvKCZoZHItPmJfbDFoZHIuYl9yZWZjbnQpKTsNCj4gIAljYWxsYmFj ay0+YXdjYl9kb25lKHppbywgYnVmLCBjYWxsYmFjay0+YXdjYl9wcml2YXRlKTsNCj4gIA0KPiAg CWFiZF9wdXQoemlvLT5pb19hYmQpOw0KPiBAQCAtNjgwMCw3ICs2ODA4LDcgQEAgYXJjX3RlbXBy ZXNlcnZlX3NwYWNlKHNwYV90ICpzcGEsIHVpbnQ2NF90IHJlc2VydmUsIHVpDQo+ICAJLyogYXNz ZXJ0IHRoYXQgaXQgaGFzIG5vdCB3cmFwcGVkIGFyb3VuZCAqLw0KPiAgCUFTU0VSVDNTKGF0b21p Y19hZGRfNjRfbnYoJmFyY19sb2FuZWRfYnl0ZXMsIDApLCA+PSwgMCk7DQo+ICANCj4gLQlhbm9u X3NpemUgPSBNQVgoKGludDY0X3QpKHJlZmNvdW50X2NvdW50KCZhcmNfYW5vbi0+YXJjc19zaXpl KSAtDQo+ICsJYW5vbl9zaXplID0gTUFYKChpbnQ2NF90KSh6ZnNfcmVmY291bnRfY291bnQoJmFy Y19hbm9uLT5hcmNzX3NpemUpIC0NCj4gIAkgICAgYXJjX2xvYW5lZF9ieXRlcyksIDApOw0KPiAg DQo+ICAJLyoNCj4gQEAgLTY4MzUsOSArNjg0MywxMCBAQCBhcmNfdGVtcHJlc2VydmVfc3BhY2Uo c3BhX3QgKnNwYSwgdWludDY0X3QgcmVzZXJ2ZSwgdWkNCj4gIAkgICAgYW5vbl9zaXplID4gYXJj X2MgKiB6ZnNfYXJjX2Fub25fbGltaXRfcGVyY2VudCAvIDEwMCAmJg0KPiAgCSAgICBzcGFfZGly dHlfYW5vbiA+IGFub25fc2l6ZSAqIHpmc19hcmNfcG9vbF9kaXJ0eV9wZXJjZW50IC8gMTAwKSB7 DQo+ICAJCXVpbnQ2NF90IG1ldGFfZXNpemUgPQ0KPiAtCQkgICAgcmVmY291bnRfY291bnQoJmFy Y19hbm9uLT5hcmNzX2VzaXplW0FSQ19CVUZDX01FVEFEQVRBXSk7DQo+ICsJCSAgICB6ZnNfcmVm Y291bnRfY291bnQoDQo+ICsJCSAgICAmYXJjX2Fub24tPmFyY3NfZXNpemVbQVJDX0JVRkNfTUVU QURBVEFdKTsNCj4gIAkJdWludDY0X3QgZGF0YV9lc2l6ZSA9DQo+IC0JCSAgICByZWZjb3VudF9j b3VudCgmYXJjX2Fub24tPmFyY3NfZXNpemVbQVJDX0JVRkNfREFUQV0pOw0KPiArCQkgICAgemZz X3JlZmNvdW50X2NvdW50KCZhcmNfYW5vbi0+YXJjc19lc2l6ZVtBUkNfQlVGQ19EQVRBXSk7DQo+ ICAJCWRwcmludGYoImZhaWxpbmcsIGFyY190ZW1wcmVzZXJ2ZT0lbGx1SyBhbm9uX21ldGE9JWxs dUsgIg0KPiAgCQkgICAgImFub25fZGF0YT0lbGx1SyB0ZW1wcmVzZXJ2ZT0lbGx1SyBhcmNfYz0l bGx1S1xuIiwNCj4gIAkJICAgIGFyY190ZW1wcmVzZXJ2ZSA+PiAxMCwgbWV0YV9lc2l6ZSA+PiAx MCwNCj4gQEAgLTY4NTIsMTEgKzY4NjEsMTEgQEAgc3RhdGljIHZvaWQNCj4gIGFyY19rc3RhdF91 cGRhdGVfc3RhdGUoYXJjX3N0YXRlX3QgKnN0YXRlLCBrc3RhdF9uYW1lZF90ICpzaXplLA0KPiAg ICAgIGtzdGF0X25hbWVkX3QgKmV2aWN0X2RhdGEsIGtzdGF0X25hbWVkX3QgKmV2aWN0X21ldGFk YXRhKQ0KPiAgew0KPiAtCXNpemUtPnZhbHVlLnVpNjQgPSByZWZjb3VudF9jb3VudCgmc3RhdGUt PmFyY3Nfc2l6ZSk7DQo+ICsJc2l6ZS0+dmFsdWUudWk2NCA9IHpmc19yZWZjb3VudF9jb3VudCgm c3RhdGUtPmFyY3Nfc2l6ZSk7DQo+ICAJZXZpY3RfZGF0YS0+dmFsdWUudWk2NCA9DQo+IC0JICAg IHJlZmNvdW50X2NvdW50KCZzdGF0ZS0+YXJjc19lc2l6ZVtBUkNfQlVGQ19EQVRBXSk7DQo+ICsJ ICAgIHpmc19yZWZjb3VudF9jb3VudCgmc3RhdGUtPmFyY3NfZXNpemVbQVJDX0JVRkNfREFUQV0p Ow0KPiAgCWV2aWN0X21ldGFkYXRhLT52YWx1ZS51aTY0ID0NCj4gLQkgICAgcmVmY291bnRfY291 bnQoJnN0YXRlLT5hcmNzX2VzaXplW0FSQ19CVUZDX01FVEFEQVRBXSk7DQo+ICsJICAgIHpmc19y ZWZjb3VudF9jb3VudCgmc3RhdGUtPmFyY3NfZXNpemVbQVJDX0JVRkNfTUVUQURBVEFdKTsNCj4g IH0NCj4gIA0KPiAgc3RhdGljIGludA0KPiBAQCAtNzAyNSwyNSArNzAzNCwyNSBAQCBhcmNfc3Rh dGVfaW5pdCh2b2lkKQ0KPiAgCSAgICBvZmZzZXRvZihhcmNfYnVmX2hkcl90LCBiX2wxaGRyLmJf YXJjX25vZGUpLA0KPiAgCSAgICBhcmNfc3RhdGVfbXVsdGlsaXN0X2luZGV4X2Z1bmMpOw0KPiAg DQo+IC0JcmVmY291bnRfY3JlYXRlKCZhcmNfYW5vbi0+YXJjc19lc2l6ZVtBUkNfQlVGQ19NRVRB REFUQV0pOw0KPiAtCXJlZmNvdW50X2NyZWF0ZSgmYXJjX2Fub24tPmFyY3NfZXNpemVbQVJDX0JV RkNfREFUQV0pOw0KPiAtCXJlZmNvdW50X2NyZWF0ZSgmYXJjX21ydS0+YXJjc19lc2l6ZVtBUkNf QlVGQ19NRVRBREFUQV0pOw0KPiAtCXJlZmNvdW50X2NyZWF0ZSgmYXJjX21ydS0+YXJjc19lc2l6 ZVtBUkNfQlVGQ19EQVRBXSk7DQo+IC0JcmVmY291bnRfY3JlYXRlKCZhcmNfbXJ1X2dob3N0LT5h cmNzX2VzaXplW0FSQ19CVUZDX01FVEFEQVRBXSk7DQo+IC0JcmVmY291bnRfY3JlYXRlKCZhcmNf bXJ1X2dob3N0LT5hcmNzX2VzaXplW0FSQ19CVUZDX0RBVEFdKTsNCj4gLQlyZWZjb3VudF9jcmVh dGUoJmFyY19tZnUtPmFyY3NfZXNpemVbQVJDX0JVRkNfTUVUQURBVEFdKTsNCj4gLQlyZWZjb3Vu dF9jcmVhdGUoJmFyY19tZnUtPmFyY3NfZXNpemVbQVJDX0JVRkNfREFUQV0pOw0KPiAtCXJlZmNv dW50X2NyZWF0ZSgmYXJjX21mdV9naG9zdC0+YXJjc19lc2l6ZVtBUkNfQlVGQ19NRVRBREFUQV0p Ow0KPiAtCXJlZmNvdW50X2NyZWF0ZSgmYXJjX21mdV9naG9zdC0+YXJjc19lc2l6ZVtBUkNfQlVG Q19EQVRBXSk7DQo+IC0JcmVmY291bnRfY3JlYXRlKCZhcmNfbDJjX29ubHktPmFyY3NfZXNpemVb QVJDX0JVRkNfTUVUQURBVEFdKTsNCj4gLQlyZWZjb3VudF9jcmVhdGUoJmFyY19sMmNfb25seS0+ YXJjc19lc2l6ZVtBUkNfQlVGQ19EQVRBXSk7DQo+ICsJemZzX3JlZmNvdW50X2NyZWF0ZSgmYXJj X2Fub24tPmFyY3NfZXNpemVbQVJDX0JVRkNfTUVUQURBVEFdKTsNCj4gKwl6ZnNfcmVmY291bnRf Y3JlYXRlKCZhcmNfYW5vbi0+YXJjc19lc2l6ZVtBUkNfQlVGQ19EQVRBXSk7DQo+ICsJemZzX3Jl ZmNvdW50X2NyZWF0ZSgmYXJjX21ydS0+YXJjc19lc2l6ZVtBUkNfQlVGQ19NRVRBREFUQV0pOw0K PiArCXpmc19yZWZjb3VudF9jcmVhdGUoJmFyY19tcnUtPmFyY3NfZXNpemVbQVJDX0JVRkNfREFU QV0pOw0KPiArCXpmc19yZWZjb3VudF9jcmVhdGUoJmFyY19tcnVfZ2hvc3QtPmFyY3NfZXNpemVb QVJDX0JVRkNfTUVUQURBVEFdKTsNCj4gKwl6ZnNfcmVmY291bnRfY3JlYXRlKCZhcmNfbXJ1X2do b3N0LT5hcmNzX2VzaXplW0FSQ19CVUZDX0RBVEFdKTsNCj4gKwl6ZnNfcmVmY291bnRfY3JlYXRl KCZhcmNfbWZ1LT5hcmNzX2VzaXplW0FSQ19CVUZDX01FVEFEQVRBXSk7DQo+ICsJemZzX3JlZmNv dW50X2NyZWF0ZSgmYXJjX21mdS0+YXJjc19lc2l6ZVtBUkNfQlVGQ19EQVRBXSk7DQo+ICsJemZz X3JlZmNvdW50X2NyZWF0ZSgmYXJjX21mdV9naG9zdC0+YXJjc19lc2l6ZVtBUkNfQlVGQ19NRVRB REFUQV0pOw0KPiArCXpmc19yZWZjb3VudF9jcmVhdGUoJmFyY19tZnVfZ2hvc3QtPmFyY3NfZXNp emVbQVJDX0JVRkNfREFUQV0pOw0KPiArCXpmc19yZWZjb3VudF9jcmVhdGUoJmFyY19sMmNfb25s eS0+YXJjc19lc2l6ZVtBUkNfQlVGQ19NRVRBREFUQV0pOw0KPiArCXpmc19yZWZjb3VudF9jcmVh dGUoJmFyY19sMmNfb25seS0+YXJjc19lc2l6ZVtBUkNfQlVGQ19EQVRBXSk7DQo+ICANCj4gLQly ZWZjb3VudF9jcmVhdGUoJmFyY19hbm9uLT5hcmNzX3NpemUpOw0KPiAtCXJlZmNvdW50X2NyZWF0 ZSgmYXJjX21ydS0+YXJjc19zaXplKTsNCj4gLQlyZWZjb3VudF9jcmVhdGUoJmFyY19tcnVfZ2hv c3QtPmFyY3Nfc2l6ZSk7DQo+IC0JcmVmY291bnRfY3JlYXRlKCZhcmNfbWZ1LT5hcmNzX3NpemUp Ow0KPiAtCXJlZmNvdW50X2NyZWF0ZSgmYXJjX21mdV9naG9zdC0+YXJjc19zaXplKTsNCj4gLQly ZWZjb3VudF9jcmVhdGUoJmFyY19sMmNfb25seS0+YXJjc19zaXplKTsNCj4gKwl6ZnNfcmVmY291 bnRfY3JlYXRlKCZhcmNfYW5vbi0+YXJjc19zaXplKTsNCj4gKwl6ZnNfcmVmY291bnRfY3JlYXRl KCZhcmNfbXJ1LT5hcmNzX3NpemUpOw0KPiArCXpmc19yZWZjb3VudF9jcmVhdGUoJmFyY19tcnVf Z2hvc3QtPmFyY3Nfc2l6ZSk7DQo+ICsJemZzX3JlZmNvdW50X2NyZWF0ZSgmYXJjX21mdS0+YXJj c19zaXplKTsNCj4gKwl6ZnNfcmVmY291bnRfY3JlYXRlKCZhcmNfbWZ1X2dob3N0LT5hcmNzX3Np emUpOw0KPiArCXpmc19yZWZjb3VudF9jcmVhdGUoJmFyY19sMmNfb25seS0+YXJjc19zaXplKTsN Cj4gIA0KPiAgCWFnZ3N1bV9pbml0KCZhcmNfbWV0YV91c2VkLCAwKTsNCj4gIAlhZ2dzdW1faW5p dCgmYXJjX3NpemUsIDApOw0KPiBAQCAtNzA1OSwyNSArNzA2OCwyNSBAQCBhcmNfc3RhdGVfaW5p dCh2b2lkKQ0KPiAgc3RhdGljIHZvaWQNCj4gIGFyY19zdGF0ZV9maW5pKHZvaWQpDQo+ICB7DQo+ IC0JcmVmY291bnRfZGVzdHJveSgmYXJjX2Fub24tPmFyY3NfZXNpemVbQVJDX0JVRkNfTUVUQURB VEFdKTsNCj4gLQlyZWZjb3VudF9kZXN0cm95KCZhcmNfYW5vbi0+YXJjc19lc2l6ZVtBUkNfQlVG Q19EQVRBXSk7DQo+IC0JcmVmY291bnRfZGVzdHJveSgmYXJjX21ydS0+YXJjc19lc2l6ZVtBUkNf QlVGQ19NRVRBREFUQV0pOw0KPiAtCXJlZmNvdW50X2Rlc3Ryb3koJmFyY19tcnUtPmFyY3NfZXNp emVbQVJDX0JVRkNfREFUQV0pOw0KPiAtCXJlZmNvdW50X2Rlc3Ryb3koJmFyY19tcnVfZ2hvc3Qt PmFyY3NfZXNpemVbQVJDX0JVRkNfTUVUQURBVEFdKTsNCj4gLQlyZWZjb3VudF9kZXN0cm95KCZh cmNfbXJ1X2dob3N0LT5hcmNzX2VzaXplW0FSQ19CVUZDX0RBVEFdKTsNCj4gLQlyZWZjb3VudF9k ZXN0cm95KCZhcmNfbWZ1LT5hcmNzX2VzaXplW0FSQ19CVUZDX01FVEFEQVRBXSk7DQo+IC0JcmVm Y291bnRfZGVzdHJveSgmYXJjX21mdS0+YXJjc19lc2l6ZVtBUkNfQlVGQ19EQVRBXSk7DQo+IC0J cmVmY291bnRfZGVzdHJveSgmYXJjX21mdV9naG9zdC0+YXJjc19lc2l6ZVtBUkNfQlVGQ19NRVRB REFUQV0pOw0KPiAtCXJlZmNvdW50X2Rlc3Ryb3koJmFyY19tZnVfZ2hvc3QtPmFyY3NfZXNpemVb QVJDX0JVRkNfREFUQV0pOw0KPiAtCXJlZmNvdW50X2Rlc3Ryb3koJmFyY19sMmNfb25seS0+YXJj c19lc2l6ZVtBUkNfQlVGQ19NRVRBREFUQV0pOw0KPiAtCXJlZmNvdW50X2Rlc3Ryb3koJmFyY19s MmNfb25seS0+YXJjc19lc2l6ZVtBUkNfQlVGQ19EQVRBXSk7DQo+ICsJemZzX3JlZmNvdW50X2Rl c3Ryb3koJmFyY19hbm9uLT5hcmNzX2VzaXplW0FSQ19CVUZDX01FVEFEQVRBXSk7DQo+ICsJemZz X3JlZmNvdW50X2Rlc3Ryb3koJmFyY19hbm9uLT5hcmNzX2VzaXplW0FSQ19CVUZDX0RBVEFdKTsN Cj4gKwl6ZnNfcmVmY291bnRfZGVzdHJveSgmYXJjX21ydS0+YXJjc19lc2l6ZVtBUkNfQlVGQ19N RVRBREFUQV0pOw0KPiArCXpmc19yZWZjb3VudF9kZXN0cm95KCZhcmNfbXJ1LT5hcmNzX2VzaXpl W0FSQ19CVUZDX0RBVEFdKTsNCj4gKwl6ZnNfcmVmY291bnRfZGVzdHJveSgmYXJjX21ydV9naG9z dC0+YXJjc19lc2l6ZVtBUkNfQlVGQ19NRVRBREFUQV0pOw0KPiArCXpmc19yZWZjb3VudF9kZXN0 cm95KCZhcmNfbXJ1X2dob3N0LT5hcmNzX2VzaXplW0FSQ19CVUZDX0RBVEFdKTsNCj4gKwl6ZnNf cmVmY291bnRfZGVzdHJveSgmYXJjX21mdS0+YXJjc19lc2l6ZVtBUkNfQlVGQ19NRVRBREFUQV0p Ow0KPiArCXpmc19yZWZjb3VudF9kZXN0cm95KCZhcmNfbWZ1LT5hcmNzX2VzaXplW0FSQ19CVUZD X0RBVEFdKTsNCj4gKwl6ZnNfcmVmY291bnRfZGVzdHJveSgmYXJjX21mdV9naG9zdC0+YXJjc19l c2l6ZVtBUkNfQlVGQ19NRVRBREFUQV0pOw0KPiArCXpmc19yZWZjb3VudF9kZXN0cm95KCZhcmNf bWZ1X2dob3N0LT5hcmNzX2VzaXplW0FSQ19CVUZDX0RBVEFdKTsNCj4gKwl6ZnNfcmVmY291bnRf ZGVzdHJveSgmYXJjX2wyY19vbmx5LT5hcmNzX2VzaXplW0FSQ19CVUZDX01FVEFEQVRBXSk7DQo+ ICsJemZzX3JlZmNvdW50X2Rlc3Ryb3koJmFyY19sMmNfb25seS0+YXJjc19lc2l6ZVtBUkNfQlVG Q19EQVRBXSk7DQo+ICANCj4gLQlyZWZjb3VudF9kZXN0cm95KCZhcmNfYW5vbi0+YXJjc19zaXpl KTsNCj4gLQlyZWZjb3VudF9kZXN0cm95KCZhcmNfbXJ1LT5hcmNzX3NpemUpOw0KPiAtCXJlZmNv dW50X2Rlc3Ryb3koJmFyY19tcnVfZ2hvc3QtPmFyY3Nfc2l6ZSk7DQo+IC0JcmVmY291bnRfZGVz dHJveSgmYXJjX21mdS0+YXJjc19zaXplKTsNCj4gLQlyZWZjb3VudF9kZXN0cm95KCZhcmNfbWZ1 X2dob3N0LT5hcmNzX3NpemUpOw0KPiAtCXJlZmNvdW50X2Rlc3Ryb3koJmFyY19sMmNfb25seS0+ YXJjc19zaXplKTsNCj4gKwl6ZnNfcmVmY291bnRfZGVzdHJveSgmYXJjX2Fub24tPmFyY3Nfc2l6 ZSk7DQo+ICsJemZzX3JlZmNvdW50X2Rlc3Ryb3koJmFyY19tcnUtPmFyY3Nfc2l6ZSk7DQo+ICsJ emZzX3JlZmNvdW50X2Rlc3Ryb3koJmFyY19tcnVfZ2hvc3QtPmFyY3Nfc2l6ZSk7DQo+ICsJemZz X3JlZmNvdW50X2Rlc3Ryb3koJmFyY19tZnUtPmFyY3Nfc2l6ZSk7DQo+ICsJemZzX3JlZmNvdW50 X2Rlc3Ryb3koJmFyY19tZnVfZ2hvc3QtPmFyY3Nfc2l6ZSk7DQo+ICsJemZzX3JlZmNvdW50X2Rl c3Ryb3koJmFyY19sMmNfb25seS0+YXJjc19zaXplKTsNCj4gIA0KPiAgCW11bHRpbGlzdF9kZXN0 cm95KGFyY19tcnUtPmFyY3NfbGlzdFtBUkNfQlVGQ19NRVRBREFUQV0pOw0KPiAgCW11bHRpbGlz dF9kZXN0cm95KGFyY19tcnVfZ2hvc3QtPmFyY3NfbGlzdFtBUkNfQlVGQ19NRVRBREFUQV0pOw0K PiBAQCAtNzM1OSw4ICs3MzY4LDggQEAgYXJjX2Zpbmkodm9pZCkNCj4gIAltdXRleF9lbnRlcigm YXJjX3BydW5lX210eCk7DQo+ICAJd2hpbGUgKChwID0gbGlzdF9oZWFkKCZhcmNfcHJ1bmVfbGlz dCkpICE9IE5VTEwpIHsNCj4gIAkJbGlzdF9yZW1vdmUoJmFyY19wcnVuZV9saXN0LCBwKTsNCj4g LQkJcmVmY291bnRfcmVtb3ZlKCZwLT5wX3JlZmNudCwgJmFyY19wcnVuZV9saXN0KTsNCj4gLQkJ cmVmY291bnRfZGVzdHJveSgmcC0+cF9yZWZjbnQpOw0KPiArCQl6ZnNfcmVmY291bnRfcmVtb3Zl KCZwLT5wX3JlZmNudCwgJmFyY19wcnVuZV9saXN0KTsNCj4gKwkJemZzX3JlZmNvdW50X2Rlc3Ry b3koJnAtPnBfcmVmY250KTsNCj4gIAkJa21lbV9mcmVlKHAsIHNpemVvZiAoKnApKTsNCj4gIAl9 DQo+ICAJbXV0ZXhfZXhpdCgmYXJjX3BydW5lX210eCk7DQo+IEBAIC03Nzg3LDcgKzc3OTYsNyBA QCB0b3A6DQo+ICAJCQlBUkNTVEFUX0lOQ1IoYXJjc3RhdF9sMl9sc2l6ZSwgLUhEUl9HRVRfTFNJ WkUoaGRyKSk7DQo+ICANCj4gIAkJCWJ5dGVzX2Ryb3BwZWQgKz0gYXJjX2hkcl9zaXplKGhkcik7 DQo+IC0JCQkodm9pZCkgcmVmY291bnRfcmVtb3ZlX21hbnkoJmRldi0+bDJhZF9hbGxvYywNCj4g KwkJCSh2b2lkKSB6ZnNfcmVmY291bnRfcmVtb3ZlX21hbnkoJmRldi0+bDJhZF9hbGxvYywNCj4g IAkJCSAgICBhcmNfaGRyX3NpemUoaGRyKSwgaGRyKTsNCj4gIAkJfQ0KPiAgDQo+IEBAIC04MjA1 LDcgKzgyMTQsOCBAQCBsMmFyY193cml0ZV9idWZmZXJzKHNwYV90ICpzcGEsIGwyYXJjX2Rldl90 ICpkZXYsIHVpbnQNCj4gIAkJCWxpc3RfaW5zZXJ0X2hlYWQoJmRldi0+bDJhZF9idWZsaXN0LCBo ZHIpOw0KPiAgCQkJbXV0ZXhfZXhpdCgmZGV2LT5sMmFkX210eCk7DQo+ICANCj4gLQkJCSh2b2lk KSByZWZjb3VudF9hZGRfbWFueSgmZGV2LT5sMmFkX2FsbG9jLCBwc2l6ZSwgaGRyKTsNCj4gKwkJ CSh2b2lkKSB6ZnNfcmVmY291bnRfYWRkX21hbnkoJmRldi0+bDJhZF9hbGxvYywgcHNpemUsDQo+ ICsJCQkgICAgaGRyKTsNCj4gIA0KPiAgCQkJLyoNCj4gIAkJCSAqIE5vcm1hbGx5IHRoZSBMMkFS QyBjYW4gdXNlIHRoZSBoZHIncyBkYXRhLCBidXQgaWYNCj4gQEAgLTg0MzksNyArODQ0OSw3IEBA IGwyYXJjX2FkZF92ZGV2KHNwYV90ICpzcGEsIHZkZXZfdCAqdmQpDQo+ICAJICAgIG9mZnNldG9m KGFyY19idWZfaGRyX3QsIGJfbDJoZHIuYl9sMm5vZGUpKTsNCj4gIA0KPiAgCXZkZXZfc3BhY2Vf dXBkYXRlKHZkLCAwLCAwLCBhZGRkZXYtPmwyYWRfZW5kIC0gYWRkZGV2LT5sMmFkX2hhbmQpOw0K PiAtCXJlZmNvdW50X2NyZWF0ZSgmYWRkZGV2LT5sMmFkX2FsbG9jKTsNCj4gKwl6ZnNfcmVmY291 bnRfY3JlYXRlKCZhZGRkZXYtPmwyYWRfYWxsb2MpOw0KPiAgDQo+ICAJLyoNCj4gIAkgKiBBZGQg ZGV2aWNlIHRvIGdsb2JhbCBsaXN0DQo+IEBAIC04NDg1LDcgKzg0OTUsNyBAQCBsMmFyY19yZW1v dmVfdmRldih2ZGV2X3QgKnZkKQ0KPiAgCWwyYXJjX2V2aWN0KHJlbWRldiwgMCwgQl9UUlVFKTsN Cj4gIAlsaXN0X2Rlc3Ryb3koJnJlbWRldi0+bDJhZF9idWZsaXN0KTsNCj4gIAltdXRleF9kZXN0 cm95KCZyZW1kZXYtPmwyYWRfbXR4KTsNCj4gLQlyZWZjb3VudF9kZXN0cm95KCZyZW1kZXYtPmwy YWRfYWxsb2MpOw0KPiArCXpmc19yZWZjb3VudF9kZXN0cm95KCZyZW1kZXYtPmwyYWRfYWxsb2Mp Ow0KPiAgCWttZW1fZnJlZShyZW1kZXYsIHNpemVvZiAobDJhcmNfZGV2X3QpKTsNCj4gIH0NCj4g IA0KPiANCj4gTW9kaWZpZWQ6IGhlYWQvc3lzL2NkZGwvY29udHJpYi9vcGVuc29sYXJpcy91dHMv Y29tbW9uL2ZzL3pmcy9kYnVmLmMNCj4gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09DQo+IC0tLSBoZWFk L3N5cy9jZGRsL2NvbnRyaWIvb3BlbnNvbGFyaXMvdXRzL2NvbW1vbi9mcy96ZnMvZGJ1Zi5jCVR1 ZSBPY3QgMTUgMTQ6NTE6MjINCj4gMjAxOQkocjM1MzU2NCkgKysrIGhlYWQvc3lzL2NkZGwvY29u dHJpYi9vcGVuc29sYXJpcy91dHMvY29tbW9uL2ZzL3pmcy9kYnVmLmMNCj4gVHVlIE9jdCAxNSAx NTowOTozNiAyMDE5CShyMzUzNTY1KSBAQCAtMjI2LDcgKzIyNiw3IEBAIHN0YXRpYyBib29sZWFu X3QNCj4gZGJ1Zl9ldmljdF90aHJlYWRfZXhpdDsgKi8NCj4gIHR5cGVkZWYgc3RydWN0IGRidWZf Y2FjaGUgew0KPiAgCW11bHRpbGlzdF90ICpjYWNoZTsNCj4gLQlyZWZjb3VudF90IHNpemU7DQo+ ICsJemZzX3JlZmNvdW50X3Qgc2l6ZTsNCj4gIH0gZGJ1Zl9jYWNoZV90Ow0KPiAgZGJ1Zl9jYWNo ZV90IGRidWZfY2FjaGVzW0RCX0NBQ0hFX01BWF07DQo+ICANCj4gQEAgLTMxNiw3ICszMTYsNyBA QCBkYnVmX2NvbnModm9pZCAqdmRiLCB2b2lkICp1bnVzZWQsIGludCBrbWZsYWcpDQo+ICAJbXV0 ZXhfaW5pdCgmZGItPmRiX210eCwgTlVMTCwgTVVURVhfREVGQVVMVCwgTlVMTCk7DQo+ICAJY3Zf aW5pdCgmZGItPmRiX2NoYW5nZWQsIE5VTEwsIENWX0RFRkFVTFQsIE5VTEwpOw0KPiAgCW11bHRp bGlzdF9saW5rX2luaXQoJmRiLT5kYl9jYWNoZV9saW5rKTsNCj4gLQlyZWZjb3VudF9jcmVhdGUo JmRiLT5kYl9ob2xkcyk7DQo+ICsJemZzX3JlZmNvdW50X2NyZWF0ZSgmZGItPmRiX2hvbGRzKTsN Cj4gIA0KPiAgCXJldHVybiAoMCk7DQo+ICB9DQo+IEBAIC0zMjksNyArMzI5LDcgQEAgZGJ1Zl9k ZXN0KHZvaWQgKnZkYiwgdm9pZCAqdW51c2VkKQ0KPiAgCW11dGV4X2Rlc3Ryb3koJmRiLT5kYl9t dHgpOw0KPiAgCWN2X2Rlc3Ryb3koJmRiLT5kYl9jaGFuZ2VkKTsNCj4gIAlBU1NFUlQoIW11bHRp bGlzdF9saW5rX2FjdGl2ZSgmZGItPmRiX2NhY2hlX2xpbmspKTsNCj4gLQlyZWZjb3VudF9kZXN0 cm95KCZkYi0+ZGJfaG9sZHMpOw0KPiArCXpmc19yZWZjb3VudF9kZXN0cm95KCZkYi0+ZGJfaG9s ZHMpOw0KPiANCj4gKioqIERJRkYgT1VUUFVUIFRSVU5DQVRFRCBBVCAxMDAwIExJTkVTICoqKg0K PiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXw0KPiBzdm4t c3JjLWhlYWRAZnJlZWJzZC5vcmcgbWFpbGluZyBsaXN0DQo+IGh0dHBzOi8vbGlzdHMuZnJlZWJz ZC5vcmcvbWFpbG1hbi9saXN0aW5mby9zdm4tc3JjLWhlYWQNCj4gVG8gdW5zdWJzY3JpYmUsIHNl bmQgYW55IG1haWwgdG8gInN2bi1zcmMtaGVhZC11bnN1YnNjcmliZUBmcmVlYnNkLm9yZyINCg0K QnVpbGR3b3JsZCBmYWlscyB3aXRoIHRoZSBlcnJvciBzaG93biBiZWxvdzoNCg0KWy4uLl0NCi0g LS0tIGNkZGwvbGliL2xpYnpmc19jb3JlX19MIC0tLQ0KLSAtLS0gbGliemZzX2NvcmUubyAtLS0N CkluIGZpbGUgaW5jbHVkZWQgZnJvbQ0KL3Vzci9zcmMvY2RkbC9jb250cmliL29wZW5zb2xhcmlz L2xpYi9saWJ6ZnNfY29yZS9jb21tb24vbGliemZzX2NvcmUuYzo4OTogSW4gZmlsZSBpbmNsdWRl ZA0KZnJvbSAvdXNyL3NyYy9zeXMvY2RkbC9jb250cmliL29wZW5zb2xhcmlzL3V0cy9jb21tb24v ZnMvemZzL3N5cy96ZnNfaW9jdGwuaDozNTogSW4gZmlsZQ0KaW5jbHVkZWQgZnJvbSAvdXNyL3Ny Yy9zeXMvY2RkbC9jb250cmliL29wZW5zb2xhcmlzL3V0cy9jb21tb24vZnMvemZzL3N5cy9kc2xf ZGVsZWcuaDozMDogSW4NCmZpbGUgaW5jbHVkZWQgZnJvbSAvdXNyL3NyYy9zeXMvY2RkbC9jb250 cmliL29wZW5zb2xhcmlzL3V0cy9jb21tb24vZnMvemZzL3N5cy9kc2xfcG9vbC5oOjM3Og0KL3Vz ci9zcmMvc3lzL2NkZGwvY29udHJpYi9vcGVuc29sYXJpcy91dHMvY29tbW9uL2ZzL3pmcy9zeXMv YXJjLmg6ODk6MjogZXJyb3I6IHVua25vd24gdHlwZQ0KbmFtZSAncmVmY291bnRfdCcgcmVmY291 bnRfdCAgICAgICAgICAgICAgcF9yZWZjbnQ7IF4NCjEgZXJyb3IgZ2VuZXJhdGVkLg0KKioqIFts aWJ6ZnNfY29yZS5vXSBFcnJvciBjb2RlIDENCg0KbWFrZVs0XTogc3RvcHBlZCBpbiAvdXNyL3Ny Yy9jZGRsL2xpYi9saWJ6ZnNfY29yZQ0KDQoNCi0gLS0gDQpPLiBIYXJ0bWFubg0KDQpJY2ggd2lk ZXJzcHJlY2hlIGRlciBOdXR6dW5nIG9kZXIgw5xiZXJtaXR0bHVuZyBtZWluZXIgRGF0ZW4gZsO8 cg0KV2VyYmV6d2Vja2Ugb2RlciBmw7xyIGRpZSBNYXJrdC0gb2RlciBNZWludW5nc2ZvcnNjaHVu ZyAowqcgMjggQWJzLiA0IEJEU0cpLg0KLS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0NCg0K aUhVRUFSWUlBQjBXSVFTeThJQnhBUERrcVZCYVRKNDROMVpaUGJhNVJ3VUNYYVhybmdBS0NSQTRO MVpaUGJhNQ0KUjllNUFQOVpSMHFrR0Fqc0pKQmNWUTZDZER4Q0pETXlOaWpDQWNwKzBkUXZKMVV4 R2dFQWpnaUZzUHdrS3FrYw0KSWxIWFk5R3VJamZqSE12NFFsVytBU0hRd0RKc0t3bz0NCj1nVTRT DQotLS0tLUVORCBQR1AgU0lHTkFUVVJFLS0tLS0NCg== From owner-svn-src-all@freebsd.org Tue Oct 15 15:56:30 2019 Return-Path: Delivered-To: svn-src-all@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 7422914BD6D; Tue, 15 Oct 2019 15:56:30 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) (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 46t0R13T4Cz4Q61; Tue, 15 Oct 2019 15:56:29 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf1-f65.google.com with SMTP id c195so14895271lfg.9; Tue, 15 Oct 2019 08:56:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=HQuXO0LtjqRqaENW2mqYlYiS25kcQBnPNYYs8CIQUgo=; b=AXovKARWzXIm3H1BU4yRQ4pvH4VVHo05UN8xdLp/2+oqVys2tXhH55bHrhMC/hrMfz 25kAbAh4f/z4YsNSdUQWioGFwTQqx89/PSSHK5duZGkvxA2cFOv+Z7lMn5c1pJ+YK9mz WpzVwvX/sBAFU6Q1gkTYeeEp+k94fndlCognZavI7phuqeDIxlXLBeb1u9fwILay/W6e 9Az7fhpnEpEyWmMPUPgRpPkXKg/Ye5jWydCvcSerlDNba+mVF5IMvH9yGtihvBfccXLV CRUNfFKFAb2CC6OCPIPGRAYMN3aQL7r2lZS0bBi7+7aAhFq0w4+vMIEjd/QO8/HcGPxu ZCtA== X-Gm-Message-State: APjAAAXXJB14MSa5puNFs13niRXOElEPOcLduunmQIAMooTFSFWCdCIi 5MLs3RhSIFibCpD+Ms8ExC9VZd+LIAI= X-Google-Smtp-Source: APXvYqz+JT3Xl7oSqwc9XbKkx3Vge+cCFOieS4mcHwDh1r1JKhwHKXLnEBktxMUg7y8GHITQ2kORoQ== X-Received: by 2002:ac2:424c:: with SMTP id m12mr13436135lfl.140.1571154987191; Tue, 15 Oct 2019 08:56:27 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id i17sm5104142ljd.2.2019.10.15.08.56.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Oct 2019 08:56:26 -0700 (PDT) Subject: Re: svn commit: r353565 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys To: "O. Hartmann" Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201910151509.x9FF9a2B031347@repo.freebsd.org> <20191015175357.3ee91a1c@thor.intern.walstatt.dynvpn.de> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: <00eaaf1a-392c-29e1-a035-e72c61423fb3@FreeBSD.org> Date: Tue, 15 Oct 2019 18:56:25 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191015175357.3ee91a1c@thor.intern.walstatt.dynvpn.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46t0R13T4Cz4Q61 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.167.65 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-3.15 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; RCVD_TLS_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[65.167.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; IP_SCORE(-1.15)[ip: (-0.35), ipnet: 209.85.128.0/17(-3.24), asn: 15169(-2.10), country: US(-0.05)]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[65.167.85.209.rep.mailspike.net : 127.0.0.17]; 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]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[96.151.72.93.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 15:56:30 -0000 On 15/10/2019 18:53, O. Hartmann wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > Am Tue, 15 Oct 2019 15:09:36 +0000 (UTC) > Andriy Gapon schrieb: Sorry, I got tired before I could scroll to your reply. -- Andriy Gapon From owner-svn-src-all@freebsd.org Tue Oct 15 16:00:56 2019 Return-Path: Delivered-To: svn-src-all@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 B622714C208 for ; Tue, 15 Oct 2019 16:00:56 +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 46t0X82K7cz4QT8 for ; Tue, 15 Oct 2019 16:00:56 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1571155255; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=dg3N/t/drftYAaeCEencbO05KBPOul54dlSkCQBQkh0ptKVvBzbChwsfIqmBjEMcwhiW21mpTtKKi iDQ6KCu++BNMk06bMMSUFACNYO485zmzf8z9AzXmRtk5sENIRBZR+C64dr2mpx9eJ+1+EI7Y1kYqq9 p9A4gP25f2aeb5IMYvz3hx4MrhY8HGqH2pu99VwkHNbawZ5zbns+3S/j04jnFKtwg2u3oI/w7WUoEE fQv2oSkX9af+9jSSsxtTuBRWRVG2q48emSMw5/k27HifONyuNsubBaeBl8lv8uf8bo+6mO+tSW1pCJ BQ9Af59A0V/CbUa1fgj4qr21w5qObmQ== 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:cc:to:from:subject:message-id:dkim-signature:from; bh=l3gABVsTgMdTx/cnOCH+c539Zjl+6KmJYuIiRH2gzd4=; b=L2vriqz2pRQxrx5jWZf97PlcgEaNwGiQYXaXSDVdQcv8lXfCAerkk7CjKrsw/+mBWsyKihefRWYc0 nnWP0rJS/ByTkGK9G3RiOgMw6RKsQNd1yaKLQyBenhfHyOx7391VbDpRWj0Z0GTpFhWtJFiraSnEf/ aEKMk4XGWb5gq8I06jO8z7kfCU/9hW5vGCoQoEky8EWNFSyviWHZMuZV74PzkK1K7P5Mg2QPufasSj pkDN3537KwOHVKkUKpj9i+PmZOuhYg9cuKjgg3yuk8BAXrh2IeUL5Jdg+WKlh4UDQAcrjLCqHj1qzV Ea0u4AiU/Tj6jD8SbOd+7a7XxRddoeA== 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:cc:to:from:subject:message-id:from; bh=l3gABVsTgMdTx/cnOCH+c539Zjl+6KmJYuIiRH2gzd4=; b=Y4Yhj+v/IX18i2CrcLLXbuJAT4fx8RqoRY2C5suIAn/H7xNxFAcWiJzfRyoNUJlGMNfdCTdyhsNjf pcrlQ1qDpW4FgR+X+upJvR0RI7nouV3Q03uIiCrVUIWZSyQDHkzcyG08paCmCkU93mE1GS6gCg0lOA +h/K5ecqHbZ/DZCwHhcfX9muDybMtfXdp5fdoH7S3/ASguuQ1LO+kUQk14mKrUv+sGGRCPFRMH901m wQi3qro6vY2L+XwIDorLYOldIvLIm42cWjtNCZCqNCXwbb4IMhp52hbba2nEABZr1UNBoXYp4BxpYw rECYiwlnQ82ePXYGHpxJuzyKSUnQmfQ== X-MHO-RoutePath: aGlwcGll X-MHO-User: f679d90b-ef64-11e9-85ed-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 f679d90b-ef64-11e9-85ed-13b9aae3a1d2; Tue, 15 Oct 2019 16:00:53 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x9FG0pxb009652; Tue, 15 Oct 2019 10:00:51 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r353565 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys From: Ian Lepore To: Andriy Gapon , "O. Hartmann" Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Date: Tue, 15 Oct 2019 10:00:51 -0600 In-Reply-To: <00eaaf1a-392c-29e1-a035-e72c61423fb3@FreeBSD.org> References: <201910151509.x9FF9a2B031347@repo.freebsd.org> <20191015175357.3ee91a1c@thor.intern.walstatt.dynvpn.de> <00eaaf1a-392c-29e1-a035-e72c61423fb3@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: 46t0X82K7cz4QT8 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.90 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.90)[-0.902,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 16:00:56 -0000 On Tue, 2019-10-15 at 18:56 +0300, Andriy Gapon wrote: > On 15/10/2019 18:53, O. Hartmann wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA256 > > > > Am Tue, 15 Oct 2019 15:09:36 +0000 (UTC) > > Andriy Gapon schrieb: > > Sorry, I got tired before I could scroll to your reply. > You break the build, a user reports it, and a smartass reply is the best you can do? -- Ian From owner-svn-src-all@freebsd.org Tue Oct 15 16:02:42 2019 Return-Path: Delivered-To: svn-src-all@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 3831014C410; Tue, 15 Oct 2019 16:02:42 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 46t0Z90xp8z4Qpt; Tue, 15 Oct 2019 16:02:40 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf1-f42.google.com with SMTP id r22so14939192lfm.1; Tue, 15 Oct 2019 09:02:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=rUgPTyRC3vJRr/x6hng6Jop2qJlzymfrmQaLioZIndY=; b=qGo6TlCPPAIyFz5uwbVqFx+ZfbiO8NSqTn6+ZL3u3JZUxWSUq6hMCNPRTkD4lpe2tC RiefeUZ2M8rH3SMgY24lqBGzmSpYM+FTPnGeTCJxOOgqkVrPQrrVUf4TftyzTqidOzYn j59LqBW03TcWA+Qb2ToB+5qxSaVpJLMmaaEXwczgrpvy1q38kdSI3h47HKlD+pNeP/bV cCp2v0zGqKeO/dh10iob9Ztr/B034iOb7/QL5buZkzM/3dkYlp51HuTNEmLEUz5DsE8H mziRfMYPzYMaPksUvXgRlXwgECyQBzXLTpnLZI4KWNF/SflU9X56VTBc7pPfU989SYpm +mig== X-Gm-Message-State: APjAAAV4wIBYavMC1PsymMtfYD3p+yrnSI2kwFlPp8QJZZunrCveJPg8 zlwvo9DhSuNBv81/vcR7an2G3tuZvNA= X-Google-Smtp-Source: APXvYqyi7l+d/nSO3SUAuqrGVhjWpyhEEe0b+970hBgh7RIcRl8Nw3+81nrXSc+eKJXMwmK5vntNXw== X-Received: by 2002:ac2:5486:: with SMTP id t6mr22700079lfk.183.1571155359023; Tue, 15 Oct 2019 09:02:39 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id u26sm5159003lfd.19.2019.10.15.09.02.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Oct 2019 09:02:38 -0700 (PDT) Subject: Re: svn commit: r353565 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys To: Ian Lepore , "O. Hartmann" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910151509.x9FF9a2B031347@repo.freebsd.org> <20191015175357.3ee91a1c@thor.intern.walstatt.dynvpn.de> <00eaaf1a-392c-29e1-a035-e72c61423fb3@FreeBSD.org> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: <4e9836f5-01ba-534a-27a3-a272a829d456@FreeBSD.org> Date: Tue, 15 Oct 2019 19:02:37 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46t0Z90xp8z4Qpt X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.167.42 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-3.18 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; RCVD_TLS_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[42.167.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; IP_SCORE(-1.18)[ip: (-0.48), ipnet: 209.85.128.0/17(-3.24), asn: 15169(-2.10), country: US(-0.05)]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[42.167.85.209.rep.mailspike.net : 127.0.0.17]; 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]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[96.151.72.93.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 16:02:42 -0000 On 15/10/2019 19:00, Ian Lepore wrote: > On Tue, 2019-10-15 at 18:56 +0300, Andriy Gapon wrote: >> On 15/10/2019 18:53, O. Hartmann wrote: >>> -----BEGIN PGP SIGNED MESSAGE----- >>> Hash: SHA256 >>> >>> Am Tue, 15 Oct 2019 15:09:36 +0000 (UTC) >>> Andriy Gapon schrieb: >> >> Sorry, I got tired before I could scroll to your reply. >> > > You break the build, a user reports it, and a smartass reply is the > best you can do? The best I could do, and did, was fixing the build. -- Andriy Gapon From owner-svn-src-all@freebsd.org Tue Oct 15 16:05:18 2019 Return-Path: Delivered-To: svn-src-all@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 5A14514C502; Tue, 15 Oct 2019 16:05:18 +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 46t0dB1lxxz4R0D; Tue, 15 Oct 2019 16:05:18 +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 1B6DA21088; Tue, 15 Oct 2019 16:05:18 +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 x9FG5Hk4066762; Tue, 15 Oct 2019 16:05:17 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FG5H4x066761; Tue, 15 Oct 2019 16:05:17 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910151605.x9FG5H4x066761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 15 Oct 2019 16:05:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353569 - head/usr.bin/rpcgen X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/usr.bin/rpcgen X-SVN-Commit-Revision: 353569 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 16:05:18 -0000 Author: brooks Date: Tue Oct 15 16:05:17 2019 New Revision: 353569 URL: https://svnweb.freebsd.org/changeset/base/353569 Log: rpcgen: make compiler arglist allocation dynamic Limit argmax to an absurdly large value prevent overflow (no overflow possible on FreeBSD due to ARG_MAX). In CheriBSD we exceed the 19 non-NULL arguments in the static array. Add a simple size doubling allocator and increase the default to 32. GC remnants of support for fixed arguments. Reviewed by: archardson (prior version), James Clarke (prior version) MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21971 Modified: head/usr.bin/rpcgen/rpc_main.c Modified: head/usr.bin/rpcgen/rpc_main.c ============================================================================== --- head/usr.bin/rpcgen/rpc_main.c Tue Oct 15 15:52:01 2019 (r353568) +++ head/usr.bin/rpcgen/rpc_main.c Tue Oct 15 16:05:17 2019 (r353569) @@ -93,19 +93,13 @@ static int allnc = nitems(allnv); */ static void addarg(const char *); /* add another argument to the list */ static void insarg(int, const char *); /* insert arg at specified location */ -static void clear_args(void); /* clear argument list */ static void checkfiles(const char *, const char *); /* check if out file already exists */ +static char **arglist; +static int argcount = 0; +static int argmax = 0; - -#define ARGLISTLEN 20 -#define FIXEDARGS 0 - -static char *arglist[ARGLISTLEN]; -static int argcount = FIXEDARGS; - - int nonfatalerrors; /* errors */ int inetdflag = 0; /* Support for inetd is disabled by default, use -I */ int pmflag = 0; /* Support for port monitors is disabled by default */ @@ -141,7 +135,6 @@ main(int argc, const char *argv[]) struct commandline cmd; (void) memset((char *)&cmd, 0, sizeof (struct commandline)); - clear_args(); if (!parseargs(argc, argv, &cmd)) usage(); /* @@ -273,16 +266,6 @@ add_warning(void) f_print(fout, " */\n\n"); } -/* clear list of arguments */ -static void -clear_args(void) -{ - int i; - for (i = FIXEDARGS; i < ARGLISTLEN; i++) - arglist[i] = NULL; - argcount = FIXEDARGS; -} - /* prepend C-preprocessor and flags before arguments */ static void prepend_cpp(void) @@ -925,21 +908,40 @@ do_registers(int argc, const char *argv[]) } /* - * Add another argument to the arg list + * Extend the argument list */ static void -addarg(const char *cp) +moreargs(void) { - if (argcount >= ARGLISTLEN) { - warnx("too many defines"); + char **newarglist; + + argmax = argmax == 0 ? 32 : argmax << 1; + if (argmax > INT_MAX / 4) { + warnx("refusing to allocate too many arguments"); crash(); - /*NOTREACHED*/ } + newarglist = realloc(arglist, argmax * sizeof(*arglist)); + if (newarglist == NULL) { + warnx("unable to allocate arglist"); + crash(); + } + free(arglist); + arglist = newarglist; +} + +/* + * Add another argument to the arg list + */ +static void +addarg(const char *cp) +{ + if (argcount >= argmax) + moreargs(); + if (cp != NULL) arglist[argcount++] = xstrdup(cp); else arglist[argcount++] = NULL; - } /* @@ -950,11 +952,8 @@ insarg(int place, const char *cp) { int i; - if (argcount >= ARGLISTLEN) { - warnx("too many defines"); - crash(); - /*NOTREACHED*/ - } + if (argcount >= argmax) + moreargs(); /* Move up existing arguments */ for (i = argcount - 1; i >= place; i--) From owner-svn-src-all@freebsd.org Tue Oct 15 16:05:56 2019 Return-Path: Delivered-To: svn-src-all@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 984A014C5C7; Tue, 15 Oct 2019 16:05:56 +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 46t0dw3ZTZz4RFJ; Tue, 15 Oct 2019 16:05:56 +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 5CFE221097; Tue, 15 Oct 2019 16:05:56 +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 x9FG5un1066953; Tue, 15 Oct 2019 16:05:56 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FG5uNo066952; Tue, 15 Oct 2019 16:05:56 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910151605.x9FG5uNo066952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 15 Oct 2019 16:05:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r353570 - releng/12.1/sys/netinet X-SVN-Group: releng X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: releng/12.1/sys/netinet X-SVN-Commit-Revision: 353570 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 16:05:56 -0000 Author: tuexen Date: Tue Oct 15 16:05:55 2019 New Revision: 353570 URL: https://svnweb.freebsd.org/changeset/base/353570 Log: MFS r353563: Ensure that local variables are reset to their initial value when dealing with error cases in a loop over all remote addresses. This issue was found and reported by OSS_Fuzz in: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18080 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18086 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18121 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18163 MFS r353567: Fix mergeinfo for r353563. Approved by: re(gjb) Modified: releng/12.1/sys/netinet/sctp_output.c Directory Properties: releng/12.1/ (props changed) Modified: releng/12.1/sys/netinet/sctp_output.c ============================================================================== --- releng/12.1/sys/netinet/sctp_output.c Tue Oct 15 16:05:17 2019 (r353569) +++ releng/12.1/sys/netinet/sctp_output.c Tue Oct 15 16:05:55 2019 (r353570) @@ -7872,8 +7872,8 @@ sctp_med_chunk_output(struct sctp_inpcb *inp, int bundle_at, ctl_cnt, no_data_chunks, eeor_mode; unsigned int mtu, r_mtu, omtu, mx_mtu, to_out; int tsns_sent = 0; - uint32_t auth_offset = 0; - struct sctp_auth_chunk *auth = NULL; + uint32_t auth_offset; + struct sctp_auth_chunk *auth; uint16_t auth_keyid; int override_ok = 1; int skip_fill_up = 0; @@ -8068,6 +8068,8 @@ again_one_more_time: } bundle_at = 0; endoutchain = outchain = NULL; + auth = NULL; + auth_offset = 0; no_fragmentflg = 1; one_chunk = 0; if (net->dest_state & SCTP_ADDR_UNCONFIRMED) { From owner-svn-src-all@freebsd.org Tue Oct 15 16:08:53 2019 Return-Path: Delivered-To: svn-src-all@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 A470814C70F; Tue, 15 Oct 2019 16:08:53 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46t0j91yCBz4RRQ; Tue, 15 Oct 2019 16:08:41 +0000 (UTC) (envelope-from ohartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1571155718; bh=ACmxN+m3WBAXIcygJ7fUj4WH5POow75ZI/T7m7U0UhU=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=cUsyZwuQhPvC9ug2Nqp+ZDd6QiE6bOLZ0/rEs9NCzcgJr8wBBmnDR31BNpIPn/UFa e5ufAgneFovbqlhbVn84HQkjbxlAadifARDArmRTNGNKOyEmdEQz4HtCg5pOQEuBkv NYhZplkiEMD0MpFp0p/0l+vNYNPIZyylln674rlo= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from thor.intern.walstatt.dynvpn.de ([77.191.155.27]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MhU5R-1hplK91bjX-00eeAI; Tue, 15 Oct 2019 18:08:38 +0200 Date: Tue, 15 Oct 2019 18:08:10 +0200 From: "O. Hartmann" To: Andriy Gapon Cc: "O. Hartmann" , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r353565 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys Message-ID: <20191015180837.2b66b861@thor.intern.walstatt.dynvpn.de> In-Reply-To: <00eaaf1a-392c-29e1-a035-e72c61423fb3@FreeBSD.org> References: <201910151509.x9FF9a2B031347@repo.freebsd.org> <20191015175357.3ee91a1c@thor.intern.walstatt.dynvpn.de> <00eaaf1a-392c-29e1-a035-e72c61423fb3@FreeBSD.org> Organization: WALSTATT User-Agent: OutScare 3.1415926 X-Operating-System: ImNotAnOperatingSystem 3.141592527 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 X-Provags-ID: V03:K1:aSD4qVJLFmo0qEGuL6sisbzSgQ9GsePM8GChhFFbdypsKtPsrZx +Q9zqa3ljYs79pQoGzKztja1UZreqf3S6RNePHg267EGSKkB7cj1jMMGs7UgyYeosO+ul/e eT36DeoWdNSDSnLQcWz45FOuOEySpuI0gRhd1DA1IxkZGCP2bz7LKbDM6ZVCj+C7WAP2v+I zukKd0gD9GWHDR/bPZGuw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:B855vTmUhHo=:pbkdnucDmI9p5p2eEp5YFq W0Z6rqdWzzwYGjc3OxltRDLrq/wjkwBjum4nWVEtWrG1y6kvZqPBMwkNOHnV/USGw3ZFOZtTq CrnDSMKII7u9r9A3vhSzHuLNv8cELa54DVXqSgnpqVL5jWdw+YedGzwMw/hu25YnOGCiOvfz4 rlSklvtQoEcYCnp6ZiLp6tXlG1bksrDln1ATwnhkbWu0uSOn2Q0n4Fbjjhcbd+Bgmn0F/af5L 7RnhnWfSVw+osRvPlcj7TQMlqLyDK+FNjltAKP4lsLYw9aSOgHKTeM3P3YyetEkehjz1jtwEK gRombi0SXWXwZlxNfqA7UauRjiuZO6CcEA6vx6SvuBw2y4gtFrJXwstxqJcNAU9Vh+KjT7IYh qUFGRtcrtbdTQam43EMbZVg9WTNbe+8hBgRJw48vBd2zdhVV/fVr5oOIirypqri6HOZ2YOr8Z 7czDApl+Era9OICjc6v9pq1DFNLOEQkuPljfL1aoQASPBfcRBP9fNU4oaMLQqcfmAoRODFlvJ 9brVt02AV92ZhiPfNp6q3FlFzUn7CaV84SZIU3JN7gpb5OYarkO5GmnVCXG87dyvqnDcR2ldG Ardu/JSQcT+3cqC6zD8Y5IOfLS3uVkP9sx3cKJUnAiIpx64ri7IEc0bBQA8Z0Q+h+k9I9RwW3 3jvKZ25Woyt8bOlEUKMbRsaAz2l0Iajm1B4S5LkdCITuN466IY6CxctEIDJsIOYFF8IqTZhVa ug7Ku5IDIDCGu781WkRXfxOx2Hi/Y1tk46lasShKh9jGX10xSU3LiNqfGHz1jlMyckiB06U3F dhs1jAJfSOCsMSQgqJDXgKsmX+YXUiCXwJQgvb/oMstmyZP2vlDul7uhyKyb10xPHnzfL8Aqs KSl9sFGkxjanfoEhSW9iEOaYPmDx2S9soL1y97Rd/VD2cki6NFu50JYgbxEZcYGaJl73apMUZ GwYYyXmfYOFrRTEdFDJVj40O4myaFRX9cclwWvZXFTDc9aXxNVSoVfqyf43O9nN+C0gMJOf58 XE09XepuFv8dcd0bXRzQ6u3GWpa/BBEFKdHsP10fM6+cR6O2/BaQH7MgtQZof/lGtW+ujmze+ 4ZihdLqHcNPyMbpEzdUE1Ra92ntD+czRUWjhkRznBlh/pXc9Ck5aMc71PW6LSvmI+9w89MmDw Us6Jg/SC+PIjqH16c3ZymTacgWdrCmpcVc986bLWX370Wqlvu3M7bQXVJUKS08+O2PvG6oX0f 5Xj/tRAtqfPuzHief1RMFRCTBZFcL6CsUH5Imxu71PY/DakZlwSgvlLA9eQ4= X-Rspamd-Queue-Id: 46t0j91yCBz4RRQ X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.b=cUsyZwuQ; dmarc=none; spf=none (mx1.freebsd.org: domain of ohartmann@walstatt.org has no SPF policy when checking 212.227.15.15) smtp.mailfrom=ohartmann@walstatt.org X-Spamd-Result: default: False [-3.39 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmx.net:s=badeba3b8450]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[walstatt.org]; RCPT_COUNT_FIVE(0.00)[5]; HAS_ORG_HEADER(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmx.net:+]; MIME_BASE64_TEXT(0.10)[]; RCVD_IN_DNSWL_NONE(0.00)[15.15.227.212.list.dnswl.org : 127.0.3.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; IP_SCORE(-1.19)[ip: (-6.63), ipnet: 212.227.0.0/16(-1.31), asn: 8560(2.02), country: DE(-0.01)]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[27.155.191.77.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 16:08:53 -0000 LS0tLS1CRUdJTiBQR1AgU0lHTkVEIE1FU1NBR0UtLS0tLQ0KSGFzaDogU0hBMjU2DQoNCkFtIFR1 ZSwgMTUgT2N0IDIwMTkgMTg6NTY6MjUgKzAzMDANCkFuZHJpeSBHYXBvbiA8YXZnQEZyZWVCU0Qu b3JnPiBzY2hyaWViOg0KDQo+IE9uIDE1LzEwLzIwMTkgMTg6NTMsIE8uIEhhcnRtYW5uIHdyb3Rl Og0KPiA+IC0tLS0tQkVHSU4gUEdQIFNJR05FRCBNRVNTQUdFLS0tLS0NCj4gPiBIYXNoOiBTSEEy NTYNCj4gPiANCj4gPiBBbSBUdWUsIDE1IE9jdCAyMDE5IDE1OjA5OjM2ICswMDAwIChVVEMpDQo+ ID4gQW5kcml5IEdhcG9uIDxhdmdARnJlZUJTRC5vcmc+IHNjaHJpZWI6ICANCj4gDQo+IFNvcnJ5 LCBJIGdvdCB0aXJlZCBiZWZvcmUgSSBjb3VsZCBzY3JvbGwgdG8geW91ciByZXBseS4NCj4gDQoN CmhhcHBlbnMgc29tdGltZXMgd2hlbiBJJ20gdGlyZWQgLi4uDQpEaWRuJ3QgcmVhbGl6ZSB0aGUg bGVuZ3RoIG9mIHRoZSBwb3N0Lg0KDQpvaA0KDQotIC0tIA0KTy4gSGFydG1hbm4NCg0KSWNoIHdp ZGVyc3ByZWNoZSBkZXIgTnV0enVuZyBvZGVyIMOcYmVybWl0dGx1bmcgbWVpbmVyIERhdGVuIGbD vHINCldlcmJlendlY2tlIG9kZXIgZsO8ciBkaWUgTWFya3QtIG9kZXIgTWVpbnVuZ3Nmb3JzY2h1 bmcgKMKnIDI4IEFicy4gNCBCRFNHKS4NCi0tLS0tQkVHSU4gUEdQIFNJR05BVFVSRS0tLS0tDQoN CmlIVUVBUllJQUIwV0lRU3k4SUJ4QVBEa3FWQmFUSjQ0TjFaWlBiYTVSd1VDWGFYdkJRQUtDUkE0 TjFaWlBiYTUNClIwTzZBUDk0NVZrN21DYUpJRDBIY2l0SktER2dpS1Q1R1VEWHhwOFRqSmczSFBs VHVRRUF0bnUwVCt0UmpOYU4NCmVCOTFOQkJkMlBwd1ZaVlRFVEdrbkpiblBpQUFBQVk9DQo9OHU1 VA0KLS0tLS1FTkQgUEdQIFNJR05BVFVSRS0tLS0tDQo= From owner-svn-src-all@freebsd.org Tue Oct 15 16:16:38 2019 Return-Path: Delivered-To: svn-src-all@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 690C814CAFC; Tue, 15 Oct 2019 16:16:38 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (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 46t0tF4jn8z4S3X; Tue, 15 Oct 2019 16:16:37 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lj1-f176.google.com with SMTP id a22so20906000ljd.0; Tue, 15 Oct 2019 09:16:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=HZP2R0IiM923YfoFtej6qERQmt0lo8EFzg5ON1hKD6Q=; b=oIOu4r9vzH22VdHUec74Y4didv2Az5HYNjyQQF+AK4ng/dgPZaas6BsdmBZaAI4vem ey1916DdgqJIK0d7xHgqQjUGppffhkAiQ0xrZDvw6NQ4kfJ00Q1bnjjM12Suyr1dW/Nx XohrCcFvKOVWltrmbwEikhX+RMQDFgQv4BWSJvn9UvtuWj5L+QIiWuoYGEj8oSBhQp96 304IZC5J1t9VUyePAze+0Edp5hlNgp6XYRPcFs0LEeEp1lEtiLavtr+/f83Icp4bI1IF 6UB0PZGSI+DKTmm3x6ESZ+IvLthCEIIHRlXC2qEdXtLncWK7juaAnRmBrrvtuMnzjw8O aRFA== X-Gm-Message-State: APjAAAUbV+uzmiwip3r4KSL3igfGdD1lwTRmaqnvPP+3Mi+BKWvxcWRW wtGKWNRPrixrQ3XfZpmSsQrjRNftvtk= X-Google-Smtp-Source: APXvYqxi21rRk9EjsLKeHsP+4p8SN5KzlM2sef8svl807jY14aXFcuY7V4CU3s3FbXjVnVlD35A56w== X-Received: by 2002:a2e:81da:: with SMTP id s26mr22210586ljg.192.1571156195561; Tue, 15 Oct 2019 09:16:35 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id z72sm5597247ljb.98.2019.10.15.09.16.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Oct 2019 09:16:34 -0700 (PDT) Subject: Re: svn commit: r353565 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys To: "O. Hartmann" Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org References: <201910151509.x9FF9a2B031347@repo.freebsd.org> <20191015175357.3ee91a1c@thor.intern.walstatt.dynvpn.de> <00eaaf1a-392c-29e1-a035-e72c61423fb3@FreeBSD.org> <20191015180837.2b66b861@thor.intern.walstatt.dynvpn.de> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: Date: Tue, 15 Oct 2019 19:16:33 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191015180837.2b66b861@thor.intern.walstatt.dynvpn.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46t0tF4jn8z4S3X X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.208.176 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-3.15 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[FreeBSD.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[176.208.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; IP_SCORE(-1.15)[ip: (-0.37), ipnet: 209.85.128.0/17(-3.24), asn: 15169(-2.10), country: US(-0.05)]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[176.208.85.209.rep.mailspike.net : 127.0.0.17]; 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)[avg@FreeBSD.org,agapon@gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[96.151.72.93.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 16:16:38 -0000 > Am Tue, 15 Oct 2019 18:56:25 +0300 > Andriy Gapon schrieb: > >> On 15/10/2019 18:53, O. Hartmann wrote: >>> -----BEGIN PGP SIGNED MESSAGE----- >>> Hash: SHA256 >>> >>> Am Tue, 15 Oct 2019 15:09:36 +0000 (UTC) >>> Andriy Gapon schrieb: > >> Sorry, I got tired before I could scroll to your reply. > > > happens somtimes when I'm tired ... > Didn't realize the length of the post. No problem. And I already had a very good guess about what I could find in your email :) -- Andriy Gapon From owner-svn-src-all@freebsd.org Tue Oct 15 16:27:04 2019 Return-Path: Delivered-To: svn-src-all@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 D5E0414D231; Tue, 15 Oct 2019 16:27:04 +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 46t16J5DdPz4TN0; Tue, 15 Oct 2019 16:27:04 +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 96D1F2148B; Tue, 15 Oct 2019 16:27:04 +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 x9FGR4Q4079425; Tue, 15 Oct 2019 16:27:04 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FGR4Fm079424; Tue, 15 Oct 2019 16:27:04 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910151627.x9FGR4Fm079424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 15 Oct 2019 16:27:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r353571 - releng/12.1/sys/riscv/riscv X-SVN-Group: releng X-SVN-Commit-Author: markj X-SVN-Commit-Paths: releng/12.1/sys/riscv/riscv X-SVN-Commit-Revision: 353571 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 16:27:04 -0000 Author: markj Date: Tue Oct 15 16:27:04 2019 New Revision: 353571 URL: https://svnweb.freebsd.org/changeset/base/353571 Log: MFS r353475, r353553: Fix a couple of bugs around handling of PGA_WRITEABLE. Approved by: re (kib) Modified: releng/12.1/sys/riscv/riscv/pmap.c Directory Properties: releng/12.1/ (props changed) Modified: releng/12.1/sys/riscv/riscv/pmap.c ============================================================================== --- releng/12.1/sys/riscv/riscv/pmap.c Tue Oct 15 16:05:55 2019 (r353570) +++ releng/12.1/sys/riscv/riscv/pmap.c Tue Oct 15 16:27:04 2019 (r353571) @@ -2090,6 +2090,7 @@ static int pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_t va, pd_entry_t l2e, struct spglist *free, struct rwlock **lockp) { + struct md_page *pvh; pt_entry_t old_l3; vm_paddr_t phys; vm_page_t m; @@ -2109,6 +2110,12 @@ pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_ vm_page_aflag_set(m, PGA_REFERENCED); CHANGE_PV_LIST_LOCK_TO_VM_PAGE(lockp, m); pmap_pvh_free(&m->md, pmap, va); + if (TAILQ_EMPTY(&m->md.pv_list) && + (m->flags & PG_FICTITIOUS) == 0) { + pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); + if (TAILQ_EMPTY(&pvh->pv_list)) + vm_page_aflag_clear(m, PGA_WRITEABLE); + } } return (pmap_unuse_pt(pmap, va, l2e, free)); @@ -2830,7 +2837,9 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v if ((new_l3 & PTE_SW_MANAGED) == 0) free_pv_entry(pmap, pv); if ((om->aflags & PGA_WRITEABLE) != 0 && - TAILQ_EMPTY(&om->md.pv_list)) + TAILQ_EMPTY(&om->md.pv_list) && + ((om->flags & PG_FICTITIOUS) != 0 || + TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) vm_page_aflag_clear(om, PGA_WRITEABLE); } pmap_invalidate_page(pmap, va); From owner-svn-src-all@freebsd.org Tue Oct 15 17:11:45 2019 Return-Path: Delivered-To: svn-src-all@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 36AE414E8EB; Tue, 15 Oct 2019 17:11:45 +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 46t25s0jBhz4XQ8; Tue, 15 Oct 2019 17:11:45 +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 F0AF721C65; Tue, 15 Oct 2019 17:11:44 +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 x9FHBiA0005616; Tue, 15 Oct 2019 17:11:44 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FHBgGB005607; Tue, 15 Oct 2019 17:11:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910151711.x9FHBgGB005607@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 15 Oct 2019 17:11:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353572 - in head/sys: conf mips/conf X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: conf mips/conf X-SVN-Commit-Revision: 353572 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 17:11:45 -0000 Author: jhb Date: Tue Oct 15 17:11:42 2019 New Revision: 353572 URL: https://svnweb.freebsd.org/changeset/base/353572 Log: Update MIPS kernel builds to work with mips-gcc. - Use a default -march of mips64 on N64 and N32 kernels. - Set the endianness (via MIPS_ENDIAN) and ABI (via MIPS_ABI) in CFLAGS from MACHINE_ARCH. ARCH_FLAGS now only sets a different -march value if needed. - TRAMP_ARCH_FLAGS inherits MIPS_ENDIAN from MACHINE_ARCH but does not set the ABI since XLPN32 needs an N64 ABI for the trampoline loader. When TRAMP_ARCH_FLAGS is used it must set both -march and -mabi. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D22030 Modified: head/sys/conf/Makefile.mips head/sys/mips/conf/ERL head/sys/mips/conf/JZ4780 head/sys/mips/conf/MALTA64 head/sys/mips/conf/MALTA64EL head/sys/mips/conf/OCTEON1 head/sys/mips/conf/X1000 head/sys/mips/conf/XLP64 head/sys/mips/conf/XLPN32 head/sys/mips/conf/std.BERI Modified: head/sys/conf/Makefile.mips ============================================================================== --- head/sys/conf/Makefile.mips Tue Oct 15 16:27:04 2019 (r353571) +++ head/sys/conf/Makefile.mips Tue Oct 15 17:11:42 2019 (r353572) @@ -39,10 +39,16 @@ KERNLOADADDR?=0x80001000 # To be changed later TRAMPLOADADDR?=0x807963c0 -# We default to the MIPS32 ISA, if none specified in the -# kernel configuration file. +# We default to the MIPS32 ISA for O32 and MIPS64 ISA for N64 and N32 +# if none is specified in the kernel configuration file. +.if ${MACHINE_ARCH:Mmips64*} != "" || ${MACHINE_ARCH:Mmipsn32*} != "" +ARCH_FLAGS?=-march=mips64 +.else ARCH_FLAGS?=-march=mips32 +.endif +ARCH_FLAGS+=-mabi=${MIPS_ABI} EXTRA_FLAGS=-fno-pic -mno-abicalls -G0 -DKERNLOADADDR=${KERNLOADADDR} +EXTRA_FLAGS+=-${MIPS_ENDIAN} HACK_EXTRA_FLAGS=-shared Modified: head/sys/mips/conf/ERL ============================================================================== --- head/sys/mips/conf/ERL Tue Oct 15 16:27:04 2019 (r353571) +++ head/sys/mips/conf/ERL Tue Oct 15 17:11:42 2019 (r353572) @@ -21,7 +21,7 @@ ident ERL -makeoptions ARCH_FLAGS="-march=octeon+ -mabi=64" +makeoptions ARCH_FLAGS="-march=octeon+" makeoptions LDSCRIPT_NAME=ldscript.mips.octeon1 makeoptions KERNLOADADDR=0xffffffff80100000 Modified: head/sys/mips/conf/JZ4780 ============================================================================== --- head/sys/mips/conf/JZ4780 Tue Oct 15 16:27:04 2019 (r353571) +++ head/sys/mips/conf/JZ4780 Tue Oct 15 17:11:42 2019 (r353572) @@ -12,7 +12,7 @@ cpu CPU_XBURST cpu CPU_MIPS4KC makeoptions KERNLOADADDR=0x80020000 -makeoptions ARCH_FLAGS="-EL -march=mips32r2" +makeoptions ARCH_FLAGS="-march=mips32r2" # Don't build any modules yet. makeoptions MODULES_OVERRIDE="" Modified: head/sys/mips/conf/MALTA64 ============================================================================== --- head/sys/mips/conf/MALTA64 Tue Oct 15 16:27:04 2019 (r353571) +++ head/sys/mips/conf/MALTA64 Tue Oct 15 17:11:42 2019 (r353572) @@ -8,8 +8,6 @@ include "std.MALTA" machine mips mips64 -makeoptions ARCH_FLAGS="-march=mips64 -mabi=64" - makeoptions KERNLOADADDR=0xffffffff80100000 options COMPAT_FREEBSD32 # Compatible with o32 binaries Modified: head/sys/mips/conf/MALTA64EL ============================================================================== --- head/sys/mips/conf/MALTA64EL Tue Oct 15 16:27:04 2019 (r353571) +++ head/sys/mips/conf/MALTA64EL Tue Oct 15 17:11:42 2019 (r353572) @@ -8,5 +8,4 @@ include "std.MALTA" machine mips mips64el -makeoptions ARCH_FLAGS="-march=mips64 -mabi=64" makeoptions KERNLOADADDR=0xffffffff80100000 Modified: head/sys/mips/conf/OCTEON1 ============================================================================== --- head/sys/mips/conf/OCTEON1 Tue Oct 15 16:27:04 2019 (r353571) +++ head/sys/mips/conf/OCTEON1 Tue Oct 15 17:11:42 2019 (r353572) @@ -20,7 +20,7 @@ ident OCTEON1 -makeoptions ARCH_FLAGS="-march=octeon -mabi=64" +makeoptions ARCH_FLAGS="-march=octeon" makeoptions LDSCRIPT_NAME=ldscript.mips.octeon1 # Don't build any modules yet. Modified: head/sys/mips/conf/X1000 ============================================================================== --- head/sys/mips/conf/X1000 Tue Oct 15 16:27:04 2019 (r353571) +++ head/sys/mips/conf/X1000 Tue Oct 15 17:11:42 2019 (r353572) @@ -10,7 +10,7 @@ cpu CPU_XBURST cpu CPU_MIPS4KC makeoptions KERNLOADADDR=0x80020000 -makeoptions ARCH_FLAGS="-EL -march=mips32r2" +makeoptions ARCH_FLAGS="-march=mips32r2" # Don't build any modules yet. makeoptions MODULES_OVERRIDE="" Modified: head/sys/mips/conf/XLP64 ============================================================================== --- head/sys/mips/conf/XLP64 Tue Oct 15 16:27:04 2019 (r353571) +++ head/sys/mips/conf/XLP64 Tue Oct 15 17:11:42 2019 (r353572) @@ -20,7 +20,7 @@ machine mips mips64 ident XLP64 -makeoptions ARCH_FLAGS="-march=mips64r2 -mabi=64" +makeoptions ARCH_FLAGS="-march=mips64r2" makeoptions KERNLOADADDR=0xffffffff80100000 include "std.XLP" Modified: head/sys/mips/conf/XLPN32 ============================================================================== --- head/sys/mips/conf/XLPN32 Tue Oct 15 16:27:04 2019 (r353571) +++ head/sys/mips/conf/XLPN32 Tue Oct 15 17:11:42 2019 (r353572) @@ -20,7 +20,6 @@ machine mips mipsn32 ident XLPN32 -makeoptions ARCH_FLAGS="-march=mips64 -mabi=n32" makeoptions KERNLOADADDR=0x80100000 include "std.XLP" Modified: head/sys/mips/conf/std.BERI ============================================================================== --- head/sys/mips/conf/std.BERI Tue Oct 15 16:27:04 2019 (r353571) +++ head/sys/mips/conf/std.BERI Tue Oct 15 17:11:42 2019 (r353572) @@ -13,8 +13,6 @@ cpu CPU_BERI options HZ=200 -makeoptions ARCH_FLAGS="-march=mips64 -mabi=64" - makeoptions KERNLOADADDR=0xffffffff80100000 include "../beri/std.beri" From owner-svn-src-all@freebsd.org Tue Oct 15 17:14:30 2019 Return-Path: Delivered-To: svn-src-all@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 F33CE14E9DE; Tue, 15 Oct 2019 17:14:30 +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 46t2926DWcz4Xml; Tue, 15 Oct 2019 17:14:30 +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 BAB7221DC3; Tue, 15 Oct 2019 17:14:30 +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 x9FHEUFH009509; Tue, 15 Oct 2019 17:14:30 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FHEUwj009508; Tue, 15 Oct 2019 17:14:30 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910151714.x9FHEUwj009508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 15 Oct 2019 17:14:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353573 - head/sys/mips/nlm/dev/net/ucore X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/mips/nlm/dev/net/ucore X-SVN-Commit-Revision: 353573 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 17:14:31 -0000 Author: jhb Date: Tue Oct 15 17:14:30 2019 New Revision: 353573 URL: https://svnweb.freebsd.org/changeset/base/353573 Log: Don't set the OUTPUT_FORMAT explicitly but let ld derive it. This fixes an error with modern ld.bfd and is inline with the changes in r215251 and r217612. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D22031 Modified: head/sys/mips/nlm/dev/net/ucore/ld.ucore.S Modified: head/sys/mips/nlm/dev/net/ucore/ld.ucore.S ============================================================================== --- head/sys/mips/nlm/dev/net/ucore/ld.ucore.S Tue Oct 15 17:11:42 2019 (r353572) +++ head/sys/mips/nlm/dev/net/ucore/ld.ucore.S Tue Oct 15 17:14:30 2019 (r353573) @@ -28,8 +28,8 @@ * $FreeBSD$ */ +OUTPUT_ARCH(mips) ENTRY(_start) -OUTPUT_FORMAT(elf32-tradbigmips) __DYNAMIC = 0; SECTIONS From owner-svn-src-all@freebsd.org Tue Oct 15 17:17:17 2019 Return-Path: Delivered-To: svn-src-all@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 3DCF314ECD7; Tue, 15 Oct 2019 17:17:17 +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 46t2DF0yBTz4YDH; Tue, 15 Oct 2019 17:17:17 +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 054E921DD5; Tue, 15 Oct 2019 17:17:17 +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 x9FHHGH3009831; Tue, 15 Oct 2019 17:17:16 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FHHG1N009830; Tue, 15 Oct 2019 17:17:16 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910151717.x9FHHG1N009830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 15 Oct 2019 17:17:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353574 - head/sys/mips/nlm/dev/net/ucore X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/mips/nlm/dev/net/ucore X-SVN-Commit-Revision: 353574 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 17:17:17 -0000 Author: jhb Date: Tue Oct 15 17:17:16 2019 New Revision: 353574 URL: https://svnweb.freebsd.org/changeset/base/353574 Log: Fix a write-only variable warning from external GCC. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D22032 Modified: head/sys/mips/nlm/dev/net/ucore/ucore_app.c Modified: head/sys/mips/nlm/dev/net/ucore/ucore_app.c ============================================================================== --- head/sys/mips/nlm/dev/net/ucore/ucore_app.c Tue Oct 15 17:14:30 2019 (r353573) +++ head/sys/mips/nlm/dev/net/ucore/ucore_app.c Tue Oct 15 17:17:16 2019 (r353574) @@ -34,13 +34,12 @@ int main(void) { - unsigned int pktrdy; int num_cachelines = 1518 / 64 ; /* pktsize / L3 cacheline size */ /* Spray packets to using distribution vector */ while (1) { - pktrdy = nlm_read_ucore_rxpktrdy(); + (void)nlm_read_ucore_rxpktrdy(); nlm_ucore_setup_poepktdistr(FWD_DIST_VEC, 0, 0, 0, 0); nlm_ucore_pkt_done(num_cachelines, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); From owner-svn-src-all@freebsd.org Tue Oct 15 17:24:22 2019 Return-Path: Delivered-To: svn-src-all@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 8400414EFA9; Tue, 15 Oct 2019 17:24:22 +0000 (UTC) (envelope-from br@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 46t2NQ2l5sz4YgH; Tue, 15 Oct 2019 17:24:22 +0000 (UTC) (envelope-from br@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 4163621FA2; Tue, 15 Oct 2019 17:24:22 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9FHOMAM015500; Tue, 15 Oct 2019 17:24:22 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FHOM55015499; Tue, 15 Oct 2019 17:24:22 GMT (envelope-from br@FreeBSD.org) Message-Id: <201910151724.x9FHOM55015499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 15 Oct 2019 17:24:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353575 - head/sys/dev/mmc/host X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/dev/mmc/host X-SVN-Commit-Revision: 353575 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 17:24:22 -0000 Author: br Date: Tue Oct 15 17:24:21 2019 New Revision: 353575 URL: https://svnweb.freebsd.org/changeset/base/353575 Log: Fix dwmmc(4) driver attachment when ext_resources are not present. Ignore only ENOENT (no DTS properties found) and ENODEV (driver not present) non-zero return values from ext_resources. Reviewed by: manu Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22043 Modified: head/sys/dev/mmc/host/dwmmc.c Modified: head/sys/dev/mmc/host/dwmmc.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc.c Tue Oct 15 17:17:16 2019 (r353574) +++ head/sys/dev/mmc/host/dwmmc.c Tue Oct 15 17:24:21 2019 (r353575) @@ -457,20 +457,32 @@ parse_fdt(struct dwmmc_softc *sc) /* IP block reset is optional */ error = hwreset_get_by_ofw_name(sc->dev, 0, "reset", &sc->hwreset); - if (error != 0 && error != ENOENT) + if (error != 0 && + error != ENOENT && + error != ENODEV) { device_printf(sc->dev, "Cannot get reset\n"); + goto fail; + } /* vmmc regulator is optional */ error = regulator_get_by_ofw_property(sc->dev, 0, "vmmc-supply", &sc->vmmc); - if (error != 0 && error != ENOENT) + if (error != 0 && + error != ENOENT && + error != ENODEV) { device_printf(sc->dev, "Cannot get regulator 'vmmc-supply'\n"); + goto fail; + } /* vqmmc regulator is optional */ error = regulator_get_by_ofw_property(sc->dev, 0, "vqmmc-supply", &sc->vqmmc); - if (error != 0 && error != ENOENT) + if (error != 0 && + error != ENOENT && + error != ENODEV) { device_printf(sc->dev, "Cannot get regulator 'vqmmc-supply'\n"); + goto fail; + } /* Assert reset first */ if (sc->hwreset != NULL) { @@ -483,8 +495,12 @@ parse_fdt(struct dwmmc_softc *sc) /* BIU (Bus Interface Unit clock) is optional */ error = clk_get_by_ofw_name(sc->dev, 0, "biu", &sc->biu); - if (error != 0 && error != ENOENT) + if (error != 0 && + error != ENOENT && + error != ENODEV) { device_printf(sc->dev, "Cannot get 'biu' clock\n"); + goto fail; + } if (sc->biu) { error = clk_enable(sc->biu); @@ -499,8 +515,12 @@ parse_fdt(struct dwmmc_softc *sc) * if no clock-frequency property is given */ error = clk_get_by_ofw_name(sc->dev, 0, "ciu", &sc->ciu); - if (error != 0 && error != ENOENT) + if (error != 0 && + error != ENOENT && + error != ENODEV) { device_printf(sc->dev, "Cannot get 'ciu' clock\n"); + goto fail; + } if (sc->ciu) { if (bus_hz != 0) { From owner-svn-src-all@freebsd.org Tue Oct 15 17:28:26 2019 Return-Path: Delivered-To: svn-src-all@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 C713214F067; Tue, 15 Oct 2019 17:28:26 +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 46t2T64sdXz4YrJ; Tue, 15 Oct 2019 17:28:26 +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 8A62D21FAE; Tue, 15 Oct 2019 17:28:26 +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 x9FHSQ0r015712; Tue, 15 Oct 2019 17:28:26 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FHSQam015711; Tue, 15 Oct 2019 17:28:26 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910151728.x9FHSQam015711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 15 Oct 2019 17:28:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353576 - head/sys/mips/conf X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/mips/conf X-SVN-Commit-Revision: 353576 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 17:28:26 -0000 Author: jhb Date: Tue Oct 15 17:28:26 2019 New Revision: 353576 URL: https://svnweb.freebsd.org/changeset/base/353576 Log: Use -march=octeon+ for OCTEON1. External binutils requires octeon+ for saa. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D22033 Modified: head/sys/mips/conf/OCTEON1 Modified: head/sys/mips/conf/OCTEON1 ============================================================================== --- head/sys/mips/conf/OCTEON1 Tue Oct 15 17:24:21 2019 (r353575) +++ head/sys/mips/conf/OCTEON1 Tue Oct 15 17:28:26 2019 (r353576) @@ -20,7 +20,7 @@ ident OCTEON1 -makeoptions ARCH_FLAGS="-march=octeon" +makeoptions ARCH_FLAGS="-march=octeon+" makeoptions LDSCRIPT_NAME=ldscript.mips.octeon1 # Don't build any modules yet. From owner-svn-src-all@freebsd.org Tue Oct 15 17:30:14 2019 Return-Path: Delivered-To: svn-src-all@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 6012014F12D; Tue, 15 Oct 2019 17:30:14 +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 46t2WB1rv4z4Z1Z; Tue, 15 Oct 2019 17:30:14 +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 22F0421FBC; Tue, 15 Oct 2019 17:30:14 +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 x9FHUEq4015875; Tue, 15 Oct 2019 17:30:14 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FHUCmd015868; Tue, 15 Oct 2019 17:30:12 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910151730.x9FHUCmd015868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 15 Oct 2019 17:30:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353577 - in stable/12: contrib/sendmail/mail.local lib/libc/tests/nss usr.bin/tip/tip usr.sbin/fwcontrol X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/12: contrib/sendmail/mail.local lib/libc/tests/nss usr.bin/tip/tip usr.sbin/fwcontrol X-SVN-Commit-Revision: 353577 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 17:30:14 -0000 Author: brooks Date: Tue Oct 15 17:30:12 2019 New Revision: 353577 URL: https://svnweb.freebsd.org/changeset/base/353577 Log: MFC r353326: Fix various -Wpointer-compare warnings This warning (comparing a pointer against a zero character literal rather than NULL) has existed since GCC 7.1.0, and was recently added to Clang trunk. Almost all of these are harmless, except for fwcontrol's str2node, which needs to both guard against dereferencing a NULL pointer (though in practice it appears none of the callers will ever pass one in), as well as ensure it doesn't parse the empty string as node 0 due to strtol's awkward interface. Submitted by: James Clarke Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21914 Modified: stable/12/contrib/sendmail/mail.local/mail.local.c stable/12/lib/libc/tests/nss/getgr_test.c stable/12/lib/libc/tests/nss/getproto_test.c stable/12/lib/libc/tests/nss/getrpc_test.c stable/12/lib/libc/tests/nss/getserv_test.c stable/12/usr.bin/tip/tip/acu.c stable/12/usr.sbin/fwcontrol/fwcontrol.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/sendmail/mail.local/mail.local.c ============================================================================== --- stable/12/contrib/sendmail/mail.local/mail.local.c Tue Oct 15 17:28:26 2019 (r353576) +++ stable/12/contrib/sendmail/mail.local/mail.local.c Tue Oct 15 17:30:12 2019 (r353577) @@ -393,7 +393,7 @@ main(argc, argv) } /* Non-LMTP from here on out */ - if (*argv == '\0') + if (*argv == NULL) usage(); /* Modified: stable/12/lib/libc/tests/nss/getgr_test.c ============================================================================== --- stable/12/lib/libc/tests/nss/getgr_test.c Tue Oct 15 17:28:26 2019 (r353576) +++ stable/12/lib/libc/tests/nss/getgr_test.c Tue Oct 15 17:30:12 2019 (r353577) @@ -153,7 +153,7 @@ compare_group(struct group *grp1, struct group *grp2, if (strcmp(*c1, *c2) != 0) goto errfin; - if (*c1 != '\0' || *c2 != '\0') + if (*c1 != NULL || *c2 != NULL) goto errfin; return 0; @@ -182,7 +182,7 @@ sdump_group(struct group *grp, char *buffer, size_t bu buflen -= written; if (grp->gr_mem != NULL) { - if (*(grp->gr_mem) != '\0') { + if (*(grp->gr_mem) != NULL) { for (cp = grp->gr_mem; *cp; ++cp) { written = snprintf(buffer, buflen, "%s%s", cp == grp->gr_mem ? "" : ",", *cp); Modified: stable/12/lib/libc/tests/nss/getproto_test.c ============================================================================== --- stable/12/lib/libc/tests/nss/getproto_test.c Tue Oct 15 17:28:26 2019 (r353576) +++ stable/12/lib/libc/tests/nss/getproto_test.c Tue Oct 15 17:30:12 2019 (r353577) @@ -148,7 +148,7 @@ compare_protoent(struct protoent *pe1, struct protoent if (strcmp(*c1, *c2) != 0) goto errfin; - if ((*c1 != '\0') || (*c2 != '\0')) + if ((*c1 != NULL) || (*c2 != NULL)) goto errfin; return 0; @@ -177,7 +177,7 @@ sdump_protoent(struct protoent *pe, char *buffer, size buflen -= written; if (pe->p_aliases != NULL) { - if (*(pe->p_aliases) != '\0') { + if (*(pe->p_aliases) != NULL) { for (cp = pe->p_aliases; *cp; ++cp) { written = snprintf(buffer, buflen, " %s", *cp); buffer += written; Modified: stable/12/lib/libc/tests/nss/getrpc_test.c ============================================================================== --- stable/12/lib/libc/tests/nss/getrpc_test.c Tue Oct 15 17:28:26 2019 (r353576) +++ stable/12/lib/libc/tests/nss/getrpc_test.c Tue Oct 15 17:30:12 2019 (r353577) @@ -147,7 +147,7 @@ compare_rpcent(struct rpcent *rpc1, struct rpcent *rpc if (strcmp(*c1, *c2) != 0) goto errfin; - if ((*c1 != '\0') || (*c2 != '\0')) + if ((*c1 != NULL) || (*c2 != NULL)) goto errfin; return 0; @@ -176,7 +176,7 @@ sdump_rpcent(struct rpcent *rpc, char *buffer, size_t buflen -= written; if (rpc->r_aliases != NULL) { - if (*(rpc->r_aliases) != '\0') { + if (*(rpc->r_aliases) != NULL) { for (cp = rpc->r_aliases; *cp; ++cp) { written = snprintf(buffer, buflen, " %s", *cp); buffer += written; Modified: stable/12/lib/libc/tests/nss/getserv_test.c ============================================================================== --- stable/12/lib/libc/tests/nss/getserv_test.c Tue Oct 15 17:28:26 2019 (r353576) +++ stable/12/lib/libc/tests/nss/getserv_test.c Tue Oct 15 17:30:12 2019 (r353577) @@ -153,7 +153,7 @@ compare_servent(struct servent *serv1, struct servent if (strcmp(*c1, *c2) != 0) goto errfin; - if ((*c1 != '\0') || (*c2 != '\0')) + if ((*c1 != NULL) || (*c2 != NULL)) goto errfin; return 0; @@ -182,7 +182,7 @@ sdump_servent(struct servent *serv, char *buffer, size buflen -= written; if (serv->s_aliases != NULL) { - if (*(serv->s_aliases) != '\0') { + if (*(serv->s_aliases) != NULL) { for (cp = serv->s_aliases; *cp; ++cp) { written = snprintf(buffer, buflen, " %s", *cp); buffer += written; Modified: stable/12/usr.bin/tip/tip/acu.c ============================================================================== --- stable/12/usr.bin/tip/tip/acu.c Tue Oct 15 17:28:26 2019 (r353576) +++ stable/12/usr.bin/tip/tip/acu.c Tue Oct 15 17:30:12 2019 (r353577) @@ -190,7 +190,7 @@ acutype(char *s) acu_t *p; extern acu_t acutable[]; - for (p = acutable; p->acu_name != '\0'; p++) + for (p = acutable; p->acu_name != NULL; p++) if (!strcmp(s, p->acu_name)) return (p); return (NOACU); Modified: stable/12/usr.sbin/fwcontrol/fwcontrol.c ============================================================================== --- stable/12/usr.sbin/fwcontrol/fwcontrol.c Tue Oct 15 17:28:26 2019 (r353576) +++ stable/12/usr.sbin/fwcontrol/fwcontrol.c Tue Oct 15 17:30:12 2019 (r353577) @@ -129,7 +129,7 @@ str2node(int fd, const char *nodestr) char *endptr; int i, node; - if (nodestr == '\0') + if (nodestr == NULL || *nodestr == '\0') return (-1); /* From owner-svn-src-all@freebsd.org Tue Oct 15 17:35:00 2019 Return-Path: Delivered-To: svn-src-all@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 2A6DD14F45B; Tue, 15 Oct 2019 17:35:00 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46t2cf4wPpz4ZTG; Tue, 15 Oct 2019 17:34:58 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 9c06c68a; Tue, 15 Oct 2019 19:34:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=TaaBAv9m826az+Oad0zC+Z0kWV4=; b=Lnd5+co4j4n1KFYs+F6KyTwVSc+P L3sW4Wlp66Tj4pQC6XbhUceR9CEQI7GEeVNOeSgFGnT0XxDmXrHmIIc9v0mqGFaj cMZjqLqXe1JK2HS87OuF+/NmO9D0B7SqA/V3aULuvrplFvS060+tS1UdGTao3Cl5 KEB/0Z5MMeVPblI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=rX4Pp37uphxABRlqg6eg1r2KGX2natbV9ljwPOr/vYuPhY8/dwYSqQR/ mYw9ubEzVMZaRl9fS8Xtg6ybWq6xKhhWmLl2F16Ng9XB9dGU9BlP8fWKkPBWTKqP 5Axd0uIGpy+iJlZ3ltbWzi5FNpl6CDT9YzfHKGxvgX0OqZZvD4k= Received: from sonic.home.blih.net (ip-9.net-89-3-105.rev.numericable.fr [89.3.105.9]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 96216a0c TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Tue, 15 Oct 2019 19:34:51 +0200 (CEST) Date: Tue, 15 Oct 2019 19:34:51 +0200 From: Emmanuel Vadot To: Ruslan Bukin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353575 - head/sys/dev/mmc/host Message-Id: <20191015193451.f7c9388f971432e6d1be369b@bidouilliste.com> In-Reply-To: <201910151724.x9FHOM55015499@repo.freebsd.org> References: <201910151724.x9FHOM55015499@repo.freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46t2cf4wPpz4ZTG X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bidouilliste.com header.s=mail header.b=Lnd5+co4; dmarc=none; spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates 212.83.177.182 as permitted sender) smtp.mailfrom=manu@bidouilliste.com X-Spamd-Result: default: False [-1.18 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mail]; NEURAL_HAM_MEDIUM(-0.69)[-0.687,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:212.83.177.182/32]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MV_CASE(0.50)[]; DMARC_NA(0.00)[bidouilliste.com]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-0.97)[-0.972,0]; DKIM_TRACE(0.00)[bidouilliste.com:+]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; IP_SCORE(0.38)[ip: (-0.67), ipnet: 212.83.160.0/19(2.45), asn: 12876(0.11), country: FR(-0.00)]; ASN(0.00)[asn:12876, ipnet:212.83.160.0/19, country:FR]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 17:35:00 -0000 On Tue, 15 Oct 2019 17:24:22 +0000 (UTC) Ruslan Bukin wrote: > Author: br > Date: Tue Oct 15 17:24:21 2019 > New Revision: 353575 > URL: https://svnweb.freebsd.org/changeset/base/353575 > > Log: > Fix dwmmc(4) driver attachment when ext_resources are not present. > > Ignore only ENOENT (no DTS properties found) and ENODEV (driver not > present) non-zero return values from ext_resources. > > Reviewed by: manu > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D22043 > > Modified: > head/sys/dev/mmc/host/dwmmc.c I've just realized that you are probably using the SOCFPGA kernel configuration and it doesn't have option EXT_RESOURCES so how did you got those errors ? > Modified: head/sys/dev/mmc/host/dwmmc.c > ============================================================================== > --- head/sys/dev/mmc/host/dwmmc.c Tue Oct 15 17:17:16 2019 (r353574) > +++ head/sys/dev/mmc/host/dwmmc.c Tue Oct 15 17:24:21 2019 (r353575) > @@ -457,20 +457,32 @@ parse_fdt(struct dwmmc_softc *sc) > > /* IP block reset is optional */ > error = hwreset_get_by_ofw_name(sc->dev, 0, "reset", &sc->hwreset); > - if (error != 0 && error != ENOENT) > + if (error != 0 && > + error != ENOENT && > + error != ENODEV) { > device_printf(sc->dev, "Cannot get reset\n"); > + goto fail; > + } > > /* vmmc regulator is optional */ > error = regulator_get_by_ofw_property(sc->dev, 0, "vmmc-supply", > &sc->vmmc); > - if (error != 0 && error != ENOENT) > + if (error != 0 && > + error != ENOENT && > + error != ENODEV) { > device_printf(sc->dev, "Cannot get regulator 'vmmc-supply'\n"); > + goto fail; > + } > > /* vqmmc regulator is optional */ > error = regulator_get_by_ofw_property(sc->dev, 0, "vqmmc-supply", > &sc->vqmmc); > - if (error != 0 && error != ENOENT) > + if (error != 0 && > + error != ENOENT && > + error != ENODEV) { > device_printf(sc->dev, "Cannot get regulator 'vqmmc-supply'\n"); > + goto fail; > + } > > /* Assert reset first */ > if (sc->hwreset != NULL) { > @@ -483,8 +495,12 @@ parse_fdt(struct dwmmc_softc *sc) > > /* BIU (Bus Interface Unit clock) is optional */ > error = clk_get_by_ofw_name(sc->dev, 0, "biu", &sc->biu); > - if (error != 0 && error != ENOENT) > + if (error != 0 && > + error != ENOENT && > + error != ENODEV) { > device_printf(sc->dev, "Cannot get 'biu' clock\n"); > + goto fail; > + } > > if (sc->biu) { > error = clk_enable(sc->biu); > @@ -499,8 +515,12 @@ parse_fdt(struct dwmmc_softc *sc) > * if no clock-frequency property is given > */ > error = clk_get_by_ofw_name(sc->dev, 0, "ciu", &sc->ciu); > - if (error != 0 && error != ENOENT) > + if (error != 0 && > + error != ENOENT && > + error != ENODEV) { > device_printf(sc->dev, "Cannot get 'ciu' clock\n"); > + goto fail; > + } > > if (sc->ciu) { > if (bus_hz != 0) { -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Tue Oct 15 17:35:40 2019 Return-Path: Delivered-To: svn-src-all@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 52DB014F4FA; Tue, 15 Oct 2019 17:35:40 +0000 (UTC) (envelope-from np@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 46t2dS1YMrz4ZcQ; Tue, 15 Oct 2019 17:35:40 +0000 (UTC) (envelope-from np@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 18BD02217A; Tue, 15 Oct 2019 17:35:40 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9FHZd3T021438; Tue, 15 Oct 2019 17:35:39 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FHZdfn021437; Tue, 15 Oct 2019 17:35:39 GMT (envelope-from np@FreeBSD.org) Message-Id: <201910151735.x9FHZdfn021437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 15 Oct 2019 17:35:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353578 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 353578 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 17:35:40 -0000 Author: np Date: Tue Oct 15 17:35:39 2019 New Revision: 353578 URL: https://svnweb.freebsd.org/changeset/base/353578 Log: cxgbe(4): An EQ update can be requested in a TX_PKTS2 work request. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Tue Oct 15 17:30:12 2019 (r353577) +++ head/sys/dev/cxgbe/t4_sge.c Tue Oct 15 17:35:39 2019 (r353578) @@ -2849,6 +2849,7 @@ wr_can_update_eq(struct fw_eth_tx_pkts_wr *wr) case FW_ULPTX_WR: case FW_ETH_TX_PKT_WR: case FW_ETH_TX_PKTS_WR: + case FW_ETH_TX_PKTS2_WR: case FW_ETH_TX_PKT_VM_WR: return (1); default: From owner-svn-src-all@freebsd.org Tue Oct 15 17:41:47 2019 Return-Path: Delivered-To: svn-src-all@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 67CC614F7AA; Tue, 15 Oct 2019 17:41:47 +0000 (UTC) (envelope-from br@bsdpad.com) Received: from sc1.bsdpad.com (sc1.bsdpad.com [163.172.212.18]) (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 46t2mV2zPSz4b47; Tue, 15 Oct 2019 17:41:46 +0000 (UTC) (envelope-from br@bsdpad.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bsdpad.com; s=20190317; h=Subject:To:From; bh=mkOiIa1gdGjMfzob53cBmbkq17Ok2Hz9RSElwLffknU=; b=kcIG1/z7g9JyKATshA9CUF4qpP 1TlPfkvS26btJ4sLv44RvRbpP+cVzkj2qxDJ7BpWxS4FMtMdW+BMSozvGHz/rHV5TtQsmmGlxhMow viJwyAiBs0TA93F0I8fcLFYsvO+2c03nzs9ebV4YU4wn1lk+Gd7RrGw1wAqGTZ5H4hAN+HfJa0wdi 8hQz/FWWkFfN6EfAaeJVKyftj9pypytKg/+LVikfJJXi6LXZ59CHapvGJSAfMUM1+RLibZlumn55Z uk0QoHZe0DPTi8uljOUTVH6G861pkrvH5JpDTLhgDaEVzA6JxWd4aPnKh9gcSKUmazl6B8LEALHib CAU1fk/A==; Received: from localhost ([127.0.0.1] helo=bsdpad.com) by sc1.bsdpad.com with smtp (Exim 4.91 (FreeBSD)) (envelope-from ) id 1iKQlh-000JKO-6x; Tue, 15 Oct 2019 18:37:57 +0100 Received: by bsdpad.com (nbSMTP-1.00) for uid 1001 br@bsdpad.com; Tue, 15 Oct 2019 18:37:57 +0100 (BST) Date: Tue, 15 Oct 2019 18:37:57 +0100 From: Ruslan Bukin To: Emmanuel Vadot Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353575 - head/sys/dev/mmc/host Message-ID: <20191015173757.GA74227@bsdpad.com> References: <201910151724.x9FHOM55015499@repo.freebsd.org> <20191015193451.f7c9388f971432e6d1be369b@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191015193451.f7c9388f971432e6d1be369b@bidouilliste.com> User-Agent: Mutt/1.11.2 (2019-01-07) X-Rspamd-Queue-Id: 46t2mV2zPSz4b47 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdpad.com header.s=20190317 header.b=kcIG1/z7; dmarc=none; spf=pass (mx1.freebsd.org: domain of br@bsdpad.com designates 163.172.212.18 as permitted sender) smtp.mailfrom=br@bsdpad.com X-Spamd-Result: default: False [-5.01 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdpad.com:s=20190317]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdpad.com:+]; IP_SCORE(-2.81)[ip: (-9.44), ipnet: 163.172.208.0/20(-4.73), asn: 12876(0.11), country: FR(-0.00)]; FORGED_SENDER(0.30)[br@freebsd.org,br@bsdpad.com]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:12876, ipnet:163.172.208.0/20, country:FR]; FROM_NEQ_ENVFROM(0.00)[br@freebsd.org,br@bsdpad.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 17:41:47 -0000 On Tue, Oct 15, 2019 at 07:34:51PM +0200, Emmanuel Vadot wrote: > On Tue, 15 Oct 2019 17:24:22 +0000 (UTC) > Ruslan Bukin wrote: > > > Author: br > > Date: Tue Oct 15 17:24:21 2019 > > New Revision: 353575 > > URL: https://svnweb.freebsd.org/changeset/base/353575 > > > > Log: > > Fix dwmmc(4) driver attachment when ext_resources are not present. > > > > Ignore only ENOENT (no DTS properties found) and ENODEV (driver not > > present) non-zero return values from ext_resources. > > > > Reviewed by: manu > > Sponsored by: DARPA, AFRL > > Differential Revision: https://reviews.freebsd.org/D22043 > > > > Modified: > > head/sys/dev/mmc/host/dwmmc.c > > I've just realized that you are probably using the SOCFPGA kernel > configuration and it doesn't have option EXT_RESOURCES so how did you > got those errors ? No, I'm using arm64 GENERIC kernel since Intel Stratix 10 is arm64/FPGA. Ruslan From owner-svn-src-all@freebsd.org Tue Oct 15 17:51:31 2019 Return-Path: Delivered-To: svn-src-all@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 5B5A614FAF0; Tue, 15 Oct 2019 17:51:31 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46t2zk2QCZz4bh7; Tue, 15 Oct 2019 17:51:29 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 064eede6; Tue, 15 Oct 2019 19:51:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=jiUZS1YE0oRST6RiBYgB0S0xGxQ=; b=msqp3uNdv/dhcrrb2wPumBM+dH6Y SN5USZgPXUR/tBnA0hIpnVLkgHwXEghQVZ6caFw/xoe7l9G7vailIokWWQRA5wNj pHZJIaaxsUKBtsIsmlkja4VS8M27SyzjKniaRIfntpsanmx6ZrYKpiGePJBL8qky 9FZwq4L4U7+pc2g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=ox2LpoaYoci/jawXSwkd1XJPpoGHEo1i/x0QgdlzByWuJTFp95sGGR+p 21JRACjI613p33aagWQCFzIzx7grKdZk1/6VLOAkmNdTgGalwqZD87Tsi6OcFZXH 1hzEQnCCZhzerr3KbUcSeGWB/dCjySRtZRSRtZzo+WlRElBRmYc= Received: from sonic.home.blih.net (ip-9.net-89-3-105.rev.numericable.fr [89.3.105.9]) by mail.blih.net (OpenSMTPD) with ESMTPSA id e2d4bc1a TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Tue, 15 Oct 2019 19:51:28 +0200 (CEST) Date: Tue, 15 Oct 2019 19:51:28 +0200 From: Emmanuel Vadot To: Ruslan Bukin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353575 - head/sys/dev/mmc/host Message-Id: <20191015195128.c3e14be27e027b538665fbef@bidouilliste.com> In-Reply-To: <20191015173757.GA74227@bsdpad.com> References: <201910151724.x9FHOM55015499@repo.freebsd.org> <20191015193451.f7c9388f971432e6d1be369b@bidouilliste.com> <20191015173757.GA74227@bsdpad.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46t2zk2QCZz4bh7 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bidouilliste.com header.s=mail header.b=msqp3uNd; dmarc=none; spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates 212.83.177.182 as permitted sender) smtp.mailfrom=manu@bidouilliste.com X-Spamd-Result: default: False [-1.21 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mail]; NEURAL_HAM_MEDIUM(-0.71)[-0.711,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:212.83.177.182/32:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MV_CASE(0.50)[]; DMARC_NA(0.00)[bidouilliste.com]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-0.98)[-0.976,0]; DKIM_TRACE(0.00)[bidouilliste.com:+]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; IP_SCORE(0.38)[ip: (-0.66), ipnet: 212.83.160.0/19(2.45), asn: 12876(0.11), country: FR(-0.00)]; ASN(0.00)[asn:12876, ipnet:212.83.160.0/19, country:FR]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 17:51:31 -0000 On Tue, 15 Oct 2019 18:37:57 +0100 Ruslan Bukin wrote: > On Tue, Oct 15, 2019 at 07:34:51PM +0200, Emmanuel Vadot wrote: > > On Tue, 15 Oct 2019 17:24:22 +0000 (UTC) > > Ruslan Bukin wrote: > > > > > Author: br > > > Date: Tue Oct 15 17:24:21 2019 > > > New Revision: 353575 > > > URL: https://svnweb.freebsd.org/changeset/base/353575 > > > > > > Log: > > > Fix dwmmc(4) driver attachment when ext_resources are not present. > > > > > > Ignore only ENOENT (no DTS properties found) and ENODEV (driver not > > > present) non-zero return values from ext_resources. > > > > > > Reviewed by: manu > > > Sponsored by: DARPA, AFRL > > > Differential Revision: https://reviews.freebsd.org/D22043 > > > > > > Modified: > > > head/sys/dev/mmc/host/dwmmc.c > > > > I've just realized that you are probably using the SOCFPGA kernel > > configuration and it doesn't have option EXT_RESOURCES so how did you > > got those errors ? > > No, I'm using arm64 GENERIC kernel since Intel Stratix 10 is arm64/FPGA. > > Ruslan Ah ok, I though this was the previous generation. Again I think that would be good to spend a few days to properly support the ext resources from this platform. This seems to be the only arm64 SoC that doesn't support it. -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Tue Oct 15 18:16:11 2019 Return-Path: Delivered-To: svn-src-all@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 C26D2150796; Tue, 15 Oct 2019 18:16:11 +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 46t3XC41Smz4dH7; Tue, 15 Oct 2019 18:16:11 +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 58659228E0; Tue, 15 Oct 2019 18:16:11 +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 x9FIGBIx044857; Tue, 15 Oct 2019 18:16:11 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FIGBLB044856; Tue, 15 Oct 2019 18:16:11 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910151816.x9FIGBLB044856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 15 Oct 2019 18:16:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353579 - head/contrib/libc++/include X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/contrib/libc++/include X-SVN-Commit-Revision: 353579 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 18:16:11 -0000 Author: jhb Date: Tue Oct 15 18:16:10 2019 New Revision: 353579 URL: https://svnweb.freebsd.org/changeset/base/353579 Log: Use __FreeBSD_version to determine if gets() has been removed. GCC compilers set __FreeBSD__ statically to a build-time determined targeted version (which in ports always matches the build host's version). This means that when building any version (12 or 13, etc.) of riscv or some other architecture via GCC on a 12.x host, __FreeBSD__ will always be set to 12. As a result, __FreeBSD__ cannot be used to reliably detect the target FreeBSD version being built. Instead, __FreeBSD_version from either (in the kernel) or (in userland) should be used. This changes the gets() test in libc++ to use __FreeBSD_version from . Reported by: jenkins (riscv64 and amd64-gcc) Reviewed by: dim, imp Differential Revision: https://reviews.freebsd.org/D22034 Modified: head/contrib/libc++/include/__config Modified: head/contrib/libc++/include/__config ============================================================================== --- head/contrib/libc++/include/__config Tue Oct 15 17:35:39 2019 (r353578) +++ head/contrib/libc++/include/__config Tue Oct 15 18:16:10 2019 (r353579) @@ -246,6 +246,7 @@ #ifdef __FreeBSD__ # include +# include # if _BYTE_ORDER == _LITTLE_ENDIAN # define _LIBCPP_LITTLE_ENDIAN # else // _BYTE_ORDER == _LITTLE_ENDIAN @@ -1131,7 +1132,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_ // Some systems do not provide gets() in their C library, for security reasons. #ifndef _LIBCPP_C_HAS_NO_GETS -# if defined(_LIBCPP_MSVCRT) || (defined(__FreeBSD__) && __FreeBSD__ >= 13) +# if defined(_LIBCPP_MSVCRT) || \ + (defined(__FreeBSD__) && __FreeBSD_version >= 1300043) # define _LIBCPP_C_HAS_NO_GETS # endif #endif From owner-svn-src-all@freebsd.org Tue Oct 15 18:39:32 2019 Return-Path: Delivered-To: svn-src-all@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 B562F150ECA; Tue, 15 Oct 2019 18:39:32 +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 46t4384DYwz4fJv; Tue, 15 Oct 2019 18:39:32 +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 7018122C78; Tue, 15 Oct 2019 18:39:32 +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 x9FIdWCQ061550; Tue, 15 Oct 2019 18:39:32 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FIdWa3061549; Tue, 15 Oct 2019 18:39:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201910151839.x9FIdWa3061549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 15 Oct 2019 18:39:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353580 - stable/12/sys/dev/ioat X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/ioat X-SVN-Commit-Revision: 353580 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 18:39:32 -0000 Author: mav Date: Tue Oct 15 18:39:32 2019 New Revision: 353580 URL: https://svnweb.freebsd.org/changeset/base/353580 Log: MFC r352787: Replace argument checks with assertions. Those functions are used by kernel, and we can't check all possible argument errors in production kernel. Plus according to docs many of those errors are checked by hardware. Assertions should just help with code debugging. Modified: stable/12/sys/dev/ioat/ioat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ioat/ioat.c ============================================================================== --- stable/12/sys/dev/ioat/ioat.c Tue Oct 15 18:16:10 2019 (r353579) +++ stable/12/sys/dev/ioat/ioat.c Tue Oct 15 18:39:32 2019 (r353580) @@ -1012,17 +1012,14 @@ ioat_op_generic(struct ioat_softc *ioat, uint8_t op, KASSERT((flags & ~_DMA_GENERIC_FLAGS) == 0, ("Unrecognized flag(s): %#x", flags & ~_DMA_GENERIC_FLAGS)); + KASSERT(size <= ioat->max_xfer_size, ("%s: size too big (%u > %u)", + __func__, (unsigned)size, ioat->max_xfer_size)); + if ((flags & DMA_NO_WAIT) != 0) mflags = M_NOWAIT; else mflags = M_WAITOK; - if (size > ioat->max_xfer_size) { - ioat_log_message(0, "%s: max_xfer_size = %d, requested = %u\n", - __func__, ioat->max_xfer_size, (unsigned)size); - return (NULL); - } - if (ioat_reserve_space(ioat, 1, mflags) != 0) return (NULL); @@ -1080,11 +1077,8 @@ ioat_copy(bus_dmaengine_t dmaengine, bus_addr_t dst, ioat = to_ioat_softc(dmaengine); - if (((src | dst) & (0xffffull << 48)) != 0) { - ioat_log_message(0, "%s: High 16 bits of src/dst invalid\n", - __func__); - return (NULL); - } + KASSERT(((src | dst) & (0xffffull << 48)) == 0, + ("%s: high 16 bits of src/dst are not zero", __func__)); desc = ioat_op_generic(ioat, IOAT_OP_COPY, len, src, dst, callback_fn, callback_arg, flags); @@ -1113,16 +1107,10 @@ ioat_copy_8k_aligned(bus_dmaengine_t dmaengine, bus_ad ioat = to_ioat_softc(dmaengine); CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); - if (((src1 | src2 | dst1 | dst2) & (0xffffull << 48)) != 0) { - ioat_log_message(0, "%s: High 16 bits of src/dst invalid\n", - __func__); - return (NULL); - } - if (((src1 | src2 | dst1 | dst2) & PAGE_MASK) != 0) { - ioat_log_message(0, "%s: Addresses must be page-aligned\n", - __func__); - return (NULL); - } + KASSERT(((src1 | src2 | dst1 | dst2) & (0xffffull << 48)) == 0, + ("%s: high 16 bits of src/dst are not zero", __func__)); + KASSERT(((src1 | src2 | dst1 | dst2) & PAGE_MASK) == 0, + ("%s: addresses are not page-aligned", __func__)); desc = ioat_op_generic(ioat, IOAT_OP_COPY, 2 * PAGE_SIZE, src1, dst1, callback_fn, callback_arg, flags); @@ -1160,26 +1148,15 @@ ioat_copy_crc(bus_dmaengine_t dmaengine, bus_addr_t ds ioat = to_ioat_softc(dmaengine); CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); - if ((ioat->capabilities & IOAT_DMACAP_MOVECRC) == 0) { - ioat_log_message(0, "%s: Device lacks MOVECRC capability\n", - __func__); - return (NULL); - } - if (((src | dst) & (0xffffffull << 40)) != 0) { - ioat_log_message(0, "%s: High 24 bits of src/dst invalid\n", - __func__); - return (NULL); - } + KASSERT((ioat->capabilities & IOAT_DMACAP_MOVECRC) != 0, + ("%s: device lacks MOVECRC capability", __func__)); + KASSERT(((src | dst) & (0xffffffull << 40)) == 0, + ("%s: high 24 bits of src/dst are not zero", __func__)); teststore = (flags & _DMA_CRC_TESTSTORE); - if (teststore == _DMA_CRC_TESTSTORE) { - ioat_log_message(0, "%s: TEST and STORE invalid\n", __func__); - return (NULL); - } - if (teststore == 0 && (flags & DMA_CRC_INLINE) != 0) { - ioat_log_message(0, "%s: INLINE invalid without TEST or STORE\n", - __func__); - return (NULL); - } + KASSERT(teststore != _DMA_CRC_TESTSTORE, + ("%s: TEST and STORE invalid", __func__)); + KASSERT(teststore != 0 || (flags & DMA_CRC_INLINE) == 0, + ("%s: INLINE invalid without TEST or STORE", __func__)); switch (teststore) { case DMA_CRC_STORE: @@ -1194,12 +1171,9 @@ ioat_copy_crc(bus_dmaengine_t dmaengine, bus_addr_t ds break; } - if ((flags & DMA_CRC_INLINE) == 0 && - (crcptr & (0xffffffull << 40)) != 0) { - ioat_log_message(0, - "%s: High 24 bits of crcptr invalid\n", __func__); - return (NULL); - } + KASSERT((flags & DMA_CRC_INLINE) != 0 || + (crcptr & (0xffffffull << 40)) == 0, + ("%s: high 24 bits of crcptr are not zero", __func__)); desc = ioat_op_generic(ioat, op, len, src, dst, callback_fn, callback_arg, flags & ~_DMA_CRC_FLAGS); @@ -1239,26 +1213,15 @@ ioat_crc(bus_dmaengine_t dmaengine, bus_addr_t src, bu ioat = to_ioat_softc(dmaengine); CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); - if ((ioat->capabilities & IOAT_DMACAP_CRC) == 0) { - ioat_log_message(0, "%s: Device lacks CRC capability\n", - __func__); - return (NULL); - } - if ((src & (0xffffffull << 40)) != 0) { - ioat_log_message(0, "%s: High 24 bits of src invalid\n", - __func__); - return (NULL); - } + KASSERT((ioat->capabilities & IOAT_DMACAP_CRC) != 0, + ("%s: device lacks CRC capability", __func__)); + KASSERT((src & (0xffffffull << 40)) == 0, + ("%s: high 24 bits of src are not zero", __func__)); teststore = (flags & _DMA_CRC_TESTSTORE); - if (teststore == _DMA_CRC_TESTSTORE) { - ioat_log_message(0, "%s: TEST and STORE invalid\n", __func__); - return (NULL); - } - if (teststore == 0 && (flags & DMA_CRC_INLINE) != 0) { - ioat_log_message(0, "%s: INLINE invalid without TEST or STORE\n", - __func__); - return (NULL); - } + KASSERT(teststore != _DMA_CRC_TESTSTORE, + ("%s: TEST and STORE invalid", __func__)); + KASSERT(teststore != 0 || (flags & DMA_CRC_INLINE) == 0, + ("%s: INLINE invalid without TEST or STORE", __func__)); switch (teststore) { case DMA_CRC_STORE: @@ -1273,12 +1236,9 @@ ioat_crc(bus_dmaengine_t dmaengine, bus_addr_t src, bu break; } - if ((flags & DMA_CRC_INLINE) == 0 && - (crcptr & (0xffffffull << 40)) != 0) { - ioat_log_message(0, - "%s: High 24 bits of crcptr invalid\n", __func__); - return (NULL); - } + KASSERT((flags & DMA_CRC_INLINE) != 0 || + (crcptr & (0xffffffull << 40)) == 0, + ("%s: high 24 bits of crcptr are not zero", __func__)); desc = ioat_op_generic(ioat, op, len, src, 0, callback_fn, callback_arg, flags & ~_DMA_CRC_FLAGS); @@ -1316,18 +1276,11 @@ ioat_blockfill(bus_dmaengine_t dmaengine, bus_addr_t d ioat = to_ioat_softc(dmaengine); CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); - if ((ioat->capabilities & IOAT_DMACAP_BFILL) == 0) { - ioat_log_message(0, "%s: Device lacks BFILL capability\n", - __func__); - return (NULL); - } + KASSERT((ioat->capabilities & IOAT_DMACAP_BFILL) != 0, + ("%s: device lacks BFILL capability", __func__)); + KASSERT((dst & (0xffffull << 48)) == 0, + ("%s: high 16 bits of crcptr are not zero", __func__)); - if ((dst & (0xffffull << 48)) != 0) { - ioat_log_message(0, "%s: High 16 bits of dst invalid\n", - __func__); - return (NULL); - } - desc = ioat_op_generic(ioat, IOAT_OP_FILL, len, fillpattern, dst, callback_fn, callback_arg, flags); if (desc == NULL) @@ -1483,7 +1436,7 @@ ioat_poll_timer_callback(void *arg) struct ioat_softc *ioat; ioat = arg; - ioat_log_message(3, "%s\n", __func__); + CTR1(KTR_IOAT, "%s", __func__); ioat_process_events(ioat, FALSE); From owner-svn-src-all@freebsd.org Tue Oct 15 18:42:07 2019 Return-Path: Delivered-To: svn-src-all@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 0924515116D; Tue, 15 Oct 2019 18:42:07 +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 46t4666Srhz4fg8; Tue, 15 Oct 2019 18:42:06 +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 C161622E09; Tue, 15 Oct 2019 18:42:06 +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 x9FIg6f1066319; Tue, 15 Oct 2019 18:42:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FIg6q6066318; Tue, 15 Oct 2019 18:42:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201910151842.x9FIg6q6066318@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 15 Oct 2019 18:42:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353581 - stable/11/sys/dev/ioat X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/ioat X-SVN-Commit-Revision: 353581 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 18:42:07 -0000 Author: mav Date: Tue Oct 15 18:42:06 2019 New Revision: 353581 URL: https://svnweb.freebsd.org/changeset/base/353581 Log: MFC r352787: Replace argument checks with assertions. Those functions are used by kernel, and we can't check all possible argument errors in production kernel. Plus according to docs many of those errors are checked by hardware. Assertions should just help with code debugging. Modified: stable/11/sys/dev/ioat/ioat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ioat/ioat.c ============================================================================== --- stable/11/sys/dev/ioat/ioat.c Tue Oct 15 18:39:32 2019 (r353580) +++ stable/11/sys/dev/ioat/ioat.c Tue Oct 15 18:42:06 2019 (r353581) @@ -1002,17 +1002,14 @@ ioat_op_generic(struct ioat_softc *ioat, uint8_t op, KASSERT((flags & ~_DMA_GENERIC_FLAGS) == 0, ("Unrecognized flag(s): %#x", flags & ~_DMA_GENERIC_FLAGS)); + KASSERT(size <= ioat->max_xfer_size, ("%s: size too big (%u > %u)", + __func__, (unsigned)size, ioat->max_xfer_size)); + if ((flags & DMA_NO_WAIT) != 0) mflags = M_NOWAIT; else mflags = M_WAITOK; - if (size > ioat->max_xfer_size) { - ioat_log_message(0, "%s: max_xfer_size = %d, requested = %u\n", - __func__, ioat->max_xfer_size, (unsigned)size); - return (NULL); - } - if (ioat_reserve_space(ioat, 1, mflags) != 0) return (NULL); @@ -1070,11 +1067,8 @@ ioat_copy(bus_dmaengine_t dmaengine, bus_addr_t dst, ioat = to_ioat_softc(dmaengine); - if (((src | dst) & (0xffffull << 48)) != 0) { - ioat_log_message(0, "%s: High 16 bits of src/dst invalid\n", - __func__); - return (NULL); - } + KASSERT(((src | dst) & (0xffffull << 48)) == 0, + ("%s: high 16 bits of src/dst are not zero", __func__)); desc = ioat_op_generic(ioat, IOAT_OP_COPY, len, src, dst, callback_fn, callback_arg, flags); @@ -1103,16 +1097,10 @@ ioat_copy_8k_aligned(bus_dmaengine_t dmaengine, bus_ad ioat = to_ioat_softc(dmaengine); CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); - if (((src1 | src2 | dst1 | dst2) & (0xffffull << 48)) != 0) { - ioat_log_message(0, "%s: High 16 bits of src/dst invalid\n", - __func__); - return (NULL); - } - if (((src1 | src2 | dst1 | dst2) & PAGE_MASK) != 0) { - ioat_log_message(0, "%s: Addresses must be page-aligned\n", - __func__); - return (NULL); - } + KASSERT(((src1 | src2 | dst1 | dst2) & (0xffffull << 48)) == 0, + ("%s: high 16 bits of src/dst are not zero", __func__)); + KASSERT(((src1 | src2 | dst1 | dst2) & PAGE_MASK) == 0, + ("%s: addresses are not page-aligned", __func__)); desc = ioat_op_generic(ioat, IOAT_OP_COPY, 2 * PAGE_SIZE, src1, dst1, callback_fn, callback_arg, flags); @@ -1150,26 +1138,15 @@ ioat_copy_crc(bus_dmaengine_t dmaengine, bus_addr_t ds ioat = to_ioat_softc(dmaengine); CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); - if ((ioat->capabilities & IOAT_DMACAP_MOVECRC) == 0) { - ioat_log_message(0, "%s: Device lacks MOVECRC capability\n", - __func__); - return (NULL); - } - if (((src | dst) & (0xffffffull << 40)) != 0) { - ioat_log_message(0, "%s: High 24 bits of src/dst invalid\n", - __func__); - return (NULL); - } + KASSERT((ioat->capabilities & IOAT_DMACAP_MOVECRC) != 0, + ("%s: device lacks MOVECRC capability", __func__)); + KASSERT(((src | dst) & (0xffffffull << 40)) == 0, + ("%s: high 24 bits of src/dst are not zero", __func__)); teststore = (flags & _DMA_CRC_TESTSTORE); - if (teststore == _DMA_CRC_TESTSTORE) { - ioat_log_message(0, "%s: TEST and STORE invalid\n", __func__); - return (NULL); - } - if (teststore == 0 && (flags & DMA_CRC_INLINE) != 0) { - ioat_log_message(0, "%s: INLINE invalid without TEST or STORE\n", - __func__); - return (NULL); - } + KASSERT(teststore != _DMA_CRC_TESTSTORE, + ("%s: TEST and STORE invalid", __func__)); + KASSERT(teststore != 0 || (flags & DMA_CRC_INLINE) == 0, + ("%s: INLINE invalid without TEST or STORE", __func__)); switch (teststore) { case DMA_CRC_STORE: @@ -1184,12 +1161,9 @@ ioat_copy_crc(bus_dmaengine_t dmaengine, bus_addr_t ds break; } - if ((flags & DMA_CRC_INLINE) == 0 && - (crcptr & (0xffffffull << 40)) != 0) { - ioat_log_message(0, - "%s: High 24 bits of crcptr invalid\n", __func__); - return (NULL); - } + KASSERT((flags & DMA_CRC_INLINE) != 0 || + (crcptr & (0xffffffull << 40)) == 0, + ("%s: high 24 bits of crcptr are not zero", __func__)); desc = ioat_op_generic(ioat, op, len, src, dst, callback_fn, callback_arg, flags & ~_DMA_CRC_FLAGS); @@ -1229,26 +1203,15 @@ ioat_crc(bus_dmaengine_t dmaengine, bus_addr_t src, bu ioat = to_ioat_softc(dmaengine); CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); - if ((ioat->capabilities & IOAT_DMACAP_CRC) == 0) { - ioat_log_message(0, "%s: Device lacks CRC capability\n", - __func__); - return (NULL); - } - if ((src & (0xffffffull << 40)) != 0) { - ioat_log_message(0, "%s: High 24 bits of src invalid\n", - __func__); - return (NULL); - } + KASSERT((ioat->capabilities & IOAT_DMACAP_CRC) != 0, + ("%s: device lacks CRC capability", __func__)); + KASSERT((src & (0xffffffull << 40)) == 0, + ("%s: high 24 bits of src are not zero", __func__)); teststore = (flags & _DMA_CRC_TESTSTORE); - if (teststore == _DMA_CRC_TESTSTORE) { - ioat_log_message(0, "%s: TEST and STORE invalid\n", __func__); - return (NULL); - } - if (teststore == 0 && (flags & DMA_CRC_INLINE) != 0) { - ioat_log_message(0, "%s: INLINE invalid without TEST or STORE\n", - __func__); - return (NULL); - } + KASSERT(teststore != _DMA_CRC_TESTSTORE, + ("%s: TEST and STORE invalid", __func__)); + KASSERT(teststore != 0 || (flags & DMA_CRC_INLINE) == 0, + ("%s: INLINE invalid without TEST or STORE", __func__)); switch (teststore) { case DMA_CRC_STORE: @@ -1263,12 +1226,9 @@ ioat_crc(bus_dmaengine_t dmaengine, bus_addr_t src, bu break; } - if ((flags & DMA_CRC_INLINE) == 0 && - (crcptr & (0xffffffull << 40)) != 0) { - ioat_log_message(0, - "%s: High 24 bits of crcptr invalid\n", __func__); - return (NULL); - } + KASSERT((flags & DMA_CRC_INLINE) != 0 || + (crcptr & (0xffffffull << 40)) == 0, + ("%s: high 24 bits of crcptr are not zero", __func__)); desc = ioat_op_generic(ioat, op, len, src, 0, callback_fn, callback_arg, flags & ~_DMA_CRC_FLAGS); @@ -1306,18 +1266,11 @@ ioat_blockfill(bus_dmaengine_t dmaengine, bus_addr_t d ioat = to_ioat_softc(dmaengine); CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); - if ((ioat->capabilities & IOAT_DMACAP_BFILL) == 0) { - ioat_log_message(0, "%s: Device lacks BFILL capability\n", - __func__); - return (NULL); - } + KASSERT((ioat->capabilities & IOAT_DMACAP_BFILL) != 0, + ("%s: device lacks BFILL capability", __func__)); + KASSERT((dst & (0xffffull << 48)) == 0, + ("%s: high 16 bits of crcptr are not zero", __func__)); - if ((dst & (0xffffull << 48)) != 0) { - ioat_log_message(0, "%s: High 16 bits of dst invalid\n", - __func__); - return (NULL); - } - desc = ioat_op_generic(ioat, IOAT_OP_FILL, len, fillpattern, dst, callback_fn, callback_arg, flags); if (desc == NULL) @@ -1473,7 +1426,7 @@ ioat_poll_timer_callback(void *arg) struct ioat_softc *ioat; ioat = arg; - ioat_log_message(3, "%s\n", __func__); + CTR1(KTR_IOAT, "%s", __func__); ioat_process_events(ioat, FALSE); From owner-svn-src-all@freebsd.org Tue Oct 15 18:44:29 2019 Return-Path: Delivered-To: svn-src-all@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 7F6941512B5; Tue, 15 Oct 2019 18:44: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 46t48s2vPfz4g0N; Tue, 15 Oct 2019 18:44: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 2E5DF22E34; Tue, 15 Oct 2019 18:44:29 +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 x9FIiTxC067317; Tue, 15 Oct 2019 18:44:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FIiTue067316; Tue, 15 Oct 2019 18:44:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201910151844.x9FIiTue067316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 15 Oct 2019 18:44:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353582 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 353582 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 18:44:29 -0000 Author: mav Date: Tue Oct 15 18:44:28 2019 New Revision: 353582 URL: https://svnweb.freebsd.org/changeset/base/353582 Log: MFC r352939: Improve latency of synchronous 128KB writes. Before my ZIL space optimization few years ago 128KB writes were logged as two 64KB+ records in two 128KB log blocks. After that change it became ~124KB+/4KB+ in two 128KB log blocks to free space in the second block for another record. Unfortunately in case of 128KB only writes, when space in the second block remained unused, that change increased write latency by imbalancing checksum computation time between parallel threads. This change introduces new 68KB log block size, used for both writes below 67KB and 128KB-sharp writes. Writes of 68-127KB are still using one 128KB block to not increase processing overhead. Writes above 131KB are still using full 128KB blocks, since possible saving there is small. Mixed loads will likely also fall back to previous 128KB, since code uses maximum of the last 10 requested block sizes. On a simple 128KB write test with queue depth of 1 this change demonstrates ~15-20% performance improvement. Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue Oct 15 18:42:06 2019 (r353581) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue Oct 15 18:44:28 2019 (r353582) @@ -1351,11 +1351,17 @@ zil_lwb_write_open(zilog_t *zilog, lwb_t *lwb) * aligned to 4KB) actually gets written. However, we can't always just * allocate SPA_OLD_MAXBLOCKSIZE as the slog space could be exhausted. */ -uint64_t zil_block_buckets[] = { - 4096, /* non TX_WRITE */ - 8192+4096, /* data base */ - 32*1024 + 4096, /* NFS writes */ - UINT64_MAX +struct { + uint64_t limit; + uint64_t blksz; +} zil_block_buckets[] = { + { 4096, 4096 }, /* non TX_WRITE */ + { 8192 + 4096, 8192 + 4096 }, /* database */ + { 32768 + 4096, 32768 + 4096 }, /* NFS writes */ + { 65536 + 4096, 65536 + 4096 }, /* 64KB writes */ + { 131072, 131072 }, /* < 128KB writes */ + { 131072 + 4096, 65536 + 4096 }, /* 128KB writes */ + { UINT64_MAX, SPA_OLD_MAXBLOCKSIZE}, /* > 128KB writes */ }; /* @@ -1432,11 +1438,9 @@ zil_lwb_write_issue(zilog_t *zilog, lwb_t *lwb) * pool log space. */ zil_blksz = zilog->zl_cur_used + sizeof (zil_chain_t); - for (i = 0; zil_blksz > zil_block_buckets[i]; i++) + for (i = 0; zil_blksz > zil_block_buckets[i].limit; i++) continue; - zil_blksz = zil_block_buckets[i]; - if (zil_blksz == UINT64_MAX) - zil_blksz = SPA_OLD_MAXBLOCKSIZE; + zil_blksz = zil_block_buckets[i].blksz; zilog->zl_prev_blks[zilog->zl_prev_rotor] = zil_blksz; for (i = 0; i < ZIL_PREV_BLKS; i++) zil_blksz = MAX(zil_blksz, zilog->zl_prev_blks[i]); From owner-svn-src-all@freebsd.org Tue Oct 15 18:44:51 2019 Return-Path: Delivered-To: svn-src-all@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 3394A151377; Tue, 15 Oct 2019 18:44:51 +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 46t49H0bKBz4g76; Tue, 15 Oct 2019 18:44:51 +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 D182A22E35; Tue, 15 Oct 2019 18:44:50 +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 x9FIio7e067390; Tue, 15 Oct 2019 18:44:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FIioe9067389; Tue, 15 Oct 2019 18:44:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201910151844.x9FIioe9067389@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 15 Oct 2019 18:44:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353583 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 353583 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 18:44:51 -0000 Author: mav Date: Tue Oct 15 18:44:50 2019 New Revision: 353583 URL: https://svnweb.freebsd.org/changeset/base/353583 Log: MFC r352939: Improve latency of synchronous 128KB writes. Before my ZIL space optimization few years ago 128KB writes were logged as two 64KB+ records in two 128KB log blocks. After that change it became ~124KB+/4KB+ in two 128KB log blocks to free space in the second block for another record. Unfortunately in case of 128KB only writes, when space in the second block remained unused, that change increased write latency by imbalancing checksum computation time between parallel threads. This change introduces new 68KB log block size, used for both writes below 67KB and 128KB-sharp writes. Writes of 68-127KB are still using one 128KB block to not increase processing overhead. Writes above 131KB are still using full 128KB blocks, since possible saving there is small. Mixed loads will likely also fall back to previous 128KB, since code uses maximum of the last 10 requested block sizes. On a simple 128KB write test with queue depth of 1 this change demonstrates ~15-20% performance improvement. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue Oct 15 18:44:28 2019 (r353582) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue Oct 15 18:44:50 2019 (r353583) @@ -1238,11 +1238,17 @@ zil_lwb_write_open(zilog_t *zilog, lwb_t *lwb) * aligned to 4KB) actually gets written. However, we can't always just * allocate SPA_OLD_MAXBLOCKSIZE as the slog space could be exhausted. */ -uint64_t zil_block_buckets[] = { - 4096, /* non TX_WRITE */ - 8192+4096, /* data base */ - 32*1024 + 4096, /* NFS writes */ - UINT64_MAX +struct { + uint64_t limit; + uint64_t blksz; +} zil_block_buckets[] = { + { 4096, 4096 }, /* non TX_WRITE */ + { 8192 + 4096, 8192 + 4096 }, /* database */ + { 32768 + 4096, 32768 + 4096 }, /* NFS writes */ + { 65536 + 4096, 65536 + 4096 }, /* 64KB writes */ + { 131072, 131072 }, /* < 128KB writes */ + { 131072 + 4096, 65536 + 4096 }, /* 128KB writes */ + { UINT64_MAX, SPA_OLD_MAXBLOCKSIZE}, /* > 128KB writes */ }; /* @@ -1319,11 +1325,9 @@ zil_lwb_write_issue(zilog_t *zilog, lwb_t *lwb) * pool log space. */ zil_blksz = zilog->zl_cur_used + sizeof (zil_chain_t); - for (i = 0; zil_blksz > zil_block_buckets[i]; i++) + for (i = 0; zil_blksz > zil_block_buckets[i].limit; i++) continue; - zil_blksz = zil_block_buckets[i]; - if (zil_blksz == UINT64_MAX) - zil_blksz = SPA_OLD_MAXBLOCKSIZE; + zil_blksz = zil_block_buckets[i].blksz; zilog->zl_prev_blks[zilog->zl_prev_rotor] = zil_blksz; for (i = 0; i < ZIL_PREV_BLKS; i++) zil_blksz = MAX(zil_blksz, zilog->zl_prev_blks[i]); From owner-svn-src-all@freebsd.org Tue Oct 15 18:47:07 2019 Return-Path: Delivered-To: svn-src-all@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 7818215147E; Tue, 15 Oct 2019 18:47:07 +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 46t4Cv2ZlHz4gHQ; Tue, 15 Oct 2019 18:47:07 +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 36FF922E36; Tue, 15 Oct 2019 18:47:07 +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 x9FIl7KW067564; Tue, 15 Oct 2019 18:47:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FIl7ef067563; Tue, 15 Oct 2019 18:47:07 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201910151847.x9FIl7ef067563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 15 Oct 2019 18:47:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353584 - stable/12/sys/cam/scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam/scsi X-SVN-Commit-Revision: 353584 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 18:47:07 -0000 Author: mav Date: Tue Oct 15 18:47:06 2019 New Revision: 353584 URL: https://svnweb.freebsd.org/changeset/base/353584 Log: MFC r352743: Add kern.cam.da.X.quirks tunable, similar existing for ada. Submitted by: Michael Lass Differential Revision: https://reviews.freebsd.org/D20677 Modified: stable/12/sys/cam/scsi/scsi_da.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_da.c Tue Oct 15 18:44:50 2019 (r353583) +++ stable/12/sys/cam/scsi/scsi_da.c Tue Oct 15 18:47:06 2019 (r353584) @@ -2679,6 +2679,7 @@ daregister(struct cam_periph *periph, void *arg) struct ccb_getdev *cgd; char tmpstr[80]; caddr_t match; + int quirks; cgd = (struct ccb_getdev *)arg; if (cgd == NULL) { @@ -2734,6 +2735,13 @@ daregister(struct cam_periph *periph, void *arg) xpt_path_inq(&cpi, periph->path); if (cpi.ccb_h.status == CAM_REQ_CMP && (cpi.hba_misc & PIM_NO_6_BYTE)) softc->quirks |= DA_Q_NO_6_BYTE; + + /* Override quirks if tunable is set */ + snprintf(tmpstr, sizeof(tmpstr), "kern.cam.da.%d.quirks", + periph->unit_number); + quirks = softc->quirks; + TUNABLE_INT_FETCH(tmpstr, &quirks); + softc->quirks = quirks; if (SID_TYPE(&cgd->inq_data) == T_ZBC_HM) softc->zone_mode = DA_ZONE_HOST_MANAGED; From owner-svn-src-all@freebsd.org Tue Oct 15 18:58:02 2019 Return-Path: Delivered-To: svn-src-all@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 794D215186D; Tue, 15 Oct 2019 18:58:02 +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 46t4SV2fmcz3CKH; Tue, 15 Oct 2019 18:58:02 +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 3A1E32303E; Tue, 15 Oct 2019 18:58:02 +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 x9FIw2Zn073471; Tue, 15 Oct 2019 18:58:02 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FIw14S073469; Tue, 15 Oct 2019 18:58:01 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910151858.x9FIw14S073469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 15 Oct 2019 18:58:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353585 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 353585 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 18:58:02 -0000 Author: jhb Date: Tue Oct 15 18:58:01 2019 New Revision: 353585 URL: https://svnweb.freebsd.org/changeset/base/353585 Log: Export pci_attach() and pci_detach(). Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21948 Modified: head/sys/dev/pci/pci.c head/sys/dev/pci/pci_private.h Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Tue Oct 15 18:47:06 2019 (r353584) +++ head/sys/dev/pci/pci.c Tue Oct 15 18:58:01 2019 (r353585) @@ -100,8 +100,6 @@ static void pci_assign_interrupt(device_t bus, device static int pci_add_map(device_t bus, device_t dev, int reg, struct resource_list *rl, int force, int prefetch); static int pci_probe(device_t dev); -static int pci_attach(device_t dev); -static int pci_detach(device_t dev); static void pci_load_vendor_data(void); static int pci_describe_parse_line(char **ptr, int *vendor, int *device, char **desc); @@ -4373,7 +4371,7 @@ pci_attach_common(device_t dev) return (0); } -static int +int pci_attach(device_t dev) { int busno, domain, error; @@ -4394,7 +4392,7 @@ pci_attach(device_t dev) return (bus_generic_attach(dev)); } -static int +int pci_detach(device_t dev) { #ifdef PCI_RES_BUS Modified: head/sys/dev/pci/pci_private.h ============================================================================== --- head/sys/dev/pci/pci_private.h Tue Oct 15 18:47:06 2019 (r353584) +++ head/sys/dev/pci/pci_private.h Tue Oct 15 18:58:01 2019 (r353585) @@ -58,7 +58,9 @@ void pci_add_resources(device_t bus, device_t dev, in uint32_t prefetchmask); void pci_add_resources_ea(device_t bus, device_t dev, int alloc_iov); struct pci_devinfo *pci_alloc_devinfo_method(device_t dev); +int pci_attach(device_t dev); int pci_attach_common(device_t dev); +int pci_detach(device_t dev); int pci_rescan_method(device_t dev); void pci_driver_added(device_t dev, driver_t *driver); int pci_ea_is_enabled(device_t dev, int rid); From owner-svn-src-all@freebsd.org Tue Oct 15 19:04:40 2019 Return-Path: Delivered-To: svn-src-all@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 4582D151AB0; Tue, 15 Oct 2019 19:04:40 +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 46t4c815S1z3Cl4; Tue, 15 Oct 2019 19:04:40 +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 08B6B23202; Tue, 15 Oct 2019 19:04:40 +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 x9FJ4dIl078975; Tue, 15 Oct 2019 19:04:39 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FJ4dae078974; Tue, 15 Oct 2019 19:04:39 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910151904.x9FJ4dae078974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 15 Oct 2019 19:04:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353586 - head/sys/dev/acpica X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/acpica X-SVN-Commit-Revision: 353586 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 19:04:40 -0000 Author: jhb Date: Tue Oct 15 19:04:39 2019 New Revision: 353586 URL: https://svnweb.freebsd.org/changeset/base/353586 Log: Support hot insertion and removal of PCI devices on EC2. Install ACPI notify handlers on PCI devices with an _EJ0 method. This handler is invoked when devices are added or removed. - When an ACPI_NOTIFY_DEVICE_CHECK event posts, rescan the parent bus device. Note that strictly speaking we only need to rescan the specified device, but BUS_RESCAN is what is available, so we rescan the entire bus. - When an ACPI_NOTIFY_EJECT_REQUEST event posts, detach the device associated with the ACPI handle, invoke the _EJ0 method, and then delete the device. Eventually this might be changed to vector notify events to devd in userspace where devctl can be used instead to permit more complex actions such as graceful unmounting of filesystems. Tested by: cperciva Reviewed by: cperciva, imp, scottl MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21948 Modified: head/sys/dev/acpica/acpi_pci.c Modified: head/sys/dev/acpica/acpi_pci.c ============================================================================== --- head/sys/dev/acpica/acpi_pci.c Tue Oct 15 18:58:01 2019 (r353585) +++ head/sys/dev/acpica/acpi_pci.c Tue Oct 15 19:04:39 2019 (r353586) @@ -71,9 +71,11 @@ CTASSERT(ACPI_STATE_D2 == PCI_POWERSTATE_D2); CTASSERT(ACPI_STATE_D3 == PCI_POWERSTATE_D3); static struct pci_devinfo *acpi_pci_alloc_devinfo(device_t dev); +static int acpi_pci_attach(device_t dev); static void acpi_pci_child_deleted(device_t dev, device_t child); static int acpi_pci_child_location_str_method(device_t cbdev, device_t child, char *buf, size_t buflen); +static int acpi_pci_detach(device_t dev); static int acpi_pci_probe(device_t dev); static int acpi_pci_read_ivar(device_t dev, device_t child, int which, uintptr_t *result); @@ -89,6 +91,8 @@ static bus_dma_tag_t acpi_pci_get_dma_tag(device_t bus static device_method_t acpi_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, acpi_pci_probe), + DEVMETHOD(device_attach, acpi_pci_attach), + DEVMETHOD(device_detach, acpi_pci_detach), /* Bus interface */ DEVMETHOD(bus_read_ivar, acpi_pci_read_ivar), @@ -324,6 +328,108 @@ acpi_pci_probe(device_t dev) return (ENXIO); device_set_desc(dev, "ACPI PCI bus"); return (BUS_PROBE_DEFAULT); +} + +static void +acpi_pci_device_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context) +{ + device_t child, dev; + ACPI_STATUS status; + int error; + + dev = context; + + switch (notify) { + case ACPI_NOTIFY_DEVICE_CHECK: + mtx_lock(&Giant); + BUS_RESCAN(dev); + mtx_unlock(&Giant); + break; + case ACPI_NOTIFY_EJECT_REQUEST: + child = acpi_get_device(h); + if (child == NULL) { + device_printf(dev, "no device to eject for %s\n", + acpi_name(h)); + return; + } + mtx_lock(&Giant); + error = device_detach(child); + if (error) { + mtx_unlock(&Giant); + device_printf(dev, "failed to detach %s: %d\n", + device_get_nameunit(child), error); + return; + } + status = acpi_SetInteger(h, "_EJ0", 1); + if (ACPI_FAILURE(status)) { + mtx_unlock(&Giant); + device_printf(dev, "failed to eject %s: %s\n", + acpi_name(h), AcpiFormatException(status)); + return; + } + BUS_RESCAN(dev); + mtx_unlock(&Giant); + break; + default: + device_printf(dev, "unknown notify %#x for %s\n", notify, + acpi_name(h)); + break; + } +} + +static ACPI_STATUS +acpi_pci_install_device_notify_handler(ACPI_HANDLE handle, UINT32 level, + void *context, void **status) +{ + ACPI_HANDLE h; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + + if (ACPI_FAILURE(AcpiGetHandle(handle, "_EJ0", &h))) + return_ACPI_STATUS (AE_OK); + + AcpiInstallNotifyHandler(handle, ACPI_SYSTEM_NOTIFY, + acpi_pci_device_notify_handler, context); + return_ACPI_STATUS (AE_OK); +} + +static int +acpi_pci_attach(device_t dev) +{ + int error; + + error = pci_attach(dev); + if (error) + return (error); + AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1, + acpi_pci_install_device_notify_handler, NULL, dev, NULL); + + return (0); +} + +static ACPI_STATUS +acpi_pci_remove_notify_handler(ACPI_HANDLE handle, UINT32 level, void *context, + void **status) +{ + ACPI_HANDLE h; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + + if (ACPI_FAILURE(AcpiGetHandle(handle, "_EJ0", &h))) + return_ACPI_STATUS (AE_OK); + + AcpiRemoveNotifyHandler(handle, ACPI_SYSTEM_NOTIFY, + acpi_pci_device_notify_handler); + return_ACPI_STATUS (AE_OK); +} + +static int +acpi_pci_detach(device_t dev) +{ + + AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1, + acpi_pci_remove_notify_handler, NULL, dev, NULL); + return (pci_detach(dev)); } #ifdef ACPI_DMAR From owner-svn-src-all@freebsd.org Tue Oct 15 19:12:10 2019 Return-Path: Delivered-To: svn-src-all@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 34D9E151ED6; Tue, 15 Oct 2019 19:12:10 +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 46t4mp0dmcz3DSr; Tue, 15 Oct 2019 19:12:10 +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 ED5A8233AB; Tue, 15 Oct 2019 19:12:09 +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 x9FJC9db084442; Tue, 15 Oct 2019 19:12:09 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FJC9Tc084441; Tue, 15 Oct 2019 19:12:09 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910151912.x9FJC9Tc084441@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 15 Oct 2019 19:12:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353587 - head/sys/dev/acpica X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/acpica X-SVN-Commit-Revision: 353587 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 19:12:10 -0000 Author: jhb Date: Tue Oct 15 19:12:09 2019 New Revision: 353587 URL: https://svnweb.freebsd.org/changeset/base/353587 Log: Install an ACPI PCI bus notify handler. Rescan a PCI bus when the ACPI_NOTIFY_BUS_CHECK event is posted to a PCI bus. Reviewed by: scottl MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D21948 Modified: head/sys/dev/acpica/acpi_pci.c Modified: head/sys/dev/acpica/acpi_pci.c ============================================================================== --- head/sys/dev/acpica/acpi_pci.c Tue Oct 15 19:04:39 2019 (r353586) +++ head/sys/dev/acpica/acpi_pci.c Tue Oct 15 19:12:09 2019 (r353587) @@ -331,6 +331,25 @@ acpi_pci_probe(device_t dev) } static void +acpi_pci_bus_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context) +{ + device_t dev; + + dev = context; + + switch (notify) { + case ACPI_NOTIFY_BUS_CHECK: + mtx_lock(&Giant); + BUS_RESCAN(dev); + mtx_unlock(&Giant); + break; + default: + device_printf(dev, "unknown notify %#x\n", notify); + break; + } +} + +static void acpi_pci_device_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context) { device_t child, dev; @@ -401,6 +420,8 @@ acpi_pci_attach(device_t dev) error = pci_attach(dev); if (error) return (error); + AcpiInstallNotifyHandler(acpi_get_handle(dev), ACPI_SYSTEM_NOTIFY, + acpi_pci_bus_notify_handler, dev); AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1, acpi_pci_install_device_notify_handler, NULL, dev, NULL); @@ -429,6 +450,8 @@ acpi_pci_detach(device_t dev) AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1, acpi_pci_remove_notify_handler, NULL, dev, NULL); + AcpiRemoveNotifyHandler(acpi_get_handle(dev), ACPI_SYSTEM_NOTIFY, + acpi_pci_bus_notify_handler); return (pci_detach(dev)); } From owner-svn-src-all@freebsd.org Tue Oct 15 19:44:44 2019 Return-Path: Delivered-To: svn-src-all@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 CBFA7152CC2; Tue, 15 Oct 2019 19:44:44 +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 46t5VN4zlVz3GNB; Tue, 15 Oct 2019 19:44:44 +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 8E48223947; Tue, 15 Oct 2019 19:44:44 +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 x9FJiibE002610; Tue, 15 Oct 2019 19:44:44 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FJiibr002608; Tue, 15 Oct 2019 19:44:44 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201910151944.x9FJiibr002608@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 15 Oct 2019 19:44:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353588 - in head: share/man/man3 sys/sys X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head: share/man/man3 sys/sys X-SVN-Commit-Revision: 353588 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 19:44:44 -0000 Author: trasz Date: Tue Oct 15 19:44:43 2019 New Revision: 353588 URL: https://svnweb.freebsd.org/changeset/base/353588 Log: Add copyrights that I forgot to add when splitting arb.h off from tree.h. While here clean up the RCS tags. Suggested by: lstewart MFC after: 2 weeks Sponsored by: Klara Inc, Netflix Modified: head/share/man/man3/arb.3 head/sys/sys/arb.h Modified: head/share/man/man3/arb.3 ============================================================================== --- head/share/man/man3/arb.3 Tue Oct 15 19:12:09 2019 (r353587) +++ head/share/man/man3/arb.3 Tue Oct 15 19:44:43 2019 (r353588) @@ -1,6 +1,7 @@ .\" $OpenBSD: tree.3,v 1.7 2002/06/12 01:09:20 provos Exp $ .\" .\" Copyright 2002 Niels Provos +.\" Copyright 2018-2019 Netflix, Inc. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without Modified: head/sys/sys/arb.h ============================================================================== --- head/sys/sys/arb.h Tue Oct 15 19:12:09 2019 (r353587) +++ head/sys/sys/arb.h Tue Oct 15 19:44:43 2019 (r353588) @@ -1,11 +1,8 @@ -/* $NetBSD: tree.h,v 1.8 2004/03/28 19:38:30 provos Exp $ */ -/* $OpenBSD: tree.h,v 1.7 2002/10/17 21:51:54 art Exp $ */ -/* $FreeBSD$ */ - /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright 2002 Niels Provos + * Copyright 2018-2019 Netflix, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,6 +24,8 @@ * 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 _SYS_ARB_H_ From owner-svn-src-all@freebsd.org Tue Oct 15 20:04:17 2019 Return-Path: Delivered-To: svn-src-all@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 4040915318B; Tue, 15 Oct 2019 20:04:17 +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 46t5wx0xc4z3HZj; Tue, 15 Oct 2019 20:04:17 +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 02FCA23CEB; Tue, 15 Oct 2019 20:04:17 +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 x9FK4GL6014300; Tue, 15 Oct 2019 20:04:16 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FK4Fqg014293; Tue, 15 Oct 2019 20:04:15 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910152004.x9FK4Fqg014293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 15 Oct 2019 20:04:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353589 - in stable/11: contrib/sendmail/mail.local lib/libc/tests/nss usr.bin/tip/tip usr.sbin/fwcontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/11: contrib/sendmail/mail.local lib/libc/tests/nss usr.bin/tip/tip usr.sbin/fwcontrol X-SVN-Commit-Revision: 353589 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 20:04:17 -0000 Author: brooks Date: Tue Oct 15 20:04:15 2019 New Revision: 353589 URL: https://svnweb.freebsd.org/changeset/base/353589 Log: MFC r353326: Fix various -Wpointer-compare warnings This warning (comparing a pointer against a zero character literal rather than NULL) has existed since GCC 7.1.0, and was recently added to Clang trunk. Almost all of these are harmless, except for fwcontrol's str2node, which needs to both guard against dereferencing a NULL pointer (though in practice it appears none of the callers will ever pass one in), as well as ensure it doesn't parse the empty string as node 0 due to strtol's awkward interface. Submitted by: James Clarke Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21914 Modified: stable/11/contrib/sendmail/mail.local/mail.local.c stable/11/lib/libc/tests/nss/getgr_test.c stable/11/lib/libc/tests/nss/getproto_test.c stable/11/lib/libc/tests/nss/getrpc_test.c stable/11/lib/libc/tests/nss/getserv_test.c stable/11/usr.bin/tip/tip/acu.c stable/11/usr.sbin/fwcontrol/fwcontrol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/sendmail/mail.local/mail.local.c ============================================================================== --- stable/11/contrib/sendmail/mail.local/mail.local.c Tue Oct 15 19:44:43 2019 (r353588) +++ stable/11/contrib/sendmail/mail.local/mail.local.c Tue Oct 15 20:04:15 2019 (r353589) @@ -393,7 +393,7 @@ main(argc, argv) } /* Non-LMTP from here on out */ - if (*argv == '\0') + if (*argv == NULL) usage(); /* Modified: stable/11/lib/libc/tests/nss/getgr_test.c ============================================================================== --- stable/11/lib/libc/tests/nss/getgr_test.c Tue Oct 15 19:44:43 2019 (r353588) +++ stable/11/lib/libc/tests/nss/getgr_test.c Tue Oct 15 20:04:15 2019 (r353589) @@ -153,7 +153,7 @@ compare_group(struct group *grp1, struct group *grp2, if (strcmp(*c1, *c2) != 0) goto errfin; - if (*c1 != '\0' || *c2 != '\0') + if (*c1 != NULL || *c2 != NULL) goto errfin; return 0; @@ -182,7 +182,7 @@ sdump_group(struct group *grp, char *buffer, size_t bu buflen -= written; if (grp->gr_mem != NULL) { - if (*(grp->gr_mem) != '\0') { + if (*(grp->gr_mem) != NULL) { for (cp = grp->gr_mem; *cp; ++cp) { written = snprintf(buffer, buflen, "%s%s", cp == grp->gr_mem ? "" : ",", *cp); Modified: stable/11/lib/libc/tests/nss/getproto_test.c ============================================================================== --- stable/11/lib/libc/tests/nss/getproto_test.c Tue Oct 15 19:44:43 2019 (r353588) +++ stable/11/lib/libc/tests/nss/getproto_test.c Tue Oct 15 20:04:15 2019 (r353589) @@ -148,7 +148,7 @@ compare_protoent(struct protoent *pe1, struct protoent if (strcmp(*c1, *c2) != 0) goto errfin; - if ((*c1 != '\0') || (*c2 != '\0')) + if ((*c1 != NULL) || (*c2 != NULL)) goto errfin; return 0; @@ -177,7 +177,7 @@ sdump_protoent(struct protoent *pe, char *buffer, size buflen -= written; if (pe->p_aliases != NULL) { - if (*(pe->p_aliases) != '\0') { + if (*(pe->p_aliases) != NULL) { for (cp = pe->p_aliases; *cp; ++cp) { written = snprintf(buffer, buflen, " %s", *cp); buffer += written; Modified: stable/11/lib/libc/tests/nss/getrpc_test.c ============================================================================== --- stable/11/lib/libc/tests/nss/getrpc_test.c Tue Oct 15 19:44:43 2019 (r353588) +++ stable/11/lib/libc/tests/nss/getrpc_test.c Tue Oct 15 20:04:15 2019 (r353589) @@ -147,7 +147,7 @@ compare_rpcent(struct rpcent *rpc1, struct rpcent *rpc if (strcmp(*c1, *c2) != 0) goto errfin; - if ((*c1 != '\0') || (*c2 != '\0')) + if ((*c1 != NULL) || (*c2 != NULL)) goto errfin; return 0; @@ -176,7 +176,7 @@ sdump_rpcent(struct rpcent *rpc, char *buffer, size_t buflen -= written; if (rpc->r_aliases != NULL) { - if (*(rpc->r_aliases) != '\0') { + if (*(rpc->r_aliases) != NULL) { for (cp = rpc->r_aliases; *cp; ++cp) { written = snprintf(buffer, buflen, " %s", *cp); buffer += written; Modified: stable/11/lib/libc/tests/nss/getserv_test.c ============================================================================== --- stable/11/lib/libc/tests/nss/getserv_test.c Tue Oct 15 19:44:43 2019 (r353588) +++ stable/11/lib/libc/tests/nss/getserv_test.c Tue Oct 15 20:04:15 2019 (r353589) @@ -153,7 +153,7 @@ compare_servent(struct servent *serv1, struct servent if (strcmp(*c1, *c2) != 0) goto errfin; - if ((*c1 != '\0') || (*c2 != '\0')) + if ((*c1 != NULL) || (*c2 != NULL)) goto errfin; return 0; @@ -182,7 +182,7 @@ sdump_servent(struct servent *serv, char *buffer, size buflen -= written; if (serv->s_aliases != NULL) { - if (*(serv->s_aliases) != '\0') { + if (*(serv->s_aliases) != NULL) { for (cp = serv->s_aliases; *cp; ++cp) { written = snprintf(buffer, buflen, " %s", *cp); buffer += written; Modified: stable/11/usr.bin/tip/tip/acu.c ============================================================================== --- stable/11/usr.bin/tip/tip/acu.c Tue Oct 15 19:44:43 2019 (r353588) +++ stable/11/usr.bin/tip/tip/acu.c Tue Oct 15 20:04:15 2019 (r353589) @@ -188,7 +188,7 @@ acutype(char *s) acu_t *p; extern acu_t acutable[]; - for (p = acutable; p->acu_name != '\0'; p++) + for (p = acutable; p->acu_name != NULL; p++) if (!strcmp(s, p->acu_name)) return (p); return (NOACU); Modified: stable/11/usr.sbin/fwcontrol/fwcontrol.c ============================================================================== --- stable/11/usr.sbin/fwcontrol/fwcontrol.c Tue Oct 15 19:44:43 2019 (r353588) +++ stable/11/usr.sbin/fwcontrol/fwcontrol.c Tue Oct 15 20:04:15 2019 (r353589) @@ -127,7 +127,7 @@ str2node(int fd, const char *nodestr) char *endptr; int i, node; - if (nodestr == '\0') + if (nodestr == NULL || *nodestr == '\0') return (-1); /* From owner-svn-src-all@freebsd.org Tue Oct 15 20:08:20 2019 Return-Path: Delivered-To: svn-src-all@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 81B0715324E; Tue, 15 Oct 2019 20:08:20 +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 46t61c2xxYz3Hn6; Tue, 15 Oct 2019 20:08:20 +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 444D223CEC; Tue, 15 Oct 2019 20:08:20 +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 x9FK8KoK014536; Tue, 15 Oct 2019 20:08:20 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FK8KVI014535; Tue, 15 Oct 2019 20:08:20 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910152008.x9FK8KVI014535@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 15 Oct 2019 20:08:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353590 - stable/12/lib/msun/src X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/lib/msun/src X-SVN-Commit-Revision: 353590 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 20:08:20 -0000 Author: brooks Date: Tue Oct 15 20:08:19 2019 New Revision: 353590 URL: https://svnweb.freebsd.org/changeset/base/353590 Log: MFC r353329: msun: Silence new harmless -Wimplicit-int-float-conversion warnings Clang from trunk recently added a warning for when implicit int-to-float conversions cause a loss of precision. The code in question is designed to be able to handle that, so add explicit casts to silence this. Submitted by: James Clarke Reviewed by: dim Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21913 Modified: stable/12/lib/msun/src/s_lround.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/msun/src/s_lround.c ============================================================================== --- stable/12/lib/msun/src/s_lround.c Tue Oct 15 20:04:15 2019 (r353589) +++ stable/12/lib/msun/src/s_lround.c Tue Oct 15 20:08:19 2019 (r353590) @@ -49,9 +49,9 @@ __FBSDID("$FreeBSD$"); * that everything is in range. At compile time, INRANGE(x) should reduce to * two floating-point comparisons in the former case, or TRUE otherwise. */ -static const type dtype_min = DTYPE_MIN - 0.5; -static const type dtype_max = DTYPE_MAX + 0.5; -#define INRANGE(x) (dtype_max - DTYPE_MAX != 0.5 || \ +static const type dtype_min = (type)DTYPE_MIN - 0.5; +static const type dtype_max = (type)DTYPE_MAX + 0.5; +#define INRANGE(x) (dtype_max - (type)DTYPE_MAX != 0.5 || \ ((x) > dtype_min && (x) < dtype_max)) dtype From owner-svn-src-all@freebsd.org Tue Oct 15 20:10:48 2019 Return-Path: Delivered-To: svn-src-all@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 04C411532DC; Tue, 15 Oct 2019 20:10:48 +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 46t64R6Pbsz3HxQ; Tue, 15 Oct 2019 20:10:47 +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 C068C23D07; Tue, 15 Oct 2019 20:10:47 +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 x9FKAlt7015424; Tue, 15 Oct 2019 20:10:47 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FKAlN1015423; Tue, 15 Oct 2019 20:10:47 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910152010.x9FKAlN1015423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 15 Oct 2019 20:10:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353591 - stable/11/lib/msun/src X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/11/lib/msun/src X-SVN-Commit-Revision: 353591 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 20:10:48 -0000 Author: brooks Date: Tue Oct 15 20:10:47 2019 New Revision: 353591 URL: https://svnweb.freebsd.org/changeset/base/353591 Log: MFC r353329: msun: Silence new harmless -Wimplicit-int-float-conversion warnings Clang from trunk recently added a warning for when implicit int-to-float conversions cause a loss of precision. The code in question is designed to be able to handle that, so add explicit casts to silence this. Submitted by: James Clarke Reviewed by: dim Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21913 Modified: stable/11/lib/msun/src/s_lround.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/msun/src/s_lround.c ============================================================================== --- stable/11/lib/msun/src/s_lround.c Tue Oct 15 20:08:19 2019 (r353590) +++ stable/11/lib/msun/src/s_lround.c Tue Oct 15 20:10:47 2019 (r353591) @@ -47,9 +47,9 @@ __FBSDID("$FreeBSD$"); * that everything is in range. At compile time, INRANGE(x) should reduce to * two floating-point comparisons in the former case, or TRUE otherwise. */ -static const type dtype_min = DTYPE_MIN - 0.5; -static const type dtype_max = DTYPE_MAX + 0.5; -#define INRANGE(x) (dtype_max - DTYPE_MAX != 0.5 || \ +static const type dtype_min = (type)DTYPE_MIN - 0.5; +static const type dtype_max = (type)DTYPE_MAX + 0.5; +#define INRANGE(x) (dtype_max - (type)DTYPE_MAX != 0.5 || \ ((x) > dtype_min && (x) < dtype_max)) dtype From owner-svn-src-all@freebsd.org Tue Oct 15 20:32:48 2019 Return-Path: Delivered-To: svn-src-all@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 8E481153E0A for ; Tue, 15 Oct 2019 20:32:48 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-yw1-xc41.google.com (mail-yw1-xc41.google.com [IPv6:2607:f8b0:4864:20::c41]) (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 46t6Yq58BKz3KLX for ; Tue, 15 Oct 2019 20:32:47 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-yw1-xc41.google.com with SMTP id m13so7822267ywa.11 for ; Tue, 15 Oct 2019 13:32:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Fg0ZNGrBxlr9RcatlSrRD4gNDda2c4NSwlnv8B9sOLM=; b=Dnhp+eJanRy/XssmnAYOtygq4n8FOwwGJ+C7GdGskLvQnbAJrKZVgyUoAl36FdcJxw Ch8IM9xfIWBhaPleXku8oX6KH4qIbbmx/MYmu7IxHl0FJohX+Meo+hxsPzHGk5UAGQ+A 5k59/ZWw0g3IzfNViDprIEtOLAsQTUmkN4SHrmtbe4HKKHEZzAXMtftKyij1+SfJEq9K 5JsiA5MtVtCSnZNyg/rnQvAXI/rMcHAUy7tjGGS6IjQKtvABi35C5EIi+0R6NCC8cCSZ 5jPhBGMf+g+UhAaXsIx86XzAXzPNXppf99caFqyNe552GLKtI39PLpoQQIC19iHKDnHT U88w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Fg0ZNGrBxlr9RcatlSrRD4gNDda2c4NSwlnv8B9sOLM=; b=KJvJ6ZJJQHQjhAIj1fT66ooLraG1YIlOJ1QJri8w0HVJybDydEYJzES7wpsF7hYJ5/ 5BE8vBnTKRECqDtHz234EG3I7EM8J8Y8l/rNRYYDPYa0/c9AZNJXtyT0/2kCs7OP9ulM ubR9QPcBBMEEUjYikgcrhGhJUAUh0P4KFI33ggoiJ/RQmE4rxGtwrX2wA1mS8Hx6GffB 9A24zoxGjQBhIjclclu84i5ohkx4Ykip013Eti9o98OBTPeP6JNcnKSbMn18OJ4Bfpgz /0XaQfxpEmmT0nMW2Lm3hNfoEEiCwaPWsOPuwr1JY3773Wuj1aced3vQqGgeQS/UDm0V 2wkA== X-Gm-Message-State: APjAAAWDQp9h0z5AWW4cuHWR+kujnB+ZKdyMVLHHpif9HiWLLm1qexTX q/DiK4jH8dn5Cpy6d4QqCqpg1+aucueATqCeb2GF2g== X-Google-Smtp-Source: APXvYqwA6t0nvrWmk2tGlLa+OMzWvzpHZk9JcAfkFbREUQXRj25hu7GOo4G200QELHYa+LT0oDpAwomxxvaiShcJ0Qo= X-Received: by 2002:a81:5005:: with SMTP id e5mr15940468ywb.377.1571171566169; Tue, 15 Oct 2019 13:32:46 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:7b47:0:0:0:0:0 with HTTP; Tue, 15 Oct 2019 13:32:45 -0700 (PDT) In-Reply-To: <201910150345.x9F3jgYw028767@repo.freebsd.org> References: <201910150345.x9F3jgYw028767@repo.freebsd.org> From: Oliver Pinter Date: Tue, 15 Oct 2019 22:32:45 +0200 Message-ID: Subject: Re: svn commit: r353539 - in head/sys: amd64/sgx cddl/contrib/opensolaris/uts/common/fs/zfs compat/linuxkpi/common/src dev/drm2/ttm dev/md dev/netmap dev/xen/gntdev dev/xen/privcmd fs/nfsclient fs/smbf... To: Jeff Roberson Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 46t6Yq58BKz3KLX X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b=Dnhp+eJa; dmarc=none; spf=pass (mx1.freebsd.org: domain of oliver.pinter@hardenedbsd.org designates 2607:f8b0:4864:20::c41 as permitted sender) smtp.mailfrom=oliver.pinter@hardenedbsd.org X-Spamd-Result: default: False [-3.04 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; 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]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; MIME_BASE64_TEXT(0.10)[]; RCVD_IN_DNSWL_NONE(0.00)[1.4.c.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]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-0.64)[ip: (1.42), ipnet: 2607:f8b0::/32(-2.48), asn: 15169(-2.10), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 20:32:48 -0000 On Tuesday, October 15, 2019, Jeff Roberson wrote: > Author: jeff > Date: Tue Oct 15 03:45:41 2019 > New Revision: 353539 > URL: https://svnweb.freebsd.org/changeset/base/353539 > > Log: > (4/6) Protect page valid with the busy lock. > > Atomics are used for page busy and valid state when the shared busy is > held. The details of the locking protocol and valid and dirty > synchronization are in the updated vm_page.h comments. > > Reviewed by: kib, markj > Tested by: pho > Sponsored by: Netflix, Intel > Differential Revision: https://reviews.freebsd.org/D21594 > > Modified: > head/sys/amd64/sgx/sgx.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > head/sys/compat/linuxkpi/common/src/linux_compat.c > head/sys/dev/drm2/ttm/ttm_bo_vm.c > head/sys/dev/drm2/ttm/ttm_tt.c > head/sys/dev/md/md.c > head/sys/dev/netmap/netmap_freebsd.c > head/sys/dev/xen/gntdev/gntdev.c > head/sys/dev/xen/privcmd/privcmd.c > head/sys/fs/nfsclient/nfs_clbio.c > head/sys/fs/smbfs/smbfs_io.c > head/sys/fs/tmpfs/tmpfs_subr.c > head/sys/kern/kern_exec.c > head/sys/kern/uipc_shm.c > head/sys/kern/vfs_bio.c > head/sys/kern/vfs_cluster.c > head/sys/vm/device_pager.c > head/sys/vm/phys_pager.c > head/sys/vm/sg_pager.c > head/sys/vm/swap_pager.c > head/sys/vm/vm_fault.c > head/sys/vm/vm_map.c > head/sys/vm/vm_mmap.c > head/sys/vm/vm_object.c > head/sys/vm/vm_page.c > head/sys/vm/vm_page.h > head/sys/vm/vm_pageout.c > head/sys/vm/vm_swapout.c > head/sys/vm/vnode_pager.c > > Modified: head/sys/amd64/sgx/sgx.c > ============================================================ > ================== > --- head/sys/amd64/sgx/sgx.c Tue Oct 15 03:41:36 2019 (r353538) > +++ head/sys/amd64/sgx/sgx.c Tue Oct 15 03:45:41 2019 (r353539) > @@ -220,8 +220,8 @@ sgx_va_slot_init_by_index(struct sgx_softc *sc, vm_obj > > page = PHYS_TO_VM_PAGE(epc->phys); > > - vm_page_insert(page, object, idx); > page->valid = VM_PAGE_BITS_ALL; This wouldn't be vm_page_valid(page)? > + vm_page_insert(page, object, idx); > } > > return (0); > @@ -610,8 +610,8 @@ sgx_insert_epc_page_by_index(vm_page_t page, vm_object > > VM_OBJECT_ASSERT_WLOCKED(object); > > - vm_page_insert(page, object, pidx); > page->valid = VM_PAGE_BITS_ALL; And here too? > + vm_page_insert(page, object, pidx); > } > > static void > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c > ============================================================ > ================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Oct > 15 03:41:36 2019 (r353538) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Oct > 15 03:45:41 2019 (r353539) > @@ -1731,11 +1731,13 @@ dmu_read_pages(objset_t *os, uint64_t object, > vm_page_ > db = dbp[0]; > for (i = 0; i < *rbehind; i++) { > m = vm_page_grab(vmobj, ma[0]->pindex - 1 - i, > - VM_ALLOC_NORMAL | VM_ALLOC_NOWAIT | VM_ALLOC_NOBUSY); > + VM_ALLOC_NORMAL | VM_ALLOC_NOWAIT | > + VM_ALLOC_SBUSY | VM_ALLOC_IGN_SBUSY); > if (m == NULL) > break; > - if (m->valid != 0) { > + if (!vm_page_none_valid(m)) { > ASSERT3U(m->valid, ==, VM_PAGE_BITS_ALL); > + vm_page_sunbusy(m); > break; > } > ASSERT(m->dirty == 0); > @@ -1746,13 +1748,14 @@ dmu_read_pages(objset_t *os, uint64_t object, > vm_page_ > va = zfs_map_page(m, &sf); > bcopy((char *)db->db_data + bufoff, va, PAGESIZE); > zfs_unmap_page(sf); > - m->valid = VM_PAGE_BITS_ALL; > + vm_page_valid(m); > vm_page_lock(m); > if ((m->busy_lock & VPB_BIT_WAITERS) != 0) > vm_page_activate(m); > else > vm_page_deactivate(m); > vm_page_unlock(m); > + vm_page_sunbusy(m); > } > *rbehind = i; > > @@ -1763,7 +1766,7 @@ dmu_read_pages(objset_t *os, uint64_t object, > vm_page_ > m = ma[mi]; > if (m != bogus_page) { > vm_page_assert_xbusied(m); > - ASSERT(m->valid == 0); > + ASSERT(vm_page_none_valid(m)); > ASSERT(m->dirty == 0); > ASSERT(!pmap_page_is_mapped(m)); > va = zfs_map_page(m, &sf); > @@ -1791,7 +1794,7 @@ dmu_read_pages(objset_t *os, uint64_t object, > vm_page_ > if (pgoff == PAGESIZE) { > if (m != bogus_page) { > zfs_unmap_page(sf); > - m->valid = VM_PAGE_BITS_ALL; > + vm_page_valid(m); > } > ASSERT(mi < count); > mi++; > @@ -1840,16 +1843,18 @@ dmu_read_pages(objset_t *os, uint64_t object, > vm_page_ > ASSERT(m != bogus_page); > bzero(va + pgoff, PAGESIZE - pgoff); > zfs_unmap_page(sf); > - m->valid = VM_PAGE_BITS_ALL; > + vm_page_valid(m); > } > > for (i = 0; i < *rahead; i++) { > m = vm_page_grab(vmobj, ma[count - 1]->pindex + 1 + i, > - VM_ALLOC_NORMAL | VM_ALLOC_NOWAIT | VM_ALLOC_NOBUSY); > + VM_ALLOC_NORMAL | VM_ALLOC_NOWAIT | > + VM_ALLOC_SBUSY | VM_ALLOC_IGN_SBUSY); > if (m == NULL) > break; > - if (m->valid != 0) { > + if (!vm_page_none_valid(m)) { > ASSERT3U(m->valid, ==, VM_PAGE_BITS_ALL); > + vm_page_sunbusy(m); > break; > } > ASSERT(m->dirty == 0); > @@ -1866,13 +1871,14 @@ dmu_read_pages(objset_t *os, uint64_t object, > vm_page_ > bzero(va + tocpy, PAGESIZE - tocpy); > } > zfs_unmap_page(sf); > - m->valid = VM_PAGE_BITS_ALL; > + vm_page_valid(m); > vm_page_lock(m); > if ((m->busy_lock & VPB_BIT_WAITERS) != 0) > vm_page_activate(m); > else > vm_page_deactivate(m); > vm_page_unlock(m); > + vm_page_sunbusy(m); > } > *rahead = i; > zfs_vmobject_wunlock(vmobj); > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > ============================================================ > ================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > Tue Oct 15 03:41:36 2019 (r353538) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > Tue Oct 15 03:45:41 2019 (r353539) > @@ -534,7 +534,7 @@ mappedread_sf(vnode_t *vp, int nbytes, uio_t *uio) > > pp = vm_page_grab(obj, OFF_TO_IDX(start), VM_ALLOC_SBUSY | > VM_ALLOC_NORMAL | VM_ALLOC_IGN_SBUSY); > - if (pp->valid == 0) { > + if (vm_page_none_valid(pp)) { > zfs_vmobject_wunlock(obj); > va = zfs_map_page(pp, &sf); > error = dmu_read(os, zp->z_id, start, bytes, va, > @@ -543,17 +543,16 @@ mappedread_sf(vnode_t *vp, int nbytes, uio_t *uio) > bzero(va + bytes, PAGESIZE - bytes); > zfs_unmap_page(sf); > zfs_vmobject_wlock(obj); > - vm_page_sunbusy(pp); > - if (error) { > - if (!vm_page_busied(pp) && > !vm_page_wired(pp) && > - pp->valid == 0) > - vm_page_free(pp); > - } else { > - pp->valid = VM_PAGE_BITS_ALL; > + if (error == 0) { > + vm_page_valid(pp); > vm_page_lock(pp); > vm_page_activate(pp); > vm_page_unlock(pp); > } > + vm_page_sunbusy(pp); > + if (error != 0 && !vm_page_wired(pp) == 0 && > + pp->valid == 0 && vm_page_tryxbusy(pp)) > + vm_page_free(pp); > } else { > ASSERT3U(pp->valid, ==, VM_PAGE_BITS_ALL); > vm_page_sunbusy(pp); > > Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c > ============================================================ > ================== > --- head/sys/compat/linuxkpi/common/src/linux_compat.c Tue Oct 15 > 03:41:36 2019 (r353538) > +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Tue Oct 15 > 03:45:41 2019 (r353539) > @@ -514,7 +514,7 @@ linux_cdev_pager_fault(vm_object_t vm_obj, vm_ooffset_ > vm_page_free(*mres); > *mres = page; > } > - page->valid = VM_PAGE_BITS_ALL; > + vm_page_valid(page); > return (VM_PAGER_OK); > } > return (VM_PAGER_FAIL); > > Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c > ============================================================ > ================== > --- head/sys/dev/drm2/ttm/ttm_bo_vm.c Tue Oct 15 03:41:36 2019 > (r353538) > +++ head/sys/dev/drm2/ttm/ttm_bo_vm.c Tue Oct 15 03:45:41 2019 > (r353539) > @@ -252,7 +252,7 @@ reserve: > ("inconsistent insert bo %p m %p m1 %p offset %jx", > bo, m, m1, (uintmax_t)offset)); > } > - m->valid = VM_PAGE_BITS_ALL; > + vm_page_valid(m); > if (*mres != NULL) { > KASSERT(*mres != m, ("losing %p %p", *mres, m)); > vm_page_free(*mres); > > Modified: head/sys/dev/drm2/ttm/ttm_tt.c > ============================================================ > ================== > --- head/sys/dev/drm2/ttm/ttm_tt.c Tue Oct 15 03:41:36 2019 > (r353538) > +++ head/sys/dev/drm2/ttm/ttm_tt.c Tue Oct 15 03:45:41 2019 > (r353539) > @@ -344,7 +344,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, vm_object_t per > continue; > to_page = vm_page_grab(obj, i, VM_ALLOC_NORMAL); > pmap_copy_page(from_page, to_page); > - to_page->valid = VM_PAGE_BITS_ALL; > + vm_page_valid(to_page); > vm_page_dirty(to_page); > vm_page_xunbusy(to_page); > } > > Modified: head/sys/dev/md/md.c > ============================================================ > ================== > --- head/sys/dev/md/md.c Tue Oct 15 03:41:36 2019 (r353538) > +++ head/sys/dev/md/md.c Tue Oct 15 03:45:41 2019 (r353539) > @@ -1074,7 +1074,7 @@ mdstart_swap(struct md_s *sc, struct bio *bp) > len = ((i == lastp) ? lastend : PAGE_SIZE) - offs; > m = vm_page_grab(sc->object, i, VM_ALLOC_SYSTEM); > if (bp->bio_cmd == BIO_READ) { > - if (m->valid == VM_PAGE_BITS_ALL) > + if (vm_page_all_valid(m)) > rv = VM_PAGER_OK; > else > rv = vm_pager_get_pages(sc->object, &m, 1, > @@ -1090,7 +1090,7 @@ mdstart_swap(struct md_s *sc, struct bio *bp) > * can be recreated if thrown out. > */ > pmap_zero_page(m); > - m->valid = VM_PAGE_BITS_ALL; > + vm_page_valid(m); > } > if ((bp->bio_flags & BIO_UNMAPPED) != 0) { > pmap_copy_pages(&m, offs, bp->bio_ma, > @@ -1104,7 +1104,7 @@ mdstart_swap(struct md_s *sc, struct bio *bp) > cpu_flush_dcache(p, len); > } > } else if (bp->bio_cmd == BIO_WRITE) { > - if (len == PAGE_SIZE || m->valid == > VM_PAGE_BITS_ALL) > + if (len == PAGE_SIZE || vm_page_all_valid(m)) > rv = VM_PAGER_OK; > else > rv = vm_pager_get_pages(sc->object, &m, 1, > @@ -1125,13 +1125,13 @@ mdstart_swap(struct md_s *sc, struct bio *bp) > physcopyin(p, VM_PAGE_TO_PHYS(m) + offs, > len); > } > > - m->valid = VM_PAGE_BITS_ALL; > + vm_page_valid(m); > if (m->dirty != VM_PAGE_BITS_ALL) { > vm_page_dirty(m); > vm_pager_page_unswapped(m); > } > } else if (bp->bio_cmd == BIO_DELETE) { > - if (len == PAGE_SIZE || m->valid == > VM_PAGE_BITS_ALL) > + if (len == PAGE_SIZE || vm_page_all_valid(m)) > rv = VM_PAGER_OK; > else > rv = vm_pager_get_pages(sc->object, &m, 1, > > Modified: head/sys/dev/netmap/netmap_freebsd.c > ============================================================ > ================== > --- head/sys/dev/netmap/netmap_freebsd.c Tue Oct 15 03:41:36 2019 > (r353538) > +++ head/sys/dev/netmap/netmap_freebsd.c Tue Oct 15 03:45:41 2019 > (r353539) > @@ -1056,7 +1056,7 @@ netmap_dev_pager_fault(vm_object_t object, > vm_ooffset_ > *mres = page; > vm_page_insert(page, object, pidx); > } > - page->valid = VM_PAGE_BITS_ALL; > + vm_page_valid(page); > return (VM_PAGER_OK); > } > > > Modified: head/sys/dev/xen/gntdev/gntdev.c > ============================================================ > ================== > --- head/sys/dev/xen/gntdev/gntdev.c Tue Oct 15 03:41:36 2019 > (r353538) > +++ head/sys/dev/xen/gntdev/gntdev.c Tue Oct 15 03:45:41 2019 > (r353539) > @@ -836,8 +836,8 @@ gntdev_gmap_pg_fault(vm_object_t object, vm_ooffset_t > } > > vm_page_busy_acquire(page, 0); > + vm_page_valid(page); > vm_page_insert(page, object, pidx); > - page->valid = VM_PAGE_BITS_ALL; > *mres = page; > return (VM_PAGER_OK); > } > > Modified: head/sys/dev/xen/privcmd/privcmd.c > ============================================================ > ================== > --- head/sys/dev/xen/privcmd/privcmd.c Tue Oct 15 03:41:36 2019 > (r353538) > +++ head/sys/dev/xen/privcmd/privcmd.c Tue Oct 15 03:45:41 2019 > (r353539) > @@ -179,8 +179,8 @@ privcmd_pg_fault(vm_object_t object, vm_ooffset_t offs > } > > vm_page_busy_acquire(page, 0); > + vm_page_valid(page); > vm_page_insert(page, object, pidx); > - page->valid = VM_PAGE_BITS_ALL; > *mres = page; > return (VM_PAGER_OK); > } > > Modified: head/sys/fs/nfsclient/nfs_clbio.c > ============================================================ > ================== > --- head/sys/fs/nfsclient/nfs_clbio.c Tue Oct 15 03:41:36 2019 > (r353538) > +++ head/sys/fs/nfsclient/nfs_clbio.c Tue Oct 15 03:45:41 2019 > (r353539) > @@ -174,7 +174,7 @@ ncl_getpages(struct vop_getpages_args *ap) > * XXXGL: is that true for NFS, where short read can occur??? > */ > VM_OBJECT_WLOCK(object); > - if (pages[npages - 1]->valid != 0 && --npages == 0) > + if (!vm_page_none_valid(pages[npages - 1]) && --npages == 0) > goto out; > VM_OBJECT_WUNLOCK(object); > > @@ -227,14 +227,14 @@ ncl_getpages(struct vop_getpages_args *ap) > /* > * Read operation filled an entire page > */ > - m->valid = VM_PAGE_BITS_ALL; > + vm_page_valid(m); > KASSERT(m->dirty == 0, > ("nfs_getpages: page %p is dirty", m)); > } else if (size > toff) { > /* > * Read operation filled a partial page. > */ > - m->valid = 0; > + vm_page_invalid(m); > vm_page_set_valid_range(m, 0, size - toff); > KASSERT(m->dirty == 0, > ("nfs_getpages: page %p is dirty", m)); > > Modified: head/sys/fs/smbfs/smbfs_io.c > ============================================================ > ================== > --- head/sys/fs/smbfs/smbfs_io.c Tue Oct 15 03:41:36 2019 > (r353538) > +++ head/sys/fs/smbfs/smbfs_io.c Tue Oct 15 03:45:41 2019 > (r353539) > @@ -457,7 +457,7 @@ smbfs_getpages(ap) > * XXXGL: is that true for SMB filesystem? > */ > VM_OBJECT_WLOCK(object); > - if (pages[npages - 1]->valid != 0 && --npages == 0) > + if (!vm_page_none_valid(pages[npages - 1]) && --npages == 0) > goto out; > VM_OBJECT_WUNLOCK(object); > > @@ -505,14 +505,14 @@ smbfs_getpages(ap) > /* > * Read operation filled an entire page > */ > - m->valid = VM_PAGE_BITS_ALL; > + vm_page_valid(m); > KASSERT(m->dirty == 0, > ("smbfs_getpages: page %p is dirty", m)); > } else if (size > toff) { > /* > * Read operation filled a partial page. > */ > - m->valid = 0; > + vm_page_invalid(m); > vm_page_set_valid_range(m, 0, size - toff); > KASSERT(m->dirty == 0, > ("smbfs_getpages: page %p is dirty", m)); > > Modified: head/sys/fs/tmpfs/tmpfs_subr.c > ============================================================ > ================== > --- head/sys/fs/tmpfs/tmpfs_subr.c Tue Oct 15 03:41:36 2019 > (r353538) > +++ head/sys/fs/tmpfs/tmpfs_subr.c Tue Oct 15 03:45:41 2019 > (r353539) > @@ -1408,7 +1408,7 @@ tmpfs_reg_resize(struct vnode *vp, off_t newsize, > bool > retry: > m = vm_page_grab(uobj, idx, VM_ALLOC_NOCREAT); > if (m != NULL) { > - MPASS(m->valid == VM_PAGE_BITS_ALL); > + MPASS(vm_page_all_valid(m)); > } else if (vm_pager_has_page(uobj, idx, NULL, > NULL)) { > m = vm_page_alloc(uobj, idx, > VM_ALLOC_NORMAL | > VM_ALLOC_WAITFAIL); > > Modified: head/sys/kern/kern_exec.c > ============================================================ > ================== > --- head/sys/kern/kern_exec.c Tue Oct 15 03:41:36 2019 (r353538) > +++ head/sys/kern/kern_exec.c Tue Oct 15 03:45:41 2019 (r353539) > @@ -979,11 +979,15 @@ exec_map_first_page(struct image_params *imgp) > retry: > ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | > VM_ALLOC_WIRED); > - if (ma[0]->valid != VM_PAGE_BITS_ALL) { > + if (!vm_page_all_valid(ma[0])) { > if (vm_page_busy_acquire(ma[0], VM_ALLOC_WAITFAIL) == 0) { > vm_page_unwire_noq(ma[0]); > goto retry; > } > + if (vm_page_all_valid(ma[0])) { > + vm_page_xunbusy(ma[0]); > + goto out; > + } > if (!vm_pager_has_page(object, 0, NULL, &after)) { > if (vm_page_unwire_noq(ma[0])) > vm_page_free(ma[0]); > @@ -1029,6 +1033,8 @@ retry: > for (i = 1; i < initial_pagein; i++) > vm_page_readahead_finish(ma[i]); > } > + > +out: > VM_OBJECT_WUNLOCK(object); > > imgp->firstpage = sf_buf_alloc(ma[0], 0); > > Modified: head/sys/kern/uipc_shm.c > ============================================================ > ================== > --- head/sys/kern/uipc_shm.c Tue Oct 15 03:41:36 2019 (r353538) > +++ head/sys/kern/uipc_shm.c Tue Oct 15 03:45:41 2019 (r353539) > @@ -459,7 +459,7 @@ shm_dotruncate_locked(struct shmfd *shmfd, off_t lengt > retry: > m = vm_page_grab(object, idx, VM_ALLOC_NOCREAT); > if (m != NULL) { > - MPASS(m->valid == VM_PAGE_BITS_ALL); > + MPASS(vm_page_all_valid(m)); > } else if (vm_pager_has_page(object, idx, NULL, > NULL)) { > m = vm_page_alloc(object, idx, > VM_ALLOC_NORMAL | VM_ALLOC_WAITFAIL); > @@ -485,7 +485,7 @@ retry: > } > if (m != NULL) { > pmap_zero_page_area(m, base, PAGE_SIZE - > base); > - KASSERT(m->valid == VM_PAGE_BITS_ALL, > + KASSERT(vm_page_all_valid(m), > ("shm_dotruncate: page %p is invalid", > m)); > vm_page_dirty(m); > vm_page_xunbusy(m); > > Modified: head/sys/kern/vfs_bio.c > ============================================================ > ================== > --- head/sys/kern/vfs_bio.c Tue Oct 15 03:41:36 2019 (r353538) > +++ head/sys/kern/vfs_bio.c Tue Oct 15 03:45:41 2019 (r353539) > @@ -956,6 +956,12 @@ vfs_buf_test_cache(struct buf *bp, vm_ooffset_t foff, > { > > VM_OBJECT_ASSERT_LOCKED(m->object); > + > + /* > + * This function and its results are protected by higher level > + * synchronization requiring vnode and buf locks to page in and > + * validate pages. > + */ > if (bp->b_flags & B_CACHE) { > int base = (foff + off) & PAGE_MASK; > if (vm_page_is_valid(m, base, size) == 0) > @@ -4640,7 +4646,7 @@ vfs_busy_pages(struct buf *bp, int clear_modify) > if (clear_modify) { > pmap_remove_write(m); > vfs_page_set_validclean(bp, foff, m); > - } else if (m->valid == VM_PAGE_BITS_ALL && > + } else if (vm_page_all_valid(m) && > (bp->b_flags & B_CACHE) == 0) { > bp->b_pages[i] = bogus_page; > bogus = true; > @@ -4681,6 +4687,14 @@ vfs_bio_set_valid(struct buf *bp, int base, int > size) > n = PAGE_SIZE - (base & PAGE_MASK); > > VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); > + > + /* > + * Busy may not be strictly necessary here because the pages are > + * unlikely to be fully valid and the vnode lock will synchronize > + * their access via getpages. It is grabbed for consistency with > + * other page validation. > + */ > + vfs_busy_pages_acquire(bp); > for (i = base / PAGE_SIZE; size > 0 && i < bp->b_npages; ++i) { > m = bp->b_pages[i]; > if (n > size) > @@ -4690,6 +4704,7 @@ vfs_bio_set_valid(struct buf *bp, int base, int size) > size -= n; > n = PAGE_SIZE; > } > + vfs_busy_pages_release(bp); > VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); > } > > @@ -4717,6 +4732,7 @@ vfs_bio_clrbuf(struct buf *bp) > bp->b_flags &= ~B_INVAL; > bp->b_ioflags &= ~BIO_ERROR; > VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); > + vfs_busy_pages_acquire(bp); > if ((bp->b_npages == 1) && (bp->b_bufsize < PAGE_SIZE) && > (bp->b_offset & PAGE_MASK) == 0) { > if (bp->b_pages[0] == bogus_page) > @@ -4758,6 +4774,7 @@ vfs_bio_clrbuf(struct buf *bp) > bp->b_pages[i]->valid |= mask; > } > unlock: > + vfs_busy_pages_release(bp); > VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); > bp->b_resid = 0; > } > @@ -5189,7 +5206,7 @@ again: > * the end of the function catches the race in a > * reliable way (protected by the object lock). > */ > - if (m->valid == VM_PAGE_BITS_ALL) > + if (vm_page_all_valid(m)) > continue; > > poff = IDX_TO_OFF(m->pindex); > @@ -5219,7 +5236,7 @@ again: > * cache pressure. > */ > if (buf_pager_relbuf || > - m->valid != VM_PAGE_BITS_ALL) > + !vm_page_all_valid(m)) > bp->b_flags |= B_RELBUF; > > bp->b_flags &= ~B_NOCACHE; > @@ -5229,12 +5246,12 @@ again: > } > } > KASSERT(1 /* racy, enable for debugging */ || > - m->valid == VM_PAGE_BITS_ALL || i == count - 1, > + vm_page_all_valid(m) || i == count - 1, > ("buf %d %p invalid", i, m)); > if (i == count - 1 && lpart) { > VM_OBJECT_WLOCK(object); > - if (m->valid != 0 && > - m->valid != VM_PAGE_BITS_ALL) > + if (!vm_page_none_valid(m) && > + !vm_page_all_valid(m)) > vm_page_zero_invalid(m, TRUE); > VM_OBJECT_WUNLOCK(object); > } > @@ -5261,7 +5278,7 @@ end_pages: > * invalidated or removed, so we must restart for > * safety as well. > */ > - if (ma[i]->valid != VM_PAGE_BITS_ALL) > + if (!vm_page_all_valid(ma[i])) > redo = true; > } > if (redo && error == 0) > > Modified: head/sys/kern/vfs_cluster.c > ============================================================ > ================== > --- head/sys/kern/vfs_cluster.c Tue Oct 15 03:41:36 2019 (r353538) > +++ head/sys/kern/vfs_cluster.c Tue Oct 15 03:45:41 2019 (r353539) > @@ -465,11 +465,13 @@ cluster_rbuild(struct vnode *vp, u_quad_t filesize, > da > if (toff + tinc > PAGE_SIZE) > tinc = PAGE_SIZE - toff; > VM_OBJECT_ASSERT_WLOCKED(tbp-> > b_pages[j]->object); > - if ((tbp->b_pages[j]->valid & > - vm_page_bits(toff, tinc)) != 0) > - break; > if (vm_page_trysbusy(tbp->b_pages[j]) == > 0) > break; > + if ((tbp->b_pages[j]->valid & > + vm_page_bits(toff, tinc)) != 0) { > + vm_page_sunbusy(tbp->b_pages[j]); > + break; > + } > vm_object_pip_add(tbp->b_bufobj->bo_object, > 1); > off += tinc; > tsize -= tinc; > @@ -524,7 +526,7 @@ clean_sbusy: > bp->b_pages[bp->b_npages] = m; > bp->b_npages++; > } > - if (m->valid == VM_PAGE_BITS_ALL) > + if (vm_page_all_valid(m)) > tbp->b_pages[j] = bogus_page; > } > VM_OBJECT_WUNLOCK(tbp->b_bufobj->bo_object); > @@ -548,7 +550,7 @@ clean_sbusy: > VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); > for (j = 0; j < bp->b_npages; j++) { > VM_OBJECT_ASSERT_WLOCKED(bp->b_pages[j]->object); > - if (bp->b_pages[j]->valid == VM_PAGE_BITS_ALL) > + if (vm_page_all_valid(bp->b_pages[j])) > bp->b_pages[j] = bogus_page; > } > VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); > > Modified: head/sys/vm/device_pager.c > ============================================================ > ================== > --- head/sys/vm/device_pager.c Tue Oct 15 03:41:36 2019 (r353538) > +++ head/sys/vm/device_pager.c Tue Oct 15 03:45:41 2019 (r353539) > @@ -395,7 +395,7 @@ old_dev_pager_fault(vm_object_t object, vm_ooffset_t o > vm_page_free(*mres); > *mres = page; > } > - page->valid = VM_PAGE_BITS_ALL; > + vm_page_valid(page); > return (VM_PAGER_OK); > } > > > Modified: head/sys/vm/phys_pager.c > ============================================================ > ================== > --- head/sys/vm/phys_pager.c Tue Oct 15 03:41:36 2019 (r353538) > +++ head/sys/vm/phys_pager.c Tue Oct 15 03:45:41 2019 (r353539) > @@ -145,12 +145,12 @@ phys_pager_getpages(vm_object_t object, vm_page_t > *m, > > VM_OBJECT_ASSERT_WLOCKED(object); > for (i = 0; i < count; i++) { > - if (m[i]->valid == 0) { > + if (vm_page_none_valid(m[i])) { > if ((m[i]->flags & PG_ZERO) == 0) > pmap_zero_page(m[i]); > - m[i]->valid = VM_PAGE_BITS_ALL; > + vm_page_valid(m[i]); > } > - KASSERT(m[i]->valid == VM_PAGE_BITS_ALL, > + KASSERT(vm_page_all_valid(m[i]), > ("phys_pager_getpages: partially valid page %p", > m[i])); > KASSERT(m[i]->dirty == 0, > ("phys_pager_getpages: dirty page %p", m[i])); > @@ -209,10 +209,8 @@ phys_pager_populate(vm_object_t object, vm_pindex_t > pi > ahead = MIN(end - i, PHYSALLOC); > m = vm_page_grab(object, i, > VM_ALLOC_NORMAL | VM_ALLOC_COUNT(ahead)); > - if (m->valid != VM_PAGE_BITS_ALL) { > + if (!vm_page_all_valid(m)) > vm_page_zero_invalid(m, TRUE); > - m->valid = VM_PAGE_BITS_ALL; > - } > KASSERT(m->dirty == 0, > ("phys_pager_populate: dirty page %p", m)); > } > > Modified: head/sys/vm/sg_pager.c > ============================================================ > ================== > --- head/sys/vm/sg_pager.c Tue Oct 15 03:41:36 2019 (r353538) > +++ head/sys/vm/sg_pager.c Tue Oct 15 03:45:41 2019 (r353539) > @@ -198,7 +198,7 @@ sg_pager_getpages(vm_object_t object, vm_page_t *m, in > vm_page_free(m[0]); > vm_page_unlock(m[0]); > m[0] = page; > - page->valid = VM_PAGE_BITS_ALL; > + vm_page_valid(page); > > if (rbehind) > *rbehind = 0; > > Modified: head/sys/vm/swap_pager.c > ============================================================ > ================== > --- head/sys/vm/swap_pager.c Tue Oct 15 03:41:36 2019 (r353538) > +++ head/sys/vm/swap_pager.c Tue Oct 15 03:45:41 2019 (r353539) > @@ -1554,7 +1554,7 @@ swp_pager_async_iodone(struct buf *bp) > * be overridden by the original caller of > * getpages so don't play cute tricks here. > */ > - m->valid = 0; > + vm_page_invalid(m); > } else { > /* > * If a write error occurs, reactivate page > @@ -1582,7 +1582,7 @@ swp_pager_async_iodone(struct buf *bp) > KASSERT(m->dirty == 0, > ("swp_pager_async_iodone: page %p is dirty", > m)); > > - m->valid = VM_PAGE_BITS_ALL; > + vm_page_valid(m); > if (i < bp->b_pgbefore || > i >= bp->b_npages - bp->b_pgafter) > vm_page_readahead_finish(m); > > Modified: head/sys/vm/vm_fault.c > ============================================================ > ================== > --- head/sys/vm/vm_fault.c Tue Oct 15 03:41:36 2019 (r353538) > +++ head/sys/vm/vm_fault.c Tue Oct 15 03:45:41 2019 (r353539) > @@ -211,6 +211,7 @@ vm_fault_dirty(vm_map_entry_t entry, vm_page_t m, vm_p > return; > > VM_OBJECT_ASSERT_LOCKED(m->object); > + VM_PAGE_OBJECT_BUSY_ASSERT(m); > > need_dirty = ((fault_type & VM_PROT_WRITE) != 0 && > (fault_flags & VM_FAULT_WIRE) == 0) || > @@ -285,7 +286,7 @@ vm_fault_soft_fast(struct faultstate *fs, vm_offset_t > m = vm_page_lookup(fs->first_object, fs->first_pindex); > /* A busy page can be mapped for read|execute access. */ > if (m == NULL || ((prot & VM_PROT_WRITE) != 0 && > - vm_page_busied(m)) || m->valid != VM_PAGE_BITS_ALL) { > + vm_page_busied(m)) || !vm_page_all_valid(m)) { > rv = KERN_FAILURE; > goto out; > } > @@ -368,7 +369,7 @@ vm_fault_populate_check_page(vm_page_t m) > * valid, and exclusively busied. > */ > MPASS(m != NULL); > - MPASS(m->valid == VM_PAGE_BITS_ALL); > + MPASS(vm_page_all_valid(m)); > MPASS(vm_page_xbusied(m)); > } > > @@ -830,7 +831,7 @@ RetryFault_oom: > * (readable), jump to readrest, else break-out ( > we > * found the page ). > */ > - if (fs.m->valid != VM_PAGE_BITS_ALL) > + if (!vm_page_all_valid(fs.m)) > goto readrest; > break; /* break to PAGE HAS BEEN FOUND */ > } > @@ -1154,7 +1155,7 @@ readrest: > VM_CNT_INC(v_ozfod); > } > VM_CNT_INC(v_zfod); > - fs.m->valid = VM_PAGE_BITS_ALL; > + vm_page_valid(fs.m); > /* Don't try to prefault neighboring pages. */ > faultcount = 1; > break; /* break to PAGE HAS BEEN FOUND */ > @@ -1245,7 +1246,7 @@ readrest: > * Oh, well, lets copy it. > */ > pmap_copy_page(fs.m, fs.first_m); > - fs.first_m->valid = VM_PAGE_BITS_ALL; > + vm_page_valid(fs.first_m); > if (wired && (fault_flags & > VM_FAULT_WIRE) == 0) { > vm_page_wire(fs.first_m); > @@ -1364,7 +1365,7 @@ readrest: > * Page must be completely valid or it is not fit to > * map into user space. vm_pager_get_pages() ensures this. > */ > - KASSERT(fs.m->valid == VM_PAGE_BITS_ALL, > + KASSERT(vm_page_all_valid(fs.m), > ("vm_fault: page %p partially invalid", fs.m)); > VM_OBJECT_WUNLOCK(fs.object); > > @@ -1480,7 +1481,7 @@ vm_fault_dontneed(const struct faultstate *fs, > vm_offs > entry->start); > while ((m = m_next) != NULL && m->pindex < pend) { > m_next = TAILQ_NEXT(m, listq); > - if (m->valid != VM_PAGE_BITS_ALL || > + if (!vm_page_all_valid(m) || > vm_page_busied(m)) > continue; > > @@ -1577,7 +1578,7 @@ vm_fault_prefault(const struct faultstate *fs, > vm_offs > VM_OBJECT_RUNLOCK(lobject); > break; > } > - if (m->valid == VM_PAGE_BITS_ALL && > + if (vm_page_all_valid(m) && > (m->flags & PG_FICTITIOUS) == 0) > pmap_enter_quick(pmap, addr, m, entry->protection); > if (!obj_locked || lobject != entry->object.vm_object) > @@ -1852,7 +1853,7 @@ again: > * all copies of the wired map entry have similar > * backing pages. > */ > - if (dst_m->valid == VM_PAGE_BITS_ALL) { > + if (vm_page_all_valid(dst_m)) { > pmap_enter(dst_map->pmap, vaddr, dst_m, prot, > access | (upgrade ? PMAP_ENTER_WIRED : 0), 0); > } > > Modified: head/sys/vm/vm_map.c > ============================================================ > ================== > --- head/sys/vm/vm_map.c Tue Oct 15 03:41:36 2019 (r353538) > +++ head/sys/vm/vm_map.c Tue Oct 15 03:45:41 2019 (r353539) > @@ -2358,7 +2358,7 @@ vm_map_pmap_enter(vm_map_t map, vm_offset_t addr, > vm_p > psize = tmpidx; > break; > } > - if (p->valid == VM_PAGE_BITS_ALL) { > + if (vm_page_all_valid(p)) { > if (p_start == NULL) { > start = addr + ptoa(tmpidx); > p_start = p; > > Modified: head/sys/vm/vm_mmap.c > ============================================================ > ================== > --- head/sys/vm/vm_mmap.c Tue Oct 15 03:41:36 2019 (r353538) > +++ head/sys/vm/vm_mmap.c Tue Oct 15 03:45:41 2019 (r353539) > @@ -893,7 +893,7 @@ RestartScan: > } > } else > vm_page_unlock(m); > - KASSERT(m->valid == VM_PAGE_BITS_ALL, > + KASSERT(vm_page_all_valid(m), > ("mincore: page %p is mapped but > invalid", > m)); > } else if (mincoreinfo == 0) { > @@ -915,7 +915,7 @@ RestartScan: > pindex = > OFF_TO_IDX(current->offset + > (addr - current->start)); > m = vm_page_lookup(object, pindex); > - if (m != NULL && m->valid == 0) > + if (m != NULL && > vm_page_none_valid(m)) > m = NULL; > if (m != NULL) > mincoreinfo = > MINCORE_INCORE; > > Modified: head/sys/vm/vm_object.c > ============================================================ > ================== > --- head/sys/vm/vm_object.c Tue Oct 15 03:41:36 2019 (r353538) > +++ head/sys/vm/vm_object.c Tue Oct 15 03:45:41 2019 (r353539) > @@ -841,7 +841,7 @@ rescan: > if (pi >= tend) > break; > np = TAILQ_NEXT(p, listq); > - if (p->valid == 0) > + if (vm_page_none_valid(p)) > continue; > if (vm_page_busy_acquire(p, VM_ALLOC_WAITFAIL) == 0) { > if (object->generation != curgeneration) { > @@ -1161,10 +1161,10 @@ next_page: > } > > /* > - * If the page is not in a normal state, skip it. > + * If the page is not in a normal state, skip it. The page > + * can not be invalidated while the object lock is held. > */ > - if (tm->valid != VM_PAGE_BITS_ALL || > - vm_page_wired(tm)) > + if (!vm_page_all_valid(tm) || vm_page_wired(tm)) > goto next_pindex; > KASSERT((tm->flags & PG_FICTITIOUS) == 0, > ("vm_object_madvise: page %p is fictitious", tm)); > @@ -1488,7 +1488,11 @@ vm_object_scan_all_shadowed(vm_object_t object) > * object and we might as well give up now. > */ > pp = vm_page_lookup(object, new_pindex); > - if ((pp == NULL || pp->valid == 0) && > + /* > + * The valid check here is stable due to object lock being > + * required to clear valid and initiate paging. > + */ > + if ((pp == NULL || vm_page_none_valid(pp)) && > !vm_pager_has_page(object, new_pindex, NULL, NULL)) > return (false); > } > @@ -1567,7 +1571,7 @@ vm_object_collapse_scan(vm_object_t object, int op) > continue; > } > > - KASSERT(pp == NULL || pp->valid != 0, > + KASSERT(pp == NULL || !vm_page_none_valid(pp), > ("unbusy invalid page %p", pp)); > > if (pp != NULL || vm_pager_has_page(object, new_pindex, > NULL, > @@ -1894,7 +1898,7 @@ wired: > object->ref_count != 0) > pmap_remove_all(p); > if ((options & OBJPR_CLEANONLY) == 0) { > - p->valid = 0; > + vm_page_invalid(p); > vm_page_undirty(p); > } > vm_page_xunbusy(p); > @@ -1902,7 +1906,8 @@ wired: > } > KASSERT((p->flags & PG_FICTITIOUS) == 0, > ("vm_object_page_remove: page %p is fictitious", p)); > - if ((options & OBJPR_CLEANONLY) != 0 && p->valid != 0) { > + if ((options & OBJPR_CLEANONLY) != 0 && > + !vm_page_none_valid(p)) { > if ((options & OBJPR_NOTMAPPED) == 0 && > From owner-svn-src-all@freebsd.org Tue Oct 15 21:08:50 2019 Return-Path: Delivered-To: svn-src-all@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 D16DC1548E8; Tue, 15 Oct 2019 21:08:50 +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 46t7MQ5HRnz3MCf; Tue, 15 Oct 2019 21:08:50 +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 94656247DB; Tue, 15 Oct 2019 21:08:50 +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 x9FL8oDP049445; Tue, 15 Oct 2019 21:08:50 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FL8ooW049443; Tue, 15 Oct 2019 21:08:50 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910152108.x9FL8ooW049443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 15 Oct 2019 21:08:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353592 - in head: . share/mk X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head: . share/mk X-SVN-Commit-Revision: 353592 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 21:08:50 -0000 Author: brooks Date: Tue Oct 15 21:08:49 2019 New Revision: 353592 URL: https://svnweb.freebsd.org/changeset/base/353592 Log: Move the per-ARCH definitions to bsd.compat.mk. This is the first step if refactoring the definitions to allow programs to be selectively linked against libcompat libraries. Reviewed by: bdrewery Sponsored by: DARPA, AFRL Added: head/share/mk/bsd.compat.mk (contents, props changed) Modified: head/Makefile.libcompat Modified: head/Makefile.libcompat ============================================================================== --- head/Makefile.libcompat Tue Oct 15 20:10:47 2019 (r353591) +++ head/Makefile.libcompat Tue Oct 15 21:08:49 2019 (r353592) @@ -6,101 +6,7 @@ __<${_this:T}>__: # Makefile for the compatibility libraries. # - 32-bit compat libraries on MIPS, PowerPC, and AMD64. -# ------------------------------------------------------------------- -# 32 bit world -.if ${TARGET_ARCH} == "amd64" -.if empty(TARGET_CPUTYPE) -LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 -.else -LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} -.endif -.if ${WANT_COMPILER_TYPE} == gcc || \ - (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) -.else -LIB32CPUFLAGS+= -target x86_64-unknown-freebsd13.0 -.endif -LIB32CPUFLAGS+= -m32 -LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ - MACHINE_CPU="i686 mmx sse sse2" -LIB32WMAKEFLAGS= \ - AS="${XAS} --32" \ - LD="${XLD} -m elf_i386_fbsd -L${LIBCOMPATTMP}/usr/lib32" - -.elif ${TARGET_ARCH} == "powerpc64" -.if empty(TARGET_CPUTYPE) -LIB32CPUFLAGS= -mcpu=powerpc -.else -LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE} -.endif -LIB32CPUFLAGS+= -m32 -LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc -LIB32WMAKEFLAGS= \ - LD="${XLD} -m elf32ppc_fbsd" - -.elif ${TARGET_ARCH:Mmips64*} != "" -.if ${WANT_COMPILER_TYPE} == gcc || \ - (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) -.if empty(TARGET_CPUTYPE) -LIB32CPUFLAGS= -march=mips3 -.else -LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} -.endif -.else -.if ${TARGET_ARCH:Mmips64el*} != "" -LIB32CPUFLAGS= -target mipsel-unknown-freebsd13.0 -.else -LIB32CPUFLAGS= -target mips-unknown-freebsd13.0 -.endif -.endif -LIB32CPUFLAGS+= -mabi=32 -LIB32WMAKEENV= MACHINE=mips MACHINE_ARCH=mips -.if ${TARGET_ARCH:Mmips64el*} != "" -LIB32WMAKEFLAGS= LD="${XLD} -m elf32ltsmip_fbsd" -.else -LIB32WMAKEFLAGS= LD="${XLD} -m elf32btsmip_fbsd" -.endif -.endif - -LIB32WMAKEFLAGS+= NM="${XNM}" -LIB32WMAKEFLAGS+= OBJCOPY="${XOBJCOPY}" - -LIB32CFLAGS= -DCOMPAT_32BIT -LIB32DTRACE= ${DTRACE} -32 -LIB32WMAKEFLAGS+= -DCOMPAT_32BIT - -# ------------------------------------------------------------------- -# soft-fp world -.if ${TARGET_ARCH:Marmv[67]*} != "" -LIBSOFTCFLAGS= -DCOMPAT_SOFTFP -LIBSOFTCPUFLAGS= -mfloat-abi=softfp -LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=${TARGET_ARCH} -LIBSOFTWMAKEFLAGS= -DCOMPAT_SOFTFP -.endif - -# ------------------------------------------------------------------- -# Generic code for each type. -# Set defaults based on type. -libcompat= ${LIBCOMPAT:tl} -_LIBCOMPAT_MAKEVARS= _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS WMAKEENV \ - WMAKEFLAGS WMAKE -.for _var in ${_LIBCOMPAT_MAKEVARS} -.if !empty(LIB${LIBCOMPAT}${_var}) -LIBCOMPAT${_var}?= ${LIB${LIBCOMPAT}${_var}} -.endif -.endfor - -# Shared flags -LIBCOMPAT_OBJTOP?= ${OBJTOP}/obj-lib${libcompat} -LIBCOMPATTMP?= ${LIBCOMPAT_OBJTOP}/tmp - -LIBCOMPATCFLAGS+= ${LIBCOMPATCPUFLAGS} \ - -L${LIBCOMPATTMP}/usr/lib${libcompat} \ - --sysroot=${LIBCOMPATTMP} \ - ${BFLAGS} - -# -B is needed to find /usr/lib32/crti.o for GCC and /usr/libsoft/crti.o for -# Clang/GCC. -LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat} +.include # Yes, the flags are redundant. LIBCOMPATWMAKEENV+= \ Added: head/share/mk/bsd.compat.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/mk/bsd.compat.mk Tue Oct 15 21:08:49 2019 (r353592) @@ -0,0 +1,106 @@ +# $FreeBSD$ + +.if !targets(__<${_this:T}>__) +__<${_this:T}>__: + +# Makefile for the compatibility libraries. +# - 32-bit compat libraries on MIPS, PowerPC, and AMD64. + +# ------------------------------------------------------------------- +# 32 bit world +.if ${TARGET_ARCH} == "amd64" +.if empty(TARGET_CPUTYPE) +LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 +.else +LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} +.endif +.if ${WANT_COMPILER_TYPE} == gcc || \ + (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) +.else +LIB32CPUFLAGS+= -target x86_64-unknown-freebsd13.0 +.endif +LIB32CPUFLAGS+= -m32 +LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ + MACHINE_CPU="i686 mmx sse sse2" +LIB32WMAKEFLAGS= \ + AS="${XAS} --32" \ + LD="${XLD} -m elf_i386_fbsd -L${LIBCOMPATTMP}/usr/lib32" + +.elif ${TARGET_ARCH} == "powerpc64" +.if empty(TARGET_CPUTYPE) +LIB32CPUFLAGS= -mcpu=powerpc +.else +LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE} +.endif +LIB32CPUFLAGS+= -m32 +LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc +LIB32WMAKEFLAGS= \ + LD="${XLD} -m elf32ppc_fbsd" + +.elif ${TARGET_ARCH:Mmips64*} != "" +.if ${WANT_COMPILER_TYPE} == gcc || \ + (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) +.if empty(TARGET_CPUTYPE) +LIB32CPUFLAGS= -march=mips3 +.else +LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} +.endif +.else +.if ${TARGET_ARCH:Mmips64el*} != "" +LIB32CPUFLAGS= -target mipsel-unknown-freebsd13.0 +.else +LIB32CPUFLAGS= -target mips-unknown-freebsd13.0 +.endif +.endif +LIB32CPUFLAGS+= -mabi=32 +LIB32WMAKEENV= MACHINE=mips MACHINE_ARCH=mips +.if ${TARGET_ARCH:Mmips64el*} != "" +LIB32WMAKEFLAGS= LD="${XLD} -m elf32ltsmip_fbsd" +.else +LIB32WMAKEFLAGS= LD="${XLD} -m elf32btsmip_fbsd" +.endif +.endif + +LIB32WMAKEFLAGS+= NM="${XNM}" +LIB32WMAKEFLAGS+= OBJCOPY="${XOBJCOPY}" + +LIB32CFLAGS= -DCOMPAT_32BIT +LIB32DTRACE= ${DTRACE} -32 +LIB32WMAKEFLAGS+= -DCOMPAT_32BIT + +# ------------------------------------------------------------------- +# soft-fp world +.if ${TARGET_ARCH:Marmv[67]*} != "" +LIBSOFTCFLAGS= -DCOMPAT_SOFTFP +LIBSOFTCPUFLAGS= -mfloat-abi=softfp +LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=${TARGET_ARCH} +LIBSOFTWMAKEFLAGS= -DCOMPAT_SOFTFP +.endif + + +# ------------------------------------------------------------------- +# Generic code for each type. +# Set defaults based on type. +libcompat= ${LIBCOMPAT:tl} +_LIBCOMPAT_MAKEVARS= _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS WMAKEENV \ + WMAKEFLAGS WMAKE +.for _var in ${_LIBCOMPAT_MAKEVARS} +.if !empty(LIB${LIBCOMPAT}${_var}) +LIBCOMPAT${_var}?= ${LIB${LIBCOMPAT}${_var}} +.endif +.endfor + +# Shared flags +LIBCOMPAT_OBJTOP?= ${OBJTOP}/obj-lib${libcompat} +LIBCOMPATTMP?= ${LIBCOMPAT_OBJTOP}/tmp + +LIBCOMPATCFLAGS+= ${LIBCOMPATCPUFLAGS} \ + -L${LIBCOMPATTMP}/usr/lib${libcompat} \ + --sysroot=${LIBCOMPATTMP} \ + ${BFLAGS} + +# -B is needed to find /usr/lib32/crti.o for GCC and /usr/libsoft/crti.o for +# Clang/GCC. +LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat} + +.endif From owner-svn-src-all@freebsd.org Tue Oct 15 21:11:23 2019 Return-Path: Delivered-To: svn-src-all@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 27E11154AC0; Tue, 15 Oct 2019 21:11:23 +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 46t7QM01QTz3MPC; Tue, 15 Oct 2019 21:11:23 +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 D810C2482C; Tue, 15 Oct 2019 21:11:22 +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 x9FLBMln052197; Tue, 15 Oct 2019 21:11:22 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FLBM8U052196; Tue, 15 Oct 2019 21:11:22 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910152111.x9FLBM8U052196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 15 Oct 2019 21:11:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353593 - in head: . share/mk X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head: . share/mk X-SVN-Commit-Revision: 353593 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 21:11:23 -0000 Author: brooks Date: Tue Oct 15 21:11:22 2019 New Revision: 353593 URL: https://svnweb.freebsd.org/changeset/base/353593 Log: Rename top-level LIBCOMPAT to _LIBCOMPAT. This avoids a conflict with LIBCOMPAT defined in bsd.libnames.mk. Reviewed by: bdrewery Sponsored by: DARPA, AFRL Modified: head/Makefile.inc1 head/share/mk/bsd.compat.mk Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Oct 15 21:08:49 2019 (r353592) +++ head/Makefile.inc1 Tue Oct 15 21:11:22 2019 (r353593) @@ -804,10 +804,10 @@ XCFLAGS+= ${BFLAGS} .if ${MK_LIB32} != "no" && (${TARGET_ARCH} == "amd64" || \ ${TARGET_ARCH} == "powerpc64" || ${TARGET_ARCH:Mmips64*} != "") -LIBCOMPAT= 32 +_LIBCOMPAT= 32 .include "Makefile.libcompat" .elif ${MK_LIBSOFT} != "no" && ${TARGET_ARCH:Marmv[67]*} != "" -LIBCOMPAT= SOFT +_LIBCOMPAT= SOFT .include "Makefile.libcompat" .endif @@ -968,7 +968,7 @@ _cleanobj_fast_depend_hack: .PHONY echo "Removing stale dependencies for memchr"; \ rm -f ${OBJTOP}/lib/libc/.depend.${f}.*; \ fi -.if defined(LIBCOMPAT) +.if defined(_LIBCOMPAT) @if [ -e "${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.o" ] && \ egrep -qw 'i386/string/memchr\.S' ${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.o; then \ echo "Removing stale dependencies for memchr"; \ @@ -983,7 +983,7 @@ _cleanobj_fast_depend_hack: .PHONY egrep -qw '${f}\.[sS]' ${OBJTOP}/lib/libc/.depend.${f}.o; then \ echo "Removing stale dependencies for ${f} syscall wrappers"; \ rm -f ${OBJTOP}/lib/libc/.depend.${f}.* \ - ${LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.*}; \ + ${_LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.*}; \ fi .endfor # 20181013 r339348 bcopy reimplemented as .c @@ -992,7 +992,7 @@ _cleanobj_fast_depend_hack: .PHONY egrep -qw 'bcopy\.[sS]' ${OBJTOP}/lib/libc/.depend.${f}.o; then \ echo "Removing stale dependencies for bcopy"; \ rm -f ${OBJTOP}/lib/libc/.depend.${f}.* \ - ${LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.*}; \ + ${_LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.*}; \ fi .endfor # 20181115 r340463 bzero reimplemented as .c @@ -1000,7 +1000,7 @@ _cleanobj_fast_depend_hack: .PHONY egrep -qw 'bzero\.[sS]' ${OBJTOP}/lib/libc/.depend.bzero.o; then \ echo "Removing stale dependencies for bzero"; \ rm -f ${OBJTOP}/lib/libc/.depend.bzero.* \ - ${LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/.depend.bzero.*}; \ + ${_LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/.depend.bzero.*}; \ fi # 20181009 track migration from ntp's embedded libevent to updated one @if [ -e "${OBJTOP}/usr.sbin/ntp/libntpevent/.depend.bufferevent_openssl.o" ] && \ @@ -1094,7 +1094,7 @@ _cleanobj: # Avoid including bsd.compiler.mk in clean and obj with _NO_INCLUDE_COMPILERMK # since the restricted $PATH might not contain a valid cc binary ${_+_}cd ${.CURDIR}; ${WMAKE} _NO_INCLUDE_COMPILERMK=t ${CLEANDIR} -.if defined(LIBCOMPAT) +.if defined(_LIBCOMPAT) ${_+_}cd ${.CURDIR}; ${LIBCOMPATWMAKE} _NO_INCLUDE_COMPILERMK=t -f Makefile.inc1 ${CLEANDIR} .endif .else @@ -1172,7 +1172,7 @@ WMAKE_TGTS+= _includes WMAKE_TGTS+= _libraries .endif WMAKE_TGTS+= everything -.if defined(LIBCOMPAT) && empty(SUBDIR_OVERRIDE) +.if defined(_LIBCOMPAT) && empty(SUBDIR_OVERRIDE) WMAKE_TGTS+= build${libcompat} .endif @@ -1345,7 +1345,7 @@ ITOOLS+=makewhatis # Non-base distributions produced by the base system EXTRA_DISTRIBUTIONS= -.if defined(LIBCOMPAT) +.if defined(_LIBCOMPAT) EXTRA_DISTRIBUTIONS+= lib${libcompat} .endif .if ${MK_TESTS} != "no" @@ -1398,7 +1398,7 @@ distributeworld installworld stageworld: _installcheck ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null .endif -.if defined(LIBCOMPAT) +.if defined(_LIBCOMPAT) ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null .if ${MK_DEBUG_FILES} != "no" @@ -1422,7 +1422,7 @@ distributeworld installworld stageworld: _installcheck sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} ${IMAKEENV} ${MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \ sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG} -.if defined(LIBCOMPAT) +.if defined(_LIBCOMPAT) ${IMAKEENV} ${MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \ sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} .endif @@ -1533,7 +1533,7 @@ restage reinstall: .MAKE .PHONY @echo ">>> Installing everything started on `LC_ALL=C date`" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install -.if defined(LIBCOMPAT) +.if defined(_LIBCOMPAT) ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install${libcompat} .endif @echo "--------------------------------------------------------------" @@ -1545,7 +1545,7 @@ redistribute: .MAKE .PHONY @echo ">>> Distributing everything" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute -.if defined(LIBCOMPAT) +.if defined(_LIBCOMPAT) ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute${libcompat} \ DISTRIBUTION=lib${libcompat} .endif @@ -3394,7 +3394,7 @@ _xi-mtree: .PHONY -p ${XDDESTDIR}/usr >/dev/null ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \ -p ${XDDESTDIR}/usr/include >/dev/null -.if defined(LIBCOMPAT) +.if defined(_LIBCOMPAT) ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ -p ${XDDESTDIR}/usr >/dev/null .endif Modified: head/share/mk/bsd.compat.mk ============================================================================== --- head/share/mk/bsd.compat.mk Tue Oct 15 21:08:49 2019 (r353592) +++ head/share/mk/bsd.compat.mk Tue Oct 15 21:11:22 2019 (r353593) @@ -81,12 +81,12 @@ LIBSOFTWMAKEFLAGS= -DCOMPAT_SOFTFP # ------------------------------------------------------------------- # Generic code for each type. # Set defaults based on type. -libcompat= ${LIBCOMPAT:tl} +libcompat= ${_LIBCOMPAT:tl} _LIBCOMPAT_MAKEVARS= _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS WMAKEENV \ WMAKEFLAGS WMAKE .for _var in ${_LIBCOMPAT_MAKEVARS} -.if !empty(LIB${LIBCOMPAT}${_var}) -LIBCOMPAT${_var}?= ${LIB${LIBCOMPAT}${_var}} +.if !empty(LIB${_LIBCOMPAT}${_var}) +LIBCOMPAT${_var}?= ${LIB${_LIBCOMPAT}${_var}} .endif .endfor From owner-svn-src-all@freebsd.org Tue Oct 15 21:15:04 2019 Return-Path: Delivered-To: svn-src-all@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 0BFE4154B94; Tue, 15 Oct 2019 21:15:04 +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 46t7Vb6b84z3Mlf; Tue, 15 Oct 2019 21:15:03 +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 C57FC24994; Tue, 15 Oct 2019 21:15:03 +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 x9FLF3wT055335; Tue, 15 Oct 2019 21:15:03 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FLF3KU055334; Tue, 15 Oct 2019 21:15:03 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910152115.x9FLF3KU055334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 15 Oct 2019 21:15:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353594 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 353594 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 21:15:04 -0000 Author: brooks Date: Tue Oct 15 21:15:03 2019 New Revision: 353594 URL: https://svnweb.freebsd.org/changeset/base/353594 Log: Allow OBJDIR to be overridden for LIB*DIR variables. This will allow us to link against internal libraries when building programs for the system's LIBCOMPAT ABI. Reviewed by: bdrewery Obtained from: CheriBSD Sponsored by: DARPA, AFRL Modified: head/share/mk/src.libnames.mk Modified: head/share/mk/src.libnames.mk ============================================================================== --- head/share/mk/src.libnames.mk Tue Oct 15 21:11:22 2019 (r353593) +++ head/share/mk/src.libnames.mk Tue Oct 15 21:15:03 2019 (r353594) @@ -462,76 +462,77 @@ DPADD+= ${DPADD_${_l}} LDADD+= ${LDADD_${_l}} .endfor +_LIB_OBJTOP?= ${OBJTOP} # INTERNALLIB definitions. -LIBELFTCDIR= ${OBJTOP}/lib/libelftc +LIBELFTCDIR= ${_LIB_OBJTOP}/lib/libelftc LIBELFTC?= ${LIBELFTCDIR}/libelftc${PIE_SUFFIX}.a -LIBPEDIR= ${OBJTOP}/lib/libpe +LIBPEDIR= ${_LIB_OBJTOP}/lib/libpe LIBPE?= ${LIBPEDIR}/libpe${PIE_SUFFIX}.a -LIBOPENBSDDIR= ${OBJTOP}/lib/libopenbsd +LIBOPENBSDDIR= ${_LIB_OBJTOP}/lib/libopenbsd LIBOPENBSD?= ${LIBOPENBSDDIR}/libopenbsd${PIE_SUFFIX}.a -LIBSMDIR= ${OBJTOP}/lib/libsm +LIBSMDIR= ${_LIB_OBJTOP}/lib/libsm LIBSM?= ${LIBSMDIR}/libsm${PIE_SUFFIX}.a -LIBSMDBDIR= ${OBJTOP}/lib/libsmdb +LIBSMDBDIR= ${_LIB_OBJTOP}/lib/libsmdb LIBSMDB?= ${LIBSMDBDIR}/libsmdb${PIE_SUFFIX}.a -LIBSMUTILDIR= ${OBJTOP}/lib/libsmutil +LIBSMUTILDIR= ${_LIB_OBJTOP}/lib/libsmutil LIBSMUTIL?= ${LIBSMUTILDIR}/libsmutil${PIE_SUFFIX}.a -LIBNETBSDDIR?= ${OBJTOP}/lib/libnetbsd +LIBNETBSDDIR?= ${_LIB_OBJTOP}/lib/libnetbsd LIBNETBSD?= ${LIBNETBSDDIR}/libnetbsd${PIE_SUFFIX}.a -LIBVERSDIR?= ${OBJTOP}/kerberos5/lib/libvers +LIBVERSDIR?= ${_LIB_OBJTOP}/kerberos5/lib/libvers LIBVERS?= ${LIBVERSDIR}/libvers${PIE_SUFFIX}.a -LIBSLDIR= ${OBJTOP}/kerberos5/lib/libsl +LIBSLDIR= ${_LIB_OBJTOP}/kerberos5/lib/libsl LIBSL?= ${LIBSLDIR}/libsl${PIE_SUFFIX}.a -LIBIFCONFIGDIR= ${OBJTOP}/lib/libifconfig +LIBIFCONFIGDIR= ${_LIB_OBJTOP}/lib/libifconfig LIBIFCONFIG?= ${LIBIFCONFIGDIR}/libifconfig${PIE_SUFFIX}.a -LIBIPFDIR= ${OBJTOP}/sbin/ipf/libipf +LIBIPFDIR= ${_LIB_OBJTOP}/sbin/ipf/libipf LIBIPF?= ${LIBIPFDIR}/libipf${PIE_SUFFIX}.a -LIBTELNETDIR= ${OBJTOP}/lib/libtelnet +LIBTELNETDIR= ${_LIB_OBJTOP}/lib/libtelnet LIBTELNET?= ${LIBTELNETDIR}/libtelnet${PIE_SUFFIX}.a -LIBCRONDIR= ${OBJTOP}/usr.sbin/cron/lib +LIBCRONDIR= ${_LIB_OBJTOP}/usr.sbin/cron/lib LIBCRON?= ${LIBCRONDIR}/libcron${PIE_SUFFIX}.a -LIBNTPDIR= ${OBJTOP}/usr.sbin/ntp/libntp +LIBNTPDIR= ${_LIB_OBJTOP}/usr.sbin/ntp/libntp LIBNTP?= ${LIBNTPDIR}/libntp${PIE_SUFFIX}.a -LIBNTPEVENTDIR= ${OBJTOP}/usr.sbin/ntp/libntpevent +LIBNTPEVENTDIR= ${_LIB_OBJTOP}/usr.sbin/ntp/libntpevent LIBNTPEVENT?= ${LIBNTPEVENTDIR}/libntpevent${PIE_SUFFIX}.a -LIBOPTSDIR= ${OBJTOP}/usr.sbin/ntp/libopts +LIBOPTSDIR= ${_LIB_OBJTOP}/usr.sbin/ntp/libopts LIBOPTS?= ${LIBOPTSDIR}/libopts${PIE_SUFFIX}.a -LIBPARSEDIR= ${OBJTOP}/usr.sbin/ntp/libparse +LIBPARSEDIR= ${_LIB_OBJTOP}/usr.sbin/ntp/libparse LIBPARSE?= ${LIBPARSEDIR}/libparse${PIE_SUFFIX}.a -LIBLPRDIR= ${OBJTOP}/usr.sbin/lpr/common_source +LIBLPRDIR= ${_LIB_OBJTOP}/usr.sbin/lpr/common_source LIBLPR?= ${LIBLPRDIR}/liblpr${PIE_SUFFIX}.a -LIBFIFOLOGDIR= ${OBJTOP}/usr.sbin/fifolog/lib +LIBFIFOLOGDIR= ${_LIB_OBJTOP}/usr.sbin/fifolog/lib LIBFIFOLOG?= ${LIBFIFOLOGDIR}/libfifolog${PIE_SUFFIX}.a -LIBBSNMPTOOLSDIR= ${OBJTOP}/usr.sbin/bsnmpd/tools/libbsnmptools +LIBBSNMPTOOLSDIR= ${_LIB_OBJTOP}/usr.sbin/bsnmpd/tools/libbsnmptools LIBBSNMPTOOLS?= ${LIBBSNMPTOOLSDIR}/libbsnmptools${PIE_SUFFIX}.a -LIBAMUDIR= ${OBJTOP}/usr.sbin/amd/libamu +LIBAMUDIR= ${_LIB_OBJTOP}/usr.sbin/amd/libamu LIBAMU?= ${LIBAMUDIR}/libamu${PIE_SUFFIX}.a LIBBE?= ${LIBBEDIR}/libbe${PIE_SUFFIX}.a -LIBPMCSTATDIR= ${OBJTOP}/lib/libpmcstat +LIBPMCSTATDIR= ${_LIB_OBJTOP}/lib/libpmcstat LIBPMCSTAT?= ${LIBPMCSTATDIR}/libpmcstat${PIE_SUFFIX}.a -LIBC_NOSSP_PICDIR= ${OBJTOP}/lib/libc +LIBC_NOSSP_PICDIR= ${_LIB_OBJTOP}/lib/libc LIBC_NOSSP_PIC?= ${LIBC_NOSSP_PICDIR}/libc_nossp_pic.a # Define a directory for each library. This is useful for adding -L in when From owner-svn-src-all@freebsd.org Tue Oct 15 21:22:14 2019 Return-Path: Delivered-To: svn-src-all@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 55A57154E29; Tue, 15 Oct 2019 21:22:14 +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 46t7ft1dk9z3NDc; Tue, 15 Oct 2019 21:22:14 +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 1B2BD24A3F; Tue, 15 Oct 2019 21:22:14 +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 x9FLMDlC060791; Tue, 15 Oct 2019 21:22:13 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FLMDP7060789; Tue, 15 Oct 2019 21:22:13 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910152122.x9FLMDP7060789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 15 Oct 2019 21:22:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353595 - head X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 353595 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 21:22:14 -0000 Author: brooks Date: Tue Oct 15 21:22:13 2019 New Revision: 353595 URL: https://svnweb.freebsd.org/changeset/base/353595 Log: Build compat libraries before "everything". This is required for us to link programs against compat versions of libraries. Reviewed by: bdrewery, jhb Sponsored by: DARPA, AFRL Modified: head/Makefile.inc1 head/Makefile.libcompat Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Oct 15 21:15:03 2019 (r353594) +++ head/Makefile.inc1 Tue Oct 15 21:22:13 2019 (r353595) @@ -1150,7 +1150,7 @@ _libraries: everything: .PHONY @echo @echo "--------------------------------------------------------------" - @echo ">>> stage 4.3: building everything" + @echo ">>> stage 4.4: building everything" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; _PARALLEL_SUBDIR_OK=1 ${WMAKE} all @@ -1171,10 +1171,10 @@ WMAKE_TGTS+= _includes .if !defined(NO_LIBS) WMAKE_TGTS+= _libraries .endif -WMAKE_TGTS+= everything .if defined(_LIBCOMPAT) && empty(SUBDIR_OVERRIDE) WMAKE_TGTS+= build${libcompat} .endif +WMAKE_TGTS+= everything # record buildworld time in seconds .if make(buildworld) Modified: head/Makefile.libcompat ============================================================================== --- head/Makefile.libcompat Tue Oct 15 21:15:03 2019 (r353594) +++ head/Makefile.libcompat Tue Oct 15 21:22:13 2019 (r353595) @@ -61,7 +61,7 @@ _jevents= lib/libpmc/pmu-events build${libcompat}: .PHONY @echo @echo "--------------------------------------------------------------" - @echo ">>> stage 5.1: building lib${libcompat} shim libraries" + @echo ">>> stage 4.3: building lib${libcompat} shim libraries" @echo "--------------------------------------------------------------" .if !defined(NO_CLEAN) rm -rf ${LIBCOMPATTMP} From owner-svn-src-all@freebsd.org Tue Oct 15 21:24:27 2019 Return-Path: Delivered-To: svn-src-all@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 86AC6154F02; Tue, 15 Oct 2019 21:24:27 +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 46t7jR30szz3NRF; Tue, 15 Oct 2019 21:24:27 +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 4A58A24B5D; Tue, 15 Oct 2019 21:24:27 +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 x9FLORrY060923; Tue, 15 Oct 2019 21:24:27 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FLOQIB060918; Tue, 15 Oct 2019 21:24:26 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910152124.x9FLOQIB060918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 15 Oct 2019 21:24:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353596 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 353596 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 21:24:27 -0000 Author: glebius Date: Tue Oct 15 21:24:25 2019 New Revision: 353596 URL: https://svnweb.freebsd.org/changeset/base/353596 Log: When assertion for a thread not being in an epoch fails also print all entered epochs. Works with EPOCH_TRACE only. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D22017 Modified: head/sys/kern/kern_malloc.c head/sys/kern/kern_synch.c head/sys/kern/subr_epoch.c head/sys/kern/subr_trap.c head/sys/sys/epoch.h Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Tue Oct 15 21:22:13 2019 (r353595) +++ head/sys/kern/kern_malloc.c Tue Oct 15 21:24:25 2019 (r353596) @@ -520,6 +520,10 @@ malloc_dbg(caddr_t *vap, size_t *sizep, struct malloc_ if (flags & M_WAITOK) { KASSERT(curthread->td_intr_nesting_level == 0, ("malloc(M_WAITOK) in interrupt context")); +#ifdef EPOCH_TRACE + if (__predict_false(curthread->td_epochnest > 0)) + epoch_trace_list(curthread); +#endif KASSERT(curthread->td_epochnest == 0, ("malloc(M_WAITOK) in epoch context")); } Modified: head/sys/kern/kern_synch.c ============================================================================== --- head/sys/kern/kern_synch.c Tue Oct 15 21:22:13 2019 (r353595) +++ head/sys/kern/kern_synch.c Tue Oct 15 21:24:25 2019 (r353596) @@ -148,6 +148,10 @@ _sleep(void *ident, struct lock_object *lock, int prio ("sleeping without a lock")); KASSERT(ident != NULL, ("_sleep: NULL ident")); KASSERT(TD_IS_RUNNING(td), ("_sleep: curthread not running")); +#ifdef EPOCH_TRACE + if (__predict_false(curthread->td_epochnest > 0)) + epoch_trace_list(curthread); +#endif KASSERT(td->td_epochnest == 0, ("sleeping in an epoch section")); if (priority & PDROP) KASSERT(lock != NULL && lock != &Giant.lock_object, Modified: head/sys/kern/subr_epoch.c ============================================================================== --- head/sys/kern/subr_epoch.c Tue Oct 15 21:22:13 2019 (r353595) +++ head/sys/kern/subr_epoch.c Tue Oct 15 21:24:25 2019 (r353596) @@ -234,6 +234,17 @@ epoch_trace_exit(struct thread *td, epoch_t epoch, epo } else SLIST_REMOVE_HEAD(&td->td_epochs, et_tlink); } + +/* Used by assertions that check thread state before going to sleep. */ +void +epoch_trace_list(struct thread *td) +{ + epoch_tracker_t iet; + + SLIST_FOREACH(iet, &td->td_epochs, et_tlink) + printf("Epoch %s entered at %s:%d\n", iet->et_epoch->e_name, + iet->et_file, iet->et_line); +} #endif /* EPOCH_TRACE */ static void Modified: head/sys/kern/subr_trap.c ============================================================================== --- head/sys/kern/subr_trap.c Tue Oct 15 21:22:13 2019 (r353595) +++ head/sys/kern/subr_trap.c Tue Oct 15 21:24:25 2019 (r353596) @@ -166,6 +166,10 @@ userret(struct thread *td, struct trapframe *frame) WITNESS_WARN(WARN_PANIC, NULL, "userret: returning"); KASSERT(td->td_critnest == 0, ("userret: Returning in a critical section")); +#ifdef EPOCH_TRACE + if (__predict_false(curthread->td_epochnest > 0)) + epoch_trace_list(curthread); +#endif KASSERT(td->td_epochnest == 0, ("userret: Returning in an epoch section")); KASSERT(td->td_locks == 0, Modified: head/sys/sys/epoch.h ============================================================================== --- head/sys/sys/epoch.h Tue Oct 15 21:22:13 2019 (r353595) +++ head/sys/sys/epoch.h Tue Oct 15 21:24:25 2019 (r353596) @@ -83,6 +83,7 @@ DPCPU_DECLARE(struct grouptask, epoch_cb_task); void _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et EPOCH_FILE_LINE); void _epoch_exit_preempt(epoch_t epoch, epoch_tracker_t et EPOCH_FILE_LINE); #ifdef EPOCH_TRACE +void epoch_trace_list(struct thread *); #define epoch_enter_preempt(epoch, et) _epoch_enter_preempt(epoch, et, __FILE__, __LINE__) #define epoch_exit_preempt(epoch, et) _epoch_exit_preempt(epoch, et, __FILE__, __LINE__) #else From owner-svn-src-all@freebsd.org Tue Oct 15 21:27:08 2019 Return-Path: Delivered-To: svn-src-all@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 18D62154FAD; Tue, 15 Oct 2019 21:27:08 +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 46t7mW6y1Xz3Nb0; Tue, 15 Oct 2019 21:27:07 +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 B380424B63; Tue, 15 Oct 2019 21:27:07 +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 x9FLR7Rw061092; Tue, 15 Oct 2019 21:27:07 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FLR7rV061089; Tue, 15 Oct 2019 21:27:07 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910152127.x9FLR7rV061089@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 15 Oct 2019 21:27:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353597 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 353597 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 21:27:08 -0000 Author: brooks Date: Tue Oct 15 21:27:06 2019 New Revision: 353597 URL: https://svnweb.freebsd.org/changeset/base/353597 Log: Add the ability to link programs against a compat ABI. Linkage is controlled by two make knobs: WANT_COMPAT - Prefer to link against the compat ABI. NEED_COMPAT - Link against the compat ABI or fail to build. Supported values are "32", "soft", and "any". The latter meaning pick the first[0] supported compat ABI. This can be used to provide test binaries for compat ABIs or to link ABI-specific programs. [0] We currently support only one compat ABI at a time, but this may change in the future and some code in this commit is structured to ease that change. Reviewed by: bdrewery, jhb Obtained from: CheriBSD (in concept) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22023 Modified: head/share/mk/bsd.README head/share/mk/bsd.compat.mk head/share/mk/bsd.prog.mk Modified: head/share/mk/bsd.README ============================================================================== --- head/share/mk/bsd.README Tue Oct 15 21:24:25 2019 (r353596) +++ head/share/mk/bsd.README Tue Oct 15 21:27:06 2019 (r353597) @@ -17,6 +17,7 @@ files. In most cases it is only interesting to includ bsd.lib.mk. bsd.arch.inc.mk - includes arch-specific Makefile.$arch +bsd.compat.mk - definitions for building programs against compat ABIs bsd.compiler.mk - defined based on current compiler bsd.confs.mk - install of configuration files bsd.cpu.mk - sets CPU/arch-related variables (included from sys.mk) @@ -378,6 +379,10 @@ LINKMODE Mode of links created with LINKS [${BINMODE}] MAN Manual pages. If no MAN variable is defined, "MAN=${PROG}.1" is assumed. See bsd.man.mk for more details. +NEED_COMPAT Build and link targeting a compatability ABI or fail if it + is not available. Supported values are "32", "soft", and + "any" being a wildcard. + PROG The name of the program to build. If not supplied, nothing is built. @@ -439,6 +444,9 @@ STRIP The flag passed to the install program to cause SUBDIR A list of subdirectories that should be built as well. Each of the targets will execute the same target in the subdirectories. + +WANT_COMPAT Similar to NEED_COMPAT, but build with the base ABI if + the specified ABI is not available. The include file includes the file named "../Makefile.inc" if it exists, as well as the include file . Modified: head/share/mk/bsd.compat.mk ============================================================================== --- head/share/mk/bsd.compat.mk Tue Oct 15 21:24:25 2019 (r353596) +++ head/share/mk/bsd.compat.mk Tue Oct 15 21:27:06 2019 (r353597) @@ -3,18 +3,16 @@ .if !targets(__<${_this:T}>__) __<${_this:T}>__: -# Makefile for the compatibility libraries. -# - 32-bit compat libraries on MIPS, PowerPC, and AMD64. - # ------------------------------------------------------------------- # 32 bit world .if ${TARGET_ARCH} == "amd64" +HAS_COMPAT=32 .if empty(TARGET_CPUTYPE) LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 .else LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} .endif -.if ${WANT_COMPILER_TYPE} == gcc || \ +.if (defined(WANT_COMPILER_TYPE) && ${WANT_COMPILER_TYPE} == gcc) || \ (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) .else LIB32CPUFLAGS+= -target x86_64-unknown-freebsd13.0 @@ -27,6 +25,7 @@ LIB32WMAKEFLAGS= \ LD="${XLD} -m elf_i386_fbsd -L${LIBCOMPATTMP}/usr/lib32" .elif ${TARGET_ARCH} == "powerpc64" +HAS_COMPAT=32 .if empty(TARGET_CPUTYPE) LIB32CPUFLAGS= -mcpu=powerpc .else @@ -38,6 +37,7 @@ LIB32WMAKEFLAGS= \ LD="${XLD} -m elf32ppc_fbsd" .elif ${TARGET_ARCH:Mmips64*} != "" +HAS_COMPAT=32 .if ${WANT_COMPILER_TYPE} == gcc || \ (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) .if empty(TARGET_CPUTYPE) @@ -71,13 +71,37 @@ LIB32WMAKEFLAGS+= -DCOMPAT_32BIT # ------------------------------------------------------------------- # soft-fp world .if ${TARGET_ARCH:Marmv[67]*} != "" +HAS_COMPAT=SOFT LIBSOFTCFLAGS= -DCOMPAT_SOFTFP LIBSOFTCPUFLAGS= -mfloat-abi=softfp LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=${TARGET_ARCH} LIBSOFTWMAKEFLAGS= -DCOMPAT_SOFTFP .endif +# ------------------------------------------------------------------- +# In the program linking case, select LIBCOMPAT +.if defined(NEED_COMPAT) +.ifndef HAS_COMPAT +.error NEED_COMPAT defined, but no LIBCOMPAT is available +.elif !${HAS_COMPAT:M${NEED_COMPAT}} && ${NEED_COMPAT} != "any" +.error NEED_COMPAT (${NEED_COMPAT}) defined, but not in HAS_COMPAT ($HAS_COMPAT) +.elif ${NEED_COMPAT} == "any" +.endif +.ifdef WANT_COMPAT +.error Both WANT_COMPAT and NEED_COMPAT defined +.endif +WANT_COMPAT:= ${NEED_COMPAT} +.endif +.if defined(HAS_COMPAT) && defined(WANT_COMPAT) +.if ${WANT_COMPAT} == "any" +_LIBCOMPAT:= ${HAS_COMPAT:[1]} +.else +_LIBCOMPAT:= ${WANT_COMPAT} +.endif +.endif + + # ------------------------------------------------------------------- # Generic code for each type. # Set defaults based on type. @@ -102,5 +126,11 @@ LIBCOMPATCFLAGS+= ${LIBCOMPATCPUFLAGS} \ # -B is needed to find /usr/lib32/crti.o for GCC and /usr/libsoft/crti.o for # Clang/GCC. LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat} + +.if defined(WANT_COMPAT) +LIBDIR_BASE:= /usr/lib${libcompat} +_LIB_OBJTOP= ${LIBCOMPAT_OBJTOP} +CFLAGS+= ${LIBCOMPATCFLAGS} +.endif .endif Modified: head/share/mk/bsd.prog.mk ============================================================================== --- head/share/mk/bsd.prog.mk Tue Oct 15 21:24:25 2019 (r353596) +++ head/share/mk/bsd.prog.mk Tue Oct 15 21:27:06 2019 (r353597) @@ -2,6 +2,7 @@ # $FreeBSD$ .include +.include .include .include From owner-svn-src-all@freebsd.org Tue Oct 15 21:32:39 2019 Return-Path: Delivered-To: svn-src-all@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 81CC8155182; Tue, 15 Oct 2019 21:32:39 +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 46t7tv2fh5z3P7S; Tue, 15 Oct 2019 21:32:39 +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 3EE6B24D39; Tue, 15 Oct 2019 21:32:39 +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 x9FLWdiA066448; Tue, 15 Oct 2019 21:32:39 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FLWcT8066446; Tue, 15 Oct 2019 21:32:38 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910152132.x9FLWcT8066446@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 15 Oct 2019 21:32:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353598 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 353598 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 21:32:39 -0000 Author: glebius Date: Tue Oct 15 21:32:38 2019 New Revision: 353598 URL: https://svnweb.freebsd.org/changeset/base/353598 Log: Missing from r353596. Modified: head/sys/kern/kern_malloc.c head/sys/kern/kern_synch.c Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Tue Oct 15 21:27:06 2019 (r353597) +++ head/sys/kern/kern_malloc.c Tue Oct 15 21:32:38 2019 (r353598) @@ -65,6 +65,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef EPOCH_TRACE +#include +#endif #include #include Modified: head/sys/kern/kern_synch.c ============================================================================== --- head/sys/kern/kern_synch.c Tue Oct 15 21:27:06 2019 (r353597) +++ head/sys/kern/kern_synch.c Tue Oct 15 21:32:38 2019 (r353598) @@ -66,6 +66,9 @@ __FBSDID("$FreeBSD$"); #include #include #endif +#ifdef EPOCH_TRACE +#include +#endif #include From owner-svn-src-all@freebsd.org Tue Oct 15 21:41:53 2019 Return-Path: Delivered-To: svn-src-all@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 A8C0015542A; Tue, 15 Oct 2019 21:41:53 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (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 46t85X671Pz3PQp; Tue, 15 Oct 2019 21:41:52 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 3E18C3C0199; Tue, 15 Oct 2019 21:41:52 +0000 (UTC) Date: Tue, 15 Oct 2019 21:41:52 +0000 From: Brooks Davis To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353597 - head/share/mk Message-ID: <20191015214152.GC49245@spindle.one-eyed-alien.net> References: <201910152127.x9FLR7rV061089@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oJ71EGRlYNjSvfq7" Content-Disposition: inline In-Reply-To: <201910152127.x9FLR7rV061089@repo.freebsd.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 46t85X671Pz3PQp X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of brooks@spindle.one-eyed-alien.net has no SPF policy when checking 199.48.129.229) smtp.mailfrom=brooks@spindle.one-eyed-alien.net X-Spamd-Result: default: False [-6.51 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; 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.20)[multipart/signed,text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[freebsd.org]; AUTH_NA(1.00)[]; IP_SCORE(-3.61)[ip: (-9.43), ipnet: 199.48.128.0/22(-4.70), asn: 36236(-3.85), country: US(-0.05)]; R_SPF_NA(0.00)[]; SIGNED_PGP(-2.00)[]; FORGED_SENDER(0.30)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; RCVD_COUNT_ZERO(0.00)[0]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:36236, ipnet:199.48.128.0/22, country:US]; FROM_NEQ_ENVFROM(0.00)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 21:41:53 -0000 --oJ71EGRlYNjSvfq7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 15, 2019 at 09:27:07PM +0000, Brooks Davis wrote: > Author: brooks > Date: Tue Oct 15 21:27:06 2019 > New Revision: 353597 > URL: https://svnweb.freebsd.org/changeset/base/353597 >=20 > Log: > Add the ability to link programs against a compat ABI. > =20 > Linkage is controlled by two make knobs: > WANT_COMPAT - Prefer to link against the compat ABI. > NEED_COMPAT - Link against the compat ABI or fail to build. > =20 > Supported values are "32", "soft", and "any". The latter meaning pick > the first[0] supported compat ABI. > =20 > This can be used to provide test binaries for compat ABIs or to link > ABI-specific programs. > =20 > [0] We currently support only one compat ABI at a time, but this may > change in the future and some code in this commit is structured to ease > that change. > =20 > Reviewed by: bdrewery, jhb > Obtained from: CheriBSD (in concept) > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D22023 This allows simple programs to build/link per the description. More work will be required to build programs that depend on things like MACHINE_ARCH, but this gets the basics working. -- Brooks --oJ71EGRlYNjSvfq7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEbBAEBAgAGBQJdpj0fAAoJEKzQXbSebgfAC2cH+NHHRikLt+x8tGtMix8BY08W 0F4IypC9g3jzN5JjTvBv8qFzrfs2E/5Qz1XdVxqMnHaIlnne6R+rLHRreoNW2EP+ 5Q6E5epbcTJKUE94XY17QtRf0qRUha8SJzo/NO29RbX/MGA8c9vggw+oFaaK8dSk kN9L1Qf4lpjs9t4I038hBj6y0c4BHDMcJYFJUuCYZyecVNaxg/O0z6hXBPpdlGdh DUU/D0f39mPF4SaU4sL1IWyyCPBQesPagHe1kWS4BukLnkoq3a5CuMx5Y8M7bPpa 101bPrUcevqTPX7h9Iw5cCLdRXsqhNF242wLr96dvMD4rsin8O292reHeCkmLQ== =vjcZ -----END PGP SIGNATURE----- --oJ71EGRlYNjSvfq7-- From owner-svn-src-all@freebsd.org Tue Oct 15 21:49:02 2019 Return-Path: Delivered-To: svn-src-all@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 C67EB15558E for ; Tue, 15 Oct 2019 21:49:02 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) (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 46t8Fp0yHrz3PqZ for ; Tue, 15 Oct 2019 21:49:01 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mail-pl1-x641.google.com with SMTP id d22so10217571pll.7 for ; Tue, 15 Oct 2019 14:49:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jroberson-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=6qXJbr1xVHD0pUKlmaIGnn+BBrUT+Qs5qSsaSqGIerQ=; b=smhB/+AWTC3aRaTg6fmyDnLgQCXdSqM6gNmoUjs6RBHqHcE4uD1KfKhElQ0LcmuCji chIrTMv61bk2+CEy2mzpV63+0jrsq9O9BKN9ql7ndx+Hx15uf19Qj3GJQqWf3WPsIvFb DA/2tDthdzRbEvlxW/YrWDXw/yf9Ob2f9VGU3cP4W1ES60lPvsLPzVwMUwB0utoNoyRI aCz3oM61jZngSlhCuhQMhUwK6M9LJqJqhNHlyexCHPjGxJuDiY3jljFUtzQwc2zGaZnS 9E6sezc5r/lIvwKjclv58IKqEVAR3IdyZybVbEurkAQBFFYF8ixmHYAm+1GZiTsom9oB E1vw== 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:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=6qXJbr1xVHD0pUKlmaIGnn+BBrUT+Qs5qSsaSqGIerQ=; b=lpwpACwN+HVMemD0JQydMOskKSMtU6HsxvrarWteKqv89hJhx3k8B8o8xj1BXVwmoj POR8IX80YkTsXerw1pYoVpznthFtRg/nx14p7LtFTmxbFnrOOjngkgg5P2PBoY7SHwPK Fsg4pRtOJktl19UM59HhCCykeDdRHkuUpyoQTJEzsX+wXTk41MRvR0urd05WubvYlnWM CgkKcLAg+ZQpE/C0cvgGa+hlkGMSj6o8e7lAT/PAjwWBqLZA7AvJnvOgBOcEIY2LSCd4 /XZ+eZteb4l8XUzQWvmzUII1Ajwey1TVCYsohHMrkD31Emds6zux30QPc0X6lpSVTTx/ P9rQ== X-Gm-Message-State: APjAAAWY7tSFSdUZ5aR9c/yo0rgKHgSohzbpnBvXkDaDArQ9kvow9bXL KIjYuUpxylNqalaseMs5tWuGQw== X-Google-Smtp-Source: APXvYqz4f862Y7YF8t6EjqvYA1fLuJKmKa6RYKc4ScPPyP44rIxfDEc7lUsbVDnFeVxJZmt5QQXBBA== X-Received: by 2002:a17:902:b110:: with SMTP id q16mr36988833plr.262.1571176138525; Tue, 15 Oct 2019 14:48:58 -0700 (PDT) Received: from rrcs-76-81-105-82.west.biz.rr.com (rrcs-76-81-105-82.west.biz.rr.com. [76.81.105.82]) by smtp.gmail.com with ESMTPSA id 18sm26607659pfp.100.2019.10.15.14.48.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Oct 2019 14:48:57 -0700 (PDT) Date: Tue, 15 Oct 2019 11:48:55 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Oliver Pinter cc: Jeff Roberson , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r353539 - in head/sys: amd64/sgx cddl/contrib/opensolaris/uts/common/fs/zfs compat/linuxkpi/common/src dev/drm2/ttm dev/md dev/netmap dev/xen/gntdev dev/xen/privcmd fs/nfsclient fs/smbf... In-Reply-To: Message-ID: References: <201910150345.x9F3jgYw028767@repo.freebsd.org> User-Agent: Alpine 2.21.9999 (BSF 287 2018-06-16) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Rspamd-Queue-Id: 46t8Fp0yHrz3PqZ X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=jroberson-net.20150623.gappssmtp.com header.s=20150623 header.b=smhB/+AW; dmarc=none; spf=none (mx1.freebsd.org: domain of jroberson@jroberson.net has no SPF policy when checking 2607:f8b0:4864:20::641) smtp.mailfrom=jroberson@jroberson.net X-Spamd-Result: default: False [-2.85 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[jroberson-net.20150623.gappssmtp.com:s=20150623]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[jroberson.net]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[jroberson-net.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[1.4.6.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)[]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-1.05)[ip: (-0.62), ipnet: 2607:f8b0::/32(-2.48), asn: 15169(-2.10), country: US(-0.05)] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 21:49:02 -0000 On Tue, 15 Oct 2019, Oliver Pinter wrote: > > > On Tuesday, October 15, 2019, Jeff Roberson wrote: > Author: jeff > Date: Tue Oct 15 03:45:41 2019 > New Revision: 353539 > URL: https://svnweb.freebsd.org/changeset/base/353539 > > Log: > ? (4/6) Protect page valid with the busy lock. > > ? Atomics are used for page busy and valid state when the shared > busy is > ? held.? The details of the locking protocol and valid and dirty > ? synchronization are in the updated vm_page.h comments. > > ? Reviewed by:? ? kib, markj > ? Tested by:? ? ? pho > ? Sponsored by:? ?Netflix, Intel > ? Differential Revision:? ? ? ? https://reviews.freebsd.org/D21594 > > Modified: > ? head/sys/amd64/sgx/sgx.c > ? head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c > ? head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > ? head/sys/compat/linuxkpi/common/src/linux_compat.c > ? head/sys/dev/drm2/ttm/ttm_bo_vm.c > ? head/sys/dev/drm2/ttm/ttm_tt.c > ? head/sys/dev/md/md.c > ? head/sys/dev/netmap/netmap_freebsd.c > ? head/sys/dev/xen/gntdev/gntdev.c > ? head/sys/dev/xen/privcmd/privcmd.c > ? head/sys/fs/nfsclient/nfs_clbio.c > ? head/sys/fs/smbfs/smbfs_io.c > ? head/sys/fs/tmpfs/tmpfs_subr.c > ? head/sys/kern/kern_exec.c > ? head/sys/kern/uipc_shm.c > ? head/sys/kern/vfs_bio.c > ? head/sys/kern/vfs_cluster.c > ? head/sys/vm/device_pager.c > ? head/sys/vm/phys_pager.c > ? head/sys/vm/sg_pager.c > ? head/sys/vm/swap_pager.c > ? head/sys/vm/vm_fault.c > ? head/sys/vm/vm_map.c > ? head/sys/vm/vm_mmap.c > ? head/sys/vm/vm_object.c > ? head/sys/vm/vm_page.c > ? head/sys/vm/vm_page.h > ? head/sys/vm/vm_pageout.c > ? head/sys/vm/vm_swapout.c > ? head/sys/vm/vnode_pager.c > > Modified: head/sys/amd64/sgx/sgx.c > =========================================================================== > === > --- head/sys/amd64/sgx/sgx.c? ? Tue Oct 15 03:41:36 2019? ? ? ? (r353538) > +++ head/sys/amd64/sgx/sgx.c? ? Tue Oct 15 03:45:41 2019? ? ? ? (r353539) > @@ -220,8 +220,8 @@ sgx_va_slot_init_by_index(struct sgx_softc > *sc, vm_obj > > ? ? ? ? ? ? ? ? page = PHYS_TO_VM_PAGE(epc->phys); > > -?? ? ? ? ? ? ?vm_page_insert(page, object, idx); > ? ? ? ? ? ? ? ? page->valid = VM_PAGE_BITS_ALL; > > > This wouldn't be vm_page_valid(page)?? > ? I didn't change places that were not using normal synchronization. This relies on the page being only visible in the current scope to protect valid as it does not acquire the busy field. Jeff > +?? ? ? ? ? ? ?vm_page_insert(page, object, idx); > ? ? ? ? } > > ? ? ? ? return (0); > @@ -610,8 +610,8 @@ sgx_insert_epc_page_by_index(vm_page_t page, > vm_object > > ? ? ? ? VM_OBJECT_ASSERT_WLOCKED(object); > > -?? ? ?vm_page_insert(page, object, pidx); > ? ? ? ? page->valid = VM_PAGE_BITS_ALL; > > > And here too?? > ? > +?? ? ?vm_page_insert(page, object, pidx); > > > ?}?static void > > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c > =========================================================================== > === > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c? ?Tue > Oct 15 03:41:36 2019? ? ? ? (r353538) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c? ?Tue > Oct 15 03:45:41 2019? ? ? ? (r353539) > @@ -1731,11 +1731,13 @@ dmu_read_pages(objset_t *os, uint64_t > object, vm_page_ > ? ? ? ? db = dbp[0]; > ? ? ? ? for (i = 0; i < *rbehind; i++) { > ? ? ? ? ? ? ? ? m = vm_page_grab(vmobj, ma[0]->pindex - 1 - i, > -?? ? ? ? ? ? ? ? ?VM_ALLOC_NORMAL | VM_ALLOC_NOWAIT | VM_ALLOC_NOBUSY); > +?? ? ? ? ? ? ? ? ?VM_ALLOC_NORMAL | VM_ALLOC_NOWAIT | > +?? ? ? ? ? ? ? ? ?VM_ALLOC_SBUSY | VM_ALLOC_IGN_SBUSY); > ? ? ? ? ? ? ? ? if (m == NULL) > ? ? ? ? ? ? ? ? ? ? ? ? break; > -?? ? ? ? ? ? ?if (m->valid != 0) { > +?? ? ? ? ? ? ?if (!vm_page_none_valid(m)) { > ? ? ? ? ? ? ? ? ? ? ? ? ASSERT3U(m->valid, ==, VM_PAGE_BITS_ALL); > +?? ? ? ? ? ? ? ? ? ? ?vm_page_sunbusy(m); > ? ? ? ? ? ? ? ? ? ? ? ? break; > ? ? ? ? ? ? ? ? } > ? ? ? ? ? ? ? ? ASSERT(m->dirty == 0); > @@ -1746,13 +1748,14 @@ dmu_read_pages(objset_t *os, uint64_t > object, vm_page_ > ? ? ? ? ? ? ? ? va = zfs_map_page(m, &sf); > ? ? ? ? ? ? ? ? bcopy((char *)db->db_data + bufoff, va, PAGESIZE); > ? ? ? ? ? ? ? ? zfs_unmap_page(sf); > -?? ? ? ? ? ? ?m->valid = VM_PAGE_BITS_ALL; > +?? ? ? ? ? ? ?vm_page_valid(m); > ? ? ? ? ? ? ? ? vm_page_lock(m); > ? ? ? ? ? ? ? ? if ((m->busy_lock & VPB_BIT_WAITERS) != 0) > ? ? ? ? ? ? ? ? ? ? ? ? vm_page_activate(m); > ? ? ? ? ? ? ? ? else > ? ? ? ? ? ? ? ? ? ? ? ? vm_page_deactivate(m); > ? ? ? ? ? ? ? ? vm_page_unlock(m); > +?? ? ? ? ? ? ?vm_page_sunbusy(m); > ? ? ? ? } > ? ? ? ? *rbehind = i; > > @@ -1763,7 +1766,7 @@ dmu_read_pages(objset_t *os, uint64_t > object, vm_page_ > ? ? ? ? ? ? ? ? ? ? ? ? m = ma[mi]; > ? ? ? ? ? ? ? ? ? ? ? ? if (m != bogus_page) { > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vm_page_assert_xbusied(m); > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ASSERT(m->valid == 0); > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ASSERT(vm_page_none_valid(m)); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ASSERT(m->dirty == 0); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ASSERT(!pmap_page_is_mapped(m)); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? va = zfs_map_page(m, &sf); > @@ -1791,7 +1794,7 @@ dmu_read_pages(objset_t *os, uint64_t > object, vm_page_ > ? ? ? ? ? ? ? ? if (pgoff == PAGESIZE) { > ? ? ? ? ? ? ? ? ? ? ? ? if (m != bogus_page) { > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? zfs_unmap_page(sf); > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?m->valid = VM_PAGE_BITS_ALL; > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?vm_page_valid(m); > ? ? ? ? ? ? ? ? ? ? ? ? } > ? ? ? ? ? ? ? ? ? ? ? ? ASSERT(mi < count); > ? ? ? ? ? ? ? ? ? ? ? ? mi++; > @@ -1840,16 +1843,18 @@ dmu_read_pages(objset_t *os, uint64_t > object, vm_page_ > ? ? ? ? ? ? ? ? ASSERT(m != bogus_page); > ? ? ? ? ? ? ? ? bzero(va + pgoff, PAGESIZE - pgoff); > ? ? ? ? ? ? ? ? zfs_unmap_page(sf); > -?? ? ? ? ? ? ?m->valid = VM_PAGE_BITS_ALL; > +?? ? ? ? ? ? ?vm_page_valid(m); > ? ? ? ? } > > ? ? ? ? for (i = 0; i < *rahead; i++) { > ? ? ? ? ? ? ? ? m = vm_page_grab(vmobj, ma[count - 1]->pindex + 1 + i, > -?? ? ? ? ? ? ? ? ?VM_ALLOC_NORMAL | VM_ALLOC_NOWAIT | VM_ALLOC_NOBUSY); > +?? ? ? ? ? ? ? ? ?VM_ALLOC_NORMAL | VM_ALLOC_NOWAIT | > +?? ? ? ? ? ? ? ? ?VM_ALLOC_SBUSY | VM_ALLOC_IGN_SBUSY); > ? ? ? ? ? ? ? ? if (m == NULL) > ? ? ? ? ? ? ? ? ? ? ? ? break; > -?? ? ? ? ? ? ?if (m->valid != 0) { > +?? ? ? ? ? ? ?if (!vm_page_none_valid(m)) { > ? ? ? ? ? ? ? ? ? ? ? ? ASSERT3U(m->valid, ==, VM_PAGE_BITS_ALL); > +?? ? ? ? ? ? ? ? ? ? ?vm_page_sunbusy(m); > ? ? ? ? ? ? ? ? ? ? ? ? break; > ? ? ? ? ? ? ? ? } > ? ? ? ? ? ? ? ? ASSERT(m->dirty == 0); > @@ -1866,13 +1871,14 @@ dmu_read_pages(objset_t *os, uint64_t > object, vm_page_ > ? ? ? ? ? ? ? ? ? ? ? ? bzero(va + tocpy, PAGESIZE - tocpy); > ? ? ? ? ? ? ? ? } > ? ? ? ? ? ? ? ? zfs_unmap_page(sf); > -?? ? ? ? ? ? ?m->valid = VM_PAGE_BITS_ALL; > +?? ? ? ? ? ? ?vm_page_valid(m); > ? ? ? ? ? ? ? ? vm_page_lock(m); > ? ? ? ? ? ? ? ? if ((m->busy_lock & VPB_BIT_WAITERS) != 0) > ? ? ? ? ? ? ? ? ? ? ? ? vm_page_activate(m); > ? ? ? ? ? ? ? ? else > ? ? ? ? ? ? ? ? ? ? ? ? vm_page_deactivate(m); > ? ? ? ? ? ? ? ? vm_page_unlock(m); > +?? ? ? ? ? ? ?vm_page_sunbusy(m); > ? ? ? ? } > ? ? ? ? *rahead = i; > ? ? ? ? zfs_vmobject_wunlock(vmobj); > > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > =========================================================================== > === > --- > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c? ? > ?Tue Oct 15 03:41:36 2019? ? ? ? (r353538) > +++ > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c? ? > ?Tue Oct 15 03:45:41 2019? ? ? ? (r353539) > @@ -534,7 +534,7 @@ mappedread_sf(vnode_t *vp, int nbytes, uio_t > *uio) > > ? ? ? ? ? ? ? ? pp = vm_page_grab(obj, OFF_TO_IDX(start), VM_ALLOC_SBUSY | > ? ? ? ? ? ? ? ? ? ? VM_ALLOC_NORMAL | VM_ALLOC_IGN_SBUSY); > -?? ? ? ? ? ? ?if (pp->valid == 0) { > +?? ? ? ? ? ? ?if (vm_page_none_valid(pp)) { > ? ? ? ? ? ? ? ? ? ? ? ? zfs_vmobject_wunlock(obj); > ? ? ? ? ? ? ? ? ? ? ? ? va = zfs_map_page(pp, &sf); > ? ? ? ? ? ? ? ? ? ? ? ? error = dmu_read(os, zp->z_id, start, bytes, va, > @@ -543,17 +543,16 @@ mappedread_sf(vnode_t *vp, int nbytes, > uio_t *uio) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bzero(va + bytes, PAGESIZE - bytes); > ? ? ? ? ? ? ? ? ? ? ? ? zfs_unmap_page(sf); > ? ? ? ? ? ? ? ? ? ? ? ? zfs_vmobject_wlock(obj); > -?? ? ? ? ? ? ? ? ? ? ?vm_page_sunbusy(pp); > -?? ? ? ? ? ? ? ? ? ? ?if (error) { > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (!vm_page_busied(pp) && !vm_page_wired(pp) && > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?pp->valid == 0) > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?vm_page_free(pp); > -?? ? ? ? ? ? ? ? ? ? ?}else { > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?pp->valid = VM_PAGE_BITS_ALL; > +?? ? ? ? ? ? ? ? ? ? ?if (error == 0) { > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?vm_page_valid(pp); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vm_page_lock(pp); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vm_page_activate(pp); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vm_page_unlock(pp); > ? ? ? ? ? ? ? ? ? ? ? ? } > +?? ? ? ? ? ? ? ? ? ? ?vm_page_sunbusy(pp); > +?? ? ? ? ? ? ? ? ? ? ?if (error != 0 && !vm_page_wired(pp) == 0 && > +?? ? ? ? ? ? ? ? ? ? ? ? ?pp->valid == 0 && vm_page_tryxbusy(pp)) > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?vm_page_free(pp); > ? ? ? ? ? ? ? ? } else { > ? ? ? ? ? ? ? ? ? ? ? ? ASSERT3U(pp->valid, ==, VM_PAGE_BITS_ALL); > ? ? ? ? ? ? ? ? ? ? ? ? vm_page_sunbusy(pp); > > Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c > =========================================================================== > === > --- head/sys/compat/linuxkpi/common/src/linux_compat.c? Tue Oct 15 > 03:41:36 2019? ? ? ? (r353538) > +++ head/sys/compat/linuxkpi/common/src/linux_compat.c? Tue Oct 15 > 03:45:41 2019? ? ? ? (r353539) > @@ -514,7 +514,7 @@ linux_cdev_pager_fault(vm_object_t vm_obj, > vm_ooffset_ > ? ? ? ? ? ? ? ? ? ? ? ? vm_page_free(*mres); > ? ? ? ? ? ? ? ? ? ? ? ? *mres = page; > ? ? ? ? ? ? ? ? } > -?? ? ? ? ? ? ?page->valid = VM_PAGE_BITS_ALL; > +?? ? ? ? ? ? ?vm_page_valid(page); > ? ? ? ? ? ? ? ? return (VM_PAGER_OK); > ? ? ? ? } > ? ? ? ? return (VM_PAGER_FAIL); > > Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c > =========================================================================== > === > --- head/sys/dev/drm2/ttm/ttm_bo_vm.c? ?Tue Oct 15 03:41:36 2019? ? ? ? > (r353538) > +++ head/sys/dev/drm2/ttm/ttm_bo_vm.c? ?Tue Oct 15 03:45:41 2019? ? ? ? > (r353539) > @@ -252,7 +252,7 @@ reserve: > ? ? ? ? ? ? ? ? ? ? ("inconsistent insert bo %p m %p m1 %p offset %jx", > ? ? ? ? ? ? ? ? ? ? bo, m, m1, (uintmax_t)offset)); > ? ? ? ? } > -?? ? ?m->valid = VM_PAGE_BITS_ALL; > +?? ? ?vm_page_valid(m); > ? ? ? ? if (*mres != NULL) { > ? ? ? ? ? ? ? ? KASSERT(*mres != m, ("losing %p %p", *mres, m)); > ? ? ? ? ? ? ? ? vm_page_free(*mres); > > Modified: head/sys/dev/drm2/ttm/ttm_tt.c > =========================================================================== > === > --- head/sys/dev/drm2/ttm/ttm_tt.c? ? ? Tue Oct 15 03:41:36 2019? ? ? ? > (r353538) > +++ head/sys/dev/drm2/ttm/ttm_tt.c? ? ? Tue Oct 15 03:45:41 2019? ? ? ? > (r353539) > @@ -344,7 +344,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, > vm_object_t per > ? ? ? ? ? ? ? ? ? ? ? ? continue; > ? ? ? ? ? ? ? ? to_page = vm_page_grab(obj, i, VM_ALLOC_NORMAL); > ? ? ? ? ? ? ? ? pmap_copy_page(from_page, to_page); > -?? ? ? ? ? ? ?to_page->valid = VM_PAGE_BITS_ALL; > +?? ? ? ? ? ? ?vm_page_valid(to_page); > ? ? ? ? ? ? ? ? vm_page_dirty(to_page); > ? ? ? ? ? ? ? ? vm_page_xunbusy(to_page); > ? ? ? ? } > > Modified: head/sys/dev/md/md.c > =========================================================================== > === > --- head/sys/dev/md/md.c? ? ? ? Tue Oct 15 03:41:36 2019? ? ? ? (r353538) > +++ head/sys/dev/md/md.c? ? ? ? Tue Oct 15 03:45:41 2019? ? ? ? (r353539) > @@ -1074,7 +1074,7 @@ mdstart_swap(struct md_s *sc, struct bio > *bp) > ? ? ? ? ? ? ? ? len = ((i == lastp) ? lastend : PAGE_SIZE) - offs; > ? ? ? ? ? ? ? ? m = vm_page_grab(sc->object, i, VM_ALLOC_SYSTEM); > ? ? ? ? ? ? ? ? if (bp->bio_cmd == BIO_READ) { > -?? ? ? ? ? ? ? ? ? ? ?if (m->valid == VM_PAGE_BITS_ALL) > +?? ? ? ? ? ? ? ? ? ? ?if (vm_page_all_valid(m)) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? rv = VM_PAGER_OK; > ? ? ? ? ? ? ? ? ? ? ? ? else > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? rv = vm_pager_get_pages(sc->object, &m, 1, > @@ -1090,7 +1090,7 @@ mdstart_swap(struct md_s *sc, struct bio > *bp) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*can be recreated if thrown out. > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*/ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? pmap_zero_page(m); > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?m->valid = VM_PAGE_BITS_ALL; > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?vm_page_valid(m); > ? ? ? ? ? ? ? ? ? ? ? ? } > ? ? ? ? ? ? ? ? ? ? ? ? if ((bp->bio_flags & BIO_UNMAPPED) != 0) { > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? pmap_copy_pages(&m, offs, bp->bio_ma, > @@ -1104,7 +1104,7 @@ mdstart_swap(struct md_s *sc, struct bio > *bp) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cpu_flush_dcache(p, len); > ? ? ? ? ? ? ? ? ? ? ? ? } > ? ? ? ? ? ? ? ? } else if (bp->bio_cmd == BIO_WRITE) { > -?? ? ? ? ? ? ? ? ? ? ?if (len == PAGE_SIZE || m->valid == VM_PAGE_BITS_ALL) > +?? ? ? ? ? ? ? ? ? ? ?if (len == PAGE_SIZE || vm_page_all_valid(m)) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? rv = VM_PAGER_OK; > ? ? ? ? ? ? ? ? ? ? ? ? else > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? rv = vm_pager_get_pages(sc->object, &m, 1, > @@ -1125,13 +1125,13 @@ mdstart_swap(struct md_s *sc, struct bio > *bp) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? physcopyin(p, VM_PAGE_TO_PHYS(m) + offs, len); > ? ? ? ? ? ? ? ? ? ? ? ? } > > -?? ? ? ? ? ? ? ? ? ? ?m->valid = VM_PAGE_BITS_ALL; > +?? ? ? ? ? ? ? ? ? ? ?vm_page_valid(m); > ? ? ? ? ? ? ? ? ? ? ? ? if (m->dirty != VM_PAGE_BITS_ALL) { > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vm_page_dirty(m); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vm_pager_page_unswapped(m); > ? ? ? ? ? ? ? ? ? ? ? ? } > ? ? ? ? ? ? ? ? } else if (bp->bio_cmd == BIO_DELETE) { > -?? ? ? ? ? ? ? ? ? ? ?if (len == PAGE_SIZE || m->valid == VM_PAGE_BITS_ALL) > +?? ? ? ? ? ? ? ? ? ? ?if (len == PAGE_SIZE || vm_page_all_valid(m)) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? rv = VM_PAGER_OK; > ? ? ? ? ? ? ? ? ? ? ? ? else > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? rv = vm_pager_get_pages(sc->object, &m, 1, > > Modified: head/sys/dev/netmap/netmap_freebsd.c > =========================================================================== > === > --- head/sys/dev/netmap/netmap_freebsd.c? ? ? ? Tue Oct 15 03:41:36 2019? ? ? ? > (r353538) > +++ head/sys/dev/netmap/netmap_freebsd.c? ? ? ? Tue Oct 15 03:45:41 2019? ? ? ? > (r353539) > @@ -1056,7 +1056,7 @@ netmap_dev_pager_fault(vm_object_t object, > vm_ooffset_ > ? ? ? ? ? ? ? ? *mres = page; > ? ? ? ? ? ? ? ? vm_page_insert(page, object, pidx); > ? ? ? ? } > -?? ? ?page->valid = VM_PAGE_BITS_ALL; > +?? ? ?vm_page_valid(page); > ? ? ? ? return (VM_PAGER_OK); > > > > ?}Modified: head/sys/dev/xen/gntdev/gntdev.c > =========================================================================== > === > --- head/sys/dev/xen/gntdev/gntdev.c? ? Tue Oct 15 03:41:36 2019? ? ? ? > (r353538) > +++ head/sys/dev/xen/gntdev/gntdev.c? ? Tue Oct 15 03:45:41 2019? ? ? ? > (r353539) > @@ -836,8 +836,8 @@ gntdev_gmap_pg_fault(vm_object_t object, > vm_ooffset_t > ? ? ? ? } > > ? ? ? ? vm_page_busy_acquire(page, 0); > +?? ? ?vm_page_valid(page); > ? ? ? ? vm_page_insert(page, object, pidx); > -?? ? ?page->valid = VM_PAGE_BITS_ALL; > ? ? ? ? *mres = page; > ? ? ? ? return (VM_PAGER_OK); > > > ?}Modified: head/sys/dev/xen/privcmd/privcmd.c > =========================================================================== > === > --- head/sys/dev/xen/privcmd/privcmd.c? Tue Oct 15 03:41:36 2019? ? ? ? > (r353538) > +++ head/sys/dev/xen/privcmd/privcmd.c? Tue Oct 15 03:45:41 2019? ? ? ? > (r353539) > @@ -179,8 +179,8 @@ privcmd_pg_fault(vm_object_t object, > vm_ooffset_t offs > ? ? ? ? } > > ? ? ? ? vm_page_busy_acquire(page, 0); > +?? ? ?vm_page_valid(page); > ? ? ? ? vm_page_insert(page, object, pidx); > -?? ? ?page->valid = VM_PAGE_BITS_ALL; > ? ? ? ? *mres = page; > ? ? ? ? return (VM_PAGER_OK); > > > ?}Modified: head/sys/fs/nfsclient/nfs_clbio.c > =========================================================================== > === > --- head/sys/fs/nfsclient/nfs_clbio.c? ?Tue Oct 15 03:41:36 2019? ? ? ? > (r353538) > +++ head/sys/fs/nfsclient/nfs_clbio.c? ?Tue Oct 15 03:45:41 2019? ? ? ? > (r353539) > @@ -174,7 +174,7 @@ ncl_getpages(struct vop_getpages_args *ap) > ? ? ? ? ?*XXXGL: is that true for NFS, where short read can occur??? > ? ? ? ? ?*/ > ? ? ? ? VM_OBJECT_WLOCK(object); > -?? ? ?if (pages[npages - 1]->valid != 0 && --npages == 0) > +?? ? ?if (!vm_page_none_valid(pages[npages - 1]) && --npages == 0) > ? ? ? ? ? ? ? ? goto out; > ? ? ? ? VM_OBJECT_WUNLOCK(object); > > @@ -227,14 +227,14 @@ ncl_getpages(struct vop_getpages_args *ap) > ? ? ? ? ? ? ? ? ? ? ? ? /* > ? ? ? ? ? ? ? ? ? ? ? ? ?*Read operation filled an entire page > ? ? ? ? ? ? ? ? ? ? ? ? ?*/ > -?? ? ? ? ? ? ? ? ? ? ?m->valid = VM_PAGE_BITS_ALL; > +?? ? ? ? ? ? ? ? ? ? ?vm_page_valid(m); > ? ? ? ? ? ? ? ? ? ? ? ? KASSERT(m->dirty == 0, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ("nfs_getpages: page %p is dirty", m)); > ? ? ? ? ? ? ? ? } else if (size > toff) { > ? ? ? ? ? ? ? ? ? ? ? ? /* > ? ? ? ? ? ? ? ? ? ? ? ? ?*Read operation filled a partial page. > ? ? ? ? ? ? ? ? ? ? ? ? ?*/ > -?? ? ? ? ? ? ? ? ? ? ?m->valid = 0; > +?? ? ? ? ? ? ? ? ? ? ?vm_page_invalid(m); > ? ? ? ? ? ? ? ? ? ? ? ? vm_page_set_valid_range(m, 0, size - toff); > ? ? ? ? ? ? ? ? ? ? ? ? KASSERT(m->dirty == 0, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ("nfs_getpages: page %p is dirty", m)); > > Modified: head/sys/fs/smbfs/smbfs_io.c > =========================================================================== > === > --- head/sys/fs/smbfs/smbfs_io.c? ? ? ? Tue Oct 15 03:41:36 2019? ? ? ? > (r353538) > +++ head/sys/fs/smbfs/smbfs_io.c? ? ? ? Tue Oct 15 03:45:41 2019? ? ? ? > (r353539) > @@ -457,7 +457,7 @@ smbfs_getpages(ap) > ? ? ? ? ?*XXXGL: is that true for SMB filesystem? > ? ? ? ? ?*/ > ? ? ? ? VM_OBJECT_WLOCK(object); > -?? ? ?if (pages[npages - 1]->valid != 0 && --npages == 0) > +?? ? ?if (!vm_page_none_valid(pages[npages - 1]) && --npages == 0) > ? ? ? ? ? ? ? ? goto out; > ? ? ? ? VM_OBJECT_WUNLOCK(object); > > @@ -505,14 +505,14 @@ smbfs_getpages(ap) > ? ? ? ? ? ? ? ? ? ? ? ? /* > ? ? ? ? ? ? ? ? ? ? ? ? ?*Read operation filled an entire page > ? ? ? ? ? ? ? ? ? ? ? ? ?*/ > -?? ? ? ? ? ? ? ? ? ? ?m->valid = VM_PAGE_BITS_ALL; > +?? ? ? ? ? ? ? ? ? ? ?vm_page_valid(m); > ? ? ? ? ? ? ? ? ? ? ? ? KASSERT(m->dirty == 0, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ("smbfs_getpages: page %p is dirty", m)); > ? ? ? ? ? ? ? ? } else if (size > toff) { > ? ? ? ? ? ? ? ? ? ? ? ? /* > ? ? ? ? ? ? ? ? ? ? ? ? ?*Read operation filled a partial page. > ? ? ? ? ? ? ? ? ? ? ? ? ?*/ > -?? ? ? ? ? ? ? ? ? ? ?m->valid = 0; > +?? ? ? ? ? ? ? ? ? ? ?vm_page_invalid(m); > ? ? ? ? ? ? ? ? ? ? ? ? vm_page_set_valid_range(m, 0, size - toff); > ? ? ? ? ? ? ? ? ? ? ? ? KASSERT(m->dirty == 0, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ("smbfs_getpages: page %p is dirty", m)); > > Modified: head/sys/fs/tmpfs/tmpfs_subr.c > =========================================================================== > === > --- head/sys/fs/tmpfs/tmpfs_subr.c? ? ? Tue Oct 15 03:41:36 2019? ? ? ? > (r353538) > +++ head/sys/fs/tmpfs/tmpfs_subr.c? ? ? Tue Oct 15 03:45:41 2019? ? ? ? > (r353539) > @@ -1408,7 +1408,7 @@ tmpfs_reg_resize(struct vnode *vp, off_t > newsize, bool > ?retry: > ? ? ? ? ? ? ? ? ? ? ? ? m = vm_page_grab(uobj, idx, VM_ALLOC_NOCREAT); > ? ? ? ? ? ? ? ? ? ? ? ? if (m != NULL) { > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MPASS(m->valid == VM_PAGE_BITS_ALL); > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MPASS(vm_page_all_valid(m)); > ? ? ? ? ? ? ? ? ? ? ? ? } else if (vm_pager_has_page(uobj, idx, NULL, NULL)) { > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? m = vm_page_alloc(uobj, idx, VM_ALLOC_NORMAL | > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? VM_ALLOC_WAITFAIL); > > Modified: head/sys/kern/kern_exec.c > =========================================================================== > === > --- head/sys/kern/kern_exec.c? ?Tue Oct 15 03:41:36 2019? ? ? ? (r353538) > +++ head/sys/kern/kern_exec.c? ?Tue Oct 15 03:45:41 2019? ? ? ? (r353539) > @@ -979,11 +979,15 @@ exec_map_first_page(struct image_params > *imgp) > ?retry: > ? ? ? ? ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | > VM_ALLOC_NOBUSY | > ? ? ? ? ? ? VM_ALLOC_WIRED); > -?? ? ?if (ma[0]->valid != VM_PAGE_BITS_ALL) { > +?? ? ?if (!vm_page_all_valid(ma[0])) { > ? ? ? ? ? ? ? ? if (vm_page_busy_acquire(ma[0], VM_ALLOC_WAITFAIL) == 0) { > ? ? ? ? ? ? ? ? ? ? ? ? vm_page_unwire_noq(ma[0]); > ? ? ? ? ? ? ? ? ? ? ? ? goto retry; > ? ? ? ? ? ? ? ? } > +?? ? ? ? ? ? ?if (vm_page_all_valid(ma[0])) { > +?? ? ? ? ? ? ? ? ? ? ?vm_page_xunbusy(ma[0]); > +?? ? ? ? ? ? ? ? ? ? ?goto out; > +?? ? ? ? ? ? > ?}? ? ? ? ? ? ? ? if (!vm_pager_has_page(object, 0, NULL, &after)) { > ? ? ? ? ? ? ? ? ? ? ? ? if (vm_page_unwire_noq(ma[0])) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vm_page_free(ma[0]); > @@ -1029,6 +1033,8 @@ retry: > ? ? ? ? ? ? ? ? for (i = 1; i < initial_pagein; i++) > ? ? ? ? ? ? ? ? ? ? ? ? vm_page_readahead_finish(ma[i]); > ? ? ? ? } > + > +out: > ? ? ? ? VM_OBJECT_WUNLOCK(object); > > ? ? ? ? imgp->firstpage = sf_buf_alloc(ma[0], 0); > > Modified: head/sys/kern/uipc_shm.c > =========================================================================== > === > --- head/sys/kern/uipc_shm.c? ? Tue Oct 15 03:41:36 2019? ? ? ? (r353538) > +++ head/sys/kern/uipc_shm.c? ? Tue Oct 15 03:45:41 2019? ? ? ? (r353539) > @@ -459,7 +459,7 @@ shm_dotruncate_locked(struct shmfd *shmfd, > off_t lengt > ?retry: > ? ? ? ? ? ? ? ? ? ? ? ? m = vm_page_grab(object, idx, VM_ALLOC_NOCREAT); > ? ? ? ? ? ? ? ? ? ? ? ? if (m != NULL) { > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MPASS(m->valid == VM_PAGE_BITS_ALL); > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MPASS(vm_page_all_valid(m)); > ? ? ? ? ? ? ? ? ? ? ? ? } else if (vm_pager_has_page(object, idx, NULL, NULL)) { > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? m = vm_page_alloc(object, idx, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? VM_ALLOC_NORMAL | VM_ALLOC_WAITFAIL); > @@ -485,7 +485,7 @@ retry: > ? ? ? ? ? ? ? ? ? ? ? ? } > ? ? ? ? ? ? ? ? ? ? ? ? if (m != NULL) { > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? pmap_zero_page_area(m, base, PAGE_SIZE - base); > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?KASSERT(m->valid == VM_PAGE_BITS_ALL, > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?KASSERT(vm_page_all_valid(m), > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ("shm_dotruncate: page %p is invalid", m)); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vm_page_dirty(m); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vm_page_xunbusy(m); > > Modified: head/sys/kern/vfs_bio.c > =========================================================================== > === > --- head/sys/kern/vfs_bio.c? ? ?Tue Oct 15 03:41:36 2019? ? ? ? (r353538) > +++ head/sys/kern/vfs_bio.c? ? ?Tue Oct 15 03:45:41 2019? ? ? ? (r353539) > @@ -956,6 +956,12 @@ vfs_buf_test_cache(struct buf *bp, > vm_ooffset_t foff, > > > ?{? ? ? ? VM_OBJECT_ASSERT_LOCKED(m->object); > + > +?? ? ?/* > +?? ? ? * This function and its results are protected by higher level > +?? ? ? * synchronization requiring vnode and buf locks to page in and > +?? ? ? * validate pages. > +?? ? ? */ > ? ? ? ? if (bp->b_flags & B_CACHE) { > ? ? ? ? ? ? ? ? int base = (foff + off) & PAGE_MASK; > ? ? ? ? ? ? ? ? if (vm_page_is_valid(m, base, size) == 0) > @@ -4640,7 +4646,7 @@ vfs_busy_pages(struct buf *bp, int > clear_modify) > ? ? ? ? ? ? ? ? if (clear_modify) { > ? ? ? ? ? ? ? ? ? ? ? ? pmap_remove_write(m); > ? ? ? ? ? ? ? ? ? ? ? ? vfs_page_set_validclean(bp, foff, m); > -?? ? ? ? ? ? ?}else if (m->valid == VM_PAGE_BITS_ALL && > +?? ? ? ? ? ? ?}else if (vm_page_all_valid(m) && > ? ? ? ? ? ? ? ? ? ? (bp->b_flags & B_CACHE) == 0) { > ? ? ? ? ? ? ? ? ? ? ? ? bp->b_pages[i] = bogus_page; > ? ? ? ? ? ? ? ? ? ? ? ? bogus = true; > @@ -4681,6 +4687,14 @@ vfs_bio_set_valid(struct buf *bp, int > base, int size) > ? ? ? ? n = PAGE_SIZE - (base & PAGE_MASK); > > ? ? ? ? VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); > + > +?? ? ?/* > +?? ? ? * Busy may not be strictly necessary here because the pages are > +?? ? ? * unlikely to be fully valid and the vnode lock will synchronize > +?? ? ? * their access via getpages.? It is grabbed for consistency with > +?? ? ? * other page validation. > +?? ? ? */ > +?? ? ?vfs_busy_pages_acquire(bp); > ? ? ? ? for (i = base / PAGE_SIZE; size > 0 && i < bp->b_npages; ++i) { > ? ? ? ? ? ? ? ? m = bp->b_pages[i]; > ? ? ? ? ? ? ? ? if (n > size) > @@ -4690,6 +4704,7 @@ vfs_bio_set_valid(struct buf *bp, int > base, int size) > ? ? ? ? ? ? ? ? size -= n; > ? ? ? ? ? ? ? ? n = PAGE_SIZE; > ? ? ? ? } > +?? ? ?vfs_busy_pages_release(bp); > ? ? ? ? VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); > > > ?}@@ -4717,6 +4732,7 @@ vfs_bio_clrbuf(struct buf *bp) > ? ? ? ? bp->b_flags &= ~B_INVAL; > ? ? ? ? bp->b_ioflags &= ~BIO_ERROR; > ? ? ? ? VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); > +?? ? ?vfs_busy_pages_acquire(bp); > ? ? ? ? if ((bp->b_npages == 1) && (bp->b_bufsize < PAGE_SIZE) && > ? ? ? ? ? ? (bp->b_offset & PAGE_MASK) == 0) { > ? ? ? ? ? ? ? ? if (bp->b_pages[0] == bogus_page) > @@ -4758,6 +4774,7 @@ vfs_bio_clrbuf(struct buf *bp) > ? ? ? ? ? ? ? ? bp->b_pages[i]->valid |= mask; > ? ? ? ? } > ?unlock: > +?? ? ?vfs_busy_pages_release(bp); > ? ? ? ? VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); > ? ? ? ? bp->b_resid = 0; > > ?}@@ -5189,7 +5206,7 @@ again: > ? ? ? ? ? ? ? ? ?*the end of the function catches the race in a > ? ? ? ? ? ? ? ? ?*reliable way (protected by the object lock). > ? ? ? ? ? ? ? ? ?*/ > -?? ? ? ? ? ? ?if (m->valid == VM_PAGE_BITS_ALL) > +?? ? ? ? ? ? ?if (vm_page_all_valid(m)) > ? ? ? ? ? ? ? ? ? ? ? ? continue; > > ? ? ? ? ? ? ? ? poff = IDX_TO_OFF(m->pindex); > @@ -5219,7 +5236,7 @@ again: > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*cache pressure. > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*/ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (buf_pager_relbuf || > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?m->valid != VM_PAGE_BITS_ALL) > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?!vm_page_all_valid(m)) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bp->b_flags |= B_RELBUF; > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bp->b_flags &= ~B_NOCACHE; > @@ -5229,12 +5246,12 @@ again: > ? ? ? ? ? ? ? ? ? ? ? ? } > ? ? ? ? ? ? ? ? } > ? ? ? ? ? ? ? ? KASSERT(1 /* racy, enable for debugging */ || > -?? ? ? ? ? ? ? ? ?m->valid == VM_PAGE_BITS_ALL || i == count - 1, > +?? ? ? ? ? ? ? ? ?vm_page_all_valid(m) || i == count - 1, > ? ? ? ? ? ? ? ? ? ? ("buf %d %p invalid", i, m)); > ? ? ? ? ? ? ? ? if (i == count - 1 && lpart) { > ? ? ? ? ? ? ? ? ? ? ? ? VM_OBJECT_WLOCK(object); > -?? ? ? ? ? ? ? ? ? ? ?if (m->valid != 0 && > -?? ? ? ? ? ? ? ? ? ? ? ? ?m->valid != VM_PAGE_BITS_ALL) > +?? ? ? ? ? ? ? ? ? ? ?if (!vm_page_none_valid(m) && > +?? ? ? ? ? ? ? ? ? ? ? ? ?!vm_page_all_valid(m)) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vm_page_zero_invalid(m, TRUE); > ? ? ? ? ? ? ? ? ? ? ? ? VM_OBJECT_WUNLOCK(object); > ? ? ? ? ? ? ? ? } > @@ -5261,7 +5278,7 @@ end_pages: > ? ? ? ? ? ? ? ? ?*invalidated or removed, so we must restart for > ? ? ? ? ? ? ? ? ?*safety as well. > ? ? ? ? ? ? ? ? ?*/ > -?? ? ? ? ? ? ?if (ma[i]->valid != VM_PAGE_BITS_ALL) > +?? ? ? ? ? ? ?if (!vm_page_all_valid(ma[i])) > ? ? ? ? ? ? ? ? ? ? ? ? redo = true; > ? ? ? ? } > ? ? ? ? if (redo && error == 0) > > Modified: head/sys/kern/vfs_cluster.c > =========================================================================== > === > --- head/sys/kern/vfs_cluster.c Tue Oct 15 03:41:36 2019? ? ? ? > (r353538) > +++ head/sys/kern/vfs_cluster.c Tue Oct 15 03:45:41 2019? ? ? ? > (r353539) > @@ -465,11 +465,13 @@ cluster_rbuild(struct vnode *vp, u_quad_t > filesize, da > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (toff + tinc > PAGE_SIZE) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? tinc = PAGE_SIZE - toff; > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? VM_OBJECT_ASSERT_WLOCKED(tbp->b_pages[j]->object); > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if ((tbp->b_pages[j]->valid & > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?vm_page_bits(toff, tinc)) != 0) > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break; > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (vm_page_trysbusy(tbp->b_pages[j]) == 0) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if ((tbp->b_pages[j]->valid & > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?vm_page_bits(toff, tinc)) != 0) { > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?vm_page_sunbusy(tbp->b_pages[j]); > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break; > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? > ?}? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vm_object_pip_add(tbp->b_bufobj->bo_object, 1); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? off += tinc; > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? tsize -= tinc; > @@ -524,7 +526,7 @@ clean_sbusy: > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bp->b_pages[bp->b_npages] = m; > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bp->b_npages++; > ? ? ? ? ? ? ? ? ? ? ? ? } > -?? ? ? ? ? ? ? ? ? ? ?if (m->valid == VM_PAGE_BITS_ALL) > +?? ? ? ? ? ? ? ? ? ? ?if (vm_page_all_valid(m)) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? tbp->b_pages[j] = bogus_page; > ? ? ? ? ? ? ? ? } > ? ? ? ? ? ? ? ? VM_OBJECT_WUNLOCK(tbp->b_bufobj->bo_object); > @@ -548,7 +550,7 @@ clean_sbusy: > ? ? ? ? VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); > ? ? ? ? for (j = 0; j < bp->b_npages; j++) { > ? ? ? ? ? ? ? ? VM_OBJECT_ASSERT_WLOCKED(bp->b_pages[j]->object); > -?? ? ? ? ? ? ?if (bp->b_pages[j]->valid == VM_PAGE_BITS_ALL) > +?? ? ? ? ? ? ?if (vm_page_all_valid(bp->b_pages[j])) > ? ? ? ? ? ? ? ? ? ? ? ? bp->b_pages[j] = bogus_page; > ? ? ? ? } > ? ? ? ? VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); > > Modified: head/sys/vm/device_pager.c > =========================================================================== > === > --- head/sys/vm/device_pager.c? Tue Oct 15 03:41:36 2019? ? ? ? (r353538) > +++ head/sys/vm/device_pager.c? Tue Oct 15 03:45:41 2019? ? ? ? (r353539) > @@ -395,7 +395,7 @@ old_dev_pager_fault(vm_object_t object, > vm_ooffset_t o > ? ? ? ? ? ? ? ? vm_page_free(*mres); > ? ? ? ? ? ? ? ? *mres = page; > ? ? ? ? } > -?? ? ?page->valid = VM_PAGE_BITS_ALL; > +?? ? ?vm_page_valid(page); > ? ? ? ? return (VM_PAGER_OK); > > > > ?}Modified: head/sys/vm/phys_pager.c > =========================================================================== > === > --- head/sys/vm/phys_pager.c? ? Tue Oct 15 03:41:36 2019? ? ? ? (r353538) > +++ head/sys/vm/phys_pager.c? ? Tue Oct 15 03:45:41 2019? ? ? ? (r353539) > @@ -145,12 +145,12 @@ phys_pager_getpages(vm_object_t object, > vm_page_t *m, > > ? ? ? ? VM_OBJECT_ASSERT_WLOCKED(object); > ? ? ? ? for (i = 0; i < count; i++) { > -?? ? ? ? ? ? ?if (m[i]->valid == 0) { > +?? ? ? ? ? ? ?if (vm_page_none_valid(m[i])) { > ? ? ? ? ? ? ? ? ? ? ? ? if ((m[i]->flags & PG_ZERO) == 0) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? pmap_zero_page(m[i]); > -?? ? ? ? ? ? ? ? ? ? ?m[i]->valid = VM_PAGE_BITS_ALL; > +?? ? ? ? ? ? ? ? ? ? ?vm_page_valid(m[i]); > ? ? ? ? ? ? ? ? } > -?? ? ? ? ? ? ?KASSERT(m[i]->valid == VM_PAGE_BITS_ALL, > +?? ? ? ? ? ? ?KASSERT(vm_page_all_valid(m[i]), > ? ? ? ? ? ? ? ? ? ? ("phys_pager_getpages: partially valid page %p", m[i])); > ? ? ? ? ? ? ? ? KASSERT(m[i]->dirty == 0, > ? ? ? ? ? ? ? ? ? ? ("phys_pager_getpages: dirty page %p", m[i])); > @@ -209,10 +209,8 @@ phys_pager_populate(vm_object_t object, > vm_pindex_t pi > ? ? ? ? ? ? ? ? ahead = MIN(end - i, PHYSALLOC); > ? ? ? ? ? ? ? ? m = vm_page_grab(object, i, > ? ? ? ? ? ? ? ? ? ? VM_ALLOC_NORMAL | VM_ALLOC_COUNT(ahead)); > -?? ? ? ? ? ? ?if (m->valid != VM_PAGE_BITS_ALL) { > +?? ? ? ? ? ? ?if (!vm_page_all_valid(m)) > ? ? ? ? ? ? ? ? ? ? ? ? vm_page_zero_invalid(m, TRUE); > -?? ? ? ? ? ? ? ? ? ? ?m->valid = VM_PAGE_BITS_ALL; > -?? ? ? ? ? ? > ?}? ? ? ? ? ? ? ? KASSERT(m->dirty == 0, > ? ? ? ? ? ? ? ? ? ? ("phys_pager_populate: dirty page %p", m)); > ? ? ? ? } > > Modified: head/sys/vm/sg_pager.c > =========================================================================== > === > --- head/sys/vm/sg_pager.c? ? ? Tue Oct 15 03:41:36 2019? ? ? ? (r353538) > +++ head/sys/vm/sg_pager.c? ? ? Tue Oct 15 03:45:41 2019? ? ? ? (r353539) > @@ -198,7 +198,7 @@ sg_pager_getpages(vm_object_t object, > vm_page_t *m, in > ? ? ? ? vm_page_free(m[0]); > ? ? ? ? vm_page_unlock(m[0]); > ? ? ? ? m[0] = page; > -?? ? ?page->valid = VM_PAGE_BITS_ALL; > +?? ? ?vm_page_valid(page); > > ? ? ? ? if (rbehind) > ? ? ? ? ? ? ? ? *rbehind = 0; > > Modified: head/sys/vm/swap_pager.c > =========================================================================== > === > --- head/sys/vm/swap_pager.c? ? Tue Oct 15 03:41:36 2019? ? ? ? (r353538) > +++ head/sys/vm/swap_pager.c? ? Tue Oct 15 03:45:41 2019? ? ? ? (r353539) > @@ -1554,7 +1554,7 @@ swp_pager_async_iodone(struct buf *bp) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*be overridden by the original caller of > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*getpages so don't play cute tricks here. > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*/ > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?m->valid = 0; > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?vm_page_invalid(m); > ? ? ? ? ? ? ? ? ? ? ? ? } else { > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? /* > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*If a write error occurs, reactivate page > @@ -1582,7 +1582,7 @@ swp_pager_async_iodone(struct buf *bp) > ? ? ? ? ? ? ? ? ? ? ? ? KASSERT(m->dirty == 0, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ("swp_pager_async_iodone: page %p is dirty", m)); > > -?? ? ? ? ? ? ? ? ? ? ?m->valid = VM_PAGE_BITS_ALL; > +?? ? ? ? ? ? ? ? ? ? ?vm_page_valid(m); > ? ? ? ? ? ? ? ? ? ? ? ? if (i < bp->b_pgbefore || > ? ? ? ? ? ? ? ? ? ? ? ? ? ? i >= bp->b_npages - bp->b_pgafter) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vm_page_readahead_finish(m); > > Modified: head/sys/vm/vm_fault.c > =========================================================================== > === > --- head/sys/vm/vm_fault.c? ? ? Tue Oct 15 03:41:36 2019? ? ? ? (r353538) > +++ head/sys/vm/vm_fault.c? ? ? Tue Oct 15 03:45:41 2019? ? ? ? (r353539) > @@ -211,6 +211,7 @@ vm_fault_dirty(vm_map_entry_t entry, > vm_page_t m, vm_p > ? ? ? ? ? ? ? ? return; > > ? ? ? ? VM_OBJECT_ASSERT_LOCKED(m->object); > +?? ? ?VM_PAGE_OBJECT_BUSY_ASSERT(m); > > ? ? ? ? need_dirty = ((fault_type & VM_PROT_WRITE) != 0 && > ? ? ? ? ? ? (fault_flags & VM_FAULT_WIRE) == 0) || > @@ -285,7 +286,7 @@ vm_fault_soft_fast(struct faultstate *fs, > vm_offset_t > ? ? ? ? m = vm_page_lookup(fs->first_object, fs->first_pindex); > ? ? ? ? /* A busy page can be mapped for read|execute access. */ > ? ? ? ? if (m == NULL || ((prot & VM_PROT_WRITE) != 0 && > -?? ? ? ? ?vm_page_busied(m)) || m->valid != VM_PAGE_BITS_ALL) { > +?? ? ? ? ?vm_page_busied(m)) || !vm_page_all_valid(m)) { > ? ? ? ? ? ? ? ? rv = KERN_FAILURE; > ? ? ? ? ? ? ? ? goto out; > ? ? ? ? } > @@ -368,7 +369,7 @@ vm_fault_populate_check_page(vm_page_t m) > ? ? ? ? ?*valid, and exclusively busied. > ? ? ? ? ?*/ > ? ? ? ? MPASS(m != NULL); > -?? ? ?MPASS(m->valid == VM_PAGE_BITS_ALL); > +?? ? ?MPASS(vm_page_all_valid(m)); > ? ? ? ? MPASS(vm_page_xbusied(m)); > > > ?}@@ -830,7 +831,7 @@ RetryFault_oom: > ? ? ? ? ? ? ? ? ? ? ? ? ?*(readable), jump to readrest, else break-out ( we > ? ? ? ? ? ? ? ? ? ? ? ? ?*found the page ). > ? ? ? ? ? ? ? ? ? ? ? ? ?*/ > -?? ? ? ? ? ? ? ? ? ? ?if (fs.m->valid != VM_PAGE_BITS_ALL) > +?? ? ? ? ? ? ? ? ? ? ?if (!vm_page_all_valid(fs.m)) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? goto readrest; > ? ? ? ? ? ? ? ? ? ? ? ? break; /* break to PAGE HAS BEEN FOUND */ > ? ? ? ? ? ? ? ? } > @@ -1154,7 +1155,7 @@ readrest: > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? VM_CNT_INC(v_ozfod); > ? ? ? ? ? ? ? ? ? ? ? ? } > ? ? ? ? ? ? ? ? ? ? ? ? VM_CNT_INC(v_zfod); > -?? ? ? ? ? ? ? ? ? ? ?fs.m->valid = VM_PAGE_BITS_ALL; > +?? ? ? ? ? ? ? ? ? ? ?vm_page_valid(fs.m); > ? ? ? ? ? ? ? ? ? ? ? ? /* Don't try to prefault neighboring pages. */ > ? ? ? ? ? ? ? ? ? ? ? ? faultcount = 1; > ? ? ? ? ? ? ? ? ? ? ? ? break;? /* break to PAGE HAS BEEN FOUND */ > @@ -1245,7 +1246,7 @@ readrest: > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*Oh, well, lets copy it. > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*/ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? pmap_copy_page(fs.m, fs.first_m); > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?fs.first_m->valid = VM_PAGE_BITS_ALL; > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?vm_page_valid(fs.first_m); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (wired && (fault_flags & > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? VM_FAULT_WIRE) == 0) { > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vm_page_wire(fs.first_m); > @@ -1364,7 +1365,7 @@ readrest: > ? ? ? ? ?*Page must be completely valid or it is not fit to > ? ? ? ? ?*map into user space.? vm_pager_get_pages() ensures this. > ? ? ? ? ?*/ > -?? ? ?KASSERT(fs.m->valid == VM_PAGE_BITS_ALL, > +?? ? ?KASSERT(vm_page_all_valid(fs.m), > ? ? ? ? ? ? ("vm_fault: page %p partially invalid", fs.m)); > ? ? ? ? VM_OBJECT_WUNLOCK(fs.object); > > @@ -1480,7 +1481,7 @@ vm_fault_dontneed(const struct faultstate > *fs, vm_offs > ? ? ? ? ? ? ? ? ? ? ? ? ? ? entry->start); > ? ? ? ? ? ? ? ? ? ? ? ? while ((m = m_next) != NULL && m->pindex < pend) { > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? m_next = TAILQ_NEXT(m, listq); > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (m->valid != VM_PAGE_BITS_ALL || > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (!vm_page_all_valid(m) || > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vm_page_busied(m)) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? continue; > > @@ -1577,7 +1578,7 @@ vm_fault_prefault(const struct faultstate > *fs, vm_offs > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? VM_OBJECT_RUNLOCK(lobject); > ? ? ? ? ? ? ? ? ? ? ? ? break; > ? ? ? ? ? ? ? ? } > -?? ? ? ? ? ? ?if (m->valid == VM_PAGE_BITS_ALL && > +?? ? ? ? ? ? ?if (vm_page_all_valid(m) && > ? ? ? ? ? ? ? ? ? ? (m->flags & PG_FICTITIOUS) == 0) > ? ? ? ? ? ? ? ? ? ? ? ? pmap_enter_quick(pmap, addr, m, entry->protection); > ? ? ? ? ? ? ? ? if (!obj_locked || lobject != entry->object.vm_object) > @@ -1852,7 +1853,7 @@ again: > ? ? ? ? ? ? ? ? ?*all copies of the wired map entry have similar > ? ? ? ? ? ? ? ? ?*backing pages. > ? ? ? ? ? ? ? ? ?*/ > -?? ? ? ? ? ? ?if (dst_m->valid == VM_PAGE_BITS_ALL) { > +?? ? ? ? ? ? ?if (vm_page_all_valid(dst_m)) { > ? ? ? ? ? ? ? ? ? ? ? ? pmap_enter(dst_map->pmap, vaddr, dst_m, prot, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? access | (upgrade ? PMAP_ENTER_WIRED : 0), 0); > ? ? ? ? ? ? ? ? } > > Modified: head/sys/vm/vm_map.c > =========================================================================== > === > --- head/sys/vm/vm_map.c? ? ? ? Tue Oct 15 03:41:36 2019? ? ? ? (r353538) > +++ head/sys/vm/vm_map.c? ? ? ? Tue Oct 15 03:45:41 2019? ? ? ? (r353539) > @@ -2358,7 +2358,7 @@ vm_map_pmap_enter(vm_map_t map, > vm_offset_t addr, vm_p > ? ? ? ? ? ? ? ? ? ? ? ? psize = tmpidx; > ? ? ? ? ? ? ? ? ? ? ? ? break; > ? ? ? ? ? ? ? ? } > -?? ? ? ? ? ? ?if (p->valid == VM_PAGE_BITS_ALL) { > +?? ? ? ? ? ? ?if (vm_page_all_valid(p)) { > ? ? ? ? ? ? ? ? ? ? ? ? if (p_start == NULL) { > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? start = addr + ptoa(tmpidx); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? p_start = p; > > Modified: head/sys/vm/vm_mmap.c > =========================================================================== > === > --- head/sys/vm/vm_mmap.c? ? ? ?Tue Oct 15 03:41:36 2019? ? ? ? (r353538) > +++ head/sys/vm/vm_mmap.c? ? ? ?Tue Oct 15 03:45:41 2019? ? ? ? (r353539) > @@ -893,7 +893,7 @@ RestartScan: > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } else > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vm_page_unlock(m); > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?KASSERT(m->valid == VM_PAGE_BITS_ALL, > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?KASSERT(vm_page_all_valid(m), > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ("mincore: page %p is mapped but invalid", > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? m)); > ? ? ? ? ? ? ? ? ? ? ? ? } else if (mincoreinfo == 0) { > @@ -915,7 +915,7 @@ RestartScan: > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? pindex = OFF_TO_IDX(current->offset + > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (addr - current->start)); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? m = vm_page_lookup(object, pindex); > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (m != NULL && m->valid == 0) > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (m != NULL && vm_page_none_valid(m)) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? m = NULL; > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (m != NULL) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mincoreinfo = MINCORE_INCORE; > > Modified: head/sys/vm/vm_object.c > =========================================================================== > === > --- head/sys/vm/vm_object.c? ? ?Tue Oct 15 03:41:36 2019? ? ? ? (r353538) > +++ head/sys/vm/vm_object.c? ? ?Tue Oct 15 03:45:41 2019? ? ? ? (r353539) > @@ -841,7 +841,7 @@ rescan: > ? ? ? ? ? ? ? ? if (pi >= tend) > ? ? ? ? ? ? ? ? ? ? ? ? break; > ? ? ? ? ? ? ? ? np = TAILQ_NEXT(p, listq); > -?? ? ? ? ? ? ?if (p->valid == 0) > +?? ? ? ? ? ? ?if (vm_page_none_valid(p)) > ? ? ? ? ? ? ? ? ? ? ? ? continue; > ? ? ? ? ? ? ? ? if (vm_page_busy_acquire(p, VM_ALLOC_WAITFAIL) == 0) { > ? ? ? ? ? ? ? ? ? ? ? ? if (object->generation != curgeneration) { > @@ -1161,10 +1161,10 @@ next_page: > ? ? ? ? ? ? ? ? } > > ? ? ? ? ? ? ? ? /* > -?? ? ? ? ? ? ? * If the page is not in a normal state, skip it. > +?? ? ? ? ? ? ? * If the page is not in a normal state, skip it.? The page > +?? ? ? ? ? ? ? * can not be invalidated while the object lock is held. > ? ? ? ? ? ? ? ? ?*/ > -?? ? ? ? ? ? ?if (tm->valid != VM_PAGE_BITS_ALL || > -?? ? ? ? ? ? ? ? ?vm_page_wired(tm)) > +?? ? ? ? ? ? ?if (!vm_page_all_valid(tm) || vm_page_wired(tm)) > ? ? ? ? ? ? ? ? ? ? ? ? goto next_pindex; > ? ? ? ? ? ? ? ? KASSERT((tm->flags & PG_FICTITIOUS) == 0, > ? ? ? ? ? ? ? ? ? ? ("vm_object_madvise: page %p is fictitious", tm)); > @@ -1488,7 +1488,11 @@ vm_object_scan_all_shadowed(vm_object_t > object) > ? ? ? ? ? ? ? ? ?*object and we might as well give up now. > ? ? ? ? ? ? ? ? ?*/ > ? ? ? ? ? ? ? ? pp = vm_page_lookup(object, new_pindex); > -?? ? ? ? ? ? ?if ((pp == NULL || pp->valid == 0) && > +?? ? ? ? ? ? ?/* > +?? ? ? ? ? ? ? * The valid check here is stable due to object lock being > +?? ? ? ? ? ? ? * required to clear valid and initiate paging. > +?? ? ? ? ? ? ? */ > +?? ? ? ? ? ? ?if ((pp == NULL || vm_page_none_valid(pp)) && > ? ? ? ? ? ? ? ? ? ? !vm_pager_has_page(object, new_pindex, NULL, NULL)) > ? ? ? ? ? ? ? ? ? ? ? ? return (false); > ? ? ? ? } > @@ -1567,7 +1571,7 @@ vm_object_collapse_scan(vm_object_t > object, int op) > ? ? ? ? ? ? ? ? ? ? ? ? continue; > ? ? ? ? ? ? ? ? } > > -?? ? ? ? ? ? ?KASSERT(pp == NULL || pp->valid != 0, > +?? ? ? ? ? ? ?KASSERT(pp == NULL || !vm_page_none_valid(pp), > ? ? ? ? ? ? ? ? ? ? ("unbusy invalid page %p", pp)); > > ? ? ? ? ? ? ? ? if (pp != NULL || vm_pager_has_page(object, new_pindex, NULL, > @@ -1894,7 +1898,7 @@ wired: > ? ? ? ? ? ? ? ? ? ? ? ? ? ? object->ref_count != 0) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? pmap_remove_all(p); > ? ? ? ? ? ? ? ? ? ? ? ? if ((options & OBJPR_CLEANONLY) == 0) { > -?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?p->valid = 0; > +?? ? ? ? ? ? ? ? ? ? ? ? ? ? ?vm_page_invalid(p); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vm_page_undirty(p); > ? ? ? ? ? ? ? ? ? ? ? ? } > ? ? ? ? ? ? ? ? ? ? ? ? vm_page_xunbusy(p); > @@ -1902,7 +1906,8 @@ wired: > ? ? ? ? ? ? ? ? } > ? ? ? ? ? ? ? ? KASSERT((p->flags & PG_FICTITIOUS) == 0, > ? ? ? ? ? ? ? ? ? ? ("vm_object_page_remove: page %p is fictitious", p)); > -?? ? ? ? ? ? ?if ((options & OBJPR_CLEANONLY) != 0 && p->valid != 0) { > +?? ? ? ? ? ? ?if ((options & OBJPR_CLEANONLY) != 0 && > +?? ? ? ? ? ? ? ? ?!vm_page_none_valid(p)) { > ? ? ? ? ? ? ? ? ? ? ? ? if ((options & OBJPR_NOTMAPPED) == 0 && > ? ? ? ? ? ? ? ? ? > > > From owner-svn-src-all@freebsd.org Tue Oct 15 21:56:20 2019 Return-Path: Delivered-To: svn-src-all@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 626471557B6; Tue, 15 Oct 2019 21:56:20 +0000 (UTC) (envelope-from erj@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 46t8QD1zpjz3QGs; Tue, 15 Oct 2019 21:56:20 +0000 (UTC) (envelope-from erj@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 27A66250B1; Tue, 15 Oct 2019 21:56:20 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9FLuKtx078587; Tue, 15 Oct 2019 21:56:20 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FLuKfa078586; Tue, 15 Oct 2019 21:56:20 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201910152156.x9FLuKfa078586@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Tue, 15 Oct 2019 21:56:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353599 - head/sys/dev/ixgbe X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/dev/ixgbe X-SVN-Commit-Revision: 353599 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 21:56:20 -0000 Author: erj Date: Tue Oct 15 21:56:19 2019 New Revision: 353599 URL: https://svnweb.freebsd.org/changeset/base/353599 Log: ixgbe: Disable EEE for backplane X550EM_X From Zach: Intel documentation indicates that backplane X550EM_X KR devices do not support Energy Efficient Ethernet. Prior to this patch, X552 devices (device ID 0x15AB) will crash the system when transitioning EEE state via sysctl. Signed-off-by: Zach Vargas PR: 240320 Submitted by: Zach Vargas Reviewed by: erj@ MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D21673 Modified: head/sys/dev/ixgbe/if_ix.c Modified: head/sys/dev/ixgbe/if_ix.c ============================================================================== --- head/sys/dev/ixgbe/if_ix.c Tue Oct 15 21:32:38 2019 (r353598) +++ head/sys/dev/ixgbe/if_ix.c Tue Oct 15 21:56:19 2019 (r353599) @@ -4414,7 +4414,7 @@ ixgbe_sysctl_eee_state(SYSCTL_HANDLER_ARGS) if ((new_eee < 0) || (new_eee > 1)) return (EINVAL); - retval = adapter->hw.mac.ops.setup_eee(&adapter->hw, new_eee); + retval = ixgbe_setup_eee(&adapter->hw, new_eee); if (retval) { device_printf(dev, "Error in EEE setup: 0x%08X\n", retval); return (EINVAL); @@ -4467,8 +4467,6 @@ ixgbe_init_device_features(struct adapter *adapter) case ixgbe_mac_X550EM_x: adapter->feat_cap |= IXGBE_FEATURE_SRIOV; adapter->feat_cap |= IXGBE_FEATURE_FDIR; - if (adapter->hw.device_id == IXGBE_DEV_ID_X550EM_X_KR) - adapter->feat_cap |= IXGBE_FEATURE_EEE; break; case ixgbe_mac_X550EM_a: adapter->feat_cap |= IXGBE_FEATURE_SRIOV; From owner-svn-src-all@freebsd.org Tue Oct 15 23:21:53 2019 Return-Path: Delivered-To: svn-src-all@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 66A48156D05; Tue, 15 Oct 2019 23:21:53 +0000 (UTC) (envelope-from kp@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 46tBJx23KQz3yhl; Tue, 15 Oct 2019 23:21:53 +0000 (UTC) (envelope-from kp@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 298F826074; Tue, 15 Oct 2019 23:21:53 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9FNLrfm029861; Tue, 15 Oct 2019 23:21:53 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FNLqQh029860; Tue, 15 Oct 2019 23:21:52 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201910152321.x9FNLqQh029860@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 15 Oct 2019 23:21:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353600 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 353600 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 23:21:53 -0000 Author: kp Date: Tue Oct 15 23:21:52 2019 New Revision: 353600 URL: https://svnweb.freebsd.org/changeset/base/353600 Log: Generalize ARM specific comments in devmap The comments in devmap are very ARM specific, this generalizes them for other architectures. Submitted by: Nicholas O'Brien Reviewed by: manu, philip Sponsored by: Axiado Differential Revision: https://reviews.freebsd.org/D22035 Modified: head/sys/kern/subr_devmap.c head/sys/sys/devmap.h Modified: head/sys/kern/subr_devmap.c ============================================================================== --- head/sys/kern/subr_devmap.c Tue Oct 15 21:56:19 2019 (r353599) +++ head/sys/kern/subr_devmap.c Tue Oct 15 23:21:52 2019 (r353600) @@ -46,7 +46,7 @@ static boolean_t devmap_bootstrap_done = false; * The allocated-kva (akva) devmap table and metadata. Platforms can call * devmap_add_entry() to add static device mappings to this table using * automatically allocated virtual addresses carved out of the top of kva space. - * Allocation begins immediately below the ARM_VECTORS_HIGH address. + * Allocation begins immediately below the max kernel virtual address. */ #define AKVA_DEVMAP_MAX_ENTRIES 32 static struct devmap_entry akva_devmap_entries[AKVA_DEVMAP_MAX_ENTRIES]; @@ -115,8 +115,8 @@ devmap_lastaddr() * physical address and size and a virtual address allocated from the top of * kva. This automatically registers the akva table on the first call, so all a * platform has to do is call this routine to install as many mappings as it - * needs and when initarm() calls devmap_bootstrap() it will pick up all the - * entries in the akva table automatically. + * needs and when the platform-specific init function calls devmap_bootstrap() + * it will pick up all the entries in the akva table automatically. */ void devmap_add_entry(vm_paddr_t pa, vm_size_t sz) @@ -132,13 +132,13 @@ devmap_add_entry(vm_paddr_t pa, vm_size_t sz) if (akva_devmap_idx == 0) devmap_register_table(akva_devmap_entries); + /* Allocate virtual address space from the top of kva downwards. */ +#ifdef __arm__ /* - * Allocate virtual address space from the top of kva downwards. If the - * range being mapped is aligned and sized to 1MB boundaries then also - * align the virtual address to the next-lower 1MB boundary so that we - * end up with a nice efficient section mapping. + * If the range being mapped is aligned and sized to 1MB boundaries then + * also align the virtual address to the next-lower 1MB boundary so that + * we end with a nice efficient section mapping. */ -#ifdef __arm__ if ((pa & 0x000fffff) == 0 && (sz & 0x000fffff) == 0) { akva_devmap_vaddr = trunc_1mpage(akva_devmap_vaddr - sz); } else @@ -170,7 +170,8 @@ devmap_register_table(const struct devmap_entry *table * the previously-registered table is used. This smooths transition from legacy * code that fills in a local table then calls this function passing that table, * and newer code that uses devmap_register_table() in platform-specific - * code, then lets the common initarm() call this function with a NULL pointer. + * code, then lets the common platform-specific init function call this function + * with a NULL pointer. */ void devmap_bootstrap(vm_offset_t l1pt, const struct devmap_entry *table) Modified: head/sys/sys/devmap.h ============================================================================== --- head/sys/sys/devmap.h Tue Oct 15 21:56:19 2019 (r353599) +++ head/sys/sys/devmap.h Tue Oct 15 23:21:52 2019 (r353600) @@ -63,16 +63,18 @@ void devmap_add_entry(vm_paddr_t pa, vm_size_t sz); /* * Register a platform-local table to be bootstrapped by the generic - * initarm() in arm/machdep.c. This is used by newer code that allocates and - * fills in its own local table but does not have its own initarm() routine. + * platform-specific init function in /machdep.c. This is used by newer + * code that allocates and fills in its own local table but does not have its + * own platform-specific init routine. */ void devmap_register_table(const struct devmap_entry * _table); /* * Establish mappings for all the entries in the table. This is called - * automatically from the common initarm() in arm/machdep.c, and also from the - * custom initarm() routines in older code. If the table pointer is NULL, this - * will use the table installed previously by devmap_register_table(). + * automatically from the common platform-specific init function in + * /machdep.c, and also from the custom platform-specific init routines + * in older code. If the table pointer is NULL, this will use the table + * installed previously by devmap_register_table(). */ void devmap_bootstrap(vm_offset_t _l1pt, const struct devmap_entry *_table); From owner-svn-src-all@freebsd.org Tue Oct 15 23:54:51 2019 Return-Path: Delivered-To: svn-src-all@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 C750E1572BA; Tue, 15 Oct 2019 23:54:51 +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 46tC2z4jqKz40wr; Tue, 15 Oct 2019 23:54:51 +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 7FAFA2660B; Tue, 15 Oct 2019 23:54:51 +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 x9FNspHR048186; Tue, 15 Oct 2019 23:54:51 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9FNspXb048185; Tue, 15 Oct 2019 23:54:51 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910152354.x9FNspXb048185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 15 Oct 2019 23:54:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353601 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 353601 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 23:54:51 -0000 Author: brooks Date: Tue Oct 15 23:54:51 2019 New Revision: 353601 URL: https://svnweb.freebsd.org/changeset/base/353601 Log: Fix including bsd.compat.mk outside Makefile.libcompat on mips64. Reported by: jhb, jenkins Modified: head/share/mk/bsd.compat.mk Modified: head/share/mk/bsd.compat.mk ============================================================================== --- head/share/mk/bsd.compat.mk Tue Oct 15 23:21:52 2019 (r353600) +++ head/share/mk/bsd.compat.mk Tue Oct 15 23:54:51 2019 (r353601) @@ -38,7 +38,7 @@ LIB32WMAKEFLAGS= \ .elif ${TARGET_ARCH:Mmips64*} != "" HAS_COMPAT=32 -.if ${WANT_COMPILER_TYPE} == gcc || \ +.if (defined(WANT_COMPILER_TYPE) && ${WANT_COMPILER_TYPE} == gcc) || \ (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) .if empty(TARGET_CPUTYPE) LIB32CPUFLAGS= -march=mips3 From owner-svn-src-all@freebsd.org Wed Oct 16 00:38:51 2019 Return-Path: Delivered-To: svn-src-all@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 F1821157E80; Wed, 16 Oct 2019 00:38:51 +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 46tD1l5vC8z42PT; Wed, 16 Oct 2019 00:38:51 +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 AA1FF26D0F; Wed, 16 Oct 2019 00:38:51 +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 x9G0cp16072023; Wed, 16 Oct 2019 00:38:51 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G0cpCi072019; Wed, 16 Oct 2019 00:38:51 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201910160038.x9G0cpCi072019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 16 Oct 2019 00:38:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353603 - in head/sys: conf powerpc/amigaone X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys: conf powerpc/amigaone X-SVN-Commit-Revision: 353603 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 00:38:52 -0000 Author: jhibbits Date: Wed Oct 16 00:38:50 2019 New Revision: 353603 URL: https://svnweb.freebsd.org/changeset/base/353603 Log: powerpc: Add AmigaOne platform, a subclass of MPC85xx Summary: The AmigaOne platform, encompassing the X5000 and A1222 at this time, is based on the mpc85xx platform, but includes some things not listed in the device tree. Some custom devices, like CPLD, could be added to the device tree with an overlay, or other means. However, some cannot easily be done, such as the power button interrupt. The directory will also become a location to add AmigaOne platform drivers, such as the aforementioned CPLD, and its children. Reviewed by: bdragon Differential Revision: https://reviews.freebsd.org/D21829 Added: head/sys/powerpc/amigaone/ head/sys/powerpc/amigaone/platform_amigaone.c (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/conf/options.powerpc Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Wed Oct 16 00:13:27 2019 (r353602) +++ head/sys/conf/files.powerpc Wed Oct 16 00:38:50 2019 (r353603) @@ -107,6 +107,7 @@ powerpc/aim/moea64_if.m optional aim powerpc/aim/moea64_native.c optional aim powerpc/aim/mp_cpudep.c optional aim powerpc/aim/slb.c optional aim powerpc64 +powerpc/amigaone/platform_amigaone.c optional amigaone powerpc/booke/locore.S optional booke no-obj powerpc/booke/booke_machdep.c optional booke powerpc/booke/machdep_e500.c optional booke_e500 Modified: head/sys/conf/options.powerpc ============================================================================== --- head/sys/conf/options.powerpc Wed Oct 16 00:13:27 2019 (r353602) +++ head/sys/conf/options.powerpc Wed Oct 16 00:38:50 2019 (r353603) @@ -20,6 +20,8 @@ GFB_NO_FONT_LOADING opt_gfb.h GFB_NO_MODE_CHANGE opt_gfb.h MOEA64_STATS opt_pmap.h +AMIGAONE opt_platform.h +MIKROTIK opt_platform.h MPC85XX opt_platform.h POWERMAC opt_platform.h PS3 opt_platform.h @@ -35,4 +37,3 @@ OFWCONS_POLL_HZ opt_ofw.h # AGP debugging support AGP_DEBUG opt_agp.h -MIKROTIK Added: head/sys/powerpc/amigaone/platform_amigaone.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/amigaone/platform_amigaone.c Wed Oct 16 00:38:50 2019 (r353603) @@ -0,0 +1,123 @@ +/*- + * Copyright (c) 2019 Justin Hibbits + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include + +#include "platform_if.h" + +static void aeon_pbutton_intr(void *_unused); +static void aeon_setup_intr(void *unused); + +static int aeon_probe(platform_t); +static int aeon_attach(platform_t); + +static platform_method_t aeon_methods[] = { + PLATFORMMETHOD(platform_probe, aeon_probe), + PLATFORMMETHOD(platform_attach, aeon_attach), + PLATFORMMETHOD_END +}; + +DEFINE_CLASS_1(aeon, aeon_platform, aeon_methods, 0, mpc85xx_platform); + +PLATFORM_DEF(aeon_platform); + +static bool is_aeon; + +static int +aeon_probe(platform_t plat) +{ + phandle_t rootnode; + char model[32]; + + rootnode = OF_finddevice("/"); + + if (OF_getprop(rootnode, "model", model, sizeof(model)) > 0) { + if (strncmp(model, "varisys,", strlen("varisys,")) == 0) + return (BUS_PROBE_SPECIFIC); + } + + return (ENXIO); +} + +static int +aeon_attach(platform_t plat) +{ + int error; + + error = mpc85xx_attach(plat); + if (error) + return (error); + + is_aeon = true; + + return (0); +} + +/* Notify devd(8) that the power button was pressed (IRQ#4 on A-Eon machines). */ +static void +aeon_pbutton_intr(void *_unused) +{ + devctl_notify("AEON", "power", "press", NULL); +} + +/* Manually configure the power button IRQ handler. */ +static void +aeon_setup_intr(void *unused) +{ + int irq; + + if (!is_aeon) + return; + + if (bootverbose) + printf("Configuring AmigaOne power button.\n"); + + irq = 4; /* From TRM, IRQ4 is raised when power button is pressed. */ + + /* Get us the root PIC. */ + irq = MAP_IRQ(0, irq); + powerpc_config_intr(irq, INTR_TRIGGER_EDGE, INTR_POLARITY_LOW); + powerpc_setup_intr("power_button", irq, NULL, aeon_pbutton_intr, NULL, + INTR_TYPE_MISC, NULL, 0); +} + +SYSINIT(aeon_setup_intr, SI_SUB_CONFIGURE, SI_ORDER_ANY, aeon_setup_intr, NULL); From owner-svn-src-all@freebsd.org Wed Oct 16 03:04:00 2019 Return-Path: Delivered-To: svn-src-all@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 2A39415A4F1; Wed, 16 Oct 2019 03:04:00 +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 46tHFD0LHzz48lx; Wed, 16 Oct 2019 03:04:00 +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 E34A98B0; Wed, 16 Oct 2019 03:03:59 +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 x9G33xh3060427; Wed, 16 Oct 2019 03:03:59 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G33xNZ060426; Wed, 16 Oct 2019 03:03:59 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201910160303.x9G33xNZ060426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 16 Oct 2019 03:03:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353604 - head/sys/powerpc/mpc85xx X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/mpc85xx X-SVN-Commit-Revision: 353604 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 03:04:00 -0000 Author: jhibbits Date: Wed Oct 16 03:03:59 2019 New Revision: 353604 URL: https://svnweb.freebsd.org/changeset/base/353604 Log: powerpc/mpc85xx: Fix function type for fsl_pcib_error_intr() Since it's only called as an interrupt handler, fsl_pcib_eror_intr() should just match the driver_intr_t type. Reported by: bdragon Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx.c Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx.c ============================================================================== --- head/sys/powerpc/mpc85xx/pci_mpc85xx.c Wed Oct 16 00:38:50 2019 (r353603) +++ head/sys/powerpc/mpc85xx/pci_mpc85xx.c Wed Oct 16 03:03:59 2019 (r353604) @@ -228,7 +228,7 @@ DEFINE_CLASS_1(pcib, fsl_pcib_driver, fsl_pcib_methods EARLY_DRIVER_MODULE(pcib, ofwbus, fsl_pcib_driver, fsl_pcib_devclass, 0, 0, BUS_PASS_BUS); -static int +static void fsl_pcib_err_intr(void *v) { struct fsl_pcib_softc *sc; @@ -253,8 +253,6 @@ fsl_pcib_err_intr(void *v) /* Clear pending errors */ bus_space_write_4(sc->sc_bst, sc->sc_bsh, REG_PEX_ERR_DR, clear_reg); - - return (0); } static int @@ -380,7 +378,7 @@ fsl_pcib_attach(device_t dev) /* Setup interrupt handler */ error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE, - NULL, (driver_intr_t *)fsl_pcib_err_intr, dev, &sc->sc_ih); + NULL, fsl_pcib_err_intr, dev, &sc->sc_ih); if (error != 0) { device_printf(dev, "Could not setup irq, %d\n", error); sc->sc_ih = NULL; From owner-svn-src-all@freebsd.org Wed Oct 16 05:47:31 2019 Return-Path: Delivered-To: svn-src-all@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 E668415BECB; Wed, 16 Oct 2019 05:47:31 +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 46tLsv5dHNz4FxS; Wed, 16 Oct 2019 05:47:31 +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 A0C392532; Wed, 16 Oct 2019 05:47:31 +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 x9G5lVkm053570; Wed, 16 Oct 2019 05:47:31 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G5lVag053568; Wed, 16 Oct 2019 05:47:31 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160547.x9G5lVag053568@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 05:47:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353605 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 353605 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 05:47:32 -0000 Author: avg Date: Wed Oct 16 05:47:30 2019 New Revision: 353605 URL: https://svnweb.freebsd.org/changeset/base/353605 Log: 10154 zfs: cast between incompatible function types illumos/illumos-gate@c62757b2b8b6c26589d7704d0ff20beb107fcd9a https://github.com/illumos/illumos-gate/commit/c62757b2b8b6c26589d7704d0ff20beb107fcd9a https://www.illumos.org/issues/10154 Author: Toomas Soome Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c Wed Oct 16 03:03:59 2019 (r353604) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c Wed Oct 16 05:47:30 2019 (r353605) @@ -700,7 +700,7 @@ vdev_disk_ldi_physio(ldi_handle_t vd_lh, caddr_t data, return (error); } -static void +static int vdev_disk_io_intr(buf_t *bp) { vdev_buf_t *vb = (vdev_buf_t *)bp; @@ -725,6 +725,7 @@ vdev_disk_io_intr(buf_t *bp) kmem_free(vb, sizeof (vdev_buf_t)); zio_delay_interrupt(zio); + return (0); } static void @@ -844,7 +845,7 @@ vdev_disk_io_start(zio_t *zio) bp->b_lblkno = lbtodb(zio->io_offset); bp->b_bufsize = zio->io_size; - bp->b_iodone = (int (*)())vdev_disk_io_intr; + bp->b_iodone = vdev_disk_io_intr; /* ldi_strategy() will return non-zero only on programming errors */ VERIFY(ldi_strategy(dvd->vd_lh, bp) == 0); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c Wed Oct 16 03:03:59 2019 (r353604) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c Wed Oct 16 05:47:30 2019 (r353605) @@ -148,7 +148,7 @@ vdev_file_close(vdev_t *vd) * interrupt taskqs. For consistency, the code structure mimics disk vdev * types. */ -static void +static int vdev_file_io_intr(buf_t *bp) { vdev_buf_t *vb = (vdev_buf_t *)bp; @@ -166,6 +166,7 @@ vdev_file_io_intr(buf_t *bp) kmem_free(vb, sizeof (vdev_buf_t)); zio_delay_interrupt(zio); + return (0); } static void @@ -241,7 +242,7 @@ vdev_file_io_start(zio_t *zio) bp->b_lblkno = lbtodb(zio->io_offset); bp->b_bufsize = zio->io_size; bp->b_private = vf->vf_vnode; - bp->b_iodone = (int (*)())vdev_file_io_intr; + bp->b_iodone = vdev_file_io_intr; VERIFY3U(taskq_dispatch(system_taskq, vdev_file_io_strategy, bp, TQ_SLEEP), !=, 0); From owner-svn-src-all@freebsd.org Wed Oct 16 06:02:07 2019 Return-Path: Delivered-To: svn-src-all@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 A55C215C249; Wed, 16 Oct 2019 06:02:07 +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 46tMBl3zC4z4GZC; Wed, 16 Oct 2019 06:02:07 +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 6CC4C2890; Wed, 16 Oct 2019 06:02:07 +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 x9G627bP065231; Wed, 16 Oct 2019 06:02:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G627Jn065230; Wed, 16 Oct 2019 06:02:07 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160602.x9G627Jn065230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 06:02:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353606 - vendor/illumos/dist/man/man1m X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor/illumos/dist/man/man1m X-SVN-Commit-Revision: 353606 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 06:02:07 -0000 Author: avg Date: Wed Oct 16 06:02:07 2019 New Revision: 353606 URL: https://svnweb.freebsd.org/changeset/base/353606 Log: 10067 Miscellaneous man page typos illumos/illumos-gate@e61d7e85ebb4a7361eeb10639b742a92e0bf5e55 https://github.com/illumos/illumos-gate/commit/e61d7e85ebb4a7361eeb10639b742a92e0bf5e55 https://www.illumos.org/issues/10067 fileystem - man1m/zfs.1m man1m/boot.1m Author: Peter Tribble Modified: vendor/illumos/dist/man/man1m/zfs.1m Modified: vendor/illumos/dist/man/man1m/zfs.1m ============================================================================== --- vendor/illumos/dist/man/man1m/zfs.1m Wed Oct 16 05:47:30 2019 (r353605) +++ vendor/illumos/dist/man/man1m/zfs.1m Wed Oct 16 06:02:07 2019 (r353606) @@ -2447,7 +2447,7 @@ option was not specified. .Cm remap .Ar filesystem Ns | Ns Ar volume .Xc -Remap the indirect blocks in the given fileystem or volume so that they no +Remap the indirect blocks in the given filesystem or volume so that they no longer reference blocks on previously removed vdevs and we can eventually shrink the size of the indirect mapping objects for the previously removed vdevs. Note that remapping all blocks might not be possible and that From owner-svn-src-all@freebsd.org Wed Oct 16 06:05:18 2019 Return-Path: Delivered-To: svn-src-all@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 AD8C415C2CA; Wed, 16 Oct 2019 06:05:18 +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 46tMGQ48xdz4Gk5; Wed, 16 Oct 2019 06:05:18 +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 7240528B8; Wed, 16 Oct 2019 06:05:18 +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 x9G65I6R065469; Wed, 16 Oct 2019 06:05:18 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G65IAN065468; Wed, 16 Oct 2019 06:05:18 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160605.x9G65IAN065468@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 06:05:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353607 - head/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/zfs X-SVN-Commit-Revision: 353607 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 06:05:18 -0000 Author: avg Date: Wed Oct 16 06:05:18 2019 New Revision: 353607 URL: https://svnweb.freebsd.org/changeset/base/353607 Log: MFV r353606: 10067 Miscellaneous man page typos https://www.illumos.org/issues/10067 fileystem - man1m/zfs.1m man1m/boot.1m Author: Peter Tribble Obtained from: illumos MFC after: 1 week Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Directory Properties: head/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Oct 16 06:02:07 2019 (r353606) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Oct 16 06:05:18 2019 (r353607) @@ -2338,7 +2338,7 @@ option was not specified. .Ar filesystem Ns | Ns Ar volume .Xc .Pp -Remap the indirect blocks in the given fileystem or volume so that they no +Remap the indirect blocks in the given filesystem or volume so that they no longer reference blocks on previously removed vdevs and we can eventually shrink the size of the indirect mapping objects for the previously removed vdevs. Note that remapping all blocks might not be possible and that From owner-svn-src-all@freebsd.org Wed Oct 16 06:07:22 2019 Return-Path: Delivered-To: svn-src-all@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 627F515C3B7; Wed, 16 Oct 2019 06:07:22 +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 46tMJp1vkMz4Gv9; Wed, 16 Oct 2019 06:07:22 +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 2091728BE; Wed, 16 Oct 2019 06:07:22 +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 x9G67LnT065610; Wed, 16 Oct 2019 06:07:21 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G67LiK065609; Wed, 16 Oct 2019 06:07:21 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160607.x9G67LiK065609@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 06:07:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353608 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 353608 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 06:07:22 -0000 Author: avg Date: Wed Oct 16 06:07:21 2019 New Revision: 353608 URL: https://svnweb.freebsd.org/changeset/base/353608 Log: 10165 libzpool: passing argument 1 to restrict-qualified parameter aliases with argument 4 illumos/illumos-gate@f91fcf59ac2fd04f1816f3dcbc69a46d44276a65 https://github.com/illumos/illumos-gate/commit/f91fcf59ac2fd04f1816f3dcbc69a46d44276a65 https://www.illumos.org/issues/10165 Author: Toomas Soome Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Wed Oct 16 06:05:18 2019 (r353607) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Wed Oct 16 06:07:21 2019 (r353608) @@ -2130,7 +2130,10 @@ dsl_get_mountpoint(dsl_dataset_t *ds, const char *dsna return (error); } - /* Process the dsname and source to find the full mountpoint string */ + /* + * Process the dsname and source to find the full mountpoint string. + * Can be skipped for 'legacy' or 'none'. + */ if (value[0] == '/') { char *buf = kmem_alloc(ZAP_MAXVALUELEN, KM_SLEEP); char *root = buf; @@ -2181,10 +2184,8 @@ dsl_get_mountpoint(dsl_dataset_t *ds, const char *dsna relpath); } kmem_free(buf, ZAP_MAXVALUELEN); - } else { - /* 'legacy' or 'none' */ - (void) snprintf(value, ZAP_MAXVALUELEN, "%s", value); } + return (0); } From owner-svn-src-all@freebsd.org Wed Oct 16 06:09:00 2019 Return-Path: Delivered-To: svn-src-all@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 D359015C42D; Wed, 16 Oct 2019 06:09: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 46tMLh5F8lz4H2W; Wed, 16 Oct 2019 06:09:00 +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 9702028BF; Wed, 16 Oct 2019 06:09:00 +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 x9G690sY065748; Wed, 16 Oct 2019 06:09:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G690pf065747; Wed, 16 Oct 2019 06:09:00 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160609.x9G690pf065747@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 06:09:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353609 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 353609 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 06:09:00 -0000 Author: avg Date: Wed Oct 16 06:09:00 2019 New Revision: 353609 URL: https://svnweb.freebsd.org/changeset/base/353609 Log: MFV r353608: 10165 libzpool: passing argument 1 to restrict-qualified parameter illumos/illumos-gate@f91fcf59ac2fd04f1816f3dcbc69a46d44276a65 https://github.com/illumos/illumos-gate/commit/f91fcf59ac2fd04f1816f3dcbc69a46d44276a65 https://www.illumos.org/issues/10165 Author: Toomas Soome MFC after: 10 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Oct 16 06:07:21 2019 (r353608) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Oct 16 06:09:00 2019 (r353609) @@ -2196,7 +2196,10 @@ dsl_get_mountpoint(dsl_dataset_t *ds, const char *dsna return (error); } - /* Process the dsname and source to find the full mountpoint string */ + /* + * Process the dsname and source to find the full mountpoint string. + * Can be skipped for 'legacy' or 'none'. + */ if (value[0] == '/') { char *buf = kmem_alloc(ZAP_MAXVALUELEN, KM_SLEEP); char *root = buf; @@ -2247,10 +2250,8 @@ dsl_get_mountpoint(dsl_dataset_t *ds, const char *dsna relpath); } kmem_free(buf, ZAP_MAXVALUELEN); - } else { - /* 'legacy' or 'none' */ - (void) snprintf(value, ZAP_MAXVALUELEN, "%s", value); } + return (0); } From owner-svn-src-all@freebsd.org Wed Oct 16 06:11:12 2019 Return-Path: Delivered-To: svn-src-all@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 4D03F15C503; Wed, 16 Oct 2019 06:11:12 +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 46tMPD0s8bz4HK3; Wed, 16 Oct 2019 06:11:12 +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 D81072906; Wed, 16 Oct 2019 06:11:11 +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 x9G6BB9K065959; Wed, 16 Oct 2019 06:11:11 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G6BBP1065958; Wed, 16 Oct 2019 06:11:11 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160611.x9G6BBP1065958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 06:11:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353610 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 353610 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 06:11:12 -0000 Author: avg Date: Wed Oct 16 06:11:11 2019 New Revision: 353610 URL: https://svnweb.freebsd.org/changeset/base/353610 Log: 10230 zfs mishandles partial writes illumos/illumos-gate@b0ef425652e5cfce27df9fa5826a9cd64cee110a https://github.com/illumos/illumos-gate/commit/b0ef425652e5cfce27df9fa5826a9cd64cee110a https://www.illumos.org/issues/10230 The trinity fuzzer calls pwritev with an iovec that has one or more entries which point to some initial valid data and then the rest point to addresses which are not mapped. This yields EFAULT once the write hits the invalid address, but we do successfully complete some amount of writing. The zfs_write code does not handle this properly. It loses track of the error return from dmu_write_uio_dbuf and it has an invalid ASSERT which does not account for the partial write case. Author: Jerry Jelinek Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c Wed Oct 16 06:09:00 2019 (r353609) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c Wed Oct 16 06:11:11 2019 (r353610) @@ -23,7 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] - * Copyright 2015 Joyent, Inc. + * Copyright 2019 Joyent, Inc. * Copyright 2017 Nexenta Systems, Inc. */ @@ -665,6 +665,7 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t ssize_t n, nbytes; int max_blksz = zfsvfs->z_max_blksz; int error = 0; + int prev_error; arc_buf_t *abuf; iovec_t *aiov = NULL; xuio_t *xuio = NULL; @@ -972,7 +973,6 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t while ((end_size = zp->z_size) < uio->uio_loffset) { (void) atomic_cas_64(&zp->z_size, end_size, uio->uio_loffset); - ASSERT(error == 0); } /* * If we are replaying and eof is non zero then force @@ -982,12 +982,17 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t if (zfsvfs->z_replay && zfsvfs->z_replay_eof != 0) zp->z_size = zfsvfs->z_replay_eof; + /* + * Keep track of a possible pre-existing error from a partial + * write via dmu_write_uio_dbuf above. + */ + prev_error = error; error = sa_bulk_update(zp->z_sa_hdl, bulk, count, tx); zfs_log_write(zilog, tx, TX_WRITE, zp, woff, tx_bytes, ioflag); dmu_tx_commit(tx); - if (error != 0) + if (prev_error != 0 || error != 0) break; ASSERT(tx_bytes == nbytes); n -= nbytes; From owner-svn-src-all@freebsd.org Wed Oct 16 06:18:39 2019 Return-Path: Delivered-To: svn-src-all@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 446BC15C7C5; Wed, 16 Oct 2019 06:18:39 +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 46tMYq13kqz4Hcg; Wed, 16 Oct 2019 06:18:39 +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 048A62A74; Wed, 16 Oct 2019 06:18:39 +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 x9G6Ic55071490; Wed, 16 Oct 2019 06:18:38 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G6IbOV071486; Wed, 16 Oct 2019 06:18:37 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160618.x9G6IbOV071486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 06:18:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353611 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zdb X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zdb X-SVN-Commit-Revision: 353611 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 06:18:39 -0000 Author: avg Date: Wed Oct 16 06:18:37 2019 New Revision: 353611 URL: https://svnweb.freebsd.org/changeset/base/353611 Log: 10330 merge recent ZoL vdev and metaslab changes illumos/illumos-gate@a0b03b161c4df3cfc54fbc741db09b3bdc23ffba https://github.com/illumos/illumos-gate/commit/a0b03b161c4df3cfc54fbc741db09b3bdc23ffba https://www.illumos.org/issues/10330 3 recent ZoL changes in the vdev and metaslab code which we can pull over: PR 8324 c853f382db 8324 Change target size of metaslabs from 256GB to 16GB PR 8290 b194fab0fb 8290 Factor metaslab_load_wait() in metaslab_load() PR 8286 419ba59145 8286 Update vdev_is_spacemap_addressable() for new spacemap encoding Author: Serapheim Dimitropoulos Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_initialize.c Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/zdb/zdb.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c Wed Oct 16 06:11:11 2019 (r353610) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c Wed Oct 16 06:18:37 2019 (r353611) @@ -1456,7 +1456,7 @@ metaslab_ops_t *zfs_metaslab_ops = &metaslab_df_ops; /* * Wait for any in-progress metaslab loads to complete. */ -void +static void metaslab_load_wait(metaslab_t *msp) { ASSERT(MUTEX_HELD(&msp->ms_lock)); @@ -1467,20 +1467,17 @@ metaslab_load_wait(metaslab_t *msp) } } -int -metaslab_load(metaslab_t *msp) +static int +metaslab_load_impl(metaslab_t *msp) { int error = 0; - boolean_t success = B_FALSE; ASSERT(MUTEX_HELD(&msp->ms_lock)); - ASSERT(!msp->ms_loaded); - ASSERT(!msp->ms_loading); + ASSERT(msp->ms_loading); - msp->ms_loading = B_TRUE; /* * Nobody else can manipulate a loading metaslab, so it's now safe - * to drop the lock. This way we don't have to hold the lock while + * to drop the lock. This way we don't have to hold the lock while * reading the spacemap from disk. */ mutex_exit(&msp->ms_lock); @@ -1497,29 +1494,49 @@ metaslab_load(metaslab_t *msp) msp->ms_start, msp->ms_size); } - success = (error == 0); - mutex_enter(&msp->ms_lock); - msp->ms_loading = B_FALSE; - if (success) { - ASSERT3P(msp->ms_group, !=, NULL); - msp->ms_loaded = B_TRUE; + if (error != 0) + return (error); - /* - * If the metaslab already has a spacemap, then we need to - * remove all segments from the defer tree; otherwise, the - * metaslab is completely empty and we can skip this. - */ - if (msp->ms_sm != NULL) { - for (int t = 0; t < TXG_DEFER_SIZE; t++) { - range_tree_walk(msp->ms_defer[t], - range_tree_remove, msp->ms_allocatable); - } + ASSERT3P(msp->ms_group, !=, NULL); + msp->ms_loaded = B_TRUE; + + /* + * If the metaslab already has a spacemap, then we need to + * remove all segments from the defer tree; otherwise, the + * metaslab is completely empty and we can skip this. + */ + if (msp->ms_sm != NULL) { + for (int t = 0; t < TXG_DEFER_SIZE; t++) { + range_tree_walk(msp->ms_defer[t], + range_tree_remove, msp->ms_allocatable); } - msp->ms_max_size = metaslab_block_maxsize(msp); } + msp->ms_max_size = metaslab_block_maxsize(msp); + + return (0); +} + +int +metaslab_load(metaslab_t *msp) +{ + ASSERT(MUTEX_HELD(&msp->ms_lock)); + + /* + * There may be another thread loading the same metaslab, if that's + * the case just wait until the other thread is done and return. + */ + metaslab_load_wait(msp); + if (msp->ms_loaded) + return (0); + VERIFY(!msp->ms_loading); + + msp->ms_loading = B_TRUE; + int error = metaslab_load_impl(msp); + msp->ms_loading = B_FALSE; cv_broadcast(&msp->ms_load_cv); + return (error); } @@ -2078,13 +2095,10 @@ metaslab_activate(metaslab_t *msp, int allocator, uint ASSERT(MUTEX_HELD(&msp->ms_lock)); if ((msp->ms_weight & METASLAB_ACTIVE_MASK) == 0) { - int error = 0; - metaslab_load_wait(msp); - if (!msp->ms_loaded) { - if ((error = metaslab_load(msp)) != 0) { - metaslab_group_sort(msp->ms_group, msp, 0); - return (error); - } + int error = metaslab_load(msp); + if (error != 0) { + metaslab_group_sort(msp->ms_group, msp, 0); + return (error); } if ((msp->ms_weight & METASLAB_ACTIVE_MASK) != 0) { /* @@ -2196,9 +2210,7 @@ metaslab_preload(void *arg) ASSERT(!MUTEX_HELD(&msp->ms_group->mg_lock)); mutex_enter(&msp->ms_lock); - metaslab_load_wait(msp); - if (!msp->ms_loaded) - (void) metaslab_load(msp); + (void) metaslab_load(msp); msp->ms_selected_txg = spa_syncing_txg(spa); mutex_exit(&msp->ms_lock); } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab.h Wed Oct 16 06:11:11 2019 (r353610) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab.h Wed Oct 16 06:18:37 2019 (r353611) @@ -48,7 +48,6 @@ int metaslab_init(metaslab_group_t *, uint64_t, uint64 metaslab_t **); void metaslab_fini(metaslab_t *); -void metaslab_load_wait(metaslab_t *); int metaslab_load(metaslab_t *); void metaslab_unload(metaslab_t *); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab_impl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab_impl.h Wed Oct 16 06:11:11 2019 (r353610) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab_impl.h Wed Oct 16 06:18:37 2019 (r353611) @@ -369,8 +369,8 @@ struct metaslab { uint64_t ms_initializing; /* leaves initializing this ms */ /* - * We must hold both ms_lock and ms_group->mg_lock in order to - * modify ms_loaded. + * We must always hold the ms_lock when modifying ms_loaded + * and ms_loading. */ boolean_t ms_loaded; boolean_t ms_loading; Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Wed Oct 16 06:11:11 2019 (r353610) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Wed Oct 16 06:18:37 2019 (r353611) @@ -72,20 +72,20 @@ static vdev_ops_t *vdev_ops_table[] = { /* maximum scrub/resilver I/O queue per leaf vdev */ int zfs_scrub_limit = 10; -/* target number of metaslabs per top-level vdev */ -int vdev_max_ms_count = 200; +/* default target for number of metaslabs per top-level vdev */ +int zfs_vdev_default_ms_count = 200; /* minimum number of metaslabs per top-level vdev */ -int vdev_min_ms_count = 16; +int zfs_vdev_min_ms_count = 16; /* practical upper limit of total metaslabs per top-level vdev */ -int vdev_ms_count_limit = 1ULL << 17; +int zfs_vdev_ms_count_limit = 1ULL << 17; /* lower limit for metaslab size (512M) */ -int vdev_default_ms_shift = 29; +int zfs_vdev_default_ms_shift = 29; -/* upper limit for metaslab size (256G) */ -int vdev_max_ms_shift = 38; +/* upper limit for metaslab size (16G) */ +int zfs_vdev_max_ms_shift = 34; boolean_t vdev_validate_skip = B_FALSE; @@ -2034,16 +2034,24 @@ void vdev_metaslab_set_size(vdev_t *vd) { uint64_t asize = vd->vdev_asize; - uint64_t ms_count = asize >> vdev_default_ms_shift; + uint64_t ms_count = asize >> zfs_vdev_default_ms_shift; uint64_t ms_shift; /* * There are two dimensions to the metaslab sizing calculation: * the size of the metaslab and the count of metaslabs per vdev. - * In general, we aim for vdev_max_ms_count (200) metaslabs. The - * range of the dimensions are as follows: * - * 2^29 <= ms_size <= 2^38 + * The default values used below are a good balance between memory + * usage (larger metaslab size means more memory needed for loaded + * metaslabs; more metaslabs means more memory needed for the + * metaslab_t structs), metaslab load time (larger metaslabs take + * longer to load), and metaslab sync time (more metaslabs means + * more time spent syncing all of them). + * + * In general, we aim for zfs_vdev_default_ms_count (200) metaslabs. + * The range of the dimensions are as follows: + * + * 2^29 <= ms_size <= 2^34 * 16 <= ms_count <= 131,072 * * On the lower end of vdev sizes, we aim for metaslabs sizes of @@ -2052,35 +2060,41 @@ vdev_metaslab_set_size(vdev_t *vd) * of at least 16 metaslabs will override this minimum size goal. * * On the upper end of vdev sizes, we aim for a maximum metaslab - * size of 256GB. However, we will cap the total count to 2^17 - * metaslabs to keep our memory footprint in check. + * size of 16GB. However, we will cap the total count to 2^17 + * metaslabs to keep our memory footprint in check and let the + * metaslab size grow from there if that limit is hit. * * The net effect of applying above constrains is summarized below. * - * vdev size metaslab count - * -------------|----------------- - * < 8GB ~16 - * 8GB - 100GB one per 512MB - * 100GB - 50TB ~200 - * 50TB - 32PB one per 256GB - * > 32PB ~131,072 - * ------------------------------- + * vdev size metaslab count + * --------------|----------------- + * < 8GB ~16 + * 8GB - 100GB one per 512MB + * 100GB - 3TB ~200 + * 3TB - 2PB one per 16GB + * > 2PB ~131,072 + * -------------------------------- + * + * Finally, note that all of the above calculate the initial + * number of metaslabs. Expanding a top-level vdev will result + * in additional metaslabs being allocated making it possible + * to exceed the zfs_vdev_ms_count_limit. */ - if (ms_count < vdev_min_ms_count) - ms_shift = highbit64(asize / vdev_min_ms_count); - else if (ms_count > vdev_max_ms_count) - ms_shift = highbit64(asize / vdev_max_ms_count); + if (ms_count < zfs_vdev_min_ms_count) + ms_shift = highbit64(asize / zfs_vdev_min_ms_count); + else if (ms_count > zfs_vdev_default_ms_count) + ms_shift = highbit64(asize / zfs_vdev_default_ms_count); else - ms_shift = vdev_default_ms_shift; + ms_shift = zfs_vdev_default_ms_shift; if (ms_shift < SPA_MAXBLOCKSHIFT) { ms_shift = SPA_MAXBLOCKSHIFT; - } else if (ms_shift > vdev_max_ms_shift) { - ms_shift = vdev_max_ms_shift; + } else if (ms_shift > zfs_vdev_max_ms_shift) { + ms_shift = zfs_vdev_max_ms_shift; /* cap the total count to constrain memory footprint */ - if ((asize >> ms_shift) > vdev_ms_count_limit) - ms_shift = highbit64(asize / vdev_ms_count_limit); + if ((asize >> ms_shift) > zfs_vdev_ms_count_limit) + ms_shift = highbit64(asize / zfs_vdev_ms_count_limit); } vd->vdev_ms_shift = ms_shift; @@ -3386,13 +3400,17 @@ vdev_accessible(vdev_t *vd, zio_t *zio) boolean_t vdev_is_spacemap_addressable(vdev_t *vd) { + if (spa_feature_is_active(vd->vdev_spa, SPA_FEATURE_SPACEMAP_V2)) + return (B_TRUE); + /* - * Assuming 47 bits of the space map entry dedicated for the entry's - * offset (see description in space_map.h), we calculate the maximum - * address that can be described by a space map entry for the given - * device. + * If double-word space map entries are not enabled we assume + * 47 bits of the space map entry are dedicated to the entry's + * offset (see SM_OFFSET_BITS in space_map.h). We then use that + * to calculate the maximum address that can be described by a + * space map entry for the given device. */ - uint64_t shift = vd->vdev_ashift + 47; + uint64_t shift = vd->vdev_ashift + SM_OFFSET_BITS; if (shift >= 63) /* detect potential overflow */ return (B_TRUE); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_initialize.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_initialize.c Wed Oct 16 06:11:11 2019 (r353610) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_initialize.c Wed Oct 16 06:18:37 2019 (r353611) @@ -353,16 +353,6 @@ vdev_initialize_ranges(vdev_t *vd, abd_t *data) } static void -vdev_initialize_ms_load(metaslab_t *msp) -{ - ASSERT(MUTEX_HELD(&msp->ms_lock)); - - metaslab_load_wait(msp); - if (!msp->ms_loaded) - VERIFY0(metaslab_load(msp)); -} - -static void vdev_initialize_mg_wait(metaslab_group_t *mg) { ASSERT(MUTEX_HELD(&mg->mg_ms_initialize_lock)); @@ -484,10 +474,10 @@ vdev_initialize_calculate_progress(vdev_t *vd) * metaslab. Load it and walk the free tree for more accurate * progress estimation. */ - vdev_initialize_ms_load(msp); + VERIFY0(metaslab_load(msp)); - for (range_seg_t *rs = avl_first(&msp->ms_allocatable->rt_root); rs; - rs = AVL_NEXT(&msp->ms_allocatable->rt_root, rs)) { + for (range_seg_t *rs = avl_first(&msp->ms_allocatable->rt_root); + rs; rs = AVL_NEXT(&msp->ms_allocatable->rt_root, rs)) { logical_rs.rs_start = rs->rs_start; logical_rs.rs_end = rs->rs_end; vdev_xlate(vd, &logical_rs, &physical_rs); @@ -615,7 +605,7 @@ vdev_initialize_thread(void *arg) vdev_initialize_ms_mark(msp); mutex_enter(&msp->ms_lock); - vdev_initialize_ms_load(msp); + VERIFY0(metaslab_load(msp)); range_tree_walk(msp->ms_allocatable, vdev_initialize_range_add, vd); From owner-svn-src-all@freebsd.org Wed Oct 16 06:18:39 2019 Return-Path: Delivered-To: svn-src-all@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 7453D15C7C8; Wed, 16 Oct 2019 06:18:39 +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 46tMYq2XnMz4Hch; Wed, 16 Oct 2019 06:18:39 +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 362F82A75; Wed, 16 Oct 2019 06:18:39 +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 x9G6Ids0071496; Wed, 16 Oct 2019 06:18:39 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G6Idoc071495; Wed, 16 Oct 2019 06:18:39 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160618.x9G6Idoc071495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 06:18:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353611 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zdb X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zdb X-SVN-Commit-Revision: 353611 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 06:18:39 -0000 Author: avg Date: Wed Oct 16 06:18:37 2019 New Revision: 353611 URL: https://svnweb.freebsd.org/changeset/base/353611 Log: 10330 merge recent ZoL vdev and metaslab changes illumos/illumos-gate@a0b03b161c4df3cfc54fbc741db09b3bdc23ffba https://github.com/illumos/illumos-gate/commit/a0b03b161c4df3cfc54fbc741db09b3bdc23ffba https://www.illumos.org/issues/10330 3 recent ZoL changes in the vdev and metaslab code which we can pull over: PR 8324 c853f382db 8324 Change target size of metaslabs from 256GB to 16GB PR 8290 b194fab0fb 8290 Factor metaslab_load_wait() in metaslab_load() PR 8286 419ba59145 8286 Update vdev_is_spacemap_addressable() for new spacemap encoding Author: Serapheim Dimitropoulos Modified: vendor/illumos/dist/cmd/zdb/zdb.c Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_initialize.c Modified: vendor/illumos/dist/cmd/zdb/zdb.c ============================================================================== --- vendor/illumos/dist/cmd/zdb/zdb.c Wed Oct 16 06:11:11 2019 (r353610) +++ vendor/illumos/dist/cmd/zdb/zdb.c Wed Oct 16 06:18:37 2019 (r353611) @@ -901,11 +901,8 @@ dump_metaslab(metaslab_t *msp) if (dump_opt['m'] > 2 && !dump_opt['L']) { mutex_enter(&msp->ms_lock); - metaslab_load_wait(msp); - if (!msp->ms_loaded) { - VERIFY0(metaslab_load(msp)); - range_tree_stat_verify(msp->ms_allocatable); - } + VERIFY0(metaslab_load(msp)); + range_tree_stat_verify(msp->ms_allocatable); dump_metaslab_stats(msp); metaslab_unload(msp); mutex_exit(&msp->ms_lock); From owner-svn-src-all@freebsd.org Wed Oct 16 06:26:52 2019 Return-Path: Delivered-To: svn-src-all@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 E57E315CA4F; Wed, 16 Oct 2019 06:26:52 +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 46tMlJ6WhFz4JCQ; Wed, 16 Oct 2019 06:26:52 +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 A44B02C2C; Wed, 16 Oct 2019 06:26:52 +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 x9G6QqMu077161; Wed, 16 Oct 2019 06:26:52 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G6Qprc077155; Wed, 16 Oct 2019 06:26:51 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160626.x9G6Qprc077155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 06:26:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353612 - in head: cddl/contrib/opensolaris/cmd/zdb sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/zdb sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 353612 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 06:26:53 -0000 Author: avg Date: Wed Oct 16 06:26:51 2019 New Revision: 353612 URL: https://svnweb.freebsd.org/changeset/base/353612 Log: MFC r353611: 10330 merge recent ZoL vdev and metaslab changes illumos/illumos-gate@a0b03b161c4df3cfc54fbc741db09b3bdc23ffba https://github.com/illumos/illumos-gate/commit/a0b03b161c4df3cfc54fbc741db09b3bdc23ffba https://www.illumos.org/issues/10330 3 recent ZoL changes in the vdev and metaslab code which we can pull over: PR 8324 c853f382db 8324 Change target size of metaslabs from 256GB to 16GB PR 8290 b194fab0fb 8290 Factor metaslab_load_wait() in metaslab_load() PR 8286 419ba59145 8286 Update vdev_is_spacemap_addressable() for new spacemap encoding Author: Serapheim Dimitropoulos Obtained from: illumos, ZoL MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_initialize.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/cmd/zdb/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Oct 16 06:18:37 2019 (r353611) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Oct 16 06:26:51 2019 (r353612) @@ -901,11 +901,8 @@ dump_metaslab(metaslab_t *msp) if (dump_opt['m'] > 2 && !dump_opt['L']) { mutex_enter(&msp->ms_lock); - metaslab_load_wait(msp); - if (!msp->ms_loaded) { - VERIFY0(metaslab_load(msp)); - range_tree_stat_verify(msp->ms_allocatable); - } + VERIFY0(metaslab_load(msp)); + range_tree_stat_verify(msp->ms_allocatable); dump_metaslab_stats(msp); metaslab_unload(msp); mutex_exit(&msp->ms_lock); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Wed Oct 16 06:18:37 2019 (r353611) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Wed Oct 16 06:26:51 2019 (r353612) @@ -1468,7 +1468,7 @@ metaslab_ops_t *zfs_metaslab_ops = &metaslab_df_ops; /* * Wait for any in-progress metaslab loads to complete. */ -void +static void metaslab_load_wait(metaslab_t *msp) { ASSERT(MUTEX_HELD(&msp->ms_lock)); @@ -1479,20 +1479,17 @@ metaslab_load_wait(metaslab_t *msp) } } -int -metaslab_load(metaslab_t *msp) +static int +metaslab_load_impl(metaslab_t *msp) { int error = 0; - boolean_t success = B_FALSE; ASSERT(MUTEX_HELD(&msp->ms_lock)); - ASSERT(!msp->ms_loaded); - ASSERT(!msp->ms_loading); + ASSERT(msp->ms_loading); - msp->ms_loading = B_TRUE; /* * Nobody else can manipulate a loading metaslab, so it's now safe - * to drop the lock. This way we don't have to hold the lock while + * to drop the lock. This way we don't have to hold the lock while * reading the spacemap from disk. */ mutex_exit(&msp->ms_lock); @@ -1509,29 +1506,49 @@ metaslab_load(metaslab_t *msp) msp->ms_start, msp->ms_size); } - success = (error == 0); - mutex_enter(&msp->ms_lock); - msp->ms_loading = B_FALSE; - if (success) { - ASSERT3P(msp->ms_group, !=, NULL); - msp->ms_loaded = B_TRUE; + if (error != 0) + return (error); - /* - * If the metaslab already has a spacemap, then we need to - * remove all segments from the defer tree; otherwise, the - * metaslab is completely empty and we can skip this. - */ - if (msp->ms_sm != NULL) { - for (int t = 0; t < TXG_DEFER_SIZE; t++) { - range_tree_walk(msp->ms_defer[t], - range_tree_remove, msp->ms_allocatable); - } + ASSERT3P(msp->ms_group, !=, NULL); + msp->ms_loaded = B_TRUE; + + /* + * If the metaslab already has a spacemap, then we need to + * remove all segments from the defer tree; otherwise, the + * metaslab is completely empty and we can skip this. + */ + if (msp->ms_sm != NULL) { + for (int t = 0; t < TXG_DEFER_SIZE; t++) { + range_tree_walk(msp->ms_defer[t], + range_tree_remove, msp->ms_allocatable); } - msp->ms_max_size = metaslab_block_maxsize(msp); } + msp->ms_max_size = metaslab_block_maxsize(msp); + + return (0); +} + +int +metaslab_load(metaslab_t *msp) +{ + ASSERT(MUTEX_HELD(&msp->ms_lock)); + + /* + * There may be another thread loading the same metaslab, if that's + * the case just wait until the other thread is done and return. + */ + metaslab_load_wait(msp); + if (msp->ms_loaded) + return (0); + VERIFY(!msp->ms_loading); + + msp->ms_loading = B_TRUE; + int error = metaslab_load_impl(msp); + msp->ms_loading = B_FALSE; cv_broadcast(&msp->ms_load_cv); + return (error); } @@ -2091,13 +2108,10 @@ metaslab_activate(metaslab_t *msp, int allocator, uint ASSERT(MUTEX_HELD(&msp->ms_lock)); if ((msp->ms_weight & METASLAB_ACTIVE_MASK) == 0) { - int error = 0; - metaslab_load_wait(msp); - if (!msp->ms_loaded) { - if ((error = metaslab_load(msp)) != 0) { - metaslab_group_sort(msp->ms_group, msp, 0); - return (error); - } + int error = metaslab_load(msp); + if (error != 0) { + metaslab_group_sort(msp->ms_group, msp, 0); + return (error); } if ((msp->ms_weight & METASLAB_ACTIVE_MASK) != 0) { /* @@ -2209,9 +2223,7 @@ metaslab_preload(void *arg) ASSERT(!MUTEX_HELD(&msp->ms_group->mg_lock)); mutex_enter(&msp->ms_lock); - metaslab_load_wait(msp); - if (!msp->ms_loaded) - (void) metaslab_load(msp); + (void) metaslab_load(msp); msp->ms_selected_txg = spa_syncing_txg(spa); mutex_exit(&msp->ms_lock); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h Wed Oct 16 06:18:37 2019 (r353611) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h Wed Oct 16 06:26:51 2019 (r353612) @@ -48,7 +48,6 @@ int metaslab_init(metaslab_group_t *, uint64_t, uint64 metaslab_t **); void metaslab_fini(metaslab_t *); -void metaslab_load_wait(metaslab_t *); int metaslab_load(metaslab_t *); void metaslab_unload(metaslab_t *); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h Wed Oct 16 06:18:37 2019 (r353611) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h Wed Oct 16 06:26:51 2019 (r353612) @@ -370,8 +370,8 @@ struct metaslab { uint64_t ms_initializing; /* leaves initializing this ms */ /* - * We must hold both ms_lock and ms_group->mg_lock in order to - * modify ms_loaded. + * We must always hold the ms_lock when modifying ms_loaded + * and ms_loading. */ boolean_t ms_loaded; boolean_t ms_loading; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Wed Oct 16 06:18:37 2019 (r353611) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Wed Oct 16 06:26:51 2019 (r353612) @@ -163,34 +163,34 @@ static vdev_ops_t *vdev_ops_table[] = { }; -/* target number of metaslabs per top-level vdev */ -int vdev_max_ms_count = 200; -SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, max_ms_count, CTLFLAG_RWTUN, - &vdev_max_ms_count, 0, +/* default target for number of metaslabs per top-level vdev */ +int zfs_vdev_default_ms_count = 200; +SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, default_ms_count, CTLFLAG_RWTUN, + &zfs_vdev_default_ms_count, 0, "Target number of metaslabs per top-level vdev"); /* minimum number of metaslabs per top-level vdev */ -int vdev_min_ms_count = 16; +int zfs_vdev_min_ms_count = 16; SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, min_ms_count, CTLFLAG_RWTUN, - &vdev_min_ms_count, 0, + &zfs_vdev_min_ms_count, 0, "Minimum number of metaslabs per top-level vdev"); /* practical upper limit of total metaslabs per top-level vdev */ -int vdev_ms_count_limit = 1ULL << 17; +int zfs_vdev_ms_count_limit = 1ULL << 17; SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, max_ms_count_limit, CTLFLAG_RWTUN, - &vdev_ms_count_limit, 0, + &zfs_vdev_ms_count_limit, 0, "Maximum number of metaslabs per top-level vdev"); /* lower limit for metaslab size (512M) */ -int vdev_default_ms_shift = 29; +int zfs_vdev_default_ms_shift = 29; SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, default_ms_shift, CTLFLAG_RWTUN, - &vdev_default_ms_shift, 0, + &zfs_vdev_default_ms_shift, 0, "Default shift between vdev size and number of metaslabs"); -/* upper limit for metaslab size (256G) */ -int vdev_max_ms_shift = 38; +/* upper limit for metaslab size (16G) */ +int zfs_vdev_max_ms_shift = 34; SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, max_ms_shift, CTLFLAG_RWTUN, - &vdev_max_ms_shift, 0, + &zfs_vdev_max_ms_shift, 0, "Maximum shift between vdev size and number of metaslabs"); boolean_t vdev_validate_skip = B_FALSE; @@ -2205,16 +2205,24 @@ void vdev_metaslab_set_size(vdev_t *vd) { uint64_t asize = vd->vdev_asize; - uint64_t ms_count = asize >> vdev_default_ms_shift; + uint64_t ms_count = asize >> zfs_vdev_default_ms_shift; uint64_t ms_shift; /* * There are two dimensions to the metaslab sizing calculation: * the size of the metaslab and the count of metaslabs per vdev. - * In general, we aim for vdev_max_ms_count (200) metaslabs. The - * range of the dimensions are as follows: * - * 2^29 <= ms_size <= 2^38 + * The default values used below are a good balance between memory + * usage (larger metaslab size means more memory needed for loaded + * metaslabs; more metaslabs means more memory needed for the + * metaslab_t structs), metaslab load time (larger metaslabs take + * longer to load), and metaslab sync time (more metaslabs means + * more time spent syncing all of them). + * + * In general, we aim for zfs_vdev_default_ms_count (200) metaslabs. + * The range of the dimensions are as follows: + * + * 2^29 <= ms_size <= 2^34 * 16 <= ms_count <= 131,072 * * On the lower end of vdev sizes, we aim for metaslabs sizes of @@ -2223,35 +2231,41 @@ vdev_metaslab_set_size(vdev_t *vd) * of at least 16 metaslabs will override this minimum size goal. * * On the upper end of vdev sizes, we aim for a maximum metaslab - * size of 256GB. However, we will cap the total count to 2^17 - * metaslabs to keep our memory footprint in check. + * size of 16GB. However, we will cap the total count to 2^17 + * metaslabs to keep our memory footprint in check and let the + * metaslab size grow from there if that limit is hit. * * The net effect of applying above constrains is summarized below. * - * vdev size metaslab count - * -------------|----------------- - * < 8GB ~16 - * 8GB - 100GB one per 512MB - * 100GB - 50TB ~200 - * 50TB - 32PB one per 256GB - * > 32PB ~131,072 - * ------------------------------- + * vdev size metaslab count + * --------------|----------------- + * < 8GB ~16 + * 8GB - 100GB one per 512MB + * 100GB - 3TB ~200 + * 3TB - 2PB one per 16GB + * > 2PB ~131,072 + * -------------------------------- + * + * Finally, note that all of the above calculate the initial + * number of metaslabs. Expanding a top-level vdev will result + * in additional metaslabs being allocated making it possible + * to exceed the zfs_vdev_ms_count_limit. */ - if (ms_count < vdev_min_ms_count) - ms_shift = highbit64(asize / vdev_min_ms_count); - else if (ms_count > vdev_max_ms_count) - ms_shift = highbit64(asize / vdev_max_ms_count); + if (ms_count < zfs_vdev_min_ms_count) + ms_shift = highbit64(asize / zfs_vdev_min_ms_count); + else if (ms_count > zfs_vdev_default_ms_count) + ms_shift = highbit64(asize / zfs_vdev_default_ms_count); else - ms_shift = vdev_default_ms_shift; + ms_shift = zfs_vdev_default_ms_shift; if (ms_shift < SPA_MAXBLOCKSHIFT) { ms_shift = SPA_MAXBLOCKSHIFT; - } else if (ms_shift > vdev_max_ms_shift) { - ms_shift = vdev_max_ms_shift; + } else if (ms_shift > zfs_vdev_max_ms_shift) { + ms_shift = zfs_vdev_max_ms_shift; /* cap the total count to constrain memory footprint */ - if ((asize >> ms_shift) > vdev_ms_count_limit) - ms_shift = highbit64(asize / vdev_ms_count_limit); + if ((asize >> ms_shift) > zfs_vdev_ms_count_limit) + ms_shift = highbit64(asize / zfs_vdev_ms_count_limit); } vd->vdev_ms_shift = ms_shift; @@ -3611,13 +3625,17 @@ vdev_accessible(vdev_t *vd, zio_t *zio) boolean_t vdev_is_spacemap_addressable(vdev_t *vd) { + if (spa_feature_is_active(vd->vdev_spa, SPA_FEATURE_SPACEMAP_V2)) + return (B_TRUE); + /* - * Assuming 47 bits of the space map entry dedicated for the entry's - * offset (see description in space_map.h), we calculate the maximum - * address that can be described by a space map entry for the given - * device. + * If double-word space map entries are not enabled we assume + * 47 bits of the space map entry are dedicated to the entry's + * offset (see SM_OFFSET_BITS in space_map.h). We then use that + * to calculate the maximum address that can be described by a + * space map entry for the given device. */ - uint64_t shift = vd->vdev_ashift + 47; + uint64_t shift = vd->vdev_ashift + SM_OFFSET_BITS; if (shift >= 63) /* detect potential overflow */ return (B_TRUE); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_initialize.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_initialize.c Wed Oct 16 06:18:37 2019 (r353611) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_initialize.c Wed Oct 16 06:26:51 2019 (r353612) @@ -353,16 +353,6 @@ vdev_initialize_ranges(vdev_t *vd, abd_t *data) } static void -vdev_initialize_ms_load(metaslab_t *msp) -{ - ASSERT(MUTEX_HELD(&msp->ms_lock)); - - metaslab_load_wait(msp); - if (!msp->ms_loaded) - VERIFY0(metaslab_load(msp)); -} - -static void vdev_initialize_mg_wait(metaslab_group_t *mg) { ASSERT(MUTEX_HELD(&mg->mg_ms_initialize_lock)); @@ -484,10 +474,10 @@ vdev_initialize_calculate_progress(vdev_t *vd) * metaslab. Load it and walk the free tree for more accurate * progress estimation. */ - vdev_initialize_ms_load(msp); + VERIFY0(metaslab_load(msp)); - for (range_seg_t *rs = avl_first(&msp->ms_allocatable->rt_root); rs; - rs = AVL_NEXT(&msp->ms_allocatable->rt_root, rs)) { + for (range_seg_t *rs = avl_first(&msp->ms_allocatable->rt_root); + rs; rs = AVL_NEXT(&msp->ms_allocatable->rt_root, rs)) { logical_rs.rs_start = rs->rs_start; logical_rs.rs_end = rs->rs_end; vdev_xlate(vd, &logical_rs, &physical_rs); @@ -615,7 +605,7 @@ vdev_initialize_thread(void *arg) vdev_initialize_ms_mark(msp); mutex_enter(&msp->ms_lock); - vdev_initialize_ms_load(msp); + VERIFY0(metaslab_load(msp)); range_tree_walk(msp->ms_allocatable, vdev_initialize_range_add, vd); From owner-svn-src-all@freebsd.org Wed Oct 16 06:35:00 2019 Return-Path: Delivered-To: svn-src-all@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 BC1E815CC1C; Wed, 16 Oct 2019 06:35: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 46tMwh4HPdz4JYl; Wed, 16 Oct 2019 06:35:00 +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 766EC2DF7; Wed, 16 Oct 2019 06:35:00 +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 x9G6Z0Cx083102; Wed, 16 Oct 2019 06:35:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G6Ywd6083078; Wed, 16 Oct 2019 06:34:58 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160634.x9G6Ywd6083078@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 06:34:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353613 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 353613 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 06:35:00 -0000 Author: avg Date: Wed Oct 16 06:34:58 2019 New Revision: 353613 URL: https://svnweb.freebsd.org/changeset/base/353613 Log: 10731 zfs: NULL pointer errors illumos/illumos-gate@dd328bf6d39366b8d7bde6a36114538fc14332dd https://github.com/illumos/illumos-gate/commit/dd328bf6d39366b8d7bde6a36114538fc14332dd https://www.illumos.org/issues/10731 Author: Toomas Soome Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.c vendor-sys/illumos/dist/uts/common/fs/zfs/sa.c vendor-sys/illumos/dist/uts/common/fs/zfs/zcp.c vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_get.c vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_global.c vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_iter.c vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.c Wed Oct 16 06:26:51 2019 (r353612) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.c Wed Oct 16 06:34:58 2019 (r353613) @@ -1147,8 +1147,7 @@ int dsl_pool_user_release(dsl_pool_t *dp, uint64_t dsobj, const char *tag, dmu_tx_t *tx) { - return (dsl_pool_user_hold_rele_impl(dp, dsobj, tag, NULL, - tx, B_FALSE)); + return (dsl_pool_user_hold_rele_impl(dp, dsobj, tag, 0, tx, B_FALSE)); } /* Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sa.c Wed Oct 16 06:26:51 2019 (r353612) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sa.c Wed Oct 16 06:34:58 2019 (r353613) @@ -1577,12 +1577,12 @@ sa_attr_register_sync(sa_handle_t *hdl, dmu_tx_t *tx) mutex_enter(&sa->sa_lock); - if (!sa->sa_need_attr_registration || sa->sa_master_obj == NULL) { + if (!sa->sa_need_attr_registration || sa->sa_master_obj == 0) { mutex_exit(&sa->sa_lock); return; } - if (sa->sa_reg_attr_obj == NULL) { + if (sa->sa_reg_attr_obj == 0) { sa->sa_reg_attr_obj = zap_create_link(hdl->sa_os, DMU_OT_SA_ATTR_REGISTRATION, sa->sa_master_obj, SA_REGISTRY, tx); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zcp.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zcp.c Wed Oct 16 06:26:51 2019 (r353612) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zcp.c Wed Oct 16 06:34:58 2019 (r353613) @@ -608,23 +608,23 @@ zcp_dataset_hold_error(lua_State *state, dsl_pool_t *d { if (error == ENOENT) { (void) zcp_argerror(state, 1, "no such dataset '%s'", dsname); - return (NULL); /* not reached; zcp_argerror will longjmp */ + return (0); /* not reached; zcp_argerror will longjmp */ } else if (error == EXDEV) { (void) zcp_argerror(state, 1, "dataset '%s' is not in the target pool '%s'", dsname, spa_name(dp->dp_spa)); - return (NULL); /* not reached; zcp_argerror will longjmp */ + return (0); /* not reached; zcp_argerror will longjmp */ } else if (error == EIO) { (void) luaL_error(state, "I/O error while accessing dataset '%s'", dsname); - return (NULL); /* not reached; luaL_error will longjmp */ + return (0); /* not reached; luaL_error will longjmp */ } else if (error != 0) { (void) luaL_error(state, "unexpected error %d while accessing dataset '%s'", error, dsname); - return (NULL); /* not reached; luaL_error will longjmp */ + return (0); /* not reached; luaL_error will longjmp */ } - return (NULL); + return (0); } /* @@ -647,10 +647,10 @@ static zcp_lib_info_t zcp_debug_info = { .func = zcp_debug, .pargs = { { .za_name = "debug string", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} } }; @@ -676,10 +676,10 @@ static zcp_lib_info_t zcp_exists_info = { .func = zcp_exists, .pargs = { { .za_name = "dataset", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} } }; Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_get.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_get.c Wed Oct 16 06:26:51 2019 (r353612) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_get.c Wed Oct 16 06:34:58 2019 (r353613) @@ -330,8 +330,7 @@ get_special_prop(lua_State *state, dsl_dataset_t *ds, error = get_clones_stat_impl(ds, clones); if (error == 0) { /* push list to lua stack */ - VERIFY0(zcp_nvlist_to_lua(state, clones, NULL, - NULL)); + VERIFY0(zcp_nvlist_to_lua(state, clones, NULL, 0)); /* source */ (void) lua_pushnil(state); } @@ -792,10 +791,10 @@ static zcp_lib_info_t zcp_get_prop_info = { .pargs = { { .za_name = "dataset", .za_lua_type = LUA_TSTRING}, { .za_name = "property", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} } }; Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_global.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_global.c Wed Oct 16 06:26:51 2019 (r353612) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_global.c Wed Oct 16 06:34:58 2019 (r353613) @@ -68,7 +68,7 @@ static const zcp_errno_global_t errno_globals[] = { {"ENOTSUP", ENOTSUP}, {"EDQUOT", EDQUOT}, {"ENAMETOOLONG", ENAMETOOLONG}, - {NULL, NULL} + {NULL, 0} }; static void Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_iter.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_iter.c Wed Oct 16 06:26:51 2019 (r353612) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_iter.c Wed Oct 16 06:34:58 2019 (r353613) @@ -110,10 +110,10 @@ static zcp_list_info_t zcp_clones_list_info = { .gc = NULL, .pargs = { { .za_name = "snapshot", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} } }; @@ -199,10 +199,10 @@ static zcp_list_info_t zcp_snapshots_list_info = { .gc = NULL, .pargs = { { .za_name = "filesystem | volume", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} } }; @@ -300,10 +300,10 @@ static zcp_list_info_t zcp_children_list_info = { .gc = NULL, .pargs = { { .za_name = "filesystem | volume", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} } }; @@ -381,10 +381,10 @@ static zcp_list_info_t zcp_props_list_info = { .pargs = { { .za_name = "filesystem | snapshot | volume", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} } }; @@ -439,10 +439,10 @@ static zcp_list_info_t zcp_system_props_list_info = { .func = zcp_system_props_list, .pargs = { { .za_name = "dataset", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} } }; Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.c Wed Oct 16 06:26:51 2019 (r353612) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.c Wed Oct 16 06:34:58 2019 (r353613) @@ -104,11 +104,11 @@ static zcp_synctask_info_t zcp_synctask_destroy_info = .func = zcp_synctask_destroy, .pargs = { {.za_name = "filesystem | snapshot", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { {.za_name = "defer", .za_lua_type = LUA_TBOOLEAN}, - {NULL, NULL} + {NULL, 0} }, .space_check = ZFS_SPACE_CHECK_DESTROY, .blocks_modified = 0 @@ -157,10 +157,10 @@ static zcp_synctask_info_t zcp_synctask_promote_info = .func = zcp_synctask_promote, .pargs = { {.za_name = "clone", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} }, .space_check = ZFS_SPACE_CHECK_RESERVED, .blocks_modified = 3 @@ -196,10 +196,10 @@ static zcp_synctask_info_t zcp_synctask_rollback_info .blocks_modified = 1, .pargs = { {.za_name = "filesystem", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} } }; @@ -226,10 +226,10 @@ static zcp_synctask_info_t zcp_synctask_snapshot_info .pargs = { {.za_name = "filesystem@snapname | volume@snapname", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} }, .space_check = ZFS_SPACE_CHECK_NORMAL, .blocks_modified = 3 Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Wed Oct 16 06:26:51 2019 (r353612) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Wed Oct 16 06:34:58 2019 (r353613) @@ -306,7 +306,7 @@ history_str_get(zfs_cmd_t *zc) { char *buf; - if (zc->zc_history == NULL) + if (zc->zc_history == 0) return (NULL); buf = kmem_alloc(HIS_MAX_RECORD_LEN, KM_SLEEP); @@ -2221,7 +2221,7 @@ zfs_ioc_objset_zplprops(zfs_cmd_t *zc) * which we aren't supposed to do with a DS_MODE_USER * hold, because it could be inconsistent. */ - if (zc->zc_nvlist_dst != NULL && + if (zc->zc_nvlist_dst != 0 && !zc->zc_objset_stats.dds_inconsistent && dmu_objset_type(os) == DMU_OST_ZFS) { nvlist_t *nv; @@ -2778,7 +2778,7 @@ zfs_ioc_set_prop(zfs_cmd_t *zc) if (error == 0) error = zfs_set_prop_nvlist(zc->zc_name, source, nvl, errors); - if (zc->zc_nvlist_dst != NULL && errors != NULL) { + if (zc->zc_nvlist_dst != 0 && errors != NULL) { (void) put_nvlist(zc, errors); } @@ -2929,7 +2929,7 @@ zfs_ioc_pool_get_props(zfs_cmd_t *zc) spa_close(spa, FTAG); } - if (error == 0 && zc->zc_nvlist_dst != NULL) + if (error == 0 && zc->zc_nvlist_dst != 0) error = put_nvlist(zc, nvp); else error = SET_ERROR(EFAULT); @@ -4401,7 +4401,7 @@ zfs_ioc_recv(zfs_cmd_t *zc) tosnap = strchr(tofs, '@'); *tosnap++ = '\0'; - if (zc->zc_nvlist_src != NULL && + if (zc->zc_nvlist_src != 0 && (error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size, zc->zc_iflags, &props)) != 0) return (error); @@ -4825,7 +4825,7 @@ zfs_ioc_clear(zfs_cmd_t *zc) nvlist_t *policy; nvlist_t *config = NULL; - if (zc->zc_nvlist_src == NULL) + if (zc->zc_nvlist_src == 0) return (SET_ERROR(EINVAL)); if ((error = get_nvlist(zc->zc_nvlist_src, From owner-svn-src-all@freebsd.org Wed Oct 16 06:38:05 2019 Return-Path: Delivered-To: svn-src-all@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 CDD0315CCA2; Wed, 16 Oct 2019 06:38:05 +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 46tN0F52kwz4Jh8; Wed, 16 Oct 2019 06:38:05 +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 8BDB82DF8; Wed, 16 Oct 2019 06:38:05 +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 x9G6c5JG083300; Wed, 16 Oct 2019 06:38:05 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G6c5Ei083299; Wed, 16 Oct 2019 06:38:05 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160638.x9G6c5Ei083299@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 06:38:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353614 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 353614 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 06:38:05 -0000 Author: avg Date: Wed Oct 16 06:38:05 2019 New Revision: 353614 URL: https://svnweb.freebsd.org/changeset/base/353614 Log: MFV r353613: 10731 zfs: NULL pointer errors FreeBSD already had these changes locally. This commit removes a small formatting difference. MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Wed Oct 16 06:34:58 2019 (r353613) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Wed Oct 16 06:38:05 2019 (r353614) @@ -1249,8 +1249,7 @@ int dsl_pool_user_release(dsl_pool_t *dp, uint64_t dsobj, const char *tag, dmu_tx_t *tx) { - return (dsl_pool_user_hold_rele_impl(dp, dsobj, tag, 0, - tx, B_FALSE)); + return (dsl_pool_user_hold_rele_impl(dp, dsobj, tag, 0, tx, B_FALSE)); } /* From owner-svn-src-all@freebsd.org Wed Oct 16 06:40:48 2019 Return-Path: Delivered-To: svn-src-all@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 2722B15CD42; Wed, 16 Oct 2019 06:40:48 +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 46tN3N12WZz4Jqv; Wed, 16 Oct 2019 06:40:48 +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 06CE32E0E; Wed, 16 Oct 2019 06:40:48 +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 x9G6em0D083488; Wed, 16 Oct 2019 06:40:48 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G6emag083487; Wed, 16 Oct 2019 06:40:48 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160640.x9G6emag083487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 06:40:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353615 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/cmd/ztest X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/cmd/ztest X-SVN-Commit-Revision: 353615 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 06:40:48 -0000 Author: avg Date: Wed Oct 16 06:40:47 2019 New Revision: 353615 URL: https://svnweb.freebsd.org/changeset/base/353615 Log: 9485 Optimize possible split block search space illumos/illumos-gate@a21fe349793c3805ec504bbe5e9acf06c2d63d7a https://github.com/illumos/illumos-gate/commit/a21fe349793c3805ec504bbe5e9acf06c2d63d7a https://www.illumos.org/issues/9485 Port this commit from ZoL: https://github.com/zfsonlinux/zfs/commit/4589f3ae4c1bb435777da8640eb915f3c713b14d Author: Brian Behlendorf Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/ztest/ztest.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c Wed Oct 16 06:38:05 2019 (r353614) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c Wed Oct 16 06:40:47 2019 (r353615) @@ -206,19 +206,23 @@ uint64_t zfs_condense_min_mapping_bytes = 128 * 1024; int zfs_condense_indirect_commit_entry_delay_ticks = 0; /* - * If a split block contains more than this many segments, consider it too - * computationally expensive to check all (2^num_segments) possible - * combinations. Instead, try at most 2^_segments_max randomly-selected - * combinations. - * - * This is reasonable if only a few segment copies are damaged and the - * majority of segment copies are good. This allows all the segment copies to - * participate fairly in the reconstruction and prevents the repeated use of - * one bad copy. + * If an indirect split block contains more than this many possible unique + * combinations when being reconstructed, consider it too computationally + * expensive to check them all. Instead, try at most 100 randomly-selected + * combinations each time the block is accessed. This allows all segment + * copies to participate fairly in the reconstruction when all combinations + * cannot be checked and prevents repeated use of one bad copy. */ -int zfs_reconstruct_indirect_segments_max = 10; +int zfs_reconstruct_indirect_combinations_max = 256; + /* + * Enable to simulate damaged segments and validate reconstruction. + * Used by ztest + */ +unsigned long zfs_reconstruct_indirect_damage_fraction = 0; + +/* * 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), @@ -228,6 +232,13 @@ int zfs_reconstruct_indirect_segments_max = 10; typedef struct indirect_child { abd_t *ic_data; vdev_t *ic_vdev; + + /* + * ic_duplicate is NULL when the ic_data contents are unique, when it + * is determined to be a duplicate it references the primary child. + */ + struct indirect_child *ic_duplicate; + list_node_t ic_node; /* node on is_unique_child */ } indirect_child_t; /* @@ -249,12 +260,14 @@ typedef struct indirect_split { uint64_t is_target_offset; /* offset on is_vdev */ uint64_t is_size; int is_children; /* number of entries in is_child[] */ + int is_unique_children; /* number of entries in is_unique_child */ + list_t is_unique_child; /* * is_good_child is the child that we are currently using to * attempt reconstruction. */ - int is_good_child; + indirect_child_t *is_good_child; indirect_child_t is_child[1]; /* variable-length */ } indirect_split_t; @@ -266,6 +279,9 @@ typedef struct indirect_split { typedef struct indirect_vsd { boolean_t iv_split_block; boolean_t iv_reconstruct; + uint64_t iv_unique_combinations; + uint64_t iv_attempts; + uint64_t iv_attempts_max; list_t iv_splits; /* list of indirect_split_t's */ } indirect_vsd_t; @@ -283,6 +299,13 @@ vdev_indirect_map_free(zio_t *zio) abd_free(ic->ic_data); } list_remove(&iv->iv_splits, is); + + indirect_child_t *ic; + while ((ic = list_head(&is->is_unique_child)) != NULL) + list_remove(&is->is_unique_child, ic); + + list_destroy(&is->is_unique_child); + kmem_free(is, offsetof(indirect_split_t, is_child[is->is_children])); } @@ -1177,6 +1200,8 @@ vdev_indirect_gather_splits(uint64_t split_offset, vde is->is_split_offset = split_offset; is->is_target_offset = offset; is->is_vdev = vd; + list_create(&is->is_unique_child, sizeof (indirect_child_t), + offsetof(indirect_child_t, ic_node)); /* * Note that we only consider multiple copies of the data for @@ -1187,6 +1212,7 @@ vdev_indirect_gather_splits(uint64_t split_offset, vde if (vd->vdev_ops == &vdev_mirror_ops) { for (int i = 0; i < n; i++) { is->is_child[i].ic_vdev = vd->vdev_child[i]; + list_link_init(&is->is_child[i].ic_node); } } else { is->is_child[0].ic_vdev = vd; @@ -1239,6 +1265,7 @@ vdev_indirect_read_all(zio_t *zio) ic->ic_data = abd_alloc_sametype(zio->io_abd, is->is_size); + ic->ic_duplicate = NULL; zio_nowait(zio_vdev_child_io(zio, NULL, ic->ic_vdev, is->is_target_offset, ic->ic_data, @@ -1350,7 +1377,7 @@ vdev_indirect_checksum_error(zio_t *zio, zio_bad_cksum_t zbc = { 0 }; void *bad_buf = abd_borrow_buf_copy(ic->ic_data, is->is_size); - abd_t *good_abd = is->is_child[is->is_good_child].ic_data; + abd_t *good_abd = is->is_good_child->ic_data; void *good_buf = abd_borrow_buf_copy(good_abd, is->is_size); zfs_ereport_post_checksum(zio->io_spa, vd, zio, is->is_target_offset, is->is_size, good_buf, bad_buf, &zbc); @@ -1383,21 +1410,18 @@ vdev_indirect_repair(zio_t *zio) for (indirect_split_t *is = list_head(&iv->iv_splits); is != NULL; is = list_next(&iv->iv_splits, is)) { - indirect_child_t *good_child = &is->is_child[is->is_good_child]; - for (int c = 0; c < is->is_children; c++) { indirect_child_t *ic = &is->is_child[c]; - if (ic == good_child) + if (ic == is->is_good_child) continue; if (ic->ic_data == NULL) continue; - if (abd_cmp(good_child->ic_data, ic->ic_data, - is->is_size) == 0) + if (ic->ic_duplicate == is->is_good_child) continue; zio_nowait(zio_vdev_child_io(zio, NULL, ic->ic_vdev, is->is_target_offset, - good_child->ic_data, is->is_size, + is->is_good_child->ic_data, is->is_size, ZIO_TYPE_WRITE, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_IO_REPAIR | ZIO_FLAG_SELF_HEAL, NULL, NULL)); @@ -1440,21 +1464,194 @@ vdev_indirect_all_checksum_errors(zio_t *zio) } /* + * Copy data from all the splits to a main zio then validate the checksum. + * If then checksum is successfully validated return success. + */ +static int +vdev_indirect_splits_checksum_validate(indirect_vsd_t *iv, zio_t *zio) +{ + zio_bad_cksum_t zbc; + + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + + ASSERT3P(is->is_good_child->ic_data, !=, NULL); + ASSERT3P(is->is_good_child->ic_duplicate, ==, NULL); + + abd_copy_off(zio->io_abd, is->is_good_child->ic_data, + is->is_split_offset, 0, is->is_size); + } + + return (zio_checksum_error(zio, &zbc)); +} + +/* + * There are relatively few possible combinations making it feasible to + * deterministically check them all. We do this by setting the good_child + * to the next unique split version. If we reach the end of the list then + * "carry over" to the next unique split version (like counting in base + * is_unique_children, but each digit can have a different base). + */ +static int +vdev_indirect_splits_enumerate_all(indirect_vsd_t *iv, zio_t *zio) +{ + boolean_t more = B_TRUE; + + iv->iv_attempts = 0; + + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) + is->is_good_child = list_head(&is->is_unique_child); + + while (more == B_TRUE) { + iv->iv_attempts++; + more = B_FALSE; + + if (vdev_indirect_splits_checksum_validate(iv, zio) == 0) + return (0); + + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + is->is_good_child = list_next(&is->is_unique_child, + is->is_good_child); + if (is->is_good_child != NULL) { + more = B_TRUE; + break; + } + + is->is_good_child = list_head(&is->is_unique_child); + } + } + + ASSERT3S(iv->iv_attempts, <=, iv->iv_unique_combinations); + + return (SET_ERROR(ECKSUM)); +} + +/* + * There are too many combinations to try all of them in a reasonable amount + * of time. So try a fixed number of random combinations from the unique + * split versions, after which we'll consider the block unrecoverable. + */ +static int +vdev_indirect_splits_enumerate_randomly(indirect_vsd_t *iv, zio_t *zio) +{ + iv->iv_attempts = 0; + + while (iv->iv_attempts < iv->iv_attempts_max) { + iv->iv_attempts++; + + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + indirect_child_t *ic = list_head(&is->is_unique_child); + int children = is->is_unique_children; + + for (int i = spa_get_random(children); i > 0; i--) + ic = list_next(&is->is_unique_child, ic); + + ASSERT3P(ic, !=, NULL); + is->is_good_child = ic; + } + + if (vdev_indirect_splits_checksum_validate(iv, zio) == 0) + return (0); + } + + return (SET_ERROR(ECKSUM)); +} + +/* + * This is a validation function for reconstruction. It randomly selects + * a good combination, if one can be found, and then it intentionally + * damages all other segment copes by zeroing them. This forces the + * reconstruction algorithm to locate the one remaining known good copy. + */ +static int +vdev_indirect_splits_damage(indirect_vsd_t *iv, zio_t *zio) +{ + /* Presume all the copies are unique for initial selection. */ + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + is->is_unique_children = 0; + + for (int i = 0; i < is->is_children; i++) { + indirect_child_t *ic = &is->is_child[i]; + if (ic->ic_data != NULL) { + is->is_unique_children++; + list_insert_tail(&is->is_unique_child, ic); + } + } + } + + /* + * Set each is_good_child to a randomly-selected child which + * is known to contain validated data. + */ + int error = vdev_indirect_splits_enumerate_randomly(iv, zio); + if (error) + goto out; + + /* + * Damage all but the known good copy by zeroing it. This will + * result in two or less unique copies per indirect_child_t. + * Both may need to be checked in order to reconstruct the block. + * Set iv->iv_attempts_max such that all unique combinations will + * enumerated, but limit the damage to at most 16 indirect splits. + */ + iv->iv_attempts_max = 1; + + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + for (int c = 0; c < is->is_children; c++) { + indirect_child_t *ic = &is->is_child[c]; + + if (ic == is->is_good_child) + continue; + if (ic->ic_data == NULL) + continue; + + abd_zero(ic->ic_data, ic->ic_data->abd_size); + } + + iv->iv_attempts_max *= 2; + if (iv->iv_attempts_max > (1ULL << 16)) { + iv->iv_attempts_max = UINT64_MAX; + break; + } + } + +out: + /* Empty the unique children lists so they can be reconstructed. */ + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + indirect_child_t *ic; + while ((ic = list_head(&is->is_unique_child)) != NULL) + list_remove(&is->is_unique_child, ic); + + is->is_unique_children = 0; + } + + return (error); +} + +/* * This function is called when we have read all copies of the data and need * to try to find a combination of copies that gives us the right checksum. * * If we pointed to any mirror vdevs, this effectively does the job of the * mirror. The mirror vdev code can't do its own job because we don't know - * the checksum of each split segment individually. We have to try every - * combination of copies of split segments, until we find one that checksums - * correctly. (Or until we have tried all combinations, or have tried - * 2^zfs_reconstruct_indirect_segments_max combinations. In these cases we - * set io_error to ECKSUM to propagate the error up to the user.) + * the checksum of each split segment individually. * - * For example, if we have 3 segments in the split, - * and each points to a 2-way mirror, we will have the following pieces of - * data: + * We have to try every unique combination of copies of split segments, until + * we find one that checksums correctly. Duplicate segment copies are first + * identified and latter skipped during reconstruction. This optimization + * reduces the search space and ensures that of the remaining combinations + * at most one is correct. * + * When the total number of combinations is small they can all be checked. + * For example, if we have 3 segments in the split, and each points to a + * 2-way mirror with unique copies, we will have the following pieces of data: + * * | mirror child * split | [0] [1] * ======|===================== @@ -1480,10 +1677,10 @@ vdev_indirect_all_checksum_errors(zio_t *zio) * data_A_1 data_B_1 data_C_1 * * Note that the split segments may be on the same or different top-level - * vdevs. In either case, we try lots of combinations (see - * zfs_reconstruct_indirect_segments_max). This ensures that if a mirror has - * small silent errors on all of its children, we can still reconstruct the - * correct data, as long as those errors are at sufficiently-separated + * vdevs. In either case, we may need to try lots of combinations (see + * zfs_reconstruct_indirect_combinations_max). This ensures that if a mirror + * has small silent errors on all of its children, we can still reconstruct + * the correct data, as long as those errors are at sufficiently-separated * offsets (specifically, separated by the largest block size - default of * 128KB, but up to 16MB). */ @@ -1491,90 +1688,91 @@ static void vdev_indirect_reconstruct_io_done(zio_t *zio) { indirect_vsd_t *iv = zio->io_vsd; - uint64_t attempts = 0; - uint64_t attempts_max = 1ULL << zfs_reconstruct_indirect_segments_max; - int segments = 0; + boolean_t known_good = B_FALSE; + int error; + iv->iv_unique_combinations = 1; + iv->iv_attempts_max = UINT64_MAX; + + if (zfs_reconstruct_indirect_combinations_max > 0) + iv->iv_attempts_max = zfs_reconstruct_indirect_combinations_max; + + /* + * If nonzero, every 1/x blocks will be damaged, in order to validate + * reconstruction when there are split segments with damaged copies. + * Known_good will TRUE when reconstruction is known to be possible. + */ + if (zfs_reconstruct_indirect_damage_fraction != 0 && + spa_get_random(zfs_reconstruct_indirect_damage_fraction) == 0) + known_good = (vdev_indirect_splits_damage(iv, zio) == 0); + + /* + * Determine the unique children for a split segment and add them + * to the is_unique_child list. By restricting reconstruction + * to these children, only unique combinations will be considered. + * This can vastly reduce the search space when there are a large + * number of indirect splits. + */ for (indirect_split_t *is = list_head(&iv->iv_splits); - is != NULL; is = list_next(&iv->iv_splits, is)) - segments++; + is != NULL; is = list_next(&iv->iv_splits, is)) { + is->is_unique_children = 0; - for (;;) { - /* copy data from splits to main zio */ - int ret; - for (indirect_split_t *is = list_head(&iv->iv_splits); - is != NULL; is = list_next(&iv->iv_splits, is)) { + for (int i = 0; i < is->is_children; i++) { + indirect_child_t *ic_i = &is->is_child[i]; - /* - * If this child failed, its ic_data will be NULL. - * Skip this combination. - */ - if (is->is_child[is->is_good_child].ic_data == NULL) { - ret = EIO; - goto next; - } + if (ic_i->ic_data == NULL || + ic_i->ic_duplicate != NULL) + continue; - abd_copy_off(zio->io_abd, - is->is_child[is->is_good_child].ic_data, - is->is_split_offset, 0, is->is_size); - } + for (int j = i + 1; j < is->is_children; j++) { + indirect_child_t *ic_j = &is->is_child[j]; - /* See if this checksum matches. */ - zio_bad_cksum_t zbc; - ret = zio_checksum_error(zio, &zbc); - if (ret == 0) { - /* Found a matching checksum. Issue repair i/os. */ - vdev_indirect_repair(zio); - zio_checksum_verified(zio); - return; - } + if (ic_j->ic_data == NULL || + ic_j->ic_duplicate != NULL) + continue; - /* - * Checksum failed; try a different combination of split - * children. - */ - boolean_t more; -next: - more = B_FALSE; - if (segments <= zfs_reconstruct_indirect_segments_max) { - /* - * There are relatively few segments, so - * deterministically check all combinations. We do - * this by by adding one to the first split's - * good_child. If it overflows, then "carry over" to - * the next split (like counting in base is_children, - * but each digit can have a different base). - */ - for (indirect_split_t *is = list_head(&iv->iv_splits); - is != NULL; is = list_next(&iv->iv_splits, is)) { - is->is_good_child++; - if (is->is_good_child < is->is_children) { - more = B_TRUE; - break; + if (abd_cmp(ic_i->ic_data, ic_j->ic_data, + is->is_size) == 0) { + ic_j->ic_duplicate = ic_i; } - is->is_good_child = 0; } - } else if (++attempts < attempts_max) { - /* - * There are too many combinations to try all of them - * in a reasonable amount of time, so try a fixed - * number of random combinations, after which we'll - * consider the block unrecoverable. - */ - for (indirect_split_t *is = list_head(&iv->iv_splits); - is != NULL; is = list_next(&iv->iv_splits, is)) { - is->is_good_child = - spa_get_random(is->is_children); - } - more = B_TRUE; + + is->is_unique_children++; + list_insert_tail(&is->is_unique_child, ic_i); } - if (!more) { - /* All combinations failed. */ - zio->io_error = ret; + + /* Reconstruction is impossible, no valid children */ + EQUIV(list_is_empty(&is->is_unique_child), + is->is_unique_children == 0); + if (list_is_empty(&is->is_unique_child)) { + zio->io_error = EIO; vdev_indirect_all_checksum_errors(zio); zio_checksum_verified(zio); return; } + + iv->iv_unique_combinations *= is->is_unique_children; + } + + if (iv->iv_unique_combinations <= iv->iv_attempts_max) + error = vdev_indirect_splits_enumerate_all(iv, zio); + else + error = vdev_indirect_splits_enumerate_randomly(iv, zio); + + if (error != 0) { + /* All attempted combinations failed. */ + ASSERT3B(known_good, ==, B_FALSE); + zio->io_error = error; + vdev_indirect_all_checksum_errors(zio); + } else { + /* + * The checksum has been successfully validated. Issue + * repair I/Os to any copies of splits which don't match + * the validated version. + */ + ASSERT0(vdev_indirect_splits_checksum_validate(iv, zio)); + vdev_indirect_repair(zio); + zio_checksum_verified(zio); } } From owner-svn-src-all@freebsd.org Wed Oct 16 06:40:48 2019 Return-Path: Delivered-To: svn-src-all@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 9D5A415CD4F; Wed, 16 Oct 2019 06:40:48 +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 46tN3N3jgBz4Jqx; Wed, 16 Oct 2019 06:40:48 +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 62E932E0F; Wed, 16 Oct 2019 06:40:48 +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 x9G6emoo083494; Wed, 16 Oct 2019 06:40:48 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G6emhQ083493; Wed, 16 Oct 2019 06:40:48 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160640.x9G6emhQ083493@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 06:40:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353615 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/cmd/ztest X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/cmd/ztest X-SVN-Commit-Revision: 353615 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 06:40:48 -0000 Author: avg Date: Wed Oct 16 06:40:47 2019 New Revision: 353615 URL: https://svnweb.freebsd.org/changeset/base/353615 Log: 9485 Optimize possible split block search space illumos/illumos-gate@a21fe349793c3805ec504bbe5e9acf06c2d63d7a https://github.com/illumos/illumos-gate/commit/a21fe349793c3805ec504bbe5e9acf06c2d63d7a https://www.illumos.org/issues/9485 Port this commit from ZoL: https://github.com/zfsonlinux/zfs/commit/4589f3ae4c1bb435777da8640eb915f3c713b14d Author: Brian Behlendorf Modified: vendor/illumos/dist/cmd/ztest/ztest.c Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c Modified: vendor/illumos/dist/cmd/ztest/ztest.c ============================================================================== --- vendor/illumos/dist/cmd/ztest/ztest.c Wed Oct 16 06:38:05 2019 (r353614) +++ vendor/illumos/dist/cmd/ztest/ztest.c Wed Oct 16 06:40:47 2019 (r353615) @@ -196,6 +196,7 @@ extern boolean_t zfs_compressed_arc_enabled; extern boolean_t zfs_abd_scatter_enabled; extern int dmu_object_alloc_chunk_shift; extern boolean_t zfs_force_some_double_word_sm_entries; +extern unsigned long zfs_reconstruct_indirect_damage_fraction; static ztest_shared_opts_t *ztest_shared_opts; static ztest_shared_opts_t ztest_opts; @@ -5697,7 +5698,8 @@ ztest_run_zdb(char *pool) isa = strdup(isa); /* LINTED */ (void) sprintf(bin, - "/usr/sbin%.*s/zdb -bcc%s%s -G -d -U %s %s", + "/usr/sbin%.*s/zdb -bcc%s%s -G -d -U %s " + "-o zfs_reconstruct_indirect_combinations_max=65536 %s", isalen, isa, ztest_opts.zo_verbose >= 3 ? "s" : "", @@ -6647,6 +6649,13 @@ main(int argc, char **argv) * of them so the feature get tested. */ zfs_force_some_double_word_sm_entries = B_TRUE; + + /* + * Verify that even extensively damaged split blocks with many + * segments can be reconstructed in a reasonable amount of time + * when reconstruction is known to be possible. + */ + zfs_reconstruct_indirect_damage_fraction = 4; ztest_fd_rand = open("/dev/urandom", O_RDONLY); ASSERT3S(ztest_fd_rand, >=, 0); From owner-svn-src-all@freebsd.org Wed Oct 16 06:43:22 2019 Return-Path: Delivered-To: svn-src-all@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 F29A015CF53; Wed, 16 Oct 2019 06:43:22 +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 46tN6L6XP2z4KJb; Wed, 16 Oct 2019 06:43:22 +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 C34842FAF; Wed, 16 Oct 2019 06:43:22 +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 x9G6hMTd089069; Wed, 16 Oct 2019 06:43:22 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G6hM4J089067; Wed, 16 Oct 2019 06:43:22 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160643.x9G6hM4J089067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 06:43:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353616 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 353616 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 06:43:23 -0000 Author: avg Date: Wed Oct 16 06:43:22 2019 New Revision: 353616 URL: https://svnweb.freebsd.org/changeset/base/353616 Log: MFV r353615: 9485 Optimize possible split block search space illumos/illumos-gate@a21fe349793c3805ec504bbe5e9acf06c2d63d7a https://github.com/illumos/illumos-gate/commit/a21fe349793c3805ec504bbe5e9acf06c2d63d7a https://www.illumos.org/issues/9485 Port this commit from ZoL: https://github.com/zfsonlinux/zfs/commit/4589f3ae4c1bb435777da8640eb915f3c713b14d Author: Brian Behlendorf Obtained from: illumos, ZoL MFC after: 3 weeks Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Wed Oct 16 06:40:47 2019 (r353615) +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Wed Oct 16 06:43:22 2019 (r353616) @@ -198,6 +198,7 @@ extern boolean_t zfs_compressed_arc_enabled; extern boolean_t zfs_abd_scatter_enabled; extern int dmu_object_alloc_chunk_shift; extern boolean_t zfs_force_some_double_word_sm_entries; +extern unsigned long zfs_reconstruct_indirect_damage_fraction; static ztest_shared_opts_t *ztest_shared_opts; static ztest_shared_opts_t ztest_opts; @@ -5696,7 +5697,8 @@ ztest_run_zdb(char *pool) isa = strdup(isa); /* LINTED */ (void) sprintf(bin, - "/usr/sbin%.*s/zdb -bcc%s%s -G -d -U %s %s", + "/usr/sbin%.*s/zdb -bcc%s%s -G -d -U %s " + "-o zfs_reconstruct_indirect_combinations_max=65536 %s", isalen, isa, ztest_opts.zo_verbose >= 3 ? "s" : "", @@ -6652,6 +6654,13 @@ main(int argc, char **argv) * of them so the feature get tested. */ zfs_force_some_double_word_sm_entries = B_TRUE; + + /* + * Verify that even extensively damaged split blocks with many + * segments can be reconstructed in a reasonable amount of time + * when reconstruction is known to be possible. + */ + zfs_reconstruct_indirect_damage_fraction = 4; ztest_fd_rand = open("/dev/urandom", O_RDONLY); ASSERT3S(ztest_fd_rand, >=, 0); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Wed Oct 16 06:40:47 2019 (r353615) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Wed Oct 16 06:43:22 2019 (r353616) @@ -206,19 +206,23 @@ uint64_t zfs_condense_min_mapping_bytes = 128 * 1024; int zfs_condense_indirect_commit_entry_delay_ticks = 0; /* - * If a split block contains more than this many segments, consider it too - * computationally expensive to check all (2^num_segments) possible - * combinations. Instead, try at most 2^_segments_max randomly-selected - * combinations. - * - * This is reasonable if only a few segment copies are damaged and the - * majority of segment copies are good. This allows all the segment copies to - * participate fairly in the reconstruction and prevents the repeated use of - * one bad copy. + * If an indirect split block contains more than this many possible unique + * combinations when being reconstructed, consider it too computationally + * expensive to check them all. Instead, try at most 100 randomly-selected + * combinations each time the block is accessed. This allows all segment + * copies to participate fairly in the reconstruction when all combinations + * cannot be checked and prevents repeated use of one bad copy. */ -int zfs_reconstruct_indirect_segments_max = 10; +int zfs_reconstruct_indirect_combinations_max = 256; + /* + * Enable to simulate damaged segments and validate reconstruction. + * Used by ztest + */ +unsigned long zfs_reconstruct_indirect_damage_fraction = 0; + +/* * 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), @@ -228,6 +232,13 @@ int zfs_reconstruct_indirect_segments_max = 10; typedef struct indirect_child { abd_t *ic_data; vdev_t *ic_vdev; + + /* + * ic_duplicate is NULL when the ic_data contents are unique, when it + * is determined to be a duplicate it references the primary child. + */ + struct indirect_child *ic_duplicate; + list_node_t ic_node; /* node on is_unique_child */ } indirect_child_t; /* @@ -249,12 +260,14 @@ typedef struct indirect_split { uint64_t is_target_offset; /* offset on is_vdev */ uint64_t is_size; int is_children; /* number of entries in is_child[] */ + int is_unique_children; /* number of entries in is_unique_child */ + list_t is_unique_child; /* * is_good_child is the child that we are currently using to * attempt reconstruction. */ - int is_good_child; + indirect_child_t *is_good_child; indirect_child_t is_child[1]; /* variable-length */ } indirect_split_t; @@ -266,6 +279,9 @@ typedef struct indirect_split { typedef struct indirect_vsd { boolean_t iv_split_block; boolean_t iv_reconstruct; + uint64_t iv_unique_combinations; + uint64_t iv_attempts; + uint64_t iv_attempts_max; list_t iv_splits; /* list of indirect_split_t's */ } indirect_vsd_t; @@ -283,6 +299,13 @@ vdev_indirect_map_free(zio_t *zio) abd_free(ic->ic_data); } list_remove(&iv->iv_splits, is); + + indirect_child_t *ic; + while ((ic = list_head(&is->is_unique_child)) != NULL) + list_remove(&is->is_unique_child, ic); + + list_destroy(&is->is_unique_child); + kmem_free(is, offsetof(indirect_split_t, is_child[is->is_children])); } @@ -1181,6 +1204,8 @@ vdev_indirect_gather_splits(uint64_t split_offset, vde is->is_split_offset = split_offset; is->is_target_offset = offset; is->is_vdev = vd; + list_create(&is->is_unique_child, sizeof (indirect_child_t), + offsetof(indirect_child_t, ic_node)); /* * Note that we only consider multiple copies of the data for @@ -1191,6 +1216,7 @@ vdev_indirect_gather_splits(uint64_t split_offset, vde if (vd->vdev_ops == &vdev_mirror_ops) { for (int i = 0; i < n; i++) { is->is_child[i].ic_vdev = vd->vdev_child[i]; + list_link_init(&is->is_child[i].ic_node); } } else { is->is_child[0].ic_vdev = vd; @@ -1243,6 +1269,7 @@ vdev_indirect_read_all(zio_t *zio) ic->ic_data = abd_alloc_sametype(zio->io_abd, is->is_size); + ic->ic_duplicate = NULL; zio_nowait(zio_vdev_child_io(zio, NULL, ic->ic_vdev, is->is_target_offset, ic->ic_data, @@ -1364,7 +1391,7 @@ vdev_indirect_checksum_error(zio_t *zio, zio_bad_cksum_t zbc = { 0 }; void *bad_buf = abd_borrow_buf_copy(ic->ic_data, is->is_size); - abd_t *good_abd = is->is_child[is->is_good_child].ic_data; + abd_t *good_abd = is->is_good_child->ic_data; void *good_buf = abd_borrow_buf_copy(good_abd, is->is_size); zfs_ereport_post_checksum(zio->io_spa, vd, zio, is->is_target_offset, is->is_size, good_buf, bad_buf, &zbc); @@ -1397,21 +1424,18 @@ vdev_indirect_repair(zio_t *zio) for (indirect_split_t *is = list_head(&iv->iv_splits); is != NULL; is = list_next(&iv->iv_splits, is)) { - indirect_child_t *good_child = &is->is_child[is->is_good_child]; - for (int c = 0; c < is->is_children; c++) { indirect_child_t *ic = &is->is_child[c]; - if (ic == good_child) + if (ic == is->is_good_child) continue; if (ic->ic_data == NULL) continue; - if (abd_cmp(good_child->ic_data, ic->ic_data, - is->is_size) == 0) + if (ic->ic_duplicate == is->is_good_child) continue; zio_nowait(zio_vdev_child_io(zio, NULL, ic->ic_vdev, is->is_target_offset, - good_child->ic_data, is->is_size, + is->is_good_child->ic_data, is->is_size, ZIO_TYPE_WRITE, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_IO_REPAIR | ZIO_FLAG_SELF_HEAL, NULL, NULL)); @@ -1454,21 +1478,194 @@ vdev_indirect_all_checksum_errors(zio_t *zio) } /* + * Copy data from all the splits to a main zio then validate the checksum. + * If then checksum is successfully validated return success. + */ +static int +vdev_indirect_splits_checksum_validate(indirect_vsd_t *iv, zio_t *zio) +{ + zio_bad_cksum_t zbc; + + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + + ASSERT3P(is->is_good_child->ic_data, !=, NULL); + ASSERT3P(is->is_good_child->ic_duplicate, ==, NULL); + + abd_copy_off(zio->io_abd, is->is_good_child->ic_data, + is->is_split_offset, 0, is->is_size); + } + + return (zio_checksum_error(zio, &zbc)); +} + +/* + * There are relatively few possible combinations making it feasible to + * deterministically check them all. We do this by setting the good_child + * to the next unique split version. If we reach the end of the list then + * "carry over" to the next unique split version (like counting in base + * is_unique_children, but each digit can have a different base). + */ +static int +vdev_indirect_splits_enumerate_all(indirect_vsd_t *iv, zio_t *zio) +{ + boolean_t more = B_TRUE; + + iv->iv_attempts = 0; + + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) + is->is_good_child = list_head(&is->is_unique_child); + + while (more == B_TRUE) { + iv->iv_attempts++; + more = B_FALSE; + + if (vdev_indirect_splits_checksum_validate(iv, zio) == 0) + return (0); + + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + is->is_good_child = list_next(&is->is_unique_child, + is->is_good_child); + if (is->is_good_child != NULL) { + more = B_TRUE; + break; + } + + is->is_good_child = list_head(&is->is_unique_child); + } + } + + ASSERT3S(iv->iv_attempts, <=, iv->iv_unique_combinations); + + return (SET_ERROR(ECKSUM)); +} + +/* + * There are too many combinations to try all of them in a reasonable amount + * of time. So try a fixed number of random combinations from the unique + * split versions, after which we'll consider the block unrecoverable. + */ +static int +vdev_indirect_splits_enumerate_randomly(indirect_vsd_t *iv, zio_t *zio) +{ + iv->iv_attempts = 0; + + while (iv->iv_attempts < iv->iv_attempts_max) { + iv->iv_attempts++; + + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + indirect_child_t *ic = list_head(&is->is_unique_child); + int children = is->is_unique_children; + + for (int i = spa_get_random(children); i > 0; i--) + ic = list_next(&is->is_unique_child, ic); + + ASSERT3P(ic, !=, NULL); + is->is_good_child = ic; + } + + if (vdev_indirect_splits_checksum_validate(iv, zio) == 0) + return (0); + } + + return (SET_ERROR(ECKSUM)); +} + +/* + * This is a validation function for reconstruction. It randomly selects + * a good combination, if one can be found, and then it intentionally + * damages all other segment copes by zeroing them. This forces the + * reconstruction algorithm to locate the one remaining known good copy. + */ +static int +vdev_indirect_splits_damage(indirect_vsd_t *iv, zio_t *zio) +{ + /* Presume all the copies are unique for initial selection. */ + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + is->is_unique_children = 0; + + for (int i = 0; i < is->is_children; i++) { + indirect_child_t *ic = &is->is_child[i]; + if (ic->ic_data != NULL) { + is->is_unique_children++; + list_insert_tail(&is->is_unique_child, ic); + } + } + } + + /* + * Set each is_good_child to a randomly-selected child which + * is known to contain validated data. + */ + int error = vdev_indirect_splits_enumerate_randomly(iv, zio); + if (error) + goto out; + + /* + * Damage all but the known good copy by zeroing it. This will + * result in two or less unique copies per indirect_child_t. + * Both may need to be checked in order to reconstruct the block. + * Set iv->iv_attempts_max such that all unique combinations will + * enumerated, but limit the damage to at most 16 indirect splits. + */ + iv->iv_attempts_max = 1; + + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + for (int c = 0; c < is->is_children; c++) { + indirect_child_t *ic = &is->is_child[c]; + + if (ic == is->is_good_child) + continue; + if (ic->ic_data == NULL) + continue; + + abd_zero(ic->ic_data, ic->ic_data->abd_size); + } + + iv->iv_attempts_max *= 2; + if (iv->iv_attempts_max > (1ULL << 16)) { + iv->iv_attempts_max = UINT64_MAX; + break; + } + } + +out: + /* Empty the unique children lists so they can be reconstructed. */ + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + indirect_child_t *ic; + while ((ic = list_head(&is->is_unique_child)) != NULL) + list_remove(&is->is_unique_child, ic); + + is->is_unique_children = 0; + } + + return (error); +} + +/* * This function is called when we have read all copies of the data and need * to try to find a combination of copies that gives us the right checksum. * * If we pointed to any mirror vdevs, this effectively does the job of the * mirror. The mirror vdev code can't do its own job because we don't know - * the checksum of each split segment individually. We have to try every - * combination of copies of split segments, until we find one that checksums - * correctly. (Or until we have tried all combinations, or have tried - * 2^zfs_reconstruct_indirect_segments_max combinations. In these cases we - * set io_error to ECKSUM to propagate the error up to the user.) + * the checksum of each split segment individually. * - * For example, if we have 3 segments in the split, - * and each points to a 2-way mirror, we will have the following pieces of - * data: + * We have to try every unique combination of copies of split segments, until + * we find one that checksums correctly. Duplicate segment copies are first + * identified and latter skipped during reconstruction. This optimization + * reduces the search space and ensures that of the remaining combinations + * at most one is correct. * + * When the total number of combinations is small they can all be checked. + * For example, if we have 3 segments in the split, and each points to a + * 2-way mirror with unique copies, we will have the following pieces of data: + * * | mirror child * split | [0] [1] * ======|===================== @@ -1494,10 +1691,10 @@ vdev_indirect_all_checksum_errors(zio_t *zio) * data_A_1 data_B_1 data_C_1 * * Note that the split segments may be on the same or different top-level - * vdevs. In either case, we try lots of combinations (see - * zfs_reconstruct_indirect_segments_max). This ensures that if a mirror has - * small silent errors on all of its children, we can still reconstruct the - * correct data, as long as those errors are at sufficiently-separated + * vdevs. In either case, we may need to try lots of combinations (see + * zfs_reconstruct_indirect_combinations_max). This ensures that if a mirror + * has small silent errors on all of its children, we can still reconstruct + * the correct data, as long as those errors are at sufficiently-separated * offsets (specifically, separated by the largest block size - default of * 128KB, but up to 16MB). */ @@ -1505,90 +1702,91 @@ static void vdev_indirect_reconstruct_io_done(zio_t *zio) { indirect_vsd_t *iv = zio->io_vsd; - uint64_t attempts = 0; - uint64_t attempts_max = 1ULL << zfs_reconstruct_indirect_segments_max; - int segments = 0; + boolean_t known_good = B_FALSE; + int error; + iv->iv_unique_combinations = 1; + iv->iv_attempts_max = UINT64_MAX; + + if (zfs_reconstruct_indirect_combinations_max > 0) + iv->iv_attempts_max = zfs_reconstruct_indirect_combinations_max; + + /* + * If nonzero, every 1/x blocks will be damaged, in order to validate + * reconstruction when there are split segments with damaged copies. + * Known_good will TRUE when reconstruction is known to be possible. + */ + if (zfs_reconstruct_indirect_damage_fraction != 0 && + spa_get_random(zfs_reconstruct_indirect_damage_fraction) == 0) + known_good = (vdev_indirect_splits_damage(iv, zio) == 0); + + /* + * Determine the unique children for a split segment and add them + * to the is_unique_child list. By restricting reconstruction + * to these children, only unique combinations will be considered. + * This can vastly reduce the search space when there are a large + * number of indirect splits. + */ for (indirect_split_t *is = list_head(&iv->iv_splits); - is != NULL; is = list_next(&iv->iv_splits, is)) - segments++; + is != NULL; is = list_next(&iv->iv_splits, is)) { + is->is_unique_children = 0; - for (;;) { - /* copy data from splits to main zio */ - int ret; - for (indirect_split_t *is = list_head(&iv->iv_splits); - is != NULL; is = list_next(&iv->iv_splits, is)) { + for (int i = 0; i < is->is_children; i++) { + indirect_child_t *ic_i = &is->is_child[i]; - /* - * If this child failed, its ic_data will be NULL. - * Skip this combination. - */ - if (is->is_child[is->is_good_child].ic_data == NULL) { - ret = EIO; - goto next; - } + if (ic_i->ic_data == NULL || + ic_i->ic_duplicate != NULL) + continue; - abd_copy_off(zio->io_abd, - is->is_child[is->is_good_child].ic_data, - is->is_split_offset, 0, is->is_size); - } + for (int j = i + 1; j < is->is_children; j++) { + indirect_child_t *ic_j = &is->is_child[j]; - /* See if this checksum matches. */ - zio_bad_cksum_t zbc; - ret = zio_checksum_error(zio, &zbc); - if (ret == 0) { - /* Found a matching checksum. Issue repair i/os. */ - vdev_indirect_repair(zio); - zio_checksum_verified(zio); - return; - } + if (ic_j->ic_data == NULL || + ic_j->ic_duplicate != NULL) + continue; - /* - * Checksum failed; try a different combination of split - * children. - */ - boolean_t more; -next: - more = B_FALSE; - if (segments <= zfs_reconstruct_indirect_segments_max) { - /* - * There are relatively few segments, so - * deterministically check all combinations. We do - * this by by adding one to the first split's - * good_child. If it overflows, then "carry over" to - * the next split (like counting in base is_children, - * but each digit can have a different base). - */ - for (indirect_split_t *is = list_head(&iv->iv_splits); - is != NULL; is = list_next(&iv->iv_splits, is)) { - is->is_good_child++; - if (is->is_good_child < is->is_children) { - more = B_TRUE; - break; + if (abd_cmp(ic_i->ic_data, ic_j->ic_data, + is->is_size) == 0) { + ic_j->ic_duplicate = ic_i; } - is->is_good_child = 0; } - } else if (++attempts < attempts_max) { - /* - * There are too many combinations to try all of them - * in a reasonable amount of time, so try a fixed - * number of random combinations, after which we'll - * consider the block unrecoverable. - */ - for (indirect_split_t *is = list_head(&iv->iv_splits); - is != NULL; is = list_next(&iv->iv_splits, is)) { - is->is_good_child = - spa_get_random(is->is_children); - } - more = B_TRUE; + + is->is_unique_children++; + list_insert_tail(&is->is_unique_child, ic_i); } - if (!more) { - /* All combinations failed. */ - zio->io_error = ret; + + /* Reconstruction is impossible, no valid children */ + EQUIV(list_is_empty(&is->is_unique_child), + is->is_unique_children == 0); + if (list_is_empty(&is->is_unique_child)) { + zio->io_error = EIO; vdev_indirect_all_checksum_errors(zio); zio_checksum_verified(zio); return; } + + iv->iv_unique_combinations *= is->is_unique_children; + } + + if (iv->iv_unique_combinations <= iv->iv_attempts_max) + error = vdev_indirect_splits_enumerate_all(iv, zio); + else + error = vdev_indirect_splits_enumerate_randomly(iv, zio); + + if (error != 0) { + /* All attempted combinations failed. */ + ASSERT3B(known_good, ==, B_FALSE); + zio->io_error = error; + vdev_indirect_all_checksum_errors(zio); + } else { + /* + * The checksum has been successfully validated. Issue + * repair I/Os to any copies of splits which don't match + * the validated version. + */ + ASSERT0(vdev_indirect_splits_checksum_validate(iv, zio)); + vdev_indirect_repair(zio); + zio_checksum_verified(zio); } } From owner-svn-src-all@freebsd.org Wed Oct 16 06:44:40 2019 Return-Path: Delivered-To: svn-src-all@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 06DFF15CFF9; Wed, 16 Oct 2019 06:44:40 +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 46tN7r0392z4KSQ; Wed, 16 Oct 2019 06:44:40 +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 C03D52FB2; Wed, 16 Oct 2019 06:44:39 +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 x9G6idw1089200; Wed, 16 Oct 2019 06:44:39 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G6icC4089192; Wed, 16 Oct 2019 06:44:38 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160644.x9G6icC4089192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 06:44:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353617 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 353617 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 06:44:40 -0000 Author: avg Date: Wed Oct 16 06:44:37 2019 New Revision: 353617 URL: https://svnweb.freebsd.org/changeset/base/353617 Log: 9425 allow channel programs to be stopped via signals illumos/illumos-gate@d0cb1fb92629bc0283c88d4719df7285c1612700 https://github.com/illumos/illumos-gate/commit/d0cb1fb92629bc0283c88d4719df7285c1612700 https://www.illumos.org/issues/9425 Problem Statement ZFS Channel program scripts currently require a timeout, so that hung or long- running scripts return a timeout error instead of causing ZFS to get wedged. This limit can currently be set up to 100 million Lua instructions. Even with a limit in place, it would be desirable to have a sys admin (support engineer) be able to cancel a script that is taking a long time. Proposed Solution Make it possible to abort a channel program by sending an interrupt signal.In the underlying txg_wait_sync function, switch the cv_wait to a cv_wait_sig to catch the signal. Once a signal is encountered, the dsl_sync_task function can install a Lua hook that will get called before the Lua interpreter executes a new line of code. The dsl_sync_task can resume with a standard txg_wait_sync call and wait for the txg to complete. Meanwhile, the hook will abort the script and indicate that the channel program was canceled. The kernel returns a EINTR to indicate that the channel program run was canceled. Author: Don Brady Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_synctask.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_synctask.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/txg.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp.h vendor-sys/illumos/dist/uts/common/fs/zfs/txg.c vendor-sys/illumos/dist/uts/common/fs/zfs/zcp.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_synctask.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_synctask.c Wed Oct 16 06:43:22 2019 (r353616) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_synctask.c Wed Oct 16 06:44:37 2019 (r353617) @@ -41,7 +41,7 @@ dsl_null_checkfunc(void *arg, dmu_tx_t *tx) static int dsl_sync_task_common(const char *pool, dsl_checkfunc_t *checkfunc, - dsl_syncfunc_t *syncfunc, void *arg, + dsl_syncfunc_t *syncfunc, dsl_sigfunc_t *sigfunc, void *arg, int blocks_modified, zfs_space_check_t space_check, boolean_t early) { spa_t *spa; @@ -85,6 +85,11 @@ top: dmu_tx_commit(tx); + if (sigfunc != NULL && txg_wait_synced_sig(dp, dst.dst_txg)) { + /* current contract is to call func once */ + sigfunc(arg, tx); + sigfunc = NULL; /* in case of an EAGAIN retry */ + } txg_wait_synced(dp, dst.dst_txg); if (dst.dst_error == EAGAIN) { @@ -124,7 +129,7 @@ dsl_sync_task(const char *pool, dsl_checkfunc_t *check dsl_syncfunc_t *syncfunc, void *arg, int blocks_modified, zfs_space_check_t space_check) { - return (dsl_sync_task_common(pool, checkfunc, syncfunc, arg, + return (dsl_sync_task_common(pool, checkfunc, syncfunc, NULL, arg, blocks_modified, space_check, B_FALSE)); } @@ -146,8 +151,21 @@ dsl_early_sync_task(const char *pool, dsl_checkfunc_t dsl_syncfunc_t *syncfunc, void *arg, int blocks_modified, zfs_space_check_t space_check) { - return (dsl_sync_task_common(pool, checkfunc, syncfunc, arg, + return (dsl_sync_task_common(pool, checkfunc, syncfunc, NULL, arg, blocks_modified, space_check, B_TRUE)); +} + +/* + * A standard synctask that can be interrupted from a signal. The sigfunc + * is called once if a signal occurred while waiting for the task to sync. + */ +int +dsl_sync_task_sig(const char *pool, dsl_checkfunc_t *checkfunc, + dsl_syncfunc_t *syncfunc, dsl_sigfunc_t *sigfunc, void *arg, + int blocks_modified, zfs_space_check_t space_check) +{ + return (dsl_sync_task_common(pool, checkfunc, syncfunc, sigfunc, arg, + blocks_modified, space_check, B_FALSE)); } static void Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_synctask.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_synctask.h Wed Oct 16 06:43:22 2019 (r353616) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_synctask.h Wed Oct 16 06:44:37 2019 (r353617) @@ -37,6 +37,7 @@ struct dsl_pool; typedef int (dsl_checkfunc_t)(void *, dmu_tx_t *); typedef void (dsl_syncfunc_t)(void *, dmu_tx_t *); +typedef void (dsl_sigfunc_t)(void *, dmu_tx_t *); typedef enum zfs_space_check { /* @@ -116,6 +117,8 @@ int dsl_early_sync_task(const char *, dsl_checkfunc_t dsl_syncfunc_t *, void *, int, zfs_space_check_t); void dsl_early_sync_task_nowait(struct dsl_pool *, dsl_syncfunc_t *, void *, int, zfs_space_check_t, dmu_tx_t *); +int dsl_sync_task_sig(const char *, dsl_checkfunc_t *, dsl_syncfunc_t *, + dsl_sigfunc_t *, void *, int, zfs_space_check_t); #ifdef __cplusplus } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/txg.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/txg.h Wed Oct 16 06:43:22 2019 (r353616) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/txg.h Wed Oct 16 06:44:37 2019 (r353617) @@ -88,6 +88,11 @@ extern void txg_kick(struct dsl_pool *dp); extern void txg_wait_synced(struct dsl_pool *dp, uint64_t txg); /* + * Wait as above. Returns true if the thread was signaled while waiting. + */ +extern boolean_t txg_wait_synced_sig(struct dsl_pool *dp, uint64_t txg); + +/* * Wait until the given transaction group, or one after it, is * the open transaction group. Try to make this happen as soon * as possible (eg. kick off any necessary syncs immediately). Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp.h Wed Oct 16 06:43:22 2019 (r353616) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp.h Wed Oct 16 06:44:37 2019 (r353617) @@ -52,6 +52,12 @@ typedef struct zcp_cleanup_handler { list_node_t zch_node; } zcp_cleanup_handler_t; +typedef struct zcp_alloc_arg { + boolean_t aa_must_succeed; + int64_t aa_alloc_remaining; + int64_t aa_alloc_limit; +} zcp_alloc_arg_t; + typedef struct zcp_run_info { dsl_pool_t *zri_pool; @@ -94,6 +100,11 @@ typedef struct zcp_run_info { boolean_t zri_timed_out; /* + * Channel program was canceled by user + */ + boolean_t zri_canceled; + + /* * Boolean indicating whether or not we are running in syncing * context. */ @@ -104,6 +115,26 @@ typedef struct zcp_run_info { * triggered in the event of a fatal error. */ list_t zri_cleanup_handlers; + + /* + * The Lua state context of our channel program. + */ + lua_State *zri_state; + + /* + * Lua memory allocator arguments. + */ + zcp_alloc_arg_t *zri_allocargs; + + /* + * Contains output values from zcp script or error string. + */ + nvlist_t *zri_outnvl; + + /* + * The errno number returned to caller of zcp_eval(). + */ + int zri_result; } zcp_run_info_t; zcp_run_info_t *zcp_run_info(lua_State *); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/txg.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/txg.c Wed Oct 16 06:43:22 2019 (r353616) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/txg.c Wed Oct 16 06:44:37 2019 (r353617) @@ -632,8 +632,8 @@ txg_delay(dsl_pool_t *dp, uint64_t txg, hrtime_t delay mutex_exit(&tx->tx_sync_lock); } -void -txg_wait_synced(dsl_pool_t *dp, uint64_t txg) +static boolean_t +txg_wait_synced_impl(dsl_pool_t *dp, uint64_t txg, boolean_t wait_sig) { tx_state_t *tx = &dp->dp_tx; @@ -652,9 +652,39 @@ txg_wait_synced(dsl_pool_t *dp, uint64_t txg) "tx_synced=%llu waiting=%llu dp=%p\n", tx->tx_synced_txg, tx->tx_sync_txg_waiting, dp); cv_broadcast(&tx->tx_sync_more_cv); - cv_wait(&tx->tx_sync_done_cv, &tx->tx_sync_lock); + if (wait_sig) { + /* + * Condition wait here but stop if the thread receives a + * signal. The caller may call txg_wait_synced*() again + * to resume waiting for this txg. + */ + if (cv_wait_sig(&tx->tx_sync_done_cv, + &tx->tx_sync_lock) == 0) { + mutex_exit(&tx->tx_sync_lock); + return (B_TRUE); + } + } else { + cv_wait(&tx->tx_sync_done_cv, &tx->tx_sync_lock); + } } mutex_exit(&tx->tx_sync_lock); + return (B_FALSE); +} + +void +txg_wait_synced(dsl_pool_t *dp, uint64_t txg) +{ + VERIFY0(txg_wait_synced_impl(dp, txg, B_FALSE)); +} + +/* + * Similar to a txg_wait_synced but it can be interrupted from a signal. + * Returns B_TRUE if the thread was signaled while waiting. + */ +boolean_t +txg_wait_synced_sig(dsl_pool_t *dp, uint64_t txg) +{ + return (txg_wait_synced_impl(dp, txg, B_TRUE)); } void Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zcp.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zcp.c Wed Oct 16 06:43:22 2019 (r353616) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zcp.c Wed Oct 16 06:44:37 2019 (r353617) @@ -115,21 +115,6 @@ static int zcp_nvpair_value_to_lua(lua_State *, nvpair static int zcp_lua_to_nvlist_impl(lua_State *, int, nvlist_t *, const char *, int); -typedef struct zcp_alloc_arg { - boolean_t aa_must_succeed; - int64_t aa_alloc_remaining; - int64_t aa_alloc_limit; -} zcp_alloc_arg_t; - -typedef struct zcp_eval_arg { - lua_State *ea_state; - zcp_alloc_arg_t *ea_allocargs; - cred_t *ea_cred; - nvlist_t *ea_outnvl; - int ea_result; - uint64_t ea_instrlimit; -} zcp_eval_arg_t; - /* * The outer-most error callback handler for use with lua_pcall(). On * error Lua will call this callback with a single argument that @@ -449,7 +434,7 @@ zcp_lua_to_nvlist_helper(lua_State *state) static void zcp_convert_return_values(lua_State *state, nvlist_t *nvl, - const char *key, zcp_eval_arg_t *evalargs) + const char *key, int *result) { int err; VERIFY3U(1, ==, lua_gettop(state)); @@ -461,7 +446,7 @@ zcp_convert_return_values(lua_State *state, nvlist_t * err = lua_pcall(state, 3, 0, 0); /* zcp_lua_to_nvlist_helper */ if (err != 0) { zcp_lua_to_nvlist(state, 1, nvl, ZCP_RET_ERROR); - evalargs->ea_result = SET_ERROR(ECHRNG); + *result = SET_ERROR(ECHRNG); } } @@ -788,13 +773,24 @@ zcp_lua_alloc(void *ud, void *ptr, size_t osize, size_ static void zcp_lua_counthook(lua_State *state, lua_Debug *ar) { - /* - * If we're called, check how many instructions the channel program has - * executed so far, and compare against the limit. - */ lua_getfield(state, LUA_REGISTRYINDEX, ZCP_RUN_INFO_KEY); zcp_run_info_t *ri = lua_touserdata(state, -1); + /* + * Check if we were canceled while waiting for the + * txg to sync or from our open context thread + */ + if (ri->zri_canceled || + (!ri->zri_sync && issig(JUSTLOOKING) && issig(FORREAL))) { + ri->zri_canceled = B_TRUE; + (void) lua_pushstring(state, "Channel program was canceled."); + (void) lua_error(state); + } + + /* + * Check how many instructions the channel program has + * executed so far, and compare against the limit. + */ ri->zri_curinstrs += zfs_lua_check_instrlimit_interval; if (ri->zri_maxinstrs != 0 && ri->zri_curinstrs > ri->zri_maxinstrs) { ri->zri_timed_out = B_TRUE; @@ -813,31 +809,25 @@ zcp_panic_cb(lua_State *state) } static void -zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_arg_t *evalargs) +zcp_eval_impl(dmu_tx_t *tx, zcp_run_info_t *ri) { int err; - zcp_run_info_t ri; - lua_State *state = evalargs->ea_state; + lua_State *state = ri->zri_state; VERIFY3U(3, ==, lua_gettop(state)); + /* finish initializing our runtime state */ + ri->zri_pool = dmu_tx_pool(tx); + ri->zri_tx = tx; + list_create(&ri->zri_cleanup_handlers, sizeof (zcp_cleanup_handler_t), + offsetof(zcp_cleanup_handler_t, zch_node)); + /* * Store the zcp_run_info_t struct for this run in the Lua registry. * Registry entries are not directly accessible by the Lua scripts but * can be accessed by our callbacks. */ - ri.zri_space_used = 0; - ri.zri_pool = dmu_tx_pool(tx); - ri.zri_cred = evalargs->ea_cred; - ri.zri_tx = tx; - ri.zri_timed_out = B_FALSE; - ri.zri_sync = sync; - list_create(&ri.zri_cleanup_handlers, sizeof (zcp_cleanup_handler_t), - offsetof(zcp_cleanup_handler_t, zch_node)); - ri.zri_curinstrs = 0; - ri.zri_maxinstrs = evalargs->ea_instrlimit; - - lua_pushlightuserdata(state, &ri); + lua_pushlightuserdata(state, ri); lua_setfield(state, LUA_REGISTRYINDEX, ZCP_RUN_INFO_KEY); VERIFY3U(3, ==, lua_gettop(state)); @@ -854,7 +844,7 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a * off control to the channel program. Channel programs that use too * much memory should die with ENOSPC. */ - evalargs->ea_allocargs->aa_must_succeed = B_FALSE; + ri->zri_allocargs->aa_must_succeed = B_FALSE; /* * Call the Lua function that open-context passed us. This pops the @@ -866,14 +856,14 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a /* * Let Lua use KM_SLEEP while we interpret the return values. */ - evalargs->ea_allocargs->aa_must_succeed = B_TRUE; + ri->zri_allocargs->aa_must_succeed = B_TRUE; /* * Remove the error handler callback from the stack. At this point, * there shouldn't be any cleanup handler registered in the handler * list (zri_cleanup_handlers), regardless of whether it ran or not. */ - list_destroy(&ri.zri_cleanup_handlers); + list_destroy(&ri->zri_cleanup_handlers); lua_remove(state, 1); switch (err) { @@ -893,16 +883,16 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a int return_count = lua_gettop(state); if (return_count == 1) { - evalargs->ea_result = 0; - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_RETURN, evalargs); + ri->zri_result = 0; + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_RETURN, &ri->zri_result); } else if (return_count > 1) { - evalargs->ea_result = SET_ERROR(ECHRNG); + ri->zri_result = SET_ERROR(ECHRNG); lua_settop(state, 0); (void) lua_pushfstring(state, "Multiple return " "values not supported"); - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); } break; } @@ -916,14 +906,16 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a * stack. */ VERIFY3U(1, ==, lua_gettop(state)); - if (ri.zri_timed_out) { - evalargs->ea_result = SET_ERROR(ETIME); + if (ri->zri_timed_out) { + ri->zri_result = SET_ERROR(ETIME); + } else if (ri->zri_canceled) { + ri->zri_result = SET_ERROR(EINTR); } else { - evalargs->ea_result = SET_ERROR(ECHRNG); + ri->zri_result = SET_ERROR(ECHRNG); } - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); break; } case LUA_ERRERR: { @@ -934,14 +926,16 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a * return the error message. */ VERIFY3U(1, ==, lua_gettop(state)); - if (ri.zri_timed_out) { - evalargs->ea_result = SET_ERROR(ETIME); + if (ri->zri_timed_out) { + ri->zri_result = SET_ERROR(ETIME); + } else if (ri->zri_canceled) { + ri->zri_result = SET_ERROR(EINTR); } else { - evalargs->ea_result = SET_ERROR(ECHRNG); + ri->zri_result = SET_ERROR(ECHRNG); } - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); break; } case LUA_ERRMEM: @@ -949,7 +943,7 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a * Lua ran out of memory while running the channel program. * There's not much we can do. */ - evalargs->ea_result = SET_ERROR(ENOSPC); + ri->zri_result = SET_ERROR(ENOSPC); break; default: VERIFY0(err); @@ -957,21 +951,35 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a } static void -zcp_pool_error(zcp_eval_arg_t *evalargs, const char *poolname) +zcp_pool_error(zcp_run_info_t *ri, const char *poolname) { - evalargs->ea_result = SET_ERROR(ECHRNG); - lua_settop(evalargs->ea_state, 0); - (void) lua_pushfstring(evalargs->ea_state, "Could not open pool: %s", + ri->zri_result = SET_ERROR(ECHRNG); + lua_settop(ri->zri_state, 0); + (void) lua_pushfstring(ri->zri_state, "Could not open pool: %s", poolname); - zcp_convert_return_values(evalargs->ea_state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(ri->zri_state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); } +/* + * This callback is called when txg_wait_synced_sig encountered a signal. + * The txg_wait_synced_sig will continue to wait for the txg to complete + * after calling this callback. + */ +/* ARGSUSED */ static void +zcp_eval_sig(void *arg, dmu_tx_t *tx) +{ + zcp_run_info_t *ri = arg; + + ri->zri_canceled = B_TRUE; +} + +static void zcp_eval_sync(void *arg, dmu_tx_t *tx) { - zcp_eval_arg_t *evalargs = arg; + zcp_run_info_t *ri = arg; /* * Open context should have setup the stack to contain: @@ -979,15 +987,14 @@ zcp_eval_sync(void *arg, dmu_tx_t *tx) * 2: Script to run (converted to a Lua function) * 3: nvlist input to function (converted to Lua table or nil) */ - VERIFY3U(3, ==, lua_gettop(evalargs->ea_state)); + VERIFY3U(3, ==, lua_gettop(ri->zri_state)); - zcp_eval_impl(tx, B_TRUE, evalargs); + zcp_eval_impl(tx, ri); } static void -zcp_eval_open(zcp_eval_arg_t *evalargs, const char *poolname) +zcp_eval_open(zcp_run_info_t *ri, const char *poolname) { - int error; dsl_pool_t *dp; dmu_tx_t *tx; @@ -995,11 +1002,11 @@ zcp_eval_open(zcp_eval_arg_t *evalargs, const char *po /* * See comment from the same assertion in zcp_eval_sync(). */ - VERIFY3U(3, ==, lua_gettop(evalargs->ea_state)); + VERIFY3U(3, ==, lua_gettop(ri->zri_state)); error = dsl_pool_hold(poolname, FTAG, &dp); if (error != 0) { - zcp_pool_error(evalargs, poolname); + zcp_pool_error(ri, poolname); return; } @@ -1014,7 +1021,7 @@ zcp_eval_open(zcp_eval_arg_t *evalargs, const char *po */ tx = dmu_tx_create_dd(dp->dp_mos_dir); - zcp_eval_impl(tx, B_FALSE, evalargs); + zcp_eval_impl(tx, ri); dmu_tx_abort(tx); @@ -1027,7 +1034,7 @@ zcp_eval(const char *poolname, const char *program, bo { int err; lua_State *state; - zcp_eval_arg_t evalargs; + zcp_run_info_t runinfo; if (instrlimit > zfs_lua_max_instrlimit) return (SET_ERROR(EINVAL)); @@ -1127,24 +1134,29 @@ zcp_eval(const char *poolname, const char *program, bo } VERIFY3U(3, ==, lua_gettop(state)); - evalargs.ea_state = state; - evalargs.ea_allocargs = &allocargs; - evalargs.ea_instrlimit = instrlimit; - evalargs.ea_cred = CRED(); - evalargs.ea_outnvl = outnvl; - evalargs.ea_result = 0; + runinfo.zri_state = state; + runinfo.zri_allocargs = &allocargs; + runinfo.zri_outnvl = outnvl; + runinfo.zri_result = 0; + runinfo.zri_cred = CRED(); + runinfo.zri_timed_out = B_FALSE; + runinfo.zri_canceled = B_FALSE; + runinfo.zri_sync = sync; + runinfo.zri_space_used = 0; + runinfo.zri_curinstrs = 0; + runinfo.zri_maxinstrs = instrlimit; if (sync) { - err = dsl_sync_task(poolname, NULL, - zcp_eval_sync, &evalargs, 0, ZFS_SPACE_CHECK_ZCP_EVAL); + err = dsl_sync_task_sig(poolname, NULL, zcp_eval_sync, + zcp_eval_sig, &runinfo, 0, ZFS_SPACE_CHECK_ZCP_EVAL); if (err != 0) - zcp_pool_error(&evalargs, poolname); + zcp_pool_error(&runinfo, poolname); } else { - zcp_eval_open(&evalargs, poolname); + zcp_eval_open(&runinfo, poolname); } lua_close(state); - return (evalargs.ea_result); + return (runinfo.zri_result); } /* Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Wed Oct 16 06:43:22 2019 (r353616) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Wed Oct 16 06:44:37 2019 (r353617) @@ -6347,7 +6347,7 @@ zfsdev_ioctl(dev_t dev, int cmd, intptr_t arg, int fla error = vec->zvec_func(zc->zc_name, innvl, outnvl); /* - * Some commands can partially execute, modfiy state, and still + * Some commands can partially execute, modify state, and still * return an error. In these cases, attempt to record what * was modified. */ From owner-svn-src-all@freebsd.org Wed Oct 16 07:00:20 2019 Return-Path: Delivered-To: svn-src-all@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 1BA1B15D266; Wed, 16 Oct 2019 07:00:20 +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 46tNTw0dmZz4KyB; Wed, 16 Oct 2019 07:00:20 +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 EE8403178; Wed, 16 Oct 2019 07:00:19 +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 x9G70Jda095218; Wed, 16 Oct 2019 07:00:19 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G70I3N095211; Wed, 16 Oct 2019 07:00:18 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160700.x9G70I3N095211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 07:00:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353618 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 353618 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 07:00:20 -0000 Author: avg Date: Wed Oct 16 07:00:18 2019 New Revision: 353618 URL: https://svnweb.freebsd.org/changeset/base/353618 Log: MFV r353617: 9425 allow channel programs to be stopped via signals illumos/illumos-gate@d0cb1fb92629bc0283c88d4719df7285c1612700 https://github.com/illumos/illumos-gate/commit/d0cb1fb92629bc0283c88d4719df7285c1612700 https://www.illumos.org/issues/9425 Problem Statement ZFS Channel program scripts currently require a timeout, so that hung or long-running scripts return a timeout error instead of causing ZFS to get wedged. This limit can currently be set up to 100 million Lua instructions. Even with a limit in place, it would be desirable to have a sys admin (support engineer) be able to cancel a script that is taking a long time. Proposed Solution Make it possible to abort a channel program by sending an interrupt signal.In the underlying txg_wait_sync function, switch the cv_wait to a cv_wait_sig to catch the signal. Once a signal is encountered, the dsl_sync_task function can install a Lua hook that will get called before the Lua interpreter executes a new line of code. The dsl_sync_task can resume with a standard txg_wait_sync call and wait for the txg to complete. Meanwhile, the hook will abort the script and indicate that the channel program was canceled. The kernel returns a EINTR to indicate that the channel program run was canceled. FreeBSD note: the return value of cv_wait_sig() has inverted meaning between us and illumos. Author: Don Brady Obtained from: illumos MFC after: 4 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c Wed Oct 16 06:44:37 2019 (r353617) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c Wed Oct 16 07:00:18 2019 (r353618) @@ -41,7 +41,7 @@ dsl_null_checkfunc(void *arg, dmu_tx_t *tx) static int dsl_sync_task_common(const char *pool, dsl_checkfunc_t *checkfunc, - dsl_syncfunc_t *syncfunc, void *arg, + dsl_syncfunc_t *syncfunc, dsl_sigfunc_t *sigfunc, void *arg, int blocks_modified, zfs_space_check_t space_check, boolean_t early) { spa_t *spa; @@ -85,6 +85,11 @@ top: dmu_tx_commit(tx); + if (sigfunc != NULL && txg_wait_synced_sig(dp, dst.dst_txg)) { + /* current contract is to call func once */ + sigfunc(arg, tx); + sigfunc = NULL; /* in case of an EAGAIN retry */ + } txg_wait_synced(dp, dst.dst_txg); if (dst.dst_error == EAGAIN) { @@ -124,7 +129,7 @@ dsl_sync_task(const char *pool, dsl_checkfunc_t *check dsl_syncfunc_t *syncfunc, void *arg, int blocks_modified, zfs_space_check_t space_check) { - return (dsl_sync_task_common(pool, checkfunc, syncfunc, arg, + return (dsl_sync_task_common(pool, checkfunc, syncfunc, NULL, arg, blocks_modified, space_check, B_FALSE)); } @@ -146,8 +151,21 @@ dsl_early_sync_task(const char *pool, dsl_checkfunc_t dsl_syncfunc_t *syncfunc, void *arg, int blocks_modified, zfs_space_check_t space_check) { - return (dsl_sync_task_common(pool, checkfunc, syncfunc, arg, + return (dsl_sync_task_common(pool, checkfunc, syncfunc, NULL, arg, blocks_modified, space_check, B_TRUE)); +} + +/* + * A standard synctask that can be interrupted from a signal. The sigfunc + * is called once if a signal occurred while waiting for the task to sync. + */ +int +dsl_sync_task_sig(const char *pool, dsl_checkfunc_t *checkfunc, + dsl_syncfunc_t *syncfunc, dsl_sigfunc_t *sigfunc, void *arg, + int blocks_modified, zfs_space_check_t space_check) +{ + return (dsl_sync_task_common(pool, checkfunc, syncfunc, sigfunc, arg, + blocks_modified, space_check, B_FALSE)); } static void Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h Wed Oct 16 06:44:37 2019 (r353617) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h Wed Oct 16 07:00:18 2019 (r353618) @@ -37,6 +37,7 @@ struct dsl_pool; typedef int (dsl_checkfunc_t)(void *, dmu_tx_t *); typedef void (dsl_syncfunc_t)(void *, dmu_tx_t *); +typedef void (dsl_sigfunc_t)(void *, dmu_tx_t *); typedef enum zfs_space_check { /* @@ -116,6 +117,8 @@ int dsl_early_sync_task(const char *, dsl_checkfunc_t dsl_syncfunc_t *, void *, int, zfs_space_check_t); void dsl_early_sync_task_nowait(struct dsl_pool *, dsl_syncfunc_t *, void *, int, zfs_space_check_t, dmu_tx_t *); +int dsl_sync_task_sig(const char *, dsl_checkfunc_t *, dsl_syncfunc_t *, + dsl_sigfunc_t *, void *, int, zfs_space_check_t); #ifdef __cplusplus } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h Wed Oct 16 06:44:37 2019 (r353617) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h Wed Oct 16 07:00:18 2019 (r353618) @@ -88,6 +88,11 @@ extern void txg_kick(struct dsl_pool *dp); extern void txg_wait_synced(struct dsl_pool *dp, uint64_t txg); /* + * Wait as above. Returns true if the thread was signaled while waiting. + */ +extern boolean_t txg_wait_synced_sig(struct dsl_pool *dp, uint64_t txg); + +/* * Wait until the given transaction group, or one after it, is * the open transaction group. Try to make this happen as soon * as possible (eg. kick off any necessary syncs immediately). Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h Wed Oct 16 06:44:37 2019 (r353617) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h Wed Oct 16 07:00:18 2019 (r353618) @@ -52,6 +52,12 @@ typedef struct zcp_cleanup_handler { list_node_t zch_node; } zcp_cleanup_handler_t; +typedef struct zcp_alloc_arg { + boolean_t aa_must_succeed; + int64_t aa_alloc_remaining; + int64_t aa_alloc_limit; +} zcp_alloc_arg_t; + typedef struct zcp_run_info { dsl_pool_t *zri_pool; @@ -94,6 +100,11 @@ typedef struct zcp_run_info { boolean_t zri_timed_out; /* + * Channel program was canceled by user + */ + boolean_t zri_canceled; + + /* * Boolean indicating whether or not we are running in syncing * context. */ @@ -104,6 +115,26 @@ typedef struct zcp_run_info { * triggered in the event of a fatal error. */ list_t zri_cleanup_handlers; + + /* + * The Lua state context of our channel program. + */ + lua_State *zri_state; + + /* + * Lua memory allocator arguments. + */ + zcp_alloc_arg_t *zri_allocargs; + + /* + * Contains output values from zcp script or error string. + */ + nvlist_t *zri_outnvl; + + /* + * The errno number returned to caller of zcp_eval(). + */ + int zri_result; } zcp_run_info_t; zcp_run_info_t *zcp_run_info(lua_State *); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Wed Oct 16 06:44:37 2019 (r353617) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Wed Oct 16 07:00:18 2019 (r353618) @@ -638,8 +638,8 @@ txg_delay(dsl_pool_t *dp, uint64_t txg, hrtime_t delay mutex_exit(&tx->tx_sync_lock); } -void -txg_wait_synced(dsl_pool_t *dp, uint64_t txg) +static boolean_t +txg_wait_synced_impl(dsl_pool_t *dp, uint64_t txg, boolean_t wait_sig) { tx_state_t *tx = &dp->dp_tx; @@ -658,9 +658,51 @@ txg_wait_synced(dsl_pool_t *dp, uint64_t txg) "tx_synced=%llu waiting=%llu dp=%p\n", tx->tx_synced_txg, tx->tx_sync_txg_waiting, dp); cv_broadcast(&tx->tx_sync_more_cv); - cv_wait(&tx->tx_sync_done_cv, &tx->tx_sync_lock); + if (wait_sig) { + /* + * Condition wait here but stop if the thread receives a + * signal. The caller may call txg_wait_synced*() again + * to resume waiting for this txg. + */ +#ifdef __FreeBSD__ + /* + * FreeBSD returns EINTR or ERESTART if there is + * a pending signal, zero if the conditional variable + * is signaled. illumos returns zero in the former case + * and >0 in the latter. + */ + if (cv_wait_sig(&tx->tx_sync_done_cv, + &tx->tx_sync_lock) != 0) { +#else + if (cv_wait_sig(&tx->tx_sync_done_cv, + &tx->tx_sync_lock) == 0) { +#endif + + mutex_exit(&tx->tx_sync_lock); + return (B_TRUE); + } + } else { + cv_wait(&tx->tx_sync_done_cv, &tx->tx_sync_lock); + } } mutex_exit(&tx->tx_sync_lock); + return (B_FALSE); +} + +void +txg_wait_synced(dsl_pool_t *dp, uint64_t txg) +{ + VERIFY0(txg_wait_synced_impl(dp, txg, B_FALSE)); +} + +/* + * Similar to a txg_wait_synced but it can be interrupted from a signal. + * Returns B_TRUE if the thread was signaled while waiting. + */ +boolean_t +txg_wait_synced_sig(dsl_pool_t *dp, uint64_t txg) +{ + return (txg_wait_synced_impl(dp, txg, B_TRUE)); } void Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c Wed Oct 16 06:44:37 2019 (r353617) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c Wed Oct 16 07:00:18 2019 (r353618) @@ -122,21 +122,6 @@ static int zcp_nvpair_value_to_lua(lua_State *, nvpair static int zcp_lua_to_nvlist_impl(lua_State *, int, nvlist_t *, const char *, int); -typedef struct zcp_alloc_arg { - boolean_t aa_must_succeed; - int64_t aa_alloc_remaining; - int64_t aa_alloc_limit; -} zcp_alloc_arg_t; - -typedef struct zcp_eval_arg { - lua_State *ea_state; - zcp_alloc_arg_t *ea_allocargs; - cred_t *ea_cred; - nvlist_t *ea_outnvl; - int ea_result; - uint64_t ea_instrlimit; -} zcp_eval_arg_t; - /* * The outer-most error callback handler for use with lua_pcall(). On * error Lua will call this callback with a single argument that @@ -456,7 +441,7 @@ zcp_lua_to_nvlist_helper(lua_State *state) static void zcp_convert_return_values(lua_State *state, nvlist_t *nvl, - const char *key, zcp_eval_arg_t *evalargs) + const char *key, int *result) { int err; VERIFY3U(1, ==, lua_gettop(state)); @@ -468,7 +453,7 @@ zcp_convert_return_values(lua_State *state, nvlist_t * err = lua_pcall(state, 3, 0, 0); /* zcp_lua_to_nvlist_helper */ if (err != 0) { zcp_lua_to_nvlist(state, 1, nvl, ZCP_RET_ERROR); - evalargs->ea_result = SET_ERROR(ECHRNG); + *result = SET_ERROR(ECHRNG); } } @@ -795,13 +780,24 @@ zcp_lua_alloc(void *ud, void *ptr, size_t osize, size_ static void zcp_lua_counthook(lua_State *state, lua_Debug *ar) { - /* - * If we're called, check how many instructions the channel program has - * executed so far, and compare against the limit. - */ lua_getfield(state, LUA_REGISTRYINDEX, ZCP_RUN_INFO_KEY); zcp_run_info_t *ri = lua_touserdata(state, -1); + /* + * Check if we were canceled while waiting for the + * txg to sync or from our open context thread + */ + if (ri->zri_canceled || + (!ri->zri_sync && issig(JUSTLOOKING) && issig(FORREAL))) { + ri->zri_canceled = B_TRUE; + (void) lua_pushstring(state, "Channel program was canceled."); + (void) lua_error(state); + } + + /* + * Check how many instructions the channel program has + * executed so far, and compare against the limit. + */ ri->zri_curinstrs += zfs_lua_check_instrlimit_interval; if (ri->zri_maxinstrs != 0 && ri->zri_curinstrs > ri->zri_maxinstrs) { ri->zri_timed_out = B_TRUE; @@ -820,31 +816,25 @@ zcp_panic_cb(lua_State *state) } static void -zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_arg_t *evalargs) +zcp_eval_impl(dmu_tx_t *tx, zcp_run_info_t *ri) { int err; - zcp_run_info_t ri; - lua_State *state = evalargs->ea_state; + lua_State *state = ri->zri_state; VERIFY3U(3, ==, lua_gettop(state)); + /* finish initializing our runtime state */ + ri->zri_pool = dmu_tx_pool(tx); + ri->zri_tx = tx; + list_create(&ri->zri_cleanup_handlers, sizeof (zcp_cleanup_handler_t), + offsetof(zcp_cleanup_handler_t, zch_node)); + /* * Store the zcp_run_info_t struct for this run in the Lua registry. * Registry entries are not directly accessible by the Lua scripts but * can be accessed by our callbacks. */ - ri.zri_space_used = 0; - ri.zri_pool = dmu_tx_pool(tx); - ri.zri_cred = evalargs->ea_cred; - ri.zri_tx = tx; - ri.zri_timed_out = B_FALSE; - ri.zri_sync = sync; - list_create(&ri.zri_cleanup_handlers, sizeof (zcp_cleanup_handler_t), - offsetof(zcp_cleanup_handler_t, zch_node)); - ri.zri_curinstrs = 0; - ri.zri_maxinstrs = evalargs->ea_instrlimit; - - lua_pushlightuserdata(state, &ri); + lua_pushlightuserdata(state, ri); lua_setfield(state, LUA_REGISTRYINDEX, ZCP_RUN_INFO_KEY); VERIFY3U(3, ==, lua_gettop(state)); @@ -861,7 +851,7 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a * off control to the channel program. Channel programs that use too * much memory should die with ENOSPC. */ - evalargs->ea_allocargs->aa_must_succeed = B_FALSE; + ri->zri_allocargs->aa_must_succeed = B_FALSE; /* * Call the Lua function that open-context passed us. This pops the @@ -873,14 +863,14 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a /* * Let Lua use KM_SLEEP while we interpret the return values. */ - evalargs->ea_allocargs->aa_must_succeed = B_TRUE; + ri->zri_allocargs->aa_must_succeed = B_TRUE; /* * Remove the error handler callback from the stack. At this point, * there shouldn't be any cleanup handler registered in the handler * list (zri_cleanup_handlers), regardless of whether it ran or not. */ - list_destroy(&ri.zri_cleanup_handlers); + list_destroy(&ri->zri_cleanup_handlers); lua_remove(state, 1); switch (err) { @@ -900,16 +890,16 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a int return_count = lua_gettop(state); if (return_count == 1) { - evalargs->ea_result = 0; - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_RETURN, evalargs); + ri->zri_result = 0; + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_RETURN, &ri->zri_result); } else if (return_count > 1) { - evalargs->ea_result = SET_ERROR(ECHRNG); + ri->zri_result = SET_ERROR(ECHRNG); lua_settop(state, 0); (void) lua_pushfstring(state, "Multiple return " "values not supported"); - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); } break; } @@ -923,14 +913,16 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a * stack. */ VERIFY3U(1, ==, lua_gettop(state)); - if (ri.zri_timed_out) { - evalargs->ea_result = SET_ERROR(ETIME); + if (ri->zri_timed_out) { + ri->zri_result = SET_ERROR(ETIME); + } else if (ri->zri_canceled) { + ri->zri_result = SET_ERROR(EINTR); } else { - evalargs->ea_result = SET_ERROR(ECHRNG); + ri->zri_result = SET_ERROR(ECHRNG); } - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); break; } case LUA_ERRERR: { @@ -941,14 +933,16 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a * return the error message. */ VERIFY3U(1, ==, lua_gettop(state)); - if (ri.zri_timed_out) { - evalargs->ea_result = SET_ERROR(ETIME); + if (ri->zri_timed_out) { + ri->zri_result = SET_ERROR(ETIME); + } else if (ri->zri_canceled) { + ri->zri_result = SET_ERROR(EINTR); } else { - evalargs->ea_result = SET_ERROR(ECHRNG); + ri->zri_result = SET_ERROR(ECHRNG); } - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); break; } case LUA_ERRMEM: @@ -956,7 +950,7 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a * Lua ran out of memory while running the channel program. * There's not much we can do. */ - evalargs->ea_result = SET_ERROR(ENOSPC); + ri->zri_result = SET_ERROR(ENOSPC); break; default: VERIFY0(err); @@ -964,21 +958,35 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a } static void -zcp_pool_error(zcp_eval_arg_t *evalargs, const char *poolname) +zcp_pool_error(zcp_run_info_t *ri, const char *poolname) { - evalargs->ea_result = SET_ERROR(ECHRNG); - lua_settop(evalargs->ea_state, 0); - (void) lua_pushfstring(evalargs->ea_state, "Could not open pool: %s", + ri->zri_result = SET_ERROR(ECHRNG); + lua_settop(ri->zri_state, 0); + (void) lua_pushfstring(ri->zri_state, "Could not open pool: %s", poolname); - zcp_convert_return_values(evalargs->ea_state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(ri->zri_state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); } +/* + * This callback is called when txg_wait_synced_sig encountered a signal. + * The txg_wait_synced_sig will continue to wait for the txg to complete + * after calling this callback. + */ +/* ARGSUSED */ static void +zcp_eval_sig(void *arg, dmu_tx_t *tx) +{ + zcp_run_info_t *ri = arg; + + ri->zri_canceled = B_TRUE; +} + +static void zcp_eval_sync(void *arg, dmu_tx_t *tx) { - zcp_eval_arg_t *evalargs = arg; + zcp_run_info_t *ri = arg; /* * Open context should have setup the stack to contain: @@ -986,15 +994,14 @@ zcp_eval_sync(void *arg, dmu_tx_t *tx) * 2: Script to run (converted to a Lua function) * 3: nvlist input to function (converted to Lua table or nil) */ - VERIFY3U(3, ==, lua_gettop(evalargs->ea_state)); + VERIFY3U(3, ==, lua_gettop(ri->zri_state)); - zcp_eval_impl(tx, B_TRUE, evalargs); + zcp_eval_impl(tx, ri); } static void -zcp_eval_open(zcp_eval_arg_t *evalargs, const char *poolname) +zcp_eval_open(zcp_run_info_t *ri, const char *poolname) { - int error; dsl_pool_t *dp; dmu_tx_t *tx; @@ -1002,11 +1009,11 @@ zcp_eval_open(zcp_eval_arg_t *evalargs, const char *po /* * See comment from the same assertion in zcp_eval_sync(). */ - VERIFY3U(3, ==, lua_gettop(evalargs->ea_state)); + VERIFY3U(3, ==, lua_gettop(ri->zri_state)); error = dsl_pool_hold(poolname, FTAG, &dp); if (error != 0) { - zcp_pool_error(evalargs, poolname); + zcp_pool_error(ri, poolname); return; } @@ -1021,7 +1028,7 @@ zcp_eval_open(zcp_eval_arg_t *evalargs, const char *po */ tx = dmu_tx_create_dd(dp->dp_mos_dir); - zcp_eval_impl(tx, B_FALSE, evalargs); + zcp_eval_impl(tx, ri); dmu_tx_abort(tx); @@ -1034,7 +1041,7 @@ zcp_eval(const char *poolname, const char *program, bo { int err; lua_State *state; - zcp_eval_arg_t evalargs; + zcp_run_info_t runinfo; if (instrlimit > zfs_lua_max_instrlimit) return (SET_ERROR(EINVAL)); @@ -1134,24 +1141,29 @@ zcp_eval(const char *poolname, const char *program, bo } VERIFY3U(3, ==, lua_gettop(state)); - evalargs.ea_state = state; - evalargs.ea_allocargs = &allocargs; - evalargs.ea_instrlimit = instrlimit; - evalargs.ea_cred = CRED(); - evalargs.ea_outnvl = outnvl; - evalargs.ea_result = 0; + runinfo.zri_state = state; + runinfo.zri_allocargs = &allocargs; + runinfo.zri_outnvl = outnvl; + runinfo.zri_result = 0; + runinfo.zri_cred = CRED(); + runinfo.zri_timed_out = B_FALSE; + runinfo.zri_canceled = B_FALSE; + runinfo.zri_sync = sync; + runinfo.zri_space_used = 0; + runinfo.zri_curinstrs = 0; + runinfo.zri_maxinstrs = instrlimit; if (sync) { - err = dsl_sync_task(poolname, NULL, - zcp_eval_sync, &evalargs, 0, ZFS_SPACE_CHECK_ZCP_EVAL); + err = dsl_sync_task_sig(poolname, NULL, zcp_eval_sync, + zcp_eval_sig, &runinfo, 0, ZFS_SPACE_CHECK_ZCP_EVAL); if (err != 0) - zcp_pool_error(&evalargs, poolname); + zcp_pool_error(&runinfo, poolname); } else { - zcp_eval_open(&evalargs, poolname); + zcp_eval_open(&runinfo, poolname); } lua_close(state); - return (evalargs.ea_result); + return (runinfo.zri_result); } /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Oct 16 06:44:37 2019 (r353617) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Oct 16 07:00:18 2019 (r353618) @@ -6823,7 +6823,7 @@ zfsdev_ioctl(struct cdev *dev, u_long zcmd, caddr_t ar error = vec->zvec_func(zc->zc_name, innvl, outnvl); /* - * Some commands can partially execute, modfiy state, and still + * Some commands can partially execute, modify state, and still * return an error. In these cases, attempt to record what * was modified. */ From owner-svn-src-all@freebsd.org Wed Oct 16 07:02:04 2019 Return-Path: Delivered-To: svn-src-all@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 15A2C15D406; Wed, 16 Oct 2019 07:02:04 +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 46tNWv6t92z4LHv; Wed, 16 Oct 2019 07:02:03 +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 CF7023302; Wed, 16 Oct 2019 07:02:03 +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 x9G723DX099332; Wed, 16 Oct 2019 07:02:03 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G722bA099097; Wed, 16 Oct 2019 07:02:02 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160702.x9G722bA099097@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 07:02:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353619 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 353619 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 07:02:04 -0000 Author: avg Date: Wed Oct 16 07:02:02 2019 New Revision: 353619 URL: https://svnweb.freebsd.org/changeset/base/353619 Log: 9691 fat zap should prefetch when iterating illumos/illumos-gate@52abb70e073c2a88808c0d66fd810ba8c5080572 https://github.com/illumos/illumos-gate/commit/52abb70e073c2a88808c0d66fd810ba8c5080572 https://www.illumos.org/issues/9691 When iterating over a ZAP object, we're almost always certain to iterate over the entire object. If there are multiple leaf blocks, we can realize a performance win by issuing reads for all the leaf blocks in parallel when the iteration begins. For example, if we have 10,000 snapshots, "zfs destroy -nv pool/fs@1%9999" can take 30 minutes when the cache is cold. This change provides a >3x performance improvement, by issuing the reads for all ~64 blocks of each ZAP object in parallel. Author: Matthew Ahrens Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/ddt_zap.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zap.h vendor-sys/illumos/dist/uts/common/fs/zfs/zap.c vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/ddt_zap.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/ddt_zap.c Wed Oct 16 07:00:18 2019 (r353618) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/ddt_zap.c Wed Oct 16 07:02:02 2019 (r353619) @@ -21,6 +21,7 @@ /* * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 by Delphix. All rights reserved. */ #include @@ -114,7 +115,18 @@ ddt_zap_walk(objset_t *os, uint64_t object, ddt_entry_ zap_attribute_t za; int error; - zap_cursor_init_serialized(&zc, os, object, *walk); + if (*walk == 0) { + /* + * We don't want to prefetch the entire ZAP object, because + * it can be enormous. Also the primary use of DDT iteration + * is for scrubbing, in which case we will be issuing many + * scrub i/os for each ZAP block that we read in, so + * reading the ZAP is unlikely to be the bottleneck. + */ + zap_cursor_init_noprefetch(&zc, os, object); + } else { + zap_cursor_init_serialized(&zc, os, object, *walk); + } if ((error = zap_cursor_retrieve(&zc, &za)) == 0) { uchar_t cbuf[sizeof (dde->dde_phys) + 1]; uint64_t csize = za.za_num_integers; Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Wed Oct 16 07:00:18 2019 (r353618) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Wed Oct 16 07:02:02 2019 (r353619) @@ -88,6 +88,13 @@ uint32_t zfs_per_txg_dirty_frees_percent = 30; */ int zfs_object_remap_one_indirect_delay_ticks = 0; +/* + * Limit the amount we can prefetch with one call to this amount. This + * helps to limit the amount of memory that can be used by prefetching. + * Larger objects should be prefetched a bit at a time. + */ +uint64_t dmu_prefetch_max = 8 * SPA_MAXBLOCKSIZE; + const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES] = { { DMU_BSWAP_UINT8, TRUE, FALSE, "unallocated" }, { DMU_BSWAP_ZAP, TRUE, TRUE, "object directory" }, @@ -636,6 +643,11 @@ dmu_prefetch(objset_t *os, uint64_t object, int64_t le rw_exit(&dn->dn_struct_rwlock); return; } + + /* + * See comment before the definition of dmu_prefetch_max. + */ + len = MIN(len, dmu_prefetch_max); /* * XXX - Note, if the dnode for the requested object is not Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zap.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zap.h Wed Oct 16 07:00:18 2019 (r353618) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zap.h Wed Oct 16 07:02:02 2019 (r353619) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2018 by Delphix. All rights reserved. * Copyright 2017 Nexenta Systems, Inc. */ @@ -347,6 +347,7 @@ typedef struct zap_cursor { uint64_t zc_serialized; uint64_t zc_hash; uint32_t zc_cd; + boolean_t zc_prefetch; } zap_cursor_t; typedef struct { @@ -373,6 +374,8 @@ typedef struct { * zapobj. You must _fini the cursor when you are done with it. */ void zap_cursor_init(zap_cursor_t *zc, objset_t *ds, uint64_t zapobj); +void zap_cursor_init_noprefetch(zap_cursor_t *zc, objset_t *os, + uint64_t zapobj); void zap_cursor_fini(zap_cursor_t *zc); /* Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zap.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zap.c Wed Oct 16 07:00:18 2019 (r353618) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zap.c Wed Oct 16 07:02:02 2019 (r353619) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2018 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. */ @@ -49,6 +49,36 @@ #include #include +/* + * If zap_iterate_prefetch is set, we will prefetch the entire ZAP object + * (all leaf blocks) when we start iterating over it. + * + * For zap_cursor_init(), the callers all intend to iterate through all the + * entries. There are a few cases where an error (typically i/o error) could + * cause it to bail out early. + * + * For zap_cursor_init_serialized(), there are callers that do the iteration + * outside of ZFS. Typically they would iterate over everything, but we + * don't have control of that. E.g. zfs_ioc_snapshot_list_next(), + * zcp_snapshots_iter(), and other iterators over things in the MOS - these + * are called by /sbin/zfs and channel programs. The other example is + * zfs_readdir() which iterates over directory entries for the getdents() + * syscall. /sbin/ls iterates to the end (unless it receives a signal), but + * userland doesn't have to. + * + * Given that the ZAP entries aren't returned in a specific order, the only + * legitimate use cases for partial iteration would be: + * + * 1. Pagination: e.g. you only want to display 100 entries at a time, so you + * get the first 100 and then wait for the user to hit "next page", which + * they may never do). + * + * 2. You want to know if there are more than X entries, without relying on + * the zfs-specific implementation of the directory's st_size (which is + * the number of entries). + */ +boolean_t zap_iterate_prefetch = B_TRUE; + int fzap_default_block_shift = 14; /* 16k blocksize */ extern inline zap_phys_t *zap_f_phys(zap_t *zap); @@ -1168,6 +1198,20 @@ fzap_cursor_retrieve(zap_t *zap, zap_cursor_t *zc, zap /* retrieve the next entry at or after zc_hash/zc_cd */ /* if no entry, return ENOENT */ + + /* + * If we are reading from the beginning, we're almost + * certain to iterate over the entire ZAP object. If there are + * multiple leaf blocks (freeblk > 2), prefetch the whole + * object, so that we read the leaf blocks concurrently. + * (Unless noprefetch was requested via zap_cursor_init_noprefetch()). + */ + if (zc->zc_hash == 0 && zap_iterate_prefetch && + zc->zc_prefetch && zap_f_phys(zap)->zap_freeblk > 2) { + dmu_prefetch(zc->zc_objset, zc->zc_zapobj, 0, 0, + zap_f_phys(zap)->zap_freeblk << FZAP_BLOCK_SHIFT(zap), + ZIO_PRIORITY_ASYNC_READ); + } if (zc->zc_leaf && (ZAP_HASH_IDX(zc->zc_hash, Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c Wed Oct 16 07:00:18 2019 (r353618) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c Wed Oct 16 07:02:02 2019 (r353619) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2017 by Delphix. All rights reserved. + * Copyright (c) 2011, 2018 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 Nexenta Systems, Inc. @@ -1386,9 +1386,9 @@ zap_remove_uint64(objset_t *os, uint64_t zapobj, const * Routines for iterating over the attributes. */ -void -zap_cursor_init_serialized(zap_cursor_t *zc, objset_t *os, uint64_t zapobj, - uint64_t serialized) +static void +zap_cursor_init_impl(zap_cursor_t *zc, objset_t *os, uint64_t zapobj, + uint64_t serialized, boolean_t prefetch) { zc->zc_objset = os; zc->zc_zap = NULL; @@ -1397,12 +1397,33 @@ zap_cursor_init_serialized(zap_cursor_t *zc, objset_t zc->zc_serialized = serialized; zc->zc_hash = 0; zc->zc_cd = 0; + zc->zc_prefetch = prefetch; } +void +zap_cursor_init_serialized(zap_cursor_t *zc, objset_t *os, uint64_t zapobj, + uint64_t serialized) +{ + zap_cursor_init_impl(zc, os, zapobj, serialized, B_TRUE); +} +/* + * Initialize a cursor at the beginning of the ZAP object. The entire + * ZAP object will be prefetched. + */ void zap_cursor_init(zap_cursor_t *zc, objset_t *os, uint64_t zapobj) { - zap_cursor_init_serialized(zc, os, zapobj, 0); + zap_cursor_init_impl(zc, os, zapobj, 0, B_TRUE); +} + +/* + * Initialize a cursor at the beginning, but request that we not prefetch + * the entire ZAP object. + */ +void +zap_cursor_init_noprefetch(zap_cursor_t *zc, objset_t *os, uint64_t zapobj) +{ + zap_cursor_init_impl(zc, os, zapobj, 0, B_FALSE); } void From owner-svn-src-all@freebsd.org Wed Oct 16 07:04:02 2019 Return-Path: Delivered-To: svn-src-all@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 0EFE015D555; Wed, 16 Oct 2019 07:04:02 +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 46tNZ96dc5z4LX6; Wed, 16 Oct 2019 07:04:01 +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 C7785332C; Wed, 16 Oct 2019 07:04:01 +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 x9G74108000920; Wed, 16 Oct 2019 07:04:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G741LC000919; Wed, 16 Oct 2019 07:04:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910160704.x9G741LC000919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 16 Oct 2019 07:04:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353620 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 353620 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 07:04:02 -0000 Author: kib Date: Wed Oct 16 07:04:01 2019 New Revision: 353620 URL: https://svnweb.freebsd.org/changeset/base/353620 Log: MFC r353463: Restore nofaulting operations after r352807. Modified: stable/12/sys/vm/vm_fault.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_fault.c ============================================================================== --- stable/12/sys/vm/vm_fault.c Wed Oct 16 07:02:02 2019 (r353619) +++ stable/12/sys/vm/vm_fault.c Wed Oct 16 07:04:01 2019 (r353620) @@ -562,15 +562,11 @@ int vm_fault_trap(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, int fault_flags, int *signo, int *ucode) { - struct thread *td; int result; MPASS(signo == NULL || ucode != NULL); - td = curthread; - if ((td->td_pflags & TDP_NOFAULTING) != 0) - return (KERN_PROTECTION_FAILURE); #ifdef KTRACE - if (map != kernel_map && KTRPOINT(td, KTR_FAULT)) + if (map != kernel_map && KTRPOINT(curthread, KTR_FAULT)) ktrfault(vaddr, fault_type); #endif result = vm_fault(map, trunc_page(vaddr), fault_type, fault_flags, @@ -582,7 +578,7 @@ vm_fault_trap(vm_map_t map, vm_offset_t vaddr, vm_prot result == KERN_OUT_OF_BOUNDS, ("Unexpected Mach error %d from vm_fault()", result)); #ifdef KTRACE - if (map != kernel_map && KTRPOINT(td, KTR_FAULTEND)) + if (map != kernel_map && KTRPOINT(curthread, KTR_FAULTEND)) ktrfaultend(result); #endif if (result != KERN_SUCCESS && signo != NULL) { @@ -652,6 +648,10 @@ vm_fault(vm_map_t map, vm_offset_t vaddr, vm_prot_t fa bool dead, hardfault, is_first_object_locked; VM_CNT_INC(v_vm_faults); + + if ((curthread->td_pflags & TDP_NOFAULTING) != 0) + return (KERN_PROTECTION_FAILURE); + fs.vp = NULL; faultcount = 0; nera = -1; From owner-svn-src-all@freebsd.org Wed Oct 16 07:09:01 2019 Return-Path: Delivered-To: svn-src-all@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 E0CF015D63B; Wed, 16 Oct 2019 07:09:01 +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 46tNgx5gLVz4Lhm; Wed, 16 Oct 2019 07:09:01 +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 A1355332E; Wed, 16 Oct 2019 07:09:01 +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 x9G7918a001194; Wed, 16 Oct 2019 07:09:01 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G790Xx001189; Wed, 16 Oct 2019 07:09:00 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160709.x9G790Xx001189@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 07:09:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353621 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 353621 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 07:09:01 -0000 Author: avg Date: Wed Oct 16 07:09:00 2019 New Revision: 353621 URL: https://svnweb.freebsd.org/changeset/base/353621 Log: MFV r353619: 9691 fat zap should prefetch when iterating illumos/illumos-gate@52abb70e073c2a88808c0d66fd810ba8c5080572 https://github.com/illumos/illumos-gate/commit/52abb70e073c2a88808c0d66fd810ba8c5080572 https://www.illumos.org/issues/9691 When iterating over a ZAP object, we're almost always certain to iterate over the entire object. If there are multiple leaf blocks, we can realize a performance win by issuing reads for all the leaf blocks in parallel when the iteration begins. For example, if we have 10,000 snapshots, "zfs destroy -nv pool/fs@1%9999" can take 30 minutes when the cache is cold. This change provides a >3x performance improvement, by issuing the reads for all ~64 blocks of each ZAP object in parallel. Author: Matthew Ahrens Obtained from: illumos MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt_zap.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt_zap.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt_zap.c Wed Oct 16 07:04:01 2019 (r353620) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt_zap.c Wed Oct 16 07:09:00 2019 (r353621) @@ -21,6 +21,7 @@ /* * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 by Delphix. All rights reserved. */ #include @@ -113,7 +114,18 @@ ddt_zap_walk(objset_t *os, uint64_t object, ddt_entry_ zap_attribute_t za; int error; - zap_cursor_init_serialized(&zc, os, object, *walk); + if (*walk == 0) { + /* + * We don't want to prefetch the entire ZAP object, because + * it can be enormous. Also the primary use of DDT iteration + * is for scrubbing, in which case we will be issuing many + * scrub i/os for each ZAP block that we read in, so + * reading the ZAP is unlikely to be the bottleneck. + */ + zap_cursor_init_noprefetch(&zc, os, object); + } else { + zap_cursor_init_serialized(&zc, os, object, *walk); + } if ((error = zap_cursor_retrieve(&zc, &za)) == 0) { uchar_t cbuf[sizeof (dde->dde_phys) + 1]; uint64_t csize = za.za_num_integers; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Wed Oct 16 07:04:01 2019 (r353620) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Wed Oct 16 07:09:00 2019 (r353621) @@ -80,6 +80,13 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, per_txg_dirty_frees_per */ int zfs_object_remap_one_indirect_delay_ticks = 0; +/* + * Limit the amount we can prefetch with one call to this amount. This + * helps to limit the amount of memory that can be used by prefetching. + * Larger objects should be prefetched a bit at a time. + */ +uint64_t dmu_prefetch_max = 8 * SPA_MAXBLOCKSIZE; + const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES] = { { DMU_BSWAP_UINT8, TRUE, FALSE, "unallocated" }, { DMU_BSWAP_ZAP, TRUE, TRUE, "object directory" }, @@ -641,6 +648,11 @@ dmu_prefetch(objset_t *os, uint64_t object, int64_t le rw_exit(&dn->dn_struct_rwlock); return; } + + /* + * See comment before the definition of dmu_prefetch_max. + */ + len = MIN(len, dmu_prefetch_max); /* * XXX - Note, if the dnode for the requested object is not Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h Wed Oct 16 07:04:01 2019 (r353620) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h Wed Oct 16 07:09:00 2019 (r353621) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2018 by Delphix. All rights reserved. * Copyright 2017 Nexenta Systems, Inc. */ @@ -349,6 +349,7 @@ typedef struct zap_cursor { uint64_t zc_serialized; uint64_t zc_hash; uint32_t zc_cd; + boolean_t zc_prefetch; } zap_cursor_t; typedef struct { @@ -375,6 +376,8 @@ typedef struct { * zapobj. You must _fini the cursor when you are done with it. */ void zap_cursor_init(zap_cursor_t *zc, objset_t *ds, uint64_t zapobj); +void zap_cursor_init_noprefetch(zap_cursor_t *zc, objset_t *os, + uint64_t zapobj); void zap_cursor_fini(zap_cursor_t *zc); /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c Wed Oct 16 07:04:01 2019 (r353620) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c Wed Oct 16 07:09:00 2019 (r353621) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2018 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. */ @@ -49,6 +49,36 @@ #include #include +/* + * If zap_iterate_prefetch is set, we will prefetch the entire ZAP object + * (all leaf blocks) when we start iterating over it. + * + * For zap_cursor_init(), the callers all intend to iterate through all the + * entries. There are a few cases where an error (typically i/o error) could + * cause it to bail out early. + * + * For zap_cursor_init_serialized(), there are callers that do the iteration + * outside of ZFS. Typically they would iterate over everything, but we + * don't have control of that. E.g. zfs_ioc_snapshot_list_next(), + * zcp_snapshots_iter(), and other iterators over things in the MOS - these + * are called by /sbin/zfs and channel programs. The other example is + * zfs_readdir() which iterates over directory entries for the getdents() + * syscall. /sbin/ls iterates to the end (unless it receives a signal), but + * userland doesn't have to. + * + * Given that the ZAP entries aren't returned in a specific order, the only + * legitimate use cases for partial iteration would be: + * + * 1. Pagination: e.g. you only want to display 100 entries at a time, so you + * get the first 100 and then wait for the user to hit "next page", which + * they may never do). + * + * 2. You want to know if there are more than X entries, without relying on + * the zfs-specific implementation of the directory's st_size (which is + * the number of entries). + */ +boolean_t zap_iterate_prefetch = B_TRUE; + int fzap_default_block_shift = 14; /* 16k blocksize */ extern inline zap_phys_t *zap_f_phys(zap_t *zap); @@ -1168,6 +1198,20 @@ fzap_cursor_retrieve(zap_t *zap, zap_cursor_t *zc, zap /* retrieve the next entry at or after zc_hash/zc_cd */ /* if no entry, return ENOENT */ + + /* + * If we are reading from the beginning, we're almost + * certain to iterate over the entire ZAP object. If there are + * multiple leaf blocks (freeblk > 2), prefetch the whole + * object, so that we read the leaf blocks concurrently. + * (Unless noprefetch was requested via zap_cursor_init_noprefetch()). + */ + if (zc->zc_hash == 0 && zap_iterate_prefetch && + zc->zc_prefetch && zap_f_phys(zap)->zap_freeblk > 2) { + dmu_prefetch(zc->zc_objset, zc->zc_zapobj, 0, 0, + zap_f_phys(zap)->zap_freeblk << FZAP_BLOCK_SHIFT(zap), + ZIO_PRIORITY_ASYNC_READ); + } if (zc->zc_leaf && (ZAP_HASH_IDX(zc->zc_hash, Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Wed Oct 16 07:04:01 2019 (r353620) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Wed Oct 16 07:09:00 2019 (r353621) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2017 by Delphix. All rights reserved. + * Copyright (c) 2011, 2018 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 Nexenta Systems, Inc. @@ -1394,9 +1394,9 @@ zap_remove_uint64(objset_t *os, uint64_t zapobj, const * Routines for iterating over the attributes. */ -void -zap_cursor_init_serialized(zap_cursor_t *zc, objset_t *os, uint64_t zapobj, - uint64_t serialized) +static void +zap_cursor_init_impl(zap_cursor_t *zc, objset_t *os, uint64_t zapobj, + uint64_t serialized, boolean_t prefetch) { zc->zc_objset = os; zc->zc_zap = NULL; @@ -1405,12 +1405,33 @@ zap_cursor_init_serialized(zap_cursor_t *zc, objset_t zc->zc_serialized = serialized; zc->zc_hash = 0; zc->zc_cd = 0; + zc->zc_prefetch = prefetch; } +void +zap_cursor_init_serialized(zap_cursor_t *zc, objset_t *os, uint64_t zapobj, + uint64_t serialized) +{ + zap_cursor_init_impl(zc, os, zapobj, serialized, B_TRUE); +} +/* + * Initialize a cursor at the beginning of the ZAP object. The entire + * ZAP object will be prefetched. + */ void zap_cursor_init(zap_cursor_t *zc, objset_t *os, uint64_t zapobj) { - zap_cursor_init_serialized(zc, os, zapobj, 0); + zap_cursor_init_impl(zc, os, zapobj, 0, B_TRUE); +} + +/* + * Initialize a cursor at the beginning, but request that we not prefetch + * the entire ZAP object. + */ +void +zap_cursor_init_noprefetch(zap_cursor_t *zc, objset_t *os, uint64_t zapobj) +{ + zap_cursor_init_impl(zc, os, zapobj, 0, B_FALSE); } void From owner-svn-src-all@freebsd.org Wed Oct 16 07:09:16 2019 Return-Path: Delivered-To: svn-src-all@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 6B5F115D688; Wed, 16 Oct 2019 07:09:16 +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 46tNhD2Fntz4Lq7; Wed, 16 Oct 2019 07:09:16 +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 305D0332F; Wed, 16 Oct 2019 07:09:16 +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 x9G79Gpo001254; Wed, 16 Oct 2019 07:09:16 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G79F6s001250; Wed, 16 Oct 2019 07:09:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910160709.x9G79F6s001250@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 16 Oct 2019 07:09:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353622 - in head/sys/powerpc: aim booke include X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/powerpc: aim booke include X-SVN-Commit-Revision: 353622 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 07:09:16 -0000 Author: kib Date: Wed Oct 16 07:09:15 2019 New Revision: 353622 URL: https://svnweb.freebsd.org/changeset/base/353622 Log: Fix assert in PowerPC pmaps after introduction of object busy. The VM_PAGE_OBJECT_BUSY_ASSERT() in pmap_enter() implementation should be only asserted when the code is executed as result of pmap_enter(), not when the same code is entered from e.g. pmap_enter_quick(). This is relevant for all PowerPC pmap variants, because mmu_*_enter() is used as the backend, and assert is located there. Add a PowerPC private pmap_enter() PMAP_ENTER_QUICK_LOCKED flag to indicate that the call is not from pmap_enter(). For non-quick-locked calls, assert that the object is locked. Reported and tested by: bdragon Reviewed by: alc, bdragon, markj Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D22041 Modified: head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/booke/pmap.c head/sys/powerpc/include/pmap.h Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Wed Oct 16 07:09:00 2019 (r353621) +++ head/sys/powerpc/aim/mmu_oea.c Wed Oct 16 07:09:15 2019 (r353622) @@ -1149,8 +1149,12 @@ moea_enter_locked(pmap_t pmap, vm_offset_t va, vm_page if (pmap_bootstrapped) rw_assert(&pvh_global_lock, RA_WLOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if ((m->oflags & VPO_UNMANAGED) == 0) - VM_PAGE_OBJECT_BUSY_ASSERT(m); + if ((m->oflags & VPO_UNMANAGED) == 0) { + if ((flags & PMAP_ENTER_QUICK_LOCKED) == 0) + VM_PAGE_OBJECT_BUSY_ASSERT(m); + else + VM_OBJECT_ASSERT_LOCKED(m->object); + } if ((m->oflags & VPO_UNMANAGED) != 0 || !moea_initialized) { pvo_head = &moea_pvo_kunmanaged; @@ -1218,7 +1222,8 @@ moea_enter_object(mmu_t mmu, pmap_t pm, vm_offset_t st PMAP_LOCK(pm); while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { moea_enter_locked(pm, start + ptoa(diff), m, prot & - (VM_PROT_READ | VM_PROT_EXECUTE), 0, 0); + (VM_PROT_READ | VM_PROT_EXECUTE), PMAP_ENTER_QUICK_LOCKED, + 0); m = TAILQ_NEXT(m, listq); } rw_wunlock(&pvh_global_lock); @@ -1233,7 +1238,7 @@ moea_enter_quick(mmu_t mmu, pmap_t pm, vm_offset_t va, rw_wlock(&pvh_global_lock); PMAP_LOCK(pm); moea_enter_locked(pm, va, m, prot & (VM_PROT_READ | VM_PROT_EXECUTE), - 0, 0); + PMAP_ENTER_QUICK_LOCKED, 0); rw_wunlock(&pvh_global_lock); PMAP_UNLOCK(pm); } Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Wed Oct 16 07:09:00 2019 (r353621) +++ head/sys/powerpc/aim/mmu_oea64.c Wed Oct 16 07:09:15 2019 (r353622) @@ -1406,8 +1406,12 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_offset_t va, v uint64_t pte_lo; int error; - if ((m->oflags & VPO_UNMANAGED) == 0) - VM_PAGE_OBJECT_BUSY_ASSERT(m); + if ((m->oflags & VPO_UNMANAGED) == 0) { + if ((flags & PMAP_ENTER_QUICK_LOCKED) == 0) + VM_PAGE_OBJECT_BUSY_ASSERT(m); + else + VM_OBJECT_ASSERT_LOCKED(m->object); + } pvo = alloc_pvo_entry(0); if (pvo == NULL) @@ -1548,7 +1552,8 @@ moea64_enter_object(mmu_t mmu, pmap_t pm, vm_offset_t m = m_start; while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { moea64_enter(mmu, pm, start + ptoa(diff), m, prot & - (VM_PROT_READ | VM_PROT_EXECUTE), PMAP_ENTER_NOSLEEP, 0); + (VM_PROT_READ | VM_PROT_EXECUTE), PMAP_ENTER_NOSLEEP | + PMAP_ENTER_QUICK_LOCKED, 0); m = TAILQ_NEXT(m, listq); } } @@ -1559,7 +1564,7 @@ moea64_enter_quick(mmu_t mmu, pmap_t pm, vm_offset_t v { moea64_enter(mmu, pm, va, m, prot & (VM_PROT_READ | VM_PROT_EXECUTE), - PMAP_ENTER_NOSLEEP, 0); + PMAP_ENTER_NOSLEEP | PMAP_ENTER_QUICK_LOCKED, 0); } vm_paddr_t Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Wed Oct 16 07:09:00 2019 (r353621) +++ head/sys/powerpc/booke/pmap.c Wed Oct 16 07:09:15 2019 (r353622) @@ -2278,8 +2278,12 @@ mmu_booke_enter_locked(mmu_t mmu, pmap_t pmap, vm_offs KASSERT((va <= VM_MAXUSER_ADDRESS), ("mmu_booke_enter_locked: user pmap, non user va")); } - if ((m->oflags & VPO_UNMANAGED) == 0) - VM_PAGE_OBJECT_BUSY_ASSERT(m); + if ((m->oflags & VPO_UNMANAGED) == 0) { + if ((pmap_flags & PMAP_ENTER_QUICK_LOCKED) == 0) + VM_PAGE_OBJECT_BUSY_ASSERT(m); + else + VM_OBJECT_ASSERT_LOCKED(m->object); + } PMAP_LOCK_ASSERT(pmap, MA_OWNED); @@ -2447,7 +2451,7 @@ mmu_booke_enter_object(mmu_t mmu, pmap_t pmap, vm_offs while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { mmu_booke_enter_locked(mmu, pmap, start + ptoa(diff), m, prot & (VM_PROT_READ | VM_PROT_EXECUTE), - PMAP_ENTER_NOSLEEP, 0); + PMAP_ENTER_NOSLEEP | PMAP_ENTER_QUICK_LOCKED, 0); m = TAILQ_NEXT(m, listq); } rw_wunlock(&pvh_global_lock); @@ -2462,8 +2466,8 @@ mmu_booke_enter_quick(mmu_t mmu, pmap_t pmap, vm_offse rw_wlock(&pvh_global_lock); PMAP_LOCK(pmap); mmu_booke_enter_locked(mmu, pmap, va, m, - prot & (VM_PROT_READ | VM_PROT_EXECUTE), PMAP_ENTER_NOSLEEP, - 0); + prot & (VM_PROT_READ | VM_PROT_EXECUTE), PMAP_ENTER_NOSLEEP | + PMAP_ENTER_QUICK_LOCKED, 0); rw_wunlock(&pvh_global_lock); PMAP_UNLOCK(pmap); } Modified: head/sys/powerpc/include/pmap.h ============================================================================== --- head/sys/powerpc/include/pmap.h Wed Oct 16 07:09:00 2019 (r353621) +++ head/sys/powerpc/include/pmap.h Wed Oct 16 07:09:15 2019 (r353622) @@ -80,6 +80,8 @@ struct pmap; typedef struct pmap *pmap_t; +#define PMAP_ENTER_QUICK_LOCKED 0x10000000 + #if !defined(NPMAPS) #define NPMAPS 32768 #endif /* !defined(NPMAPS) */ From owner-svn-src-all@freebsd.org Wed Oct 16 07:11:30 2019 Return-Path: Delivered-To: svn-src-all@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 CA48A15D84C; Wed, 16 Oct 2019 07:11:30 +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 46tNkp4z0Yz4M2P; Wed, 16 Oct 2019 07:11:30 +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 8DC573394; Wed, 16 Oct 2019 07:11:30 +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 x9G7BUkR005846; Wed, 16 Oct 2019 07:11:30 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G7BU7p005845; Wed, 16 Oct 2019 07:11:30 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160711.x9G7BU7p005845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 07:11:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353623 - vendor/illumos/dist/man/man1m X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor/illumos/dist/man/man1m X-SVN-Commit-Revision: 353623 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 07:11:30 -0000 Author: avg Date: Wed Oct 16 07:11:30 2019 New Revision: 353623 URL: https://svnweb.freebsd.org/changeset/base/353623 Log: 10473 zfs(1M) missing cross-reference to zfs-program(1M) illumos/illumos-gate@736e6700391d17ab1494985a80076fc185722699 https://github.com/illumos/illumos-gate/commit/736e6700391d17ab1494985a80076fc185722699 https://www.illumos.org/issues/10473 Author: Jason King Modified: vendor/illumos/dist/man/man1m/zfs.1m Modified: vendor/illumos/dist/man/man1m/zfs.1m ============================================================================== --- vendor/illumos/dist/man/man1m/zfs.1m Wed Oct 16 07:09:15 2019 (r353622) +++ vendor/illumos/dist/man/man1m/zfs.1m Wed Oct 16 07:11:30 2019 (r353623) @@ -23,14 +23,13 @@ .\" Copyright 2011 Joshua M. Clulow .\" Copyright (c) 2011, 2016 by Delphix. All rights reserved. .\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved. -.\" Copyright (c) 2014, Joyent, Inc. All rights reserved. .\" Copyright (c) 2014 by Adam Stevko. All rights reserved. .\" Copyright (c) 2014 Integros [integros.com] .\" Copyright 2017 Nexenta Systems, Inc. -.\" Copyright 2018 Joyent, Inc. +.\" Copyright 2019 Joyent, Inc. .\" Copyright (c) 2018 Datto Inc. .\" -.Dd Feb 10, 2018 +.Dd February 26, 2019 .Dt ZFS 1M .Os .Sh NAME @@ -3493,6 +3492,7 @@ Channel programs may only be run with root privileges. .sp For full documentation of the ZFS channel program interface, see the manual page for +.Xr zfs-program 1M . .Bl -tag -width "" .It Fl j Display channel program output in JSON format. @@ -3918,6 +3918,7 @@ M F /tank/test/modified .Xr share 1M , .Xr sharemgr 1M , .Xr unshare 1M , +.Xr zfs-program 1M , .Xr zonecfg 1M , .Xr zpool 1M , .Xr chmod 2 , From owner-svn-src-all@freebsd.org Wed Oct 16 07:21:00 2019 Return-Path: Delivered-To: svn-src-all@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 B091815DBED; Wed, 16 Oct 2019 07:21: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 46tNxm44Fcz4MgW; Wed, 16 Oct 2019 07:21:00 +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 7071E3822; Wed, 16 Oct 2019 07:21:00 +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 x9G7L0cc008940; Wed, 16 Oct 2019 07:21:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G7L08r008939; Wed, 16 Oct 2019 07:21:00 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160721.x9G7L08r008939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 07:21:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353624 - head/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/zfs X-SVN-Commit-Revision: 353624 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 07:21:00 -0000 Author: avg Date: Wed Oct 16 07:20:59 2019 New Revision: 353624 URL: https://svnweb.freebsd.org/changeset/base/353624 Log: MFV r353623: 10473 zfs(1M) missing cross-reference to zfs-program(1M) illumos/illumos-gate@736e6700391d17ab1494985a80076fc185722699 https://github.com/illumos/illumos-gate/commit/736e6700391d17ab1494985a80076fc185722699 https://www.illumos.org/issues/10473 Author: Jason King Obtained from: illumos MFC after: 6 days Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Directory Properties: head/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Oct 16 07:11:30 2019 (r353623) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Oct 16 07:20:59 2019 (r353624) @@ -23,17 +23,16 @@ .\" Copyright (c) 2012, Glen Barber .\" Copyright (c) 2012, Bryan Drewery .\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved. -.\" Copyright (c) 2014, Joyent, Inc. All rights reserved. .\" Copyright (c) 2013, Steven Hartland .\" Copyright (c) 2016 Nexenta Systems, Inc. All Rights Reserved. .\" Copyright (c) 2014, Xin LI .\" Copyright (c) 2014-2015, The FreeBSD Foundation, All Rights Reserved. -.\" Copyright 2018 Joyent, Inc. +.\" Copyright 2019 Joyent, Inc. .\" Copyright (c) 2018 Datto Inc. .\" .\" $FreeBSD$ .\" -.Dd February 15, 2018 +.Dd Octover 16, 2019 .Dt ZFS 8 .Os .Sh NAME @@ -3930,6 +3929,7 @@ M F /tank/test/modified .Xr jail 8 , .Xr mount 8 , .Xr umount 8 , +.Xr zfs-program 8 , .Xr zpool 8 .Sh AUTHORS This manual page is a From owner-svn-src-all@freebsd.org Wed Oct 16 07:41:34 2019 Return-Path: Delivered-To: svn-src-all@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 C7FBA15E141; Wed, 16 Oct 2019 07:41:34 +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 46tPPV4s3dz4NXK; Wed, 16 Oct 2019 07:41:34 +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 8A1F83C6E; Wed, 16 Oct 2019 07:41:34 +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 x9G7fYOp022678; Wed, 16 Oct 2019 07:41:34 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G7fYJo022675; Wed, 16 Oct 2019 07:41:34 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160741.x9G7fYJo022675@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 07:41:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353625 - in head/cddl/contrib/opensolaris/lib/libzpool/common: . sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/cddl/contrib/opensolaris/lib/libzpool/common: . sys X-SVN-Commit-Revision: 353625 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 07:41:34 -0000 Author: avg Date: Wed Oct 16 07:41:33 2019 New Revision: 353625 URL: https://svnweb.freebsd.org/changeset/base/353625 Log: zfs: add a lame emulation of cv_wait_sig(9) in userland to fix r353618 Not sure if we need anything better. Maybe we should try to port illumos libfakekernel or provide something similar natively. MFC after: 4 weeks X-MFC with: r353618 Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Wed Oct 16 07:20:59 2019 (r353624) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Wed Oct 16 07:41:33 2019 (r353625) @@ -321,6 +321,18 @@ cv_wait(kcondvar_t *cv, kmutex_t *mp) mp->m_owner = curthread; } +/* + * NB: this emulates FreeBSD cv_wait_sig(9), not the illumos one. + * Meanings of the return code is different. + * NB: this does not actually catch any siganls. + */ +int +cv_wait_sig(kcondvar_t *cv, kmutex_t *mp) +{ + cv_wait(cv, mp); + return (0); +} + clock_t cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime) { Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Wed Oct 16 07:20:59 2019 (r353624) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Wed Oct 16 07:41:33 2019 (r353625) @@ -330,6 +330,7 @@ typedef cond_t kcondvar_t; extern void cv_init(kcondvar_t *cv, char *name, int type, void *arg); extern void cv_destroy(kcondvar_t *cv); extern void cv_wait(kcondvar_t *cv, kmutex_t *mp); +extern int cv_wait_sig(kcondvar_t *cv, kmutex_t *mp); extern clock_t cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime); extern clock_t cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res, int flag); From owner-svn-src-all@freebsd.org Wed Oct 16 07:49:21 2019 Return-Path: Delivered-To: svn-src-all@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 6BECA15E30A; Wed, 16 Oct 2019 07:49:21 +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 46tPZT2DD4z4NvX; Wed, 16 Oct 2019 07:49:21 +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 2B2913CD5; Wed, 16 Oct 2019 07:49:21 +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 x9G7nLUm024490; Wed, 16 Oct 2019 07:49:21 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G7nKH0024489; Wed, 16 Oct 2019 07:49:21 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160749.x9G7nKH0024489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 07:49:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353626 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 353626 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 07:49:21 -0000 Author: avg Date: Wed Oct 16 07:49:20 2019 New Revision: 353626 URL: https://svnweb.freebsd.org/changeset/base/353626 Log: 10841 predictive prefetch disabled on new pools until export/reboot illumos/illumos-gate@0ce4bbcb47d8f86307fb8d2c84fd0f4e070f576e https://github.com/illumos/illumos-gate/commit/0ce4bbcb47d8f86307fb8d2c84fd0f4e070f576e https://www.illumos.org/issues/10841 ZoL 944a37248a0 predictive prefetch disabled on new pools until export/reboot When a pool is initially created (by `zpool create`), predictive prefetch is inadvertently disabled, until the pool is export/import-ed, or the machine is rebooted. When device removal was introduced, we added some code to disable predictive prefetching until indirect vdevs have been loaded. This resulted in the "default state" of prefetch being disabled, until we proactively enable it after indirect vdevs are loaded. Unfortunately this resulted in a few bugs where in some code paths we neglect to enable predictive prefetch. The first of these was fixed by https://github.com/zfsonlinux/zfs/commit/20507534d4ede14d4dd82c99fc8d461704ce7419 This commit fixes another case where we also need to explicitly enable predictive prefetch, when the pool is initially created. Author: Matthew Ahrens Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Oct 16 07:41:33 2019 (r353625) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Oct 16 07:49:20 2019 (r353626) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2018 by Delphix. All rights reserved. + * Copyright (c) 2011, 2019 by Delphix. All rights reserved. * Copyright (c) 2015, Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright 2013 Saso Kiselkov. All rights reserved. @@ -4651,6 +4651,7 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_ spa->spa_removing_phys.sr_state = DSS_NONE; spa->spa_removing_phys.sr_removing_vdev = -1; spa->spa_removing_phys.sr_prev_indirect_vdev = -1; + spa->spa_indirect_vdevs_loaded = B_TRUE; /* * Create "The Godfather" zio to hold all async IOs From owner-svn-src-all@freebsd.org Wed Oct 16 07:49:23 2019 Return-Path: Delivered-To: svn-src-all@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 A834215E325; Wed, 16 Oct 2019 07:49: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 46tPZW2Pppz4Nw9; Wed, 16 Oct 2019 07:49:22 +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 x9G7nEhZ030515 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 16 Oct 2019 10:49:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x9G7nEhZ030515 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x9G7nEdh030514; Wed, 16 Oct 2019 10:49:14 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 16 Oct 2019 10:49:14 +0300 From: Konstantin Belousov To: Andriy Gapon Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353625 - in head/cddl/contrib/opensolaris/lib/libzpool/common: . sys Message-ID: <20191016074914.GE73312@kib.kiev.ua> References: <201910160741.x9G7fYJo022675@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201910160741.x9G7fYJo022675@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) 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: 46tPZW2Pppz4Nw9 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.990,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 07:49:23 -0000 On Wed, Oct 16, 2019 at 07:41:34AM +0000, Andriy Gapon wrote: > Author: avg > Date: Wed Oct 16 07:41:33 2019 > New Revision: 353625 > URL: https://svnweb.freebsd.org/changeset/base/353625 > > Log: > zfs: add a lame emulation of cv_wait_sig(9) in userland to fix r353618 > > Not sure if we need anything better. > Maybe we should try to port illumos libfakekernel or provide something > similar natively. > > MFC after: 4 weeks > X-MFC with: r353618 > > Modified: > head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c > head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h > > Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c > ============================================================================== > --- head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Wed Oct 16 07:20:59 2019 (r353624) > +++ head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Wed Oct 16 07:41:33 2019 (r353625) > @@ -321,6 +321,18 @@ cv_wait(kcondvar_t *cv, kmutex_t *mp) > mp->m_owner = curthread; > } > > +/* > + * NB: this emulates FreeBSD cv_wait_sig(9), not the illumos one. > + * Meanings of the return code is different. > + * NB: this does not actually catch any siganls. s/siganls/signals/ From owner-svn-src-all@freebsd.org Wed Oct 16 07:53:48 2019 Return-Path: Delivered-To: svn-src-all@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 2ADD915E6DD; Wed, 16 Oct 2019 07:53:48 +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 46tPgc0L96z4Pg3; Wed, 16 Oct 2019 07:53:48 +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 E30353ED6; Wed, 16 Oct 2019 07:53:47 +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 x9G7rlK3030488; Wed, 16 Oct 2019 07:53:47 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G7rlX2030487; Wed, 16 Oct 2019 07:53:47 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160753.x9G7rlX2030487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 07:53:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353627 - head/cddl/contrib/opensolaris/lib/libzpool/common X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzpool/common X-SVN-Commit-Revision: 353627 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 07:53:48 -0000 Author: avg Date: Wed Oct 16 07:53:47 2019 New Revision: 353627 URL: https://svnweb.freebsd.org/changeset/base/353627 Log: fix wording / typos in r353625 Reported by: kib MFC after: 4 weeks X-MFC with: r353625, r353618 Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Wed Oct 16 07:49:20 2019 (r353626) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Wed Oct 16 07:53:47 2019 (r353627) @@ -323,8 +323,8 @@ cv_wait(kcondvar_t *cv, kmutex_t *mp) /* * NB: this emulates FreeBSD cv_wait_sig(9), not the illumos one. - * Meanings of the return code is different. - * NB: this does not actually catch any siganls. + * Meanings of the return code are different. + * NB: this does not actually catch any signals. */ int cv_wait_sig(kcondvar_t *cv, kmutex_t *mp) From owner-svn-src-all@freebsd.org Wed Oct 16 07:54:33 2019 Return-Path: Delivered-To: svn-src-all@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 79C1B15E751; Wed, 16 Oct 2019 07:54:33 +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 46tPhT2gTkz4Pnn; Wed, 16 Oct 2019 07:54:33 +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 3EC4B3ED7; Wed, 16 Oct 2019 07:54:33 +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 x9G7sXEZ030563; Wed, 16 Oct 2019 07:54:33 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G7sXNh030562; Wed, 16 Oct 2019 07:54:33 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160754.x9G7sXNh030562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 07:54:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353628 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 353628 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 07:54:33 -0000 Author: avg Date: Wed Oct 16 07:54:32 2019 New Revision: 353628 URL: https://svnweb.freebsd.org/changeset/base/353628 Log: 10842 Mutex leak in dsl_dataset_hold_obj() illumos/illumos-gate@ad027c0ff9612bff8f47b43d8561da627f80cd29 https://github.com/illumos/illumos-gate/commit/ad027c0ff9612bff8f47b43d8561da627f80cd29 https://www.illumos.org/issues/10842 ZoL d10b2f1d35b Mutex leak in dsl_dataset_hold_obj() Portions contributed by: Jerry Jelinek Author: Jorgen Lundman Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Wed Oct 16 07:53:47 2019 (r353627) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Wed Oct 16 07:54:32 2019 (r353628) @@ -562,10 +562,14 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uint64_t dsobj, v if (ds->ds_prev) dsl_dataset_rele(ds->ds_prev, ds); dsl_dir_rele(ds->ds_dir, ds); + list_destroy(&ds->ds_prop_cbs); + list_destroy(&ds->ds_sendstreams); mutex_destroy(&ds->ds_lock); mutex_destroy(&ds->ds_opening_lock); mutex_destroy(&ds->ds_sendstream_lock); + mutex_destroy(&ds->ds_remap_deadlist_lock); zfs_refcount_destroy(&ds->ds_longholds); + rrw_destroy(&ds->ds_bp_rwlock); kmem_free(ds, sizeof (dsl_dataset_t)); if (err != 0) { dmu_buf_rele(dbuf, tag); From owner-svn-src-all@freebsd.org Wed Oct 16 07:57:59 2019 Return-Path: Delivered-To: svn-src-all@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 5A17415E7E8; Wed, 16 Oct 2019 07:57:59 +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 46tPmR1j9Qz4Pwx; Wed, 16 Oct 2019 07:57: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 1973A3ED9; Wed, 16 Oct 2019 07:57: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 x9G7vw1Z030805; Wed, 16 Oct 2019 07:57:58 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G7vwcF030804; Wed, 16 Oct 2019 07:57:58 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160757.x9G7vwcF030804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 07:57:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353629 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 353629 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 07:57:59 -0000 Author: avg Date: Wed Oct 16 07:57:58 2019 New Revision: 353629 URL: https://svnweb.freebsd.org/changeset/base/353629 Log: MFV r353628: 10842 Mutex leak in dsl_dataset_hold_obj() illumos/illumos-gate@ad027c0ff9612bff8f47b43d8561da627f80cd29 https://github.com/illumos/illumos-gate/commit/ad027c0ff9612bff8f47b43d8561da627f80cd29 https://www.illumos.org/issues/10842 ZoL d10b2f1d35b Mutex leak in dsl_dataset_hold_obj() Portions contributed by: Jerry Jelinek Author: Jorgen Lundman Obtained from: illumos, ZoL MFC after: 15 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Oct 16 07:54:32 2019 (r353628) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Oct 16 07:57:58 2019 (r353629) @@ -573,10 +573,14 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uint64_t dsobj, v if (ds->ds_prev) dsl_dataset_rele(ds->ds_prev, ds); dsl_dir_rele(ds->ds_dir, ds); + list_destroy(&ds->ds_prop_cbs); + list_destroy(&ds->ds_sendstreams); mutex_destroy(&ds->ds_lock); mutex_destroy(&ds->ds_opening_lock); mutex_destroy(&ds->ds_sendstream_lock); + mutex_destroy(&ds->ds_remap_deadlist_lock); zfs_refcount_destroy(&ds->ds_longholds); + rrw_destroy(&ds->ds_bp_rwlock); kmem_free(ds, sizeof (dsl_dataset_t)); if (err != 0) { dmu_buf_rele(dbuf, tag); From owner-svn-src-all@freebsd.org Wed Oct 16 08:01:41 2019 Return-Path: Delivered-To: svn-src-all@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 8930915EAD1; Wed, 16 Oct 2019 08:01:41 +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 46tPrj3vRqz4QHw; Wed, 16 Oct 2019 08:01:41 +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 6A83F4083; Wed, 16 Oct 2019 08:01:41 +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 x9G81fE3032526; Wed, 16 Oct 2019 08:01:41 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G81bLV032502; Wed, 16 Oct 2019 08:01:37 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160801.x9G81bLV032502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 08:01:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353630 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys vendor/illumos/dist/lib/libzfs/common vendor/ill... X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys vendor/illumos/dist/lib/libzfs/common vendor/illumos/dist/lib/libzpool/co... X-SVN-Commit-Revision: 353630 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 08:01:41 -0000 Author: avg Date: Wed Oct 16 08:01:36 2019 New Revision: 353630 URL: https://svnweb.freebsd.org/changeset/base/353630 Log: 10809 Performance optimization of AVL tree comparator functions illumos/illumos-gate@c4ab0d3f46036e85ad0700125c5a83cc139f55a3 https://github.com/illumos/illumos-gate/commit/c4ab0d3f46036e85ad0700125c5a83cc139f55a3 https://www.illumos.org/issues/10809 Port ZoL ee36c709c3d Performance optimization of AVL tree comparator functions From the ZoL commit msg: perf: 2.75x faster ddt_entry_compare() First 256bits of ddt_key_t is a block checksum, which are expected to be close to random data. Hence, on average, comparison only needs to look at first few bytes of the keys. To reduce number of conditional jump instructions, the result is computed as: sign(memcmp(k1, k2)). Sign of an integer 'a' can be obtained as: `(0 < a) - (a < 0)` := {-1, 0, 1}, which is computed efficiently. Synthetic performance evaluation of original and new algorithm over 1G random keys on 2.6GHz Intel(R) Xeon(R) CPU E5-2660 v3: old 6.85789 s new 2.49089 s perf: 2.8x faster vdev_queue_offset_compare() and vdev_queue_timestamp_compare() Compute the result directly instead of using conditionals perf: zfs_range_compare() Speedup between 1.1x - 2.5x, depending on compiler version and optimization level. perf: spa_error_entry_compare() `bcmp()` is not suitable for comparator use. Use `memcmp()` instead. perf: 2.8x faster metaslab_compare() and metaslab_rangesize_compare() perf: 2.8x faster zil_bp_compare() Portions contributed by: Jerry Jelinek Author: Gvozden Neskovic Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/ddt.c vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deadlist.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deleg.c vendor-sys/illumos/dist/uts/common/fs/zfs/lz4.c vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c vendor-sys/illumos/dist/uts/common/fs/zfs/range_tree.c vendor-sys/illumos/dist/uts/common/fs/zfs/sa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/illumos/dist/uts/common/fs/zfs/space_reftree.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_context.h vendor-sys/illumos/dist/uts/common/fs/zfs/unique.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_cache.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_queue.c vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_fuid.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_rlock.c vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c vendor-sys/illumos/dist/uts/common/sys/avl.h Changes in other areas also in this revision: Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c vendor/illumos/dist/lib/libzfs/common/libzfs_iter.c vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/ddt.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/ddt.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/ddt.c Wed Oct 16 08:01:36 2019 (r353630) @@ -755,22 +755,31 @@ ddt_prefetch(spa_t *spa, const blkptr_t *bp) } } +/* + * Opaque struct used for ddt_key comparison + */ +#define DDT_KEY_CMP_LEN (sizeof (ddt_key_t) / sizeof (uint16_t)) + +typedef struct ddt_key_cmp { + uint16_t u16[DDT_KEY_CMP_LEN]; +} ddt_key_cmp_t; + int ddt_entry_compare(const void *x1, const void *x2) { const ddt_entry_t *dde1 = x1; const ddt_entry_t *dde2 = x2; - const uint64_t *u1 = (const uint64_t *)&dde1->dde_key; - const uint64_t *u2 = (const uint64_t *)&dde2->dde_key; + const ddt_key_cmp_t *k1 = (const ddt_key_cmp_t *)&dde1->dde_key; + const ddt_key_cmp_t *k2 = (const ddt_key_cmp_t *)&dde2->dde_key; + int32_t cmp = 0; - for (int i = 0; i < DDT_KEY_WORDS; i++) { - if (u1[i] < u2[i]) - return (-1); - if (u1[i] > u2[i]) - return (1); + for (int i = 0; i < DDT_KEY_CMP_LEN; i++) { + cmp = (int32_t)k1->u16[i] - (int32_t)k2->u16[i]; + if (likely(cmp)) + break; } - return (0); + return (AVL_ISIGN(cmp)); } static ddt_t * Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c Wed Oct 16 08:01:36 2019 (r353630) @@ -90,19 +90,13 @@ dbuf_compare(const void *x1, const void *x2) const dmu_buf_impl_t *d1 = x1; const dmu_buf_impl_t *d2 = x2; - if (d1->db_level < d2->db_level) { - return (-1); - } - if (d1->db_level > d2->db_level) { - return (1); - } + int cmp = AVL_CMP(d1->db_level, d2->db_level); + if (likely(cmp)) + return (cmp); - if (d1->db_blkid < d2->db_blkid) { - return (-1); - } - if (d1->db_blkid > d2->db_blkid) { - return (1); - } + cmp = AVL_CMP(d1->db_blkid, d2->db_blkid); + if (likely(cmp)) + return (cmp); if (d1->db_state == DB_SEARCH) { ASSERT3S(d2->db_state, !=, DB_SEARCH); @@ -112,13 +106,7 @@ dbuf_compare(const void *x1, const void *x2) return (1); } - if ((uintptr_t)d1 < (uintptr_t)d2) { - return (-1); - } - if ((uintptr_t)d1 > (uintptr_t)d2) { - return (1); - } - return (0); + return (AVL_PCMP(d1, d2)); } /* ARGSUSED */ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deadlist.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deadlist.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deadlist.c Wed Oct 16 08:01:36 2019 (r353630) @@ -55,15 +55,10 @@ static int dsl_deadlist_compare(const void *arg1, const void *arg2) { - const dsl_deadlist_entry_t *dle1 = arg1; - const dsl_deadlist_entry_t *dle2 = arg2; + const dsl_deadlist_entry_t *dle1 = (const dsl_deadlist_entry_t *)arg1; + const dsl_deadlist_entry_t *dle2 = (const dsl_deadlist_entry_t *)arg2; - if (dle1->dle_mintxg < dle2->dle_mintxg) - return (-1); - else if (dle1->dle_mintxg > dle2->dle_mintxg) - return (+1); - else - return (0); + return (AVL_CMP(dle1->dle_mintxg, dle2->dle_mintxg)); } static void Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deleg.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deleg.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deleg.c Wed Oct 16 08:01:36 2019 (r353630) @@ -384,14 +384,13 @@ typedef struct perm_set { static int perm_set_compare(const void *arg1, const void *arg2) { - const perm_set_t *node1 = arg1; - const perm_set_t *node2 = arg2; + const perm_set_t *node1 = (const perm_set_t *)arg1; + const perm_set_t *node2 = (const perm_set_t *)arg2; int val; val = strcmp(node1->p_setname, node2->p_setname); - if (val == 0) - return (0); - return (val > 0 ? 1 : -1); + + return (AVL_ISIGN(val)); } /* Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/lz4.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/lz4.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/lz4.c Wed Oct 16 08:01:36 2019 (r353630) @@ -284,8 +284,13 @@ lz4_decompress(void *s_start, void *d_start, size_t s_ #define expect(expr, value) (expr) #endif +#ifndef likely #define likely(expr) expect((expr) != 0, 1) +#endif + +#ifndef unlikely #define unlikely(expr) expect((expr) != 0, 0) +#endif /* Basic types */ #if defined(_MSC_VER) Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c Wed Oct 16 08:01:36 2019 (r353630) @@ -451,8 +451,8 @@ metaslab_class_expandable_space(metaslab_class_t *mc) static int metaslab_compare(const void *x1, const void *x2) { - const metaslab_t *m1 = x1; - const metaslab_t *m2 = x2; + const metaslab_t *m1 = (const metaslab_t *)x1; + const metaslab_t *m2 = (const metaslab_t *)x2; int sort1 = 0; int sort2 = 0; @@ -478,22 +478,13 @@ metaslab_compare(const void *x1, const void *x2) if (sort1 > sort2) return (1); - if (m1->ms_weight < m2->ms_weight) - return (1); - if (m1->ms_weight > m2->ms_weight) - return (-1); + int cmp = AVL_CMP(m2->ms_weight, m1->ms_weight); + if (likely(cmp)) + return (cmp); - /* - * If the weights are identical, use the offset to force uniqueness. - */ - if (m1->ms_start < m2->ms_start) - return (-1); - if (m1->ms_start > m2->ms_start) - return (1); + IMPLY(AVL_CMP(m1->ms_start, m2->ms_start) == 0, m1 == m2); - ASSERT3P(m1, ==, m2); - - return (0); + return (AVL_CMP(m1->ms_start, m2->ms_start)); } /* @@ -1104,18 +1095,11 @@ metaslab_rangesize_compare(const void *x1, const void uint64_t rs_size1 = r1->rs_end - r1->rs_start; uint64_t rs_size2 = r2->rs_end - r2->rs_start; - if (rs_size1 < rs_size2) - return (-1); - if (rs_size1 > rs_size2) - return (1); + int cmp = AVL_CMP(rs_size1, rs_size2); + if (likely(cmp)) + return (cmp); - if (r1->rs_start < r2->rs_start) - return (-1); - - if (r1->rs_start > r2->rs_start) - return (1); - - return (0); + return (AVL_CMP(r1->rs_start, r2->rs_start)); } /* Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/range_tree.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/range_tree.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/range_tree.c Wed Oct 16 08:01:36 2019 (r353630) @@ -109,20 +109,13 @@ range_tree_stat_decr(range_tree_t *rt, range_seg_t *rs static int range_tree_seg_compare(const void *x1, const void *x2) { - const range_seg_t *r1 = x1; - const range_seg_t *r2 = x2; + const range_seg_t *r1 = (const range_seg_t *)x1; + const range_seg_t *r2 = (const range_seg_t *)x2; - if (r1->rs_start < r2->rs_start) { - if (r1->rs_end > r2->rs_start) - return (0); - return (-1); - } - if (r1->rs_start > r2->rs_start) { - if (r1->rs_start < r2->rs_end) - return (0); - return (1); - } - return (0); + ASSERT3U(r1->rs_start, <=, r1->rs_end); + ASSERT3U(r2->rs_start, <=, r2->rs_end); + + return ((r1->rs_start >= r2->rs_end) - (r1->rs_end <= r2->rs_start)); } range_tree_t * Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sa.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sa.c Wed Oct 16 08:01:36 2019 (r353630) @@ -243,31 +243,23 @@ sa_cache_fini(void) static int layout_num_compare(const void *arg1, const void *arg2) { - const sa_lot_t *node1 = arg1; - const sa_lot_t *node2 = arg2; + const sa_lot_t *node1 = (const sa_lot_t *)arg1; + const sa_lot_t *node2 = (const sa_lot_t *)arg2; - if (node1->lot_num > node2->lot_num) - return (1); - else if (node1->lot_num < node2->lot_num) - return (-1); - return (0); + return (AVL_CMP(node1->lot_num, node2->lot_num)); } static int layout_hash_compare(const void *arg1, const void *arg2) { - const sa_lot_t *node1 = arg1; - const sa_lot_t *node2 = arg2; + const sa_lot_t *node1 = (const sa_lot_t *)arg1; + const sa_lot_t *node2 = (const sa_lot_t *)arg2; - if (node1->lot_hash > node2->lot_hash) - return (1); - if (node1->lot_hash < node2->lot_hash) - return (-1); - if (node1->lot_instance > node2->lot_instance) - return (1); - if (node1->lot_instance < node2->lot_instance) - return (-1); - return (0); + int cmp = AVL_CMP(node1->lot_hash, node2->lot_hash); + if (likely(cmp)) + return (cmp); + + return (AVL_CMP(node1->lot_instance, node2->lot_instance)); } boolean_t Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Oct 16 08:01:36 2019 (r353630) @@ -882,19 +882,14 @@ spa_change_guid(spa_t *spa) static int spa_error_entry_compare(const void *a, const void *b) { - spa_error_entry_t *sa = (spa_error_entry_t *)a; - spa_error_entry_t *sb = (spa_error_entry_t *)b; + const spa_error_entry_t *sa = (const spa_error_entry_t *)a; + const spa_error_entry_t *sb = (const spa_error_entry_t *)b; int ret; - ret = bcmp(&sa->se_bookmark, &sb->se_bookmark, + ret = memcmp(&sa->se_bookmark, &sb->se_bookmark, sizeof (zbookmark_phys_t)); - if (ret < 0) - return (-1); - else if (ret > 0) - return (1); - else - return (0); + return (AVL_ISIGN(ret)); } /* Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c Wed Oct 16 08:01:36 2019 (r353630) @@ -897,18 +897,13 @@ typedef struct spa_aux { int aux_count; } spa_aux_t; -static int +static inline int spa_aux_compare(const void *a, const void *b) { - const spa_aux_t *sa = a; - const spa_aux_t *sb = b; + const spa_aux_t *sa = (const spa_aux_t *)a; + const spa_aux_t *sb = (const spa_aux_t *)b; - if (sa->aux_guid < sb->aux_guid) - return (-1); - else if (sa->aux_guid > sb->aux_guid) - return (1); - else - return (0); + return (AVL_CMP(sa->aux_guid, sb->aux_guid)); } void @@ -1878,11 +1873,8 @@ spa_name_compare(const void *a1, const void *a2) int s; s = strcmp(s1->spa_name, s2->spa_name); - if (s > 0) - return (1); - if (s < 0) - return (-1); - return (0); + + return (AVL_ISIGN(s)); } int Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/space_reftree.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/space_reftree.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/space_reftree.c Wed Oct 16 08:01:36 2019 (r353630) @@ -54,20 +54,14 @@ static int space_reftree_compare(const void *x1, const void *x2) { - const space_ref_t *sr1 = x1; - const space_ref_t *sr2 = x2; + const space_ref_t *sr1 = (const space_ref_t *)x1; + const space_ref_t *sr2 = (const space_ref_t *)x2; - if (sr1->sr_offset < sr2->sr_offset) - return (-1); - if (sr1->sr_offset > sr2->sr_offset) - return (1); + int cmp = AVL_CMP(sr1->sr_offset, sr2->sr_offset); + if (likely(cmp)) + return (cmp); - if (sr1 < sr2) - return (-1); - if (sr1 > sr2) - return (1); - - return (0); + return (AVL_PCMP(sr1, sr2)); } void Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_context.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_context.h Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_context.h Wed Oct 16 08:01:36 2019 (r353630) @@ -73,6 +73,14 @@ extern "C" { #include #include +#if (GCC_VERSION >= 302) || (__INTEL_COMPILER >= 800) || defined(__clang__) +#define _zfs_expect(expr, value) (__builtin_expect((expr), (value))) +#else +#define _zfs_expect(expr, value) (expr) +#endif + +#define likely(x) _zfs_expect((x) != 0, 1) + #define CPU_SEQID (CPU->cpu_seqid) #ifdef __cplusplus Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/unique.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/unique.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/unique.c Wed Oct 16 08:01:36 2019 (r353630) @@ -42,14 +42,10 @@ typedef struct unique { static int unique_compare(const void *a, const void *b) { - const unique_t *una = a; - const unique_t *unb = b; + const unique_t *una = (const unique_t *)a; + const unique_t *unb = (const unique_t *)b; - if (una->un_value < unb->un_value) - return (-1); - if (una->un_value > unb->un_value) - return (+1); - return (0); + return (AVL_CMP(una->un_value, unb->un_value)); } void Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_cache.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_cache.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_cache.c Wed Oct 16 08:01:36 2019 (r353630) @@ -105,29 +105,24 @@ static vdc_stats_t vdc_stats = { #define VDCSTAT_BUMP(stat) atomic_inc_64(&vdc_stats.stat.value.ui64); -static int +static inline int vdev_cache_offset_compare(const void *a1, const void *a2) { - const vdev_cache_entry_t *ve1 = a1; - const vdev_cache_entry_t *ve2 = a2; + const vdev_cache_entry_t *ve1 = (const vdev_cache_entry_t *)a1; + const vdev_cache_entry_t *ve2 = (const vdev_cache_entry_t *)a2; - if (ve1->ve_offset < ve2->ve_offset) - return (-1); - if (ve1->ve_offset > ve2->ve_offset) - return (1); - return (0); + return (AVL_CMP(ve1->ve_offset, ve2->ve_offset)); } static int vdev_cache_lastused_compare(const void *a1, const void *a2) { - const vdev_cache_entry_t *ve1 = a1; - const vdev_cache_entry_t *ve2 = a2; + const vdev_cache_entry_t *ve1 = (const vdev_cache_entry_t *)a1; + const vdev_cache_entry_t *ve2 = (const vdev_cache_entry_t *)a2; - if (ve1->ve_lastused < ve2->ve_lastused) - return (-1); - if (ve1->ve_lastused > ve2->ve_lastused) - return (1); + int cmp = AVL_CMP(ve1->ve_lastused, ve2->ve_lastused); + if (likely(cmp)) + return (cmp); /* * Among equally old entries, sort by offset to ensure uniqueness. Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c Wed Oct 16 08:01:36 2019 (r353630) @@ -989,19 +989,13 @@ retry: * among uberblocks with equal txg, choose the one with the latest timestamp. */ static int -vdev_uberblock_compare(uberblock_t *ub1, uberblock_t *ub2) +vdev_uberblock_compare(const uberblock_t *ub1, const uberblock_t *ub2) { - if (ub1->ub_txg < ub2->ub_txg) - return (-1); - if (ub1->ub_txg > ub2->ub_txg) - return (1); + int cmp = AVL_CMP(ub1->ub_txg, ub2->ub_txg); + if (likely(cmp)) + return (cmp); - if (ub1->ub_timestamp < ub2->ub_timestamp) - return (-1); - if (ub1->ub_timestamp > ub2->ub_timestamp) - return (1); - - return (0); + return (AVL_CMP(ub1->ub_timestamp, ub2->ub_timestamp)); } struct ubl_cbdata { Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_queue.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_queue.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_queue.c Wed Oct 16 08:01:36 2019 (r353630) @@ -202,20 +202,15 @@ int zfs_vdev_def_queue_depth = 32; int vdev_queue_offset_compare(const void *x1, const void *x2) { - const zio_t *z1 = x1; - const zio_t *z2 = x2; + const zio_t *z1 = (const zio_t *)x1; + const zio_t *z2 = (const zio_t *)x2; - if (z1->io_offset < z2->io_offset) - return (-1); - if (z1->io_offset > z2->io_offset) - return (1); + int cmp = AVL_CMP(z1->io_offset, z2->io_offset); - if (z1 < z2) - return (-1); - if (z1 > z2) - return (1); + if (likely(cmp)) + return (cmp); - return (0); + return (AVL_PCMP(z1, z2)); } static inline avl_tree_t * @@ -237,20 +232,15 @@ vdev_queue_type_tree(vdev_queue_t *vq, zio_type_t t) int vdev_queue_timestamp_compare(const void *x1, const void *x2) { - const zio_t *z1 = x1; - const zio_t *z2 = x2; + const zio_t *z1 = (const zio_t *)x1; + const zio_t *z2 = (const zio_t *)x2; - if (z1->io_timestamp < z2->io_timestamp) - return (-1); - if (z1->io_timestamp > z2->io_timestamp) - return (1); + int cmp = AVL_CMP(z1->io_timestamp, z2->io_timestamp); - if (z1 < z2) - return (-1); - if (z1 > z2) - return (1); + if (likely(cmp)) + return (cmp); - return (0); + return (AVL_PCMP(z1, z2)); } void Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c Wed Oct 16 08:01:36 2019 (r353630) @@ -281,15 +281,11 @@ mze_compare(const void *arg1, const void *arg2) const mzap_ent_t *mze1 = arg1; const mzap_ent_t *mze2 = arg2; - if (mze1->mze_hash > mze2->mze_hash) - return (+1); - if (mze1->mze_hash < mze2->mze_hash) - return (-1); - if (mze1->mze_cd > mze2->mze_cd) - return (+1); - if (mze1->mze_cd < mze2->mze_cd) - return (-1); - return (0); + int cmp = AVL_CMP(mze1->mze_hash, mze2->mze_hash); + if (likely(cmp)) + return (cmp); + + return (AVL_CMP(mze1->mze_cd, mze2->mze_cd)); } static void Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_fuid.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_fuid.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_fuid.c Wed Oct 16 08:01:36 2019 (r353630) @@ -71,14 +71,10 @@ static char *nulldomain = ""; static int idx_compare(const void *arg1, const void *arg2) { - const fuid_domain_t *node1 = arg1; - const fuid_domain_t *node2 = arg2; + const fuid_domain_t *node1 = (const fuid_domain_t *)arg1; + const fuid_domain_t *node2 = (const fuid_domain_t *)arg2; - if (node1->f_idx < node2->f_idx) - return (-1); - else if (node1->f_idx > node2->f_idx) - return (1); - return (0); + return (AVL_CMP(node1->f_idx, node2->f_idx)); } /* @@ -87,14 +83,13 @@ idx_compare(const void *arg1, const void *arg2) static int domain_compare(const void *arg1, const void *arg2) { - const fuid_domain_t *node1 = arg1; - const fuid_domain_t *node2 = arg2; + const fuid_domain_t *node1 = (const fuid_domain_t *)arg1; + const fuid_domain_t *node2 = (const fuid_domain_t *)arg2; int val; val = strcmp(node1->f_ksid->kd_name, node2->f_ksid->kd_name); - if (val == 0) - return (0); - return (val > 0 ? 1 : -1); + + return (AVL_ISIGN(val)); } void Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_rlock.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_rlock.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_rlock.c Wed Oct 16 08:01:36 2019 (r353630) @@ -106,14 +106,10 @@ static int rangelock_compare(const void *arg1, const void *arg2) { - const locked_range_t *rl1 = arg1; - const locked_range_t *rl2 = arg2; + const locked_range_t *rl1 = (const locked_range_t *)arg1; + const locked_range_t *rl2 = (const locked_range_t *)arg2; - if (rl1->lr_offset > rl2->lr_offset) - return (1); - if (rl1->lr_offset < rl2->lr_offset) - return (-1); - return (0); + return (AVL_CMP(rl1->lr_offset, rl2->lr_offset)); } /* Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Wed Oct 16 08:01:36 2019 (r353630) @@ -123,17 +123,11 @@ zil_bp_compare(const void *x1, const void *x2) const dva_t *dva1 = &((zil_bp_node_t *)x1)->zn_dva; const dva_t *dva2 = &((zil_bp_node_t *)x2)->zn_dva; - if (DVA_GET_VDEV(dva1) < DVA_GET_VDEV(dva2)) - return (-1); - if (DVA_GET_VDEV(dva1) > DVA_GET_VDEV(dva2)) - return (1); + int cmp = AVL_CMP(DVA_GET_VDEV(dva1), DVA_GET_VDEV(dva2)); + if (likely(cmp)) + return (cmp); - if (DVA_GET_OFFSET(dva1) < DVA_GET_OFFSET(dva2)) - return (-1); - if (DVA_GET_OFFSET(dva1) > DVA_GET_OFFSET(dva2)) - return (1); - - return (0); + return (AVL_CMP(DVA_GET_OFFSET(dva1), DVA_GET_OFFSET(dva2))); } static void @@ -495,12 +489,7 @@ zil_lwb_vdev_compare(const void *x1, const void *x2) const uint64_t v1 = ((zil_vdev_node_t *)x1)->zv_vdev; const uint64_t v2 = ((zil_vdev_node_t *)x2)->zv_vdev; - if (v1 < v2) - return (-1); - if (v1 > v2) - return (1); - - return (0); + return (AVL_CMP(v1, v2)); } static lwb_t * @@ -1729,12 +1718,7 @@ zil_aitx_compare(const void *x1, const void *x2) const uint64_t o1 = ((itx_async_node_t *)x1)->ia_foid; const uint64_t o2 = ((itx_async_node_t *)x2)->ia_foid; - if (o1 < o2) - return (-1); - if (o1 > o2) - return (1); - - return (0); + return (AVL_CMP(o1, o2)); } /* Modified: vendor-sys/illumos/dist/uts/common/sys/avl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/avl.h Wed Oct 16 07:57:58 2019 (r353629) +++ vendor-sys/illumos/dist/uts/common/sys/avl.h Wed Oct 16 08:01:36 2019 (r353630) @@ -105,6 +105,13 @@ extern "C" { * as is needed for any linked list implementation. */ +/* + * AVL comparator helpers + */ +#define AVL_ISIGN(a) (((a) > 0) - ((a) < 0)) +#define AVL_CMP(a, b) (((a) > (b)) - ((a) < (b))) +#define AVL_PCMP(a, b) \ + (((uintptr_t)(a) > (uintptr_t)(b)) - ((uintptr_t)(a) < (uintptr_t)(b))) /* * Type used for the root of the AVL tree. From owner-svn-src-all@freebsd.org Wed Oct 16 08:01:42 2019 Return-Path: Delivered-To: svn-src-all@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 A27E115EAE5; Wed, 16 Oct 2019 08:01:42 +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 46tPrk3skQz4QJ6; Wed, 16 Oct 2019 08:01:42 +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 68A574086; Wed, 16 Oct 2019 08:01:42 +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 x9G81gKk032535; Wed, 16 Oct 2019 08:01:42 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G81f0e032531; Wed, 16 Oct 2019 08:01:41 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160801.x9G81f0e032531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 08:01:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353630 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys vendor/illumos/dist/lib/libzfs/common vendor/ill... X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys vendor/illumos/dist/lib/libzfs/common vendor/illumos/dist/lib/libzpool/co... X-SVN-Commit-Revision: 353630 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 08:01:42 -0000 Author: avg Date: Wed Oct 16 08:01:36 2019 New Revision: 353630 URL: https://svnweb.freebsd.org/changeset/base/353630 Log: 10809 Performance optimization of AVL tree comparator functions illumos/illumos-gate@c4ab0d3f46036e85ad0700125c5a83cc139f55a3 https://github.com/illumos/illumos-gate/commit/c4ab0d3f46036e85ad0700125c5a83cc139f55a3 https://www.illumos.org/issues/10809 Port ZoL ee36c709c3d Performance optimization of AVL tree comparator functions From the ZoL commit msg: perf: 2.75x faster ddt_entry_compare() First 256bits of ddt_key_t is a block checksum, which are expected to be close to random data. Hence, on average, comparison only needs to look at first few bytes of the keys. To reduce number of conditional jump instructions, the result is computed as: sign(memcmp(k1, k2)). Sign of an integer 'a' can be obtained as: `(0 < a) - (a < 0)` := {-1, 0, 1}, which is computed efficiently. Synthetic performance evaluation of original and new algorithm over 1G random keys on 2.6GHz Intel(R) Xeon(R) CPU E5-2660 v3: old 6.85789 s new 2.49089 s perf: 2.8x faster vdev_queue_offset_compare() and vdev_queue_timestamp_compare() Compute the result directly instead of using conditionals perf: zfs_range_compare() Speedup between 1.1x - 2.5x, depending on compiler version and optimization level. perf: spa_error_entry_compare() `bcmp()` is not suitable for comparator use. Use `memcmp()` instead. perf: 2.8x faster metaslab_compare() and metaslab_rangesize_compare() perf: 2.8x faster zil_bp_compare() Portions contributed by: Jerry Jelinek Author: Gvozden Neskovic Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c vendor/illumos/dist/lib/libzfs/common/libzfs_iter.c vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/ddt.c vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deadlist.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deleg.c vendor-sys/illumos/dist/uts/common/fs/zfs/lz4.c vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c vendor-sys/illumos/dist/uts/common/fs/zfs/range_tree.c vendor-sys/illumos/dist/uts/common/fs/zfs/sa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/illumos/dist/uts/common/fs/zfs/space_reftree.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_context.h vendor-sys/illumos/dist/uts/common/fs/zfs/unique.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_cache.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_queue.c vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_fuid.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_rlock.c vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c vendor-sys/illumos/dist/uts/common/sys/avl.h Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Wed Oct 16 08:01:36 2019 (r353630) @@ -772,15 +772,13 @@ typedef struct mnttab_node { static int libzfs_mnttab_cache_compare(const void *arg1, const void *arg2) { - const mnttab_node_t *mtn1 = arg1; - const mnttab_node_t *mtn2 = arg2; + const mnttab_node_t *mtn1 = (const mnttab_node_t *)arg1; + const mnttab_node_t *mtn2 = (const mnttab_node_t *)arg2; int rv; rv = strcmp(mtn1->mtn_mt.mnt_special, mtn2->mtn_mt.mnt_special); - if (rv == 0) - return (0); - return (rv > 0 ? 1 : -1); + return (AVL_ISIGN(rv)); } void Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_iter.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_iter.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_iter.c Wed Oct 16 08:01:36 2019 (r353630) @@ -272,12 +272,7 @@ zfs_snapshot_compare(const void *larg, const void *rar lcreate = zfs_prop_get_int(l, ZFS_PROP_CREATETXG); rcreate = zfs_prop_get_int(r, ZFS_PROP_CREATETXG); - if (lcreate < rcreate) - return (-1); - else if (lcreate > rcreate) - return (+1); - else - return (0); + return (AVL_CMP(lcreate, rcreate)); } int Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c Wed Oct 16 07:57:58 2019 (r353629) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c Wed Oct 16 08:01:36 2019 (r353630) @@ -482,15 +482,10 @@ typedef struct fsavl_node { static int fsavl_compare(const void *arg1, const void *arg2) { - const fsavl_node_t *fn1 = arg1; - const fsavl_node_t *fn2 = arg2; + const fsavl_node_t *fn1 = (const fsavl_node_t *)arg1; + const fsavl_node_t *fn2 = (const fsavl_node_t *)arg2; - if (fn1->fn_guid > fn2->fn_guid) - return (+1); - else if (fn1->fn_guid < fn2->fn_guid) - return (-1); - else - return (0); + return (AVL_CMP(fn1->fn_guid, fn2->fn_guid)); } /* Modified: vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h Wed Oct 16 07:57:58 2019 (r353629) +++ vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h Wed Oct 16 08:01:36 2019 (r353630) @@ -285,6 +285,14 @@ extern vnode_t *rootdir; #define minclsyspri 60 #define maxclsyspri 99 +#if (GCC_VERSION >= 302) || (__INTEL_COMPILER >= 800) || defined(__clang__) +#define _zfs_expect(expr, value) (__builtin_expect((expr), (value))) +#else +#define _zfs_expect(expr, value) (expr) +#endif + +#define likely(x) _zfs_expect((x) != 0, 1) + #define CPU_SEQID (thr_self() & (max_ncpus - 1)) extern void kernel_init(int); From owner-svn-src-all@freebsd.org Wed Oct 16 08:40:58 2019 Return-Path: Delivered-To: svn-src-all@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 CD20215F79B; Wed, 16 Oct 2019 08:40:58 +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 46tQk256Dqz4S1t; Wed, 16 Oct 2019 08:40:58 +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 9403B475F; Wed, 16 Oct 2019 08:40:58 +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 x9G8ewck055672; Wed, 16 Oct 2019 08:40:58 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G8ewZW055671; Wed, 16 Oct 2019 08:40:58 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910160840.x9G8ewZW055671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 16 Oct 2019 08:40:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353631 - head/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Commit-Revision: 353631 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 08:40:58 -0000 Author: hselasky Date: Wed Oct 16 08:40:58 2019 New Revision: 353631 URL: https://svnweb.freebsd.org/changeset/base/353631 Log: VLAN_DEVAT() requires epochification in ipoib after r353292. Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Wed Oct 16 08:01:36 2019 (r353630) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Wed Oct 16 08:40:58 2019 (r353631) @@ -1315,13 +1315,16 @@ ipoib_config_vlan(void *arg, struct ifnet *ifp, u_int1 { struct ipoib_dev_priv *parent; struct ipoib_dev_priv *priv; + struct epoch_tracker et; struct ifnet *dev; uint16_t pkey; int error; if (ifp->if_type != IFT_INFINIBAND) return; + NET_EPOCH_ENTER(et); dev = VLAN_DEVAT(ifp, vtag); + NET_EPOCH_EXIT(et); if (dev == NULL) return; priv = NULL; @@ -1383,13 +1386,16 @@ ipoib_unconfig_vlan(void *arg, struct ifnet *ifp, u_in { struct ipoib_dev_priv *parent; struct ipoib_dev_priv *priv; + struct epoch_tracker et; struct ifnet *dev; uint16_t pkey; if (ifp->if_type != IFT_INFINIBAND) return; + NET_EPOCH_ENTER(et); dev = VLAN_DEVAT(ifp, vtag); + NET_EPOCH_EXIT(et); if (dev) VLAN_SETCOOKIE(dev, NULL); pkey = vtag | 0x8000; From owner-svn-src-all@freebsd.org Wed Oct 16 08:55:30 2019 Return-Path: Delivered-To: svn-src-all@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 C257215FAA2; Wed, 16 Oct 2019 08:55:30 +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 46tR2p4pl2z4Smq; Wed, 16 Oct 2019 08:55:30 +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 8387049AE; Wed, 16 Oct 2019 08:55:30 +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 x9G8tU8P065507; Wed, 16 Oct 2019 08:55:30 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G8tUJO065505; Wed, 16 Oct 2019 08:55:30 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910160855.x9G8tUJO065505@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 16 Oct 2019 08:55:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353632 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 353632 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 08:55:30 -0000 Author: hselasky Date: Wed Oct 16 08:55:29 2019 New Revision: 353632 URL: https://svnweb.freebsd.org/changeset/base/353632 Log: Replace rdma_is_upper_dev_rcu() with rdma_vlan_dev_real_dev() in ibcore. This reduces the number of references to VLAN_TRUNKDEV() in ibcore. Currently only VLAN is supported as a child interface in FreeBSD. Remove superfluous RCU locking. Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/core_priv.h head/sys/ofed/drivers/infiniband/core/ib_sa_query.c Modified: head/sys/ofed/drivers/infiniband/core/core_priv.h ============================================================================== --- head/sys/ofed/drivers/infiniband/core/core_priv.h Wed Oct 16 08:40:58 2019 (r353631) +++ head/sys/ofed/drivers/infiniband/core/core_priv.h Wed Oct 16 08:55:29 2019 (r353632) @@ -128,16 +128,6 @@ int ib_cache_setup_one(struct ib_device *device); void ib_cache_cleanup_one(struct ib_device *device); void ib_cache_release_one(struct ib_device *device); -static inline bool rdma_is_upper_dev_rcu(struct net_device *dev, - struct net_device *upper) -{ - - /* TODO: add support for LAGG */ - upper = VLAN_TRUNKDEV(upper); - - return (dev == upper); -} - int addr_init(void); void addr_cleanup(void); Modified: head/sys/ofed/drivers/infiniband/core/ib_sa_query.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_sa_query.c Wed Oct 16 08:40:58 2019 (r353631) +++ head/sys/ofed/drivers/infiniband/core/ib_sa_query.c Wed Oct 16 08:55:29 2019 (r353632) @@ -702,12 +702,10 @@ int ib_init_ah_from_path(struct ib_device *device, u8 return -ENODEV; } ndev = ib_get_ndev_from_path(rec); - rcu_read_lock(); if ((ndev && ndev != resolved_dev) || (resolved_dev != idev && - !rdma_is_upper_dev_rcu(idev, resolved_dev))) + rdma_vlan_dev_real_dev(resolved_dev) != idev)) ret = -EHOSTUNREACH; - rcu_read_unlock(); dev_put(idev); dev_put(resolved_dev); if (ret) { From owner-svn-src-all@freebsd.org Wed Oct 16 08:56:08 2019 Return-Path: Delivered-To: svn-src-all@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 244AB15FB13; Wed, 16 Oct 2019 08:56:08 +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 46tR3X09pQz4Svb; Wed, 16 Oct 2019 08:56:08 +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 DEB8749AF; Wed, 16 Oct 2019 08:56:07 +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 x9G8u7i7065579; Wed, 16 Oct 2019 08:56:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G8u7Sg065578; Wed, 16 Oct 2019 08:56:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910160856.x9G8u7Sg065578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 16 Oct 2019 08:56:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353633 - head/sys/ofed/include/rdma X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/ofed/include/rdma X-SVN-Commit-Revision: 353633 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 08:56:08 -0000 Author: hselasky Date: Wed Oct 16 08:56:07 2019 New Revision: 353633 URL: https://svnweb.freebsd.org/changeset/base/353633 Log: VLAN_TRUNKDEV() requires epochification in ibcore after r353292. Sponsored by: Mellanox Technologies Modified: head/sys/ofed/include/rdma/ib_addr.h Modified: head/sys/ofed/include/rdma/ib_addr.h ============================================================================== --- head/sys/ofed/include/rdma/ib_addr.h Wed Oct 16 08:55:29 2019 (r353632) +++ head/sys/ofed/include/rdma/ib_addr.h Wed Oct 16 08:56:07 2019 (r353633) @@ -354,9 +354,13 @@ static inline u16 rdma_get_vlan_id(union ib_gid *dgid) static inline struct net_device *rdma_vlan_dev_real_dev(struct net_device *dev) { - if (dev->if_type == IFT_ETHER && dev->if_pcp != IFNET_PCP_NONE) - return dev; /* prio-tagged traffic */ - return VLAN_TRUNKDEV(__DECONST(struct ifnet *, dev)); + struct epoch_tracker et; + + NET_EPOCH_ENTER(et); + if (dev->if_type != IFT_ETHER || dev->if_pcp == IFNET_PCP_NONE) + dev = VLAN_TRUNKDEV(dev); /* non prio-tagged traffic */ + NET_EPOCH_EXIT(et); + return (dev); } #endif /* IB_ADDR_H */ From owner-svn-src-all@freebsd.org Wed Oct 16 09:04:55 2019 Return-Path: Delivered-To: svn-src-all@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 34E2E15FEDF; Wed, 16 Oct 2019 09:04:55 +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 46tRFg1LD2z4TLL; Wed, 16 Oct 2019 09:04:55 +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 0CE5E4B80; Wed, 16 Oct 2019 09:04:55 +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 x9G94tm1071326; Wed, 16 Oct 2019 09:04:55 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G94sRK071320; Wed, 16 Oct 2019 09:04:54 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160904.x9G94sRK071320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 09:04:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353634 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 353634 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 09:04:55 -0000 Author: avg Date: Wed Oct 16 09:04:53 2019 New Revision: 353634 URL: https://svnweb.freebsd.org/changeset/base/353634 Log: MFV r348596: 9689 zfs range lock code should not be zpl-specific illumos/illumos-gate@7931524763ef94dc16989451dddd206563d03bb4 FreeBSD note: some tweaking was needed to avoid a conflict with sys/rangelock.h. Author: Matthew Ahrens Obtained from: illumos MFC after: 3 weeks Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_rlock.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Wed Oct 16 08:56:07 2019 (r353633) +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Wed Oct 16 09:04:53 2019 (r353634) @@ -242,7 +242,9 @@ typedef struct bufwad { } bufwad_t; /* - * XXX -- fix zfs range locks to be generic so we can use them here. + * It would be better to use a rangelock_t per object. Unfortunately + * the rangelock_t is not a drop-in replacement for rl_t, because we + * still need to map from object ID to rangelock_t. */ typedef enum { RL_READER, @@ -1943,12 +1945,12 @@ static void ztest_get_done(zgd_t *zgd, int error) { ztest_ds_t *zd = zgd->zgd_private; - uint64_t object = zgd->zgd_rl->rl_object; + uint64_t object = ((rl_t *)zgd->zgd_lr)->rl_object; if (zgd->zgd_db) dmu_buf_rele(zgd->zgd_db, zgd); - ztest_range_unlock(zgd->zgd_rl); + ztest_range_unlock((rl_t *)zgd->zgd_lr); ztest_object_unlock(zd, object); umem_free(zgd, sizeof (*zgd)); @@ -1998,8 +2000,8 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, s zgd->zgd_private = zd; if (buf != NULL) { /* immediate write */ - zgd->zgd_rl = ztest_range_lock(zd, object, offset, size, - RL_READER); + zgd->zgd_lr = (struct locked_range *)ztest_range_lock(zd, + object, offset, size, RL_READER); error = dmu_read(os, object, offset, size, buf, DMU_READ_NO_PREFETCH); @@ -2013,8 +2015,8 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, s offset = 0; } - zgd->zgd_rl = ztest_range_lock(zd, object, offset, size, - RL_READER); + zgd->zgd_lr = (struct locked_range *)ztest_range_lock(zd, + object, offset, size, RL_READER); error = dmu_buf_hold(os, object, offset, zgd, &db, DMU_READ_NO_PREFETCH); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Oct 16 08:56:07 2019 (r353633) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Oct 16 09:04:53 2019 (r353634) @@ -75,6 +75,7 @@ struct arc_buf; struct zio_prop; struct sa_handle; struct file; +struct locked_range; typedef struct objset objset_t; typedef struct dmu_tx dmu_tx_t; @@ -966,7 +967,7 @@ typedef struct zgd { struct lwb *zgd_lwb; struct blkptr *zgd_bp; dmu_buf_t *zgd_db; - struct rl *zgd_rl; + struct locked_range *zgd_lr; void *zgd_private; } zgd_t; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_rlock.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_rlock.h Wed Oct 16 08:56:07 2019 (r353633) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_rlock.h Wed Oct 16 09:04:53 2019 (r353634) @@ -22,6 +22,9 @@ * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright (c) 2018 by Delphix. All rights reserved. + */ #ifndef _SYS_FS_ZFS_RLOCK_H #define _SYS_FS_ZFS_RLOCK_H @@ -30,54 +33,53 @@ extern "C" { #endif -#ifdef _KERNEL +#ifdef __FreeBSD__ +#define rangelock_init zfs_rangelock_init +#define rangelock_fini zfs_rangelock_fini +#endif -#include - typedef enum { RL_READER, RL_WRITER, RL_APPEND -} rl_type_t; +} rangelock_type_t; -typedef struct rl { - znode_t *r_zp; /* znode this lock applies to */ - avl_node_t r_node; /* avl node link */ - uint64_t r_off; /* file range offset */ - uint64_t r_len; /* file range length */ - uint_t r_cnt; /* range reference count in tree */ - rl_type_t r_type; /* range type */ - kcondvar_t r_wr_cv; /* cv for waiting writers */ - kcondvar_t r_rd_cv; /* cv for waiting readers */ - uint8_t r_proxy; /* acting for original range */ - uint8_t r_write_wanted; /* writer wants to lock this range */ - uint8_t r_read_wanted; /* reader wants to lock this range */ -} rl_t; +struct locked_range; -/* - * Lock a range (offset, length) as either shared (RL_READER) - * or exclusive (RL_WRITER or RL_APPEND). RL_APPEND is a special type that - * is converted to RL_WRITER that specified to lock from the start of the - * end of file. Returns the range lock structure. - */ -rl_t *zfs_range_lock(znode_t *zp, uint64_t off, uint64_t len, rl_type_t type); +typedef void (rangelock_cb_t)(struct locked_range *, void *); -/* Unlock range and destroy range lock structure. */ -void zfs_range_unlock(rl_t *rl); +#ifdef __FreeBSD__ +typedef struct zfs_rangelock { +#else +typedef struct rangelock { +#endif + avl_tree_t rl_tree; /* contains locked_range_t */ + kmutex_t rl_lock; + rangelock_cb_t *rl_cb; + void *rl_arg; +} rangelock_t; -/* - * Reduce range locked as RW_WRITER from whole file to specified range. - * Asserts the whole file was previously locked. - */ -void zfs_range_reduce(rl_t *rl, uint64_t off, uint64_t len); +typedef struct locked_range { + rangelock_t *lr_rangelock; /* rangelock that this lock applies to */ + avl_node_t lr_node; /* avl node link */ + uint64_t lr_offset; /* file range offset */ + uint64_t lr_length; /* file range length */ + uint_t lr_count; /* range reference count in tree */ + rangelock_type_t lr_type; /* range type */ + kcondvar_t lr_write_cv; /* cv for waiting writers */ + kcondvar_t lr_read_cv; /* cv for waiting readers */ + uint8_t lr_proxy; /* acting for original range */ + uint8_t lr_write_wanted; /* writer wants to lock this range */ + uint8_t lr_read_wanted; /* reader wants to lock this range */ +} locked_range_t; -/* - * AVL comparison function used to order range locks - * Locks are ordered on the start offset of the range. - */ -int zfs_range_compare(const void *arg1, const void *arg2); +void rangelock_init(rangelock_t *, rangelock_cb_t *, void *); +void rangelock_fini(rangelock_t *); -#endif /* _KERNEL */ +locked_range_t *rangelock_enter(rangelock_t *, + uint64_t, uint64_t, rangelock_type_t); +void rangelock_exit(locked_range_t *); +void rangelock_reduce(locked_range_t *, uint64_t, uint64_t); #ifdef __cplusplus } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Wed Oct 16 08:56:07 2019 (r353633) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Wed Oct 16 09:04:53 2019 (r353634) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2015 by Delphix. All rights reserved. + * Copyright (c) 2012, 2018 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ @@ -36,6 +36,7 @@ #include #include #include +#include #endif #include #include @@ -57,8 +58,8 @@ extern "C" { #define ZFS_APPENDONLY 0x0000004000000000 #define ZFS_NODUMP 0x0000008000000000 #define ZFS_OPAQUE 0x0000010000000000 -#define ZFS_AV_QUARANTINED 0x0000020000000000 -#define ZFS_AV_MODIFIED 0x0000040000000000 +#define ZFS_AV_QUARANTINED 0x0000020000000000 +#define ZFS_AV_MODIFIED 0x0000040000000000 #define ZFS_REPARSE 0x0000080000000000 #define ZFS_OFFLINE 0x0000100000000000 #define ZFS_SPARSE 0x0000200000000000 @@ -78,8 +79,8 @@ extern "C" { */ #define ZFS_XATTR 0x1 /* is an extended attribute */ #define ZFS_INHERIT_ACE 0x2 /* ace has inheritable ACEs */ -#define ZFS_ACL_TRIVIAL 0x4 /* files ACL is trivial */ -#define ZFS_ACL_OBJ_ACE 0x8 /* ACL has CMPLX Object ACE */ +#define ZFS_ACL_TRIVIAL 0x4 /* files ACL is trivial */ +#define ZFS_ACL_OBJ_ACE 0x8 /* ACL has CMPLX Object ACE */ #define ZFS_ACL_PROTECTED 0x10 /* ACL protected */ #define ZFS_ACL_DEFAULTED 0x20 /* ACL should be defaulted */ #define ZFS_ACL_AUTO_INHERIT 0x40 /* ACL should be inherited */ @@ -177,8 +178,7 @@ typedef struct znode { krwlock_t z_name_lock; /* "master" lock for dirent locks */ zfs_dirlock_t *z_dirlocks; /* directory entry lock list */ #endif - kmutex_t z_range_lock; /* protects changes to z_range_avl */ - avl_tree_t z_range_avl; /* avl tree of file range locks */ + rangelock_t z_rangelock; /* file range locks */ uint8_t z_unlinked; /* file has been unlinked */ uint8_t z_atime_dirty; /* atime needs to be synced */ uint8_t z_zn_prefetch; /* Prefetch znodes? */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c Wed Oct 16 08:56:07 2019 (r353633) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c Wed Oct 16 09:04:53 2019 (r353634) @@ -23,7 +23,7 @@ * Use is subject to license terms. */ /* - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012, 2018 by Delphix. All rights reserved. */ /* @@ -34,9 +34,9 @@ * Interface * --------- * Defined in zfs_rlock.h but essentially: - * rl = zfs_range_lock(zp, off, len, lock_type); - * zfs_range_unlock(rl); - * zfs_range_reduce(rl, off, len); + * lr = rangelock_enter(zp, off, len, lock_type); + * rangelock_reduce(lr, off, len); // optional + * rangelock_exit(lr); * * AVL tree * -------- @@ -46,9 +46,10 @@ * * Common case * ----------- - * The (hopefully) usual case is of no overlaps or contention for - * locks. On entry to zfs_lock_range() a rl_t is allocated; the tree - * searched that finds no overlap, and *this* rl_t is placed in the tree. + * The (hopefully) usual case is of no overlaps or contention for locks. On + * entry to rangelock_enter(), a locked_range_t is allocated; the tree + * searched that finds no overlap, and *this* locked_range_t is placed in the + * tree. * * Overlaps/Reference counting/Proxy locks * --------------------------------------- @@ -87,67 +88,90 @@ * * Grow block handling * ------------------- - * ZFS supports multiple block sizes currently upto 128K. The smallest + * ZFS supports multiple block sizes, up to 16MB. The smallest * block size is used for the file which is grown as needed. During this * growth all other writers and readers must be excluded. * So if the block size needs to be grown then the whole file is * exclusively locked, then later the caller will reduce the lock - * range to just the range to be written using zfs_reduce_range. + * range to just the range to be written using rangelock_reduce(). */ +#include +#include #include /* + * AVL comparison function used to order range locks + * Locks are ordered on the start offset of the range. + */ +static int +rangelock_compare(const void *arg1, const void *arg2) +{ + const locked_range_t *rl1 = arg1; + const locked_range_t *rl2 = arg2; + + if (rl1->lr_offset > rl2->lr_offset) + return (1); + if (rl1->lr_offset < rl2->lr_offset) + return (-1); + return (0); +} + +/* + * The callback is invoked when acquiring a RL_WRITER or RL_APPEND lock. + * It must convert RL_APPEND to RL_WRITER (starting at the end of the file), + * and may increase the range that's locked for RL_WRITER. + */ +void +rangelock_init(rangelock_t *rl, rangelock_cb_t *cb, void *arg) +{ + mutex_init(&rl->rl_lock, NULL, MUTEX_DEFAULT, NULL); + avl_create(&rl->rl_tree, rangelock_compare, + sizeof (locked_range_t), offsetof(locked_range_t, lr_node)); + rl->rl_cb = cb; + rl->rl_arg = arg; +} + +void +rangelock_fini(rangelock_t *rl) +{ + mutex_destroy(&rl->rl_lock); + avl_destroy(&rl->rl_tree); +} + +/* * Check if a write lock can be grabbed, or wait and recheck until available. */ static void -zfs_range_lock_writer(znode_t *zp, rl_t *new) +rangelock_enter_writer(rangelock_t *rl, locked_range_t *new) { - avl_tree_t *tree = &zp->z_range_avl; - rl_t *rl; + avl_tree_t *tree = &rl->rl_tree; + locked_range_t *lr; avl_index_t where; - uint64_t end_size; - uint64_t off = new->r_off; - uint64_t len = new->r_len; + uint64_t orig_off = new->lr_offset; + uint64_t orig_len = new->lr_length; + rangelock_type_t orig_type = new->lr_type; for (;;) { /* - * Range locking is also used by zvol and uses a - * dummied up znode. However, for zvol, we don't need to - * append or grow blocksize, and besides we don't have - * a "sa" data or z_zfsvfs - so skip that processing. - * - * Yes, this is ugly, and would be solved by not handling - * grow or append in range lock code. If that was done then - * we could make the range locking code generically available - * to other non-zfs consumers. + * Call callback which can modify new->r_off,len,type. + * Note, the callback is used by the ZPL to handle appending + * and changing blocksizes. It isn't needed for zvols. */ - if (zp->z_vnode) { /* caller is ZPL */ - /* - * If in append mode pick up the current end of file. - * This is done under z_range_lock to avoid races. - */ - if (new->r_type == RL_APPEND) - new->r_off = zp->z_size; - - /* - * If we need to grow the block size then grab the whole - * file range. This is also done under z_range_lock to - * avoid races. - */ - end_size = MAX(zp->z_size, new->r_off + len); - if (end_size > zp->z_blksz && (!ISP2(zp->z_blksz) || - zp->z_blksz < zp->z_zfsvfs->z_max_blksz)) { - new->r_off = 0; - new->r_len = UINT64_MAX; - } + if (rl->rl_cb != NULL) { + rl->rl_cb(new, rl->rl_arg); } /* + * If the type was APPEND, the callback must convert it to + * WRITER. + */ + ASSERT3U(new->lr_type, ==, RL_WRITER); + + /* * First check for the usual case of no locks */ if (avl_numnodes(tree) == 0) { - new->r_type = RL_WRITER; /* convert to writer */ avl_add(tree, new); return; } @@ -155,31 +179,33 @@ zfs_range_lock_writer(znode_t *zp, rl_t *new) /* * Look for any locks in the range. */ - rl = avl_find(tree, new, &where); - if (rl) + lr = avl_find(tree, new, &where); + if (lr != NULL) goto wait; /* already locked at same offset */ - rl = (rl_t *)avl_nearest(tree, where, AVL_AFTER); - if (rl && (rl->r_off < new->r_off + new->r_len)) + lr = (locked_range_t *)avl_nearest(tree, where, AVL_AFTER); + if (lr != NULL && + lr->lr_offset < new->lr_offset + new->lr_length) goto wait; - rl = (rl_t *)avl_nearest(tree, where, AVL_BEFORE); - if (rl && rl->r_off + rl->r_len > new->r_off) + lr = (locked_range_t *)avl_nearest(tree, where, AVL_BEFORE); + if (lr != NULL && + lr->lr_offset + lr->lr_length > new->lr_offset) goto wait; - new->r_type = RL_WRITER; /* convert possible RL_APPEND */ avl_insert(tree, new, where); return; wait: - if (!rl->r_write_wanted) { - cv_init(&rl->r_wr_cv, NULL, CV_DEFAULT, NULL); - rl->r_write_wanted = B_TRUE; + if (!lr->lr_write_wanted) { + cv_init(&lr->lr_write_cv, NULL, CV_DEFAULT, NULL); + lr->lr_write_wanted = B_TRUE; } - cv_wait(&rl->r_wr_cv, &zp->z_range_lock); + cv_wait(&lr->lr_write_cv, &rl->rl_lock); /* reset to original */ - new->r_off = off; - new->r_len = len; + new->lr_offset = orig_off; + new->lr_length = orig_len; + new->lr_type = orig_type; } } @@ -187,29 +213,29 @@ wait: * If this is an original (non-proxy) lock then replace it by * a proxy and return the proxy. */ -static rl_t * -zfs_range_proxify(avl_tree_t *tree, rl_t *rl) +static locked_range_t * +rangelock_proxify(avl_tree_t *tree, locked_range_t *lr) { - rl_t *proxy; + locked_range_t *proxy; - if (rl->r_proxy) - return (rl); /* already a proxy */ + if (lr->lr_proxy) + return (lr); /* already a proxy */ - ASSERT3U(rl->r_cnt, ==, 1); - ASSERT(rl->r_write_wanted == B_FALSE); - ASSERT(rl->r_read_wanted == B_FALSE); - avl_remove(tree, rl); - rl->r_cnt = 0; + ASSERT3U(lr->lr_count, ==, 1); + ASSERT(lr->lr_write_wanted == B_FALSE); + ASSERT(lr->lr_read_wanted == B_FALSE); + avl_remove(tree, lr); + lr->lr_count = 0; /* create a proxy range lock */ - proxy = kmem_alloc(sizeof (rl_t), KM_SLEEP); - proxy->r_off = rl->r_off; - proxy->r_len = rl->r_len; - proxy->r_cnt = 1; - proxy->r_type = RL_READER; - proxy->r_proxy = B_TRUE; - proxy->r_write_wanted = B_FALSE; - proxy->r_read_wanted = B_FALSE; + proxy = kmem_alloc(sizeof (locked_range_t), KM_SLEEP); + proxy->lr_offset = lr->lr_offset; + proxy->lr_length = lr->lr_length; + proxy->lr_count = 1; + proxy->lr_type = RL_READER; + proxy->lr_proxy = B_TRUE; + proxy->lr_write_wanted = B_FALSE; + proxy->lr_read_wanted = B_FALSE; avl_add(tree, proxy); return (proxy); @@ -219,29 +245,27 @@ zfs_range_proxify(avl_tree_t *tree, rl_t *rl) * Split the range lock at the supplied offset * returning the *front* proxy. */ -static rl_t * -zfs_range_split(avl_tree_t *tree, rl_t *rl, uint64_t off) +static locked_range_t * +rangelock_split(avl_tree_t *tree, locked_range_t *lr, uint64_t off) { - rl_t *front, *rear; + ASSERT3U(lr->lr_length, >, 1); + ASSERT3U(off, >, lr->lr_offset); + ASSERT3U(off, <, lr->lr_offset + lr->lr_length); + ASSERT(lr->lr_write_wanted == B_FALSE); + ASSERT(lr->lr_read_wanted == B_FALSE); - ASSERT3U(rl->r_len, >, 1); - ASSERT3U(off, >, rl->r_off); - ASSERT3U(off, <, rl->r_off + rl->r_len); - ASSERT(rl->r_write_wanted == B_FALSE); - ASSERT(rl->r_read_wanted == B_FALSE); - /* create the rear proxy range lock */ - rear = kmem_alloc(sizeof (rl_t), KM_SLEEP); - rear->r_off = off; - rear->r_len = rl->r_off + rl->r_len - off; - rear->r_cnt = rl->r_cnt; - rear->r_type = RL_READER; - rear->r_proxy = B_TRUE; - rear->r_write_wanted = B_FALSE; - rear->r_read_wanted = B_FALSE; + locked_range_t *rear = kmem_alloc(sizeof (locked_range_t), KM_SLEEP); + rear->lr_offset = off; + rear->lr_length = lr->lr_offset + lr->lr_length - off; + rear->lr_count = lr->lr_count; + rear->lr_type = RL_READER; + rear->lr_proxy = B_TRUE; + rear->lr_write_wanted = B_FALSE; + rear->lr_read_wanted = B_FALSE; - front = zfs_range_proxify(tree, rl); - front->r_len = off - rl->r_off; + locked_range_t *front = rangelock_proxify(tree, lr); + front->lr_length = off - lr->lr_offset; avl_insert_here(tree, rear, front, AVL_AFTER); return (front); @@ -251,28 +275,27 @@ zfs_range_split(avl_tree_t *tree, rl_t *rl, uint64_t o * Create and add a new proxy range lock for the supplied range. */ static void -zfs_range_new_proxy(avl_tree_t *tree, uint64_t off, uint64_t len) +rangelock_new_proxy(avl_tree_t *tree, uint64_t off, uint64_t len) { - rl_t *rl; - - ASSERT(len); - rl = kmem_alloc(sizeof (rl_t), KM_SLEEP); - rl->r_off = off; - rl->r_len = len; - rl->r_cnt = 1; - rl->r_type = RL_READER; - rl->r_proxy = B_TRUE; - rl->r_write_wanted = B_FALSE; - rl->r_read_wanted = B_FALSE; - avl_add(tree, rl); + ASSERT(len != 0); + locked_range_t *lr = kmem_alloc(sizeof (locked_range_t), KM_SLEEP); + lr->lr_offset = off; + lr->lr_length = len; + lr->lr_count = 1; + lr->lr_type = RL_READER; + lr->lr_proxy = B_TRUE; + lr->lr_write_wanted = B_FALSE; + lr->lr_read_wanted = B_FALSE; + avl_add(tree, lr); } static void -zfs_range_add_reader(avl_tree_t *tree, rl_t *new, rl_t *prev, avl_index_t where) +rangelock_add_reader(avl_tree_t *tree, locked_range_t *new, + locked_range_t *prev, avl_index_t where) { - rl_t *next; - uint64_t off = new->r_off; - uint64_t len = new->r_len; + locked_range_t *next; + uint64_t off = new->lr_offset; + uint64_t len = new->lr_length; /* * prev arrives either: @@ -281,37 +304,37 @@ zfs_range_add_reader(avl_tree_t *tree, rl_t *new, rl_t * range may overlap with the new range * - null, if there were no ranges starting before the new one */ - if (prev) { - if (prev->r_off + prev->r_len <= off) { + if (prev != NULL) { + if (prev->lr_offset + prev->lr_length <= off) { prev = NULL; - } else if (prev->r_off != off) { + } else if (prev->lr_offset != off) { /* * convert to proxy if needed then * split this entry and bump ref count */ - prev = zfs_range_split(tree, prev, off); + prev = rangelock_split(tree, prev, off); prev = AVL_NEXT(tree, prev); /* move to rear range */ } } - ASSERT((prev == NULL) || (prev->r_off == off)); + ASSERT((prev == NULL) || (prev->lr_offset == off)); - if (prev) + if (prev != NULL) next = prev; else - next = (rl_t *)avl_nearest(tree, where, AVL_AFTER); + next = avl_nearest(tree, where, AVL_AFTER); - if (next == NULL || off + len <= next->r_off) { + if (next == NULL || off + len <= next->lr_offset) { /* no overlaps, use the original new rl_t in the tree */ avl_insert(tree, new, where); return; } - if (off < next->r_off) { + if (off < next->lr_offset) { /* Add a proxy for initial range before the overlap */ - zfs_range_new_proxy(tree, off, next->r_off - off); + rangelock_new_proxy(tree, off, next->lr_offset - off); } - new->r_cnt = 0; /* will use proxies in tree */ + new->lr_count = 0; /* will use proxies in tree */ /* * We now search forward through the ranges, until we go past the end * of the new range. For each entry we make it a proxy if it @@ -319,47 +342,51 @@ zfs_range_add_reader(avl_tree_t *tree, rl_t *new, rl_t * gaps between the ranges then we create a new proxy range. */ for (prev = NULL; next; prev = next, next = AVL_NEXT(tree, next)) { - if (off + len <= next->r_off) + if (off + len <= next->lr_offset) break; - if (prev && prev->r_off + prev->r_len < next->r_off) { + if (prev != NULL && prev->lr_offset + prev->lr_length < + next->lr_offset) { /* there's a gap */ - ASSERT3U(next->r_off, >, prev->r_off + prev->r_len); - zfs_range_new_proxy(tree, prev->r_off + prev->r_len, - next->r_off - (prev->r_off + prev->r_len)); + ASSERT3U(next->lr_offset, >, + prev->lr_offset + prev->lr_length); + rangelock_new_proxy(tree, + prev->lr_offset + prev->lr_length, + next->lr_offset - + (prev->lr_offset + prev->lr_length)); } - if (off + len == next->r_off + next->r_len) { + if (off + len == next->lr_offset + next->lr_length) { /* exact overlap with end */ - next = zfs_range_proxify(tree, next); - next->r_cnt++; + next = rangelock_proxify(tree, next); + next->lr_count++; return; } - if (off + len < next->r_off + next->r_len) { + if (off + len < next->lr_offset + next->lr_length) { /* new range ends in the middle of this block */ - next = zfs_range_split(tree, next, off + len); - next->r_cnt++; + next = rangelock_split(tree, next, off + len); + next->lr_count++; return; } - ASSERT3U(off + len, >, next->r_off + next->r_len); - next = zfs_range_proxify(tree, next); - next->r_cnt++; + ASSERT3U(off + len, >, next->lr_offset + next->lr_length); + next = rangelock_proxify(tree, next); + next->lr_count++; } /* Add the remaining end range. */ - zfs_range_new_proxy(tree, prev->r_off + prev->r_len, - (off + len) - (prev->r_off + prev->r_len)); + rangelock_new_proxy(tree, prev->lr_offset + prev->lr_length, + (off + len) - (prev->lr_offset + prev->lr_length)); } /* * Check if a reader lock can be grabbed, or wait and recheck until available. */ static void -zfs_range_lock_reader(znode_t *zp, rl_t *new) +rangelock_enter_reader(rangelock_t *rl, locked_range_t *new) { - avl_tree_t *tree = &zp->z_range_avl; - rl_t *prev, *next; + avl_tree_t *tree = &rl->rl_tree; + locked_range_t *prev, *next; avl_index_t where; - uint64_t off = new->r_off; - uint64_t len = new->r_len; + uint64_t off = new->lr_offset; + uint64_t len = new->lr_length; /* * Look for any writer locks in the range. @@ -367,21 +394,22 @@ zfs_range_lock_reader(znode_t *zp, rl_t *new) retry: prev = avl_find(tree, new, &where); if (prev == NULL) - prev = (rl_t *)avl_nearest(tree, where, AVL_BEFORE); + prev = (locked_range_t *)avl_nearest(tree, where, AVL_BEFORE); /* * Check the previous range for a writer lock overlap. */ - if (prev && (off < prev->r_off + prev->r_len)) { - if ((prev->r_type == RL_WRITER) || (prev->r_write_wanted)) { - if (!prev->r_read_wanted) { - cv_init(&prev->r_rd_cv, NULL, CV_DEFAULT, NULL); - prev->r_read_wanted = B_TRUE; + if (prev && (off < prev->lr_offset + prev->lr_length)) { + if ((prev->lr_type == RL_WRITER) || (prev->lr_write_wanted)) { + if (!prev->lr_read_wanted) { + cv_init(&prev->lr_read_cv, + NULL, CV_DEFAULT, NULL); + prev->lr_read_wanted = B_TRUE; } - cv_wait(&prev->r_rd_cv, &zp->z_range_lock); + cv_wait(&prev->lr_read_cv, &rl->rl_lock); goto retry; } - if (off + len < prev->r_off + prev->r_len) + if (off + len < prev->lr_offset + prev->lr_length) goto got_lock; } @@ -389,70 +417,71 @@ retry: * Search through the following ranges to see if there's * write lock any overlap. */ - if (prev) + if (prev != NULL) next = AVL_NEXT(tree, prev); else - next = (rl_t *)avl_nearest(tree, where, AVL_AFTER); - for (; next; next = AVL_NEXT(tree, next)) { - if (off + len <= next->r_off) + next = (locked_range_t *)avl_nearest(tree, where, AVL_AFTER); + for (; next != NULL; next = AVL_NEXT(tree, next)) { + if (off + len <= next->lr_offset) goto got_lock; - if ((next->r_type == RL_WRITER) || (next->r_write_wanted)) { - if (!next->r_read_wanted) { - cv_init(&next->r_rd_cv, NULL, CV_DEFAULT, NULL); - next->r_read_wanted = B_TRUE; + if ((next->lr_type == RL_WRITER) || (next->lr_write_wanted)) { + if (!next->lr_read_wanted) { + cv_init(&next->lr_read_cv, + NULL, CV_DEFAULT, NULL); + next->lr_read_wanted = B_TRUE; } - cv_wait(&next->r_rd_cv, &zp->z_range_lock); + cv_wait(&next->lr_read_cv, &rl->rl_lock); goto retry; } - if (off + len <= next->r_off + next->r_len) + if (off + len <= next->lr_offset + next->lr_length) goto got_lock; } got_lock: /* * Add the read lock, which may involve splitting existing - * locks and bumping ref counts (r_cnt). + * locks and bumping ref counts (r_count). */ - zfs_range_add_reader(tree, new, prev, where); + rangelock_add_reader(tree, new, prev, where); } /* - * Lock a range (offset, length) as either shared (RL_READER) - * or exclusive (RL_WRITER). Returns the range lock structure - * for later unlocking or reduce range (if entire file - * previously locked as RL_WRITER). + * Lock a range (offset, length) as either shared (RL_READER) or exclusive + * (RL_WRITER or RL_APPEND). If RL_APPEND is specified, rl_cb() will convert + * it to a RL_WRITER lock (with the offset at the end of the file). Returns + * the range lock structure for later unlocking (or reduce range if the + * entire file is locked as RL_WRITER). */ -rl_t * -zfs_range_lock(znode_t *zp, uint64_t off, uint64_t len, rl_type_t type) +locked_range_t * +rangelock_enter(rangelock_t *rl, uint64_t off, uint64_t len, + rangelock_type_t type) { - rl_t *new; - ASSERT(type == RL_READER || type == RL_WRITER || type == RL_APPEND); - new = kmem_alloc(sizeof (rl_t), KM_SLEEP); - new->r_zp = zp; - new->r_off = off; + locked_range_t *new = kmem_alloc(sizeof (locked_range_t), KM_SLEEP); + new->lr_rangelock = rl; + new->lr_offset = off; if (len + off < off) /* overflow */ len = UINT64_MAX - off; - new->r_len = len; - new->r_cnt = 1; /* assume it's going to be in the tree */ - new->r_type = type; - new->r_proxy = B_FALSE; - new->r_write_wanted = B_FALSE; - new->r_read_wanted = B_FALSE; + new->lr_length = len; + new->lr_count = 1; /* assume it's going to be in the tree */ + new->lr_type = type; + new->lr_proxy = B_FALSE; + new->lr_write_wanted = B_FALSE; + new->lr_read_wanted = B_FALSE; - mutex_enter(&zp->z_range_lock); + mutex_enter(&rl->rl_lock); if (type == RL_READER) { /* * First check for the usual case of no locks */ - if (avl_numnodes(&zp->z_range_avl) == 0) - avl_add(&zp->z_range_avl, new); + if (avl_numnodes(&rl->rl_tree) == 0) + avl_add(&rl->rl_tree, new); else - zfs_range_lock_reader(zp, new); + rangelock_enter_reader(rl, new); } else - zfs_range_lock_writer(zp, new); /* RL_WRITER or RL_APPEND */ - mutex_exit(&zp->z_range_lock); + rangelock_enter_writer(rl, new); /* RL_WRITER or RL_APPEND */ + mutex_exit(&rl->rl_lock); return (new); } @@ -460,10 +489,9 @@ zfs_range_lock(znode_t *zp, uint64_t off, uint64_t len * Unlock a reader lock */ static void -zfs_range_unlock_reader(znode_t *zp, rl_t *remove) +rangelock_exit_reader(rangelock_t *rl, locked_range_t *remove) { - avl_tree_t *tree = &zp->z_range_avl; - rl_t *rl, *next = NULL; + avl_tree_t *tree = &rl->rl_tree; uint64_t len; /* @@ -473,129 +501,118 @@ zfs_range_unlock_reader(znode_t *zp, rl_t *remove) * removed from the tree and replaced by proxies (one or * more ranges mapping to the entire range). */ - if (remove->r_cnt == 1) { + if (remove->lr_count == 1) { avl_remove(tree, remove); - if (remove->r_write_wanted) { - cv_broadcast(&remove->r_wr_cv); - cv_destroy(&remove->r_wr_cv); + if (remove->lr_write_wanted) { + cv_broadcast(&remove->lr_write_cv); + cv_destroy(&remove->lr_write_cv); } - if (remove->r_read_wanted) { - cv_broadcast(&remove->r_rd_cv); - cv_destroy(&remove->r_rd_cv); + if (remove->lr_read_wanted) { + cv_broadcast(&remove->lr_read_cv); + cv_destroy(&remove->lr_read_cv); } } else { - ASSERT0(remove->r_cnt); - ASSERT0(remove->r_write_wanted); - ASSERT0(remove->r_read_wanted); + ASSERT0(remove->lr_count); + ASSERT0(remove->lr_write_wanted); + ASSERT0(remove->lr_read_wanted); /* * Find start proxy representing this reader lock, * then decrement ref count on all proxies * that make up this range, freeing them as needed. */ - rl = avl_find(tree, remove, NULL); - ASSERT(rl); - ASSERT(rl->r_cnt); - ASSERT(rl->r_type == RL_READER); - for (len = remove->r_len; len != 0; rl = next) { - len -= rl->r_len; - if (len) { - next = AVL_NEXT(tree, rl); - ASSERT(next); - ASSERT(rl->r_off + rl->r_len == next->r_off); - ASSERT(next->r_cnt); - ASSERT(next->r_type == RL_READER); + locked_range_t *lr = avl_find(tree, remove, NULL); + ASSERT3P(lr, !=, NULL); + ASSERT3U(lr->lr_count, !=, 0); + ASSERT3U(lr->lr_type, ==, RL_READER); + locked_range_t *next = NULL; + for (len = remove->lr_length; len != 0; lr = next) { + len -= lr->lr_length; + if (len != 0) { + next = AVL_NEXT(tree, lr); + ASSERT3P(next, !=, NULL); + ASSERT3U(lr->lr_offset + lr->lr_length, ==, + next->lr_offset); + ASSERT3U(next->lr_count, !=, 0); + ASSERT3U(next->lr_type, ==, RL_READER); } - rl->r_cnt--; - if (rl->r_cnt == 0) { - avl_remove(tree, rl); - if (rl->r_write_wanted) { - cv_broadcast(&rl->r_wr_cv); - cv_destroy(&rl->r_wr_cv); + lr->lr_count--; + if (lr->lr_count == 0) { + avl_remove(tree, lr); + if (lr->lr_write_wanted) { + cv_broadcast(&lr->lr_write_cv); + cv_destroy(&lr->lr_write_cv); } - if (rl->r_read_wanted) { - cv_broadcast(&rl->r_rd_cv); - cv_destroy(&rl->r_rd_cv); + if (lr->lr_read_wanted) { + cv_broadcast(&lr->lr_read_cv); + cv_destroy(&lr->lr_read_cv); } - kmem_free(rl, sizeof (rl_t)); + kmem_free(lr, sizeof (locked_range_t)); } } } - kmem_free(remove, sizeof (rl_t)); + kmem_free(remove, sizeof (locked_range_t)); } /* * Unlock range and destroy range lock structure. */ void -zfs_range_unlock(rl_t *rl) +rangelock_exit(locked_range_t *lr) { - znode_t *zp = rl->r_zp; + rangelock_t *rl = lr->lr_rangelock; - ASSERT(rl->r_type == RL_WRITER || rl->r_type == RL_READER); - ASSERT(rl->r_cnt == 1 || rl->r_cnt == 0); - ASSERT(!rl->r_proxy); + ASSERT(lr->lr_type == RL_WRITER || lr->lr_type == RL_READER); + ASSERT(lr->lr_count == 1 || lr->lr_count == 0); + ASSERT(!lr->lr_proxy); - mutex_enter(&zp->z_range_lock); - if (rl->r_type == RL_WRITER) { + mutex_enter(&rl->rl_lock); + if (lr->lr_type == RL_WRITER) { /* writer locks can't be shared or split */ - avl_remove(&zp->z_range_avl, rl); - mutex_exit(&zp->z_range_lock); - if (rl->r_write_wanted) { - cv_broadcast(&rl->r_wr_cv); - cv_destroy(&rl->r_wr_cv); + avl_remove(&rl->rl_tree, lr); + mutex_exit(&rl->rl_lock); + if (lr->lr_write_wanted) { + cv_broadcast(&lr->lr_write_cv); + cv_destroy(&lr->lr_write_cv); } - if (rl->r_read_wanted) { - cv_broadcast(&rl->r_rd_cv); - cv_destroy(&rl->r_rd_cv); + if (lr->lr_read_wanted) { + cv_broadcast(&lr->lr_read_cv); + cv_destroy(&lr->lr_read_cv); } - kmem_free(rl, sizeof (rl_t)); + kmem_free(lr, sizeof (locked_range_t)); } else { /* - * lock may be shared, let zfs_range_unlock_reader() + * lock may be shared, let rangelock_exit_reader() * release the lock and free the rl_t */ - zfs_range_unlock_reader(zp, rl); - mutex_exit(&zp->z_range_lock); + rangelock_exit_reader(rl, lr); + mutex_exit(&rl->rl_lock); } } /* * Reduce range locked as RL_WRITER from whole file to specified range. - * Asserts the whole file is exclusivly locked and so there's only one + * Asserts the whole file is exclusively locked and so there's only one * entry in the tree. */ void *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Oct 16 09:11:50 2019 Return-Path: Delivered-To: svn-src-all@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 ED86615FFD7; Wed, 16 Oct 2019 09:11:50 +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 46tRPf62gmz4TlD; Wed, 16 Oct 2019 09:11:50 +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 B2C624D13; Wed, 16 Oct 2019 09:11:50 +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 x9G9Borb076339; Wed, 16 Oct 2019 09:11:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G9BonH076337; Wed, 16 Oct 2019 09:11:50 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910160911.x9G9BonH076337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 16 Oct 2019 09:11:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353635 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 353635 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 09:11:51 -0000 Author: hselasky Date: Wed Oct 16 09:11:49 2019 New Revision: 353635 URL: https://svnweb.freebsd.org/changeset/base/353635 Log: Fix panic in network stack due to use after free when receiving partial fragmented packets before a network interface is detached. When sending IPv4 or IPv6 fragmented packets and a fragment is lost before the network device is freed, the mbuf making up the fragment will remain in the temporary hashed fragment list and cause a panic when it times out due to accessing a freed network interface structure. 1) Make sure the m_pkthdr.rcvif always points to a valid network interface. Else the rcvif field should be set to NULL. 2) Use the rcvif of the last received fragment as m_pkthdr.rcvif for the fully defragged packet, instead of the first received fragment. Panic backtrace for IPv6: panic() icmp6_reflect() # tries to access rcvif->if_afdata[AF_INET6]->xxx icmp6_error() frag6_freef() frag6_slowtimo() pfslowtimo() softclock_call_cc() softclock() ithread_loop() Reviewed by: bz Differential Revision: https://reviews.freebsd.org/D19622 MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/netinet/ip_reass.c head/sys/netinet6/frag6.c Modified: head/sys/netinet/ip_reass.c ============================================================================== --- head/sys/netinet/ip_reass.c Wed Oct 16 09:04:53 2019 (r353634) +++ head/sys/netinet/ip_reass.c Wed Oct 16 09:11:49 2019 (r353635) @@ -47,7 +47,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include +#include #include #include #include @@ -181,6 +184,7 @@ ip_reass(struct mbuf *m) struct ip *ip; struct mbuf *p, *q, *nq, *t; struct ipq *fp; + struct ifnet *srcifp; struct ipqhead *head; int i, hlen, next, tmpmax; u_int8_t ecn, ecn0; @@ -241,6 +245,11 @@ ip_reass(struct mbuf *m) } /* + * Store receive network interface pointer for later. + */ + srcifp = m->m_pkthdr.rcvif; + + /* * Attempt reassembly; if it succeeds, proceed. * ip_reass() will return a different mbuf. */ @@ -490,8 +499,11 @@ ip_reass(struct mbuf *m) m->m_len += (ip->ip_hl << 2); m->m_data -= (ip->ip_hl << 2); /* some debugging cruft by sklower, below, will go away soon */ - if (m->m_flags & M_PKTHDR) /* XXX this should be done elsewhere */ + if (m->m_flags & M_PKTHDR) { /* XXX this should be done elsewhere */ m_fixhdr(m); + /* set valid receive interface pointer */ + m->m_pkthdr.rcvif = srcifp; + } IPSTAT_INC(ips_reassembled); IPQ_UNLOCK(hash); @@ -607,6 +619,43 @@ ipreass_drain(void) } } +/* + * Drain off all datagram fragments belonging to + * the given network interface. + */ +static void +ipreass_cleanup(void *arg __unused, struct ifnet *ifp) +{ + struct ipq *fp, *temp; + struct mbuf *m; + int i; + + KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); + + /* + * Skip processing if IPv4 reassembly is not initialised or + * torn down by ipreass_destroy(). + */ + if (V_ipq_zone == NULL) + return; + + CURVNET_SET_QUIET(ifp->if_vnet); + for (i = 0; i < IPREASS_NHASH; i++) { + IPQ_LOCK(i); + /* Scan fragment list. */ + TAILQ_FOREACH_SAFE(fp, &V_ipq[i].head, ipq_list, temp) { + for (m = fp->ipq_frags; m != NULL; m = m->m_nextpkt) { + /* clear no longer valid rcvif pointer */ + if (m->m_pkthdr.rcvif == ifp) + m->m_pkthdr.rcvif = NULL; + } + } + IPQ_UNLOCK(i); + } + CURVNET_RESTORE(); +} +EVENTHANDLER_DEFINE(ifnet_departure_event, ipreass_cleanup, NULL, 0); + #ifdef VIMAGE /* * Destroy IP reassembly structures. @@ -617,6 +666,7 @@ ipreass_destroy(void) ipreass_drain(); uma_zdestroy(V_ipq_zone); + V_ipq_zone = NULL; for (int i = 0; i < IPREASS_NHASH; i++) mtx_destroy(&V_ipq[i].lock); } Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Wed Oct 16 09:04:53 2019 (r353634) +++ head/sys/netinet6/frag6.c Wed Oct 16 09:11:49 2019 (r353635) @@ -246,7 +246,7 @@ frag6_freef(struct ip6q *q6, uint32_t bucket) * Return ICMP time exceeded error for the 1st fragment. * Just free other fragments. */ - if (af6->ip6af_off == 0) { + if (af6->ip6af_off == 0 && m->m_pkthdr.rcvif != NULL) { /* Adjust pointer. */ ip6 = mtod(m, struct ip6_hdr *); @@ -272,6 +272,43 @@ frag6_freef(struct ip6q *q6, uint32_t bucket) } /* + * Drain off all datagram fragments belonging to + * the given network interface. + */ +static void +frag6_cleanup(void *arg __unused, struct ifnet *ifp) +{ + struct ip6q *q6, *q6n, *head; + struct ip6asfrag *af6; + struct mbuf *m; + int i; + + KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); + + CURVNET_SET_QUIET(ifp->if_vnet); + for (i = 0; i < IP6REASS_NHASH; i++) { + IP6QB_LOCK(i); + head = IP6QB_HEAD(i); + /* Scan fragment list. */ + for (q6 = head->ip6q_next; q6 != head; q6 = q6n) { + q6n = q6->ip6q_next; + + for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; + af6 = af6->ip6af_down) { + m = IP6_REASS_MBUF(af6); + + /* clear no longer valid rcvif pointer */ + if (m->m_pkthdr.rcvif == ifp) + m->m_pkthdr.rcvif = NULL; + } + } + IP6QB_UNLOCK(i); + } + CURVNET_RESTORE(); +} +EVENTHANDLER_DEFINE(ifnet_departure_event, frag6_cleanup, NULL, 0); + +/* * 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, @@ -307,6 +344,7 @@ int frag6_input(struct mbuf **mp, int *offp, int proto) { struct ifnet *dstifp; + struct ifnet *srcifp; struct in6_ifaddr *ia6; struct ip6_hdr *ip6; struct ip6_frag *ip6f; @@ -338,6 +376,11 @@ frag6_input(struct mbuf **mp, int *offp, int proto) return (IPPROTO_DONE); #endif + /* + * Store receive network interface pointer for later. + */ + srcifp = m->m_pkthdr.rcvif; + dstifp = NULL; /* Find the destination interface of the packet. */ ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); @@ -534,6 +577,9 @@ frag6_input(struct mbuf **mp, int *offp, int proto) frag6_deq(af6, bucket); free(af6, M_FRAG6); + /* Set a valid receive interface pointer. */ + merr->m_pkthdr.rcvif = srcifp; + /* Adjust pointer. */ ip6err = mtod(merr, struct ip6_hdr *); @@ -720,6 +766,8 @@ insert: for (t = m; t; t = t->m_next) plen += t->m_len; m->m_pkthdr.len = plen; + /* Set a valid receive interface pointer. */ + m->m_pkthdr.rcvif = srcifp; } #ifdef RSS From owner-svn-src-all@freebsd.org Wed Oct 16 09:20:10 2019 Return-Path: Delivered-To: svn-src-all@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 8859B160244; Wed, 16 Oct 2019 09:20:10 +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 46tRbG35HNz4V4V; Wed, 16 Oct 2019 09:20:10 +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 48CE14D8D; Wed, 16 Oct 2019 09:20:10 +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 x9G9KAY2077464; Wed, 16 Oct 2019 09:20:10 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G9K8pt077452; Wed, 16 Oct 2019 09:20:08 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160920.x9G9K8pt077452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 09:20:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353636 - in head/sys/cddl/contrib/opensolaris/uts/common: fs/zfs sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common: fs/zfs sys X-SVN-Commit-Revision: 353636 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 09:20:10 -0000 Author: avg Date: Wed Oct 16 09:20:08 2019 New Revision: 353636 URL: https://svnweb.freebsd.org/changeset/base/353636 Log: MFV r353630: 10809 Performance optimization of AVL tree comparator functions illumos/illumos-gate@c4ab0d3f46036e85ad0700125c5a83cc139f55a3 https://github.com/illumos/illumos-gate/commit/c4ab0d3f46036e85ad0700125c5a83cc139f55a3 https://www.illumos.org/issues/10809 Port ZoL ee36c709c3d Performance optimization of AVL tree comparator functions This is a followup to r337567 that imported the ZoL commit directly into FreeBSD. It seems that at the time we did not have some of the earlier changes, so some pieces of the ZoL change were not applicable. Also, the illumos version got a few style cleanups. Some changes were missed or incorrectly merged (e.g., vdev_cache_lastused_compare and metaslab_rangesize_compare). Obtained from: ZoL, illumos MFC after: 25 days X-MFC after: r353634 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c head/sys/cddl/contrib/opensolaris/uts/common/sys/avl.h Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c Wed Oct 16 09:11:49 2019 (r353635) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c Wed Oct 16 09:20:08 2019 (r353636) @@ -768,22 +768,31 @@ ddt_prefetch(spa_t *spa, const blkptr_t *bp) } } +/* + * Opaque struct used for ddt_key comparison + */ +#define DDT_KEY_CMP_LEN (sizeof (ddt_key_t) / sizeof (uint16_t)) + +typedef struct ddt_key_cmp { + uint16_t u16[DDT_KEY_CMP_LEN]; +} ddt_key_cmp_t; + int ddt_entry_compare(const void *x1, const void *x2) { const ddt_entry_t *dde1 = x1; const ddt_entry_t *dde2 = x2; - const uint64_t *u1 = (const uint64_t *)&dde1->dde_key; - const uint64_t *u2 = (const uint64_t *)&dde2->dde_key; + const ddt_key_cmp_t *k1 = (const ddt_key_cmp_t *)&dde1->dde_key; + const ddt_key_cmp_t *k2 = (const ddt_key_cmp_t *)&dde2->dde_key; + int32_t cmp = 0; - for (int i = 0; i < DDT_KEY_WORDS; i++) { - if (u1[i] < u2[i]) - return (-1); - if (u1[i] > u2[i]) - return (1); + for (int i = 0; i < DDT_KEY_CMP_LEN; i++) { + cmp = (int32_t)k1->u16[i] - (int32_t)k2->u16[i]; + if (likely(cmp)) + break; } - return (0); + return (AVL_ISIGN(cmp)); } static ddt_t * Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c Wed Oct 16 09:11:49 2019 (r353635) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c Wed Oct 16 09:20:08 2019 (r353636) @@ -259,8 +259,13 @@ lz4_decompress(void *s_start, void *d_start, size_t s_ #undef unlikely #endif +#ifndef likely #define likely(expr) expect((expr) != 0, 1) +#endif + +#ifndef unlikely #define unlikely(expr) expect((expr) != 0, 0) +#endif /* Basic types */ #define BYTE uint8_t Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Wed Oct 16 09:11:49 2019 (r353635) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Wed Oct 16 09:20:08 2019 (r353636) @@ -1203,9 +1203,6 @@ metaslab_rangesize_compare(const void *x1, const void if (likely(cmp)) return (cmp); - if (r1->rs_start < r2->rs_start) - return (-1); - return (AVL_CMP(r1->rs_start, r2->rs_start)); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c Wed Oct 16 09:11:49 2019 (r353635) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c Wed Oct 16 09:20:08 2019 (r353636) @@ -164,7 +164,7 @@ range_tree_seg_compare(const void *x1, const void *x2) ASSERT3U(r1->rs_start, <=, r1->rs_end); ASSERT3U(r2->rs_start, <=, r2->rs_end); - + return ((r1->rs_start >= r2->rs_end) - (r1->rs_end <= r2->rs_start)); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c Wed Oct 16 09:11:49 2019 (r353635) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c Wed Oct 16 09:20:08 2019 (r353636) @@ -114,29 +114,24 @@ static vdc_stats_t vdc_stats = { #define VDCSTAT_BUMP(stat) atomic_inc_64(&vdc_stats.stat.value.ui64); -static int +static inline int vdev_cache_offset_compare(const void *a1, const void *a2) { - const vdev_cache_entry_t *ve1 = a1; - const vdev_cache_entry_t *ve2 = a2; + const vdev_cache_entry_t *ve1 = (const vdev_cache_entry_t *)a1; + const vdev_cache_entry_t *ve2 = (const vdev_cache_entry_t *)a2; - if (ve1->ve_offset < ve2->ve_offset) - return (-1); - if (ve1->ve_offset > ve2->ve_offset) - return (1); - return (0); + return (AVL_CMP(ve1->ve_offset, ve2->ve_offset)); } static int vdev_cache_lastused_compare(const void *a1, const void *a2) { - const vdev_cache_entry_t *ve1 = a1; - const vdev_cache_entry_t *ve2 = a2; + const vdev_cache_entry_t *ve1 = (const vdev_cache_entry_t *)a1; + const vdev_cache_entry_t *ve2 = (const vdev_cache_entry_t *)a2; - if (ve1->ve_lastused < ve2->ve_lastused) - return (-1); - if (ve1->ve_lastused > ve2->ve_lastused) - return (1); + int cmp = AVL_CMP(ve1->ve_lastused, ve2->ve_lastused); + if (likely(cmp)) + return (cmp); /* * Among equally old entries, sort by offset to ensure uniqueness. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Wed Oct 16 09:11:49 2019 (r353635) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Wed Oct 16 09:20:08 2019 (r353636) @@ -353,25 +353,15 @@ vdev_queue_type_tree(vdev_queue_t *vq, zio_type_t t) int vdev_queue_timestamp_compare(const void *x1, const void *x2) { - const zio_t *z1 = x1; - const zio_t *z2 = x2; + const zio_t *z1 = (const zio_t *)x1; + const zio_t *z2 = (const zio_t *)x2; - if (z1->io_timestamp < z2->io_timestamp) - return (-1); - if (z1->io_timestamp > z2->io_timestamp) - return (1); + int cmp = AVL_CMP(z1->io_timestamp, z2->io_timestamp); - if (z1->io_offset < z2->io_offset) - return (-1); - if (z1->io_offset > z2->io_offset) - return (1); + if (likely(cmp)) + return (cmp); - if (z1 < z2) - return (-1); - if (z1 > z2) - return (1); - - return (0); + return (AVL_PCMP(z1, z2)); } void Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c Wed Oct 16 09:11:49 2019 (r353635) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c Wed Oct 16 09:20:08 2019 (r353636) @@ -107,14 +107,10 @@ static int rangelock_compare(const void *arg1, const void *arg2) { - const locked_range_t *rl1 = arg1; - const locked_range_t *rl2 = arg2; + const locked_range_t *rl1 = (const locked_range_t *)arg1; + const locked_range_t *rl2 = (const locked_range_t *)arg2; - if (rl1->lr_offset > rl2->lr_offset) - return (1); - if (rl1->lr_offset < rl2->lr_offset) - return (-1); - return (0); + return (AVL_CMP(rl1->lr_offset, rl2->lr_offset)); } /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/avl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/avl.h Wed Oct 16 09:11:49 2019 (r353635) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/avl.h Wed Oct 16 09:20:08 2019 (r353636) @@ -105,6 +105,13 @@ extern "C" { * as is needed for any linked list implementation. */ +/* + * AVL comparator helpers + */ +#define AVL_ISIGN(a) (((a) > 0) - ((a) < 0)) +#define AVL_CMP(a, b) (((a) > (b)) - ((a) < (b))) +#define AVL_PCMP(a, b) \ + (((uintptr_t)(a) > (uintptr_t)(b)) - ((uintptr_t)(a) < (uintptr_t)(b))) /* * AVL comparator helpers From owner-svn-src-all@freebsd.org Wed Oct 16 09:21:14 2019 Return-Path: Delivered-To: svn-src-all@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 67AD41602B8; Wed, 16 Oct 2019 09:21:14 +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 46tRcV2vshz4VMJ; Wed, 16 Oct 2019 09:21:14 +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 45E3F4DCC; Wed, 16 Oct 2019 09:21:14 +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 x9G9LEQu078357; Wed, 16 Oct 2019 09:21:14 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G9LCvn078350; Wed, 16 Oct 2019 09:21:12 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160921.x9G9LCvn078350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 09:21:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353637 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 353637 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 09:21:14 -0000 Author: avg Date: Wed Oct 16 09:21:12 2019 New Revision: 353637 URL: https://svnweb.freebsd.org/changeset/base/353637 Log: 10844 Serialize ZTHR operations to eliminate races illumos/illumos-gate@6a316e1f6d32750bb8fcf2558dcb17b90ca580fd https://github.com/illumos/illumos-gate/commit/6a316e1f6d32750bb8fcf2558dcb17b90ca580fd https://www.illumos.org/issues/10844 ZoL 61c3391acc9 Serialize ZTHR operations to eliminate races Portions contributed by: Jerry Jelinek Author: Serapheim Dimitropoulos Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_checkpoint.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_checkpoint.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zthr.h vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c vendor-sys/illumos/dist/uts/common/fs/zfs/zthr.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Wed Oct 16 09:20:08 2019 (r353636) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Wed Oct 16 09:21:12 2019 (r353637) @@ -4193,7 +4193,7 @@ arc_adjust_cb_check(void *arg, zthr_t *zthr) * from the ARC. */ /* ARGSUSED */ -static int +static void arc_adjust_cb(void *arg, zthr_t *zthr) { uint64_t evicted = 0; @@ -4224,8 +4224,6 @@ arc_adjust_cb(void *arg, zthr_t *zthr) cv_broadcast(&arc_adjust_waiters_cv); } mutex_exit(&arc_adjust_lock); - - return (0); } /* ARGSUSED */ @@ -4267,7 +4265,7 @@ arc_reap_cb_check(void *arg, zthr_t *zthr) * to free more buffers. */ /* ARGSUSED */ -static int +static void arc_reap_cb(void *arg, zthr_t *zthr) { int64_t free_memory; @@ -4306,8 +4304,6 @@ arc_reap_cb(void *arg, zthr_t *zthr) #endif arc_reduce_target_size(to_free); } - - return (0); } /* Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Oct 16 09:20:08 2019 (r353636) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Oct 16 09:21:12 2019 (r353637) @@ -1364,13 +1364,11 @@ spa_unload(spa_t *spa) } if (spa->spa_condense_zthr != NULL) { - ASSERT(!zthr_isrunning(spa->spa_condense_zthr)); zthr_destroy(spa->spa_condense_zthr); spa->spa_condense_zthr = NULL; } if (spa->spa_checkpoint_discard_zthr != NULL) { - ASSERT(!zthr_isrunning(spa->spa_checkpoint_discard_zthr)); zthr_destroy(spa->spa_checkpoint_discard_zthr); spa->spa_checkpoint_discard_zthr = NULL; } @@ -6919,12 +6917,12 @@ spa_async_suspend(spa_t *spa) spa_vdev_remove_suspend(spa); zthr_t *condense_thread = spa->spa_condense_zthr; - if (condense_thread != NULL && zthr_isrunning(condense_thread)) - VERIFY0(zthr_cancel(condense_thread)); + if (condense_thread != NULL) + zthr_cancel(condense_thread); zthr_t *discard_thread = spa->spa_checkpoint_discard_zthr; - if (discard_thread != NULL && zthr_isrunning(discard_thread)) - VERIFY0(zthr_cancel(discard_thread)); + if (discard_thread != NULL) + zthr_cancel(discard_thread); } void @@ -6937,11 +6935,11 @@ spa_async_resume(spa_t *spa) spa_restart_removal(spa); zthr_t *condense_thread = spa->spa_condense_zthr; - if (condense_thread != NULL && !zthr_isrunning(condense_thread)) + if (condense_thread != NULL) zthr_resume(condense_thread); zthr_t *discard_thread = spa->spa_checkpoint_discard_zthr; - if (discard_thread != NULL && !zthr_isrunning(discard_thread)) + if (discard_thread != NULL) zthr_resume(discard_thread); } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa_checkpoint.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa_checkpoint.c Wed Oct 16 09:20:08 2019 (r353636) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa_checkpoint.c Wed Oct 16 09:21:12 2019 (r353637) @@ -391,7 +391,7 @@ spa_checkpoint_discard_thread_check(void *arg, zthr_t return (B_TRUE); } -int +void spa_checkpoint_discard_thread(void *arg, zthr_t *zthr) { spa_t *spa = arg; @@ -406,7 +406,7 @@ spa_checkpoint_discard_thread(void *arg, zthr_t *zthr) dmu_buf_t **dbp; if (zthr_iscancelled(zthr)) - return (0); + return; ASSERT3P(vd->vdev_ops, !=, &vdev_indirect_ops); @@ -443,8 +443,6 @@ spa_checkpoint_discard_thread(void *arg, zthr_t *zthr) VERIFY0(dsl_sync_task(spa->spa_name, NULL, spa_checkpoint_discard_complete_sync, spa, 0, ZFS_SPACE_CHECK_NONE)); - - return (0); } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_checkpoint.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_checkpoint.h Wed Oct 16 09:20:08 2019 (r353636) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_checkpoint.h Wed Oct 16 09:21:12 2019 (r353637) @@ -37,7 +37,7 @@ int spa_checkpoint(const char *); int spa_checkpoint_discard(const char *); boolean_t spa_checkpoint_discard_thread_check(void *, zthr_t *); -int spa_checkpoint_discard_thread(void *, zthr_t *); +void spa_checkpoint_discard_thread(void *, zthr_t *); int spa_checkpoint_get_stats(spa_t *, pool_checkpoint_stat_t *); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zthr.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zthr.h Wed Oct 16 09:20:08 2019 (r353636) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zthr.h Wed Oct 16 09:21:12 2019 (r353637) @@ -14,42 +14,26 @@ */ /* - * Copyright (c) 2017 by Delphix. All rights reserved. + * Copyright (c) 2017, 2018 by Delphix. All rights reserved. */ #ifndef _SYS_ZTHR_H #define _SYS_ZTHR_H typedef struct zthr zthr_t; -typedef int (zthr_func_t)(void *, zthr_t *); +typedef void (zthr_func_t)(void *, zthr_t *); typedef boolean_t (zthr_checkfunc_t)(void *, zthr_t *); -struct zthr { - kthread_t *zthr_thread; - kmutex_t zthr_lock; - kcondvar_t zthr_cv; - boolean_t zthr_cancel; - hrtime_t zthr_wait_time; - - zthr_checkfunc_t *zthr_checkfunc; - zthr_func_t *zthr_func; - void *zthr_arg; - int zthr_rc; -}; - extern zthr_t *zthr_create(zthr_checkfunc_t checkfunc, zthr_func_t *func, void *arg); extern zthr_t *zthr_create_timer(zthr_checkfunc_t *checkfunc, zthr_func_t *func, void *arg, hrtime_t nano_wait); - -extern void zthr_exit(zthr_t *t, int rc); extern void zthr_destroy(zthr_t *t); extern void zthr_wakeup(zthr_t *t); -extern int zthr_cancel(zthr_t *t); +extern void zthr_cancel(zthr_t *t); extern void zthr_resume(zthr_t *t); extern boolean_t zthr_iscancelled(zthr_t *t); -extern boolean_t zthr_isrunning(zthr_t *t); #endif /* _SYS_ZTHR_H */ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c Wed Oct 16 09:20:08 2019 (r353636) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c Wed Oct 16 09:21:12 2019 (r353637) @@ -642,7 +642,7 @@ spa_condense_indirect_thread_check(void *arg, zthr_t * } /* ARGSUSED */ -static int +static void spa_condense_indirect_thread(void *arg, zthr_t *zthr) { spa_t *spa = arg; @@ -739,13 +739,11 @@ spa_condense_indirect_thread(void *arg, zthr_t *zthr) * shutting down. */ if (zthr_iscancelled(zthr)) - return (0); + return; VERIFY0(dsl_sync_task(spa_name(spa), NULL, spa_condense_indirect_complete_sync, sci, 0, ZFS_SPACE_CHECK_EXTRA_RESERVED)); - - return (0); } /* Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zthr.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zthr.c Wed Oct 16 09:20:08 2019 (r353636) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zthr.c Wed Oct 16 09:21:12 2019 (r353637) @@ -14,7 +14,7 @@ */ /* - * Copyright (c) 2017 by Delphix. All rights reserved. + * Copyright (c) 2017, 2019 by Delphix. All rights reserved. */ /* @@ -28,7 +28,7 @@ * * 1] The operation needs to run over multiple txgs. * 2] There is be a single point of reference in memory or on disk that - * indicates whether the operation should run/is running or is + * indicates whether the operation should run/is running or has * stopped. * * If the operation satisfies the above then the following rules guarantee @@ -51,6 +51,9 @@ * during creation to wakeup on it's own after a specified interval * [see zthr_create_timer()]. * + * Note: ZTHR threads are NOT a replacement for generic threads! Please + * ensure that they fit your use-case well before using them. + * * == ZTHR creation * * Every zthr needs three inputs to start running: @@ -64,17 +67,17 @@ * 2] A user-defined ZTHR function (func) which the zthr executes when * it is not sleeping. The function should adhere to the following * signature type: - * int func_name(void *args, zthr_t *t); + * void func_name(void *args, zthr_t *t); * * 3] A void args pointer that will be passed to checkfunc and func * implicitly by the infrastructure. * * The reason why the above API needs two different functions, * instead of one that both checks and does the work, has to do with - * the zthr's internal lock (zthr_lock) and the allowed cancellation - * windows. We want to hold the zthr_lock while running checkfunc - * but not while running func. This way the zthr can be cancelled - * while doing work and not while checking for work. + * the zthr's internal state lock (zthr_state_lock) and the allowed + * cancellation windows. We want to hold the zthr_state_lock while + * running checkfunc but not while running func. This way the zthr + * can be cancelled while doing work and not while checking for work. * * To start a zthr: * zthr_t *zthr_pointer = zthr_create(checkfunc, func, args); @@ -83,7 +86,7 @@ * args, max_sleep); * * After that you should be able to wakeup, cancel, and resume the - * zthr from another thread using zthr_pointer. + * zthr from another thread using the zthr_pointer. * * NOTE: ZTHR threads could potentially wake up spuriously and the * user should take this into account when writing a checkfunc. @@ -102,8 +105,8 @@ * zthr_resume(zthr_pointer); * * A zthr will implicitly check if it has received a cancellation - * signal every time func returns and everytime it wakes up [see ZTHR - * state transitions below]. + * signal every time func returns and every time it wakes up [see + * ZTHR state transitions below]. * * At times, waiting for the zthr's func to finish its job may take * time. This may be very time-consuming for some operations that @@ -119,17 +122,8 @@ * while (!work_done && !zthr_iscancelled(t)) { * ... ... * } - * return (0); * } * - * == ZTHR exit - * - * For the rare cases where the zthr wants to stop running voluntarily - * while running its ZTHR function (func), we provide zthr_exit(). - * When a zthr has voluntarily stopped running, it can be resumed with - * zthr_resume(), just like it would if it was cancelled by some other - * thread. - * * == ZTHR cleanup * * Cancelling a zthr doesn't clean up its metadata (internal locks, @@ -165,49 +159,86 @@ * v * zthr stopped running * + * == Implementation of ZTHR requests + * + * ZTHR wakeup, cancel, and resume are requests on a zthr to + * change its internal state. Requests on a zthr are serialized + * using the zthr_request_lock, while changes in its internal + * state are protected by the zthr_state_lock. A request will + * first acquire the zthr_request_lock and then immediately + * acquire the zthr_state_lock. We do this so that incoming + * requests are serialized using the request lock, while still + * allowing us to use the state lock for thread communication + * via zthr_cv. */ #include #include -void -zthr_exit(zthr_t *t, int rc) -{ - ASSERT3P(t->zthr_thread, ==, curthread); - mutex_enter(&t->zthr_lock); - t->zthr_thread = NULL; - t->zthr_rc = rc; - cv_broadcast(&t->zthr_cv); - mutex_exit(&t->zthr_lock); - thread_exit(); -} +struct zthr { + /* running thread doing the work */ + kthread_t *zthr_thread; + /* lock protecting internal data & invariants */ + kmutex_t zthr_state_lock; + + /* mutex that serializes external requests */ + kmutex_t zthr_request_lock; + + /* notification mechanism for requests */ + kcondvar_t zthr_cv; + + /* flag set to true if we are canceling the zthr */ + boolean_t zthr_cancel; + + /* + * maximum amount of time that the zthr is spent sleeping; + * if this is 0, the thread doesn't wake up until it gets + * signaled. + */ + hrtime_t zthr_wait_time; + + /* consumer-provided callbacks & data */ + zthr_checkfunc_t *zthr_checkfunc; + zthr_func_t *zthr_func; + void *zthr_arg; +}; + static void zthr_procedure(void *arg) { zthr_t *t = arg; - int rc = 0; - mutex_enter(&t->zthr_lock); + mutex_enter(&t->zthr_state_lock); + ASSERT3P(t->zthr_thread, ==, curthread); + while (!t->zthr_cancel) { if (t->zthr_checkfunc(t->zthr_arg, t)) { - mutex_exit(&t->zthr_lock); - rc = t->zthr_func(t->zthr_arg, t); - mutex_enter(&t->zthr_lock); + mutex_exit(&t->zthr_state_lock); + t->zthr_func(t->zthr_arg, t); + mutex_enter(&t->zthr_state_lock); } else { /* go to sleep */ if (t->zthr_wait_time == 0) { - cv_wait(&t->zthr_cv, &t->zthr_lock); + cv_wait(&t->zthr_cv, &t->zthr_state_lock); } else { (void) cv_timedwait_hires(&t->zthr_cv, - &t->zthr_lock, t->zthr_wait_time, + &t->zthr_state_lock, t->zthr_wait_time, MSEC2NSEC(1), 0); } } } - mutex_exit(&t->zthr_lock); - zthr_exit(t, rc); + /* + * Clear out the kernel thread metadata and notify the + * zthr_cancel() thread that we've stopped running. + */ + t->zthr_thread = NULL; + t->zthr_cancel = B_FALSE; + cv_broadcast(&t->zthr_cv); + + mutex_exit(&t->zthr_state_lock); + thread_exit(); } zthr_t * @@ -226,10 +257,11 @@ zthr_create_timer(zthr_checkfunc_t *checkfunc, zthr_fu void *arg, hrtime_t max_sleep) { zthr_t *t = kmem_zalloc(sizeof (*t), KM_SLEEP); - mutex_init(&t->zthr_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&t->zthr_state_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&t->zthr_request_lock, NULL, MUTEX_DEFAULT, NULL); cv_init(&t->zthr_cv, NULL, CV_DEFAULT, NULL); - mutex_enter(&t->zthr_lock); + mutex_enter(&t->zthr_state_lock); t->zthr_checkfunc = checkfunc; t->zthr_func = func; t->zthr_arg = arg; @@ -237,7 +269,7 @@ zthr_create_timer(zthr_checkfunc_t *checkfunc, zthr_fu t->zthr_thread = thread_create(NULL, 0, zthr_procedure, t, 0, &p0, TS_RUN, minclsyspri); - mutex_exit(&t->zthr_lock); + mutex_exit(&t->zthr_state_lock); return (t); } @@ -245,71 +277,130 @@ zthr_create_timer(zthr_checkfunc_t *checkfunc, zthr_fu void zthr_destroy(zthr_t *t) { + ASSERT(!MUTEX_HELD(&t->zthr_state_lock)); + ASSERT(!MUTEX_HELD(&t->zthr_request_lock)); VERIFY3P(t->zthr_thread, ==, NULL); - mutex_destroy(&t->zthr_lock); + mutex_destroy(&t->zthr_request_lock); + mutex_destroy(&t->zthr_state_lock); cv_destroy(&t->zthr_cv); kmem_free(t, sizeof (*t)); } /* - * Note: If the zthr is not sleeping and misses the wakeup - * (e.g it is running its ZTHR function), it will check if - * there is work to do before going to sleep using its checker - * function [see ZTHR state transition in ZTHR block comment]. - * Thus, missing the wakeup still yields the expected behavior. + * Wake up the zthr if it is sleeping. If the thread has been + * cancelled that does nothing. */ void zthr_wakeup(zthr_t *t) { - mutex_enter(&t->zthr_lock); + mutex_enter(&t->zthr_request_lock); + mutex_enter(&t->zthr_state_lock); + + /* + * There are 4 states that we can find the zthr when issuing + * this broadcast: + * + * [1] The common case of the thread being asleep, at which + * point the broadcast will wake it up. + * [2] The thread has been cancelled. Waking up a cancelled + * thread is a no-op. Any work that is still left to be + * done should be handled the next time the thread is + * resumed. + * [3] The thread is doing work and is already up, so this + * is basically a no-op. + * [4] The thread was just created/resumed, in which case the + * behavior is similar to [3]. + */ cv_broadcast(&t->zthr_cv); - mutex_exit(&t->zthr_lock); + + mutex_exit(&t->zthr_state_lock); + mutex_exit(&t->zthr_request_lock); } /* - * Note: If the zthr is not running (e.g. has been cancelled + * Sends a cancel request to the zthr and blocks until the zthr is + * cancelled. If the zthr is not running (e.g. has been cancelled * already), this is a no-op. */ -int +void zthr_cancel(zthr_t *t) { - int rc = 0; + mutex_enter(&t->zthr_request_lock); + mutex_enter(&t->zthr_state_lock); - mutex_enter(&t->zthr_lock); + /* + * Since we are holding the zthr_state_lock at this point + * we can find the state in one of the following 4 states: + * + * [1] The thread has already been cancelled, therefore + * there is nothing for us to do. + * [2] The thread is sleeping, so we broadcast the CV first + * to wake it up and then we set the flag and we are + * waiting for it to exit. + * [3] The thread is doing work, in which case we just set + * the flag and wait for it to finish. + * [4] The thread was just created/resumed, in which case + * the behavior is similar to [3]. + * + * Since requests are serialized, by the time that we get + * control back we expect that the zthr is cancelled and + * not running anymore. + */ + if (t->zthr_thread != NULL) { + t->zthr_cancel = B_TRUE; - /* broadcast in case the zthr is sleeping */ - cv_broadcast(&t->zthr_cv); + /* broadcast in case the zthr is sleeping */ + cv_broadcast(&t->zthr_cv); - t->zthr_cancel = B_TRUE; - while (t->zthr_thread != NULL) - cv_wait(&t->zthr_cv, &t->zthr_lock); - t->zthr_cancel = B_FALSE; - rc = t->zthr_rc; - mutex_exit(&t->zthr_lock); + while (t->zthr_thread != NULL) + cv_wait(&t->zthr_cv, &t->zthr_state_lock); - return (rc); + ASSERT(!t->zthr_cancel); + } + + mutex_exit(&t->zthr_state_lock); + mutex_exit(&t->zthr_request_lock); } +/* + * Sends a resume request to the supplied zthr. If the zthr is + * already running this is a no-op. + */ void zthr_resume(zthr_t *t) { - ASSERT3P(t->zthr_thread, ==, NULL); + mutex_enter(&t->zthr_request_lock); + mutex_enter(&t->zthr_state_lock); - mutex_enter(&t->zthr_lock); - ASSERT3P(&t->zthr_checkfunc, !=, NULL); ASSERT3P(&t->zthr_func, !=, NULL); ASSERT(!t->zthr_cancel); - t->zthr_thread = thread_create(NULL, 0, zthr_procedure, t, - 0, &p0, TS_RUN, minclsyspri); + /* + * There are 4 states that we find the zthr in at this point + * given the locks that we hold: + * + * [1] The zthr was cancelled, so we spawn a new thread for + * the zthr (common case). + * [2] The zthr is running at which point this is a no-op. + * [3] The zthr is sleeping at which point this is a no-op. + * [4] The zthr was just spawned at which point this is a + * no-op. + */ + if (t->zthr_thread == NULL) { + t->zthr_thread = thread_create(NULL, 0, zthr_procedure, t, + 0, &p0, TS_RUN, minclsyspri); + } - mutex_exit(&t->zthr_lock); + mutex_exit(&t->zthr_state_lock); + mutex_exit(&t->zthr_request_lock); } /* * This function is intended to be used by the zthr itself - * to check if another thread has signal it to stop running. + * (specifically the zthr_func callback provided) to check + * if another thread has signaled it to stop running before + * doing some expensive operation. * * returns TRUE if we are in the middle of trying to cancel * this thread. @@ -319,25 +410,22 @@ zthr_resume(zthr_t *t) boolean_t zthr_iscancelled(zthr_t *t) { - boolean_t cancelled; - ASSERT3P(t->zthr_thread, ==, curthread); - mutex_enter(&t->zthr_lock); - cancelled = t->zthr_cancel; - mutex_exit(&t->zthr_lock); - + /* + * The majority of the functions here grab zthr_request_lock + * first and then zthr_state_lock. This function only grabs + * the zthr_state_lock. That is because this function should + * only be called from the zthr_func to check if someone has + * issued a zthr_cancel() on the thread. If there is a zthr_cancel() + * happening concurrently, attempting to grab the request lock + * here would result in a deadlock. + * + * By grabbing only the zthr_state_lock this function is allowed + * to run concurrently with a zthr_cancel() request. + */ + mutex_enter(&t->zthr_state_lock); + boolean_t cancelled = t->zthr_cancel; + mutex_exit(&t->zthr_state_lock); return (cancelled); -} - -boolean_t -zthr_isrunning(zthr_t *t) -{ - boolean_t running; - - mutex_enter(&t->zthr_lock); - running = (t->zthr_thread != NULL); - mutex_exit(&t->zthr_lock); - - return (running); } From owner-svn-src-all@freebsd.org Wed Oct 16 09:29:03 2019 Return-Path: Delivered-To: svn-src-all@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 705DE160604; Wed, 16 Oct 2019 09:29:03 +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 46tRnW38swz4VlB; Wed, 16 Oct 2019 09:29:03 +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 3566B4F43; Wed, 16 Oct 2019 09:29:03 +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 x9G9T31G083290; Wed, 16 Oct 2019 09:29:03 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G9T1l9083283; Wed, 16 Oct 2019 09:29:01 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910160929.x9G9T1l9083283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 09:29:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353638 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 353638 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 09:29:03 -0000 Author: avg Date: Wed Oct 16 09:29:01 2019 New Revision: 353638 URL: https://svnweb.freebsd.org/changeset/base/353638 Log: MFV r353637: 10844 Serialize ZTHR operations to eliminate races illumos/illumos-gate@6a316e1f6d32750bb8fcf2558dcb17b90ca580fd https://github.com/illumos/illumos-gate/commit/6a316e1f6d32750bb8fcf2558dcb17b90ca580fd https://www.illumos.org/issues/10844 ZoL 61c3391acc9 Serialize ZTHR operations to eliminate races Portions contributed by: Jerry Jelinek Author: Serapheim Dimitropoulos Obtained from: illumos, ZoL MFC after: 3 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_checkpoint.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_checkpoint.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zthr.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zthr.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Oct 16 09:21:12 2019 (r353637) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Oct 16 09:29:01 2019 (r353638) @@ -4896,7 +4896,7 @@ arc_adjust_cb_check(void *arg, zthr_t *zthr) * Keep arc_size under arc_c by running arc_adjust which evicts data * from the ARC. */ /* ARGSUSED */ -static int +static void arc_adjust_cb(void *arg, zthr_t *zthr) { uint64_t evicted = 0; @@ -4927,8 +4927,6 @@ arc_adjust_cb(void *arg, zthr_t *zthr) cv_broadcast(&arc_adjust_waiters_cv); } mutex_exit(&arc_adjust_lock); - - return (0); } /* ARGSUSED */ @@ -4970,7 +4968,7 @@ arc_reap_cb_check(void *arg, zthr_t *zthr) * to free more buffers. */ /* ARGSUSED */ -static int +static void arc_reap_cb(void *arg, zthr_t *zthr) { int64_t free_memory; @@ -5011,8 +5009,6 @@ arc_reap_cb(void *arg, zthr_t *zthr) #endif arc_reduce_target_size(to_free); } - - return (0); } static u_int arc_dnlc_evicts_arg; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Oct 16 09:21:12 2019 (r353637) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Oct 16 09:29:01 2019 (r353638) @@ -1438,13 +1438,11 @@ spa_unload(spa_t *spa) } if (spa->spa_condense_zthr != NULL) { - ASSERT(!zthr_isrunning(spa->spa_condense_zthr)); zthr_destroy(spa->spa_condense_zthr); spa->spa_condense_zthr = NULL; } if (spa->spa_checkpoint_discard_zthr != NULL) { - ASSERT(!zthr_isrunning(spa->spa_checkpoint_discard_zthr)); zthr_destroy(spa->spa_checkpoint_discard_zthr); spa->spa_checkpoint_discard_zthr = NULL; } @@ -7310,12 +7308,12 @@ spa_async_suspend(spa_t *spa) spa_vdev_remove_suspend(spa); zthr_t *condense_thread = spa->spa_condense_zthr; - if (condense_thread != NULL && zthr_isrunning(condense_thread)) - VERIFY0(zthr_cancel(condense_thread)); + if (condense_thread != NULL) + zthr_cancel(condense_thread); zthr_t *discard_thread = spa->spa_checkpoint_discard_zthr; - if (discard_thread != NULL && zthr_isrunning(discard_thread)) - VERIFY0(zthr_cancel(discard_thread)); + if (discard_thread != NULL) + zthr_cancel(discard_thread); } void @@ -7328,11 +7326,11 @@ spa_async_resume(spa_t *spa) spa_restart_removal(spa); zthr_t *condense_thread = spa->spa_condense_zthr; - if (condense_thread != NULL && !zthr_isrunning(condense_thread)) + if (condense_thread != NULL) zthr_resume(condense_thread); zthr_t *discard_thread = spa->spa_checkpoint_discard_zthr; - if (discard_thread != NULL && !zthr_isrunning(discard_thread)) + if (discard_thread != NULL) zthr_resume(discard_thread); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_checkpoint.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_checkpoint.c Wed Oct 16 09:21:12 2019 (r353637) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_checkpoint.c Wed Oct 16 09:29:01 2019 (r353638) @@ -391,7 +391,7 @@ spa_checkpoint_discard_thread_check(void *arg, zthr_t return (B_TRUE); } -int +void spa_checkpoint_discard_thread(void *arg, zthr_t *zthr) { spa_t *spa = arg; @@ -406,7 +406,7 @@ spa_checkpoint_discard_thread(void *arg, zthr_t *zthr) dmu_buf_t **dbp; if (zthr_iscancelled(zthr)) - return (0); + return; ASSERT3P(vd->vdev_ops, !=, &vdev_indirect_ops); @@ -443,8 +443,6 @@ spa_checkpoint_discard_thread(void *arg, zthr_t *zthr) VERIFY0(dsl_sync_task(spa->spa_name, NULL, spa_checkpoint_discard_complete_sync, spa, 0, ZFS_SPACE_CHECK_NONE)); - - return (0); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_checkpoint.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_checkpoint.h Wed Oct 16 09:21:12 2019 (r353637) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_checkpoint.h Wed Oct 16 09:29:01 2019 (r353638) @@ -37,7 +37,7 @@ int spa_checkpoint(const char *); int spa_checkpoint_discard(const char *); boolean_t spa_checkpoint_discard_thread_check(void *, zthr_t *); -int spa_checkpoint_discard_thread(void *, zthr_t *); +void spa_checkpoint_discard_thread(void *, zthr_t *); int spa_checkpoint_get_stats(spa_t *, pool_checkpoint_stat_t *); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zthr.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zthr.h Wed Oct 16 09:21:12 2019 (r353637) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zthr.h Wed Oct 16 09:29:01 2019 (r353638) @@ -14,42 +14,26 @@ */ /* - * Copyright (c) 2017 by Delphix. All rights reserved. + * Copyright (c) 2017, 2018 by Delphix. All rights reserved. */ #ifndef _SYS_ZTHR_H #define _SYS_ZTHR_H typedef struct zthr zthr_t; -typedef int (zthr_func_t)(void *, zthr_t *); +typedef void (zthr_func_t)(void *, zthr_t *); typedef boolean_t (zthr_checkfunc_t)(void *, zthr_t *); -struct zthr { - kthread_t *zthr_thread; - kmutex_t zthr_lock; - kcondvar_t zthr_cv; - boolean_t zthr_cancel; - hrtime_t zthr_wait_time; - - zthr_checkfunc_t *zthr_checkfunc; - zthr_func_t *zthr_func; - void *zthr_arg; - int zthr_rc; -}; - extern zthr_t *zthr_create(zthr_checkfunc_t checkfunc, zthr_func_t *func, void *arg); extern zthr_t *zthr_create_timer(zthr_checkfunc_t *checkfunc, zthr_func_t *func, void *arg, hrtime_t nano_wait); - -extern void zthr_exit(zthr_t *t, int rc); extern void zthr_destroy(zthr_t *t); extern void zthr_wakeup(zthr_t *t); -extern int zthr_cancel(zthr_t *t); +extern void zthr_cancel(zthr_t *t); extern void zthr_resume(zthr_t *t); extern boolean_t zthr_iscancelled(zthr_t *t); -extern boolean_t zthr_isrunning(zthr_t *t); #endif /* _SYS_ZTHR_H */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Wed Oct 16 09:21:12 2019 (r353637) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Wed Oct 16 09:29:01 2019 (r353638) @@ -642,7 +642,7 @@ spa_condense_indirect_thread_check(void *arg, zthr_t * } /* ARGSUSED */ -static int +static void spa_condense_indirect_thread(void *arg, zthr_t *zthr) { spa_t *spa = arg; @@ -739,13 +739,11 @@ spa_condense_indirect_thread(void *arg, zthr_t *zthr) * shutting down. */ if (zthr_iscancelled(zthr)) - return (0); + return; VERIFY0(dsl_sync_task(spa_name(spa), NULL, spa_condense_indirect_complete_sync, sci, 0, ZFS_SPACE_CHECK_EXTRA_RESERVED)); - - return (0); } /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zthr.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zthr.c Wed Oct 16 09:21:12 2019 (r353637) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zthr.c Wed Oct 16 09:29:01 2019 (r353638) @@ -14,7 +14,7 @@ */ /* - * Copyright (c) 2017 by Delphix. All rights reserved. + * Copyright (c) 2017, 2019 by Delphix. All rights reserved. */ /* @@ -28,7 +28,7 @@ * * 1] The operation needs to run over multiple txgs. * 2] There is be a single point of reference in memory or on disk that - * indicates whether the operation should run/is running or is + * indicates whether the operation should run/is running or has * stopped. * * If the operation satisfies the above then the following rules guarantee @@ -51,6 +51,9 @@ * during creation to wakeup on it's own after a specified interval * [see zthr_create_timer()]. * + * Note: ZTHR threads are NOT a replacement for generic threads! Please + * ensure that they fit your use-case well before using them. + * * == ZTHR creation * * Every zthr needs three inputs to start running: @@ -64,17 +67,17 @@ * 2] A user-defined ZTHR function (func) which the zthr executes when * it is not sleeping. The function should adhere to the following * signature type: - * int func_name(void *args, zthr_t *t); + * void func_name(void *args, zthr_t *t); * * 3] A void args pointer that will be passed to checkfunc and func * implicitly by the infrastructure. * * The reason why the above API needs two different functions, * instead of one that both checks and does the work, has to do with - * the zthr's internal lock (zthr_lock) and the allowed cancellation - * windows. We want to hold the zthr_lock while running checkfunc - * but not while running func. This way the zthr can be cancelled - * while doing work and not while checking for work. + * the zthr's internal state lock (zthr_state_lock) and the allowed + * cancellation windows. We want to hold the zthr_state_lock while + * running checkfunc but not while running func. This way the zthr + * can be cancelled while doing work and not while checking for work. * * To start a zthr: * zthr_t *zthr_pointer = zthr_create(checkfunc, func, args); @@ -83,7 +86,7 @@ * args, max_sleep); * * After that you should be able to wakeup, cancel, and resume the - * zthr from another thread using zthr_pointer. + * zthr from another thread using the zthr_pointer. * * NOTE: ZTHR threads could potentially wake up spuriously and the * user should take this into account when writing a checkfunc. @@ -102,8 +105,8 @@ * zthr_resume(zthr_pointer); * * A zthr will implicitly check if it has received a cancellation - * signal every time func returns and everytime it wakes up [see ZTHR - * state transitions below]. + * signal every time func returns and every time it wakes up [see + * ZTHR state transitions below]. * * At times, waiting for the zthr's func to finish its job may take * time. This may be very time-consuming for some operations that @@ -119,17 +122,8 @@ * while (!work_done && !zthr_iscancelled(t)) { * ... ... * } - * return (0); * } * - * == ZTHR exit - * - * For the rare cases where the zthr wants to stop running voluntarily - * while running its ZTHR function (func), we provide zthr_exit(). - * When a zthr has voluntarily stopped running, it can be resumed with - * zthr_resume(), just like it would if it was cancelled by some other - * thread. - * * == ZTHR cleanup * * Cancelling a zthr doesn't clean up its metadata (internal locks, @@ -165,49 +159,86 @@ * v * zthr stopped running * + * == Implementation of ZTHR requests + * + * ZTHR wakeup, cancel, and resume are requests on a zthr to + * change its internal state. Requests on a zthr are serialized + * using the zthr_request_lock, while changes in its internal + * state are protected by the zthr_state_lock. A request will + * first acquire the zthr_request_lock and then immediately + * acquire the zthr_state_lock. We do this so that incoming + * requests are serialized using the request lock, while still + * allowing us to use the state lock for thread communication + * via zthr_cv. */ #include #include -void -zthr_exit(zthr_t *t, int rc) -{ - ASSERT3P(t->zthr_thread, ==, curthread); - mutex_enter(&t->zthr_lock); - t->zthr_thread = NULL; - t->zthr_rc = rc; - cv_broadcast(&t->zthr_cv); - mutex_exit(&t->zthr_lock); - thread_exit(); -} +struct zthr { + /* running thread doing the work */ + kthread_t *zthr_thread; + /* lock protecting internal data & invariants */ + kmutex_t zthr_state_lock; + + /* mutex that serializes external requests */ + kmutex_t zthr_request_lock; + + /* notification mechanism for requests */ + kcondvar_t zthr_cv; + + /* flag set to true if we are canceling the zthr */ + boolean_t zthr_cancel; + + /* + * maximum amount of time that the zthr is spent sleeping; + * if this is 0, the thread doesn't wake up until it gets + * signaled. + */ + hrtime_t zthr_wait_time; + + /* consumer-provided callbacks & data */ + zthr_checkfunc_t *zthr_checkfunc; + zthr_func_t *zthr_func; + void *zthr_arg; +}; + static void zthr_procedure(void *arg) { zthr_t *t = arg; - int rc = 0; - mutex_enter(&t->zthr_lock); + mutex_enter(&t->zthr_state_lock); + ASSERT3P(t->zthr_thread, ==, curthread); + while (!t->zthr_cancel) { if (t->zthr_checkfunc(t->zthr_arg, t)) { - mutex_exit(&t->zthr_lock); - rc = t->zthr_func(t->zthr_arg, t); - mutex_enter(&t->zthr_lock); + mutex_exit(&t->zthr_state_lock); + t->zthr_func(t->zthr_arg, t); + mutex_enter(&t->zthr_state_lock); } else { /* go to sleep */ if (t->zthr_wait_time == 0) { - cv_wait(&t->zthr_cv, &t->zthr_lock); + cv_wait(&t->zthr_cv, &t->zthr_state_lock); } else { (void) cv_timedwait_hires(&t->zthr_cv, - &t->zthr_lock, t->zthr_wait_time, + &t->zthr_state_lock, t->zthr_wait_time, MSEC2NSEC(1), 0); } } } - mutex_exit(&t->zthr_lock); - zthr_exit(t, rc); + /* + * Clear out the kernel thread metadata and notify the + * zthr_cancel() thread that we've stopped running. + */ + t->zthr_thread = NULL; + t->zthr_cancel = B_FALSE; + cv_broadcast(&t->zthr_cv); + + mutex_exit(&t->zthr_state_lock); + thread_exit(); } zthr_t * @@ -226,10 +257,11 @@ zthr_create_timer(zthr_checkfunc_t *checkfunc, zthr_fu void *arg, hrtime_t max_sleep) { zthr_t *t = kmem_zalloc(sizeof (*t), KM_SLEEP); - mutex_init(&t->zthr_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&t->zthr_state_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&t->zthr_request_lock, NULL, MUTEX_DEFAULT, NULL); cv_init(&t->zthr_cv, NULL, CV_DEFAULT, NULL); - mutex_enter(&t->zthr_lock); + mutex_enter(&t->zthr_state_lock); t->zthr_checkfunc = checkfunc; t->zthr_func = func; t->zthr_arg = arg; @@ -237,7 +269,7 @@ zthr_create_timer(zthr_checkfunc_t *checkfunc, zthr_fu t->zthr_thread = thread_create(NULL, 0, zthr_procedure, t, 0, &p0, TS_RUN, minclsyspri); - mutex_exit(&t->zthr_lock); + mutex_exit(&t->zthr_state_lock); return (t); } @@ -245,71 +277,130 @@ zthr_create_timer(zthr_checkfunc_t *checkfunc, zthr_fu void zthr_destroy(zthr_t *t) { + ASSERT(!MUTEX_HELD(&t->zthr_state_lock)); + ASSERT(!MUTEX_HELD(&t->zthr_request_lock)); VERIFY3P(t->zthr_thread, ==, NULL); - mutex_destroy(&t->zthr_lock); + mutex_destroy(&t->zthr_request_lock); + mutex_destroy(&t->zthr_state_lock); cv_destroy(&t->zthr_cv); kmem_free(t, sizeof (*t)); } /* - * Note: If the zthr is not sleeping and misses the wakeup - * (e.g it is running its ZTHR function), it will check if - * there is work to do before going to sleep using its checker - * function [see ZTHR state transition in ZTHR block comment]. - * Thus, missing the wakeup still yields the expected behavior. + * Wake up the zthr if it is sleeping. If the thread has been + * cancelled that does nothing. */ void zthr_wakeup(zthr_t *t) { - mutex_enter(&t->zthr_lock); + mutex_enter(&t->zthr_request_lock); + mutex_enter(&t->zthr_state_lock); + + /* + * There are 4 states that we can find the zthr when issuing + * this broadcast: + * + * [1] The common case of the thread being asleep, at which + * point the broadcast will wake it up. + * [2] The thread has been cancelled. Waking up a cancelled + * thread is a no-op. Any work that is still left to be + * done should be handled the next time the thread is + * resumed. + * [3] The thread is doing work and is already up, so this + * is basically a no-op. + * [4] The thread was just created/resumed, in which case the + * behavior is similar to [3]. + */ cv_broadcast(&t->zthr_cv); - mutex_exit(&t->zthr_lock); + + mutex_exit(&t->zthr_state_lock); + mutex_exit(&t->zthr_request_lock); } /* - * Note: If the zthr is not running (e.g. has been cancelled + * Sends a cancel request to the zthr and blocks until the zthr is + * cancelled. If the zthr is not running (e.g. has been cancelled * already), this is a no-op. */ -int +void zthr_cancel(zthr_t *t) { - int rc = 0; + mutex_enter(&t->zthr_request_lock); + mutex_enter(&t->zthr_state_lock); - mutex_enter(&t->zthr_lock); + /* + * Since we are holding the zthr_state_lock at this point + * we can find the state in one of the following 4 states: + * + * [1] The thread has already been cancelled, therefore + * there is nothing for us to do. + * [2] The thread is sleeping, so we broadcast the CV first + * to wake it up and then we set the flag and we are + * waiting for it to exit. + * [3] The thread is doing work, in which case we just set + * the flag and wait for it to finish. + * [4] The thread was just created/resumed, in which case + * the behavior is similar to [3]. + * + * Since requests are serialized, by the time that we get + * control back we expect that the zthr is cancelled and + * not running anymore. + */ + if (t->zthr_thread != NULL) { + t->zthr_cancel = B_TRUE; - /* broadcast in case the zthr is sleeping */ - cv_broadcast(&t->zthr_cv); + /* broadcast in case the zthr is sleeping */ + cv_broadcast(&t->zthr_cv); - t->zthr_cancel = B_TRUE; - while (t->zthr_thread != NULL) - cv_wait(&t->zthr_cv, &t->zthr_lock); - t->zthr_cancel = B_FALSE; - rc = t->zthr_rc; - mutex_exit(&t->zthr_lock); + while (t->zthr_thread != NULL) + cv_wait(&t->zthr_cv, &t->zthr_state_lock); - return (rc); + ASSERT(!t->zthr_cancel); + } + + mutex_exit(&t->zthr_state_lock); + mutex_exit(&t->zthr_request_lock); } +/* + * Sends a resume request to the supplied zthr. If the zthr is + * already running this is a no-op. + */ void zthr_resume(zthr_t *t) { - ASSERT3P(t->zthr_thread, ==, NULL); + mutex_enter(&t->zthr_request_lock); + mutex_enter(&t->zthr_state_lock); - mutex_enter(&t->zthr_lock); - ASSERT3P(&t->zthr_checkfunc, !=, NULL); ASSERT3P(&t->zthr_func, !=, NULL); ASSERT(!t->zthr_cancel); - t->zthr_thread = thread_create(NULL, 0, zthr_procedure, t, - 0, &p0, TS_RUN, minclsyspri); + /* + * There are 4 states that we find the zthr in at this point + * given the locks that we hold: + * + * [1] The zthr was cancelled, so we spawn a new thread for + * the zthr (common case). + * [2] The zthr is running at which point this is a no-op. + * [3] The zthr is sleeping at which point this is a no-op. + * [4] The zthr was just spawned at which point this is a + * no-op. + */ + if (t->zthr_thread == NULL) { + t->zthr_thread = thread_create(NULL, 0, zthr_procedure, t, + 0, &p0, TS_RUN, minclsyspri); + } - mutex_exit(&t->zthr_lock); + mutex_exit(&t->zthr_state_lock); + mutex_exit(&t->zthr_request_lock); } /* * This function is intended to be used by the zthr itself - * to check if another thread has signal it to stop running. + * (specifically the zthr_func callback provided) to check + * if another thread has signaled it to stop running before + * doing some expensive operation. * * returns TRUE if we are in the middle of trying to cancel * this thread. @@ -319,25 +410,22 @@ zthr_resume(zthr_t *t) boolean_t zthr_iscancelled(zthr_t *t) { - boolean_t cancelled; - ASSERT3P(t->zthr_thread, ==, curthread); - mutex_enter(&t->zthr_lock); - cancelled = t->zthr_cancel; - mutex_exit(&t->zthr_lock); - + /* + * The majority of the functions here grab zthr_request_lock + * first and then zthr_state_lock. This function only grabs + * the zthr_state_lock. That is because this function should + * only be called from the zthr_func to check if someone has + * issued a zthr_cancel() on the thread. If there is a zthr_cancel() + * happening concurrently, attempting to grab the request lock + * here would result in a deadlock. + * + * By grabbing only the zthr_state_lock this function is allowed + * to run concurrently with a zthr_cancel() request. + */ + mutex_enter(&t->zthr_state_lock); + boolean_t cancelled = t->zthr_cancel; + mutex_exit(&t->zthr_state_lock); return (cancelled); -} - -boolean_t -zthr_isrunning(zthr_t *t) -{ - boolean_t running; - - mutex_enter(&t->zthr_lock); - running = (t->zthr_thread != NULL); - mutex_exit(&t->zthr_lock); - - return (running); } From owner-svn-src-all@freebsd.org Wed Oct 16 09:52:33 2019 Return-Path: Delivered-To: svn-src-all@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 6CC341610ED for ; Wed, 16 Oct 2019 09:52:33 +0000 (UTC) (envelope-from svn-src-all@freebsd.org) Received: from mail.web-tamashin.jp (181.243.128.210.static.iijgio.jp [210.128.243.181]) by mx1.freebsd.org (Postfix) with ESMTP id 46tSJc4tMvz4X4J for ; Wed, 16 Oct 2019 09:52:32 +0000 (UTC) (envelope-from svn-src-all@freebsd.org) Received: from fixed-138-186-29-150.totalplay.net (unknown [192.168.0.2]) by mail.web-tamashin.jp (Postfix) with ESMTP id 0293F4FFDB for ; Wed, 16 Oct 2019 18:30:56 +0900 (JST) From: Mejores Ventas To: svn-src-all@freebsd.org Subject: Directorio Empresarial Mexico - Octubre 2019. Date: 16 Oct 2019 04:30:55 -0500 Message-ID: <20191016043055.2D8B8088EBA95910@freebsd.org> X-Rspamd-Queue-Id: 46tSJc4tMvz4X4J X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.29 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.29)[-0.290,0]; ASN(0.00)[asn:2497, ipnet:210.128.0.0/16, country:JP]; NEURAL_HAM_LONG(-1.00)[-0.998,0] MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 09:52:33 -0000 From owner-svn-src-all@freebsd.org Wed Oct 16 13:20:36 2019 Return-Path: Delivered-To: svn-src-all@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 C6DB6165061; Wed, 16 Oct 2019 13:20:36 +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 46tXwh4wgfz3FpB; Wed, 16 Oct 2019 13:20:36 +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 8C3A178F3; Wed, 16 Oct 2019 13:20:36 +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 x9GDKaab021463; Wed, 16 Oct 2019 13:20:36 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GDKaBK021462; Wed, 16 Oct 2019 13:20:36 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201910161320.x9GDKaBK021462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 16 Oct 2019 13:20:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353639 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 353639 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 13:20:36 -0000 Author: imp Date: Wed Oct 16 13:20:36 2019 New Revision: 353639 URL: https://svnweb.freebsd.org/changeset/base/353639 Log: bsd.compat.mk isn't setup to be included outside of Makefile.inc so comment it out here until that's sorted out. Otherwise the build is broken. when TARGET_ARCH isn't defined. Modified: head/share/mk/bsd.prog.mk Modified: head/share/mk/bsd.prog.mk ============================================================================== --- head/share/mk/bsd.prog.mk Wed Oct 16 09:29:01 2019 (r353638) +++ head/share/mk/bsd.prog.mk Wed Oct 16 13:20:36 2019 (r353639) @@ -2,7 +2,7 @@ # $FreeBSD$ .include -.include +# .include .include .include From owner-svn-src-all@freebsd.org Wed Oct 16 13:21:02 2019 Return-Path: Delivered-To: svn-src-all@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 6F4C91651F0; Wed, 16 Oct 2019 13:21:02 +0000 (UTC) (envelope-from andrew@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 46tXxB2LpZz3Fy2; Wed, 16 Oct 2019 13:21:02 +0000 (UTC) (envelope-from andrew@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 33F7A7913; Wed, 16 Oct 2019 13:21:02 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9GDL2s8021560; Wed, 16 Oct 2019 13:21:02 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GDL2ee021543; Wed, 16 Oct 2019 13:21:02 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910161321.x9GDL2ee021543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 16 Oct 2019 13:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353640 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 353640 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 13:21:02 -0000 Author: andrew Date: Wed Oct 16 13:21:01 2019 New Revision: 353640 URL: https://svnweb.freebsd.org/changeset/base/353640 Log: Stop leaking information from the kernel through timespec The timespec struct holds a seconds value in a time_t and a nanoseconds value in a long. On most architectures these are the same size, however on 32-bit architectures other than i386 time_t is 8 bytes and long is 4 bytes. Most ABIs will then pad a struct holding an 8 byte and 4 byte value to 16 bytes with 4 bytes of padding. When copying one of these structs the compiler is free to copy the padding if it wishes. In this case the padding may contain kernel data that is then leaked to userspace. Fix this by copying the timespec elements rather than the entire struct. This doesn't affect Tier-1 architectures so no SA is expected. admbugs: 651 MFC after: 1 week Sponsored by: DARPA, AFRL Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Wed Oct 16 13:20:36 2019 (r353639) +++ head/sys/kern/vfs_vnops.c Wed Oct 16 13:21:01 2019 (r353640) @@ -1455,10 +1455,14 @@ vn_stat(struct vnode *vp, struct stat *sb, struct ucre if (vap->va_size > OFF_MAX) return (EOVERFLOW); sb->st_size = vap->va_size; - sb->st_atim = vap->va_atime; - sb->st_mtim = vap->va_mtime; - sb->st_ctim = vap->va_ctime; - sb->st_birthtim = vap->va_birthtime; + sb->st_atim.tv_sec = vap->va_atime.tv_sec; + sb->st_atim.tv_nsec = vap->va_atime.tv_nsec; + sb->st_mtim.tv_sec = vap->va_mtime.tv_sec; + sb->st_mtim.tv_nsec = vap->va_mtime.tv_nsec; + sb->st_ctim.tv_sec = vap->va_ctime.tv_sec; + sb->st_ctim.tv_nsec = vap->va_ctime.tv_nsec; + sb->st_birthtim.tv_sec = vap->va_birthtime.tv_sec; + sb->st_birthtim.tv_nsec = vap->va_birthtime.tv_nsec; /* * According to www.opengroup.org, the meaning of st_blksize is From owner-svn-src-all@freebsd.org Wed Oct 16 13:30:28 2019 Return-Path: Delivered-To: svn-src-all@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 F02DD16536B; Wed, 16 Oct 2019 13:30:28 +0000 (UTC) (envelope-from andrew@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 46tY846rqCz3Gbn; Wed, 16 Oct 2019 13:30:28 +0000 (UTC) (envelope-from andrew@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 B55327ABD; Wed, 16 Oct 2019 13:30:28 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9GDUSAU027339; Wed, 16 Oct 2019 13:30:28 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GDUSd1027338; Wed, 16 Oct 2019 13:30:28 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910161330.x9GDUSd1027338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 16 Oct 2019 13:30:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353641 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 353641 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 13:30:29 -0000 Author: andrew Date: Wed Oct 16 13:30:28 2019 New Revision: 353641 URL: https://svnweb.freebsd.org/changeset/base/353641 Log: Use tables to store the information to decode the arm64 ID registers. Arm updates these with each new architecture revision. To help keep them updated use a collection of tables to hold the needed information to decode these registers. Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22020 Modified: head/sys/arm64/arm64/identcpu.c Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Wed Oct 16 13:21:01 2019 (r353640) +++ head/sys/arm64/arm64/identcpu.c Wed Oct 16 13:30:28 2019 (r353641) @@ -204,71 +204,511 @@ const struct cpu_implementers cpu_implementers[] = { #define MRS_EXACT_FIELD(x) ((x) >> 4) #define MRS_LOWER 2 +struct mrs_field_value { + uint64_t value; + const char *desc; +}; + +#define MRS_FIELD_VALUE(_value, _desc) \ + { \ + .value = (_value), \ + .desc = (_desc), \ + } + +#define MRS_FIELD_VALUE_NONE_IMPL(_reg, _field, _none, _impl) \ + MRS_FIELD_VALUE(_reg ## _ ## _field ## _ ## _none, ""), \ + MRS_FIELD_VALUE(_reg ## _ ## _field ## _ ## _impl, #_field) + +#define MRS_FIELD_VALUE_COUNT(_reg, _field, _desc) \ + MRS_FIELD_VALUE(0ul << _reg ## _ ## _field ## _SHIFT, "1 " _desc), \ + MRS_FIELD_VALUE(1ul << _reg ## _ ## _field ## _SHIFT, "2 " _desc "s"), \ + MRS_FIELD_VALUE(2ul << _reg ## _ ## _field ## _SHIFT, "3 " _desc "s"), \ + MRS_FIELD_VALUE(3ul << _reg ## _ ## _field ## _SHIFT, "4 " _desc "s"), \ + MRS_FIELD_VALUE(4ul << _reg ## _ ## _field ## _SHIFT, "5 " _desc "s"), \ + MRS_FIELD_VALUE(5ul << _reg ## _ ## _field ## _SHIFT, "6 " _desc "s"), \ + MRS_FIELD_VALUE(6ul << _reg ## _ ## _field ## _SHIFT, "7 " _desc "s"), \ + MRS_FIELD_VALUE(7ul << _reg ## _ ## _field ## _SHIFT, "8 " _desc "s"), \ + MRS_FIELD_VALUE(8ul << _reg ## _ ## _field ## _SHIFT, "9 " _desc "s"), \ + MRS_FIELD_VALUE(9ul << _reg ## _ ## _field ## _SHIFT, "10 "_desc "s"), \ + MRS_FIELD_VALUE(10ul<< _reg ## _ ## _field ## _SHIFT, "11 "_desc "s"), \ + MRS_FIELD_VALUE(11ul<< _reg ## _ ## _field ## _SHIFT, "12 "_desc "s"), \ + MRS_FIELD_VALUE(12ul<< _reg ## _ ## _field ## _SHIFT, "13 "_desc "s"), \ + MRS_FIELD_VALUE(13ul<< _reg ## _ ## _field ## _SHIFT, "14 "_desc "s"), \ + MRS_FIELD_VALUE(14ul<< _reg ## _ ## _field ## _SHIFT, "15 "_desc "s"), \ + MRS_FIELD_VALUE(15ul<< _reg ## _ ## _field ## _SHIFT, "16 "_desc "s") + +#define MRS_FIELD_VALUE_END { .desc = NULL } + struct mrs_field { + const char *name; + struct mrs_field_value *values; + uint64_t mask; bool sign; u_int type; u_int shift; }; -#define MRS_FIELD(_sign, _type, _shift) \ +#define MRS_FIELD(_register, _name, _sign, _type, _values) \ { \ + .name = #_name, \ .sign = (_sign), \ .type = (_type), \ - .shift = (_shift), \ + .shift = _register ## _ ## _name ## _SHIFT, \ + .mask = _register ## _ ## _name ## _MASK, \ + .values = (_values), \ } #define MRS_FIELD_END { .type = MRS_INVALID, } +/* ID_AA64AFR0_EL1 */ +static struct mrs_field id_aa64afr0_fields[] = { + MRS_FIELD_END, +}; + + +/* ID_AA64AFR1_EL1 */ +static struct mrs_field id_aa64afr1_fields[] = { + MRS_FIELD_END, +}; + + +/* ID_AA64DFR0_EL1 */ +static struct mrs_field_value id_aa64dfr0_pmsver[] = { + MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_NONE, ""), + MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_V1, "SPE"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64dfr0_ctx_cmps[] = { + MRS_FIELD_VALUE_COUNT(ID_AA64DFR0, CTX_CMPs, "CTX BKPT"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64dfr0_wrps[] = { + MRS_FIELD_VALUE_COUNT(ID_AA64DFR0, WRPs, "Watchpoint"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64dfr0_brps[] = { + MRS_FIELD_VALUE_COUNT(ID_AA64DFR0, BRPs, "Breakpoint"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64dfr0_pmuver[] = { + MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_NONE, ""), + MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3, "PMUv3"), + MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3_1, "PMUv3+16 bit evtCount"), + MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_IMPL, "IMPL PMU"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64dfr0_tracever[] = { + MRS_FIELD_VALUE(ID_AA64DFR0_TraceVer_NONE, ""), + MRS_FIELD_VALUE(ID_AA64DFR0_TraceVer_IMPL, "Trace"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64dfr0_debugver[] = { + MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8, "Debugv8"), + MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8_VHE, "Debugv8_VHE"), + MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8_2, "Debugv8.2"), + MRS_FIELD_VALUE_END, +}; + static struct mrs_field id_aa64dfr0_fields[] = { - MRS_FIELD(false, MRS_EXACT, ID_AA64DFR0_PMSVer_SHIFT), - MRS_FIELD(false, MRS_EXACT, ID_AA64DFR0_CTX_CMPs_SHIFT), - MRS_FIELD(false, MRS_EXACT, ID_AA64DFR0_WRPs_SHIFT), - MRS_FIELD(false, MRS_EXACT, ID_AA64DFR0_BRPs_SHIFT), - MRS_FIELD(false, MRS_EXACT, ID_AA64DFR0_PMUVer_SHIFT), - MRS_FIELD(false, MRS_EXACT, ID_AA64DFR0_TraceVer_SHIFT), - MRS_FIELD(false, MRS_EXACT_VAL(0x6), ID_AA64DFR0_DebugVer_SHIFT), + MRS_FIELD(ID_AA64DFR0, PMSVer, false, MRS_EXACT, id_aa64dfr0_pmsver), + MRS_FIELD(ID_AA64DFR0, CTX_CMPs, false, MRS_EXACT, + id_aa64dfr0_ctx_cmps), + MRS_FIELD(ID_AA64DFR0, WRPs, false, MRS_EXACT, id_aa64dfr0_wrps), + MRS_FIELD(ID_AA64DFR0, BRPs, false, MRS_EXACT, id_aa64dfr0_brps), + MRS_FIELD(ID_AA64DFR0, PMUVer, false, MRS_EXACT, id_aa64dfr0_pmuver), + MRS_FIELD(ID_AA64DFR0, TraceVer, false, MRS_EXACT, + id_aa64dfr0_tracever), + MRS_FIELD(ID_AA64DFR0, DebugVer, false, MRS_EXACT_VAL(0x6), + id_aa64dfr0_debugver), MRS_FIELD_END, }; + +/* ID_AA64DFR1 */ +static struct mrs_field id_aa64dfr1_fields[] = { + MRS_FIELD_END, +}; + + +/* ID_AA64ISAR0_EL1 */ +static struct mrs_field_value id_aa64isar0_dp[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, DP, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar0_sm4[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, SM4, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar0_sm3[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, SM3, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar0_sha3[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, SHA3, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar0_rdm[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, RDM, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar0_atomic[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, Atomic, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar0_crc32[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, CRC32, NONE, BASE), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar0_sha2[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, SHA2, NONE, BASE), + MRS_FIELD_VALUE(ID_AA64ISAR0_SHA2_512, "SHA2+SHA512"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar0_sha1[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, SHA1, NONE, BASE), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar0_aes[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, AES, NONE, BASE), + MRS_FIELD_VALUE(ID_AA64ISAR0_AES_PMULL, "AES+PMULL"), + MRS_FIELD_VALUE_END, +}; + static struct mrs_field id_aa64isar0_fields[] = { - MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR0_DP_SHIFT), - MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR0_SM4_SHIFT), - MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR0_SM3_SHIFT), - MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR0_SHA3_SHIFT), - MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR0_RDM_SHIFT), - MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR0_Atomic_SHIFT), - MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR0_CRC32_SHIFT), - MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR0_SHA2_SHIFT), - MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR0_SHA1_SHIFT), - MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR0_AES_SHIFT), + MRS_FIELD(ID_AA64ISAR0, DP, false, MRS_LOWER, id_aa64isar0_dp), + MRS_FIELD(ID_AA64ISAR0, SM4, false, MRS_LOWER, id_aa64isar0_sm4), + MRS_FIELD(ID_AA64ISAR0, SM3, false, MRS_LOWER, id_aa64isar0_sm3), + MRS_FIELD(ID_AA64ISAR0, SHA3, false, MRS_LOWER, id_aa64isar0_sha3), + MRS_FIELD(ID_AA64ISAR0, RDM, false, MRS_LOWER, id_aa64isar0_rdm), + MRS_FIELD(ID_AA64ISAR0, Atomic, false, MRS_LOWER, id_aa64isar0_atomic), + MRS_FIELD(ID_AA64ISAR0, CRC32, false, MRS_LOWER, id_aa64isar0_crc32), + MRS_FIELD(ID_AA64ISAR0, SHA2, false, MRS_LOWER, id_aa64isar0_sha2), + MRS_FIELD(ID_AA64ISAR0, SHA1, false, MRS_LOWER, id_aa64isar0_sha1), + MRS_FIELD(ID_AA64ISAR0, AES, false, MRS_LOWER, id_aa64isar0_aes), MRS_FIELD_END, }; + +/* ID_AA64ISAR1_EL1 */ +static struct mrs_field_value id_aa64isar1_gpi[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, GPI, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar1_gpa[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, GPA, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar1_lrcpc[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, LRCPC, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar1_fcma[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, FCMA, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar1_jscvt[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, JSCVT, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar1_api[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, API, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar1_apa[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, GPA, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar1_dpb[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, DPB, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + static struct mrs_field id_aa64isar1_fields[] = { - MRS_FIELD(false, MRS_EXACT, ID_AA64ISAR1_GPI_SHIFT), - MRS_FIELD(false, MRS_EXACT, ID_AA64ISAR1_GPA_SHIFT), - MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_LRCPC_SHIFT), - MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_FCMA_SHIFT), - MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_JSCVT_SHIFT), - MRS_FIELD(false, MRS_EXACT, ID_AA64ISAR1_API_SHIFT), - MRS_FIELD(false, MRS_EXACT, ID_AA64ISAR1_APA_SHIFT), - MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_DPB_SHIFT), + MRS_FIELD(ID_AA64ISAR1, GPI, false, MRS_EXACT, id_aa64isar1_gpi), + MRS_FIELD(ID_AA64ISAR1, GPA, false, MRS_EXACT, id_aa64isar1_gpa), + MRS_FIELD(ID_AA64ISAR1, LRCPC, false, MRS_LOWER, id_aa64isar1_lrcpc), + MRS_FIELD(ID_AA64ISAR1, FCMA, false, MRS_LOWER, id_aa64isar1_fcma), + MRS_FIELD(ID_AA64ISAR1, JSCVT, false, MRS_LOWER, id_aa64isar1_jscvt), + MRS_FIELD(ID_AA64ISAR1, API, false, MRS_EXACT, id_aa64isar1_api), + MRS_FIELD(ID_AA64ISAR1, APA, false, MRS_EXACT, id_aa64isar1_apa), + MRS_FIELD(ID_AA64ISAR1, DPB, false, MRS_LOWER, id_aa64isar1_dpb), MRS_FIELD_END, }; + +/* ID_AA64MMFR0_EL1 */ +static struct mrs_field_value id_aa64mmfr0_tgran4[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, TGran4, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr0_tgran64[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, TGran64, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr0_tgran16[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, TGran16, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr0_bigend_el0[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, BigEndEL0, FIXED, MIXED), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr0_snsmem[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, SNSMem, NONE, DISTINCT), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr0_bigend[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, BigEnd, FIXED, MIXED), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr0_asid_bits[] = { + MRS_FIELD_VALUE(ID_AA64MMFR0_ASIDBits_8, "8bit ASID"), + MRS_FIELD_VALUE(ID_AA64MMFR0_ASIDBits_16, "16bit ASID"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr0_parange[] = { + MRS_FIELD_VALUE(ID_AA64MMFR0_PARange_4G, "4GB PA"), + MRS_FIELD_VALUE(ID_AA64MMFR0_PARange_64G, "64GB PA"), + MRS_FIELD_VALUE(ID_AA64MMFR0_PARange_1T, "1TB PA"), + MRS_FIELD_VALUE(ID_AA64MMFR0_PARange_4T, "4TB PA"), + MRS_FIELD_VALUE(ID_AA64MMFR0_PARange_16T, "16TB PA"), + MRS_FIELD_VALUE(ID_AA64MMFR0_PARange_256T, "256TB PA"), + MRS_FIELD_VALUE(ID_AA64MMFR0_PARange_4P, "4PB PA"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field id_aa64mmfr0_fields[] = { + MRS_FIELD(ID_AA64MMFR0, TGran4, false, MRS_EXACT, id_aa64mmfr0_tgran4), + MRS_FIELD(ID_AA64MMFR0, TGran64, false, MRS_EXACT, + id_aa64mmfr0_tgran64), + MRS_FIELD(ID_AA64MMFR0, TGran16, false, MRS_EXACT, + id_aa64mmfr0_tgran16), + MRS_FIELD(ID_AA64MMFR0, BigEndEL0, false, MRS_EXACT, + id_aa64mmfr0_bigend_el0), + MRS_FIELD(ID_AA64MMFR0, SNSMem, false, MRS_EXACT, id_aa64mmfr0_snsmem), + MRS_FIELD(ID_AA64MMFR0, BigEnd, false, MRS_EXACT, id_aa64mmfr0_bigend), + MRS_FIELD(ID_AA64MMFR0, ASIDBits, false, MRS_EXACT, + id_aa64mmfr0_asid_bits), + MRS_FIELD(ID_AA64MMFR0, PARange, false, MRS_EXACT, + id_aa64mmfr0_parange), + MRS_FIELD_END, +}; + + +/* ID_AA64MMFR1_EL1 */ +static struct mrs_field_value id_aa64mmfr1_xnx[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR1, XNX, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr1_specsei[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR1, SpecSEI, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr1_pan[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR1, PAN, NONE, IMPL), + MRS_FIELD_VALUE(ID_AA64MMFR1_PAN_ATS1E1, "PAN+ATS1E1"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr1_lo[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR1, LO, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr1_hpds[] = { + MRS_FIELD_VALUE(ID_AA64MMFR1_HPDS_NONE, ""), + MRS_FIELD_VALUE(ID_AA64MMFR1_HPDS_HPD, "HPD"), + MRS_FIELD_VALUE(ID_AA64MMFR1_HPDS_TTPBHA, "HPD+TTPBHA"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr1_vh[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR1, VH, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr1_vmidbits[] = { + MRS_FIELD_VALUE(ID_AA64MMFR1_VMIDBits_8, "8bit VMID"), + MRS_FIELD_VALUE(ID_AA64MMFR1_VMIDBits_16, "16bit VMID"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr1_hafdbs[] = { + MRS_FIELD_VALUE(ID_AA64MMFR1_HAFDBS_NONE, ""), + MRS_FIELD_VALUE(ID_AA64MMFR1_HAFDBS_AF, "HAF"), + MRS_FIELD_VALUE(ID_AA64MMFR1_HAFDBS_AF_DBS, "HAF+DS"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field id_aa64mmfr1_fields[] = { + MRS_FIELD(ID_AA64MMFR1, XNX, false, MRS_EXACT, id_aa64mmfr1_xnx), + MRS_FIELD(ID_AA64MMFR1, SpecSEI, false, MRS_EXACT, + id_aa64mmfr1_specsei), + MRS_FIELD(ID_AA64MMFR1, PAN, false, MRS_EXACT, id_aa64mmfr1_pan), + MRS_FIELD(ID_AA64MMFR1, LO, false, MRS_EXACT, id_aa64mmfr1_lo), + MRS_FIELD(ID_AA64MMFR1, HPDS, false, MRS_EXACT, id_aa64mmfr1_hpds), + MRS_FIELD(ID_AA64MMFR1, VH, false, MRS_EXACT, id_aa64mmfr1_vh), + MRS_FIELD(ID_AA64MMFR1, VMIDBits, false, MRS_EXACT, + id_aa64mmfr1_vmidbits), + MRS_FIELD(ID_AA64MMFR1, HAFDBS, false, MRS_EXACT, id_aa64mmfr1_hafdbs), + MRS_FIELD_END, +}; + + +/* ID_AA64MMFR2_EL1 */ +static struct mrs_field_value id_aa64mmfr2_nv[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, NV, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr2_ccidx[] = { + MRS_FIELD_VALUE(ID_AA64MMFR2_CCIDX_32, "32bit CCIDX"), + MRS_FIELD_VALUE(ID_AA64MMFR2_CCIDX_64, "32bit CCIDX"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr2_varange[] = { + MRS_FIELD_VALUE(ID_AA64MMFR2_VARange_48, "48bit VA"), + MRS_FIELD_VALUE(ID_AA64MMFR2_VARange_52, "52bit VA"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr2_iesb[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, IESB, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr2_lsm[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, LSM, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr2_uao[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, UAO, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr2_cnp[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, CnP, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field id_aa64mmfr2_fields[] = { + MRS_FIELD(ID_AA64MMFR2, NV, false, MRS_EXACT, id_aa64mmfr2_nv), + MRS_FIELD(ID_AA64MMFR2, CCIDX, false, MRS_EXACT, id_aa64mmfr2_ccidx), + MRS_FIELD(ID_AA64MMFR2, VARange, false, MRS_EXACT, + id_aa64mmfr2_varange), + MRS_FIELD(ID_AA64MMFR2, IESB, false, MRS_EXACT, id_aa64mmfr2_iesb), + MRS_FIELD(ID_AA64MMFR2, LSM, false, MRS_EXACT, id_aa64mmfr2_lsm), + MRS_FIELD(ID_AA64MMFR2, UAO, false, MRS_EXACT, id_aa64mmfr2_uao), + MRS_FIELD(ID_AA64MMFR2, CnP, false, MRS_EXACT, id_aa64mmfr2_cnp), + MRS_FIELD_END, +}; + + +/* ID_AA64PFR0_EL1 */ +static struct mrs_field_value id_aa64pfr0_sve[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR0, SVE, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64pfr0_ras[] = { + MRS_FIELD_VALUE(ID_AA64PFR0_RAS_NONE, ""), + MRS_FIELD_VALUE(ID_AA64PFR0_RAS_V1, "RASv1"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64pfr0_gic[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR0, GIC, CPUIF_NONE, CPUIF_EN), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64pfr0_advsimd[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR0, AdvSIMD, NONE, IMPL), + MRS_FIELD_VALUE(ID_AA64PFR0_AdvSIMD_HP, "AdvSIMD+HP"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64pfr0_fp[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR0, FP, NONE, IMPL), + MRS_FIELD_VALUE(ID_AA64PFR0_FP_HP, "FP+HP"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64pfr0_el3[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR0, EL3, NONE, 64), + MRS_FIELD_VALUE(ID_AA64PFR0_EL3_64_32, "EL3 32"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64pfr0_el2[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64PFR0, EL2, NONE, 64), + MRS_FIELD_VALUE(ID_AA64PFR0_EL2_64_32, "EL2 32"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64pfr0_el1[] = { + MRS_FIELD_VALUE(ID_AA64PFR0_EL1_64, "EL1"), + MRS_FIELD_VALUE(ID_AA64PFR0_EL1_64_32, "EL1 32"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64pfr0_el0[] = { + MRS_FIELD_VALUE(ID_AA64PFR0_EL0_64, "EL0"), + MRS_FIELD_VALUE(ID_AA64PFR0_EL0_64_32, "EL0 32"), + MRS_FIELD_VALUE_END, +}; + static struct mrs_field id_aa64pfr0_fields[] = { - MRS_FIELD(false, MRS_EXACT, ID_AA64PFR0_SVE_SHIFT), - MRS_FIELD(false, MRS_EXACT, ID_AA64PFR0_RAS_SHIFT), - MRS_FIELD(false, MRS_EXACT, ID_AA64PFR0_GIC_SHIFT), - MRS_FIELD(true, MRS_LOWER, ID_AA64PFR0_AdvSIMD_SHIFT), - MRS_FIELD(true, MRS_LOWER, ID_AA64PFR0_FP_SHIFT), - MRS_FIELD(false, MRS_EXACT, ID_AA64PFR0_EL3_SHIFT), - MRS_FIELD(false, MRS_EXACT, ID_AA64PFR0_EL2_SHIFT), - MRS_FIELD(false, MRS_LOWER, ID_AA64PFR0_EL1_SHIFT), - MRS_FIELD(false, MRS_LOWER, ID_AA64PFR0_EL0_SHIFT), + MRS_FIELD(ID_AA64PFR0, SVE, false, MRS_EXACT, id_aa64pfr0_sve), + MRS_FIELD(ID_AA64PFR0, RAS, false, MRS_EXACT, id_aa64pfr0_ras), + MRS_FIELD(ID_AA64PFR0, GIC, false, MRS_EXACT, id_aa64pfr0_gic), + MRS_FIELD(ID_AA64PFR0, AdvSIMD, true, MRS_LOWER, id_aa64pfr0_advsimd), + MRS_FIELD(ID_AA64PFR0, FP, true, MRS_LOWER, id_aa64pfr0_fp), + MRS_FIELD(ID_AA64PFR0, EL3, false, MRS_EXACT, id_aa64pfr0_el3), + MRS_FIELD(ID_AA64PFR0, EL2, false, MRS_EXACT, id_aa64pfr0_el2), + MRS_FIELD(ID_AA64PFR0, EL1, false, MRS_LOWER, id_aa64pfr0_el1), + MRS_FIELD(ID_AA64PFR0, EL0, false, MRS_LOWER, id_aa64pfr0_el0), MRS_FIELD_END, }; + +/* ID_AA64PFR1_EL1 */ +static struct mrs_field id_aa64pfr1_fields[] = { + MRS_FIELD_END, +}; + struct mrs_user_reg { u_int CRm; u_int Op2; @@ -541,10 +981,52 @@ parse_cpu_features_hwcap(u_int cpu) } static void +print_id_register(struct sbuf *sb, const char *reg_name, uint64_t reg, + struct mrs_field *fields) +{ + struct mrs_field_value *fv; + int field, i, j, printed; + + sbuf_printf(sb, "%29s = <", reg_name); + +#define SEP_STR ((printed++) == 0) ? "" : "," + printed = 0; + for (i = 0; fields[i].type != 0; i++) { + fv = fields[i].values; + + /* TODO: Handle with an unknown message */ + if (fv == NULL) + continue; + + field = (reg & fields[i].mask) >> fields[i].shift; + for (j = 0; fv[j].desc != NULL; j++) { + if ((fv[j].value >> fields[i].shift) != field) + continue; + + if (fv[j].desc[0] != '\0') + sbuf_printf(sb, "%s%s", SEP_STR, fv[j].desc); + break; + } + if (fv[j].desc == NULL) + sbuf_printf(sb, "%sUnknown %s(%x)", SEP_STR, + fields[i].name, field); + + reg &= ~(0xful << fields[i].shift); + } + + if (reg != 0) + sbuf_printf(sb, "%s%#lx", SEP_STR, reg); +#undef SEP_STR + + sbuf_finish(sb); + printf("%s>\n", sbuf_data(sb)); + sbuf_clear(sb); +} + +static void print_cpu_features(u_int cpu) { struct sbuf *sb; - int printed; sb = sbuf_new_auto(); sbuf_printf(sb, "CPU%3d: %s %s r%dp%d", cpu, @@ -594,783 +1076,60 @@ print_cpu_features(u_int cpu) "hardware bugs that may cause the incorrect operation of " "atomic operations.\n"); -#define SEP_STR ((printed++) == 0) ? "" : "," - /* AArch64 Instruction Set Attribute Register 0 */ - if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_ISAR0) != 0) { - printed = 0; - sbuf_printf(sb, " Instruction Set Attributes 0 = <"); + if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_ISAR0) != 0) + print_id_register(sb, "Instruction Set Attributes 0", + cpu_desc[cpu].id_aa64isar0, id_aa64isar0_fields); - switch (ID_AA64ISAR0_DP(cpu_desc[cpu].id_aa64isar0)) { - case ID_AA64ISAR0_DP_NONE: - break; - case ID_AA64ISAR0_DP_IMPL: - sbuf_printf(sb, "%sDotProd", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown DP", SEP_STR); - break; - } - - switch (ID_AA64ISAR0_SM4(cpu_desc[cpu].id_aa64isar0)) { - case ID_AA64ISAR0_SM4_NONE: - break; - case ID_AA64ISAR0_SM4_IMPL: - sbuf_printf(sb, "%sSM4", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown SM4", SEP_STR); - break; - } - - switch (ID_AA64ISAR0_SM3(cpu_desc[cpu].id_aa64isar0)) { - case ID_AA64ISAR0_SM3_NONE: - break; - case ID_AA64ISAR0_SM3_IMPL: - sbuf_printf(sb, "%sSM3", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown SM3", SEP_STR); - break; - } - - switch (ID_AA64ISAR0_SHA3(cpu_desc[cpu].id_aa64isar0)) { - case ID_AA64ISAR0_SHA3_NONE: - break; - case ID_AA64ISAR0_SHA3_IMPL: - sbuf_printf(sb, "%sSHA3", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown SHA3", SEP_STR); - break; - } - - switch (ID_AA64ISAR0_RDM(cpu_desc[cpu].id_aa64isar0)) { - case ID_AA64ISAR0_RDM_NONE: - break; - case ID_AA64ISAR0_RDM_IMPL: - sbuf_printf(sb, "%sRDM", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown RDM", SEP_STR); - } - - switch (ID_AA64ISAR0_Atomic(cpu_desc[cpu].id_aa64isar0)) { - case ID_AA64ISAR0_Atomic_NONE: - break; - case ID_AA64ISAR0_Atomic_IMPL: - sbuf_printf(sb, "%sAtomic", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown Atomic", SEP_STR); - } - - switch (ID_AA64ISAR0_CRC32(cpu_desc[cpu].id_aa64isar0)) { - case ID_AA64ISAR0_CRC32_NONE: - break; - case ID_AA64ISAR0_CRC32_BASE: - sbuf_printf(sb, "%sCRC32", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown CRC32", SEP_STR); - break; - } - - switch (ID_AA64ISAR0_SHA2(cpu_desc[cpu].id_aa64isar0)) { - case ID_AA64ISAR0_SHA2_NONE: - break; - case ID_AA64ISAR0_SHA2_BASE: - sbuf_printf(sb, "%sSHA2", SEP_STR); - break; - case ID_AA64ISAR0_SHA2_512: - sbuf_printf(sb, "%sSHA2+SHA512", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown SHA2", SEP_STR); - break; - } - - switch (ID_AA64ISAR0_SHA1(cpu_desc[cpu].id_aa64isar0)) { - case ID_AA64ISAR0_SHA1_NONE: - break; - case ID_AA64ISAR0_SHA1_BASE: - sbuf_printf(sb, "%sSHA1", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown SHA1", SEP_STR); - break; - } - - switch (ID_AA64ISAR0_AES(cpu_desc[cpu].id_aa64isar0)) { - case ID_AA64ISAR0_AES_NONE: - break; - case ID_AA64ISAR0_AES_BASE: - sbuf_printf(sb, "%sAES", SEP_STR); - break; - case ID_AA64ISAR0_AES_PMULL: - sbuf_printf(sb, "%sAES+PMULL", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown AES", SEP_STR); - break; - } - - if ((cpu_desc[cpu].id_aa64isar0 & ~ID_AA64ISAR0_MASK) != 0) - sbuf_printf(sb, "%s%#lx", SEP_STR, - cpu_desc[cpu].id_aa64isar0 & ~ID_AA64ISAR0_MASK); - - sbuf_finish(sb); - printf("%s>\n", sbuf_data(sb)); - sbuf_clear(sb); - } - /* AArch64 Instruction Set Attribute Register 1 */ - if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_ISAR1) != 0) { - printed = 0; - sbuf_printf(sb, " Instruction Set Attributes 1 = <"); + if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_ISAR1) != 0) + print_id_register(sb, "Instruction Set Attributes 1", + cpu_desc[cpu].id_aa64isar1, id_aa64isar1_fields); - switch (ID_AA64ISAR1_GPI(cpu_desc[cpu].id_aa64isar1)) { - case ID_AA64ISAR1_GPI_NONE: - break; - case ID_AA64ISAR1_GPI_IMPL: - sbuf_printf(sb, "%sImpl GenericAuth", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown GenericAuth", SEP_STR); - break; - } - - switch (ID_AA64ISAR1_GPA(cpu_desc[cpu].id_aa64isar1)) { - case ID_AA64ISAR1_GPA_NONE: - break; - case ID_AA64ISAR1_GPA_IMPL: - sbuf_printf(sb, "%sPrince GenericAuth", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown GenericAuth", SEP_STR); - break; - } - - switch (ID_AA64ISAR1_LRCPC(cpu_desc[cpu].id_aa64isar1)) { - case ID_AA64ISAR1_LRCPC_NONE: - break; - case ID_AA64ISAR1_LRCPC_IMPL: - sbuf_printf(sb, "%sRCpc", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown RCpc", SEP_STR); - break; - } - - switch (ID_AA64ISAR1_FCMA(cpu_desc[cpu].id_aa64isar1)) { - case ID_AA64ISAR1_FCMA_NONE: - break; - case ID_AA64ISAR1_FCMA_IMPL: - sbuf_printf(sb, "%sFCMA", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown FCMA", SEP_STR); - break; - } - - switch (ID_AA64ISAR1_JSCVT(cpu_desc[cpu].id_aa64isar1)) { - case ID_AA64ISAR1_JSCVT_NONE: - break; - case ID_AA64ISAR1_JSCVT_IMPL: - sbuf_printf(sb, "%sJS Conv", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown JS Conv", SEP_STR); - break; - } - - switch (ID_AA64ISAR1_API(cpu_desc[cpu].id_aa64isar1)) { - case ID_AA64ISAR1_API_NONE: - break; - case ID_AA64ISAR1_API_IMPL: - sbuf_printf(sb, "%sImpl AddrAuth", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown Impl AddrAuth", SEP_STR); - break; - } - - switch (ID_AA64ISAR1_APA(cpu_desc[cpu].id_aa64isar1)) { - case ID_AA64ISAR1_APA_NONE: - break; - case ID_AA64ISAR1_APA_IMPL: - sbuf_printf(sb, "%sPrince AddrAuth", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown Prince AddrAuth", SEP_STR); - break; - } - - switch (ID_AA64ISAR1_DPB(cpu_desc[cpu].id_aa64isar1)) { - case ID_AA64ISAR1_DPB_NONE: - break; - case ID_AA64ISAR1_DPB_IMPL: - sbuf_printf(sb, "%sDC CVAP", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown DC CVAP", SEP_STR); - break; - } - - if ((cpu_desc[cpu].id_aa64isar1 & ~ID_AA64ISAR1_MASK) != 0) - sbuf_printf(sb, "%s%#lx", SEP_STR, - cpu_desc[cpu].id_aa64isar1 & ~ID_AA64ISAR1_MASK); - sbuf_finish(sb); - printf("%s>\n", sbuf_data(sb)); - sbuf_clear(sb); - } - /* AArch64 Processor Feature Register 0 */ - if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_PFR0) != 0) { - printed = 0; - sbuf_printf(sb, " Processor Features 0 = <"); + if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_PFR0) != 0) + print_id_register(sb, "Processor Features 0", + cpu_desc[cpu].id_aa64pfr0, id_aa64pfr0_fields); - switch (ID_AA64PFR0_SVE(cpu_desc[cpu].id_aa64pfr0)) { - case ID_AA64PFR0_SVE_NONE: - break; - case ID_AA64PFR0_SVE_IMPL: - sbuf_printf(sb, "%sSVE", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown SVE", SEP_STR); - break; - } - - switch (ID_AA64PFR0_RAS(cpu_desc[cpu].id_aa64pfr0)) { - case ID_AA64PFR0_RAS_NONE: - break; - case ID_AA64PFR0_RAS_V1: - sbuf_printf(sb, "%sRASv1", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown RAS", SEP_STR); - break; - } - - switch (ID_AA64PFR0_GIC(cpu_desc[cpu].id_aa64pfr0)) { - case ID_AA64PFR0_GIC_CPUIF_NONE: - break; - case ID_AA64PFR0_GIC_CPUIF_EN: - sbuf_printf(sb, "%sGIC", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown GIC interface", SEP_STR); - break; - } - - switch (ID_AA64PFR0_AdvSIMD(cpu_desc[cpu].id_aa64pfr0)) { - case ID_AA64PFR0_AdvSIMD_NONE: - break; - case ID_AA64PFR0_AdvSIMD_IMPL: - sbuf_printf(sb, "%sAdvSIMD", SEP_STR); - break; - case ID_AA64PFR0_AdvSIMD_HP: - sbuf_printf(sb, "%sAdvSIMD+HP", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown AdvSIMD", SEP_STR); - break; - } - - switch (ID_AA64PFR0_FP(cpu_desc[cpu].id_aa64pfr0)) { - case ID_AA64PFR0_FP_NONE: - break; - case ID_AA64PFR0_FP_IMPL: - sbuf_printf(sb, "%sFloat", SEP_STR); - break; - case ID_AA64PFR0_FP_HP: - sbuf_printf(sb, "%sFloat+HP", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown Float", SEP_STR); - break; - } - - switch (ID_AA64PFR0_EL3(cpu_desc[cpu].id_aa64pfr0)) { - case ID_AA64PFR0_EL3_NONE: - sbuf_printf(sb, "%sNo EL3", SEP_STR); - break; - case ID_AA64PFR0_EL3_64: - sbuf_printf(sb, "%sEL3", SEP_STR); - break; - case ID_AA64PFR0_EL3_64_32: - sbuf_printf(sb, "%sEL3 32", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown EL3", SEP_STR); - break; - } - - switch (ID_AA64PFR0_EL2(cpu_desc[cpu].id_aa64pfr0)) { - case ID_AA64PFR0_EL2_NONE: - sbuf_printf(sb, "%sNo EL2", SEP_STR); - break; - case ID_AA64PFR0_EL2_64: - sbuf_printf(sb, "%sEL2", SEP_STR); - break; - case ID_AA64PFR0_EL2_64_32: - sbuf_printf(sb, "%sEL2 32", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown EL2", SEP_STR); - break; - } - - switch (ID_AA64PFR0_EL1(cpu_desc[cpu].id_aa64pfr0)) { - case ID_AA64PFR0_EL1_64: - sbuf_printf(sb, "%sEL1", SEP_STR); - break; - case ID_AA64PFR0_EL1_64_32: - sbuf_printf(sb, "%sEL1 32", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown EL1", SEP_STR); - break; - } - - switch (ID_AA64PFR0_EL0(cpu_desc[cpu].id_aa64pfr0)) { - case ID_AA64PFR0_EL0_64: - sbuf_printf(sb, "%sEL0", SEP_STR); - break; - case ID_AA64PFR0_EL0_64_32: - sbuf_printf(sb, "%sEL0 32", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown EL0", SEP_STR); - break; - } - - if ((cpu_desc[cpu].id_aa64pfr0 & ~ID_AA64PFR0_MASK) != 0) - sbuf_printf(sb, "%s%#lx", SEP_STR, - cpu_desc[cpu].id_aa64pfr0 & ~ID_AA64PFR0_MASK); - - sbuf_finish(sb); - printf("%s>\n", sbuf_data(sb)); - sbuf_clear(sb); - } - /* AArch64 Processor Feature Register 1 */ - if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_PFR1) != 0) { - printf(" Processor Features 1 = <%#lx>\n", - cpu_desc[cpu].id_aa64pfr1); - } + if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_PFR1) != 0) + print_id_register(sb, "Processor Features 1", + cpu_desc[cpu].id_aa64pfr1, id_aa64pfr1_fields); /* AArch64 Memory Model Feature Register 0 */ - if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_MMFR0) != 0) { - printed = 0; - sbuf_printf(sb, " Memory Model Features 0 = <"); - switch (ID_AA64MMFR0_TGran4(cpu_desc[cpu].id_aa64mmfr0)) { - case ID_AA64MMFR0_TGran4_NONE: - break; - case ID_AA64MMFR0_TGran4_IMPL: - sbuf_printf(sb, "%s4k Granule", SEP_STR); - break; - default: - sbuf_printf(sb, "%sUnknown 4k Granule", SEP_STR); - break; - } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Oct 16 13:53:53 2019 Return-Path: Delivered-To: svn-src-all@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 D58A2165932; Wed, 16 Oct 2019 13:53:53 +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 46tYg55N36z3Hhm; Wed, 16 Oct 2019 13:53:53 +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 9C6D08003; Wed, 16 Oct 2019 13:53:53 +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 x9GDrr82044753; Wed, 16 Oct 2019 13:53:53 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GDrrUq044752; Wed, 16 Oct 2019 13:53:53 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910161353.x9GDrrUq044752@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 16 Oct 2019 13:53:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353642 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 353642 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 13:53:53 -0000 Author: manu Date: Wed Oct 16 13:53:53 2019 New Revision: 353642 URL: https://svnweb.freebsd.org/changeset/base/353642 Log: dwc3: Use a pair of ()'s around arguments for some macros Reported by: hselasky MFC after: 1 week X-MFC-With: r353533 Modified: head/sys/dev/usb/controller/dwc3.h Modified: head/sys/dev/usb/controller/dwc3.h ============================================================================== --- head/sys/dev/usb/controller/dwc3.h Wed Oct 16 13:30:28 2019 (r353641) +++ head/sys/dev/usb/controller/dwc3.h Wed Oct 16 13:53:53 2019 (r353642) @@ -92,8 +92,8 @@ #define DWC3_GUSB3PIPECTL0_PHYSOFTRST (1 << 31) #define DWC3_GUSB3PIPECTL0_DELAYP1TRANS (1 << 18) -#define DWC3_GTXFIFOSIZ(x) (0xc300 + 0x4 * x) -#define DWC3_GRXFIFOSIZ(x) (0xc380 + 0x4 * x) +#define DWC3_GTXFIFOSIZ(x) (0xc300 + 0x4 * (x)) +#define DWC3_GRXFIFOSIZ(x) (0xc380 + 0x4 * (x)) #define DWC3_GEVNTADRLO0 0xc400 #define DWC3_GEVNTADRHI0 0xc404 #define DWC3_GEVNTSIZ0 0xc408 From owner-svn-src-all@freebsd.org Wed Oct 16 13:58:22 2019 Return-Path: Delivered-To: svn-src-all@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 407091659D2; Wed, 16 Oct 2019 13:58:22 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (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 46tYmG0q3gz3HsG; Wed, 16 Oct 2019 13:58:21 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 64B782602CD; Wed, 16 Oct 2019 15:58:19 +0200 (CEST) Subject: Re: svn commit: r353642 - head/sys/dev/usb/controller To: Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910161353.x9GDrrUq044752@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <58b56930-36d4-8e09-366e-a425c959b408@selasky.org> Date: Wed, 16 Oct 2019 15:56:16 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: <201910161353.x9GDrrUq044752@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46tYmG0q3gz3HsG X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.991,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 13:58:22 -0000 On 2019-10-16 15:53, Emmanuel Vadot wrote: > Author: manu > Date: Wed Oct 16 13:53:53 2019 > New Revision: 353642 > URL: https://svnweb.freebsd.org/changeset/base/353642 > > Log: > dwc3: Use a pair of ()'s around arguments for some macros > > Reported by: hselasky > MFC after: 1 week > X-MFC-With: r353533 > > Modified: > head/sys/dev/usb/controller/dwc3.h > > Modified: head/sys/dev/usb/controller/dwc3.h > ============================================================================== > --- head/sys/dev/usb/controller/dwc3.h Wed Oct 16 13:30:28 2019 (r353641) > +++ head/sys/dev/usb/controller/dwc3.h Wed Oct 16 13:53:53 2019 (r353642) > @@ -92,8 +92,8 @@ > #define DWC3_GUSB3PIPECTL0_PHYSOFTRST (1 << 31) > #define DWC3_GUSB3PIPECTL0_DELAYP1TRANS (1 << 18) > > -#define DWC3_GTXFIFOSIZ(x) (0xc300 + 0x4 * x) > -#define DWC3_GRXFIFOSIZ(x) (0xc380 + 0x4 * x) > +#define DWC3_GTXFIFOSIZ(x) (0xc300 + 0x4 * (x)) > +#define DWC3_GRXFIFOSIZ(x) (0xc380 + 0x4 * (x)) > #define DWC3_GEVNTADRLO0 0xc400 > #define DWC3_GEVNTADRHI0 0xc404 > #define DWC3_GEVNTSIZ0 0xc408 > One more: 86 #define DWC3_GUSB2PHYCFG0_PHYSEL(x) ((x >> 7) & 0x1) /* 0 = USB2.0, 1 = USB1.1 */ --HPS From owner-svn-src-all@freebsd.org Wed Oct 16 14:42:49 2019 Return-Path: Delivered-To: svn-src-all@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 C9AE51669DB; Wed, 16 Oct 2019 14:42:49 +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 46tZlY4z3Sz3LJx; Wed, 16 Oct 2019 14:42:49 +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 740D38917; Wed, 16 Oct 2019 14:42:49 +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 x9GEgn2S074843; Wed, 16 Oct 2019 14:42:49 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GEgnQt074842; Wed, 16 Oct 2019 14:42:49 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910161442.x9GEgnQt074842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 14:42:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353643 - head/sys/dev/nctgpio X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/nctgpio X-SVN-Commit-Revision: 353643 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 14:42:49 -0000 Author: avg Date: Wed Oct 16 14:42:49 2019 New Revision: 353643 URL: https://svnweb.freebsd.org/changeset/base/353643 Log: move nctgpio to superio(4) bus This is where it logically belongs. The change allows to drop a bunch of low lewel code. Reviewed by: gonzo MFC after: 19 days Differential Revision: https://reviews.freebsd.org/D21980 Modified: head/sys/dev/nctgpio/nctgpio.c Modified: head/sys/dev/nctgpio/nctgpio.c ============================================================================== --- head/sys/dev/nctgpio/nctgpio.c Wed Oct 16 13:53:53 2019 (r353642) +++ head/sys/dev/nctgpio/nctgpio.c Wed Oct 16 14:42:49 2019 (r353643) @@ -42,34 +42,20 @@ #include #include -#include #include -#include - #include -#include #include +#include #include "gpio_if.h" -/* - * Global configuration registers (CR). - */ -#define NCT_CR_LDN 0x07 /* Logical Device Number */ -#define NCT_CR_CHIP_ID 0x20 /* Chip ID */ -#define NCT_CR_CHIP_ID_H 0x20 /* Chip ID (high byte) */ -#define NCT_CR_CHIP_ID_L 0x21 /* Chip ID (low byte) */ -#define NCT_CR_OPT_1 0x26 /* Global Options (1) */ - /* Logical Device Numbers. */ #define NCT_LDN_GPIO 0x07 -#define NCT_LDN_GPIO_CFG 0x08 #define NCT_LDN_GPIO_MODE 0x0f /* Logical Device 7 */ -#define NCT_LD7_GPIO_ENABLE 0x30 #define NCT_LD7_GPIO0_IOR 0xe0 #define NCT_LD7_GPIO0_DAT 0xe1 #define NCT_LD7_GPIO0_INV 0xe2 @@ -83,8 +69,6 @@ #define NCT_LDF_GPIO0_OUTCFG 0xe0 #define NCT_LDF_GPIO1_OUTCFG 0xe1 -#define NCT_EXTFUNC_ENTER 0x87 -#define NCT_EXTFUNC_EXIT 0xaa #define NCT_MAX_PIN 15 #define NCT_IS_VALID_PIN(_p) ((_p) >= 0 && (_p) <= NCT_MAX_PIN) @@ -97,10 +81,9 @@ struct nct_softc { device_t dev; + device_t dev_f; device_t busdev; struct mtx mtx; - struct resource *portres; - int rid; struct gpio_pin pins[NCT_MAX_PIN + 1]; }; @@ -112,22 +95,6 @@ struct nct_softc { #define GPIO_ASSERT_LOCKED(_sc) mtx_assert(&(_sc)->mtx, MA_OWNED) #define GPIO_ASSERT_UNLOCKED(_sc) mtx_assert(&(_sc)->mtx, MA_NOTOWNED) -#define NCT_BARRIER_WRITE(_sc) \ - bus_barrier((_sc)->portres, 0, 2, BUS_SPACE_BARRIER_WRITE) - -#define NCT_BARRIER_READ_WRITE(_sc) \ - bus_barrier((_sc)->portres, 0, 2, \ - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE) - -static void ext_cfg_enter(struct nct_softc *); -static void ext_cfg_exit(struct nct_softc *); - -/* - * Potential Extended Function Enable Register addresses. - * Same address as EFIR. - */ -uint8_t probe_addrs[] = {0x2e, 0x4e}; - struct nuvoton_vendor_device_id { uint16_t chip_id; const char * descr; @@ -146,77 +113,7 @@ struct nuvoton_vendor_device_id { }, }; -static void -write_cfg_reg_1(struct nct_softc *sc, uint8_t reg, uint8_t value) -{ - GPIO_ASSERT_LOCKED(sc); - bus_write_1(sc->portres, 0, reg); - NCT_BARRIER_WRITE(sc); - bus_write_1(sc->portres, 1, value); - NCT_BARRIER_WRITE(sc); -} - -static uint8_t -read_cfg_reg_1(struct nct_softc *sc, uint8_t reg) -{ - uint8_t value; - - GPIO_ASSERT_LOCKED(sc); - bus_write_1(sc->portres, 0, reg); - NCT_BARRIER_READ_WRITE(sc); - value = bus_read_1(sc->portres, 1); - NCT_BARRIER_READ_WRITE(sc); - - return (value); -} - -static uint16_t -read_cfg_reg_2(struct nct_softc *sc, uint8_t reg) -{ - uint16_t value; - - value = read_cfg_reg_1(sc, reg) << 8; - value |= read_cfg_reg_1(sc, reg + 1); - - return (value); -} - /* - * Enable extended function mode. - * - */ -static void -ext_cfg_enter(struct nct_softc *sc) -{ - GPIO_ASSERT_LOCKED(sc); - bus_write_1(sc->portres, 0, NCT_EXTFUNC_ENTER); - NCT_BARRIER_WRITE(sc); - bus_write_1(sc->portres, 0, NCT_EXTFUNC_ENTER); - NCT_BARRIER_WRITE(sc); -} - -/* - * Disable extended function mode. - * - */ -static void -ext_cfg_exit(struct nct_softc *sc) -{ - GPIO_ASSERT_LOCKED(sc); - bus_write_1(sc->portres, 0, NCT_EXTFUNC_EXIT); - NCT_BARRIER_WRITE(sc); -} - -/* - * Select a Logical Device. - */ -static void -select_ldn(struct nct_softc *sc, uint8_t ldn) -{ - write_cfg_reg_1(sc, NCT_CR_LDN, ldn); -} - -/* * Get the GPIO Input/Output register address * for a pin. */ @@ -289,10 +186,9 @@ nct_set_pin_is_output(struct nct_softc *sc, uint32_t p uint8_t ior; reg = nct_ior_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO); - ior = read_cfg_reg_1(sc, reg); + ior = superio_read(sc->dev, reg); ior &= ~(NCT_PIN_BIT(pin_num)); - write_cfg_reg_1(sc, reg, ior); + superio_write(sc->dev, reg, ior); } /* @@ -305,10 +201,9 @@ nct_set_pin_is_input(struct nct_softc *sc, uint32_t pi uint8_t ior; reg = nct_ior_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO); - ior = read_cfg_reg_1(sc, reg); + ior = superio_read(sc->dev, reg); ior |= NCT_PIN_BIT(pin_num); - write_cfg_reg_1(sc, reg, ior); + superio_write(sc->dev, reg, ior); } /* @@ -321,8 +216,7 @@ nct_pin_is_input(struct nct_softc *sc, uint32_t pin_nu uint8_t ior; reg = nct_ior_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO); - ior = read_cfg_reg_1(sc, reg); + ior = superio_read(sc->dev, reg); return (ior & NCT_PIN_BIT(pin_num)); } @@ -337,14 +231,13 @@ nct_write_pin(struct nct_softc *sc, uint32_t pin_num, uint8_t value; reg = nct_dat_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO); - value = read_cfg_reg_1(sc, reg); + value = superio_read(sc->dev, reg); if (data) value |= NCT_PIN_BIT(pin_num); else value &= ~(NCT_PIN_BIT(pin_num)); - write_cfg_reg_1(sc, reg, value); + superio_write(sc->dev, reg, value); } static bool @@ -353,9 +246,8 @@ nct_read_pin(struct nct_softc *sc, uint32_t pin_num) uint8_t reg; reg = nct_dat_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO); - return (read_cfg_reg_1(sc, reg) & NCT_PIN_BIT(pin_num)); + return (superio_read(sc->dev, reg) & NCT_PIN_BIT(pin_num)); } static void @@ -365,10 +257,9 @@ nct_set_pin_is_inverted(struct nct_softc *sc, uint32_t uint8_t inv; reg = nct_inv_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO); - inv = read_cfg_reg_1(sc, reg); + inv = superio_read(sc->dev, reg); inv |= (NCT_PIN_BIT(pin_num)); - write_cfg_reg_1(sc, reg, inv); + superio_write(sc->dev, reg, inv); } static void @@ -378,10 +269,9 @@ nct_set_pin_not_inverted(struct nct_softc *sc, uint32_ uint8_t inv; reg = nct_inv_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO); - inv = read_cfg_reg_1(sc, reg); + inv = superio_read(sc->dev, reg); inv &= ~(NCT_PIN_BIT(pin_num)); - write_cfg_reg_1(sc, reg, inv); + superio_write(sc->dev, reg, inv); } static bool @@ -391,8 +281,7 @@ nct_pin_is_inverted(struct nct_softc *sc, uint32_t pin uint8_t inv; reg = nct_inv_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO); - inv = read_cfg_reg_1(sc, reg); + inv = superio_read(sc->dev, reg); return (inv & NCT_PIN_BIT(pin_num)); } @@ -404,10 +293,9 @@ nct_set_pin_opendrain(struct nct_softc *sc, uint32_t p uint8_t outcfg; reg = nct_outcfg_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO_MODE); - outcfg = read_cfg_reg_1(sc, reg); - outcfg |= (NCT_PIN_BIT(pin_num)); - write_cfg_reg_1(sc, reg, outcfg); + outcfg = superio_read(sc->dev_f, reg); + outcfg |= NCT_PIN_BIT(pin_num); + superio_write(sc->dev_f, reg, outcfg); } static void @@ -417,10 +305,9 @@ nct_set_pin_pushpull(struct nct_softc *sc, uint32_t pi uint8_t outcfg; reg = nct_outcfg_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO_MODE); - outcfg = read_cfg_reg_1(sc, reg); - outcfg &= ~(NCT_PIN_BIT(pin_num)); - write_cfg_reg_1(sc, reg, outcfg); + outcfg = superio_read(sc->dev_f, reg); + outcfg &= ~NCT_PIN_BIT(pin_num); + superio_write(sc->dev_f, reg, outcfg); } static bool @@ -430,66 +317,33 @@ nct_pin_is_opendrain(struct nct_softc *sc, uint32_t pi uint8_t outcfg; reg = nct_outcfg_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO_MODE); - outcfg = read_cfg_reg_1(sc, reg); - + outcfg = superio_read(sc->dev_f, reg); return (outcfg & NCT_PIN_BIT(pin_num)); } -static void -nct_identify(driver_t *driver, device_t parent) -{ - if (device_find_child(parent, driver->name, 0) != NULL) - return; - - BUS_ADD_CHILD(parent, 0, driver->name, 0); -} - static int nct_probe(device_t dev) { - int i, j; - int rc; - struct nct_softc *sc; + int j; uint16_t chipid; - /* Make sure we do not claim some ISA PNP device. */ - if (isa_get_logicalid(dev) != 0) + if (superio_vendor(dev) != SUPERIO_VENDOR_NUVOTON) return (ENXIO); + if (superio_get_type(dev) != SUPERIO_DEV_GPIO) + return (ENXIO); - sc = device_get_softc(dev); + /* + * There are several GPIO devices, we attach only to one of them + * and use the rest without attaching. + */ + if (superio_get_ldn(dev) != NCT_LDN_GPIO) + return (ENXIO); - for (i = 0; i < nitems(probe_addrs); i++) { - sc->rid = 0; - sc->portres = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->rid, - probe_addrs[i], probe_addrs[i] + 1, 2, RF_ACTIVE); - if (sc->portres == NULL) - continue; - - GPIO_LOCK_INIT(sc); - - GPIO_ASSERT_UNLOCKED(sc); - GPIO_LOCK(sc); - ext_cfg_enter(sc); - chipid = read_cfg_reg_2(sc, NCT_CR_CHIP_ID); - ext_cfg_exit(sc); - GPIO_UNLOCK(sc); - - GPIO_LOCK_DESTROY(sc); - - bus_release_resource(dev, SYS_RES_IOPORT, sc->rid, sc->portres); - bus_delete_resource(dev, SYS_RES_IOPORT, sc->rid); - - for (j = 0; j < nitems(nct_devs); j++) { - if (chipid == nct_devs[j].chip_id) { - rc = bus_set_resource(dev, SYS_RES_IOPORT, 0, probe_addrs[i], 2); - if (rc != 0) { - device_printf(dev, "bus_set_resource failed for address 0x%02X\n", probe_addrs[i]); - continue; - } - device_set_desc(dev, nct_devs[j].descr); - return (BUS_PROBE_DEFAULT); - } + chipid = superio_devid(dev); + for (j = 0; j < nitems(nct_devs); j++) { + if (chipid == nct_devs[j].chip_id) { + device_set_desc(dev, "Nuvoton GPIO controller"); + return (BUS_PROBE_DEFAULT); } } return (ENXIO); @@ -502,24 +356,19 @@ nct_attach(device_t dev) int i; sc = device_get_softc(dev); - - sc->rid = 0; - sc->portres = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->rid, - 0ul, ~0ul, 2, RF_ACTIVE); - if (sc->portres == NULL) { - device_printf(dev, "cannot allocate ioport\n"); + sc->dev = dev; + sc->dev_f = superio_find_dev(device_get_parent(dev), SUPERIO_DEV_GPIO, + NCT_LDN_GPIO_MODE); + if (sc->dev_f == NULL) { + device_printf(dev, "failed to find LDN F\n"); return (ENXIO); } - GPIO_LOCK_INIT(sc); + /* Enable gpio0 and gpio1. */ + superio_dev_enable(dev, 0x03); - GPIO_ASSERT_UNLOCKED(sc); + GPIO_LOCK_INIT(sc); GPIO_LOCK(sc); - ext_cfg_enter(sc); - select_ldn(sc, NCT_LDN_GPIO); - /* Enable gpio0 and gpio1. */ - write_cfg_reg_1(sc, NCT_LD7_GPIO_ENABLE, - read_cfg_reg_1(sc, NCT_LD7_GPIO_ENABLE) | 0x03); for (i = 0; i <= NCT_MAX_PIN; i++) { struct gpio_pin *pin; @@ -550,12 +399,7 @@ nct_attach(device_t dev) sc->busdev = gpiobus_attach_bus(dev); if (sc->busdev == NULL) { GPIO_ASSERT_UNLOCKED(sc); - GPIO_LOCK(sc); - ext_cfg_exit(sc); - GPIO_UNLOCK(sc); - bus_release_resource(dev, SYS_RES_IOPORT, sc->rid, sc->portres); GPIO_LOCK_DESTROY(sc); - return (ENXIO); } @@ -571,13 +415,6 @@ nct_detach(device_t dev) gpiobus_detach_bus(dev); GPIO_ASSERT_UNLOCKED(sc); - GPIO_LOCK(sc); - ext_cfg_exit(sc); - GPIO_UNLOCK(sc); - - /* Cleanup resources. */ - bus_release_resource(dev, SYS_RES_IOPORT, sc->rid, sc->portres); - GPIO_LOCK_DESTROY(sc); return (0); @@ -775,26 +612,25 @@ nct_gpio_pin_setflags(device_t dev, uint32_t pin_num, static device_method_t nct_methods[] = { /* Device interface */ - DEVMETHOD(device_identify, nct_identify), DEVMETHOD(device_probe, nct_probe), DEVMETHOD(device_attach, nct_attach), DEVMETHOD(device_detach, nct_detach), /* GPIO */ - DEVMETHOD(gpio_get_bus, nct_gpio_get_bus), - DEVMETHOD(gpio_pin_max, nct_gpio_pin_max), - DEVMETHOD(gpio_pin_get, nct_gpio_pin_get), - DEVMETHOD(gpio_pin_set, nct_gpio_pin_set), - DEVMETHOD(gpio_pin_toggle, nct_gpio_pin_toggle), - DEVMETHOD(gpio_pin_getname, nct_gpio_pin_getname), - DEVMETHOD(gpio_pin_getcaps, nct_gpio_pin_getcaps), + DEVMETHOD(gpio_get_bus, nct_gpio_get_bus), + DEVMETHOD(gpio_pin_max, nct_gpio_pin_max), + DEVMETHOD(gpio_pin_get, nct_gpio_pin_get), + DEVMETHOD(gpio_pin_set, nct_gpio_pin_set), + DEVMETHOD(gpio_pin_toggle, nct_gpio_pin_toggle), + DEVMETHOD(gpio_pin_getname, nct_gpio_pin_getname), + DEVMETHOD(gpio_pin_getcaps, nct_gpio_pin_getcaps), DEVMETHOD(gpio_pin_getflags, nct_gpio_pin_getflags), DEVMETHOD(gpio_pin_setflags, nct_gpio_pin_setflags), DEVMETHOD_END }; -static driver_t nct_isa_driver = { +static driver_t nct_driver = { "gpio", nct_methods, sizeof(struct nct_softc) @@ -802,5 +638,8 @@ static driver_t nct_isa_driver = { static devclass_t nct_devclass; -DRIVER_MODULE(nctgpio, isa, nct_isa_driver, nct_devclass, NULL, NULL); +DRIVER_MODULE(nctgpio, superio, nct_driver, nct_devclass, NULL, NULL); MODULE_DEPEND(nctgpio, gpiobus, 1, 1, 1); +MODULE_DEPEND(nctgpio, superio, 1, 1, 1); +MODULE_VERSION(nctgpio, 1); + From owner-svn-src-all@freebsd.org Wed Oct 16 14:43:06 2019 Return-Path: Delivered-To: svn-src-all@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 0D698166A2B; Wed, 16 Oct 2019 14:43:06 +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 46tZls6dvpz3LRT; Wed, 16 Oct 2019 14:43:05 +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 C80A28919; Wed, 16 Oct 2019 14:43:05 +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 x9GEh5I3074905; Wed, 16 Oct 2019 14:43:05 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GEh5AO074903; Wed, 16 Oct 2019 14:43:05 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910161443.x9GEh5AO074903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Oct 2019 14:43:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353644 - head/lib/libbe X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libbe X-SVN-Commit-Revision: 353644 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 14:43:06 -0000 Author: kevans Date: Wed Oct 16 14:43:05 2019 New Revision: 353644 URL: https://svnweb.freebsd.org/changeset/base/353644 Log: libbe(3): add needed bits for be_destroy to auto-destroy some origins New BEs can be created from either an existing snapshot or an existing BE. If an existing BE is chosen (either implicitly via 'bectl create' or explicitly via 'bectl create -e foo bar', for instance), then bectl will create a snapshot of the current BE or "foo" with be_snapshot, with a name formatted like: strftime("%F-%T") and a serial added to it. This commit adds the needed bits for libbe or consumers to determine if a snapshot names matches one of these auto-created snapshots (with some light validation of the date/time/serial), and also a be_destroy flag to specify that the origin should be automatically destroyed if possible. A future commit to bectl will specify BE_DESTROY_AUTOORIGIN by default so we clean up the origin in the most common case, non-user-managed snapshots. Modified: head/lib/libbe/be.c head/lib/libbe/be.h head/lib/libbe/libbe.3 Modified: head/lib/libbe/be.c ============================================================================== --- head/lib/libbe/be.c Wed Oct 16 14:42:49 2019 (r353643) +++ head/lib/libbe/be.c Wed Oct 16 14:43:05 2019 (r353644) @@ -229,6 +229,7 @@ be_destroy_cb(zfs_handle_t *zfs_hdl, void *data) return (0); } +#define BE_DESTROY_NEEDORIGIN (BE_DESTROY_ORIGIN | BE_DESTROY_AUTOORIGIN) /* * Destroy the boot environment or snapshot specified by the name * parameter. Options are or'd together with the possible values: @@ -264,11 +265,24 @@ be_destroy(libbe_handle_t *lbh, const char *name, int if (fs == NULL) return (set_error(lbh, BE_ERR_ZFSOPEN)); - if ((options & BE_DESTROY_ORIGIN) != 0 && + if ((options & BE_DESTROY_NEEDORIGIN) != 0 && zfs_prop_get(fs, ZFS_PROP_ORIGIN, origin, sizeof(origin), NULL, NULL, 0, 1) != 0) return (set_error(lbh, BE_ERR_NOORIGIN)); + /* + * If the caller wants auto-origin destruction and the origin + * name matches one of our automatically created snapshot names + * (i.e. strftime("%F-%T") with a serial at the end), then + * we'll set the DESTROY_ORIGIN flag and nuke it + * be_is_auto_snapshot_name is exported from libbe(3) so that + * the caller can determine if it needs to warn about the origin + * not being destroyed or not. + */ + if ((options & BE_DESTROY_AUTOORIGIN) != 0 && + be_is_auto_snapshot_name(lbh, origin)) + options |= BE_DESTROY_ORIGIN; + /* Don't destroy a mounted dataset unless force is specified */ if ((mounted = zfs_is_mounted(fs, NULL)) != 0) { if (force) { @@ -341,6 +355,25 @@ be_setup_snapshot_name(libbe_handle_t *lbh, char *buf, if (!zfs_dataset_exists(lbh->lzh, buf, ZFS_TYPE_SNAPSHOT)) return; } +} + +bool +be_is_auto_snapshot_name(libbe_handle_t *lbh, const char *name) +{ + const char *snap; + int day, hour, minute, month, second, serial, year; + + if ((snap = strchr(name, '@')) == NULL) + return (false); + ++snap; + /* We'll grab the individual components and do some light validation. */ + if (sscanf(snap, "%d-%d-%d-%d:%d:%d-%d", &year, &month, &day, &hour, + &minute, &second, &serial) != 7) + return (false); + return (year >= 1970) && (month >= 1 && month <= 12) && + (day >= 1 && day <= 31) && (hour >= 0 && hour <= 23) && + (minute >= 0 && minute <= 59) && (second >= 0 && second <= 60) && + serial >= 0; } int Modified: head/lib/libbe/be.h ============================================================================== --- head/lib/libbe/be.h Wed Oct 16 14:42:49 2019 (r353643) +++ head/lib/libbe/be.h Wed Oct 16 14:43:05 2019 (r353644) @@ -82,6 +82,8 @@ void be_prop_list_free(nvlist_t *be_list); int be_activate(libbe_handle_t *, const char *, bool); +bool be_is_auto_snapshot_name(libbe_handle_t *, const char *); + /* Bootenv creation functions */ int be_create(libbe_handle_t *, const char *); int be_create_depth(libbe_handle_t *, const char *, const char *, int); @@ -97,6 +99,7 @@ int be_rename(libbe_handle_t *, const char *, const ch typedef enum { BE_DESTROY_FORCE = 1 << 0, BE_DESTROY_ORIGIN = 1 << 1, + BE_DESTROY_AUTOORIGIN = 1 << 2, } be_destroy_opt_t; int be_destroy(libbe_handle_t *, const char *, int); Modified: head/lib/libbe/libbe.3 ============================================================================== --- head/lib/libbe/libbe.3 Wed Oct 16 14:42:49 2019 (r353643) +++ head/lib/libbe/libbe.3 Wed Oct 16 14:43:05 2019 (r353644) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 22, 2019 +.Dd October 16, 2019 .Dt LIBBE 3 .Os .Sh NAME @@ -59,6 +59,9 @@ .Ft const char * Ns .Fn be_root_path "libbe_handle_t *hdl" .Pp +.Ft bool Ns +.Fn be_is_auto_snapshot_name "libbe_handle_t *hdl" "const char *snap" +.Pp .Ft int .Fn be_create "libbe_handle_t *hdl" "const char *be_name" .Pp @@ -212,6 +215,18 @@ active on reboot. The .Fn be_root_path function returns the boot environment root path. +.Pp +The +.Fn be_is_auto_snapshot_name +function is used to determine if the given snapshot name matches the format that +the +.Fn be_snapshot +function will use by default if it is not given a snapshot name to use. +It returns +.Dv true +if the name matches the format, and +.Dv false +if it does not. .Pp The .Fn be_create From owner-svn-src-all@freebsd.org Wed Oct 16 14:46:05 2019 Return-Path: Delivered-To: svn-src-all@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 ACDC5166B92; Wed, 16 Oct 2019 14:46:05 +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 46tZqK4sblz3LfN; Wed, 16 Oct 2019 14:46:05 +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 85E53891E; Wed, 16 Oct 2019 14:46:05 +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 x9GEk5n8075122; Wed, 16 Oct 2019 14:46:05 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GEk5eP075121; Wed, 16 Oct 2019 14:46:05 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910161446.x9GEk5eP075121@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 14:46:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353645 - in head: share/man/man4 sys/dev/wbwd X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/wbwd X-SVN-Commit-Revision: 353645 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 14:46:05 -0000 Author: avg Date: Wed Oct 16 14:46:04 2019 New Revision: 353645 URL: https://svnweb.freebsd.org/changeset/base/353645 Log: wbwd: move to superio(4) bus This allows to remove a bunch of low level code. Also, superio(4) provides safer interaction with other drivers that work with Super I/O configuration registers. Tested only on PCengines APU2: superio0: at port 0x2e-0x2f on isa0 wbwd0: at WDT ldn 0x08 on superio0 The watchdog output is incorrectly wired on that system and the watchdog does not really do it its job, but the pulse can be seen with a signal analyzer. Reviewed by: delphij, bcr (man page) MFC after: 19 days Differential Revision: https://reviews.freebsd.org/D21979 Modified: head/share/man/man4/wbwd.4 head/sys/dev/wbwd/wbwd.c Modified: head/share/man/man4/wbwd.4 ============================================================================== --- head/share/man/man4/wbwd.4 Wed Oct 16 14:43:05 2019 (r353644) +++ head/share/man/man4/wbwd.4 Wed Oct 16 14:46:04 2019 (r353645) @@ -25,16 +25,17 @@ .\" .\" $FreeBSD$ .\" -.Dd March 24, 2016 +.Dd October 16, 2019 .Dt WBWD 4 .Os .Sh NAME .Nm wbwd .Nd device driver for Winbond/Nuvoton Super I/O chips watchdog timer .Sh SYNOPSIS -To compile this driver into the kernel, place the following line in your +To compile this driver into the kernel, place the following lines in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device superio" .Cd "device wbwd" .Ed .Pp @@ -91,10 +92,6 @@ Nuvoton NCT6791 .It Nuvoton NCT6792 .El -.Pp -Driver may be forced to attach to unknown chips by adding to -.Pa /boot/device.hints : -.Cd hint.wbwd.0.at="isa" .Sh SYSCTL VARIABLES The .Nm @@ -130,6 +127,7 @@ The driver also provides further sysctl options that are hidden by default. See the source code for more information. .Sh SEE ALSO +.Xr superio 4 .Xr watchdog 4 , .Xr device.hints 5 , .Xr watchdog 8 , Modified: head/sys/dev/wbwd/wbwd.c ============================================================================== --- head/sys/dev/wbwd/wbwd.c Wed Oct 16 14:43:05 2019 (r353644) +++ head/sys/dev/wbwd/wbwd.c Wed Oct 16 14:46:04 2019 (r353645) @@ -47,14 +47,12 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include -#include #include #include #include -#include +#include #include #include @@ -101,13 +99,7 @@ enum chips { w83627hf, w83627s, w83697hf, w83697ug, w8 struct wb_softc { device_t dev; - struct resource *portres; - bus_space_tag_t bst; - bus_space_handle_t bsh; - int rid; eventhandler_tag ev_tag; - int (*ext_cfg_enter_f)(struct wb_softc *, u_short); - void (*ext_cfg_exit_f)(struct wb_softc *, u_short); enum chips chip; uint8_t ctl_reg; uint8_t time_reg; @@ -132,26 +124,6 @@ struct wb_softc { uint8_t reg_2; }; -static int ext_cfg_enter_0x87_0x87(struct wb_softc *, u_short); -static void ext_cfg_exit_0xaa(struct wb_softc *, u_short); - -struct winbond_superio_cfg { - uint8_t efer; /* and efir */ - int (*ext_cfg_enter_f)(struct wb_softc *, u_short); - void (*ext_cfg_exit_f)(struct wb_softc *, u_short); -} probe_addrs[] = { - { - .efer = 0x2e, - .ext_cfg_enter_f = ext_cfg_enter_0x87_0x87, - .ext_cfg_exit_f = ext_cfg_exit_0xaa, - }, - { - .efer = 0x4e, - .ext_cfg_enter_f = ext_cfg_enter_0x87_0x87, - .ext_cfg_exit_f = ext_cfg_exit_0xaa, - }, -}; - struct winbond_vendor_device_id { uint8_t device_id; enum chips chip; @@ -264,66 +236,7 @@ struct winbond_vendor_device_id { }, }; -static void -write_efir_1(struct wb_softc *sc, u_short baseport, uint8_t value) -{ - MPASS(sc != NULL || baseport != 0); - if (sc != NULL) - bus_space_write_1((sc)->bst, (sc)->bsh, 0, (value)); - else - outb(baseport, value); -} - -static uint8_t __unused -read_efir_1(struct wb_softc *sc, u_short baseport) -{ - - MPASS(sc != NULL || baseport != 0); - if (sc != NULL) - return (bus_space_read_1((sc)->bst, (sc)->bsh, 0)); - else - return (inb(baseport)); -} - -static void -write_efdr_1(struct wb_softc *sc, u_short baseport, uint8_t value) -{ - - MPASS(sc != NULL || baseport != 0); - if (sc != NULL) - bus_space_write_1((sc)->bst, (sc)->bsh, 1, (value)); - else - outb(baseport + 1, value); -} - -static uint8_t -read_efdr_1(struct wb_softc *sc, u_short baseport) -{ - - MPASS(sc != NULL || baseport != 0); - if (sc != NULL) - return (bus_space_read_1((sc)->bst, (sc)->bsh, 1)); - else - return (inb(baseport + 1)); -} - -static void -write_reg(struct wb_softc *sc, uint8_t reg, uint8_t value) -{ - - write_efir_1(sc, 0, reg); - write_efdr_1(sc, 0, value); -} - -static uint8_t -read_reg(struct wb_softc *sc, uint8_t reg) -{ - - write_efir_1(sc, 0, reg); - return (read_efdr_1(sc, 0)); -} - /* * Return the watchdog related registers as we last read them. This will * usually not give the current timeout or state on whether the watchdog @@ -362,18 +275,10 @@ sysctl_wb_debug_current(SYSCTL_HANDLER_ARGS) sc = arg1; - if ((*sc->ext_cfg_enter_f)(sc, 0) != 0) - return (ENXIO); + sc->reg_1 = superio_read(sc->dev, sc->ctl_reg); + sc->reg_timeout = superio_read(sc->dev, sc->time_reg); + sc->reg_2 = superio_read(sc->dev, sc->csr_reg); - /* Watchdog is configured as part of LDN 8 (GPIO Port2, Watchdog). */ - write_reg(sc, WB_LDN_REG, WB_LDN_REG_LDN8); - - sc->reg_1 = read_reg(sc, sc->ctl_reg); - sc->reg_timeout = read_reg(sc, sc->time_reg); - sc->reg_2 = read_reg(sc, sc->csr_reg); - - (*sc->ext_cfg_exit_f)(sc, 0); - return (sysctl_wb_debug(oidp, arg1, arg2, req)); } @@ -411,12 +316,7 @@ sysctl_wb_force_test_nmi(SYSCTL_HANDLER_ARGS) sc->test_nmi = 0; return (0); } -#endif - if ((*sc->ext_cfg_enter_f)(sc, 0) != 0) - return (ENXIO); - -#ifdef notyet /* * If we are testing the NMI functionality, set the flag before * forcing the timeout. @@ -425,16 +325,11 @@ sysctl_wb_force_test_nmi(SYSCTL_HANDLER_ARGS) sc->test_nmi = 1; #endif - /* Watchdog is configured as part of LDN 8 (GPIO Port2, Watchdog). */ - write_reg(sc, WB_LDN_REG, WB_LDN_REG_LDN8); - /* Force watchdog to fire. */ - sc->reg_2 = read_reg(sc, sc->csr_reg); + sc->reg_2 = superio_read(sc->dev, sc->csr_reg); sc->reg_2 |= WB_LDN8_CRF7_FORCE; - write_reg(sc, sc->csr_reg, sc->reg_2); + superio_write(sc->dev, sc->csr_reg, sc->reg_2); - (*sc->ext_cfg_exit_f)(sc, 0); - return (0); } @@ -450,7 +345,7 @@ wb_print_state(struct wb_softc *sc, const char *msg) device_printf(sc->dev, "%s%sWatchdog %sabled. %s" "Scaling by %ds, timer at %d (%s=%ds%s). " - "CRF5 0x%02x CRF7 0x%02x\n", + "CR%02X 0x%02x CR%02X 0x%02x\n", (msg != NULL) ? msg : "", (msg != NULL) ? ": " : "", (sc->reg_timeout > 0x00) ? "en" : "dis", (sc->reg_2 & WB_LDN8_CRF7_TS) ? "Watchdog fired. " : "", @@ -459,35 +354,10 @@ wb_print_state(struct wb_softc *sc, const char *msg) (sc->reg_timeout > 0x00) ? "<" : "", sc->reg_timeout * ((sc->reg_1 & WB_LDN8_CRF5_SCALE) ? 60 : 1), (sc->reg_timeout > 0x00) ? " left" : "", - sc->reg_1, sc->reg_2); + sc->ctl_reg, sc->reg_1, sc->csr_reg, sc->reg_2); } /* - * Functions to enter and exit extended function mode. Possibly shared - * between different chips. - */ -static int -ext_cfg_enter_0x87_0x87(struct wb_softc *sc, u_short baseport) -{ - - /* - * Enable extended function mode. - * Winbond does not allow us to validate so always return success. - */ - write_efir_1(sc, baseport, 0x87); - write_efir_1(sc, baseport, 0x87); - - return (0); -} - -static void -ext_cfg_exit_0xaa(struct wb_softc *sc, u_short baseport) -{ - - write_efir_1(sc, baseport, 0xaa); -} - -/* * (Re)load the watchdog counter depending on timeout. A timeout of 0 will * disable the watchdog. */ @@ -511,20 +381,14 @@ wb_set_watchdog(struct wb_softc *sc, unsigned int time if (sc->debug_verbose) wb_print_state(sc, "Before watchdog counter (re)load"); - if ((*sc->ext_cfg_enter_f)(sc, 0) != 0) - return (ENXIO); - - /* Watchdog is configured as part of LDN 8 (GPIO Port2, Watchdog) */ - write_reg(sc, WB_LDN_REG, WB_LDN_REG_LDN8); - if (timeout == 0) { /* Disable watchdog. */ sc->reg_timeout = 0; - write_reg(sc, sc->time_reg, sc->reg_timeout); + superio_write(sc->dev, sc->time_reg, sc->reg_timeout); } else { /* Read current scaling factor. */ - sc->reg_1 = read_reg(sc, sc->ctl_reg); + sc->reg_1 = superio_read(sc->dev, sc->ctl_reg); if (timeout > 255) { /* Set scaling factor to 60s. */ @@ -539,21 +403,19 @@ wb_set_watchdog(struct wb_softc *sc, unsigned int time } /* In case we fired before we need to clear to fire again. */ - sc->reg_2 = read_reg(sc, sc->csr_reg); + sc->reg_2 = superio_read(sc->dev, sc->csr_reg); if (sc->reg_2 & WB_LDN8_CRF7_TS) { sc->reg_2 &= ~WB_LDN8_CRF7_TS; - write_reg(sc, sc->csr_reg, sc->reg_2); + superio_write(sc->dev, sc->csr_reg, sc->reg_2); } /* Write back scaling factor. */ - write_reg(sc, sc->ctl_reg, sc->reg_1); + superio_write(sc->dev, sc->ctl_reg, sc->reg_1); /* Set timer and arm/reset the watchdog. */ - write_reg(sc, sc->time_reg, sc->reg_timeout); + superio_write(sc->dev, sc->time_reg, sc->reg_timeout); } - (*sc->ext_cfg_exit_f)(sc, 0); - if (sc->debug_verbose) wb_print_state(sc, "After watchdog counter (re)load"); return (0); @@ -599,217 +461,99 @@ wb_watchdog_fn(void *private, u_int cmd, int *error) } } -/* - * Probe/attach the Winbond Super I/O chip. - * - * Initial abstraction to possibly support more chips: - * - Iterate over the well known base ports, try to enable extended function - * mode and read and match the device ID and device revision. Unfortunately - * the Vendor ID is in the hardware monitoring section accessible by different - * base ports only. - * - Also HEFRAS, which would tell use the base port, is only accessible after - * entering extended function mode, for which the base port is needed. - * At least check HEFRAS to match the current base port we are probing. - * - On match set the description, remember functions to enter/exit extended - * function mode as well as the base port. - */ static int -wb_probe_enable(device_t dev, int probe) +wb_probe(device_t dev) { - struct wb_softc *sc; - int error, found, i, j; - uint8_t dev_id, dev_rev, cr26; char buf[128]; + struct wb_softc *sc; + int found, j; + uint8_t devid; + uint8_t revid; - if (dev == NULL) - sc = NULL; - else { - sc = device_get_softc(dev); - bzero(sc, sizeof(*sc)); - sc->dev = dev; - } + if (superio_vendor(dev) != SUPERIO_VENDOR_NUVOTON) + return (ENXIO); + if (superio_get_type(dev) != SUPERIO_DEV_WDT) + return (ENXIO); - error = ENXIO; + sc = device_get_softc(dev); + devid = superio_devid(dev) >> 8; + revid = superio_revid(dev); found = 0; - for (i = 0; i < nitems(probe_addrs); i++) { - - if (sc != NULL) { - /* Allocate bus resources for IO index/data register access. */ - sc->portres = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->rid, - probe_addrs[i].efer, probe_addrs[i].efer + 1, 2, RF_ACTIVE); - if (sc->portres == NULL) - continue; - sc->bst = rman_get_bustag(sc->portres); - sc->bsh = rman_get_bushandle(sc->portres); - } - - error = (*probe_addrs[i].ext_cfg_enter_f)(sc, probe_addrs[i].efer); - if (error != 0) - goto cleanup; - - /* Identify the SuperIO chip. */ - write_efir_1(sc, probe_addrs[i].efer, WB_DEVICE_ID_REG); - dev_id = read_efdr_1(sc, probe_addrs[i].efer); - write_efir_1(sc, probe_addrs[i].efer, WB_DEVICE_REV_REG); - dev_rev = read_efdr_1(sc, probe_addrs[i].efer); - write_efir_1(sc, probe_addrs[i].efer, WB_CR26); - cr26 = read_efdr_1(sc, probe_addrs[i].efer); - - if (dev_id == 0xff && dev_rev == 0xff) - goto cleanup; - - /* HEFRAS of 0 means EFER at 0x2e, 1 means EFER at 0x4e. */ - if (((cr26 & 0x40) == 0x00 && probe_addrs[i].efer != 0x2e) || - ((cr26 & 0x40) == 0x40 && probe_addrs[i].efer != 0x4e)) { - if (dev != NULL) - device_printf(dev, "HEFRAS and EFER do not " - "align: EFER 0x%02x DevID 0x%02x DevRev " - "0x%02x CR26 0x%02x\n", - probe_addrs[i].efer, dev_id, dev_rev, cr26); - goto cleanup; - } - - for (j = 0; j < nitems(wb_devs); j++) { - if (wb_devs[j].device_id == dev_id) { - found = 1; - break; - } - } - - if (probe && dev != NULL) { + for (j = 0; j < nitems(wb_devs); j++) { + if (wb_devs[j].device_id == devid) { + sc->chip = wb_devs[j].chip; snprintf(buf, sizeof(buf), "%s (0x%02x/0x%02x) Watchdog Timer", - found ? wb_devs[j].descr : - "Unknown Winbond/Nuvoton", dev_id, dev_rev); + wb_devs[j].descr, devid, revid); device_set_desc_copy(dev, buf); - } - - /* If this is hinted attach, try to guess the model. */ - if (dev != NULL && !found) { - found = 1; - j = 0; - } - -cleanup: - if (probe || !found) { - (*probe_addrs[i].ext_cfg_exit_f)(sc, probe_addrs[i].efer); - if (sc != NULL) - (void) bus_release_resource(dev, SYS_RES_IOPORT, - sc->rid, sc->portres); - } - - /* - * Stop probing if have successfully identified the SuperIO. - * Remember the extended function mode enter/exit functions - * for operations. - */ - if (found) { - if (sc != NULL) { - sc->ext_cfg_enter_f = probe_addrs[i].ext_cfg_enter_f; - sc->ext_cfg_exit_f = probe_addrs[i].ext_cfg_exit_f; - sc->chip = wb_devs[j].chip; - sc->ctl_reg = 0xf5; - sc->time_reg = 0xf6; - sc->csr_reg = 0xf7; - if (sc->chip == w83697hf || - sc->chip == w83697ug) { - sc->ctl_reg = 0xf3; - sc->time_reg = 0xf4; - } else if (sc->chip == nct6102) { - sc->ctl_reg = 0xf0; - sc->time_reg = 0xf1; - sc->csr_reg = 0xf2; - } - } return (BUS_PROBE_SPECIFIC); - } else - error = ENXIO; + } } - - return (error); + return (ENXIO); } -static void -wb_identify(driver_t *driver, device_t parent) -{ - - if (device_find_child(parent, driver->name, 0) == NULL) { - if (wb_probe_enable(NULL, 1) <= 0) - BUS_ADD_CHILD(parent, 0, driver->name, 0); - } -} - static int -wb_probe(device_t dev) -{ - - /* Make sure we do not claim some ISA PNP device. */ - if (isa_get_logicalid(dev) != 0) - return (ENXIO); - - return (wb_probe_enable(dev, 1)); -} - -static int wb_attach(device_t dev) { struct wb_softc *sc; struct sysctl_ctx_list *sctx; struct sysctl_oid *soid; unsigned long timeout; - int error; uint8_t t; - error = wb_probe_enable(dev, 0); - if (error > 0) - return (ENXIO); - sc = device_get_softc(dev); - KASSERT(sc->ext_cfg_enter_f != NULL && sc->ext_cfg_exit_f != NULL, - ("%s: successful probe result but not setup correctly", __func__)); + sc->dev = dev; - /* Watchdog is configured as part of LDN 8 (GPIO Port2, Watchdog). */ - write_reg(sc, WB_LDN_REG, WB_LDN_REG_LDN8); + sc->ctl_reg = 0xf5; + sc->time_reg = 0xf6; + sc->csr_reg = 0xf7; + if (sc->chip == w83697hf || sc->chip == w83697ug) { + sc->ctl_reg = 0xf3; + sc->time_reg = 0xf4; + } else if (sc->chip == nct6102) { + sc->ctl_reg = 0xf0; + sc->time_reg = 0xf1; + sc->csr_reg = 0xf2; + } /* Make sure WDT is enabled. */ - write_reg(sc, WB_LDN8_CR30, - read_reg(sc, WB_LDN8_CR30) | WB_LDN8_CR30_ACTIVE); + superio_dev_enable(dev, WB_LDN8_CR30_ACTIVE); switch (sc->chip) { case w83627hf: case w83627s: - t = read_reg(sc, 0x2B) & ~0x10; - write_reg(sc, 0x2B, t); /* set GPIO24 to WDT0 */ + t = superio_read(dev, 0x2B) & ~0x10; + superio_write(dev, 0x2B, t); /* set GPIO24 to WDT0 */ break; case w83697hf: /* Set pin 119 to WDTO# mode (= CR29, WDT0) */ - t = read_reg(sc, 0x29) & ~0x60; + t = superio_read(dev, 0x29) & ~0x60; t |= 0x20; - write_reg(sc, 0x29, t); + superio_write(dev, 0x29, t); break; case w83697ug: /* Set pin 118 to WDTO# mode */ - t = read_reg(sc, 0x2b) & ~0x04; - write_reg(sc, 0x2b, t); + t = superio_read(dev, 0x2b) & ~0x04; + superio_write(dev, 0x2b, t); break; case w83627thf: - t = (read_reg(sc, 0x2B) & ~0x08) | 0x04; - write_reg(sc, 0x2B, t); /* set GPIO3 to WDT0 */ + t = (superio_read(dev, 0x2B) & ~0x08) | 0x04; + superio_write(dev, 0x2B, t); /* set GPIO3 to WDT0 */ break; case w83627dhg: case w83627dhg_p: - t = read_reg(sc, 0x2D) & ~0x01; /* PIN77 -> WDT0# */ - write_reg(sc, 0x2D, t); /* set GPIO5 to WDT0 */ - t = read_reg(sc, sc->ctl_reg); + t = superio_read(dev, 0x2D) & ~0x01; /* PIN77 -> WDT0# */ + superio_write(dev, 0x2D, t); /* set GPIO5 to WDT0 */ + t = superio_read(dev, sc->ctl_reg); t |= 0x02; /* enable the WDTO# output low pulse * to the KBRST# pin */ - write_reg(sc, sc->ctl_reg, t); + superio_write(dev, sc->ctl_reg, t); break; case w83637hf: break; case w83687thf: - t = read_reg(sc, 0x2C) & ~0x80; /* PIN47 -> WDT0# */ - write_reg(sc, 0x2C, t); + t = superio_read(dev, 0x2C) & ~0x80; /* PIN47 -> WDT0# */ + superio_write(dev, 0x2C, t); break; case w83627ehf: case w83627uhg: @@ -829,19 +573,19 @@ wb_attach(device_t dev) * Don't touch its configuration, and hope the BIOS * does the right thing. */ - t = read_reg(sc, sc->ctl_reg); + t = superio_read(dev, sc->ctl_reg); t |= 0x02; /* enable the WDTO# output low pulse * to the KBRST# pin */ - write_reg(sc, sc->ctl_reg, t); + superio_write(dev, sc->ctl_reg, t); break; default: break; } /* Read the current watchdog configuration. */ - sc->reg_1 = read_reg(sc, sc->ctl_reg); - sc->reg_timeout = read_reg(sc, sc->time_reg); - sc->reg_2 = read_reg(sc, sc->csr_reg); + sc->reg_1 = superio_read(dev, sc->ctl_reg); + sc->reg_timeout = superio_read(dev, sc->time_reg); + sc->reg_2 = superio_read(dev, sc->csr_reg); /* Print current state if bootverbose or watchdog already enabled. */ if (bootverbose || (sc->reg_timeout > 0x00)) @@ -849,7 +593,7 @@ wb_attach(device_t dev) sc->reg_1 &= ~WB_LDN8_CRF5_KEYB_P20; sc->reg_1 |= WB_LDN8_CRF5_KBRST; - write_reg(sc, sc->ctl_reg, sc->reg_1); + superio_write(dev, sc->ctl_reg, sc->reg_1); /* * Clear a previous watchdog timeout event (if still set). @@ -857,10 +601,8 @@ wb_attach(device_t dev) * since one of my boards is getting stuck in reboot without it. */ sc->reg_2 &= ~(WB_LDN8_CRF7_MOUSE|WB_LDN8_CRF7_TS); - write_reg(sc, sc->csr_reg, sc->reg_2); + superio_write(dev, sc->csr_reg, sc->reg_2); - (*sc->ext_cfg_exit_f)(sc, 0); - /* Read global timeout override tunable, Add per device sysctls. */ if (TUNABLE_ULONG_FETCH("hw.wbwd.timeout_override", &timeout)) { if (timeout > 0) @@ -907,12 +649,6 @@ wb_detach(device_t dev) EVENTHANDLER_DEREGISTER(watchdog_list, sc->ev_tag); wb_set_watchdog(sc, 0); - /* Disable extended function mode. */ - (*sc->ext_cfg_exit_f)(sc, 0); - - /* Cleanup resources. */ - (void) bus_release_resource(dev, SYS_RES_IOPORT, sc->rid, sc->portres); - /* Bus subroutines take care of sysctls already. */ return (0); @@ -920,7 +656,6 @@ wb_detach(device_t dev) static device_method_t wb_methods[] = { /* Device interface */ - DEVMETHOD(device_identify, wb_identify), DEVMETHOD(device_probe, wb_probe), DEVMETHOD(device_attach, wb_attach), DEVMETHOD(device_detach, wb_detach), @@ -928,7 +663,7 @@ static device_method_t wb_methods[] = { DEVMETHOD_END }; -static driver_t wb_isa_driver = { +static driver_t wb_driver = { "wbwd", wb_methods, sizeof(struct wb_softc) @@ -936,4 +671,6 @@ static driver_t wb_isa_driver = { static devclass_t wb_devclass; -DRIVER_MODULE(wb, isa, wb_isa_driver, wb_devclass, NULL, NULL); +DRIVER_MODULE(wb, superio, wb_driver, wb_devclass, NULL, NULL); +MODULE_DEPEND(wb, superio, 1, 1, 1); +MODULE_VERSION(wb, 1); From owner-svn-src-all@freebsd.org Wed Oct 16 14:55:57 2019 Return-Path: Delivered-To: svn-src-all@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 3F410166EA4; Wed, 16 Oct 2019 14:55:57 +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 46tb2j11tqz3MCx; Wed, 16 Oct 2019 14:55:57 +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 039D28AE5; Wed, 16 Oct 2019 14:55:57 +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 x9GEtumZ081271; Wed, 16 Oct 2019 14:55:56 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GEtuR6081270; Wed, 16 Oct 2019 14:55:56 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910161455.x9GEtuR6081270@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Oct 2019 14:55:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353646 - head/sbin/bectl X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sbin/bectl X-SVN-Commit-Revision: 353646 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 14:55:57 -0000 Author: kevans Date: Wed Oct 16 14:55:56 2019 New Revision: 353646 URL: https://svnweb.freebsd.org/changeset/base/353646 Log: bectl(8): destroy: use BE_DESTROY_AUTOORIGIN if -o is not specified -o will force the origin to be destroyed unconditionally. BE_DESTROY_AUTOORIGIN, on the other hand, will only destroy the origin if it matches the format used by be_snapshot. This lets us clean up the snapshots that are clearly not user-managed (because we're creating them) while leaving user-created snapshots in place and warning that they're still around when the BE created goes away. Modified: head/sbin/bectl/bectl.c Modified: head/sbin/bectl/bectl.c ============================================================================== --- head/sbin/bectl/bectl.c Wed Oct 16 14:46:04 2019 (r353645) +++ head/sbin/bectl/bectl.c Wed Oct 16 14:55:56 2019 (r353646) @@ -376,6 +376,7 @@ bectl_cmd_destroy(int argc, char *argv[]) /* We'll emit a notice if there's an origin to be cleaned up */ if ((flags & BE_DESTROY_ORIGIN) == 0 && strchr(target, '@') == NULL) { + flags |= BE_DESTROY_AUTOORIGIN; if (be_root_concat(be, target, targetds) != 0) goto destroy; if (be_prop_list_alloc(&props) != 0) @@ -384,7 +385,8 @@ bectl_cmd_destroy(int argc, char *argv[]) be_prop_list_free(props); goto destroy; } - if (nvlist_lookup_string(props, "origin", &origin) == 0) + if (nvlist_lookup_string(props, "origin", &origin) == 0 && + !be_is_auto_snapshot_name(be, origin)) fprintf(stderr, "bectl destroy: leaving origin '%s' intact\n", origin); be_prop_list_free(props); From owner-svn-src-all@freebsd.org Wed Oct 16 14:57:40 2019 Return-Path: Delivered-To: svn-src-all@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 72BEF166FCF; Wed, 16 Oct 2019 14:57:40 +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 46tb4h2R49z3MN2; Wed, 16 Oct 2019 14:57:40 +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 18A9E8AE6; Wed, 16 Oct 2019 14:57:40 +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 x9GEvdsg081414; Wed, 16 Oct 2019 14:57:39 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GEvcXK081407; Wed, 16 Oct 2019 14:57:38 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910161457.x9GEvcXK081407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 14:57:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353647 - in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/itwd sys/i386/conf sys/modules/itwd X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/itwd sys/i386/conf sys/modules/itwd X-SVN-Commit-Revision: 353647 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 14:57:40 -0000 Author: avg Date: Wed Oct 16 14:57:38 2019 New Revision: 353647 URL: https://svnweb.freebsd.org/changeset/base/353647 Log: itwd(4): driver for watchdog function in ITE Super I/O chips The chips are commonly named with "IT" prefix. MFC after: 19 days Added: head/share/man/man4/itwd.4 (contents, props changed) head/sys/dev/itwd/ head/sys/dev/itwd/itwd.c (contents, props changed) head/sys/modules/itwd/ head/sys/modules/itwd/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/amd64/conf/NOTES head/sys/conf/files.x86 head/sys/i386/conf/NOTES Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Wed Oct 16 14:55:56 2019 (r353646) +++ head/share/man/man4/Makefile Wed Oct 16 14:57:38 2019 (r353647) @@ -227,6 +227,7 @@ MAN= aac.4 \ ismt.4 \ isp.4 \ ispfw.4 \ + ${_itwd.4} \ iwi.4 \ iwifw.4 \ iwm.4 \ @@ -791,6 +792,7 @@ _if_wpi.4= if_wpi.4 _imcsmb.4= imcsmb.4 _ipmi.4= ipmi.4 _io.4= io.4 +_itwd.4= itwd.4 _linux.4= linux.4 _nda.4= nda.4 _ndis.4= ndis.4 Added: head/share/man/man4/itwd.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/itwd.4 Wed Oct 16 14:57:38 2019 (r353647) @@ -0,0 +1,75 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2012 Bjoern A. Zeeb +.\" Copyright (c) 2019 Andriy Gapon +.\" +.\" 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 October 16, 2019 +.Dt ITWD 4 +.Os +.Sh NAME +.Nm itwd +.Nd device driver for ITE Super I/O chips watchdog timer +.Sh SYNOPSIS +To compile this driver into the kernel, place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device superio" +.Cd "device itwd" +.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 +itwd_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides +.Xr watchdog 4 +support for the watchdog timer present on at least the following +Super I/O chips: +.Bl -bullet -compact +.It +IT8721F +.It +IT8728F +.It +IT8771F +.El +.Sh SEE ALSO +.Xr superio 4 +.Xr watchdog 4 , +.Xr device.hints 5 , +.Xr watchdog 8 , +.Xr watchdogd 8 , +.Xr watchdog 9 +.Sh AUTHORS +.An -nosplit +This manual page was written by +.An Andriy Gapon Aq Mt avg@FreeBSD.org . Modified: head/sys/amd64/conf/NOTES ============================================================================== --- head/sys/amd64/conf/NOTES Wed Oct 16 14:55:56 2019 (r353646) +++ head/sys/amd64/conf/NOTES Wed Oct 16 14:57:38 2019 (r353647) @@ -550,11 +550,13 @@ device ioat # Intel I/OAT DMA engine # amdsbwd: AMD SB7xx watchdog timer # viawd: VIA south bridge watchdog timer # wbwd: Winbond watchdog timer +# itwd: ITE Super I/O watchdog timer # device ichwd device amdsbwd device viawd device wbwd +device itwd # # Temperature sensors: Modified: head/sys/conf/files.x86 ============================================================================== --- head/sys/conf/files.x86 Wed Oct 16 14:55:56 2019 (r353646) +++ head/sys/conf/files.x86 Wed Oct 16 14:57:38 2019 (r353647) @@ -252,6 +252,7 @@ dev/isci/scil/scif_sas_task_request.c optional isci dev/isci/scil/scif_sas_task_request_state_handlers.c optional isci dev/isci/scil/scif_sas_task_request_states.c optional isci dev/isci/scil/scif_sas_timer.c optional isci +dev/itwd/itwd.c optional itwd libkern/x86/crc32_sse42.c standard # # x86 shared code between IA32 and AMD64 architectures Added: head/sys/dev/itwd/itwd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/itwd/itwd.c Wed Oct 16 14:57:38 2019 (r353647) @@ -0,0 +1,236 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 Andriy Gapon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + + +struct itwd_softc { + eventhandler_tag wd_ev; + void *intr_handle; + struct resource *intr_res; + int intr_rid; +}; + +static void +wd_func(void *priv, u_int cmd, int *error) +{ + device_t dev = priv; + uint64_t timeout; + uint8_t val; + + + if (cmd != 0) { + cmd &= WD_INTERVAL; + + /* + * Convert the requested timeout to seconds. + * If the timeout is smaller than the minimal supported value + * then set it to the minimum. + * TODO This hardware actually supports 64ms resolution + * when bit 5 of 0x72 is set. Switch to that resolution when + * needed. + */ + if (cmd >= WD_TO_1SEC) + timeout = (uint64_t)1 << (cmd - WD_TO_1SEC); + else + timeout = 1; + + /* TODO If timeout is greater than maximum value + * that can be specified in seconds, we should + * switch the timer to minutes mode by clearing + * bit 7 of 0x72 (ensure that bit 5 is also cleared). + * + * For now, just disable the timer to honor the + * watchdog(9) protocol. + * + * XXX The timeout actually can be up to 65535 units + * as it is set via two registers 0x73, LSB, and 0x74, + * MSB. But it is not clear what the protocol for writing + * those two registers is. + */ + if (timeout <= UINT8_MAX) { + val = timeout; + *error = 0; + } else { + /* error left unchanged */ + val = 0; + } + } else { + val = 0; + } +#ifdef DIAGNOSTIC + if (bootverbose) + device_printf(dev, "setting timeout to %d\n", val); +#endif + superio_write(dev, 0x73, val); + if (superio_read(dev, 0x73) != val) + superio_write(dev, 0x73, val); +} + +static void +itwd_intr(void *cookie) +{ + device_t dev = cookie; + uint8_t val; + + val = superio_read(dev, 0x71); + if (bootverbose) + device_printf(dev, "got interrupt, wdt status = %d\n", val & 1); + superio_write(dev, 0x71, val & ~((uint8_t)0x01)); +} + +static int +itwd_probe(device_t dev) +{ + + if (superio_vendor(dev) != SUPERIO_VENDOR_ITE) + return (ENXIO); + if (superio_get_type(dev) != SUPERIO_DEV_WDT) + return (ENXIO); + device_set_desc(dev, "Watchdog Timer on ITE SuperIO"); + return (BUS_PROBE_DEFAULT); +} + +static int +itwd_attach(device_t dev) +{ + struct itwd_softc *sc = device_get_softc(dev); + int irq = 0; + int nmi = 0; + int error; + + /* First, reset the timeout, just in case. */ + superio_write(dev, 0x74, 0); + superio_write(dev, 0x73, 0); + + TUNABLE_INT_FETCH("dev.itwd.irq", &irq); + TUNABLE_INT_FETCH("dev.itwd.nmi", &nmi); + if (irq < 0 || irq > 15) { + device_printf(dev, "Ignoring invalid IRQ value %d\n", irq); + irq = 0; + } + if (irq == 0 && nmi) { + device_printf(dev, "Ignoring NMI mode if IRQ is not set\n"); + nmi = 0; + } + + /* + * NB: if the interrupt has been configured for the NMI delivery, + * then it is not available for the regular interrupt allocation. + * Thus, we configure the hardware to generate the interrupt, + * but do not attempt to allocate and setup it as a regular + * interrupt. + */ + if (irq != 0 && !nmi) { + sc->intr_rid = 0; + bus_set_resource(dev, SYS_RES_IRQ, sc->intr_rid, irq, 1); + + sc->intr_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, + &sc->intr_rid, RF_ACTIVE); + if (sc->intr_res == NULL) { + device_printf(dev, "unable to map interrupt\n"); + return (ENXIO); + } + error = bus_setup_intr(dev, sc->intr_res, + INTR_TYPE_MISC | INTR_MPSAFE, NULL, itwd_intr, dev, + &sc->intr_handle); + if (error != 0) { + bus_release_resource(dev, SYS_RES_IRQ, + sc->intr_rid, sc->intr_res); + device_printf(dev, "Unable to setup irq: error %d\n", + error); + return (ENXIO); + } + } + if (irq != 0) { + device_printf(dev, "Using IRQ%d to signal timeout\n", irq); + } else { + /* System reset via KBRST. */ + irq = 0x40; + device_printf(dev, "Configured for system reset on timeout\n"); + } + + superio_write(dev, 0x71, 0); + superio_write(dev, 0x72, 0x80 | (uint8_t)irq); + + sc->wd_ev = EVENTHANDLER_REGISTER(watchdog_list, wd_func, dev, 0); + return (0); +} + +static int +itwd_detach(device_t dev) +{ + struct itwd_softc *sc = device_get_softc(dev); + int dummy; + + if (sc->wd_ev != NULL) + EVENTHANDLER_DEREGISTER(watchdog_list, sc->wd_ev); + wd_func(dev, 0, &dummy); + if (sc->intr_handle) + bus_teardown_intr(dev, sc->intr_res, sc->intr_handle); + if (sc->intr_res) + bus_release_resource(dev, SYS_RES_IRQ, sc->intr_rid, + sc->intr_res); + return (0); +} + +static device_method_t itwd_methods[] = { + /* Methods from the device interface */ + DEVMETHOD(device_probe, itwd_probe), + DEVMETHOD(device_attach, itwd_attach), + DEVMETHOD(device_detach, itwd_detach), + + /* Terminate method list */ + { 0, 0 } +}; + +static driver_t itwd_driver = { + "itwd", + itwd_methods, + sizeof (struct itwd_softc) +}; + +static devclass_t itwd_devclass; + +DRIVER_MODULE(itwd, superio, itwd_driver, itwd_devclass, NULL, NULL); +MODULE_DEPEND(itwd, superio, 1, 1, 1); +MODULE_VERSION(itwd, 1); Modified: head/sys/i386/conf/NOTES ============================================================================== --- head/sys/i386/conf/NOTES Wed Oct 16 14:55:56 2019 (r353646) +++ head/sys/i386/conf/NOTES Wed Oct 16 14:57:38 2019 (r353647) @@ -816,11 +816,13 @@ hint.pcf.0.irq="5" # amdsbwd: AMD SB7xx watchdog timer # viawd: VIA south bridge watchdog timer # wbwd: Winbond watchdog timer +# itwd: ITE Super I/O watchdog timer # device ichwd device amdsbwd device viawd device wbwd +device itwd # # Temperature sensors: Added: head/sys/modules/itwd/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/itwd/Makefile Wed Oct 16 14:57:38 2019 (r353647) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/itwd + +KMOD= itwd +SRCS= itwd.c +SRCS+= device_if.h bus_if.h isa_if.h + +.include From owner-svn-src-all@freebsd.org Wed Oct 16 15:01:45 2019 Return-Path: Delivered-To: svn-src-all@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 7A5451671AE; Wed, 16 Oct 2019 15:01:45 +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 46tb9P2RkKz3Mnt; Wed, 16 Oct 2019 15:01:45 +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 3833E8C5F; Wed, 16 Oct 2019 15:01:45 +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 x9GF1jef084796; Wed, 16 Oct 2019 15:01:45 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GF1jDx084788; Wed, 16 Oct 2019 15:01:45 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910161501.x9GF1jDx084788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 15:01:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353648 - head/sys/modules X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/modules X-SVN-Commit-Revision: 353648 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 15:01:45 -0000 Author: avg Date: Wed Oct 16 15:01:44 2019 New Revision: 353648 URL: https://svnweb.freebsd.org/changeset/base/353648 Log: attach itwd to the module build on x86 MFC after: 19 days X-MFC with: r353647 Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Wed Oct 16 14:57:38 2019 (r353647) +++ head/sys/modules/Makefile Wed Oct 16 15:01:44 2019 (r353648) @@ -184,6 +184,7 @@ SUBDIR= \ ${_iser} \ isp \ ${_ispfw} \ + ${_itwd} \ ${_iwi} \ ${_iwifw} \ ${_iwm} \ @@ -598,6 +599,7 @@ _et= et _exca= exca _if_ndis= if_ndis _io= io +_itwd= itwd _ix= ix _ixv= ixv .if ${MK_SOURCELESS_UCODE} != "no" From owner-svn-src-all@freebsd.org Wed Oct 16 15:10:20 2019 Return-Path: Delivered-To: svn-src-all@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 A342F167480; Wed, 16 Oct 2019 15:10:20 +0000 (UTC) (envelope-from br@bsdpad.com) Received: from sc1.bsdpad.com (sc1.bsdpad.com [163.172.212.18]) (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 46tbMH4Krkz3NFK; Wed, 16 Oct 2019 15:10:19 +0000 (UTC) (envelope-from br@bsdpad.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bsdpad.com; s=20190317; h=Subject:To:From; bh=T+zbIgwfCI2Piytl61W4zeSfdGvTw0M8BEcvOeotNKU=; b=JtcD5H1PdbTQVc2ut+o0Iu7PFi wcsutts6rlKuXwB3cUCve4fs/BNjZtyDZEFDU3rxqPSn0vDxyFvIZXIBqdL5wjMEvuKa3ZcHfaDwi VZ9BPyi1BUITPrZecZ/sn7UICnfjPNc227ZaAGPmSnVVxptAJxzL6/qgs+1DNVaYMq9GSVxh3rt5h Y8e61n3piefE16+GAQcsEN6n5v3qTIm/QIOuw4vQ03TrFdJ9OubIT6iZImyAvvmPfN4pANC6aXSHi vytzG8Zmg0deNKu7SA+eJRsg1xhEHLVPn6YQveH2g5JNHLUGP0dMgVz5bVLrtXYuKeK8qmLhJtwSx VP44Yovg==; Received: from localhost ([127.0.0.1] helo=bsdpad.com) by sc1.bsdpad.com with smtp (Exim 4.91 (FreeBSD)) (envelope-from ) id 1iKksk-0004bX-Li; Wed, 16 Oct 2019 16:06:34 +0100 Received: by bsdpad.com (nbSMTP-1.00) for uid 1001 br@bsdpad.com; Wed, 16 Oct 2019 16:06:34 +0100 (BST) Date: Wed, 16 Oct 2019 16:06:34 +0100 From: Ruslan Bukin To: Emmanuel Vadot Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353493 - head/sys/dev/mmc/host Message-ID: <20191016150634.GA17444@bsdpad.com> References: <201910141553.x9EFr0Zb010167@repo.freebsd.org> <20191014181051.bd8c7a3dbb7b07a636d81ed9@bidouilliste.com> <20191014162751.GA30496@bsdpad.com> <20191014184526.e5f3798fd4d4f9c744f4a491@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191014184526.e5f3798fd4d4f9c744f4a491@bidouilliste.com> User-Agent: Mutt/1.11.2 (2019-01-07) X-Rspamd-Queue-Id: 46tbMH4Krkz3NFK X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdpad.com header.s=20190317 header.b=JtcD5H1P; dmarc=none; spf=pass (mx1.freebsd.org: domain of br@bsdpad.com designates 163.172.212.18 as permitted sender) smtp.mailfrom=br@bsdpad.com X-Spamd-Result: default: False [-5.01 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdpad.com:s=20190317]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdpad.com:+]; IP_SCORE(-2.81)[ip: (-9.43), ipnet: 163.172.208.0/20(-4.73), asn: 12876(0.11), country: FR(-0.00)]; FORGED_SENDER(0.30)[br@freebsd.org,br@bsdpad.com]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:12876, ipnet:163.172.208.0/20, country:FR]; FROM_NEQ_ENVFROM(0.00)[br@freebsd.org,br@bsdpad.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 15:10:20 -0000 On Mon, Oct 14, 2019 at 06:45:26PM +0200, Emmanuel Vadot wrote: > On Mon, 14 Oct 2019 17:27:51 +0100 > Ruslan Bukin wrote: > > > On Mon, Oct 14, 2019 at 06:10:51PM +0200, Emmanuel Vadot wrote: > > > > > > On Mon, 14 Oct 2019 15:53:00 +0000 (UTC) > > > Ruslan Bukin wrote: > > > > > > > Author: br > > > > Date: Mon Oct 14 15:52:59 2019 > > > > New Revision: 353493 > > > > URL: https://svnweb.freebsd.org/changeset/base/353493 > > > > > > > > Log: > > > > Fix the driver attachment in cases when the external resource devices > > > > (resets, regulators, clocks) are not available. > > > > > > > > Rely on a system initialization done by a bootloader in that cases. > > > > > > > > This fixes operation on Terasic DE10-Pro (an Intel Stratix 10 > > > > development kit). > > > > > > > > Sponsored by: DARPA, AFRL > > > > > > > > Modified: > > > > head/sys/dev/mmc/host/dwmmc.c > > > > > > > > Modified: head/sys/dev/mmc/host/dwmmc.c > > > > ============================================================================== > > > > --- head/sys/dev/mmc/host/dwmmc.c Mon Oct 14 15:33:53 2019 (r353492) > > > > +++ head/sys/dev/mmc/host/dwmmc.c Mon Oct 14 15:52:59 2019 (r353493) > > > > @@ -1,5 +1,5 @@ > > > > /*- > > > > - * Copyright (c) 2014 Ruslan Bukin > > > > + * Copyright (c) 2014-2019 Ruslan Bukin > > > > * All rights reserved. > > > > * > > > > * This software was developed by SRI International and the University of > > > > @@ -457,26 +457,20 @@ parse_fdt(struct dwmmc_softc *sc) > > > > > > > > /* IP block reset is optional */ > > > > error = hwreset_get_by_ofw_name(sc->dev, 0, "reset", &sc->hwreset); > > > > - if (error != 0 && error != ENOENT) { > > > > + if (error != 0 && error != ENOENT) > > > > device_printf(sc->dev, "Cannot get reset\n"); > > > > - goto fail; > > > > - } > > > > > > This is not correct, on a system without reset/clock/regulator support > > > you will get ENODEV as the phandle is present but no device is > > > associated with it. This is the case that you want to test. Currently > > > this hide all errors. > > > > The change means that the driver will be attached regardless of the return value from ext resources. > > Yes and this is a problem. > > > Why it is not correct? > > Because if a reset/clock/regulator is present but we failed to parse > the node (bad #clock-cell for example) this just assume that the > resource isn't present which is not correct. Or worse the underlying > gpio cannot be mapped, you now have a non functional driver because you > cannot switch the regulator. > Could an error in DTS convert a device from being optional to become mandatory? It is still not clear if any support present on a stage of parsing. Since the knowledge of registered support is at extres, then it should be mandatory from a driver perspective (if enabled in kernel config). And then the framework should make a decision based on any support present. What do you think ? Ruslan From owner-svn-src-all@freebsd.org Wed Oct 16 15:21:06 2019 Return-Path: Delivered-To: svn-src-all@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 23C6D1677FC; Wed, 16 Oct 2019 15:21:06 +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 46tbbk0C3Xz3Nx7; Wed, 16 Oct 2019 15:21:06 +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 DE2D18FAD; Wed, 16 Oct 2019 15:21:05 +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 x9GFL56I093496; Wed, 16 Oct 2019 15:21:05 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GFL5DN093495; Wed, 16 Oct 2019 15:21:05 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910161521.x9GFL5DN093495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 16 Oct 2019 15:21:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353649 - head/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/zfs X-SVN-Commit-Revision: 353649 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 15:21:06 -0000 Author: avg Date: Wed Oct 16 15:21:05 2019 New Revision: 353649 URL: https://svnweb.freebsd.org/changeset/base/353649 Log: fix section number in zfs-program.8 MFC after: 3 days Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Wed Oct 16 15:01:44 2019 (r353648) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Wed Oct 16 15:21:05 2019 (r353649) @@ -12,7 +12,7 @@ .\" Copyright (c) 2018 Datto Inc. .\" .Dd October 02, 2017 -.Dt ZFS-PROGRAM 1M +.Dt ZFS-PROGRAM 8 .Os .Sh NAME .Nm zfs program From owner-svn-src-all@freebsd.org Wed Oct 16 15:47:23 2019 Return-Path: Delivered-To: svn-src-all@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 9784814878E; Wed, 16 Oct 2019 15:47:23 +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 46tcB32p3qz3R7Y; Wed, 16 Oct 2019 15:47:22 +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 x9GFlKq7040366 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 16 Oct 2019 08:47:21 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x9GFlKLf040365; Wed, 16 Oct 2019 08:47:20 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Wed, 16 Oct 2019 08:47:20 -0700 From: Gleb Smirnoff To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353597 - head/share/mk Message-ID: <20191016154720.GS4086@FreeBSD.org> References: <201910152127.x9FLR7rV061089@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201910152127.x9FLR7rV061089@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46tcB32p3qz3R7Y X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.992,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 15:47:23 -0000 Brooks, On Tue, Oct 15, 2019 at 09:27:07PM +0000, Brooks Davis wrote: B> Author: brooks B> Date: Tue Oct 15 21:27:06 2019 B> New Revision: 353597 B> URL: https://svnweb.freebsd.org/changeset/base/353597 B> B> Log: B> Add the ability to link programs against a compat ABI. ... B> Modified: head/share/mk/bsd.prog.mk B> ============================================================================== B> --- head/share/mk/bsd.prog.mk Tue Oct 15 21:24:25 2019 (r353596) B> +++ head/share/mk/bsd.prog.mk Tue Oct 15 21:27:06 2019 (r353597) B> @@ -2,6 +2,7 @@ B> # $FreeBSD$ B> B> .include B> +.include B> .include B> .include And bsd.compat.mk isn't installed. Now that bsd.prog.mk requires it, some ports compilations are broken. -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Wed Oct 16 15:50:12 2019 Return-Path: Delivered-To: svn-src-all@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 DADEA148B5E; Wed, 16 Oct 2019 15:50:12 +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 46tcFJ5SpHz3wdZ; Wed, 16 Oct 2019 15:50:12 +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 9FC8C93D3; Wed, 16 Oct 2019 15:50:12 +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 x9GFoCmU015810; Wed, 16 Oct 2019 15:50:12 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GFoCXc015809; Wed, 16 Oct 2019 15:50:12 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910161550.x9GFoCXc015809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 16 Oct 2019 15:50:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353650 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 353650 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 15:50:12 -0000 Author: markj Date: Wed Oct 16 15:50:12 2019 New Revision: 353650 URL: https://svnweb.freebsd.org/changeset/base/353650 Log: Clear PGA_WRITEABLE in moea_pvo_remove(). moea_pvo_remove() might remove the last mapping of a page, in which case it is clearly no longer writeable. This can happen via pmap_remove(), or when a CoW fault removes the last mapping of the old page. Reported and tested by: bdragon Reviewed by: alc, bdragon, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22044 Modified: head/sys/powerpc/aim/mmu_oea.c Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Wed Oct 16 15:21:05 2019 (r353649) +++ head/sys/powerpc/aim/mmu_oea.c Wed Oct 16 15:50:12 2019 (r353650) @@ -2108,23 +2108,26 @@ moea_pvo_remove(struct pvo_entry *pvo, int pteidx) pvo->pvo_pmap->pm_stats.wired_count--; /* + * Remove this PVO from the PV and pmap lists. + */ + LIST_REMOVE(pvo, pvo_vlink); + RB_REMOVE(pvo_tree, &pvo->pvo_pmap->pmap_pvo, pvo); + + /* * Save the REF/CHG bits into their cache if the page is managed. + * Clear PGA_WRITEABLE if all mappings of the page have been removed. */ if ((pvo->pvo_vaddr & PVO_MANAGED) == PVO_MANAGED) { - struct vm_page *pg; + struct vm_page *pg; pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.pte.pte_lo & PTE_RPGN); if (pg != NULL) { moea_attr_save(pg, pvo->pvo_pte.pte.pte_lo & (PTE_REF | PTE_CHG)); + if (LIST_EMPTY(&pg->md.mdpg_pvoh)) + vm_page_aflag_clear(pg, PGA_WRITEABLE); } } - - /* - * Remove this PVO from the PV and pmap lists. - */ - LIST_REMOVE(pvo, pvo_vlink); - RB_REMOVE(pvo_tree, &pvo->pvo_pmap->pmap_pvo, pvo); /* * Remove this from the overflow list and return it to the pool From owner-svn-src-all@freebsd.org Wed Oct 16 16:03:20 2019 Return-Path: Delivered-To: svn-src-all@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 107C0149588; Wed, 16 Oct 2019 16:03:20 +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 46tcXR6chLz3xlF; Wed, 16 Oct 2019 16:03:19 +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 C68F29795; Wed, 16 Oct 2019 16:03:19 +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 x9GG3JGL027224; Wed, 16 Oct 2019 16:03:19 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GG3Jsx027223; Wed, 16 Oct 2019 16:03:19 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201910161603.x9GG3Jsx027223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 16 Oct 2019 16:03:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353651 - 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: 353651 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 16:03:20 -0000 Author: ian Date: Wed Oct 16 16:03:19 2019 New Revision: 353651 URL: https://svnweb.freebsd.org/changeset/base/353651 Log: Relax the sdhci(4) check that filters out the 1.8v voltage option unless the slot is flagged as 'embedded'. The features related to embedded and shared slots were added in v3.0 of the sdhci spec. Hardware prior to v3 sometimes supported 1.8v on non- removable devices in embedded systems, but had no way to indicate that via the standard sdhci registers (instead they use out of band metadata such as FDT data). This change adds the controller specification version to the check for whether to filter out the 1.8v selection. On older hardware, the 1.8v option is allowed to remain. On 3.0 or later it still requires the embedded-slot flag to remain. This is part of the fix for PR 241301 (eMMC not detected on Beaglebone). Changes to the sdhci_ti driver are also needed for a full fix. PR: 241301 Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Wed Oct 16 15:50:12 2019 (r353650) +++ head/sys/dev/sdhci/sdhci.c Wed Oct 16 16:03:19 2019 (r353651) @@ -919,8 +919,13 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, slot->host.host_ocr |= MMC_OCR_320_330 | MMC_OCR_330_340; if (caps & SDHCI_CAN_VDD_300) slot->host.host_ocr |= MMC_OCR_290_300 | MMC_OCR_300_310; - /* 1.8V VDD is not supposed to be used for removable cards. */ - if ((caps & SDHCI_CAN_VDD_180) && (slot->opt & SDHCI_SLOT_EMBEDDED)) + /* + * 1.8V VDD is not supposed to be used for removable cards. Hardware + * prior to v3.0 had no way to indicate embedded slots, but did + * sometimes support 1.8v for non-removable devices. + */ + if ((caps & SDHCI_CAN_VDD_180) && (slot->version < SDHCI_SPEC_300 || + (slot->opt & SDHCI_SLOT_EMBEDDED))) slot->host.host_ocr |= MMC_OCR_LOW_VOLTAGE; if (slot->host.host_ocr == 0) { slot_printf(slot, "Hardware doesn't report any " From owner-svn-src-all@freebsd.org Wed Oct 16 16:19:22 2019 Return-Path: Delivered-To: svn-src-all@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 1CE1B1499A5; Wed, 16 Oct 2019 16:19:22 +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 46tctx70kJz3yMT; Wed, 16 Oct 2019 16:19:21 +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 CF5379965; Wed, 16 Oct 2019 16:19:21 +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 x9GGJLYO033519; Wed, 16 Oct 2019 16:19:21 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GGJLJA033518; Wed, 16 Oct 2019 16:19:21 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201910161619.x9GGJLJA033518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 16 Oct 2019 16:19:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353652 - head/sys/arm/ti X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/ti X-SVN-Commit-Revision: 353652 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 16:19:22 -0000 Author: ian Date: Wed Oct 16 16:19:21 2019 New Revision: 353652 URL: https://svnweb.freebsd.org/changeset/base/353652 Log: Revert r351218 (by manu). While the changes in r351218 appear to be (and should be) correct, they lead to the eMMC on a Beaglebone failing to work in some situations. The TI sdhci hardware is kind of strange. The first device inherently supports 1.8v and 3.3v and the abililty to switch between them, and the other two devices must be set to 1.8v in the sdhci power control register to operate correctly, but doing so actually makes them run at 3.3v (unless an external level-shifter is present in the signal path). Even the 1.8v on the first device may actually be 3.3v (or any other value), depending on what voltage is fed to the VDDS1-VDDS7 power supply pins on the am335x chip. Another strange quirk is that the convention for am335x sdhci drivers in linux and uboot and the am335x boot ROM seems to be to set the voltage in the sdhci capabilities register to 3.0v even though the actual voltage is 3.3v. Why this is done is a complete mystery to me, but it seems to be required for correct operation. If we had complete modern support for the am335x chip we could get the actual voltages from the FDT data and the regulator framework. But our am335x code currently doesn't have any regulator framework support. Reverting to the prior code will get the popular Beaglebone boards working again. This is part of the fix for PR 241301, but also requires r353651 for a complete fix. PR: 241301 Discussed with: manu Modified: head/sys/arm/ti/ti_sdhci.c Modified: head/sys/arm/ti/ti_sdhci.c ============================================================================== --- head/sys/arm/ti/ti_sdhci.c Wed Oct 16 16:03:19 2019 (r353651) +++ head/sys/arm/ti/ti_sdhci.c Wed Oct 16 16:19:21 2019 (r353652) @@ -482,14 +482,15 @@ ti_sdhci_hw_init(device_t dev) * The attach() routine has examined fdt data and set flags in * slot.host.caps to reflect what voltages we can handle. Set those * values in the CAPA register. The manual says that these values can - * only be set once, and that they survive a reset so unless u-boot didn't - * set this register this code is a no-op. + * only be set once, "before initialization" whatever that means, and + * that they survive a reset. So maybe doing this will be a no-op if + * u-boot has already initialized the hardware. */ regval = ti_mmchs_read_4(sc, MMCHS_SD_CAPA); if (sc->slot.host.caps & MMC_OCR_LOW_VOLTAGE) regval |= MMCHS_SD_CAPA_VS18; - if (sc->slot.host.caps & (MMC_OCR_320_330 | MMC_OCR_330_340)) - regval |= MMCHS_SD_CAPA_VS33; + if (sc->slot.host.caps & (MMC_OCR_290_300 | MMC_OCR_300_310)) + regval |= MMCHS_SD_CAPA_VS30; ti_mmchs_write_4(sc, MMCHS_SD_CAPA, regval); /* Set initial host configuration (1-bit, std speed, pwr off). */ @@ -523,20 +524,17 @@ ti_sdhci_attach(device_t dev) } /* - * The hardware can inherently do dual-voltage (1p8v, 3p3v) on the first + * The hardware can inherently do dual-voltage (1p8v, 3p0v) on the first * device, and only 1p8v on other devices unless an external transceiver * is used. The only way we could know about a transceiver is fdt data. * Note that we have to do this before calling ti_sdhci_hw_init() so * that it can set the right values in the CAPA register, which can only * be done once and never reset. */ - if (OF_hasprop(node, "ti,dual-volt")) { - sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE | MMC_OCR_320_330 | MMC_OCR_330_340; - } else if (OF_hasprop(node, "no-1-8-v")) { - sc->slot.host.caps |= MMC_OCR_320_330 | MMC_OCR_330_340; - } else - sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE; - + sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE; + if (sc->mmchs_clk_id == MMC1_CLK || OF_hasprop(node, "ti,dual-volt")) { + sc->slot.host.caps |= MMC_OCR_290_300 | MMC_OCR_300_310; + } /* * Set the offset from the device's memory start to the MMCHS registers. From owner-svn-src-all@freebsd.org Wed Oct 16 16:26:35 2019 Return-Path: Delivered-To: svn-src-all@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 D5AE1149D39; Wed, 16 Oct 2019 16:26:35 +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 46td3H5JHhz3yv9; Wed, 16 Oct 2019 16:26:35 +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 990C99B23; Wed, 16 Oct 2019 16:26:35 +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 x9GGQZPM039130; Wed, 16 Oct 2019 16:26:35 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GGQZCO039129; Wed, 16 Oct 2019 16:26:35 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201910161626.x9GGQZCO039129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 16 Oct 2019 16:26:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353653 - head/sys/arm/ti X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/ti X-SVN-Commit-Revision: 353653 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 16:26:35 -0000 Author: ian Date: Wed Oct 16 16:26:35 2019 New Revision: 353653 URL: https://svnweb.freebsd.org/changeset/base/353653 Log: Update some comments; no functional changes. Some historical old comments in this driver indicate that the SD_CAPA register is write-once and after being set one time the values in it cannot be changed. That turns out not to be the case -- the values written to it survive a reset, but they can be rewritten/changed at any time. Modified: head/sys/arm/ti/ti_sdhci.c Modified: head/sys/arm/ti/ti_sdhci.c ============================================================================== --- head/sys/arm/ti/ti_sdhci.c Wed Oct 16 16:19:21 2019 (r353652) +++ head/sys/arm/ti/ti_sdhci.c Wed Oct 16 16:26:35 2019 (r353653) @@ -481,10 +481,10 @@ ti_sdhci_hw_init(device_t dev) /* * The attach() routine has examined fdt data and set flags in * slot.host.caps to reflect what voltages we can handle. Set those - * values in the CAPA register. The manual says that these values can - * only be set once, "before initialization" whatever that means, and - * that they survive a reset. So maybe doing this will be a no-op if - * u-boot has already initialized the hardware. + * values in the CAPA register. Empirical testing shows that the + * values in this register can be overwritten at any time, but the + * manual says that these values should only be set once, "before + * initialization" whatever that means, and that they survive a reset. */ regval = ti_mmchs_read_4(sc, MMCHS_SD_CAPA); if (sc->slot.host.caps & MMC_OCR_LOW_VOLTAGE) @@ -528,8 +528,7 @@ ti_sdhci_attach(device_t dev) * device, and only 1p8v on other devices unless an external transceiver * is used. The only way we could know about a transceiver is fdt data. * Note that we have to do this before calling ti_sdhci_hw_init() so - * that it can set the right values in the CAPA register, which can only - * be done once and never reset. + * that it can set the right values in the CAPA register. */ sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE; if (sc->mmchs_clk_id == MMC1_CLK || OF_hasprop(node, "ti,dual-volt")) { From owner-svn-src-all@freebsd.org Wed Oct 16 16:32:58 2019 Return-Path: Delivered-To: svn-src-all@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 D4B3D14A0C8; Wed, 16 Oct 2019 16:32:58 +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 46tdBf5JDmz40Rt; Wed, 16 Oct 2019 16:32:58 +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 992699CEF; Wed, 16 Oct 2019 16:32:58 +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 x9GGWwrC044959; Wed, 16 Oct 2019 16:32:58 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GGWwRx044958; Wed, 16 Oct 2019 16:32:58 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910161632.x9GGWwRx044958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 16 Oct 2019 16:32:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353654 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353654 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 16:32:58 -0000 Author: glebius Date: Wed Oct 16 16:32:58 2019 New Revision: 353654 URL: https://svnweb.freebsd.org/changeset/base/353654 Log: do_link_state_change() is executed in taskqueue context and in general is allowed to sleep. Don't enter the epoch for the whole duration. If some event handlers need the epoch, they should handle that theirselves. Discussed with: hselasky Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Wed Oct 16 16:26:35 2019 (r353653) +++ head/sys/net/if.c Wed Oct 16 16:32:58 2019 (r353654) @@ -2313,11 +2313,9 @@ if_link_state_change(struct ifnet *ifp, int link_state static void do_link_state_change(void *arg, int pending) { - struct epoch_tracker et; struct ifnet *ifp; int link_state; - NET_EPOCH_ENTER(et); ifp = arg; link_state = ifp->if_link_state; @@ -2345,7 +2343,6 @@ do_link_state_change(void *arg, int pending) if (log_link_state_change) if_printf(ifp, "link state changed to %s\n", (link_state == LINK_STATE_UP) ? "UP" : "DOWN" ); - NET_EPOCH_EXIT(et); EVENTHANDLER_INVOKE(ifnet_link_event, ifp, link_state); CURVNET_RESTORE(); } From owner-svn-src-all@freebsd.org Wed Oct 16 16:55:42 2019 Return-Path: Delivered-To: svn-src-all@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 49FD714B028; Wed, 16 Oct 2019 16:55:42 +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 46tdhs5Qncz41gB; Wed, 16 Oct 2019 16:55:41 +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 x9GGtXbe040722 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 16 Oct 2019 09:55:34 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x9GGtXOj040721; Wed, 16 Oct 2019 09:55:33 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Wed, 16 Oct 2019 09:55:33 -0700 From: Gleb Smirnoff To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353633 - head/sys/ofed/include/rdma Message-ID: <20191016165533.GT4086@FreeBSD.org> References: <201910160856.x9G8u7Sg065578@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201910160856.x9G8u7Sg065578@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46tdhs5Qncz41gB X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.992,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 16:55:42 -0000 On Wed, Oct 16, 2019 at 08:56:07AM +0000, Hans Petter Selasky wrote: H> Author: hselasky H> Date: Wed Oct 16 08:56:07 2019 H> New Revision: 353633 H> URL: https://svnweb.freebsd.org/changeset/base/353633 H> H> Log: H> VLAN_TRUNKDEV() requires epochification in ibcore after r353292. Note that neither VLAN_DEVAT() not VLAN_TRUNKDEV() reference the returned structure, so after epoch is exited the link is no longer safe. Does ibcore require these two functions in non-fast code paths? -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Wed Oct 16 16:57:24 2019 Return-Path: Delivered-To: svn-src-all@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 93EC614B159; Wed, 16 Oct 2019 16:57:24 +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 46tdkr2Hc1z41rt; Wed, 16 Oct 2019 16:57:23 +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 x9GGvM45040750 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 16 Oct 2019 09:57:22 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x9GGvMQr040749; Wed, 16 Oct 2019 09:57:22 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Wed, 16 Oct 2019 09:57:22 -0700 From: Gleb Smirnoff To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353635 - in head/sys: netinet netinet6 Message-ID: <20191016165722.GU4086@FreeBSD.org> References: <201910160911.x9G9BonH076337@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201910160911.x9G9BonH076337@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46tdkr2Hc1z41rt X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.991,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 16:57:24 -0000 Hans, as far as I remember I was against this changeset and I had several other developers agreed that this should be fixed in different way. Why did you proceed with checking it in? :( On Wed, Oct 16, 2019 at 09:11:50AM +0000, Hans Petter Selasky wrote: H> Author: hselasky H> Date: Wed Oct 16 09:11:49 2019 H> New Revision: 353635 H> URL: https://svnweb.freebsd.org/changeset/base/353635 H> H> Log: H> Fix panic in network stack due to use after free when receiving H> partial fragmented packets before a network interface is detached. H> H> When sending IPv4 or IPv6 fragmented packets and a fragment is lost H> before the network device is freed, the mbuf making up the fragment H> will remain in the temporary hashed fragment list and cause a panic H> when it times out due to accessing a freed network interface H> structure. H> H> H> 1) Make sure the m_pkthdr.rcvif always points to a valid network H> interface. Else the rcvif field should be set to NULL. H> H> 2) Use the rcvif of the last received fragment as m_pkthdr.rcvif for H> the fully defragged packet, instead of the first received fragment. H> H> Panic backtrace for IPv6: H> H> panic() H> icmp6_reflect() # tries to access rcvif->if_afdata[AF_INET6]->xxx H> icmp6_error() H> frag6_freef() H> frag6_slowtimo() H> pfslowtimo() H> softclock_call_cc() H> softclock() H> ithread_loop() H> H> Reviewed by: bz H> Differential Revision: https://reviews.freebsd.org/D19622 H> MFC after: 1 week H> Sponsored by: Mellanox Technologies H> H> Modified: H> head/sys/netinet/ip_reass.c H> head/sys/netinet6/frag6.c H> H> Modified: head/sys/netinet/ip_reass.c H> ============================================================================== H> --- head/sys/netinet/ip_reass.c Wed Oct 16 09:04:53 2019 (r353634) H> +++ head/sys/netinet/ip_reass.c Wed Oct 16 09:11:49 2019 (r353635) H> @@ -47,7 +47,10 @@ __FBSDID("$FreeBSD$"); H> #include H> #include H> #include H> +#include H> H> +#include H> +#include H> #include H> #include H> #include H> @@ -181,6 +184,7 @@ ip_reass(struct mbuf *m) H> struct ip *ip; H> struct mbuf *p, *q, *nq, *t; H> struct ipq *fp; H> + struct ifnet *srcifp; H> struct ipqhead *head; H> int i, hlen, next, tmpmax; H> u_int8_t ecn, ecn0; H> @@ -241,6 +245,11 @@ ip_reass(struct mbuf *m) H> } H> H> /* H> + * Store receive network interface pointer for later. H> + */ H> + srcifp = m->m_pkthdr.rcvif; H> + H> + /* H> * Attempt reassembly; if it succeeds, proceed. H> * ip_reass() will return a different mbuf. H> */ H> @@ -490,8 +499,11 @@ ip_reass(struct mbuf *m) H> m->m_len += (ip->ip_hl << 2); H> m->m_data -= (ip->ip_hl << 2); H> /* some debugging cruft by sklower, below, will go away soon */ H> - if (m->m_flags & M_PKTHDR) /* XXX this should be done elsewhere */ H> + if (m->m_flags & M_PKTHDR) { /* XXX this should be done elsewhere */ H> m_fixhdr(m); H> + /* set valid receive interface pointer */ H> + m->m_pkthdr.rcvif = srcifp; H> + } H> IPSTAT_INC(ips_reassembled); H> IPQ_UNLOCK(hash); H> H> @@ -607,6 +619,43 @@ ipreass_drain(void) H> } H> } H> H> +/* H> + * Drain off all datagram fragments belonging to H> + * the given network interface. H> + */ H> +static void H> +ipreass_cleanup(void *arg __unused, struct ifnet *ifp) H> +{ H> + struct ipq *fp, *temp; H> + struct mbuf *m; H> + int i; H> + H> + KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); H> + H> + /* H> + * Skip processing if IPv4 reassembly is not initialised or H> + * torn down by ipreass_destroy(). H> + */ H> + if (V_ipq_zone == NULL) H> + return; H> + H> + CURVNET_SET_QUIET(ifp->if_vnet); H> + for (i = 0; i < IPREASS_NHASH; i++) { H> + IPQ_LOCK(i); H> + /* Scan fragment list. */ H> + TAILQ_FOREACH_SAFE(fp, &V_ipq[i].head, ipq_list, temp) { H> + for (m = fp->ipq_frags; m != NULL; m = m->m_nextpkt) { H> + /* clear no longer valid rcvif pointer */ H> + if (m->m_pkthdr.rcvif == ifp) H> + m->m_pkthdr.rcvif = NULL; H> + } H> + } H> + IPQ_UNLOCK(i); H> + } H> + CURVNET_RESTORE(); H> +} H> +EVENTHANDLER_DEFINE(ifnet_departure_event, ipreass_cleanup, NULL, 0); H> + H> #ifdef VIMAGE H> /* H> * Destroy IP reassembly structures. H> @@ -617,6 +666,7 @@ ipreass_destroy(void) H> H> ipreass_drain(); H> uma_zdestroy(V_ipq_zone); H> + V_ipq_zone = NULL; H> for (int i = 0; i < IPREASS_NHASH; i++) H> mtx_destroy(&V_ipq[i].lock); H> } H> H> Modified: head/sys/netinet6/frag6.c H> ============================================================================== H> --- head/sys/netinet6/frag6.c Wed Oct 16 09:04:53 2019 (r353634) H> +++ head/sys/netinet6/frag6.c Wed Oct 16 09:11:49 2019 (r353635) H> @@ -246,7 +246,7 @@ frag6_freef(struct ip6q *q6, uint32_t bucket) H> * Return ICMP time exceeded error for the 1st fragment. H> * Just free other fragments. H> */ H> - if (af6->ip6af_off == 0) { H> + if (af6->ip6af_off == 0 && m->m_pkthdr.rcvif != NULL) { H> H> /* Adjust pointer. */ H> ip6 = mtod(m, struct ip6_hdr *); H> @@ -272,6 +272,43 @@ frag6_freef(struct ip6q *q6, uint32_t bucket) H> } H> H> /* H> + * Drain off all datagram fragments belonging to H> + * the given network interface. H> + */ H> +static void H> +frag6_cleanup(void *arg __unused, struct ifnet *ifp) H> +{ H> + struct ip6q *q6, *q6n, *head; H> + struct ip6asfrag *af6; H> + struct mbuf *m; H> + int i; H> + H> + KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); H> + H> + CURVNET_SET_QUIET(ifp->if_vnet); H> + for (i = 0; i < IP6REASS_NHASH; i++) { H> + IP6QB_LOCK(i); H> + head = IP6QB_HEAD(i); H> + /* Scan fragment list. */ H> + for (q6 = head->ip6q_next; q6 != head; q6 = q6n) { H> + q6n = q6->ip6q_next; H> + H> + for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; H> + af6 = af6->ip6af_down) { H> + m = IP6_REASS_MBUF(af6); H> + H> + /* clear no longer valid rcvif pointer */ H> + if (m->m_pkthdr.rcvif == ifp) H> + m->m_pkthdr.rcvif = NULL; H> + } H> + } H> + IP6QB_UNLOCK(i); H> + } H> + CURVNET_RESTORE(); H> +} H> +EVENTHANDLER_DEFINE(ifnet_departure_event, frag6_cleanup, NULL, 0); H> + H> +/* H> * Like in RFC2460, in RFC8200, fragment and reassembly rules do not agree with H> * each other, in terms of next header field handling in fragment header. H> * While the sender will use the same value for all of the fragmented packets, H> @@ -307,6 +344,7 @@ int H> frag6_input(struct mbuf **mp, int *offp, int proto) H> { H> struct ifnet *dstifp; H> + struct ifnet *srcifp; H> struct in6_ifaddr *ia6; H> struct ip6_hdr *ip6; H> struct ip6_frag *ip6f; H> @@ -338,6 +376,11 @@ frag6_input(struct mbuf **mp, int *offp, int proto) H> return (IPPROTO_DONE); H> #endif H> H> + /* H> + * Store receive network interface pointer for later. H> + */ H> + srcifp = m->m_pkthdr.rcvif; H> + H> dstifp = NULL; H> /* Find the destination interface of the packet. */ H> ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); H> @@ -534,6 +577,9 @@ frag6_input(struct mbuf **mp, int *offp, int proto) H> frag6_deq(af6, bucket); H> free(af6, M_FRAG6); H> H> + /* Set a valid receive interface pointer. */ H> + merr->m_pkthdr.rcvif = srcifp; H> + H> /* Adjust pointer. */ H> ip6err = mtod(merr, struct ip6_hdr *); H> H> @@ -720,6 +766,8 @@ insert: H> for (t = m; t; t = t->m_next) H> plen += t->m_len; H> m->m_pkthdr.len = plen; H> + /* Set a valid receive interface pointer. */ H> + m->m_pkthdr.rcvif = srcifp; H> } H> H> #ifdef RSS H> _______________________________________________ H> svn-src-all@freebsd.org mailing list H> https://lists.freebsd.org/mailman/listinfo/svn-src-all H> To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Wed Oct 16 17:11:18 2019 Return-Path: Delivered-To: svn-src-all@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 B3FD814B686; Wed, 16 Oct 2019 17:11:18 +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 46tf2t4NYpz42dT; Wed, 16 Oct 2019 17:11:18 +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 7A583A388; Wed, 16 Oct 2019 17:11:18 +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 x9GHBI9c067393; Wed, 16 Oct 2019 17:11:18 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GHBI17067392; Wed, 16 Oct 2019 17:11:18 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910161711.x9GHBI17067392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 16 Oct 2019 17:11:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353655 - head/usr.bin/clang/lld X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/usr.bin/clang/lld X-SVN-Commit-Revision: 353655 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 17:11:18 -0000 Author: dim Date: Wed Oct 16 17:11:18 2019 New Revision: 353655 URL: https://svnweb.freebsd.org/changeset/base/353655 Log: Ensure lld respects the WITH/WITHOUT_SHARED_TOOLCHAIN option Traditionally, toolchain components such as cc, as, and ld have been built as static executables. The WITH_SHARED_TOOLCHAIN option from src.conf(5) is meant to link these as regular executables, e.g. using shared libraries. The build of ld.lld did not yet check this option. Fix the Makefile so it will do so now. Reported by: Mike Cui PR: 241257 MFC after: 3 days Modified: head/usr.bin/clang/lld/Makefile Modified: head/usr.bin/clang/lld/Makefile ============================================================================== --- head/usr.bin/clang/lld/Makefile Wed Oct 16 16:32:58 2019 (r353654) +++ head/usr.bin/clang/lld/Makefile Wed Oct 16 17:11:18 2019 (r353655) @@ -15,6 +15,10 @@ SYMLINKS= ${PROG_CXX} ${BINDIR}/ld MLINKS= ld.lld.1 ld.1 .endif +.if ${MK_SHARED_TOOLCHAIN} == "no" +NO_SHARED?= yes +.endif + CFLAGS+= -I${LLD_SRCS}/ELF CFLAGS+= -I${LLD_SRCS}/include CFLAGS+= -I${.OBJDIR} From owner-svn-src-all@freebsd.org Wed Oct 16 17:13:47 2019 Return-Path: Delivered-To: svn-src-all@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 831B414B8D4; Wed, 16 Oct 2019 17:13:47 +0000 (UTC) (envelope-from erj@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 46tf5l2t5Hz42tX; Wed, 16 Oct 2019 17:13:47 +0000 (UTC) (envelope-from erj@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 4636AA414; Wed, 16 Oct 2019 17:13:47 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9GHDl9Z068178; Wed, 16 Oct 2019 17:13:47 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GHDlMG068177; Wed, 16 Oct 2019 17:13:47 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201910161713.x9GHDlMG068177@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Wed, 16 Oct 2019 17:13:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353656 - head/sys/dev/e1000 X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/dev/e1000 X-SVN-Commit-Revision: 353656 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 17:13:47 -0000 Author: erj Date: Wed Oct 16 17:13:46 2019 New Revision: 353656 URL: https://svnweb.freebsd.org/changeset/base/353656 Log: e1000: correctly set isc_pause_frames only when XOFF increases From Jake: The e1000 driver sets the iflib shared context isc_pause_frames value to the number of received xoff frames. This is done so that the iflib watchdog timer won't trigger a Tx Hang due to pause frames. Unfortunately, the function simply sets it to the value of the xoffrxc counter. Once the device has received a single XOFF packet, the driver always reports that we received pause frames. This will prevent the Tx hang detection entirely from that point on. Fix this by assigning isc_pause_frames to a non-zero value if we received any XOFF packets in the last timer interval. We could attempt to calculate the total number of received packets by doing a subtraction, but the iflib stack only seems to check if isc_pause_frames is non-zero. Signed-off-by: Jacob Keller Submitted by: Jacob Keller Reviewed by: gallatin@ Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D21868 Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Wed Oct 16 17:11:18 2019 (r353655) +++ head/sys/dev/e1000/if_em.c Wed Oct 16 17:13:46 2019 (r353656) @@ -3903,6 +3903,7 @@ em_disable_aspm(struct adapter *adapter) static void em_update_stats_counters(struct adapter *adapter) { + u64 prev_xoffrxc = adapter->stats.xoffrxc; if(adapter->hw.phy.media_type == e1000_media_type_copper || (E1000_READ_REG(&adapter->hw, E1000_STATUS) & E1000_STATUS_LU)) { @@ -3926,7 +3927,8 @@ em_update_stats_counters(struct adapter *adapter) ** For watchdog management we need to know if we have been ** paused during the last interval, so capture that here. */ - adapter->shared->isc_pause_frames = adapter->stats.xoffrxc; + if (adapter->stats.xoffrxc != prev_xoffrxc) + adapter->shared->isc_pause_frames = 1; adapter->stats.xofftxc += E1000_READ_REG(&adapter->hw, E1000_XOFFTXC); adapter->stats.fcruc += E1000_READ_REG(&adapter->hw, E1000_FCRUC); adapter->stats.prc64 += E1000_READ_REG(&adapter->hw, E1000_PRC64); From owner-svn-src-all@freebsd.org Wed Oct 16 17:16:33 2019 Return-Path: Delivered-To: svn-src-all@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 85D0814BA2E; Wed, 16 Oct 2019 17:16:33 +0000 (UTC) (envelope-from erj@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 46tf8x2z41z437N; Wed, 16 Oct 2019 17:16:33 +0000 (UTC) (envelope-from erj@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 44A71A42B; Wed, 16 Oct 2019 17:16:33 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9GHGXtU068351; Wed, 16 Oct 2019 17:16:33 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GHGXH5068350; Wed, 16 Oct 2019 17:16:33 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201910161716.x9GHGXH5068350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Wed, 16 Oct 2019 17:16:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353657 - head/sys/dev/ixgbe X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/dev/ixgbe X-SVN-Commit-Revision: 353657 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 17:16:33 -0000 Author: erj Date: Wed Oct 16 17:16:32 2019 New Revision: 353657 URL: https://svnweb.freebsd.org/changeset/base/353657 Log: ix: report isc_pause_frames during stat update From Jake: Notify the iflib stack of whether we received any pause frames during the timer window. This allows the stack to avoid reporting a Tx hang due to the device being paused. Signed-off-by: Jacob Keller Submitted by: Jacob Keller Reviewed by: gallatin@ Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D21869 Modified: head/sys/dev/ixgbe/if_ix.c Modified: head/sys/dev/ixgbe/if_ix.c ============================================================================== --- head/sys/dev/ixgbe/if_ix.c Wed Oct 16 17:13:46 2019 (r353656) +++ head/sys/dev/ixgbe/if_ix.c Wed Oct 16 17:16:32 2019 (r353657) @@ -1393,6 +1393,7 @@ ixgbe_update_stats_counters(struct adapter *adapter) struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw_stats *stats = &adapter->stats.pf; u32 missed_rx = 0, bprc, lxon, lxoff, total; + u32 lxoffrxc; u64 total_missed_rx = 0; stats->crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS); @@ -1422,15 +1423,24 @@ ixgbe_update_stats_counters(struct adapter *adapter) stats->tor += IXGBE_READ_REG(hw, IXGBE_TORL) + ((u64)IXGBE_READ_REG(hw, IXGBE_TORH) << 32); stats->lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXCNT); - stats->lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT); + lxoffrxc = IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT); + stats->lxoffrxc += lxoffrxc; } else { stats->lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXC); - stats->lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXC); + lxoffrxc = IXGBE_READ_REG(hw, IXGBE_LXOFFRXC); + stats->lxoffrxc += lxoffrxc; /* 82598 only has a counter in the high register */ stats->gorc += IXGBE_READ_REG(hw, IXGBE_GORCH); stats->gotc += IXGBE_READ_REG(hw, IXGBE_GOTCH); stats->tor += IXGBE_READ_REG(hw, IXGBE_TORH); } + + /* + * For watchdog management we need to know if we have been paused + * during the last interval, so capture that here. + */ + if (lxoffrxc) + adapter->shared->isc_pause_frames = 1; /* * Workaround: mprc hardware is incorrectly counting From owner-svn-src-all@freebsd.org Wed Oct 16 17:18:12 2019 Return-Path: Delivered-To: svn-src-all@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 EB2DA14BAC3; Wed, 16 Oct 2019 17:18:12 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (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 46tfBr5Ykqz43HW; Wed, 16 Oct 2019 17:18:12 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 746D63C0199; Wed, 16 Oct 2019 17:18:11 +0000 (UTC) Date: Wed, 16 Oct 2019 17:18:11 +0000 From: Brooks Davis To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353639 - head/share/mk Message-ID: <20191016171811.GA52641@spindle.one-eyed-alien.net> References: <201910161320.x9GDKaBK021462@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="T4sUOijqQbZv57TR" Content-Disposition: inline In-Reply-To: <201910161320.x9GDKaBK021462@repo.freebsd.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 46tfBr5Ykqz43HW X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.995,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 17:18:13 -0000 --T4sUOijqQbZv57TR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 16, 2019 at 01:20:36PM +0000, Warner Losh wrote: > Author: imp > Date: Wed Oct 16 13:20:36 2019 > New Revision: 353639 > URL: https://svnweb.freebsd.org/changeset/base/353639 >=20 > Log: > bsd.compat.mk isn't setup to be included outside of Makefile.inc so com= ment it > out here until that's sorted out. Otherwise the build is broken. when > TARGET_ARCH isn't defined. Thanks for committing this workaround. I forgot to test bare builds (not buildworld/buildenv/...) because I almost always cross build (either for a different arch or targeting CURRENT from STABLE). I'm currently testing a switch from TARGET_ARCH to MACHINE_ARCH and TARGET_CPUTYPE to CPUTYPE. -- Brooks --T4sUOijqQbZv57TR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJdp1DSAAoJEKzQXbSebgfAMTAH/AluEA2nMScjE2wwRXil7cjG 5w5FGqn3Op4AP2EqhwkM4Rs5JxIVP/NW1CgN2rErdK4i55XuR6MA67KwW9kNPfgo w6nlrJ1t1d+m/51SmACfRQboe+1/UjZeVV55eWvmI4cvQvICaIF1Lran4cXzcWip 2uvP4eRHsUQi8MRpOJy+QnPp8RfWijwmGvIiocnIC5J1dDm5YliZ1+TgkH/V8rrN naoDP3zOx1gPk18gOcG02BtJbGGWbGegi6ypvk2+gf6L0ICWVARFzcr12DK6nPWZ Lxv67zUo/g3yULbM3hGvOtb4g34si9s5i6wPIAzt1atFwvveAGGe/MC8gZ77prg= =vuEZ -----END PGP SIGNATURE----- --T4sUOijqQbZv57TR-- From owner-svn-src-all@freebsd.org Wed Oct 16 17:19:18 2019 Return-Path: Delivered-To: svn-src-all@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 4349614BB5A; Wed, 16 Oct 2019 17:19:18 +0000 (UTC) (envelope-from erj@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 46tfD60N2Kz43Qv; Wed, 16 Oct 2019 17:19:18 +0000 (UTC) (envelope-from erj@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 E0E08A443; Wed, 16 Oct 2019 17:19:17 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9GHJHmS068506; Wed, 16 Oct 2019 17:19:17 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GHJHux068505; Wed, 16 Oct 2019 17:19:17 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201910161719.x9GHJHux068505@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Wed, 16 Oct 2019 17:19:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353658 - head/sys/dev/ixl X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/dev/ixl X-SVN-Commit-Revision: 353658 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 17:19:18 -0000 Author: erj Date: Wed Oct 16 17:19:17 2019 New Revision: 353658 URL: https://svnweb.freebsd.org/changeset/base/353658 Log: ixl: report whether device received pause frames From Jake: When updating the device statistics, report whether or not we have received any pause frames to the iflib stack. This allows the iflib stack to avoid generating a Tx hang message while the device is paused. Signed-off-by: Jacob Keller Submitted by: Jacob Keller Reviewed by: gallatin@ Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D21870 Modified: head/sys/dev/ixl/ixl_pf_main.c Modified: head/sys/dev/ixl/ixl_pf_main.c ============================================================================== --- head/sys/dev/ixl/ixl_pf_main.c Wed Oct 16 17:16:32 2019 (r353657) +++ head/sys/dev/ixl/ixl_pf_main.c Wed Oct 16 17:19:17 2019 (r353658) @@ -2592,6 +2592,7 @@ ixl_update_stats_counters(struct ixl_pf *pf) struct i40e_hw *hw = &pf->hw; struct ixl_vsi *vsi = &pf->vsi; struct ixl_vf *vf; + u64 prev_link_xoff_rx = pf->stats.link_xoff_rx; struct i40e_hw_port_stats *nsd = &pf->stats; struct i40e_hw_port_stats *osd = &pf->stats_offsets; @@ -2676,6 +2677,13 @@ ixl_update_stats_counters(struct ixl_pf *pf) ixl_stat_update32(hw, I40E_GLPRT_LXOFFTXC(hw->port), pf->stat_offsets_loaded, &osd->link_xoff_tx, &nsd->link_xoff_tx); + + /* + * For watchdog management we need to know if we have been paused + * during the last interval, so capture that here. + */ + if (pf->stats.link_xoff_rx != prev_link_xoff_rx) + adapter->shared->isc_pause_frames = 1; /* Packet size stats rx */ ixl_stat_update48(hw, I40E_GLPRT_PRC64H(hw->port), From owner-svn-src-all@freebsd.org Wed Oct 16 17:21:19 2019 Return-Path: Delivered-To: svn-src-all@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 9B84814BD74; Wed, 16 Oct 2019 17:21:19 +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 46tfGR3bdZz43dG; Wed, 16 Oct 2019 17:21:19 +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 5EE56A4B0; Wed, 16 Oct 2019 17:21:19 +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 x9GHLJpT070063; Wed, 16 Oct 2019 17:21:19 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GHLJOb070062; Wed, 16 Oct 2019 17:21:19 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910161721.x9GHLJOb070062@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 16 Oct 2019 17:21:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353659 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 353659 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 17:21:19 -0000 Author: brooks Date: Wed Oct 16 17:21:18 2019 New Revision: 353659 URL: https://svnweb.freebsd.org/changeset/base/353659 Log: Install bsd.compat.mk. Reported by: glebius Modified: head/share/mk/Makefile Modified: head/share/mk/Makefile ============================================================================== --- head/share/mk/Makefile Wed Oct 16 17:19:17 2019 (r353658) +++ head/share/mk/Makefile Wed Oct 16 17:21:18 2019 (r353659) @@ -19,6 +19,7 @@ FILES= \ bsd.arch.inc.mk \ bsd.clang-analyze.mk \ bsd.compiler.mk \ + bsd.compat.mk \ bsd.confs.mk \ bsd.cpu.mk \ bsd.crunchgen.mk \ From owner-svn-src-all@freebsd.org Wed Oct 16 17:26:25 2019 Return-Path: Delivered-To: svn-src-all@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 72A8614BE53; Wed, 16 Oct 2019 17:26:25 +0000 (UTC) (envelope-from erj@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 46tfNK28YTz43y1; Wed, 16 Oct 2019 17:26:25 +0000 (UTC) (envelope-from erj@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 298BEA619; Wed, 16 Oct 2019 17:26:25 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9GHQP7Q074253; Wed, 16 Oct 2019 17:26:25 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GHQPHQ074252; Wed, 16 Oct 2019 17:26:25 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201910161726.x9GHQPHQ074252@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Wed, 16 Oct 2019 17:26:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353660 - stable/12/sys/dev/ixgbe X-SVN-Group: stable-12 X-SVN-Commit-Author: erj X-SVN-Commit-Paths: stable/12/sys/dev/ixgbe X-SVN-Commit-Revision: 353660 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 17:26:25 -0000 Author: erj Date: Wed Oct 16 17:26:24 2019 New Revision: 353660 URL: https://svnweb.freebsd.org/changeset/base/353660 Log: MFC r353599 MFCs ixgbe: Disable EEE for backplane X550EM_X This prevents a possible kernel panic on X552 backplane devices. Sponsored by: Intel Corporation Modified: stable/12/sys/dev/ixgbe/if_ix.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ixgbe/if_ix.c ============================================================================== --- stable/12/sys/dev/ixgbe/if_ix.c Wed Oct 16 17:21:18 2019 (r353659) +++ stable/12/sys/dev/ixgbe/if_ix.c Wed Oct 16 17:26:24 2019 (r353660) @@ -4416,7 +4416,7 @@ ixgbe_sysctl_eee_state(SYSCTL_HANDLER_ARGS) if ((new_eee < 0) || (new_eee > 1)) return (EINVAL); - retval = adapter->hw.mac.ops.setup_eee(&adapter->hw, new_eee); + retval = ixgbe_setup_eee(&adapter->hw, new_eee); if (retval) { device_printf(dev, "Error in EEE setup: 0x%08X\n", retval); return (EINVAL); @@ -4469,8 +4469,6 @@ ixgbe_init_device_features(struct adapter *adapter) case ixgbe_mac_X550EM_x: adapter->feat_cap |= IXGBE_FEATURE_SRIOV; adapter->feat_cap |= IXGBE_FEATURE_FDIR; - if (adapter->hw.device_id == IXGBE_DEV_ID_X550EM_X_KR) - adapter->feat_cap |= IXGBE_FEATURE_EEE; break; case ixgbe_mac_X550EM_a: adapter->feat_cap |= IXGBE_FEATURE_SRIOV; From owner-svn-src-all@freebsd.org Wed Oct 16 17:49:45 2019 Return-Path: Delivered-To: svn-src-all@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 E7E1114C42E; Wed, 16 Oct 2019 17:49:45 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46tfvD5bB2z44r5; Wed, 16 Oct 2019 17:49:44 +0000 (UTC) (envelope-from ohartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1571248172; bh=qMs1cVUbztcFKiFfq6utx7+NtEfQ29Iy1V+iQ8Xeg7w=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=LTa4lWQzprRy0TAvexwxnx1cu6bDsL8AFvh+v4geurP+HUHp1ofLdu6urPB/OrQSf TZLM4X3WZ/5q+jQTYOjLbos2yUTUIPu3a0Bt4O8cT0QFRkn9boAq6EilWrLw/gsJhA jG+O2CpdJ7Xcj/+FqykoFvjXJDiaJbLRDM8eD6xc= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from thor.intern.walstatt.dynvpn.de ([77.13.158.142]) by mail.gmx.com (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MJE6F-1idhu91rMh-00KdXG; Wed, 16 Oct 2019 19:44:06 +0200 Date: Wed, 16 Oct 2019 19:43:32 +0200 From: "O. Hartmann" To: Eric Joyner Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353658 - head/sys/dev/ixl Message-ID: <20191016194359.2c1cddf2@thor.intern.walstatt.dynvpn.de> In-Reply-To: <201910161719.x9GHJHux068505@repo.freebsd.org> References: <201910161719.x9GHJHux068505@repo.freebsd.org> Organization: WALSTATT User-Agent: OutScare 3.1415926 X-Operating-System: ImNotAnOperatingSystem 3.141592527 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 X-Provags-ID: V03:K1:M3XB68nJcRVtGXtqTh3ztoxaN5Wbu3gaYCYdCoFP4SLWV3arY1A UAZVH539dSBwF4+cGGNeZyWqZgJQpvw8TJ5uIJulms/UOVYeJjHMjZKI6LCHFuvyn9RpH1s Dz4gROyTfuiitAN5exxPtQ+1RdawycoiiVjoxxjIkXqC5iDdRJ7ZrJLVYyu9usII5/foQOX HkfTq7Tgkk7sDKjZJSKvg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:y03inrwQhtU=:n3DwQThe+kArd9g5LKpGCC IOK4Rs1dLgNH/bSUWe4QrSnS53/dx1kLrCBsfVlujLXSQsy67dVlz9tMGD2ZUmFJnmGajdkUy oZmO7UbNiDxa/hmstFu+V0LXo5AA2LOwx1Goli4GB/cFREs0lSVbrYCQD/FKpf06f4EtWo1d3 mir76k6quAgtOe13Pmni+h2T3eRgBGXfVZzLQ/fs2M9Hw9J38U9hahTa2NbFTUDwMIqibb38V 7O9izV8nJxoG2kPIc1DONENlQiYbjaZ3oS6G+iUVTHFUimixlcdn5TEq+uNJM+8itS8sNBWAq Whb3q79IiXFg2puDrldhfPYEsvg+E9b9wHptNFQOP7rTD9ClxyDIBFXvgWLrLmWv5LhOdrEcI 9s5PJhQA23gu+lVunc/qfBkxAk6i/dxPMGcmaE3Y1D4WQk6qRooBTaAEpkUJgBZfdFYOIjDVH fzAWuxp6N0eK+LlmFItM9yIiFXBNEIU3VKKXlq6xe0lhKq2qHxSZ6XBulDIxmcH6u0PcD3n5V Qn1j4jfzabCX5jP6a8VPtQaNoxeva3IoPQiZ+i1TFZ7W/Y3HC+rDzj/dK2jG5gKxcnlRD27HB HxWfo7ApnkzJJgzVydPtNmU9tqnJin3eFHzKwnqF5escvFMyLtXXFYYhopfgLd5TdB5Nt1pmO sDBiAMsWJkCY9B5BdIaz0qLugXtZY4dJfFVcs8D4CUZjKCgTu4I0hOR9FOB1gLukB8q+llaAX UQhj9KD+iB0vEc28PTh53QHYmAVe6l/raYLxyYZNTzkBqsG9MogPIsHqiz+0EiIxiEWPzuIyF PJr7Xzp8RX0R28eNLIAB0yBm2PxXssc4qGP0pMxyj88q+rOvPitbjXRAqXLFUXKKBcZY83WWc 8KhsnnO7rk4+HtNBmTADphRI0sl051lGNvefOJXb5RHJP2E4jEU056fTtbzNmZeO0QC9A0HW1 AVs+wehwhNDfC2JZYHQLxEgi4YRuVzTjVWlLF+PsJdLC+Q4FF/2Jc7CB3XEuLxNb+wUcXcOR3 hagmOsv+yjocP+OLlg1yZUMHSxDnICeUDfdsY32x5hmDH0YEtd9spAO5VDhwpUcpxpRPFkDyi YX1MGnGKJSXoBwdFKFsxaVFpc7m2R4x84wmjP2b98uTZvtnD0eXVHCDsT44BikzF2E3W3ZCpA gBW407BZxH/2alhiYvd/5KZ1M72tE379CrA8dYzHDghMwV4W8+Cw9BjtcVhExF14O2h2oo9uu G3XsI4g7B1nZXVimtBIjcOjOO3ZD4pehE6WcVe1gsX4SNAuKgZnK5pPI9g+Y= X-Rspamd-Queue-Id: 46tfvD5bB2z44r5 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.b=LTa4lWQz; dmarc=none; spf=none (mx1.freebsd.org: domain of ohartmann@walstatt.org has no SPF policy when checking 212.227.17.22) smtp.mailfrom=ohartmann@walstatt.org X-Spamd-Result: default: False [-3.26 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmx.net:s=badeba3b8450]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; IP_SCORE(-0.96)[ip: (-5.49), ipnet: 212.227.0.0/16(-1.32), asn: 8560(2.02), country: DE(-0.01)]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[walstatt.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; HAS_ORG_HEADER(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmx.net:+]; MIME_BASE64_TEXT(0.10)[]; R_SPF_NA(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[22.17.227.212.list.dnswl.org : 127.0.3.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[142.158.13.77.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 17:49:46 -0000 LS0tLS1CRUdJTiBQR1AgU0lHTkVEIE1FU1NBR0UtLS0tLQ0KSGFzaDogU0hBMjU2DQoNCkFtIFdl ZCwgMTYgT2N0IDIwMTkgMTc6MTk6MTcgKzAwMDAgKFVUQykNCkVyaWMgSm95bmVyIDxlcmpARnJl ZUJTRC5vcmc+IHNjaHJpZWI6DQoNCj4gQXV0aG9yOiBlcmoNCj4gRGF0ZTogV2VkIE9jdCAxNiAx NzoxOToxNyAyMDE5DQo+IE5ldyBSZXZpc2lvbjogMzUzNjU4DQo+IFVSTDogaHR0cHM6Ly9zdm53 ZWIuZnJlZWJzZC5vcmcvY2hhbmdlc2V0L2Jhc2UvMzUzNjU4DQo+IA0KPiBMb2c6DQo+ICAgaXhs OiByZXBvcnQgd2hldGhlciBkZXZpY2UgcmVjZWl2ZWQgcGF1c2UgZnJhbWVzDQo+ICAgDQo+ICAg RnJvbSBKYWtlOg0KPiAgIFdoZW4gdXBkYXRpbmcgdGhlIGRldmljZSBzdGF0aXN0aWNzLCByZXBv cnQgd2hldGhlciBvciBub3Qgd2UgaGF2ZQ0KPiAgIHJlY2VpdmVkIGFueSBwYXVzZSBmcmFtZXMg dG8gdGhlIGlmbGliIHN0YWNrLiBUaGlzIGFsbG93cyB0aGUgaWZsaWINCj4gICBzdGFjayB0byBh dm9pZCBnZW5lcmF0aW5nIGEgVHggaGFuZyBtZXNzYWdlIHdoaWxlIHRoZSBkZXZpY2UgaXMgcGF1 c2VkLg0KPiAgIA0KPiAgIFNpZ25lZC1vZmYtYnk6IEphY29iIEtlbGxlciA8amFjb2IuZS5rZWxs ZXJAaW50ZWwuY29tPg0KPiAgIA0KPiAgIFN1Ym1pdHRlZCBieToJSmFjb2IgS2VsbGVyIDxqYWNv Yi5lLmtlbGxlckBpbnRlbC5jb20+DQo+ICAgUmV2aWV3ZWQgYnk6CWdhbGxhdGluQA0KPiAgIFNw b25zb3JlZCBieToJSW50ZWwgQ29ycG9yYXRpb24NCj4gICBEaWZmZXJlbnRpYWwgUmV2aXNpb246 CWh0dHBzOi8vcmV2aWV3cy5mcmVlYnNkLm9yZy9EMjE4NzANCj4gDQo+IE1vZGlmaWVkOg0KPiAg IGhlYWQvc3lzL2Rldi9peGwvaXhsX3BmX21haW4uYw0KPiANCj4gTW9kaWZpZWQ6IGhlYWQvc3lz L2Rldi9peGwvaXhsX3BmX21haW4uYw0KPiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0NCj4gLS0tIGhl YWQvc3lzL2Rldi9peGwvaXhsX3BmX21haW4uYwlXZWQgT2N0IDE2IDE3OjE2OjMyIDIwMTkJKHIz NTM2NTcpDQo+ICsrKyBoZWFkL3N5cy9kZXYvaXhsL2l4bF9wZl9tYWluLmMJV2VkIE9jdCAxNiAx NzoxOToxNyAyMDE5CShyMzUzNjU4KQ0KPiBAQCAtMjU5Miw2ICsyNTkyLDcgQEAgaXhsX3VwZGF0 ZV9zdGF0c19jb3VudGVycyhzdHJ1Y3QgaXhsX3BmICpwZikNCj4gIAlzdHJ1Y3QgaTQwZV9odwkq aHcgPSAmcGYtPmh3Ow0KPiAgCXN0cnVjdCBpeGxfdnNpCSp2c2kgPSAmcGYtPnZzaTsNCj4gIAlz dHJ1Y3QgaXhsX3ZmCSp2ZjsNCj4gKwl1NjQgcHJldl9saW5rX3hvZmZfcnggPSBwZi0+c3RhdHMu bGlua194b2ZmX3J4Ow0KPiAgDQo+ICAJc3RydWN0IGk0MGVfaHdfcG9ydF9zdGF0cyAqbnNkID0g JnBmLT5zdGF0czsNCj4gIAlzdHJ1Y3QgaTQwZV9od19wb3J0X3N0YXRzICpvc2QgPSAmcGYtPnN0 YXRzX29mZnNldHM7DQo+IEBAIC0yNjc2LDYgKzI2NzcsMTMgQEAgaXhsX3VwZGF0ZV9zdGF0c19j b3VudGVycyhzdHJ1Y3QgaXhsX3BmICpwZikNCj4gIAlpeGxfc3RhdF91cGRhdGUzMihodywgSTQw RV9HTFBSVF9MWE9GRlRYQyhody0+cG9ydCksDQo+ICAJCQkgICBwZi0+c3RhdF9vZmZzZXRzX2xv YWRlZCwNCj4gIAkJCSAgICZvc2QtPmxpbmtfeG9mZl90eCwgJm5zZC0+bGlua194b2ZmX3R4KTsN Cj4gKw0KPiArCS8qDQo+ICsJICogRm9yIHdhdGNoZG9nIG1hbmFnZW1lbnQgd2UgbmVlZCB0byBr bm93IGlmIHdlIGhhdmUgYmVlbiBwYXVzZWQNCj4gKwkgKiBkdXJpbmcgdGhlIGxhc3QgaW50ZXJ2 YWwsIHNvIGNhcHR1cmUgdGhhdCBoZXJlLg0KPiArCSAqLw0KPiArCWlmIChwZi0+c3RhdHMubGlu a194b2ZmX3J4ICE9IHByZXZfbGlua194b2ZmX3J4KQ0KPiArCQlhZGFwdGVyLT5zaGFyZWQtPmlz Y19wYXVzZV9mcmFtZXMgPSAxOw0KPiAgDQo+ICAJLyogUGFja2V0IHNpemUgc3RhdHMgcnggKi8N Cj4gIAlpeGxfc3RhdF91cGRhdGU0OChodywgSTQwRV9HTFBSVF9QUkM2NEgoaHctPnBvcnQpLA0K PiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXw0KPiBzdm4t c3JjLWhlYWRAZnJlZWJzZC5vcmcgbWFpbGluZyBsaXN0DQo+IGh0dHBzOi8vbGlzdHMuZnJlZWJz ZC5vcmcvbWFpbG1hbi9saXN0aW5mby9zdm4tc3JjLWhlYWQNCj4gVG8gdW5zdWJzY3JpYmUsIHNl bmQgYW55IG1haWwgdG8gInN2bi1zcmMtaGVhZC11bnN1YnNjcmliZUBmcmVlYnNkLm9yZyINCg0K VGhpcyBjb21taXQgcmVuZGVycyBidWlsZGtlcm5lbCB0byBmYWlsOg0KDQpbLi4uXQ0KLSAtLS0g aXhsX3BmX21haW4ubyAtLS0NCi91c3Ivc3JjL3N5cy9kZXYvaXhsL2l4bF9wZl9tYWluLmM6MjY4 NjozOiBlcnJvcjogdXNlIG9mIHVuZGVjbGFyZWQgaWRlbnRpZmllciAnYWRhcHRlcicNCiAgICAg ICAgICAgICAgICBhZGFwdGVyLT5zaGFyZWQtPmlzY19wYXVzZV9mcmFtZXMgPSAxOw0KDQoNCi0g LS0gDQpPLiBIYXJ0bWFubg0KDQpJY2ggd2lkZXJzcHJlY2hlIGRlciBOdXR6dW5nIG9kZXIgw5xi ZXJtaXR0bHVuZyBtZWluZXIgRGF0ZW4gZsO8cg0KV2VyYmV6d2Vja2Ugb2RlciBmw7xyIGRpZSBN YXJrdC0gb2RlciBNZWludW5nc2ZvcnNjaHVuZyAowqcgMjggQWJzLiA0IEJEU0cpLg0KLS0tLS1C RUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0NCg0KaUhVRUFSWUlBQjBXSVFTeThJQnhBUERrcVZCYVRK NDROMVpaUGJhNVJ3VUNYYWRXM3dBS0NSQTROMVpaUGJhNQ0KUjNkdEFQOUhaS2xiOXRQVVZ4VUp2 TSs1VHNMUzc3SS80d0dGS2hBdjhCdk9RcldhdHdEK0pJem5KdE41UzFsdw0KQzBkWGlxcld1di9X WWkwMVg0elduR1VPUzBEb01ncz0NCj1FckZaDQotLS0tLUVORCBQR1AgU0lHTkFUVVJFLS0tLS0N Cg== From owner-svn-src-all@freebsd.org Wed Oct 16 18:12:23 2019 Return-Path: Delivered-To: svn-src-all@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 0CDEE14CCDF; Wed, 16 Oct 2019 18:12:23 +0000 (UTC) (envelope-from erj@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 46tgPL6VHCz45vf; Wed, 16 Oct 2019 18:12:22 +0000 (UTC) (envelope-from erj@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 C2638AF12; Wed, 16 Oct 2019 18:12:22 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9GICMqO001791; Wed, 16 Oct 2019 18:12:22 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GICMWn001790; Wed, 16 Oct 2019 18:12:22 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201910161812.x9GICMWn001790@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Wed, 16 Oct 2019 18:12:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353661 - head/sys/dev/ixl X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/dev/ixl X-SVN-Commit-Revision: 353661 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 18:12:23 -0000 Author: erj Date: Wed Oct 16 18:12:22 2019 New Revision: 353661 URL: https://svnweb.freebsd.org/changeset/base/353661 Log: Fix compile error introduced in r353658 "adapter" doesn't exist in ixl. Reported by: O. Hartmann Modified: head/sys/dev/ixl/ixl_pf_main.c Modified: head/sys/dev/ixl/ixl_pf_main.c ============================================================================== --- head/sys/dev/ixl/ixl_pf_main.c Wed Oct 16 17:26:24 2019 (r353660) +++ head/sys/dev/ixl/ixl_pf_main.c Wed Oct 16 18:12:22 2019 (r353661) @@ -2683,7 +2683,7 @@ ixl_update_stats_counters(struct ixl_pf *pf) * during the last interval, so capture that here. */ if (pf->stats.link_xoff_rx != prev_link_xoff_rx) - adapter->shared->isc_pause_frames = 1; + vsi->shared->isc_pause_frames = 1; /* Packet size stats rx */ ixl_stat_update48(hw, I40E_GLPRT_PRC64H(hw->port), From owner-svn-src-all@freebsd.org Wed Oct 16 18:13:23 2019 Return-Path: Delivered-To: svn-src-all@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 BE9DD14CD5E for ; Wed, 16 Oct 2019 18:13:23 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.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 46tgQW0cYDz46Q4 for ; Wed, 16 Oct 2019 18:13:22 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: by mail-lf1-f54.google.com with SMTP id r22so18296837lfm.1 for ; Wed, 16 Oct 2019 11:13:22 -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=LwiWBOXYemwUGNVr61w4b344GNn/hEnbr88nhG12qTY=; b=F9bRw+F80STjX3zPSjwNPQl4BdyKekNiDBDl0mwE0uPGW1osfLCRwfHg06y6d27hQX Yd86FfGOl8ccOWEcW8lLsCVxsYmJDEm3CuA48WRcaw0JuDbxNFy2d1Akc6eMrHBlYPzx TbM5IsAEgXBsHrzJbLLEOJyJGktkpAWmTTpQnbR0gIuK1LscE0yV0gOLPbl5Vq9TUJIW 93+eC5djeT3NGKH+pqx/CR3xo+A1Htopt5vzB0WYmhBABgJhLdP7WD28oPjs50t0w7gI yM5Snwg6+fftv/J5ZL3wITOntJxea+8+/tf7JqKAyoH1hOj8Y7z5AwRfMVztI4JzIMRH z6bw== X-Gm-Message-State: APjAAAXyDZjbdb0Mnv1IKqQnXHh8azSb9tFlioF9pes0zNjrmje7qmAb BIounFqXuXtjFiyEkE3xQKoOP6Jf X-Google-Smtp-Source: APXvYqw8kaPO4DftxZ3QkuL70Xdo5vrmSmpPyvx1chy1Cfc37xug3eJ2MEDh14N0dBOkbcTWKzQbjw== X-Received: by 2002:a19:4b8f:: with SMTP id y137mr26357277lfa.19.1571249600801; Wed, 16 Oct 2019 11:13:20 -0700 (PDT) Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com. [209.85.208.181]) by smtp.gmail.com with ESMTPSA id g3sm6497484ljj.59.2019.10.16.11.13.19 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Oct 2019 11:13:20 -0700 (PDT) Received: by mail-lj1-f181.google.com with SMTP id d1so24933434ljl.13 for ; Wed, 16 Oct 2019 11:13:19 -0700 (PDT) X-Received: by 2002:a2e:99cc:: with SMTP id l12mr25857724ljj.175.1571249599464; Wed, 16 Oct 2019 11:13:19 -0700 (PDT) MIME-Version: 1.0 References: <201910161719.x9GHJHux068505@repo.freebsd.org> <20191016194359.2c1cddf2@thor.intern.walstatt.dynvpn.de> In-Reply-To: <20191016194359.2c1cddf2@thor.intern.walstatt.dynvpn.de> From: Eric Joyner Date: Wed, 16 Oct 2019 11:13:08 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r353658 - head/sys/dev/ixl To: "O. Hartmann" Cc: src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46tgQW0cYDz46Q4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of ricera10@gmail.com designates 209.85.167.54 as permitted sender) smtp.mailfrom=ricera10@gmail.com X-Spamd-Result: default: False [-2.19 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; URI_COUNT_ODD(1.00)[9]; RCVD_COUNT_THREE(0.00)[4]; MIME_TRACE(0.00)[0:+,1:+,2:~]; TO_DN_ALL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[54.167.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-1.19)[ip: (-0.56), ipnet: 209.85.128.0/17(-3.24), asn: 15169(-2.10), country: US(-0.05)]; FORGED_SENDER(0.30)[erj@freebsd.org,ricera10@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[54.167.85.209.rep.mailspike.net : 127.0.0.17]; 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)[erj@freebsd.org,ricera10@gmail.com]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 18:13:23 -0000 Does r353661 fix it? I didn't catch "adapter" being used, probably due to committing patches for the other drivers that do use "adapter". On Wed, Oct 16, 2019 at 10:57 AM O. Hartmann wrote= : > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > Am Wed, 16 Oct 2019 17:19:17 +0000 (UTC) > Eric Joyner schrieb: > > > Author: erj > > Date: Wed Oct 16 17:19:17 2019 > > New Revision: 353658 > > URL: https://svnweb.freebsd.org/changeset/base/353658 > > > > Log: > > ixl: report whether device received pause frames > > > > From Jake: > > When updating the device statistics, report whether or not we have > > received any pause frames to the iflib stack. This allows the iflib > > stack to avoid generating a Tx hang message while the device is pause= d. > > > > Signed-off-by: Jacob Keller > > > > Submitted by: Jacob Keller > > Reviewed by: gallatin@ > > Sponsored by: Intel Corporation > > Differential Revision: https://reviews.freebsd.org/D21870 > > > > Modified: > > head/sys/dev/ixl/ixl_pf_main.c > > > > Modified: head/sys/dev/ixl/ixl_pf_main.c > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > > --- head/sys/dev/ixl/ixl_pf_main.c Wed Oct 16 17:16:32 2019 > (r353657) > > +++ head/sys/dev/ixl/ixl_pf_main.c Wed Oct 16 17:19:17 2019 > (r353658) > > @@ -2592,6 +2592,7 @@ ixl_update_stats_counters(struct ixl_pf *pf) > > struct i40e_hw *hw =3D &pf->hw; > > struct ixl_vsi *vsi =3D &pf->vsi; > > struct ixl_vf *vf; > > + u64 prev_link_xoff_rx =3D pf->stats.link_xoff_rx; > > > > struct i40e_hw_port_stats *nsd =3D &pf->stats; > > struct i40e_hw_port_stats *osd =3D &pf->stats_offsets; > > @@ -2676,6 +2677,13 @@ ixl_update_stats_counters(struct ixl_pf *pf) > > ixl_stat_update32(hw, I40E_GLPRT_LXOFFTXC(hw->port), > > pf->stat_offsets_loaded, > > &osd->link_xoff_tx, &nsd->link_xoff_tx); > > + > > + /* > > + * For watchdog management we need to know if we have been paused > > + * during the last interval, so capture that here. > > + */ > > + if (pf->stats.link_xoff_rx !=3D prev_link_xoff_rx) > > + adapter->shared->isc_pause_frames =3D 1; > > > > /* Packet size stats rx */ > > ixl_stat_update48(hw, I40E_GLPRT_PRC64H(hw->port), > > _______________________________________________ > > svn-src-head@freebsd.org mailing list > > https://lists.freebsd.org/mailman/listinfo/svn-src-head > > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > > This commit renders buildkernel to fail: > > [...] > - --- ixl_pf_main.o --- > /usr/src/sys/dev/ixl/ixl_pf_main.c:2686:3: error: use of undeclared > identifier 'adapter' > adapter->shared->isc_pause_frames =3D 1; > > > - -- > O. Hartmann > > Ich widerspreche der Nutzung oder =C3=9Cbermittlung meiner Daten f=C3=BCr > Werbezwecke oder f=C3=BCr die Markt- oder Meinungsforschung (=C2=A7 28 Ab= s. 4 BDSG). > -----BEGIN PGP SIGNATURE----- > > iHUEARYIAB0WIQSy8IBxAPDkqVBaTJ44N1ZZPba5RwUCXadW3wAKCRA4N1ZZPba5 > R3dtAP9HZKlb9tPUVxUJvM+5TsLS77I/4wGFKhAv8BvOQrWatwD+JIznJtN5S1lw > C0dXiqrWuv/WYi01X4zWnGUOS0DoMgs=3D > =3DErFZ > -----END PGP SIGNATURE----- > From owner-svn-src-all@freebsd.org Wed Oct 16 18:27:28 2019 Return-Path: Delivered-To: svn-src-all@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 7B7CE14D12D; Wed, 16 Oct 2019 18:27: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 46tgkm2hQbz475p; Wed, 16 Oct 2019 18:27: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 22500B0F2; Wed, 16 Oct 2019 18:27: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 x9GIRR8j009547; Wed, 16 Oct 2019 18:27:27 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GIRR9N009546; Wed, 16 Oct 2019 18:27:27 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910161827.x9GIRR9N009546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 16 Oct 2019 18:27:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353662 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 353662 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 18:27:28 -0000 Author: cem Date: Wed Oct 16 18:27:27 2019 New Revision: 353662 URL: https://svnweb.freebsd.org/changeset/base/353662 Log: ddb: Add support for disassembling 'crc32' on amd64 Modified: head/sys/amd64/amd64/db_disasm.c Modified: head/sys/amd64/amd64/db_disasm.c ============================================================================== --- head/sys/amd64/amd64/db_disasm.c Wed Oct 16 18:12:22 2019 (r353661) +++ head/sys/amd64/amd64/db_disasm.c Wed Oct 16 18:27:27 2019 (r353662) @@ -145,6 +145,26 @@ static const struct inst db_inst_0f388x[] = { /*8f*/ { "", FALSE, NONE, 0, 0 }, }; +static const struct inst db_inst_0f38fx[] = { +/*f0*/ { "crc32b",TRUE, NONE, op2(Eb, R), 0 }, +/*f1*/ { "crc32", TRUE, LONG, op2(E, R), 0 }, +/*f2*/ { "", FALSE, NONE, 0, 0 }, +/*f3*/ { "", FALSE, NONE, 0, 0 }, +/*f4*/ { "", FALSE, NONE, 0, 0 }, +/*f5*/ { "", FALSE, NONE, 0, 0 }, +/*f6*/ { "", FALSE, NONE, 0, 0 }, +/*f7*/ { "", FALSE, NONE, 0, 0 }, + +/*f8*/ { "", FALSE, NONE, 0, 0 }, +/*f9*/ { "", FALSE, NONE, 0, 0 }, +/*fa*/ { "", FALSE, NONE, 0, 0 }, +/*fb*/ { "", FALSE, NONE, 0, 0 }, +/*fc*/ { "", FALSE, NONE, 0, 0 }, +/*fd*/ { "", FALSE, NONE, 0, 0 }, +/*fe*/ { "", FALSE, NONE, 0, 0 }, +/*ff*/ { "", FALSE, NONE, 0, 0 }, +}; + static const struct inst * const db_inst_0f38[] = { 0, 0, @@ -161,7 +181,7 @@ static const struct inst * const db_inst_0f38[] = { 0, 0, 0, - 0 + db_inst_0f38fx }; static const char * const db_Grp6[] = { @@ -1238,7 +1258,7 @@ db_disasm(db_addr_t loc, bool altfmt) boolean_t first; int displ; int prefix; - int rep; + int rep, repne; int imm; int imm2; long imm64; @@ -1254,6 +1274,7 @@ db_disasm(db_addr_t loc, bool altfmt) * Get prefixes */ rep = FALSE; + repne = FALSE; prefix = TRUE; do { switch (inst) { @@ -1284,8 +1305,12 @@ db_disasm(db_addr_t loc, bool altfmt) case 0xf0: db_printf("lock "); break; + /* + * XXX repne/repe are only actually valid for MOVS, CMPS, + * SCAS, LODS, STOS, INS, OUTS. + */ case 0xf2: - db_printf("repne "); + repne = TRUE; break; case 0xf3: rep = TRUE; @@ -1480,6 +1505,11 @@ db_disasm(db_addr_t loc, bool altfmt) rep = FALSE; } } + /* N.B., likely highly incomplete. */ + if (repne) { + if (ip == &db_inst_0f38fx[0] || ip == &db_inst_0f38fx[1]) + repne = FALSE; + } if (size == WORD) { if (ip->i_extra == db_Grp9 && f_mod(rex, regmodrm) != 3 && f_reg(rex, regmodrm) == 0x6) { @@ -1495,6 +1525,8 @@ db_disasm(db_addr_t loc, bool altfmt) if (rep == TRUE) db_printf("repe "); /* XXX repe VS rep */ + if (repne == TRUE) + db_printf("repne "); if (i_size == SDEP) { if (size == LONG) From owner-svn-src-all@freebsd.org Wed Oct 16 18:33:32 2019 Return-Path: Delivered-To: svn-src-all@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 098EA14D370; Wed, 16 Oct 2019 18:33:32 +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 46tgsl6SsQz47TZ; Wed, 16 Oct 2019 18:33:31 +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 C2320B2AB; Wed, 16 Oct 2019 18:33:31 +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 x9GIXV50015046; Wed, 16 Oct 2019 18:33:31 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GIXVOo015045; Wed, 16 Oct 2019 18:33:31 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910161833.x9GIXVOo015045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Oct 2019 18:33:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353663 - head/lib/libbe X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libbe X-SVN-Commit-Revision: 353663 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 18:33:32 -0000 Author: kevans Date: Wed Oct 16 18:33:31 2019 New Revision: 353663 URL: https://svnweb.freebsd.org/changeset/base/353663 Log: libbe(3): Fix destroy of imported BE w/ AUTOORIGIN Imported BE, much like the activated BE, will not have an origin that we can fetch/examine for destruction. be_destroy should not return BE_ERR_NOORIGIN for failure to get the origin property for BE_DESTROY_AUTOORIGIN, because we don't really know going into it that there's even an origin to be destroyed. BE_DESTROY_NEEDORIGIN has been renamed to BE_DESTROY_WANTORIGIN because only a subset of it *needs* the origin, so 'need' is too strong of verbiage. This was caught by jenkins and the bectl tests, but kevans failed to run the bectl tests prior to commit. Reported by: lwhsu Modified: head/lib/libbe/be.c Modified: head/lib/libbe/be.c ============================================================================== --- head/lib/libbe/be.c Wed Oct 16 18:27:27 2019 (r353662) +++ head/lib/libbe/be.c Wed Oct 16 18:33:31 2019 (r353663) @@ -229,7 +229,7 @@ be_destroy_cb(zfs_handle_t *zfs_hdl, void *data) return (0); } -#define BE_DESTROY_NEEDORIGIN (BE_DESTROY_ORIGIN | BE_DESTROY_AUTOORIGIN) +#define BE_DESTROY_WANTORIGIN (BE_DESTROY_ORIGIN | BE_DESTROY_AUTOORIGIN) /* * Destroy the boot environment or snapshot specified by the name * parameter. Options are or'd together with the possible values: @@ -265,9 +265,10 @@ be_destroy(libbe_handle_t *lbh, const char *name, int if (fs == NULL) return (set_error(lbh, BE_ERR_ZFSOPEN)); - if ((options & BE_DESTROY_NEEDORIGIN) != 0 && + if ((options & BE_DESTROY_WANTORIGIN) != 0 && zfs_prop_get(fs, ZFS_PROP_ORIGIN, origin, sizeof(origin), - NULL, NULL, 0, 1) != 0) + NULL, NULL, 0, 1) != 0 && + (options & BE_DESTROY_ORIGIN) != 0) return (set_error(lbh, BE_ERR_NOORIGIN)); /* @@ -279,7 +280,7 @@ be_destroy(libbe_handle_t *lbh, const char *name, int * the caller can determine if it needs to warn about the origin * not being destroyed or not. */ - if ((options & BE_DESTROY_AUTOORIGIN) != 0 && + if ((options & BE_DESTROY_AUTOORIGIN) != 0 && *origin != '\0' && be_is_auto_snapshot_name(lbh, origin)) options |= BE_DESTROY_ORIGIN; From owner-svn-src-all@freebsd.org Wed Oct 16 19:05:41 2019 Return-Path: Delivered-To: svn-src-all@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 D01D314DB63; Wed, 16 Oct 2019 19:05:41 +0000 (UTC) (envelope-from bdrewery@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 46thZs52R4z48xX; Wed, 16 Oct 2019 19:05:41 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 7E272D552; Wed, 16 Oct 2019 19:05:41 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 3AB6B9FE; Wed, 16 Oct 2019 19:05:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id caXlOcgLrKl8; Wed, 16 Oct 2019 19:05:32 +0000 (UTC) Subject: Re: svn commit: r353639 - head/share/mk DKIM-Filter: OpenDKIM Filter v2.10.3 mail.xzibition.com D35569F7 To: Brooks Davis , Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910161320.x9GDKaBK021462@repo.freebsd.org> <20191016171811.GA52641@spindle.one-eyed-alien.net> From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=https://zx.xk42.net/bryan.asc Autocrypt: addr=bdrewery@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFJphmsBCADiFgmS4bIzwZijrS31SjEMzg+n5zNellgM+HkShwehpqCiyhXdWrvH6dTZ a6u50pbUIX7doTR7W7PQHCjCTqtpwvcj0eulZva+iHFp+XrbgSFHn+VVXgkYP2MFySyZRFab D2qqzJBEJofhpv4HvY6uQI5K99pMqKr1Z/lHqsijYYu4RH2OfwB5PinId7xeldzWEonVoCr+ rfxzO/UrgA6v/3layGZcKNHFjmc3NqoN1DXtdaEHqtjIozzbndVkH6lkFvIpIrI6i5ox8pwp VxsxLCr/4Musd5CWgHiet5kSw2SzNeA8FbxdLYCpXNVu+uBACEbCUP+CSNy3NVfEUxsBABEB AAG0JEJyeWFuIERyZXdlcnkgPGJkcmV3ZXJ5QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwUL CQgHAwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBPkXPLLDqup6XIofCTXXcbtuRpfPBQJb5hLu BQkNPvODAAoJEDXXcbtuRpfP9rMH/3f7cfX5rzyEV5QNfV/wS4jFukLoPZ4+nCM/TKxH3pEX 2bLbeQbkk6La8cueQ5Lpoht5XFZ18Y5TbMittngltrlNzoDD0h9are24OkDFGim3afJU7tkj IGQa1if+re+vI5BhzYwRhj0oKXzBi39M5oePd3L1dXfx83rg2FPyZBdIejsz6fR74T3JVkbd 6k2l5/3Zk2uiNMy+eBfDRgYE1E6CP28kV0nCeGKZgSVso0kGUUHud7voKqGVpMvbd0mE4pp4 PE5YJaFPjrll9miaDAvdU8LGIq5n6+aXPLKoQ/QNl6mg6ifgI6FfKILOkTizLW8E5PBSNnCm NapQ55yjm125AQ0EUmmGawEIAKJUU9+Q19oW1RK5jTf3m56j+szIc8Y9DaLC8REUKl4UZJBK BqCl6c0cukVApOD92XoU6hJPm2rLEyp/IcYcPPNTnVu8D8h9oag2L8EiFN7+2hk0xG+lwjc8 uOIZycme7AIJsBU4AZ1v63lxm2k104hwpiatgbe71GIGl7p1MX6ousP/wGzXCOF25Dx9w02C eRe7zEMfhnFjSUhzdCC9han2+KaVB7qIqNR3b8NfbwRNlwPmHqlhXffUow9OsQjSnTK8WKNR lx7xzVccXIvWP2wECFrmqmzMmXpSrmIuiWEpFwZ9x2a0Pva8dCNRiCVTK51IlRXKjaAxiN1u IUrMm6UAEQEAAYkBPAQYAQoAJgIbDBYhBPkXPLLDqup6XIofCTXXcbtuRpfPBQJb5hL4BQkN PvONAAoJEDXXcbtuRpfPCjcH/ivBsOpdpebpgLizSNU5/X4yWN5Aixsc9VBnQhGKAKnMINJQ VMpA55sD2JSPwloXYM/B3qyPJRS/9cwIuX5LDNKKOZU3Qp+TzleynM15/xea14orWYRGRict YHBM3Cnqp7OD8K6Q1uhs0fTxyJP7PZ/G0+7Corlf1DlHhDt6C2HldRPFvAvAgl6sR9Wzgcb7 rzub2HVtbJgl6YHbgyAG7x9NpXFqzx1JLAMdpt2DIYwoi+oMdRQlBIwNuKjQjCGzuXHandd3 kGvBAsyJpQ+coEep9UzwANaV28cXrFr2R4FSOcR50rBA2Nh/vqUYfpsvBvJlwuKAoV1djVHa ihNeL5E= Organization: FreeBSD Message-ID: <32ca31df-3039-0f0c-1006-86bd67d1e9e4@FreeBSD.org> Date: Wed, 16 Oct 2019 12:05:22 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191016171811.GA52641@spindle.one-eyed-alien.net> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="HJohtPujDkhS49pXwHMaTYz5Uyjxeb526" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 19:05:41 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --HJohtPujDkhS49pXwHMaTYz5Uyjxeb526 Content-Type: multipart/mixed; boundary="JDXklkezbv4kEuJW2zklDnqfHTFRoK0L7"; protected-headers="v1" From: Bryan Drewery To: Brooks Davis , Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <32ca31df-3039-0f0c-1006-86bd67d1e9e4@FreeBSD.org> Subject: Re: svn commit: r353639 - head/share/mk References: <201910161320.x9GDKaBK021462@repo.freebsd.org> <20191016171811.GA52641@spindle.one-eyed-alien.net> In-Reply-To: <20191016171811.GA52641@spindle.one-eyed-alien.net> --JDXklkezbv4kEuJW2zklDnqfHTFRoK0L7 Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 10/16/2019 10:18 AM, Brooks Davis wrote: > On Wed, Oct 16, 2019 at 01:20:36PM +0000, Warner Losh wrote: >> Author: imp >> Date: Wed Oct 16 13:20:36 2019 >> New Revision: 353639 >> URL: https://svnweb.freebsd.org/changeset/base/353639 >> >> Log: >> bsd.compat.mk isn't setup to be included outside of Makefile.inc so = comment it >> out here until that's sorted out. Otherwise the build is broken. whe= n >> TARGET_ARCH isn't defined. >=20 > Thanks for committing this workaround. I forgot to test bare builds (n= ot > buildworld/buildenv/...) because I almost always cross build (either fo= r a > different arch or targeting CURRENT from STABLE). >=20 > I'm currently testing a switch from TARGET_ARCH to MACHINE_ARCH and > TARGET_CPUTYPE to CPUTYPE. >=20 > -- Brooks >=20 As a hack you could do =2Eif defined(SRCTOP) =2Einclude =2Eendif Or rename it src.compat.mk and remove from Makefile and do =2Esinclude --=20 Regards, Bryan Drewery --JDXklkezbv4kEuJW2zklDnqfHTFRoK0L7-- --HJohtPujDkhS49pXwHMaTYz5Uyjxeb526 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEE+Rc8ssOq6npcih8JNddxu25Gl88FAl2nafJfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEY5 MTczQ0IyQzNBQUVBN0E1QzhBMUYwOTM1RDc3MUJCNkU0Njk3Q0YACgkQNddxu25G l88zMQgAzk/s3Nn3y6ABtA6Dq4WxRbmXpkD9ro76iPV1Pp+ImPXCgd+oleTgPLeQ XhTiyEf61Pbht/GZjfmMvcrUr/uLuwEfZQz2hZ7WZ6LAIEtLZRfX0OMuA3Nbunht pqbZW7p8+ycWMUmKksL2OSnBnLsKLkqAZlUWPVbWfqQX4dIlSdPai5hLbpNnyxoT lUyrFdDtJsYTXauOXS6pCc6gKBSR7WKyNy7euhtA8mewKS6DzUzEVRVcvq4xM4dA qTh85rxwCrMLOUyCOFkLvMcUoPVh8AhJUlg5wYWlzYnUp9yi5z2pp1TzZEXzPAEt z7bBJkEljbzEKsFlRTBHyGxjMSOZTw== =Gb2T -----END PGP SIGNATURE----- --HJohtPujDkhS49pXwHMaTYz5Uyjxeb526-- From owner-svn-src-all@freebsd.org Wed Oct 16 20:45:22 2019 Return-Path: Delivered-To: svn-src-all@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 7CA8014F75D; Wed, 16 Oct 2019 20:45:22 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (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 46tknt2bZbz4FLF; Wed, 16 Oct 2019 20:45:21 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id C1BC1260082; Wed, 16 Oct 2019 22:45:13 +0200 (CEST) Subject: Re: svn commit: r353633 - head/sys/ofed/include/rdma To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910160856.x9G8u7Sg065578@repo.freebsd.org> <20191016165533.GT4086@FreeBSD.org> From: Hans Petter Selasky Message-ID: Date: Wed, 16 Oct 2019 22:44:23 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: <20191016165533.GT4086@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46tknt2bZbz4FLF X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 20:45:22 -0000 On 2019-10-16 18:55, Gleb Smirnoff wrote: > On Wed, Oct 16, 2019 at 08:56:07AM +0000, Hans Petter Selasky wrote: > H> Author: hselasky > H> Date: Wed Oct 16 08:56:07 2019 > H> New Revision: 353633 > H> URL: https://svnweb.freebsd.org/changeset/base/353633 > H> > H> Log: > H> VLAN_TRUNKDEV() requires epochification in ibcore after r353292. > > Note that neither VLAN_DEVAT() not VLAN_TRUNKDEV() reference the > returned structure, so after epoch is exited the link is no longer > safe. > > Does ibcore require these two functions in non-fast code paths? > Yes, ibcore use these in non-fast path. Typically the ifnet's used will be referenced, and only the pointer value is needed for deciding if a packet is designated for the given network device or not. --HPS From owner-svn-src-all@freebsd.org Wed Oct 16 20:47:37 2019 Return-Path: Delivered-To: svn-src-all@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 3562314F7EE; Wed, 16 Oct 2019 20:47:37 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (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 46tkrT0c2Cz4FTW; Wed, 16 Oct 2019 20:47:36 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 81887260082; Wed, 16 Oct 2019 22:47:35 +0200 (CEST) Subject: Re: svn commit: r353635 - in head/sys: netinet netinet6 To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910160911.x9G9BonH076337@repo.freebsd.org> <20191016165722.GU4086@FreeBSD.org> From: Hans Petter Selasky Message-ID: <138998a2-b304-fbe3-065d-e1df0a09af14@selasky.org> Date: Wed, 16 Oct 2019 22:46:44 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: <20191016165722.GU4086@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46tkrT0c2Cz4FTW X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 20:47:37 -0000 On 2019-10-16 18:57, Gleb Smirnoff wrote: > Hans, > > as far as I remember I was against this changeset and I had > several other developers agreed that this should be fixed in > different way. Why did you proceed with checking it in? :( > Hi Gleb, This issue has been discussed in-depth at various transport meetings and we have agreed on a solution. Are you seeing something broken as of this patch? --HPS From owner-svn-src-all@freebsd.org Wed Oct 16 21:07:20 2019 Return-Path: Delivered-To: svn-src-all@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 03E6A14FE33; Wed, 16 Oct 2019 21:07: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 46tlHC6Lbcz4GLM; Wed, 16 Oct 2019 21:07:19 +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 B8ECECF73; Wed, 16 Oct 2019 21:07:19 +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 x9GL7JcK003266; Wed, 16 Oct 2019 21:07:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GL7I8u003262; Wed, 16 Oct 2019 21:07:18 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910162107.x9GL7I8u003262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 16 Oct 2019 21:07:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353664 - in head/sys: arm/arm arm/include sparc64/include sparc64/sparc64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: arm/arm arm/include sparc64/include sparc64/sparc64 X-SVN-Commit-Revision: 353664 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 21:07:20 -0000 Author: kib Date: Wed Oct 16 21:07:18 2019 New Revision: 353664 URL: https://svnweb.freebsd.org/changeset/base/353664 Log: Port r353622 to sparc64 and arm v4. Noted by: alc Reviewed by: alc, jeff, markj Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D22056 Modified: head/sys/arm/arm/pmap-v4.c head/sys/arm/include/pmap.h head/sys/sparc64/include/pmap.h head/sys/sparc64/sparc64/pmap.c Modified: head/sys/arm/arm/pmap-v4.c ============================================================================== --- head/sys/arm/arm/pmap-v4.c Wed Oct 16 18:33:31 2019 (r353663) +++ head/sys/arm/arm/pmap-v4.c Wed Oct 16 21:07:18 2019 (r353664) @@ -2979,8 +2979,12 @@ pmap_enter_locked(pmap_t pmap, vm_offset_t va, vm_page pa = systempage.pv_pa; m = NULL; } else { - if ((m->oflags & VPO_UNMANAGED) == 0) - VM_PAGE_OBJECT_BUSY_ASSERT(m); + if ((m->oflags & VPO_UNMANAGED) == 0) { + if ((flags & PMAP_ENTER_QUICK_LOCKED) == 0) + VM_PAGE_OBJECT_BUSY_ASSERT(m); + else + VM_OBJECT_ASSERT_LOCKED(m->object); + } pa = VM_PAGE_TO_PHYS(m); } nflags = 0; @@ -3253,7 +3257,8 @@ pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_o PMAP_LOCK(pmap); while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { pmap_enter_locked(pmap, start + ptoa(diff), m, prot & - (VM_PROT_READ | VM_PROT_EXECUTE), PMAP_ENTER_NOSLEEP); + (VM_PROT_READ | VM_PROT_EXECUTE), PMAP_ENTER_NOSLEEP | + PMAP_ENTER_QUICK_LOCKED); m = TAILQ_NEXT(m, listq); } rw_wunlock(&pvh_global_lock); @@ -3276,7 +3281,7 @@ pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_ rw_wlock(&pvh_global_lock); PMAP_LOCK(pmap); pmap_enter_locked(pmap, va, m, prot & (VM_PROT_READ | VM_PROT_EXECUTE), - PMAP_ENTER_NOSLEEP); + PMAP_ENTER_NOSLEEP | PMAP_ENTER_QUICK_LOCKED); rw_wunlock(&pvh_global_lock); PMAP_UNLOCK(pmap); } Modified: head/sys/arm/include/pmap.h ============================================================================== --- head/sys/arm/include/pmap.h Wed Oct 16 18:33:31 2019 (r353663) +++ head/sys/arm/include/pmap.h Wed Oct 16 21:07:18 2019 (r353664) @@ -75,5 +75,7 @@ pmap_vmspace_copy(pmap_t dst_pmap __unused, pmap_t src return (0); } +#define PMAP_ENTER_QUICK_LOCKED 0x10000000 + #endif /* _KERNEL */ #endif /* !_MACHINE_PMAP_H_ */ Modified: head/sys/sparc64/include/pmap.h ============================================================================== --- head/sys/sparc64/include/pmap.h Wed Oct 16 18:33:31 2019 (r353663) +++ head/sys/sparc64/include/pmap.h Wed Oct 16 21:07:18 2019 (r353664) @@ -50,6 +50,7 @@ #include #define PMAP_CONTEXT_MAX 8192 +#define PMAP_ENTER_QUICK_LOCKED 0x10000000 typedef struct pmap *pmap_t; Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Wed Oct 16 18:33:31 2019 (r353663) +++ head/sys/sparc64/sparc64/pmap.c Wed Oct 16 21:07:18 2019 (r353664) @@ -1500,8 +1500,12 @@ pmap_enter_locked(pmap_t pm, vm_offset_t va, vm_page_t rw_assert(&tte_list_global_lock, RA_WLOCKED); PMAP_LOCK_ASSERT(pm, MA_OWNED); - if ((m->oflags & VPO_UNMANAGED) == 0) - VM_PAGE_OBJECT_BUSY_ASSERT(m); + if ((m->oflags & VPO_UNMANAGED) == 0) { + if ((flags & PMAP_ENTER_QUICK_LOCKED) == 0) + VM_PAGE_OBJECT_BUSY_ASSERT(m); + else + VM_OBJECT_ASSERT_LOCKED(m->object); + } PMAP_STATS_INC(pmap_nenter); pa = VM_PAGE_TO_PHYS(m); wired = (flags & PMAP_ENTER_WIRED) != 0; @@ -1649,7 +1653,8 @@ pmap_enter_object(pmap_t pm, vm_offset_t start, vm_off PMAP_LOCK(pm); while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { pmap_enter_locked(pm, start + ptoa(diff), m, prot & - (VM_PROT_READ | VM_PROT_EXECUTE), 0, 0); + (VM_PROT_READ | VM_PROT_EXECUTE), + PMAP_ENTER_QUICK_LOCKED, 0); m = TAILQ_NEXT(m, listq); } rw_wunlock(&tte_list_global_lock); @@ -1663,7 +1668,7 @@ pmap_enter_quick(pmap_t pm, vm_offset_t va, vm_page_t rw_wlock(&tte_list_global_lock); PMAP_LOCK(pm); pmap_enter_locked(pm, va, m, prot & (VM_PROT_READ | VM_PROT_EXECUTE), - 0, 0); + PMAP_ENTER_QUICK_LOCKED, 0); rw_wunlock(&tte_list_global_lock); PMAP_UNLOCK(pm); } From owner-svn-src-all@freebsd.org Wed Oct 16 21:46:49 2019 Return-Path: Delivered-To: svn-src-all@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 E4A57150BA6; Wed, 16 Oct 2019 21:46:49 +0000 (UTC) (envelope-from erj@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 46tm8n5Pkgz4JLQ; Wed, 16 Oct 2019 21:46:49 +0000 (UTC) (envelope-from erj@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 9E674D6B3; Wed, 16 Oct 2019 21:46:49 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9GLknRM027212; Wed, 16 Oct 2019 21:46:49 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GLknlB027211; Wed, 16 Oct 2019 21:46:49 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201910162146.x9GLknlB027211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Wed, 16 Oct 2019 21:46:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r353665 - releng/12.1/sys/dev/ixgbe X-SVN-Group: releng X-SVN-Commit-Author: erj X-SVN-Commit-Paths: releng/12.1/sys/dev/ixgbe X-SVN-Commit-Revision: 353665 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 21:46:50 -0000 Author: erj Date: Wed Oct 16 21:46:49 2019 New Revision: 353665 URL: https://svnweb.freebsd.org/changeset/base/353665 Log: MFC r353660: ixgbe: Disable EEE for backplane X550EM_X This prevents a kernel panic when configuring EEE on X552 devices. PR: 240320 Approved by: re@ (gjb@) Sponsored by: Intel Corporation Modified: releng/12.1/sys/dev/ixgbe/if_ix.c Directory Properties: releng/12.1/ (props changed) Modified: releng/12.1/sys/dev/ixgbe/if_ix.c ============================================================================== --- releng/12.1/sys/dev/ixgbe/if_ix.c Wed Oct 16 21:07:18 2019 (r353664) +++ releng/12.1/sys/dev/ixgbe/if_ix.c Wed Oct 16 21:46:49 2019 (r353665) @@ -4416,7 +4416,7 @@ ixgbe_sysctl_eee_state(SYSCTL_HANDLER_ARGS) if ((new_eee < 0) || (new_eee > 1)) return (EINVAL); - retval = adapter->hw.mac.ops.setup_eee(&adapter->hw, new_eee); + retval = ixgbe_setup_eee(&adapter->hw, new_eee); if (retval) { device_printf(dev, "Error in EEE setup: 0x%08X\n", retval); return (EINVAL); @@ -4469,8 +4469,6 @@ ixgbe_init_device_features(struct adapter *adapter) case ixgbe_mac_X550EM_x: adapter->feat_cap |= IXGBE_FEATURE_SRIOV; adapter->feat_cap |= IXGBE_FEATURE_FDIR; - if (adapter->hw.device_id == IXGBE_DEV_ID_X550EM_X_KR) - adapter->feat_cap |= IXGBE_FEATURE_EEE; break; case ixgbe_mac_X550EM_a: adapter->feat_cap |= IXGBE_FEATURE_SRIOV; From owner-svn-src-all@freebsd.org Wed Oct 16 21:47:59 2019 Return-Path: Delivered-To: svn-src-all@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 948D0150C98; Wed, 16 Oct 2019 21:47:59 +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 46tmB73NlXz4JWj; Wed, 16 Oct 2019 21:47:59 +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 57905D6DF; Wed, 16 Oct 2019 21:47:59 +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 x9GLlxkb027319; Wed, 16 Oct 2019 21:47:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GLlxPZ027318; Wed, 16 Oct 2019 21:47:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910162147.x9GLlxPZ027318@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 16 Oct 2019 21:47:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353666 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353666 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 21:47:59 -0000 Author: markj Date: Wed Oct 16 21:47:58 2019 New Revision: 353666 URL: https://svnweb.freebsd.org/changeset/base/353666 Log: Correct the range boundaries used by kern_mincore(). Reported by: alc Sponsored by: Netflix Modified: head/sys/vm/vm_mmap.c Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Wed Oct 16 21:46:49 2019 (r353665) +++ head/sys/vm/vm_mmap.c Wed Oct 16 21:47:58 2019 (r353666) @@ -800,7 +800,7 @@ kern_mincore(struct thread *td, uintptr_t addr0, size_ * mode. */ first_addr = addr = trunc_page(addr0); - end = addr + (vm_size_t)round_page(len); + end = round_page(addr0 + len); map = &td->td_proc->p_vmspace->vm_map; if (end > vm_map_max(map) || end < addr) return (ENOMEM); From owner-svn-src-all@freebsd.org Wed Oct 16 21:49:40 2019 Return-Path: Delivered-To: svn-src-all@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 B3FCB150DD2; Wed, 16 Oct 2019 21:49:40 +0000 (UTC) (envelope-from chs@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 46tmD44DG4z4JmV; Wed, 16 Oct 2019 21:49:40 +0000 (UTC) (envelope-from chs@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 7506BD6E4; Wed, 16 Oct 2019 21:49:40 +0000 (UTC) (envelope-from chs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9GLneCr027549; Wed, 16 Oct 2019 21:49:40 GMT (envelope-from chs@FreeBSD.org) Received: (from chs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GLne2i027547; Wed, 16 Oct 2019 21:49:40 GMT (envelope-from chs@FreeBSD.org) Message-Id: <201910162149.x9GLne2i027547@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chs set sender to chs@FreeBSD.org using -f From: Chuck Silvers Date: Wed, 16 Oct 2019 21:49:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353667 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: chs X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 353667 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 21:49:40 -0000 Author: chs Date: Wed Oct 16 21:49:39 2019 New Revision: 353667 URL: https://svnweb.freebsd.org/changeset/base/353667 Log: Add a new gctl_get_paraml_opt() interface to extract optional parameters from the request. It is the same as gctl_get_paraml() except that the request is not marked with an error if the parameter is not present. Approved by: imp (mentor) Reviewed by: cem Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21972 Modified: head/sys/geom/geom.h head/sys/geom/geom_ctl.c Modified: head/sys/geom/geom.h ============================================================================== --- head/sys/geom/geom.h Wed Oct 16 21:47:58 2019 (r353666) +++ head/sys/geom/geom.h Wed Oct 16 21:49:39 2019 (r353667) @@ -428,6 +428,7 @@ void gctl_set_param_err(struct gctl_req *req, const ch void *gctl_get_param(struct gctl_req *req, const char *param, int *len); char const *gctl_get_asciiparam(struct gctl_req *req, const char *param); void *gctl_get_paraml(struct gctl_req *req, const char *param, int len); +void *gctl_get_paraml_opt(struct gctl_req *req, const char *param, int len); int gctl_error(struct gctl_req *req, const char *fmt, ...) __printflike(2, 3); struct g_class *gctl_get_class(struct gctl_req *req, char const *arg); struct g_geom *gctl_get_geom(struct gctl_req *req, struct g_class *mpr, char const *arg); Modified: head/sys/geom/geom_ctl.c ============================================================================== --- head/sys/geom/geom_ctl.c Wed Oct 16 21:47:58 2019 (r353666) +++ head/sys/geom/geom_ctl.c Wed Oct 16 21:49:39 2019 (r353667) @@ -365,18 +365,27 @@ gctl_get_asciiparam(struct gctl_req *req, const char * } void * -gctl_get_paraml(struct gctl_req *req, const char *param, int len) +gctl_get_paraml_opt(struct gctl_req *req, const char *param, int len) { int i; void *p; p = gctl_get_param(req, param, &i); - if (p == NULL) - gctl_error(req, "Missing %s argument", param); - else if (i != len) { + if (i != len) { p = NULL; gctl_error(req, "Wrong length %s argument", param); } + return (p); +} + +void * +gctl_get_paraml(struct gctl_req *req, const char *param, int len) +{ + void *p; + + p = gctl_get_paraml_opt(req, param, len); + if (p == NULL) + gctl_error(req, "Missing %s argument", param); return (p); } From owner-svn-src-all@freebsd.org Wed Oct 16 21:49:44 2019 Return-Path: Delivered-To: svn-src-all@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 CD890150DF6; Wed, 16 Oct 2019 21:49:44 +0000 (UTC) (envelope-from chs@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 46tmD858Gmz4JpQ; Wed, 16 Oct 2019 21:49:44 +0000 (UTC) (envelope-from chs@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 7D280D6E5; Wed, 16 Oct 2019 21:49:44 +0000 (UTC) (envelope-from chs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9GLni2J027599; Wed, 16 Oct 2019 21:49:44 GMT (envelope-from chs@FreeBSD.org) Received: (from chs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GLniRL027598; Wed, 16 Oct 2019 21:49:44 GMT (envelope-from chs@FreeBSD.org) Message-Id: <201910162149.x9GLniRL027598@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chs set sender to chs@FreeBSD.org using -f From: Chuck Silvers Date: Wed, 16 Oct 2019 21:49:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353668 - head/sys/geom/nop X-SVN-Group: head X-SVN-Commit-Author: chs X-SVN-Commit-Paths: head/sys/geom/nop X-SVN-Commit-Revision: 353668 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 21:49:44 -0000 Author: chs Date: Wed Oct 16 21:49:44 2019 New Revision: 353668 URL: https://svnweb.freebsd.org/changeset/base/353668 Log: Make all the gnop parameters optional in the request from userland, filling in the same defaults that the current userland module uses. This allows an old geom_nop.so userland module to work with a new kernel. Approved by: imp (mentor) Reviewed by: cem Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21972 Modified: head/sys/geom/nop/g_nop.c Modified: head/sys/geom/nop/g_nop.c ============================================================================== --- head/sys/geom/nop/g_nop.c Wed Oct 16 21:49:39 2019 (r353667) +++ head/sys/geom/nop/g_nop.c Wed Oct 16 21:49:44 2019 (r353668) @@ -497,15 +497,28 @@ static void g_nop_ctl_create(struct gctl_req *req, struct g_class *mp) { struct g_provider *pp; - intmax_t *error, *rfailprob, *wfailprob, *count_until_fail, *offset, - *secsize, *size, *stripesize, *stripeoffset, *delaymsec, - *rdelayprob, *wdelayprob; + intmax_t *val, error, rfailprob, wfailprob, count_until_fail, offset, + secsize, size, stripesize, stripeoffset, delaymsec, + rdelayprob, wdelayprob; const char *name, *physpath; char param[16]; int i, *nargs; g_topology_assert(); + error = -1; + rfailprob = -1; + wfailprob = -1; + count_until_fail = -1; + offset = 0; + secsize = 0; + size = 0; + stripesize = 0; + stripeoffset = 0; + delaymsec = -1; + rdelayprob = -1; + wdelayprob = -1; + nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs)); if (nargs == NULL) { gctl_error(req, "No '%s' argument", "nargs"); @@ -515,111 +528,100 @@ g_nop_ctl_create(struct gctl_req *req, struct g_class gctl_error(req, "Missing device(s)."); return; } - error = gctl_get_paraml(req, "error", sizeof(*error)); - if (error == NULL) { - gctl_error(req, "No '%s' argument", "error"); - return; + val = gctl_get_paraml_opt(req, "error", sizeof(*val)); + if (val != NULL) { + error = *val; } - rfailprob = gctl_get_paraml(req, "rfailprob", sizeof(*rfailprob)); - if (rfailprob == NULL) { - gctl_error(req, "No '%s' argument", "rfailprob"); - return; + val = gctl_get_paraml_opt(req, "rfailprob", sizeof(*val)); + if (val != NULL) { + rfailprob = *val; + if (rfailprob < -1 || rfailprob > 100) { + gctl_error(req, "Invalid '%s' argument", "rfailprob"); + return; + } } - if (*rfailprob < -1 || *rfailprob > 100) { - gctl_error(req, "Invalid '%s' argument", "rfailprob"); - return; + val = gctl_get_paraml_opt(req, "wfailprob", sizeof(*val)); + if (val != NULL) { + wfailprob = *val; + if (wfailprob < -1 || wfailprob > 100) { + gctl_error(req, "Invalid '%s' argument", "wfailprob"); + return; + } } - wfailprob = gctl_get_paraml(req, "wfailprob", sizeof(*wfailprob)); - if (wfailprob == NULL) { - gctl_error(req, "No '%s' argument", "wfailprob"); - return; + val = gctl_get_paraml_opt(req, "delaymsec", sizeof(*val)); + if (val != NULL) { + delaymsec = *val; + if (delaymsec < 1 && delaymsec != -1) { + gctl_error(req, "Invalid '%s' argument", "delaymsec"); + return; + } } - if (*wfailprob < -1 || *wfailprob > 100) { - gctl_error(req, "Invalid '%s' argument", "wfailprob"); - return; + val = gctl_get_paraml_opt(req, "rdelayprob", sizeof(*val)); + if (val != NULL) { + rdelayprob = *val; + if (rdelayprob < -1 || rdelayprob > 100) { + gctl_error(req, "Invalid '%s' argument", "rdelayprob"); + return; + } } - delaymsec = gctl_get_paraml(req, "delaymsec", sizeof(*delaymsec)); - if (delaymsec == NULL) { - gctl_error(req, "No '%s' argument", "delaymsec"); - return; + val = gctl_get_paraml_opt(req, "wdelayprob", sizeof(*val)); + if (val != NULL) { + wdelayprob = *val; + if (wdelayprob < -1 || wdelayprob > 100) { + gctl_error(req, "Invalid '%s' argument", "wdelayprob"); + return; + } } - if (*delaymsec < 1 && *delaymsec != -1) { - gctl_error(req, "Invalid '%s' argument", "delaymsec"); - return; + val = gctl_get_paraml_opt(req, "count_until_fail", sizeof(*val)); + if (val != NULL) { + count_until_fail = *val; + if (count_until_fail < -1) { + gctl_error(req, "Invalid '%s' argument", + "count_until_fail"); + return; + } } - rdelayprob = gctl_get_paraml(req, "rdelayprob", sizeof(*rdelayprob)); - if (rdelayprob == NULL) { - gctl_error(req, "No '%s' argument", "rdelayprob"); - return; + val = gctl_get_paraml_opt(req, "offset", sizeof(*val)); + if (val != NULL) { + offset = *val; + if (offset < 0) { + gctl_error(req, "Invalid '%s' argument", "offset"); + return; + } } - if (*rdelayprob < -1 || *rdelayprob > 100) { - gctl_error(req, "Invalid '%s' argument", "rdelayprob"); - return; + val = gctl_get_paraml_opt(req, "size", sizeof(*val)); + if (val != NULL) { + size = *val; + if (size < 0) { + gctl_error(req, "Invalid '%s' argument", "size"); + return; + } } - wdelayprob = gctl_get_paraml(req, "wdelayprob", sizeof(*wdelayprob)); - if (wdelayprob == NULL) { - gctl_error(req, "No '%s' argument", "wdelayprob"); - return; + val = gctl_get_paraml_opt(req, "secsize", sizeof(*val)); + if (val != NULL) { + secsize = *val; + if (secsize < 0) { + gctl_error(req, "Invalid '%s' argument", "secsize"); + return; + } } - if (*wdelayprob < -1 || *wdelayprob > 100) { - gctl_error(req, "Invalid '%s' argument", "wdelayprob"); - return; + val = gctl_get_paraml_opt(req, "stripesize", sizeof(*val)); + if (val != NULL) { + stripesize = *val; + if (stripesize < 0) { + gctl_error(req, "Invalid '%s' argument", "stripesize"); + return; + } } - count_until_fail = gctl_get_paraml(req, "count_until_fail", - sizeof(*count_until_fail)); - if (count_until_fail == NULL) { - gctl_error(req, "No '%s' argument", "count_until_fail"); - return; + val = gctl_get_paraml_opt(req, "stripeoffset", sizeof(*val)); + if (val != NULL) { + stripeoffset = *val; + if (stripeoffset < 0) { + gctl_error(req, "Invalid '%s' argument", + "stripeoffset"); + return; + } } - if (*count_until_fail < -1) { - gctl_error(req, "Invalid '%s' argument", "count_until_fail"); - return; - } - offset = gctl_get_paraml(req, "offset", sizeof(*offset)); - if (offset == NULL) { - gctl_error(req, "No '%s' argument", "offset"); - return; - } - if (*offset < 0) { - gctl_error(req, "Invalid '%s' argument", "offset"); - return; - } - size = gctl_get_paraml(req, "size", sizeof(*size)); - if (size == NULL) { - gctl_error(req, "No '%s' argument", "size"); - return; - } - if (*size < 0) { - gctl_error(req, "Invalid '%s' argument", "size"); - return; - } - secsize = gctl_get_paraml(req, "secsize", sizeof(*secsize)); - if (secsize == NULL) { - gctl_error(req, "No '%s' argument", "secsize"); - return; - } - if (*secsize < 0) { - gctl_error(req, "Invalid '%s' argument", "secsize"); - return; - } - stripesize = gctl_get_paraml(req, "stripesize", sizeof(*stripesize)); - if (stripesize == NULL) { - gctl_error(req, "No '%s' argument", "stripesize"); - return; - } - if (*stripesize < 0) { - gctl_error(req, "Invalid '%s' argument", "stripesize"); - return; - } - stripeoffset = gctl_get_paraml(req, "stripeoffset", sizeof(*stripeoffset)); - if (stripeoffset == NULL) { - gctl_error(req, "No '%s' argument", "stripeoffset"); - return; - } - if (*stripeoffset < 0) { - gctl_error(req, "Invalid '%s' argument", "stripeoffset"); - return; - } physpath = gctl_get_asciiparam(req, "physpath"); for (i = 0; i < *nargs; i++) { @@ -638,15 +640,15 @@ g_nop_ctl_create(struct gctl_req *req, struct g_class return; } if (g_nop_create(req, mp, pp, - *error == -1 ? EIO : (int)*error, - *count_until_fail == -1 ? 0 : (u_int)*count_until_fail, - *rfailprob == -1 ? 0 : (u_int)*rfailprob, - *wfailprob == -1 ? 0 : (u_int)*wfailprob, - *delaymsec == -1 ? 1 : (u_int)*delaymsec, - *rdelayprob == -1 ? 0 : (u_int)*rdelayprob, - *wdelayprob == -1 ? 0 : (u_int)*wdelayprob, - (off_t)*offset, (off_t)*size, (u_int)*secsize, - (off_t)*stripesize, (off_t)*stripeoffset, + error == -1 ? EIO : (int)error, + count_until_fail == -1 ? 0 : (u_int)count_until_fail, + rfailprob == -1 ? 0 : (u_int)rfailprob, + wfailprob == -1 ? 0 : (u_int)wfailprob, + delaymsec == -1 ? 1 : (u_int)delaymsec, + rdelayprob == -1 ? 0 : (u_int)rdelayprob, + wdelayprob == -1 ? 0 : (u_int)wdelayprob, + (off_t)offset, (off_t)size, (u_int)secsize, + (off_t)stripesize, (off_t)stripeoffset, physpath) != 0) { return; } @@ -658,14 +660,22 @@ g_nop_ctl_configure(struct gctl_req *req, struct g_cla { struct g_nop_softc *sc; struct g_provider *pp; - intmax_t *delaymsec, *error, *rdelayprob, *rfailprob, *wdelayprob, - *wfailprob, *count_until_fail; + intmax_t *val, delaymsec, error, rdelayprob, rfailprob, wdelayprob, + wfailprob, count_until_fail; const char *name; char param[16]; int i, *nargs; g_topology_assert(); + count_until_fail = -1; + delaymsec = -1; + error = -1; + rdelayprob = -1; + rfailprob = -1; + wdelayprob = -1; + wfailprob = -1; + nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs)); if (nargs == NULL) { gctl_error(req, "No '%s' argument", "nargs"); @@ -675,63 +685,54 @@ g_nop_ctl_configure(struct gctl_req *req, struct g_cla gctl_error(req, "Missing device(s)."); return; } - error = gctl_get_paraml(req, "error", sizeof(*error)); - if (error == NULL) { - gctl_error(req, "No '%s' argument", "error"); - return; + val = gctl_get_paraml_opt(req, "error", sizeof(*val)); + if (val != NULL) { + error = *val; } - count_until_fail = gctl_get_paraml(req, "count_until_fail", - sizeof(*count_until_fail)); - if (count_until_fail == NULL) { - gctl_error(req, "No '%s' argument", "count_until_fail"); - return; + val = gctl_get_paraml_opt(req, "count_until_fail", sizeof(*val)); + if (val != NULL) { + count_until_fail = *val; } - rfailprob = gctl_get_paraml(req, "rfailprob", sizeof(*rfailprob)); - if (rfailprob == NULL) { - gctl_error(req, "No '%s' argument", "rfailprob"); - return; + val = gctl_get_paraml_opt(req, "rfailprob", sizeof(*val)); + if (val != NULL) { + rfailprob = *val; + if (rfailprob < -1 || rfailprob > 100) { + gctl_error(req, "Invalid '%s' argument", "rfailprob"); + return; + } } - if (*rfailprob < -1 || *rfailprob > 100) { - gctl_error(req, "Invalid '%s' argument", "rfailprob"); - return; + val = gctl_get_paraml_opt(req, "wfailprob", sizeof(*val)); + if (val != NULL) { + wfailprob = *val; + if (wfailprob < -1 || wfailprob > 100) { + gctl_error(req, "Invalid '%s' argument", "wfailprob"); + return; + } } - wfailprob = gctl_get_paraml(req, "wfailprob", sizeof(*wfailprob)); - if (wfailprob == NULL) { - gctl_error(req, "No '%s' argument", "wfailprob"); - return; + val = gctl_get_paraml_opt(req, "delaymsec", sizeof(*val)); + if (val != NULL) { + delaymsec = *val; + if (delaymsec < 1 && delaymsec != -1) { + gctl_error(req, "Invalid '%s' argument", "delaymsec"); + return; + } } - if (*wfailprob < -1 || *wfailprob > 100) { - gctl_error(req, "Invalid '%s' argument", "wfailprob"); - return; + val = gctl_get_paraml_opt(req, "rdelayprob", sizeof(*val)); + if (val != NULL) { + rdelayprob = *val; + if (rdelayprob < -1 || rdelayprob > 100) { + gctl_error(req, "Invalid '%s' argument", "rdelayprob"); + return; + } } - - delaymsec = gctl_get_paraml(req, "delaymsec", sizeof(*delaymsec)); - if (delaymsec == NULL) { - gctl_error(req, "No '%s' argument", "delaymsec"); - return; + val = gctl_get_paraml_opt(req, "wdelayprob", sizeof(*val)); + if (val != NULL) { + wdelayprob = *val; + if (wdelayprob < -1 || wdelayprob > 100) { + gctl_error(req, "Invalid '%s' argument", "wdelayprob"); + return; + } } - if (*delaymsec < 1 && *delaymsec != -1) { - gctl_error(req, "Invalid '%s' argument", "delaymsec"); - return; - } - rdelayprob = gctl_get_paraml(req, "rdelayprob", sizeof(*rdelayprob)); - if (rdelayprob == NULL) { - gctl_error(req, "No '%s' argument", "rdelayprob"); - return; - } - if (*rdelayprob < -1 || *rdelayprob > 100) { - gctl_error(req, "Invalid '%s' argument", "rdelayprob"); - return; - } - wdelayprob = gctl_get_paraml(req, "wdelayprob", sizeof(*wdelayprob)); - if (wdelayprob == NULL) { - gctl_error(req, "No '%s' argument", "wdelayprob"); - return; - } - if (*wdelayprob < -1 || *wdelayprob > 100) { - gctl_error(req, "Invalid '%s' argument", "wdelayprob"); - return; - } for (i = 0; i < *nargs; i++) { snprintf(param, sizeof(param), "arg%d", i); @@ -749,20 +750,20 @@ g_nop_ctl_configure(struct gctl_req *req, struct g_cla return; } sc = pp->geom->softc; - if (*error != -1) - sc->sc_error = (int)*error; - if (*rfailprob != -1) - sc->sc_rfailprob = (u_int)*rfailprob; - if (*wfailprob != -1) - sc->sc_wfailprob = (u_int)*wfailprob; - if (*rdelayprob != -1) - sc->sc_rdelayprob = (u_int)*rdelayprob; - if (*wdelayprob != -1) - sc->sc_wdelayprob = (u_int)*wdelayprob; - if (*delaymsec != -1) - sc->sc_delaymsec = (u_int)*delaymsec; - if (*count_until_fail != -1) - sc->sc_count_until_fail = (u_int)*count_until_fail; + if (error != -1) + sc->sc_error = (int)error; + if (rfailprob != -1) + sc->sc_rfailprob = (u_int)rfailprob; + if (wfailprob != -1) + sc->sc_wfailprob = (u_int)wfailprob; + if (rdelayprob != -1) + sc->sc_rdelayprob = (u_int)rdelayprob; + if (wdelayprob != -1) + sc->sc_wdelayprob = (u_int)wdelayprob; + if (delaymsec != -1) + sc->sc_delaymsec = (u_int)delaymsec; + if (count_until_fail != -1) + sc->sc_count_until_fail = (u_int)count_until_fail; } } From owner-svn-src-all@freebsd.org Wed Oct 16 21:54:49 2019 Return-Path: Delivered-To: svn-src-all@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 6601E15112C; Wed, 16 Oct 2019 21:54:49 +0000 (UTC) (envelope-from erj@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 46tmL1237Xz4KPG; Wed, 16 Oct 2019 21:54:49 +0000 (UTC) (envelope-from erj@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 2AE92D8A1; Wed, 16 Oct 2019 21:54:49 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9GLsn9L033066; Wed, 16 Oct 2019 21:54:49 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GLsnix033065; Wed, 16 Oct 2019 21:54:49 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201910162154.x9GLsnix033065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Wed, 16 Oct 2019 21:54:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353669 - stable/11/sys/dev/ixgbe X-SVN-Group: stable-11 X-SVN-Commit-Author: erj X-SVN-Commit-Paths: stable/11/sys/dev/ixgbe X-SVN-Commit-Revision: 353669 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 21:54:49 -0000 Author: erj Date: Wed Oct 16 21:54:48 2019 New Revision: 353669 URL: https://svnweb.freebsd.org/changeset/base/353669 Log: MFC r353599 MFCs ixgbe: Disable EEE for backplane X550EM_X This prevents a possible kernel panic on X552 backplane devices. PR: 240320 Sponsored by: Intel Corporation Modified: stable/11/sys/dev/ixgbe/if_ix.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ixgbe/if_ix.c ============================================================================== --- stable/11/sys/dev/ixgbe/if_ix.c Wed Oct 16 21:49:44 2019 (r353668) +++ stable/11/sys/dev/ixgbe/if_ix.c Wed Oct 16 21:54:48 2019 (r353669) @@ -4591,7 +4591,7 @@ ixgbe_sysctl_eee_state(SYSCTL_HANDLER_ARGS) if ((new_eee < 0) || (new_eee > 1)) return (EINVAL); - retval = adapter->hw.mac.ops.setup_eee(&adapter->hw, new_eee); + retval = ixgbe_setup_eee(&adapter->hw, new_eee); if (retval) { device_printf(dev, "Error in EEE setup: 0x%08X\n", retval); return (EINVAL); @@ -4645,8 +4645,6 @@ ixgbe_init_device_features(struct adapter *adapter) case ixgbe_mac_X550EM_x: adapter->feat_cap |= IXGBE_FEATURE_SRIOV; adapter->feat_cap |= IXGBE_FEATURE_FDIR; - if (adapter->hw.device_id == IXGBE_DEV_ID_X550EM_X_KR) - adapter->feat_cap |= IXGBE_FEATURE_EEE; break; case ixgbe_mac_X550EM_a: adapter->feat_cap |= IXGBE_FEATURE_SRIOV; From owner-svn-src-all@freebsd.org Wed Oct 16 22:03:31 2019 Return-Path: Delivered-To: svn-src-all@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 98ACF1514FD; Wed, 16 Oct 2019 22:03:31 +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 46tmX34JCJz4LBj; Wed, 16 Oct 2019 22:03:31 +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 76CA5DA8A; Wed, 16 Oct 2019 22:03:31 +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 x9GM3VhV039570; Wed, 16 Oct 2019 22:03:31 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GM3SSx039553; Wed, 16 Oct 2019 22:03:28 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910162203.x9GM3SSx039553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 16 Oct 2019 22:03:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353670 - in head/sys: amd64/amd64 arm/arm arm64/arm64 i386/i386 kern mips/mips powerpc/booke powerpc/powerpc riscv/riscv sparc64/sparc64 vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: amd64/amd64 arm/arm arm64/arm64 i386/i386 kern mips/mips powerpc/booke powerpc/powerpc riscv/riscv sparc64/sparc64 vm X-SVN-Commit-Revision: 353670 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 22:03:31 -0000 Author: markj Date: Wed Oct 16 22:03:27 2019 New Revision: 353670 URL: https://svnweb.freebsd.org/changeset/base/353670 Log: Remove page locking from pmap_mincore(). After r352110 the page lock no longer protects a page's identity, so there is no purpose in locking the page in pmap_mincore(). Instead, if vm.mincore_mapped is set to the non-default value of 0, re-lookup the page after acquiring its object lock, which holds the page's identity stable. The change removes the last callers of vm_page_pa_tryrelock(), so remove it. Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21823 Modified: head/sys/amd64/amd64/pmap.c head/sys/arm/arm/pmap-v4.c head/sys/arm/arm/pmap-v6.c head/sys/arm64/arm64/pmap.c head/sys/i386/i386/pmap.c head/sys/i386/i386/pmap_base.c head/sys/kern/kern_proc.c head/sys/mips/mips/pmap.c head/sys/powerpc/booke/pmap.c head/sys/powerpc/powerpc/mmu_if.m head/sys/powerpc/powerpc/pmap_dispatch.c head/sys/riscv/riscv/pmap.c head/sys/sparc64/sparc64/pmap.c head/sys/vm/pmap.h head/sys/vm/vm_mmap.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Oct 16 21:54:48 2019 (r353669) +++ head/sys/amd64/amd64/pmap.c Wed Oct 16 22:03:27 2019 (r353670) @@ -8433,10 +8433,12 @@ pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, boole } /* - * perform the pmap work for mincore + * Perform the pmap work for mincore(2). If the page is not both referenced and + * modified by this pmap, returns its physical address so that the caller can + * find other mappings. */ int -pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) +pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap) { pd_entry_t *pdep; pt_entry_t pte, PG_A, PG_M, PG_RW, PG_V; @@ -8449,7 +8451,6 @@ pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t PG_RW = pmap_rw_bit(pmap); PMAP_LOCK(pmap); -retry: pdep = pmap_pde(pmap, addr); if (pdep != NULL && (*pdep & PG_V)) { if (*pdep & PG_PS) { @@ -8478,11 +8479,8 @@ retry: if ((val & (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER)) != (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER) && (pte & (PG_MANAGED | PG_V)) == (PG_MANAGED | PG_V)) { - /* Ensure that "PHYS_TO_VM_PAGE(pa)->object" doesn't change. */ - if (vm_page_pa_tryrelock(pmap, pa, locked_pa)) - goto retry; - } else - PA_UNLOCK_COND(*locked_pa); + *pap = pa; + } PMAP_UNLOCK(pmap); return (val); } Modified: head/sys/arm/arm/pmap-v4.c ============================================================================== --- head/sys/arm/arm/pmap-v4.c Wed Oct 16 21:54:48 2019 (r353669) +++ head/sys/arm/arm/pmap-v4.c Wed Oct 16 22:03:27 2019 (r353670) @@ -4142,10 +4142,12 @@ pmap_remove_write(vm_page_t m) /* - * perform the pmap work for mincore + * Perform the pmap work for mincore(2). If the page is not both referenced and + * modified by this pmap, returns its physical address so that the caller can + * find other mappings. */ int -pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) +pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap) { struct l2_bucket *l2b; pt_entry_t *ptep, pte; @@ -4155,17 +4157,16 @@ pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t boolean_t managed; PMAP_LOCK(pmap); -retry: l2b = pmap_get_l2_bucket(pmap, addr); if (l2b == NULL) { - val = 0; - goto out; + PMAP_UNLOCK(pmap); + return (0); } ptep = &l2b->l2b_kva[l2pte_index(addr)]; pte = *ptep; if (!l2pte_valid(pte)) { - val = 0; - goto out; + PMAP_UNLOCK(pmap); + return (0); } val = MINCORE_INCORE; if (pte & L2_S_PROT_W) @@ -4192,12 +4193,8 @@ retry: } if ((val & (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER)) != (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER) && managed) { - /* Ensure that "PHYS_TO_VM_PAGE(pa)->object" doesn't change. */ - if (vm_page_pa_tryrelock(pmap, pa, locked_pa)) - goto retry; - } else -out: - PA_UNLOCK_COND(*locked_pa); + *pap = pa; + } PMAP_UNLOCK(pmap); return (val); } Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Wed Oct 16 21:54:48 2019 (r353669) +++ head/sys/arm/arm/pmap-v6.c Wed Oct 16 22:03:27 2019 (r353670) @@ -6217,10 +6217,12 @@ pmap_activate(struct thread *td) } /* - * Perform the pmap work for mincore. + * Perform the pmap work for mincore(2). If the page is not both referenced and + * modified by this pmap, returns its physical address so that the caller can + * find other mappings. */ int -pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) +pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap) { pt1_entry_t *pte1p, pte1; pt2_entry_t *pte2p, pte2; @@ -6229,7 +6231,6 @@ pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t int val; PMAP_LOCK(pmap); -retry: pte1p = pmap_pte1(pmap, addr); pte1 = pte1_load(pte1p); if (pte1_is_section(pte1)) { @@ -6257,11 +6258,8 @@ retry: } if ((val & (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER)) != (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER) && managed) { - /* Ensure that "PHYS_TO_VM_PAGE(pa)->object" doesn't change. */ - if (vm_page_pa_tryrelock(pmap, pa, locked_pa)) - goto retry; - } else - PA_UNLOCK_COND(*locked_pa); + *pap = pa; + } PMAP_UNLOCK(pmap); return (val); } Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Wed Oct 16 21:54:48 2019 (r353669) +++ head/sys/arm64/arm64/pmap.c Wed Oct 16 22:03:27 2019 (r353670) @@ -5607,10 +5607,12 @@ pmap_demote_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_ } /* - * perform the pmap work for mincore + * Perform the pmap work for mincore(2). If the page is not both referenced and + * modified by this pmap, returns its physical address so that the caller can + * find other mappings. */ int -pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) +pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap) { pt_entry_t *pte, tpte; vm_paddr_t mask, pa; @@ -5618,8 +5620,6 @@ pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t bool managed; PMAP_LOCK(pmap); -retry: - val = 0; pte = pmap_pte(pmap, addr, &lvl); if (pte != NULL) { tpte = pmap_load(pte); @@ -5649,18 +5649,16 @@ retry: val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; pa = (tpte & ~ATTR_MASK) | (addr & mask); - } else + } else { managed = false; + val = 0; + } if ((val & (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER)) != (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER) && managed) { - /* Ensure that "PHYS_TO_VM_PAGE(pa)->object" doesn't change. */ - if (vm_page_pa_tryrelock(pmap, pa, locked_pa)) - goto retry; - } else - PA_UNLOCK_COND(*locked_pa); + *pap = pa; + } PMAP_UNLOCK(pmap); - return (val); } Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Wed Oct 16 21:54:48 2019 (r353669) +++ head/sys/i386/i386/pmap.c Wed Oct 16 22:03:27 2019 (r353670) @@ -5700,10 +5700,12 @@ __CONCAT(PMTYPE, change_attr)(vm_offset_t va, vm_size_ } /* - * perform the pmap work for mincore + * Perform the pmap work for mincore(2). If the page is not both referenced and + * modified by this pmap, returns its physical address so that the caller can + * find other mappings. */ static int -__CONCAT(PMTYPE, mincore)(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) +__CONCAT(PMTYPE, mincore)(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap) { pd_entry_t pde; pt_entry_t pte; @@ -5711,7 +5713,6 @@ __CONCAT(PMTYPE, mincore)(pmap_t pmap, vm_offset_t add int val; PMAP_LOCK(pmap); -retry: pde = *pmap_pde(pmap, addr); if (pde != 0) { if ((pde & PG_PS) != 0) { @@ -5740,11 +5741,8 @@ retry: if ((val & (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER)) != (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER) && (pte & (PG_MANAGED | PG_V)) == (PG_MANAGED | PG_V)) { - /* Ensure that "PHYS_TO_VM_PAGE(pa)->object" doesn't change. */ - if (vm_page_pa_tryrelock(pmap, pa, locked_pa)) - goto retry; - } else - PA_UNLOCK_COND(*locked_pa); + *pap = pa; + } PMAP_UNLOCK(pmap); return (val); } Modified: head/sys/i386/i386/pmap_base.c ============================================================================== --- head/sys/i386/i386/pmap_base.c Wed Oct 16 21:54:48 2019 (r353669) +++ head/sys/i386/i386/pmap_base.c Wed Oct 16 22:03:27 2019 (r353670) @@ -632,10 +632,10 @@ pmap_change_attr(vm_offset_t va, vm_size_t size, int m } int -pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) +pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap) { - return (pmap_methods_ptr->pm_mincore(pmap, addr, locked_pa)); + return (pmap_methods_ptr->pm_mincore(pmap, addr, pap)); } void Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Wed Oct 16 21:54:48 2019 (r353669) +++ head/sys/kern/kern_proc.c Wed Oct 16 22:03:27 2019 (r353670) @@ -2362,7 +2362,7 @@ kern_proc_vmmap_resident(vm_map_t map, vm_map_entry_t vm_object_t obj, tobj; vm_page_t m, m_adv; vm_offset_t addr; - vm_paddr_t locked_pa; + vm_paddr_t pa; vm_pindex_t pi, pi_adv, pindex; *super = false; @@ -2370,7 +2370,7 @@ kern_proc_vmmap_resident(vm_map_t map, vm_map_entry_t if (vmmap_skip_res_cnt) return; - locked_pa = 0; + pa = 0; obj = entry->object.vm_object; addr = entry->start; m_adv = NULL; @@ -2400,8 +2400,7 @@ kern_proc_vmmap_resident(vm_map_t map, vm_map_entry_t m_adv = NULL; if (m->psind != 0 && addr + pagesizes[1] <= entry->end && (addr & (pagesizes[1] - 1)) == 0 && - (pmap_mincore(map->pmap, addr, &locked_pa) & - MINCORE_SUPER) != 0) { + (pmap_mincore(map->pmap, addr, &pa) & MINCORE_SUPER) != 0) { *super = true; pi_adv = atop(pagesizes[1]); } else { @@ -2417,7 +2416,6 @@ kern_proc_vmmap_resident(vm_map_t map, vm_map_entry_t *resident_count += pi_adv; next:; } - PA_UNLOCK_COND(locked_pa); } /* Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Wed Oct 16 21:54:48 2019 (r353669) +++ head/sys/mips/mips/pmap.c Wed Oct 16 22:03:27 2019 (r353670) @@ -3193,10 +3193,12 @@ pmap_unmapdev(vm_offset_t va, vm_size_t size) } /* - * perform the pmap work for mincore + * Perform the pmap work for mincore(2). If the page is not both referenced and + * modified by this pmap, returns its physical address so that the caller can + * find other mappings. */ int -pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) +pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap) { pt_entry_t *ptep, pte; vm_paddr_t pa; @@ -3204,12 +3206,11 @@ pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t int val; PMAP_LOCK(pmap); -retry: ptep = pmap_pte(pmap, addr); pte = (ptep != NULL) ? *ptep : 0; if (!pte_test(&pte, PTE_V)) { - val = 0; - goto out; + PMAP_UNLOCK(pmap); + return (0); } val = MINCORE_INCORE; if (pte_test(&pte, PTE_D)) @@ -3229,12 +3230,8 @@ retry: if ((val & (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER)) != (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER) && pte_test(&pte, PTE_MANAGED)) { - /* Ensure that "PHYS_TO_VM_PAGE(pa)->object" doesn't change. */ - if (vm_page_pa_tryrelock(pmap, pa, locked_pa)) - goto retry; - } else -out: - PA_UNLOCK_COND(*locked_pa); + *pap = pa; + } PMAP_UNLOCK(pmap); return (val); } Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Wed Oct 16 21:54:48 2019 (r353669) +++ head/sys/powerpc/booke/pmap.c Wed Oct 16 22:03:27 2019 (r353670) @@ -3565,7 +3565,7 @@ mmu_booke_object_init_pt(mmu_t mmu, pmap_t pmap, vm_of */ static int mmu_booke_mincore(mmu_t mmu, pmap_t pmap, vm_offset_t addr, - vm_paddr_t *locked_pa) + vm_paddr_t *pap) { /* XXX: this should be implemented at some point */ Modified: head/sys/powerpc/powerpc/mmu_if.m ============================================================================== --- head/sys/powerpc/powerpc/mmu_if.m Wed Oct 16 21:54:48 2019 (r353669) +++ head/sys/powerpc/powerpc/mmu_if.m Wed Oct 16 22:03:27 2019 (r353670) @@ -91,7 +91,7 @@ CODE { } static int mmu_null_mincore(mmu_t mmu, pmap_t pmap, vm_offset_t addr, - vm_paddr_t *locked_pa) + vm_paddr_t *pap) { return (0); } @@ -679,7 +679,7 @@ METHOD void zero_page_area { * * @param _pmap physical map * @param _addr page virtual address - * @param _locked_pa page physical address + * @param _pa page physical address * * @retval 0 no result * @retval non-zero mincore(2) flag values @@ -688,7 +688,7 @@ METHOD int mincore { mmu_t _mmu; pmap_t _pmap; vm_offset_t _addr; - vm_paddr_t *_locked_pa; + vm_paddr_t *_pap; } DEFAULT mmu_null_mincore; Modified: head/sys/powerpc/powerpc/pmap_dispatch.c ============================================================================== --- head/sys/powerpc/powerpc/pmap_dispatch.c Wed Oct 16 21:54:48 2019 (r353669) +++ head/sys/powerpc/powerpc/pmap_dispatch.c Wed Oct 16 22:03:27 2019 (r353670) @@ -382,11 +382,11 @@ pmap_zero_page_area(vm_page_t m, int off, int size) } int -pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) +pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap) { CTR3(KTR_PMAP, "%s(%p, %#x)", __func__, pmap, addr); - return (MMU_MINCORE(mmu_obj, pmap, addr, locked_pa)); + return (MMU_MINCORE(mmu_obj, pmap, addr, pap)); } void Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Wed Oct 16 21:54:48 2019 (r353669) +++ head/sys/riscv/riscv/pmap.c Wed Oct 16 22:03:27 2019 (r353670) @@ -4228,10 +4228,12 @@ pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) } /* - * perform the pmap work for mincore + * Perform the pmap work for mincore(2). If the page is not both referenced and + * modified by this pmap, returns its physical address so that the caller can + * find other mappings. */ int -pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) +pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap) { pt_entry_t *l2, *l3, tpte; vm_paddr_t pa; @@ -4239,10 +4241,6 @@ pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t bool managed; PMAP_LOCK(pmap); -retry: - managed = false; - val = 0; - l2 = pmap_l2(pmap, addr); if (l2 != NULL && ((tpte = pmap_load(l2)) & PTE_V) != 0) { if ((tpte & PTE_RWX) != 0) { @@ -4251,8 +4249,10 @@ retry: } else { l3 = pmap_l2_to_l3(l2, addr); tpte = pmap_load(l3); - if ((tpte & PTE_V) == 0) - goto done; + if ((tpte & PTE_V) == 0) { + PMAP_UNLOCK(pmap); + return (0); + } pa = PTE_TO_PHYS(tpte) | (addr & L3_OFFSET); val = MINCORE_INCORE; } @@ -4262,16 +4262,14 @@ retry: if ((tpte & PTE_A) != 0) val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; managed = (tpte & PTE_SW_MANAGED) == PTE_SW_MANAGED; + } else { + managed = false; + val = 0; } - -done: if ((val & (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER)) != (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER) && managed) { - /* Ensure that "PHYS_TO_VM_PAGE(pa)->object" doesn't change. */ - if (vm_page_pa_tryrelock(pmap, pa, locked_pa)) - goto retry; - } else - PA_UNLOCK_COND(*locked_pa); + *pap = pa; + } PMAP_UNLOCK(pmap); return (val); } Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Wed Oct 16 21:54:48 2019 (r353669) +++ head/sys/sparc64/sparc64/pmap.c Wed Oct 16 22:03:27 2019 (r353670) @@ -2241,7 +2241,7 @@ pmap_remove_write(vm_page_t m) } int -pmap_mincore(pmap_t pm, vm_offset_t addr, vm_paddr_t *locked_pa) +pmap_mincore(pmap_t pm, vm_offset_t addr, vm_paddr_t *pap) { /* TODO; */ Modified: head/sys/vm/pmap.h ============================================================================== --- head/sys/vm/pmap.h Wed Oct 16 21:54:48 2019 (r353669) +++ head/sys/vm/pmap.h Wed Oct 16 22:03:27 2019 (r353670) @@ -144,8 +144,7 @@ boolean_t pmap_is_prefaultable(pmap_t pmap, vm_offset boolean_t pmap_is_referenced(vm_page_t m); boolean_t pmap_is_valid_memattr(pmap_t, vm_memattr_t); vm_offset_t pmap_map(vm_offset_t *, vm_paddr_t, vm_paddr_t, int); -int pmap_mincore(pmap_t pmap, vm_offset_t addr, - vm_paddr_t *locked_pa); +int pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap); void pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, vm_object_t object, vm_pindex_t pindex, vm_size_t size); boolean_t pmap_page_exists_quick(pmap_t pmap, vm_page_t m); Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Wed Oct 16 21:54:48 2019 (r353669) +++ head/sys/vm/vm_mmap.c Wed Oct 16 22:03:27 2019 (r353670) @@ -779,21 +779,16 @@ sys_mincore(struct thread *td, struct mincore_args *ua int kern_mincore(struct thread *td, uintptr_t addr0, size_t len, char *vec) { - vm_offset_t addr, first_addr; - vm_offset_t end, cend; pmap_t pmap; vm_map_t map; - int error = 0; - int vecindex, lastvecindex; - vm_map_entry_t current; - vm_map_entry_t entry; + vm_map_entry_t current, entry; vm_object_t object; - vm_paddr_t locked_pa; + vm_offset_t addr, cend, end, first_addr; + vm_paddr_t pa; vm_page_t m; vm_pindex_t pindex; - int mincoreinfo; + int error, lastvecindex, mincoreinfo, vecindex; unsigned int timestamp; - boolean_t locked; /* * Make sure that the addresses presented are valid for user @@ -836,7 +831,7 @@ RestartScan: * ignore submaps (for now) or null objects */ if ((current->eflags & MAP_ENTRY_IS_SUB_MAP) || - current->object.vm_object == NULL) + current->object.vm_object == NULL) continue; /* @@ -849,50 +844,45 @@ RestartScan: if (cend > end) cend = end; - /* - * scan this entry one page at a time - */ - while (addr < cend) { + for (; addr < cend; addr += PAGE_SIZE) { /* * Check pmap first, it is likely faster, also * it can provide info as to whether we are the * one referencing or modifying the page. */ - object = NULL; - locked_pa = 0; - retry: m = NULL; - mincoreinfo = pmap_mincore(pmap, addr, &locked_pa); + object = NULL; +retry: + pa = 0; + mincoreinfo = pmap_mincore(pmap, addr, &pa); if (mincore_mapped) { /* * We only care about this pmap's * mapping of the page, if any. */ - if (locked_pa != 0) { - vm_page_unlock(PHYS_TO_VM_PAGE( - locked_pa)); - } - } else if (locked_pa != 0) { + ; + } else if (pa != 0) { /* * The page is mapped by this process but not * both accessed and modified. It is also * managed. Acquire the object lock so that - * other mappings might be examined. + * other mappings might be examined. The page's + * identity may change at any point before its + * object lock is acquired, so re-validate if + * necessary. */ - m = PHYS_TO_VM_PAGE(locked_pa); - if (m->object != object) { + m = PHYS_TO_VM_PAGE(pa); + while (object == NULL || m->object != object) { if (object != NULL) VM_OBJECT_WUNLOCK(object); - object = m->object; - locked = VM_OBJECT_TRYWLOCK(object); - vm_page_unlock(m); - if (!locked) { - VM_OBJECT_WLOCK(object); - vm_page_lock(m); + object = (vm_object_t)atomic_load_ptr( + &m->object); + if (object == NULL) goto retry; - } - } else - vm_page_unlock(m); + VM_OBJECT_WLOCK(object); + } + if (pa != pmap_extract(pmap, addr)) + goto retry; KASSERT(vm_page_all_valid(m), ("mincore: page %p is mapped but invalid", m)); @@ -922,11 +912,14 @@ RestartScan: } } if (m != NULL) { - /* Examine other mappings to the page. */ + VM_OBJECT_ASSERT_WLOCKED(m->object); + + /* Examine other mappings of the page. */ if (m->dirty == 0 && pmap_is_modified(m)) vm_page_dirty(m); if (m->dirty != 0) mincoreinfo |= MINCORE_MODIFIED_OTHER; + /* * The first test for PGA_REFERENCED is an * optimization. The second test is @@ -985,7 +978,6 @@ RestartScan: goto RestartScan; lastvecindex = vecindex; - addr += PAGE_SIZE; } } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Oct 16 21:54:48 2019 (r353669) +++ head/sys/vm/vm_page.c Wed Oct 16 22:03:27 2019 (r353670) @@ -168,10 +168,6 @@ SYSCTL_INT(_vm, OID_AUTO, boot_pages, CTLFLAG_RDTUN | &boot_pages, 0, "number of pages allocated for bootstrapping the VM system"); -static int pa_tryrelock_restart; -SYSCTL_INT(_vm, OID_AUTO, tryrelock_restart, CTLFLAG_RD, - &pa_tryrelock_restart, 0, "Number of tryrelock restarts"); - static TAILQ_HEAD(, vm_page) blacklist_head; static int sysctl_vm_page_blacklist(SYSCTL_HANDLER_ARGS); SYSCTL_PROC(_vm, OID_AUTO, page_blacklist, CTLTYPE_STRING | CTLFLAG_RD | @@ -251,34 +247,6 @@ SYSINIT(vm_page2, SI_SUB_VM_CONF, SI_ORDER_ANY, vm_pag CTASSERT(sizeof(u_long) >= 8); #endif #endif - -/* - * Try to acquire a physical address lock while a pmap is locked. If we - * fail to trylock we unlock and lock the pmap directly and cache the - * locked pa in *locked. The caller should then restart their loop in case - * the virtual to physical mapping has changed. - */ -int -vm_page_pa_tryrelock(pmap_t pmap, vm_paddr_t pa, vm_paddr_t *locked) -{ - vm_paddr_t lockpa; - - lockpa = *locked; - *locked = pa; - if (lockpa) { - PA_LOCK_ASSERT(lockpa, MA_OWNED); - if (PA_LOCKPTR(pa) == PA_LOCKPTR(lockpa)) - return (0); - PA_UNLOCK(lockpa); - } - if (PA_TRYLOCK(pa)) - return (0); - PMAP_UNLOCK(pmap); - atomic_add_int(&pa_tryrelock_restart, 1); - PA_LOCK(pa); - PMAP_LOCK(pmap); - return (EAGAIN); -} /* * vm_set_page_size: Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Wed Oct 16 21:54:48 2019 (r353669) +++ head/sys/vm/vm_page.h Wed Oct 16 22:03:27 2019 (r353670) @@ -607,7 +607,6 @@ void vm_page_invalid(vm_page_t m); void vm_page_launder(vm_page_t m); vm_page_t vm_page_lookup (vm_object_t, vm_pindex_t); vm_page_t vm_page_next(vm_page_t m); -int vm_page_pa_tryrelock(pmap_t, vm_paddr_t, vm_paddr_t *); void vm_page_pqbatch_drain(void); void vm_page_pqbatch_submit(vm_page_t m, uint8_t queue); vm_page_t vm_page_prev(vm_page_t m); From owner-svn-src-all@freebsd.org Wed Oct 16 22:06:20 2019 Return-Path: Delivered-To: svn-src-all@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 3BF891515B0; Wed, 16 Oct 2019 22:06:20 +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 46tmbJ0bPcz4LN2; Wed, 16 Oct 2019 22:06:20 +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 E7B6DDA8B; Wed, 16 Oct 2019 22:06:19 +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 x9GM6JbA039734; Wed, 16 Oct 2019 22:06:19 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GM6J4u039732; Wed, 16 Oct 2019 22:06:19 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910162206.x9GM6J4u039732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 16 Oct 2019 22:06:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353671 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 353671 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 22:06:20 -0000 Author: markj Date: Wed Oct 16 22:06:19 2019 New Revision: 353671 URL: https://svnweb.freebsd.org/changeset/base/353671 Log: Use KOBJMETHOD_END in the kernel linker. MFC after: 1 week Modified: head/sys/kern/link_elf.c head/sys/kern/link_elf_obj.c Modified: head/sys/kern/link_elf.c ============================================================================== --- head/sys/kern/link_elf.c Wed Oct 16 22:03:27 2019 (r353670) +++ head/sys/kern/link_elf.c Wed Oct 16 22:06:19 2019 (r353671) @@ -175,7 +175,7 @@ static kobj_method_t link_elf_methods[] = { KOBJMETHOD(linker_ctf_get, link_elf_ctf_get), KOBJMETHOD(linker_symtab_get, link_elf_symtab_get), KOBJMETHOD(linker_strtab_get, link_elf_strtab_get), - { 0, 0 } + KOBJMETHOD_END }; static struct linker_class link_elf_class = { Modified: head/sys/kern/link_elf_obj.c ============================================================================== --- head/sys/kern/link_elf_obj.c Wed Oct 16 22:03:27 2019 (r353670) +++ head/sys/kern/link_elf_obj.c Wed Oct 16 22:06:19 2019 (r353671) @@ -163,7 +163,7 @@ static kobj_method_t link_elf_methods[] = { KOBJMETHOD(linker_ctf_get, link_elf_ctf_get), KOBJMETHOD(linker_symtab_get, link_elf_symtab_get), KOBJMETHOD(linker_strtab_get, link_elf_strtab_get), - { 0, 0 } + KOBJMETHOD_END }; static struct linker_class link_elf_class = { From owner-svn-src-all@freebsd.org Wed Oct 16 22:12:35 2019 Return-Path: Delivered-To: svn-src-all@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 6271F1518D8; Wed, 16 Oct 2019 22:12:35 +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 46tmkW1yf2z4Lw4; Wed, 16 Oct 2019 22:12:35 +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 0C5B2DC55; Wed, 16 Oct 2019 22:12:35 +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 x9GMCYNi045336; Wed, 16 Oct 2019 22:12:34 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GMCYPg045334; Wed, 16 Oct 2019 22:12:34 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910162212.x9GMCYPg045334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 16 Oct 2019 22:12:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353672 - in head/sys/amd64: amd64 include X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys/amd64: amd64 include X-SVN-Commit-Revision: 353672 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 22:12:35 -0000 Author: markj Date: Wed Oct 16 22:12:34 2019 New Revision: 353672 URL: https://svnweb.freebsd.org/changeset/base/353672 Log: Introduce pmap_change_prot() for amd64. This updates the protection attributes of subranges of the kernel map. Unlike pmap_protect(), which is typically used for user mappings, pmap_change_prot() does not perform lazy upgrades of protections. pmap_change_prot() also updates the aliasing range of the direct map. Reviewed by: kib MFC after: 1 month Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21758 Modified: head/sys/amd64/amd64/pmap.c head/sys/amd64/include/pmap.h Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Oct 16 22:06:19 2019 (r353671) +++ head/sys/amd64/amd64/pmap.c Wed Oct 16 22:12:34 2019 (r353672) @@ -1138,10 +1138,11 @@ static caddr_t crashdumpmap; /* * Internal flags for pmap_mapdev_internal() and - * pmap_change_attr_locked(). + * pmap_change_props_locked(). */ -#define MAPDEV_FLUSHCACHE 0x0000001 /* Flush cache after mapping. */ -#define MAPDEV_SETATTR 0x0000002 /* Modify existing attrs. */ +#define MAPDEV_FLUSHCACHE 0x00000001 /* Flush cache after mapping. */ +#define MAPDEV_SETATTR 0x00000002 /* Modify existing attrs. */ +#define MAPDEV_ASSERTVALID 0x00000004 /* Assert mapping validity. */ TAILQ_HEAD(pv_chunklist, pv_chunk); @@ -1165,8 +1166,8 @@ static void pmap_pvh_free(struct md_page *pvh, pmap_t static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, vm_offset_t va); -static int pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode, - int flags); +static int pmap_change_props_locked(vm_offset_t va, vm_size_t size, + vm_prot_t prot, int mode, int flags); static boolean_t pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va); static boolean_t pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, struct rwlock **lockp); @@ -1189,14 +1190,13 @@ static void pmap_invalidate_pde_page(pmap_t pmap, vm_o static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode); static vm_page_t pmap_large_map_getptp_unlocked(void); static vm_paddr_t pmap_large_map_kextract(vm_offset_t va); -static void pmap_pde_attr(pd_entry_t *pde, int cache_bits, int mask); #if VM_NRESERVLEVEL > 0 static void pmap_promote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, struct rwlock **lockp); #endif static boolean_t pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot); -static void pmap_pte_attr(pt_entry_t *pte, int cache_bits, int mask); +static void pmap_pte_props(pt_entry_t *pte, u_long bits, u_long mask); static void pmap_pti_add_kva_locked(vm_offset_t sva, vm_offset_t eva, bool exec); static pdp_entry_t *pmap_pti_pdpe(vm_offset_t va); @@ -7900,40 +7900,20 @@ restart: * Miscellaneous support routines follow */ -/* Adjust the cache mode for a 4KB page mapped via a PTE. */ +/* Adjust the properties for a leaf page table entry. */ static __inline void -pmap_pte_attr(pt_entry_t *pte, int cache_bits, int mask) +pmap_pte_props(pt_entry_t *pte, u_long bits, u_long mask) { - u_int opte, npte; + u_long opte, npte; - /* - * The cache mode bits are all in the low 32-bits of the - * PTE, so we can just spin on updating the low 32-bits. - */ + opte = *(u_long *)pte; do { - opte = *(u_int *)pte; npte = opte & ~mask; - npte |= cache_bits; - } while (npte != opte && !atomic_cmpset_int((u_int *)pte, opte, npte)); + npte |= bits; + } while (npte != opte && !atomic_fcmpset_long((u_long *)pte, &opte, + npte)); } -/* Adjust the cache mode for a 2MB page mapped via a PDE. */ -static __inline void -pmap_pde_attr(pd_entry_t *pde, int cache_bits, int mask) -{ - u_int opde, npde; - - /* - * The cache mode bits are all in the low 32-bits of the - * PDE, so we can just spin on updating the low 32-bits. - */ - do { - opde = *(u_int *)pde; - npde = opde & ~mask; - npde |= cache_bits; - } while (npde != opde && !atomic_cmpset_int((u_int *)pde, opde, npde)); -} - /* * Map a set of physical memory pages into the kernel virtual * address space. Return a pointer to where it is mapped. This @@ -7987,7 +7967,8 @@ pmap_mapdev_internal(vm_paddr_t pa, vm_size_t size, in va = PHYS_TO_DMAP(pa); if ((flags & MAPDEV_SETATTR) != 0) { PMAP_LOCK(kernel_pmap); - i = pmap_change_attr_locked(va, size, mode, flags); + i = pmap_change_props_locked(va, size, + PROT_NONE, mode, flags); PMAP_UNLOCK(kernel_pmap); } else i = 0; @@ -8173,21 +8154,46 @@ pmap_change_attr(vm_offset_t va, vm_size_t size, int m int error; PMAP_LOCK(kernel_pmap); - error = pmap_change_attr_locked(va, size, mode, MAPDEV_FLUSHCACHE); + error = pmap_change_props_locked(va, size, PROT_NONE, mode, + MAPDEV_FLUSHCACHE); PMAP_UNLOCK(kernel_pmap); return (error); } +/* + * Changes the specified virtual address range's protections to those + * specified by "prot". Like pmap_change_attr(), protections for aliases + * in the direct map are updated as well. Protections on aliasing mappings may + * be a subset of the requested protections; for example, mappings in the direct + * map are never executable. + */ +int +pmap_change_prot(vm_offset_t va, vm_size_t size, vm_prot_t prot) +{ + int error; + + /* Only supported within the kernel map. */ + if (va < VM_MIN_KERNEL_ADDRESS) + return (EINVAL); + + PMAP_LOCK(kernel_pmap); + error = pmap_change_props_locked(va, size, prot, -1, + MAPDEV_ASSERTVALID); + PMAP_UNLOCK(kernel_pmap); + return (error); +} + static int -pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode, int flags) +pmap_change_props_locked(vm_offset_t va, vm_size_t size, vm_prot_t prot, + int mode, int flags) { vm_offset_t base, offset, tmpva; vm_paddr_t pa_start, pa_end, pa_end1; pdp_entry_t *pdpe; - pd_entry_t *pde; - pt_entry_t *pte; - int cache_bits_pte, cache_bits_pde, error; - boolean_t changed; + pd_entry_t *pde, pde_bits, pde_mask; + pt_entry_t *pte, pte_bits, pte_mask; + int error; + bool changed; PMAP_LOCK_ASSERT(kernel_pmap, MA_OWNED); base = trunc_page(va); @@ -8201,9 +8207,33 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size if (base < DMAP_MIN_ADDRESS) return (EINVAL); - cache_bits_pde = pmap_cache_bits(kernel_pmap, mode, 1); - cache_bits_pte = pmap_cache_bits(kernel_pmap, mode, 0); - changed = FALSE; + /* + * Construct our flag sets and masks. "bits" is the subset of + * "mask" that will be set in each modified PTE. + * + * Mappings in the direct map are never allowed to be executable. + */ + pde_bits = pte_bits = 0; + pde_mask = pte_mask = 0; + if (mode != -1) { + pde_bits |= pmap_cache_bits(kernel_pmap, mode, true); + pde_mask |= X86_PG_PDE_CACHE; + pte_bits |= pmap_cache_bits(kernel_pmap, mode, false); + pte_mask |= X86_PG_PTE_CACHE; + } + if (prot != VM_PROT_NONE) { + if ((prot & VM_PROT_WRITE) != 0) { + pde_bits |= X86_PG_RW; + pte_bits |= X86_PG_RW; + } + if ((prot & VM_PROT_EXECUTE) == 0 || + va < VM_MIN_KERNEL_ADDRESS) { + pde_bits |= pg_nx; + pte_bits |= pg_nx; + } + pde_mask |= X86_PG_RW | pg_nx; + pte_mask |= X86_PG_RW | pg_nx; + } /* * Pages that aren't mapped aren't supported. Also break down 2MB pages @@ -8211,15 +8241,18 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size */ for (tmpva = base; tmpva < base + size; ) { pdpe = pmap_pdpe(kernel_pmap, tmpva); - if (pdpe == NULL || *pdpe == 0) + if (pdpe == NULL || *pdpe == 0) { + KASSERT((flags & MAPDEV_ASSERTVALID) == 0, + ("%s: addr %#lx is not mapped", __func__, tmpva)); return (EINVAL); + } if (*pdpe & PG_PS) { /* * If the current 1GB page already has the required - * memory type, then we need not demote this page. Just + * properties, then we need not demote this page. Just * increment tmpva to the next 1GB page frame. */ - if ((*pdpe & X86_PG_PDE_CACHE) == cache_bits_pde) { + if ((*pdpe & pde_mask) == pde_bits) { tmpva = trunc_1gpage(tmpva) + NBPDP; continue; } @@ -8238,15 +8271,18 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size return (ENOMEM); } pde = pmap_pdpe_to_pde(pdpe, tmpva); - if (*pde == 0) + if (*pde == 0) { + KASSERT((flags & MAPDEV_ASSERTVALID) == 0, + ("%s: addr %#lx is not mapped", __func__, tmpva)); return (EINVAL); + } if (*pde & PG_PS) { /* * If the current 2MB page already has the required - * memory type, then we need not demote this page. Just + * properties, then we need not demote this page. Just * increment tmpva to the next 2MB page frame. */ - if ((*pde & X86_PG_PDE_CACHE) == cache_bits_pde) { + if ((*pde & pde_mask) == pde_bits) { tmpva = trunc_2mpage(tmpva) + NBPDR; continue; } @@ -8265,24 +8301,27 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size return (ENOMEM); } pte = pmap_pde_to_pte(pde, tmpva); - if (*pte == 0) + if (*pte == 0) { + KASSERT((flags & MAPDEV_ASSERTVALID) == 0, + ("%s: addr %#lx is not mapped", __func__, tmpva)); return (EINVAL); + } tmpva += PAGE_SIZE; } error = 0; /* * Ok, all the pages exist, so run through them updating their - * cache mode if required. + * properties if required. */ + changed = false; pa_start = pa_end = 0; for (tmpva = base; tmpva < base + size; ) { pdpe = pmap_pdpe(kernel_pmap, tmpva); if (*pdpe & PG_PS) { - if ((*pdpe & X86_PG_PDE_CACHE) != cache_bits_pde) { - pmap_pde_attr(pdpe, cache_bits_pde, - X86_PG_PDE_CACHE); - changed = TRUE; + if ((*pdpe & pde_mask) != pde_bits) { + pmap_pte_props(pdpe, pde_bits, pde_mask); + changed = true; } if (tmpva >= VM_MIN_KERNEL_ADDRESS && (*pdpe & PG_PS_FRAME) < dmaplimit) { @@ -8294,9 +8333,10 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size pa_end += NBPDP; else { /* Run ended, update direct map. */ - error = pmap_change_attr_locked( + error = pmap_change_props_locked( PHYS_TO_DMAP(pa_start), - pa_end - pa_start, mode, flags); + pa_end - pa_start, prot, mode, + flags); if (error != 0) break; /* Start physical address run. */ @@ -8309,10 +8349,9 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size } pde = pmap_pdpe_to_pde(pdpe, tmpva); if (*pde & PG_PS) { - if ((*pde & X86_PG_PDE_CACHE) != cache_bits_pde) { - pmap_pde_attr(pde, cache_bits_pde, - X86_PG_PDE_CACHE); - changed = TRUE; + if ((*pde & pde_mask) != pde_bits) { + pmap_pte_props(pde, pde_bits, pde_mask); + changed = true; } if (tmpva >= VM_MIN_KERNEL_ADDRESS && (*pde & PG_PS_FRAME) < dmaplimit) { @@ -8324,9 +8363,10 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size pa_end += NBPDR; else { /* Run ended, update direct map. */ - error = pmap_change_attr_locked( + error = pmap_change_props_locked( PHYS_TO_DMAP(pa_start), - pa_end - pa_start, mode, flags); + pa_end - pa_start, prot, mode, + flags); if (error != 0) break; /* Start physical address run. */ @@ -8337,10 +8377,9 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size tmpva = trunc_2mpage(tmpva) + NBPDR; } else { pte = pmap_pde_to_pte(pde, tmpva); - if ((*pte & X86_PG_PTE_CACHE) != cache_bits_pte) { - pmap_pte_attr(pte, cache_bits_pte, - X86_PG_PTE_CACHE); - changed = TRUE; + if ((*pte & pte_mask) != pte_bits) { + pmap_pte_props(pte, pte_bits, pte_mask); + changed = true; } if (tmpva >= VM_MIN_KERNEL_ADDRESS && (*pte & PG_FRAME) < dmaplimit) { @@ -8352,9 +8391,10 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size pa_end += PAGE_SIZE; else { /* Run ended, update direct map. */ - error = pmap_change_attr_locked( + error = pmap_change_props_locked( PHYS_TO_DMAP(pa_start), - pa_end - pa_start, mode, flags); + pa_end - pa_start, prot, mode, + flags); if (error != 0) break; /* Start physical address run. */ @@ -8368,8 +8408,8 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size if (error == 0 && pa_start != pa_end && pa_start < dmaplimit) { pa_end1 = MIN(pa_end, dmaplimit); if (pa_start != pa_end1) - error = pmap_change_attr_locked(PHYS_TO_DMAP(pa_start), - pa_end1 - pa_start, mode, flags); + error = pmap_change_props_locked(PHYS_TO_DMAP(pa_start), + pa_end1 - pa_start, prot, mode, flags); } /* Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Wed Oct 16 22:06:19 2019 (r353671) +++ head/sys/amd64/include/pmap.h Wed Oct 16 22:12:34 2019 (r353672) @@ -425,6 +425,7 @@ void pmap_activate_sw(struct thread *); void pmap_bootstrap(vm_paddr_t *); int pmap_cache_bits(pmap_t pmap, int mode, boolean_t is_pde); int pmap_change_attr(vm_offset_t, vm_size_t, int); +int pmap_change_prot(vm_offset_t, vm_size_t, vm_prot_t); void pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, boolean_t invalidate); void pmap_flush_cache_range(vm_offset_t, vm_offset_t); void pmap_flush_cache_phys_range(vm_paddr_t, vm_paddr_t, vm_memattr_t); From owner-svn-src-all@freebsd.org Wed Oct 16 22:19:24 2019 Return-Path: Delivered-To: svn-src-all@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 4B79B1519A2; Wed, 16 Oct 2019 22:19:24 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46tmtL4dc6z4MCj; Wed, 16 Oct 2019 22:19:22 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 1ef09c50; Thu, 17 Oct 2019 00:19:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=WpjDwZvGpyqliblI5HL+GC5+W5g=; b=loCB3GTUlKRsysfKLNmb+oeSHuXu mDU9wRZ6c6H4+xySiTL95eQ6hFtvxQ1p86t7uA3xvN7ll84Jnv7EumPv3Jn5J8LW +J6mYh7+LR9yPZ9eDAeDEfoxsVex2ezoRBM/+5K2SrMcPNmrG691W6dCzs1jyOlM V88I6TMdq0f2kKs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=D1v1Mak627jptIvqZ2gEZ/MfYSlG406ePWt0kVHEQbQREZ//f1xboIRv z4ROvhXMhNJjEqkj4lg5K9mVp7Z6cHFvZ+/ZSb6C5Xwtgrhdvh4v0Gwm2Hgo6gWC cK2W+jVvpwsWIfpZL9MKrZlZ/rIN4wTBCjZ+CptriOYXvYTsJWM= Received: from sonic.home.blih.net (ip-9.net-89-3-105.rev.numericable.fr [89.3.105.9]) by mail.blih.net (OpenSMTPD) with ESMTPSA id fde3446d TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Thu, 17 Oct 2019 00:19:14 +0200 (CEST) Date: Thu, 17 Oct 2019 00:19:14 +0200 From: Emmanuel Vadot To: Ruslan Bukin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353493 - head/sys/dev/mmc/host Message-Id: <20191017001914.402ea31c62f7499f604af1b2@bidouilliste.com> In-Reply-To: <20191016150634.GA17444@bsdpad.com> References: <201910141553.x9EFr0Zb010167@repo.freebsd.org> <20191014181051.bd8c7a3dbb7b07a636d81ed9@bidouilliste.com> <20191014162751.GA30496@bsdpad.com> <20191014184526.e5f3798fd4d4f9c744f4a491@bidouilliste.com> <20191016150634.GA17444@bsdpad.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46tmtL4dc6z4MCj X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bidouilliste.com header.s=mail header.b=loCB3GTU; dmarc=none; spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates 212.83.177.182 as permitted sender) smtp.mailfrom=manu@bidouilliste.com X-Spamd-Result: default: False [-1.13 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mail]; NEURAL_HAM_MEDIUM(-0.70)[-0.697,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:212.83.177.182/32]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MV_CASE(0.50)[]; DMARC_NA(0.00)[bidouilliste.com]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-0.92)[-0.916,0]; DKIM_TRACE(0.00)[bidouilliste.com:+]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; IP_SCORE(0.38)[ip: (-0.65), ipnet: 212.83.160.0/19(2.44), asn: 12876(0.11), country: FR(-0.00)]; ASN(0.00)[asn:12876, ipnet:212.83.160.0/19, country:FR]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 22:19:24 -0000 On Wed, 16 Oct 2019 16:06:34 +0100 Ruslan Bukin wrote: > On Mon, Oct 14, 2019 at 06:45:26PM +0200, Emmanuel Vadot wrote: > > On Mon, 14 Oct 2019 17:27:51 +0100 > > Ruslan Bukin wrote: > > > > > On Mon, Oct 14, 2019 at 06:10:51PM +0200, Emmanuel Vadot wrote: > > > > > > > > On Mon, 14 Oct 2019 15:53:00 +0000 (UTC) > > > > Ruslan Bukin wrote: > > > > > > > > > Author: br > > > > > Date: Mon Oct 14 15:52:59 2019 > > > > > New Revision: 353493 > > > > > URL: https://svnweb.freebsd.org/changeset/base/353493 > > > > > > > > > > Log: > > > > > Fix the driver attachment in cases when the external resource devices > > > > > (resets, regulators, clocks) are not available. > > > > > > > > > > Rely on a system initialization done by a bootloader in that cases. > > > > > > > > > > This fixes operation on Terasic DE10-Pro (an Intel Stratix 10 > > > > > development kit). > > > > > > > > > > Sponsored by: DARPA, AFRL > > > > > > > > > > Modified: > > > > > head/sys/dev/mmc/host/dwmmc.c > > > > > > > > > > Modified: head/sys/dev/mmc/host/dwmmc.c > > > > > ============================================================================== > > > > > --- head/sys/dev/mmc/host/dwmmc.c Mon Oct 14 15:33:53 2019 (r353492) > > > > > +++ head/sys/dev/mmc/host/dwmmc.c Mon Oct 14 15:52:59 2019 (r353493) > > > > > @@ -1,5 +1,5 @@ > > > > > /*- > > > > > - * Copyright (c) 2014 Ruslan Bukin > > > > > + * Copyright (c) 2014-2019 Ruslan Bukin > > > > > * All rights reserved. > > > > > * > > > > > * This software was developed by SRI International and the University of > > > > > @@ -457,26 +457,20 @@ parse_fdt(struct dwmmc_softc *sc) > > > > > > > > > > /* IP block reset is optional */ > > > > > error = hwreset_get_by_ofw_name(sc->dev, 0, "reset", &sc->hwreset); > > > > > - if (error != 0 && error != ENOENT) { > > > > > + if (error != 0 && error != ENOENT) > > > > > device_printf(sc->dev, "Cannot get reset\n"); > > > > > - goto fail; > > > > > - } > > > > > > > > This is not correct, on a system without reset/clock/regulator support > > > > you will get ENODEV as the phandle is present but no device is > > > > associated with it. This is the case that you want to test. Currently > > > > this hide all errors. > > > > > > The change means that the driver will be attached regardless of the return value from ext resources. > > > > Yes and this is a problem. > > > > > Why it is not correct? > > > > Because if a reset/clock/regulator is present but we failed to parse > > the node (bad #clock-cell for example) this just assume that the > > resource isn't present which is not correct. Or worse the underlying > > gpio cannot be mapped, you now have a non functional driver because you > > cannot switch the regulator. > > > > Could an error in DTS convert a device from being optional to become > mandatory? It is still not clear if any support present on a stage of > parsing. > > Since the knowledge of registered support is at extres, then it should > be mandatory from a driver perspective (if enabled in kernel config). > And then the framework should make a decision based on any support present. > > What do you think ? > > Ruslan I didnt' quite understood what you are suggesting ? Could you elaborate a bit more please ? -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Wed Oct 16 22:19:57 2019 Return-Path: Delivered-To: svn-src-all@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 0DF9E151A22; Wed, 16 Oct 2019 22:19:57 +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 46tmv06XR1z4MLt; Wed, 16 Oct 2019 22:19:56 +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 BF5A1DC5D; Wed, 16 Oct 2019 22:19:56 +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 x9GMJu8R045684; Wed, 16 Oct 2019 22:19:56 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GMJuo8045682; Wed, 16 Oct 2019 22:19:56 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910162219.x9GMJuo8045682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 16 Oct 2019 22:19:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353673 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 353673 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 22:19:57 -0000 Author: markj Date: Wed Oct 16 22:19:56 2019 New Revision: 353673 URL: https://svnweb.freebsd.org/changeset/base/353673 Log: Formalize the use of linker scripts for kernel modules. Automatically apply ldscript.kmod.${MACHINE_ARCH} if it exists. We already have an i386-specific linker script; rename it accordingly. Note that the linker script is applied when the object files are partially linked. (For amd64 this is also the final link.) Reviewed by: imp, kib Discussed with: jhb MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21887 Added: head/sys/conf/ldscript.kmod.i386 - copied unchanged from r353672, head/sys/conf/ldscript.set_padding Deleted: head/sys/conf/ldscript.set_padding Modified: head/sys/conf/kmod.mk Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Wed Oct 16 22:12:34 2019 (r353672) +++ head/sys/conf/kmod.mk Wed Oct 16 22:19:56 2019 (r353673) @@ -242,18 +242,16 @@ EXPORT_SYMS?= NO CLEANFILES+= export_syms .endif +.if !defined(FIRMWS) && exists(${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH}) +_LDFLAGS+=-T ${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH} +.endif + .if ${__KLD_SHARED} == yes ${KMOD}.kld: ${OBJS} .else ${FULLPROG}: ${OBJS} .endif -.if !defined(FIRMWS) && (${MACHINE_CPUARCH} == "i386") - ${LD} -m ${LD_EMULATION} ${_LDFLAGS} -r \ - -T ${SYSDIR}/conf/ldscript.set_padding \ - -d -o ${.TARGET} ${OBJS} -.else ${LD} -m ${LD_EMULATION} ${_LDFLAGS} -r -d -o ${.TARGET} ${OBJS} -.endif .if ${MK_CTF} != "no" ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} .endif Copied: head/sys/conf/ldscript.kmod.i386 (from r353672, head/sys/conf/ldscript.set_padding) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/conf/ldscript.kmod.i386 Wed Oct 16 22:19:56 2019 (r353673, copy of r353672, head/sys/conf/ldscript.set_padding) @@ -0,0 +1,46 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2018 Bjoern A. Zeeb + * + * 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$ + */ +SECTIONS +{ + set_pcpu : + { + *(set_pcpu) + LONG(0x90909090) ; + } +} + +SECTIONS +{ + set_vnet : + { + *(set_vnet) + LONG(0x90909090) ; + } +} +/* end */ From owner-svn-src-all@freebsd.org Thu Oct 17 00:34:54 2019 Return-Path: Delivered-To: svn-src-all@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 469D8153EFA; Thu, 17 Oct 2019 00:34:54 +0000 (UTC) (envelope-from philip@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 46tqtk115qz4TGN; Thu, 17 Oct 2019 00:34:54 +0000 (UTC) (envelope-from philip@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 07221F57D; Thu, 17 Oct 2019 00:34:54 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9H0Yr5a029095; Thu, 17 Oct 2019 00:34:53 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9H0YreI029094; Thu, 17 Oct 2019 00:34:53 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201910170034.x9H0YreI029094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Thu, 17 Oct 2019 00:34:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353674 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: philip X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353674 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 00:34:54 -0000 Author: philip Date: Thu Oct 17 00:34:53 2019 New Revision: 353674 URL: https://svnweb.freebsd.org/changeset/base/353674 Log: ether: add older ethertype definitions for QinQ Older network equipment used the ethertypes 0x9100, 0x9200, and 0x9300 for outer VLANs, before standardisation introduced 0x88a8. Submitted by: Lutz Donnerhacke Differential Revision: https://reviews.freebsd.org/D21846 Modified: head/sys/net/ethernet.h Modified: head/sys/net/ethernet.h ============================================================================== --- head/sys/net/ethernet.h Wed Oct 16 22:19:56 2019 (r353673) +++ head/sys/net/ethernet.h Thu Oct 17 00:34:53 2019 (r353674) @@ -346,10 +346,13 @@ struct ether_vlan_header { #define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */ #define ETHERTYPE_QINQ 0x88A8 /* 802.1ad VLAN stacking */ #define ETHERTYPE_LOOPBACK 0x9000 /* Loopback: used to test interfaces */ +#define ETHERTYPE_8021Q9100 0x9100 /* IEEE 802.1Q stacking (proprietary) */ #define ETHERTYPE_LBACK ETHERTYPE_LOOPBACK /* DEC MOP loopback */ #define ETHERTYPE_XNSSM 0x9001 /* 3Com (Formerly Bridge Communications), XNS Systems Management */ #define ETHERTYPE_TCPSM 0x9002 /* 3Com (Formerly Bridge Communications), TCP/IP Systems Management */ #define ETHERTYPE_BCLOOP 0x9003 /* 3Com (Formerly Bridge Communications), loopback detection */ +#define ETHERTYPE_8021Q9200 0x9200 /* IEEE 802.1Q stacking (proprietary) */ +#define ETHERTYPE_8021Q9300 0x9300 /* IEEE 802.1Q stacking (proprietary) */ #define ETHERTYPE_DEBNI 0xAAAA /* DECNET? Used by VAX 6220 DEBNI */ #define ETHERTYPE_SONIX 0xFAF5 /* Sonix Arpeggio */ #define ETHERTYPE_VITAL 0xFF00 /* BBN VITAL-LanBridge cache wakeups */ From owner-svn-src-all@freebsd.org Thu Oct 17 01:30:38 2019 Return-Path: Delivered-To: svn-src-all@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 3212615552C; Thu, 17 Oct 2019 01:30: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 46ts720Y5Pz4WwS; Thu, 17 Oct 2019 01:30: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 E99B9FEE8; Thu, 17 Oct 2019 01:30:37 +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 x9H1UbPC058119; Thu, 17 Oct 2019 01:30:37 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9H1Ubjq058118; Thu, 17 Oct 2019 01:30:37 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201910170130.x9H1Ubjq058118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 17 Oct 2019 01:30:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353675 - in stable/12/sys: arm/ti dev/sdhci X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/12/sys: arm/ti dev/sdhci X-SVN-Commit-Revision: 353675 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 01:30:38 -0000 Author: ian Date: Thu Oct 17 01:30:37 2019 New Revision: 353675 URL: https://svnweb.freebsd.org/changeset/base/353675 Log: MFC r353651-r353652 r353651: Relax the sdhci(4) check that filters out the 1.8v voltage option unless the slot is flagged as 'embedded'. The features related to embedded and shared slots were added in v3.0 of the sdhci spec. Hardware prior to v3 sometimes supported 1.8v on non- removable devices in embedded systems, but had no way to indicate that via the standard sdhci registers (instead they use out of band metadata such as FDT data). This change adds the controller specification version to the check for whether to filter out the 1.8v selection. On older hardware, the 1.8v option is allowed to remain. On 3.0 or later it still requires the embedded-slot flag to remain. This is part of the fix for PR 241301 (eMMC not detected on Beaglebone). Changes to the sdhci_ti driver are also needed for a full fix. PR: 241301 r353652: Revert r351218 (by manu). While the changes in r351218 appear to be (and should be) correct, they lead to the eMMC on a Beaglebone failing to work in some situations. The TI sdhci hardware is kind of strange. The first device inherently supports 1.8v and 3.3v and the abililty to switch between them, and the other two devices must be set to 1.8v in the sdhci power control register to operate correctly, but doing so actually makes them run at 3.3v (unless an external level-shifter is present in the signal path). Even the 1.8v on the first device may actually be 3.3v (or any other value), depending on what voltage is fed to the VDDS1-VDDS7 power supply pins on the am335x chip. Another strange quirk is that the convention for am335x sdhci drivers in linux and uboot and the am335x boot ROM seems to be to set the voltage in the sdhci capabilities register to 3.0v even though the actual voltage is 3.3v. Why this is done is a complete mystery to me, but it seems to be required for correct operation. If we had complete modern support for the am335x chip we could get the actual voltages from the FDT data and the regulator framework. But our am335x code currently doesn't have any regulator framework support. Reverting to the prior code will get the popular Beaglebone boards working again. This is part of the fix for PR 241301, but also requires r353651 for a complete fix. PR: 241301 Discussed with: manu Approved by: re(gjb) for MFC without 3-day wait Modified: stable/12/sys/arm/ti/ti_sdhci.c stable/12/sys/dev/sdhci/sdhci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/ti/ti_sdhci.c ============================================================================== --- stable/12/sys/arm/ti/ti_sdhci.c Thu Oct 17 00:34:53 2019 (r353674) +++ stable/12/sys/arm/ti/ti_sdhci.c Thu Oct 17 01:30:37 2019 (r353675) @@ -482,14 +482,15 @@ ti_sdhci_hw_init(device_t dev) * The attach() routine has examined fdt data and set flags in * slot.host.caps to reflect what voltages we can handle. Set those * values in the CAPA register. The manual says that these values can - * only be set once, and that they survive a reset so unless u-boot didn't - * set this register this code is a no-op. + * only be set once, "before initialization" whatever that means, and + * that they survive a reset. So maybe doing this will be a no-op if + * u-boot has already initialized the hardware. */ regval = ti_mmchs_read_4(sc, MMCHS_SD_CAPA); if (sc->slot.host.caps & MMC_OCR_LOW_VOLTAGE) regval |= MMCHS_SD_CAPA_VS18; - if (sc->slot.host.caps & (MMC_OCR_320_330 | MMC_OCR_330_340)) - regval |= MMCHS_SD_CAPA_VS33; + if (sc->slot.host.caps & (MMC_OCR_290_300 | MMC_OCR_300_310)) + regval |= MMCHS_SD_CAPA_VS30; ti_mmchs_write_4(sc, MMCHS_SD_CAPA, regval); /* Set initial host configuration (1-bit, std speed, pwr off). */ @@ -523,20 +524,17 @@ ti_sdhci_attach(device_t dev) } /* - * The hardware can inherently do dual-voltage (1p8v, 3p3v) on the first + * The hardware can inherently do dual-voltage (1p8v, 3p0v) on the first * device, and only 1p8v on other devices unless an external transceiver * is used. The only way we could know about a transceiver is fdt data. * Note that we have to do this before calling ti_sdhci_hw_init() so * that it can set the right values in the CAPA register, which can only * be done once and never reset. */ - if (OF_hasprop(node, "ti,dual-volt")) { - sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE | MMC_OCR_320_330 | MMC_OCR_330_340; - } else if (OF_hasprop(node, "no-1-8-v")) { - sc->slot.host.caps |= MMC_OCR_320_330 | MMC_OCR_330_340; - } else - sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE; - + sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE; + if (sc->mmchs_clk_id == MMC1_CLK || OF_hasprop(node, "ti,dual-volt")) { + sc->slot.host.caps |= MMC_OCR_290_300 | MMC_OCR_300_310; + } /* * Set the offset from the device's memory start to the MMCHS registers. Modified: stable/12/sys/dev/sdhci/sdhci.c ============================================================================== --- stable/12/sys/dev/sdhci/sdhci.c Thu Oct 17 00:34:53 2019 (r353674) +++ stable/12/sys/dev/sdhci/sdhci.c Thu Oct 17 01:30:37 2019 (r353675) @@ -902,8 +902,13 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, slot->host.host_ocr |= MMC_OCR_320_330 | MMC_OCR_330_340; if (caps & SDHCI_CAN_VDD_300) slot->host.host_ocr |= MMC_OCR_290_300 | MMC_OCR_300_310; - /* 1.8V VDD is not supposed to be used for removable cards. */ - if ((caps & SDHCI_CAN_VDD_180) && (slot->opt & SDHCI_SLOT_EMBEDDED)) + /* + * 1.8V VDD is not supposed to be used for removable cards. Hardware + * prior to v3.0 had no way to indicate embedded slots, but did + * sometimes support 1.8v for non-removable devices. + */ + if ((caps & SDHCI_CAN_VDD_180) && (slot->version < SDHCI_SPEC_300 || + (slot->opt & SDHCI_SLOT_EMBEDDED))) slot->host.host_ocr |= MMC_OCR_LOW_VOLTAGE; if (slot->host.host_ocr == 0) { slot_printf(slot, "Hardware doesn't report any " From owner-svn-src-all@freebsd.org Thu Oct 17 02:05:36 2019 Return-Path: Delivered-To: svn-src-all@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 48E5816060A; Thu, 17 Oct 2019 02:05:36 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (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 46tsvN19xmz4jsc; Thu, 17 Oct 2019 02:05:36 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 06FBD14DE2; Thu, 17 Oct 2019 02:05:36 +0000 (UTC) Date: Thu, 17 Oct 2019 02:05:35 +0000 From: Alexey Dokuchaev To: Ian Lepore Cc: Andriy Gapon , "O. Hartmann" , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r353565 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys Message-ID: <20191017020535.GB8053@FreeBSD.org> References: <201910151509.x9FF9a2B031347@repo.freebsd.org> <20191015175357.3ee91a1c@thor.intern.walstatt.dynvpn.de> <00eaaf1a-392c-29e1-a035-e72c61423fb3@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 02:05:36 -0000 On Tue, Oct 15, 2019 at 10:00:51AM -0600, Ian Lepore wrote: > On Tue, 2019-10-15 at 18:56 +0300, Andriy Gapon wrote: > > On 15/10/2019 18:53, O. Hartmann wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > > > Hash: SHA256 > > > > > > Am Tue, 15 Oct 2019 15:09:36 +0000 (UTC) > > > Andriy Gapon schrieb: > > > > Sorry, I got tired before I could scroll to your reply. > > You break the build, a user reports it, and a smartass reply is the > best you can do? In Andriy's defense, O. Hartmann could have trimmed the log down to the relevant build error lines rather than (uselessly) quoting entire diff. It really takes a while to scroll down these emails of his, especially on a slow connections. Overquoting in general is a big problem on FreeBSD lists, and I don't know exactly why. It was not like that 15-20 years ago. ./danfe From owner-svn-src-all@freebsd.org Thu Oct 17 04:10:41 2019 Return-Path: Delivered-To: svn-src-all@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 DA24216D7AA; Thu, 17 Oct 2019 04:10:41 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (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 46twgg5mVcz3GkG; Thu, 17 Oct 2019 04:10:39 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id Kx7Ui0keVUIS2Kx7ViKZ7S; Wed, 16 Oct 2019 22:10:38 -0600 X-Authority-Analysis: v=2.3 cv=N41X6F1B c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=XobE76Q3jBoA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=NOSWdVJw-eKdtt-dyQYA:9 a=aA6ZCiMsjVEVdhMv:21 a=DDg3lIw8BGnepZDI:21 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 47B7237ED; Wed, 16 Oct 2019 21:10:35 -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 x9H4AYgr020793; Wed, 16 Oct 2019 21:10:34 -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 x9H4AYsP020790; Wed, 16 Oct 2019 21:10:34 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201910170410.x9H4AYsP020790@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: Alexey Dokuchaev cc: Ian Lepore , Andriy Gapon , "O. Hartmann" , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r353565 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys In-reply-to: <20191017020535.GB8053@FreeBSD.org> References: <201910151509.x9FF9a2B031347@repo.freebsd.org> <20191015175357.3ee91a1c@thor.intern.walstatt.dynvpn.de> <00eaaf1a-392c-29e1-a035-e72c61423fb3@FreeBSD.org> <20191017020535.GB8053@FreeBSD.org> Comments: In-reply-to Alexey Dokuchaev message dated "Thu, 17 Oct 2019 02:05:35 -0000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 16 Oct 2019 21:10:34 -0700 X-CMAE-Envelope: MS4wfA1erOZkASV+5A4AsGrd0iheNxginD6RoDidQvmlA5UjqHeLEvnt4++rdAwb1AYBL9ZVPbt5kF/bwNAiOdysLEH6oYQHsHiUJDbQ7Z9X6WlsmDElavzI dFaXA0Kr5yojAh3RoG7GydhbRUU94au9VRkSILx/k5MCHHybSR1p7k2M5pk5k9nbl9De602QwWBSjvkDobXSJO5LBTvRkZ1qHy6lJNv/NLOF3PZXrDiiJoMU Psk1fkGu5g0r1LSND5eTk48tHeUsZUcoCHdhDoIKryOuZijTQCVMdlfQw40v7GFtgSwyUc0CWoD08lwJ2m51Agem5veiIjtX2eQA5qg1XATjuj1l+/6Qiqvs HwHqlxUFA/O0hCKDZ8WioC/lUyWfTQ== X-Rspamd-Queue-Id: 46twgg5mVcz3GkG 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.134.13) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-4.00 / 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)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; REPLYTO_EQ_FROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[13.134.59.64.list.dnswl.org : 127.0.5.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:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-2.40)[ip: (-6.50), ipnet: 64.59.128.0/20(-3.05), asn: 6327(-2.38), 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 04:10:41 -0000 In message <20191017020535.GB8053@FreeBSD.org>, Alexey Dokuchaev writes: > On Tue, Oct 15, 2019 at 10:00:51AM -0600, Ian Lepore wrote: > > On Tue, 2019-10-15 at 18:56 +0300, Andriy Gapon wrote: > > > On 15/10/2019 18:53, O. Hartmann wrote: > > > > -----BEGIN PGP SIGNED MESSAGE----- > > > > Hash: SHA256 > > > > > > > > Am Tue, 15 Oct 2019 15:09:36 +0000 (UTC) > > > > Andriy Gapon schrieb: > > > > > > Sorry, I got tired before I could scroll to your reply. > > > > You break the build, a user reports it, and a smartass reply is the > > best you can do? > > In Andriy's defense, O. Hartmann could have trimmed the log down to the > relevant build error lines rather than (uselessly) quoting entire diff. > It really takes a while to scroll down these emails of his, especially > on a slow connections. > > Overquoting in general is a big problem on FreeBSD lists, and I don't > know exactly why. It was not like that 15-20 years ago. Agreed. However, for me personally, trimming using my desktop client (exmh2) is simple. If I'm replying using my phone (K-9 mail), trimming is so time consuming and error prone (one wrong finger movement and you start over again, especially while riding the bus to work -- one bump in the road and I'm guaranteed starting over again) that it's next to impossible. As much as I dislike it, top posting might be more acceptable in those circumstances. Otherwise agreed. -- 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-all@freebsd.org Thu Oct 17 05:14:30 2019 Return-Path: Delivered-To: svn-src-all@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 9FE5F16E6BD; Thu, 17 Oct 2019 05:14:30 +0000 (UTC) (envelope-from linimon@lonesome.com) Received: from mail.soaustin.net (mail.soaustin.net [18.222.6.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.soaustin.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ty5L0MpXz3JrB; Thu, 17 Oct 2019 05:14:29 +0000 (UTC) (envelope-from linimon@lonesome.com) Received: from lonesome.com (unknown [18.188.142.31]) by mail.soaustin.net (Postfix) with ESMTPSA id B8D302A7D2; Thu, 17 Oct 2019 05:14:28 +0000 (UTC) Date: Thu, 17 Oct 2019 05:14:27 +0000 From: Mark Linimon To: Cy Schubert Cc: Alexey Dokuchaev , src-committers@freebsd.org, Ian Lepore , svn-src-all@freebsd.org, Andriy Gapon , svn-src-head@freebsd.org, "O. Hartmann" Subject: Re: svn commit: r353565 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys Message-ID: <20191017051426.GA2042@lonesome.com> References: <201910151509.x9FF9a2B031347@repo.freebsd.org> <20191015175357.3ee91a1c@thor.intern.walstatt.dynvpn.de> <00eaaf1a-392c-29e1-a035-e72c61423fb3@FreeBSD.org> <20191017020535.GB8053@FreeBSD.org> <201910170410.x9H4AYsP020790@slippy.cwsent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201910170410.x9H4AYsP020790@slippy.cwsent.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Rspamd-Queue-Id: 46ty5L0MpXz3JrB X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of linimon@lonesome.com has no SPF policy when checking 18.222.6.11) smtp.mailfrom=linimon@lonesome.com X-Spamd-Result: default: False [-1.49 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-0.93)[-0.929,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; IP_SCORE(-0.26)[ip: (0.02), ipnet: 18.220.0.0/14(0.13), asn: 16509(-1.42), country: US(-0.05)]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[lonesome.com]; AUTH_NA(1.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_MED(-0.20)[11.6.222.18.list.dnswl.org : 127.0.5.2]; 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:16509, ipnet:18.220.0.0/14, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 05:14:30 -0000 On Wed, Oct 16, 2019 at 09:10:34PM -0700, Cy Schubert wrote: > I'm replying using my phone (K-9 mail), trimming is so time consuming > and error prone (one wrong finger movement and you start over again, > especially while riding the bus to work -- one bump in the road and > I'm guaranteed starting over again) that it's next to impossible. While I'm sure that that's true, please look at it from my standpoint: with your phone emails I have to skip page after page to get to the meat of it. While this is merely annoying at home, it is extra painful when I am traveling and on e.g. crappy hotel wireless. May I ask you to please consider waiting to reply to long email messages, until you are at your home or office? Thanks. mcl From owner-svn-src-all@freebsd.org Thu Oct 17 06:21:09 2019 Return-Path: Delivered-To: svn-src-all@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 B4FCC16F8C4; Thu, 17 Oct 2019 06:21:09 +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 46tzZF4NKTz3MFF; Thu, 17 Oct 2019 06:21:09 +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 7AF041C5C7; Thu, 17 Oct 2019 06:21:09 +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 x9H6L9wU029753; Thu, 17 Oct 2019 06:21:09 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9H6L9Ge029752; Thu, 17 Oct 2019 06:21:09 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910170621.x9H6L9Ge029752@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 17 Oct 2019 06:21:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353677 - head/sys/dev/wbwd X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/wbwd X-SVN-Commit-Revision: 353677 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 06:21:09 -0000 Author: avg Date: Thu Oct 17 06:21:09 2019 New Revision: 353677 URL: https://svnweb.freebsd.org/changeset/base/353677 Log: wbwd: small clean-ups and improvements This change applies some suggestions by delphij from D21979. A write-only variable is removed. There is a diagnostic message if the driver does not recognize the chip. A chained if-statement is converted to a switch. MFC after: 3 weeks Modified: head/sys/dev/wbwd/wbwd.c Modified: head/sys/dev/wbwd/wbwd.c ============================================================================== --- head/sys/dev/wbwd/wbwd.c Thu Oct 17 05:50:57 2019 (r353676) +++ head/sys/dev/wbwd/wbwd.c Thu Oct 17 06:21:09 2019 (r353677) @@ -466,7 +466,7 @@ wb_probe(device_t dev) { char buf[128]; struct wb_softc *sc; - int found, j; + int j; uint8_t devid; uint8_t revid; @@ -478,7 +478,6 @@ wb_probe(device_t dev) sc = device_get_softc(dev); devid = superio_devid(dev) >> 8; revid = superio_revid(dev); - found = 0; for (j = 0; j < nitems(wb_devs); j++) { if (wb_devs[j].device_id == devid) { sc->chip = wb_devs[j].chip; @@ -489,6 +488,11 @@ wb_probe(device_t dev) return (BUS_PROBE_SPECIFIC); } } + if (bootverbose) { + device_printf(dev, + "unrecognized chip: devid 0x%02x, revid 0x%02x\n", + devid, revid); + } return (ENXIO); } @@ -504,20 +508,27 @@ wb_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; - sc->ctl_reg = 0xf5; - sc->time_reg = 0xf6; - sc->csr_reg = 0xf7; - if (sc->chip == w83697hf || sc->chip == w83697ug) { + /* Make sure WDT is enabled. */ + superio_dev_enable(dev, WB_LDN8_CR30_ACTIVE); + + switch (sc->chip) { + case w83697hf: + case w83697ug: sc->ctl_reg = 0xf3; sc->time_reg = 0xf4; - } else if (sc->chip == nct6102) { + sc->csr_reg = 0xf7; + break; + case nct6102: sc->ctl_reg = 0xf0; sc->time_reg = 0xf1; sc->csr_reg = 0xf2; + break; + default: + sc->ctl_reg = 0xf5; + sc->time_reg = 0xf6; + sc->csr_reg = 0xf7; + break; } - - /* Make sure WDT is enabled. */ - superio_dev_enable(dev, WB_LDN8_CR30_ACTIVE); switch (sc->chip) { case w83627hf: From owner-svn-src-all@freebsd.org Thu Oct 17 06:32:35 2019 Return-Path: Delivered-To: svn-src-all@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 AE16316FD13; Thu, 17 Oct 2019 06:32:35 +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 46tzqR3pf7z3Mwm; Thu, 17 Oct 2019 06:32:35 +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 6761A1C933; Thu, 17 Oct 2019 06:32:35 +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 x9H6WZHP038905; Thu, 17 Oct 2019 06:32:35 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9H6WZUv038903; Thu, 17 Oct 2019 06:32:35 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910170632.x9H6WZUv038903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 17 Oct 2019 06:32:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353678 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 353678 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 06:32:35 -0000 Author: avg Date: Thu Oct 17 06:32:34 2019 New Revision: 353678 URL: https://svnweb.freebsd.org/changeset/base/353678 Log: provide a way to assign taskqueue threads to a kernel process This can be used to group all threads belonging to a single logical entity under a common kernel process. I am planning to use the new interface for ZFS threads. MFC after: 4 weeks Modified: head/sys/kern/subr_taskqueue.c head/sys/sys/taskqueue.h Modified: head/sys/kern/subr_taskqueue.c ============================================================================== --- head/sys/kern/subr_taskqueue.c Thu Oct 17 06:21:09 2019 (r353677) +++ head/sys/kern/subr_taskqueue.c Thu Oct 17 06:32:34 2019 (r353678) @@ -654,7 +654,7 @@ taskqueue_swi_giant_run(void *dummy) static int _taskqueue_start_threads(struct taskqueue **tqp, int count, int pri, - cpuset_t *mask, const char *name, va_list ap) + cpuset_t *mask, struct proc *p, const char *name, va_list ap) { char ktname[MAXCOMLEN + 1]; struct thread *td; @@ -676,10 +676,10 @@ _taskqueue_start_threads(struct taskqueue **tqp, int c for (i = 0; i < count; i++) { if (count == 1) - error = kthread_add(taskqueue_thread_loop, tqp, NULL, + error = kthread_add(taskqueue_thread_loop, tqp, p, &tq->tq_threads[i], RFSTOPPED, 0, "%s", ktname); else - error = kthread_add(taskqueue_thread_loop, tqp, NULL, + error = kthread_add(taskqueue_thread_loop, tqp, p, &tq->tq_threads[i], RFSTOPPED, 0, "%s_%d", ktname, i); if (error) { @@ -729,12 +729,25 @@ taskqueue_start_threads(struct taskqueue **tqp, int co int error; va_start(ap, name); - error = _taskqueue_start_threads(tqp, count, pri, NULL, name, ap); + error = _taskqueue_start_threads(tqp, count, pri, NULL, NULL, name, ap); va_end(ap); return (error); } int +taskqueue_start_threads_in_proc(struct taskqueue **tqp, int count, int pri, + struct proc *proc, const char *name, ...) +{ + va_list ap; + int error; + + va_start(ap, name); + error = _taskqueue_start_threads(tqp, count, pri, NULL, proc, name, ap); + va_end(ap); + return (error); +} + +int taskqueue_start_threads_cpuset(struct taskqueue **tqp, int count, int pri, cpuset_t *mask, const char *name, ...) { @@ -742,7 +755,7 @@ taskqueue_start_threads_cpuset(struct taskqueue **tqp, int error; va_start(ap, name); - error = _taskqueue_start_threads(tqp, count, pri, mask, name, ap); + error = _taskqueue_start_threads(tqp, count, pri, mask, NULL, name, ap); va_end(ap); return (error); } Modified: head/sys/sys/taskqueue.h ============================================================================== --- head/sys/sys/taskqueue.h Thu Oct 17 06:21:09 2019 (r353677) +++ head/sys/sys/taskqueue.h Thu Oct 17 06:32:34 2019 (r353678) @@ -42,6 +42,7 @@ struct taskqueue; struct taskqgroup; +struct proc; struct thread; struct timeout_task { @@ -75,7 +76,9 @@ struct taskqueue *taskqueue_create(const char *name, i taskqueue_enqueue_fn enqueue, void *context); int taskqueue_start_threads(struct taskqueue **tqp, int count, int pri, - const char *name, ...) __printflike(4, 5); + const char *name, ...) __printflike(4, 5); +int taskqueue_start_threads_in_proc(struct taskqueue **tqp, int count, + int pri, struct proc *p, const char *name, ...) __printflike(5, 6); int taskqueue_start_threads_cpuset(struct taskqueue **tqp, int count, int pri, cpuset_t *mask, const char *name, ...) __printflike(5, 6); int taskqueue_enqueue(struct taskqueue *queue, struct task *task); From owner-svn-src-all@freebsd.org Thu Oct 17 06:58:09 2019 Return-Path: Delivered-To: svn-src-all@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 26AF11483B0; Thu, 17 Oct 2019 06:58:09 +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 46v0Nw53lkz3Nm8; Thu, 17 Oct 2019 06:58:08 +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 8DF281CCC1; Thu, 17 Oct 2019 06:58:08 +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 x9H6w8Ha050980; Thu, 17 Oct 2019 06:58:08 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9H6w89c050978; Thu, 17 Oct 2019 06:58:08 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910170658.x9H6w89c050978@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 17 Oct 2019 06:58:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353679 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 353679 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 06:58:09 -0000 Author: avg Date: Thu Oct 17 06:58:07 2019 New Revision: 353679 URL: https://svnweb.freebsd.org/changeset/base/353679 Log: document taskqueue_start_threads_in_proc While here, fix taskqueue_start_threads_cpuset that was documented under old name of taskqueue_start_threads_pinned. MFC after: 4 weeks Modified: head/share/man/man9/Makefile head/share/man/man9/taskqueue.9 Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Thu Oct 17 06:32:34 2019 (r353678) +++ head/share/man/man9/Makefile Thu Oct 17 06:58:07 2019 (r353679) @@ -2085,7 +2085,8 @@ MLINKS+=taskqueue.9 TASK_INIT.9 \ taskqueue.9 taskqueue_run.9 \ taskqueue.9 taskqueue_set_callback.9 \ taskqueue.9 taskqueue_start_threads.9 \ - taskqueue.9 taskqueue_start_threads_pinned.9 \ + taskqueue.9 taskqueue_start_threads_cpuset.9 \ + taskqueue.9 taskqueue_start_threads_in_proc.9 \ taskqueue.9 taskqueue_unblock.9 \ taskqueue.9 TIMEOUT_TASK_INIT.9 MLINKS+=tcp_functions.9 register_tcp_functions.9 \ Modified: head/share/man/man9/taskqueue.9 ============================================================================== --- head/share/man/man9/taskqueue.9 Thu Oct 17 06:32:34 2019 (r353678) +++ head/share/man/man9/taskqueue.9 Thu Oct 17 06:58:07 2019 (r353679) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 21, 2018 +.Dd October 17, 2019 .Dt TASKQUEUE 9 .Os .Sh NAME @@ -69,10 +69,15 @@ struct timeout_task; .Ft int .Fn taskqueue_start_threads "struct taskqueue **tqp" "int count" "int pri" "const char *name" "..." .Ft int -.Fo taskqueue_start_threads_pinned -.Fa "struct taskqueue **tqp" "int count" "int pri" "int cpu_id" +.Fo taskqueue_start_threads_cpuset +.Fa "struct taskqueue **tqp" "int count" "int pri" "cpuset_t *mask" .Fa "const char *name" "..." .Fc +.Ft int +.Fo taskqueue_start_threads_in_proc +.Fa "struct taskqueue **tqp" "int count" "int pri" "struct proc *proc" +.Fa "const char *name" "..." +.Fc .Ft void .Fn taskqueue_set_callback "struct taskqueue *queue" "enum taskqueue_callback_type cb_type" "taskqueue_callback_fn callback" "void *context" .Ft void @@ -152,14 +157,20 @@ Any tasks that are on the queue will be executed at th which the thread servicing the queue will be signaled that it should exit. .Pp Once a taskqueue has been created, its threads should be started using -.Fn taskqueue_start_threads +.Fn taskqueue_start_threads , +.Fn taskqueue_start_threads_cpuset or -.Fn taskqueue_start_threads_pinned . -.Fn taskqueue_start_threads_pinned +.Fn taskqueue_start_threads_in_proc . +.Fn taskqueue_start_threads_cpuset takes a -.Va cpu_id +.Va cpuset argument which will cause the threads which are started for the taskqueue -to be pinned to run on the given CPU. +to be restricted to run on the given CPUs. +.Fn taskqueue_start_threads_in_proc +takes a +.Va proc +argument which will cause the threads which are started for the taskqueue +to be assigned to the given kernel process. Callbacks may optionally be registered using .Fn taskqueue_set_callback . Currently, callbacks may be registered for the following purposes: From owner-svn-src-all@freebsd.org Thu Oct 17 10:02:10 2019 Return-Path: Delivered-To: svn-src-all@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 F2FEF14CBE8; Thu, 17 Oct 2019 10:02:10 +0000 (UTC) (envelope-from danfe@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 46v4TG6DFrz42fd; Thu, 17 Oct 2019 10:02:10 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id C2C7C1C7C1; Thu, 17 Oct 2019 10:02:10 +0000 (UTC) Date: Thu, 17 Oct 2019 10:02:10 +0000 From: Alexey Dokuchaev To: Mike Karels Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351379 - head/usr.bin/w Message-ID: <20191017100210.GA43419@FreeBSD.org> References: <201908220328.x7M3SVDU089700@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201908220328.x7M3SVDU089700@repo.freebsd.org> User-Agent: Mutt/1.11.4 (2019-03-13) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 10:02:11 -0000 On Thu, Aug 22, 2019 at 03:28:31AM +0000, Mike Karels wrote: > New Revision: 351379 > URL: https://svnweb.freebsd.org/changeset/base/351379 > > Log: > Change w(1) to compute FROM (host) field size dynamically > > It's nice to be able to display a full IPv6 host address if > needed, but it's also nice to display more than 3 characters of a command > line. Compute the needed size for the FROM column in an earlier pass, > and determine the maximum, then print what fits for the command. Thank you Mike, this had been bugging me for quite a while! Now I only need one-line W_DISPUSERSIZE=8 patch to get my perfect w(1). :-) ./danfe From owner-svn-src-all@freebsd.org Thu Oct 17 13:08:50 2019 Return-Path: Delivered-To: svn-src-all@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 D2E6F151FE7; Thu, 17 Oct 2019 13:08:50 +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 46v8cf5GvSz4CK5; Thu, 17 Oct 2019 13:08:50 +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 93F3A20E69; Thu, 17 Oct 2019 13:08:50 +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 x9HD8oMH067240; Thu, 17 Oct 2019 13:08:50 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HD8oEE067239; Thu, 17 Oct 2019 13:08:50 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201910171308.x9HD8oEE067239@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 17 Oct 2019 13:08:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353680 - head/sys/dev/vt X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/dev/vt X-SVN-Commit-Revision: 353680 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 13:08:50 -0000 Author: emaste Date: Thu Oct 17 13:08:50 2019 New Revision: 353680 URL: https://svnweb.freebsd.org/changeset/base/353680 Log: vt: remove comment that is not true since r259680 r259680 added support to vt(4) for printing double-width characters. Remove the comment that claims no support. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/vt_font.c Modified: head/sys/dev/vt/vt_font.c ============================================================================== --- head/sys/dev/vt/vt_font.c Thu Oct 17 06:58:07 2019 (r353679) +++ head/sys/dev/vt/vt_font.c Thu Oct 17 13:08:50 2019 (r353680) @@ -92,11 +92,6 @@ vtfont_lookup(const struct vt_font *vf, term_char_t c) unsigned int normal_map; unsigned int bold_map; - /* - * No support for printing right hand sides for CJK fullwidth - * characters. Simply print a space and assume that the left - * hand side describes the entire character. - */ src = TCHAR_CHARACTER(c); if (TCHAR_FORMAT(c) & TF_CJK_RIGHT) { normal_map = VFNT_MAP_NORMAL_RIGHT; From owner-svn-src-all@freebsd.org Thu Oct 17 13:49:48 2019 Return-Path: Delivered-To: svn-src-all@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 B15D4152D22; Thu, 17 Oct 2019 13:49:48 +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 46v9Ww40Tbz4F2b; Thu, 17 Oct 2019 13:49:48 +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 6C60221560; Thu, 17 Oct 2019 13:49:48 +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 x9HDnm4d090600; Thu, 17 Oct 2019 13:49:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HDnmno090599; Thu, 17 Oct 2019 13:49:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910171349.x9HDnmno090599@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 17 Oct 2019 13:49:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353681 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353681 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 13:49:48 -0000 Author: kib Date: Thu Oct 17 13:49:47 2019 New Revision: 353681 URL: https://svnweb.freebsd.org/changeset/base/353681 Log: swapon_check_swzone(): use already calculated static variables. Submitted by: ota@j.email.ne.jp MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22065 Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Thu Oct 17 13:08:50 2019 (r353680) +++ head/sys/vm/swap_pager.c Thu Oct 17 13:49:47 2019 (r353681) @@ -590,6 +590,7 @@ swap_pager_swap_init(void) if (n < n2) printf("Swap blk zone entries changed from %lu to %lu.\n", n2, n); + /* absolute maximum we can handle assuming 100% efficiency */ swap_maxpages = n * SWAP_META_PAGES; swzone = n * sizeof(struct swblk); if (!uma_zone_reserve_kva(swpctrie_zone, n)) @@ -2250,17 +2251,12 @@ done: static void swapon_check_swzone(void) { - unsigned long maxpages, npages; - npages = swap_total; - /* absolute maximum we can handle assuming 100% efficiency */ - maxpages = uma_zone_get_max(swblk_zone) * SWAP_META_PAGES; - /* recommend using no more than half that amount */ - if (npages > maxpages / 2) { + if (swap_total > swap_maxpages / 2) { printf("warning: total configured swap (%lu pages) " "exceeds maximum recommended amount (%lu pages).\n", - npages, maxpages / 2); + swap_total, swap_maxpages / 2); printf("warning: increase kern.maxswzone " "or reduce amount of swap.\n"); } From owner-svn-src-all@freebsd.org Thu Oct 17 14:58:04 2019 Return-Path: Delivered-To: svn-src-all@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 3918B154538; Thu, 17 Oct 2019 14:58:04 +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 46vC2h0nf5z4JRK; Thu, 17 Oct 2019 14:58:04 +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 F30C4221E2; Thu, 17 Oct 2019 14:58:03 +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 x9HEw3Kv031857; Thu, 17 Oct 2019 14:58:03 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HEw3I0031856; Thu, 17 Oct 2019 14:58:03 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201910171458.x9HEw3I0031856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 17 Oct 2019 14:58:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353682 - head/sys/dev/sound/pci/hda X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/dev/sound/pci/hda X-SVN-Commit-Revision: 353682 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 14:58:04 -0000 Author: emaste Date: Thu Oct 17 14:58:03 2019 New Revision: 353682 URL: https://svnweb.freebsd.org/changeset/base/353682 Log: snd_hda: style(9) whitespace fixup PR: 241299 Submitted by: Neel Chauhan Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdaa_patches.c Thu Oct 17 13:49:47 2019 (r353681) +++ head/sys/dev/sound/pci/hda/hdaa_patches.c Thu Oct 17 14:58:03 2019 (r353682) @@ -447,7 +447,7 @@ hdac_pin_patch(struct hdaa_widget *w) config = 0x01a1913d; break; } - } else if (id == HDA_CODEC_ALC256 && subid == DELL_I7577_SUBVENDOR ) { + } else if (id == HDA_CODEC_ALC256 && subid == DELL_I7577_SUBVENDOR) { switch (nid) { case 20: patch = "as=1 seq=0"; From owner-svn-src-all@freebsd.org Thu Oct 17 15:08:25 2019 Return-Path: Delivered-To: svn-src-all@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 EDC5F1548B5; Thu, 17 Oct 2019 15:08:25 +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 46vCGd3Yyjz4KCC; Thu, 17 Oct 2019 15:08:25 +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 x9HF8M4d047179 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 17 Oct 2019 08:08:22 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x9HF8MCf047178; Thu, 17 Oct 2019 08:08:22 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Thu, 17 Oct 2019 08:08:22 -0700 From: Gleb Smirnoff To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353635 - in head/sys: netinet netinet6 Message-ID: <20191017150822.GY4086@FreeBSD.org> References: <201910160911.x9G9BonH076337@repo.freebsd.org> <20191016165722.GU4086@FreeBSD.org> <138998a2-b304-fbe3-065d-e1df0a09af14@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <138998a2-b304-fbe3-065d-e1df0a09af14@selasky.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46vCGd3Yyjz4KCC X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.70 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.70)[-0.701,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 15:08:26 -0000 On Wed, Oct 16, 2019 at 10:46:44PM +0200, Hans Petter Selasky wrote: H> > as far as I remember I was against this changeset and I had H> > several other developers agreed that this should be fixed in H> > different way. Why did you proceed with checking it in? :( H> H> Hi Gleb, H> H> This issue has been discussed in-depth at various transport meetings and H> we have agreed on a solution. Is the list of people who agreed longer than "Reviewed by" list? H> Are you seeing something broken as of this patch? As I already explained, first, we are dropping absolutely legitimate packets. At the time of arrival there were nothing wrong about them. This is idelogically wrong from viewpoint of abstract network stack. Second, the problem should be fixed in a different way: when we put packets on the queue, we should take all important values out of the ifnet and store them on queue entry. -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Thu Oct 17 16:02:35 2019 Return-Path: Delivered-To: svn-src-all@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 3607E155E12; Thu, 17 Oct 2019 16:02:35 +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 46vDT70fNrz4Md9; Thu, 17 Oct 2019 16:02:35 +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 EE82622E53; Thu, 17 Oct 2019 16:02:34 +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 x9HG2YXJ072398; Thu, 17 Oct 2019 16:02:34 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HG2YHg072397; Thu, 17 Oct 2019 16:02:34 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910171602.x9HG2YHg072397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 17 Oct 2019 16:02:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353683 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 353683 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 16:02:35 -0000 Author: glebius Date: Thu Oct 17 16:02:34 2019 New Revision: 353683 URL: https://svnweb.freebsd.org/changeset/base/353683 Log: igmp_v1v2_queue_report() doesn't require epoch. Modified: head/sys/netinet/igmp.c Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Thu Oct 17 14:58:03 2019 (r353682) +++ head/sys/netinet/igmp.c Thu Oct 17 16:02:34 2019 (r353683) @@ -2179,7 +2179,6 @@ igmp_v1v2_queue_report(struct in_multi *inm, const int struct ip *ip; struct mbuf *m; - NET_EPOCH_ASSERT(); IN_MULTI_LIST_LOCK_ASSERT(); IGMP_LOCK_ASSERT(); From owner-svn-src-all@freebsd.org Thu Oct 17 16:20:25 2019 Return-Path: Delivered-To: svn-src-all@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 0534315678B; Thu, 17 Oct 2019 16:20:25 +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 46vDsh6Rtyz4NTk; Thu, 17 Oct 2019 16:20:24 +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 C1FD82306A; Thu, 17 Oct 2019 16:20:24 +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 x9HGKOAf078839; Thu, 17 Oct 2019 16:20:24 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HGKOOk078837; Thu, 17 Oct 2019 16:20:24 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201910171620.x9HGKOOk078837@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 17 Oct 2019 16:20:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r353684 - in releng/12.1/sys: arm/ti dev/sdhci X-SVN-Group: releng X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in releng/12.1/sys: arm/ti dev/sdhci X-SVN-Commit-Revision: 353684 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 16:20:25 -0000 Author: ian Date: Thu Oct 17 16:20:24 2019 New Revision: 353684 URL: https://svnweb.freebsd.org/changeset/base/353684 Log: MFC r353675 from stable-12 (r353651-r353652 from head)... r353651: Relax the sdhci(4) check that filters out the 1.8v voltage option unless the slot is flagged as 'embedded'. The features related to embedded and shared slots were added in v3.0 of the sdhci spec. Hardware prior to v3 sometimes supported 1.8v on non- removable devices in embedded systems, but had no way to indicate that via the standard sdhci registers (instead they use out of band metadata such as FDT data). This change adds the controller specification version to the check for whether to filter out the 1.8v selection. On older hardware, the 1.8v option is allowed to remain. On 3.0 or later it still requires the embedded-slot flag to remain. This is part of the fix for PR 241301 (eMMC not detected on Beaglebone). Changes to the sdhci_ti driver are also needed for a full fix. PR: 241301 r353652: Revert r351218 (by manu). While the changes in r351218 appear to be (and should be) correct, they lead to the eMMC on a Beaglebone failing to work in some situations. The TI sdhci hardware is kind of strange. The first device inherently supports 1.8v and 3.3v and the abililty to switch between them, and the other two devices must be set to 1.8v in the sdhci power control register to operate correctly, but doing so actually makes them run at 3.3v (unless an external level-shifter is present in the signal path). Even the 1.8v on the first device may actually be 3.3v (or any other value), depending on what voltage is fed to the VDDS1-VDDS7 power supply pins on the am335x chip. Another strange quirk is that the convention for am335x sdhci drivers in linux and uboot and the am335x boot ROM seems to be to set the voltage in the sdhci capabilities register to 3.0v even though the actual voltage is 3.3v. Why this is done is a complete mystery to me, but it seems to be required for correct operation. If we had complete modern support for the am335x chip we could get the actual voltages from the FDT data and the regulator framework. But our am335x code currently doesn't have any regulator framework support. Reverting to the prior code will get the popular Beaglebone boards working again. This is part of the fix for PR 241301, but also requires r353651 for a complete fix. PR: 241301 Discussed with: manu Approved by: re(kib) Modified: releng/12.1/sys/arm/ti/ti_sdhci.c releng/12.1/sys/dev/sdhci/sdhci.c Directory Properties: releng/12.1/ (props changed) Modified: releng/12.1/sys/arm/ti/ti_sdhci.c ============================================================================== --- releng/12.1/sys/arm/ti/ti_sdhci.c Thu Oct 17 16:02:34 2019 (r353683) +++ releng/12.1/sys/arm/ti/ti_sdhci.c Thu Oct 17 16:20:24 2019 (r353684) @@ -482,14 +482,15 @@ ti_sdhci_hw_init(device_t dev) * The attach() routine has examined fdt data and set flags in * slot.host.caps to reflect what voltages we can handle. Set those * values in the CAPA register. The manual says that these values can - * only be set once, and that they survive a reset so unless u-boot didn't - * set this register this code is a no-op. + * only be set once, "before initialization" whatever that means, and + * that they survive a reset. So maybe doing this will be a no-op if + * u-boot has already initialized the hardware. */ regval = ti_mmchs_read_4(sc, MMCHS_SD_CAPA); if (sc->slot.host.caps & MMC_OCR_LOW_VOLTAGE) regval |= MMCHS_SD_CAPA_VS18; - if (sc->slot.host.caps & (MMC_OCR_320_330 | MMC_OCR_330_340)) - regval |= MMCHS_SD_CAPA_VS33; + if (sc->slot.host.caps & (MMC_OCR_290_300 | MMC_OCR_300_310)) + regval |= MMCHS_SD_CAPA_VS30; ti_mmchs_write_4(sc, MMCHS_SD_CAPA, regval); /* Set initial host configuration (1-bit, std speed, pwr off). */ @@ -523,20 +524,17 @@ ti_sdhci_attach(device_t dev) } /* - * The hardware can inherently do dual-voltage (1p8v, 3p3v) on the first + * The hardware can inherently do dual-voltage (1p8v, 3p0v) on the first * device, and only 1p8v on other devices unless an external transceiver * is used. The only way we could know about a transceiver is fdt data. * Note that we have to do this before calling ti_sdhci_hw_init() so * that it can set the right values in the CAPA register, which can only * be done once and never reset. */ - if (OF_hasprop(node, "ti,dual-volt")) { - sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE | MMC_OCR_320_330 | MMC_OCR_330_340; - } else if (OF_hasprop(node, "no-1-8-v")) { - sc->slot.host.caps |= MMC_OCR_320_330 | MMC_OCR_330_340; - } else - sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE; - + sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE; + if (sc->mmchs_clk_id == MMC1_CLK || OF_hasprop(node, "ti,dual-volt")) { + sc->slot.host.caps |= MMC_OCR_290_300 | MMC_OCR_300_310; + } /* * Set the offset from the device's memory start to the MMCHS registers. Modified: releng/12.1/sys/dev/sdhci/sdhci.c ============================================================================== --- releng/12.1/sys/dev/sdhci/sdhci.c Thu Oct 17 16:02:34 2019 (r353683) +++ releng/12.1/sys/dev/sdhci/sdhci.c Thu Oct 17 16:20:24 2019 (r353684) @@ -902,8 +902,13 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, slot->host.host_ocr |= MMC_OCR_320_330 | MMC_OCR_330_340; if (caps & SDHCI_CAN_VDD_300) slot->host.host_ocr |= MMC_OCR_290_300 | MMC_OCR_300_310; - /* 1.8V VDD is not supposed to be used for removable cards. */ - if ((caps & SDHCI_CAN_VDD_180) && (slot->opt & SDHCI_SLOT_EMBEDDED)) + /* + * 1.8V VDD is not supposed to be used for removable cards. Hardware + * prior to v3.0 had no way to indicate embedded slots, but did + * sometimes support 1.8v for non-removable devices. + */ + if ((caps & SDHCI_CAN_VDD_180) && (slot->version < SDHCI_SPEC_300 || + (slot->opt & SDHCI_SLOT_EMBEDDED))) slot->host.host_ocr |= MMC_OCR_LOW_VOLTAGE; if (slot->host.host_ocr == 0) { slot_printf(slot, "Hardware doesn't report any " From owner-svn-src-all@freebsd.org Thu Oct 17 16:23:08 2019 Return-Path: Delivered-To: svn-src-all@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 48F601569DC; Thu, 17 Oct 2019 16: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 46vDwr1wXKz4Nrd; Thu, 17 Oct 2019 16: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 242D723223; Thu, 17 Oct 2019 16: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 x9HGN8nX084247; Thu, 17 Oct 2019 16:23:08 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HGN4oI084227; Thu, 17 Oct 2019 16:23:04 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910171623.x9HGN4oI084227@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 17 Oct 2019 16:23:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353685 - in head/sys: amd64/conf arm64/conf conf dev/alc dev/bge dev/bxe dev/cxgb dev/mlx4/mlx4_en dev/re dev/virtio/network i386/conf kern net netinet/netdump powerpc/conf sparc64/con... X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: amd64/conf arm64/conf conf dev/alc dev/bge dev/bxe dev/cxgb dev/mlx4/mlx4_en dev/re dev/virtio/network i386/conf kern net netinet/netdump powerpc/conf sparc64/conf sys X-SVN-Commit-Revision: 353685 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 16:23:08 -0000 Author: cem Date: Thu Oct 17 16:23:03 2019 New Revision: 353685 URL: https://svnweb.freebsd.org/changeset/base/353685 Log: Split out a more generic debugnet(4) from netdump(4) Debugnet is a simplistic and specialized panic- or debug-time reliable datagram transport. It can drive a single connection at a time and is currently unidirectional (debug/panic machine transmit to remote server only). It is mostly a verbatim code lift from netdump(4). Netdump(4) remains the only consumer (until the rest of this patch series lands). The INET-specific logic has been extracted somewhat more thoroughly than previously in netdump(4), into debugnet_inet.c. UDP-layer logic and up, as much as possible as is protocol-independent, remains in debugnet.c. The separation is not perfect and future improvement is welcome. Supporting INET6 is a long-term goal. Much of the diff is "gratuitous" renaming from 'netdump_' or 'nd_' to 'debugnet_' or 'dn_' -- sorry. I thought keeping the netdump name on the generic module would be more confusing than the refactoring. The only functional change here is the mbuf allocation / tracking. Instead of initiating solely on netdump-configured interface(s) at dumpon(8) configuration time, we watch for any debugnet-enabled NIC for link activation and query it for mbuf parameters at that time. If they exceed the existing high-water mark allocation, we re-allocate and track the new high-water mark. Otherwise, we leave the pre-panic mbuf allocation alone. In a future patch in this series, this will allow initiating netdump from panic ddb(4) without pre-panic configuration. No other functional change intended. Reviewed by: markj (earlier version) Some discussion with: emaste, jhb Objection from: marius Differential Revision: https://reviews.freebsd.org/D21421 Added: head/sys/net/debugnet.c (contents, props changed) head/sys/net/debugnet.h (contents, props changed) head/sys/net/debugnet_inet.c (contents, props changed) head/sys/net/debugnet_int.h (contents, props changed) Modified: head/sys/amd64/conf/GENERIC head/sys/arm64/conf/GENERIC head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options head/sys/dev/alc/if_alc.c head/sys/dev/bge/if_bge.c head/sys/dev/bxe/bxe.c head/sys/dev/bxe/bxe.h head/sys/dev/cxgb/cxgb_adapter.h head/sys/dev/cxgb/cxgb_main.c head/sys/dev/cxgb/cxgb_sge.c head/sys/dev/mlx4/mlx4_en/en.h head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c head/sys/dev/re/if_re.c head/sys/dev/virtio/network/if_vtnet.c head/sys/i386/conf/GENERIC head/sys/kern/kern_mbuf.c head/sys/net/if.c head/sys/net/if_var.h head/sys/net/iflib.c head/sys/netinet/netdump/netdump.h head/sys/netinet/netdump/netdump_client.c head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/GENERIC64 head/sys/sparc64/conf/GENERIC head/sys/sys/mbuf.h head/sys/sys/param.h Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Thu Oct 17 16:20:24 2019 (r353684) +++ head/sys/amd64/conf/GENERIC Thu Oct 17 16:23:03 2019 (r353685) @@ -111,6 +111,7 @@ options VERBOSE_SYSINIT=0 # Support debug.verbose_sys options EKCD # Support for encrypted kernel dumps options GZIO # gzip-compressed kernel and user dumps options ZSTDIO # zstd-compressed kernel and user dumps +options DEBUGNET # debugnet networking options NETDUMP # netdump(4) client support # Make an SMP-capable kernel by default Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Thu Oct 17 16:20:24 2019 (r353684) +++ head/sys/arm64/conf/GENERIC Thu Oct 17 16:23:03 2019 (r353685) @@ -103,6 +103,7 @@ options VERBOSE_SYSINIT=0 # Support debug.verbose_sys options EKCD # Support for encrypted kernel dumps options GZIO # gzip-compressed kernel and user dumps options ZSTDIO # zstd-compressed kernel and user dumps +options DEBUGNET # debugnet networking options NETDUMP # netdump(4) client support # SoC support Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Thu Oct 17 16:20:24 2019 (r353684) +++ head/sys/conf/NOTES Thu Oct 17 16:23:03 2019 (r353685) @@ -1042,6 +1042,10 @@ options DUMMYNET # This allows a panicking kernel to transmit a kernel dump to a remote host. options NETDUMP +# The DEBUGNET option enables a basic debug/panic-time networking API. It +# is used by NETDUMP. +options DEBUGNET + ##################################################################### # FILESYSTEM OPTIONS Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Oct 17 16:20:24 2019 (r353684) +++ head/sys/conf/files Thu Oct 17 16:23:03 2019 (r353685) @@ -4077,6 +4077,8 @@ net/mp_ring.c optional ether iflib net/mppcc.c optional netgraph_mppc_compression net/mppcd.c optional netgraph_mppc_compression net/netisr.c standard +net/debugnet.c optional inet debugnet +net/debugnet_inet.c optional inet debugnet net/pfil.c optional ether | inet net/radix.c standard net/radix_mpath.c standard Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Thu Oct 17 16:20:24 2019 (r353684) +++ head/sys/conf/options Thu Oct 17 16:23:03 2019 (r353685) @@ -321,6 +321,8 @@ NETSMB opt_netsmb.h # Enable netdump(4) client support. NETDUMP opt_global.h +# Enable debugnet(4) networking support. +DEBUGNET opt_global.h # Options used only in subr_param.c. HZ opt_param.h Modified: head/sys/dev/alc/if_alc.c ============================================================================== --- head/sys/dev/alc/if_alc.c Thu Oct 17 16:20:24 2019 (r353684) +++ head/sys/dev/alc/if_alc.c Thu Oct 17 16:23:03 2019 (r353685) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -64,7 +65,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -215,7 +215,7 @@ static int sysctl_int_range(SYSCTL_HANDLER_ARGS, int, static int sysctl_hw_alc_proc_limit(SYSCTL_HANDLER_ARGS); static int sysctl_hw_alc_int_mod(SYSCTL_HANDLER_ARGS); -NETDUMP_DEFINE(alc); +DEBUGNET_DEFINE(alc); static device_method_t alc_methods[] = { /* Device interface. */ @@ -1657,8 +1657,8 @@ alc_attach(device_t dev) goto fail; } - /* Attach driver netdump methods. */ - NETDUMP_SET(ifp, alc); + /* Attach driver debugnet methods. */ + DEBUGNET_SET(ifp, alc); fail: if (error != 0) @@ -4658,9 +4658,9 @@ sysctl_hw_alc_int_mod(SYSCTL_HANDLER_ARGS) ALC_IM_TIMER_MIN, ALC_IM_TIMER_MAX)); } -#ifdef NETDUMP +#ifdef DEBUGNET static void -alc_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) +alc_debugnet_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) { struct alc_softc *sc; @@ -4668,17 +4668,17 @@ alc_netdump_init(struct ifnet *ifp, int *nrxr, int *nc KASSERT(sc->alc_buf_size <= MCLBYTES, ("incorrect cluster size")); *nrxr = ALC_RX_RING_CNT; - *ncl = NETDUMP_MAX_IN_FLIGHT; + *ncl = DEBUGNET_MAX_IN_FLIGHT; *clsize = MCLBYTES; } static void -alc_netdump_event(struct ifnet *ifp __unused, enum netdump_ev event __unused) +alc_debugnet_event(struct ifnet *ifp __unused, enum debugnet_ev event __unused) { } static int -alc_netdump_transmit(struct ifnet *ifp, struct mbuf *m) +alc_debugnet_transmit(struct ifnet *ifp, struct mbuf *m) { struct alc_softc *sc; int error; @@ -4695,7 +4695,7 @@ alc_netdump_transmit(struct ifnet *ifp, struct mbuf *m } static int -alc_netdump_poll(struct ifnet *ifp, int count) +alc_debugnet_poll(struct ifnet *ifp, int count) { struct alc_softc *sc; @@ -4707,4 +4707,4 @@ alc_netdump_poll(struct ifnet *ifp, int count) alc_txeof(sc); return (alc_rxintr(sc, count)); } -#endif /* NETDUMP */ +#endif /* DEBUGNET */ Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Thu Oct 17 16:20:24 2019 (r353684) +++ head/sys/dev/bge/if_bge.c Thu Oct 17 16:23:03 2019 (r353685) @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -100,7 +101,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -519,7 +519,7 @@ static void bge_add_sysctl_stats(struct bge_softc *, s struct sysctl_oid_list *); static int bge_sysctl_stats(SYSCTL_HANDLER_ARGS); -NETDUMP_DEFINE(bge); +DEBUGNET_DEFINE(bge); static device_method_t bge_methods[] = { /* Device interface */ @@ -3983,8 +3983,8 @@ again: goto fail; } - /* Attach driver netdump methods. */ - NETDUMP_SET(ifp, bge); + /* Attach driver debugnet methods. */ + DEBUGNET_SET(ifp, bge); fail: if (error) @@ -6844,16 +6844,16 @@ bge_get_counter(if_t ifp, ift_counter cnt) } } -#ifdef NETDUMP +#ifdef DEBUGNET static void -bge_netdump_init(if_t ifp, int *nrxr, int *ncl, int *clsize) +bge_debugnet_init(if_t ifp, int *nrxr, int *ncl, int *clsize) { struct bge_softc *sc; sc = if_getsoftc(ifp); BGE_LOCK(sc); *nrxr = sc->bge_return_ring_cnt; - *ncl = NETDUMP_MAX_IN_FLIGHT; + *ncl = DEBUGNET_MAX_IN_FLIGHT; if ((sc->bge_flags & BGE_FLAG_JUMBO_STD) != 0 && (if_getmtu(sc->bge_ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN > (MCLBYTES - ETHER_ALIGN))) @@ -6864,12 +6864,12 @@ bge_netdump_init(if_t ifp, int *nrxr, int *ncl, int *c } static void -bge_netdump_event(if_t ifp __unused, enum netdump_ev event __unused) +bge_debugnet_event(if_t ifp __unused, enum debugnet_ev event __unused) { } static int -bge_netdump_transmit(if_t ifp, struct mbuf *m) +bge_debugnet_transmit(if_t ifp, struct mbuf *m) { struct bge_softc *sc; uint32_t prodidx; @@ -6888,7 +6888,7 @@ bge_netdump_transmit(if_t ifp, struct mbuf *m) } static int -bge_netdump_poll(if_t ifp, int count) +bge_debugnet_poll(if_t ifp, int count) { struct bge_softc *sc; uint32_t rx_prod, tx_cons; @@ -6913,4 +6913,4 @@ bge_netdump_poll(if_t ifp, int count) bge_txeof(sc, tx_cons); return (0); } -#endif /* NETDUMP */ +#endif /* DEBUGNET */ Modified: head/sys/dev/bxe/bxe.c ============================================================================== --- head/sys/dev/bxe/bxe.c Thu Oct 17 16:20:24 2019 (r353684) +++ head/sys/dev/bxe/bxe.c Thu Oct 17 16:23:03 2019 (r353685) @@ -237,7 +237,7 @@ MODULE_DEPEND(bxe, pci, 1, 1, 1); MODULE_DEPEND(bxe, ether, 1, 1, 1); DRIVER_MODULE(bxe, pci, bxe_driver, bxe_devclass, 0, 0); -NETDUMP_DEFINE(bxe); +DEBUGNET_DEFINE(bxe); /* resources needed for unloading a previously loaded device */ @@ -13124,8 +13124,8 @@ bxe_init_ifnet(struct bxe_softc *sc) /* attach to the Ethernet interface list */ ether_ifattach(ifp, sc->link_params.mac_addr); - /* Attach driver netdump methods. */ - NETDUMP_SET(ifp, bxe); + /* Attach driver debugnet methods. */ + DEBUGNET_SET(ifp, bxe); return (0); } @@ -19533,27 +19533,27 @@ bxe_eioctl(struct cdev *dev, u_long cmd, caddr_t data, return (rval); } -#ifdef NETDUMP +#ifdef DEBUGNET static void -bxe_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) +bxe_debugnet_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) { struct bxe_softc *sc; sc = if_getsoftc(ifp); BXE_CORE_LOCK(sc); *nrxr = sc->num_queues; - *ncl = NETDUMP_MAX_IN_FLIGHT; + *ncl = DEBUGNET_MAX_IN_FLIGHT; *clsize = sc->fp[0].mbuf_alloc_size; BXE_CORE_UNLOCK(sc); } static void -bxe_netdump_event(struct ifnet *ifp __unused, enum netdump_ev event __unused) +bxe_debugnet_event(struct ifnet *ifp __unused, enum debugnet_ev event __unused) { } static int -bxe_netdump_transmit(struct ifnet *ifp, struct mbuf *m) +bxe_debugnet_transmit(struct ifnet *ifp, struct mbuf *m) { struct bxe_softc *sc; int error; @@ -19570,7 +19570,7 @@ bxe_netdump_transmit(struct ifnet *ifp, struct mbuf *m } static int -bxe_netdump_poll(struct ifnet *ifp, int count) +bxe_debugnet_poll(struct ifnet *ifp, int count) { struct bxe_softc *sc; int i; @@ -19585,4 +19585,4 @@ bxe_netdump_poll(struct ifnet *ifp, int count) (void)bxe_txeof(sc, &sc->fp[0]); return (0); } -#endif /* NETDUMP */ +#endif /* DEBUGNET */ Modified: head/sys/dev/bxe/bxe.h ============================================================================== --- head/sys/dev/bxe/bxe.h Thu Oct 17 16:20:24 2019 (r353684) +++ head/sys/dev/bxe/bxe.h Thu Oct 17 16:23:03 2019 (r353685) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -70,7 +71,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- head/sys/dev/cxgb/cxgb_adapter.h Thu Oct 17 16:20:24 2019 (r353684) +++ head/sys/dev/cxgb/cxgb_adapter.h Thu Oct 17 16:23:03 2019 (r353685) @@ -578,10 +578,10 @@ void cxgb_qflush(struct ifnet *ifp); void t3_iterate(void (*)(struct adapter *, void *), void *); void cxgb_refresh_stats(struct port_info *); -#ifdef NETDUMP -int cxgb_netdump_encap(struct sge_qset *qs, struct mbuf **m); -int cxgb_netdump_poll_rx(adapter_t *adap, struct sge_qset *qs); -int cxgb_netdump_poll_tx(struct sge_qset *qs); +#ifdef DEBUGNET +int cxgb_debugnet_encap(struct sge_qset *qs, struct mbuf **m); +int cxgb_debugnet_poll_rx(adapter_t *adap, struct sge_qset *qs); +int cxgb_debugnet_poll_tx(struct sge_qset *qs); #endif #endif Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Thu Oct 17 16:20:24 2019 (r353684) +++ head/sys/dev/cxgb/cxgb_main.c Thu Oct 17 16:23:03 2019 (r353685) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -74,7 +75,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -218,7 +218,7 @@ static devclass_t cxgb_port_devclass; DRIVER_MODULE(cxgb, cxgbc, cxgb_port_driver, cxgb_port_devclass, 0, 0); MODULE_VERSION(cxgb, 1); -NETDUMP_DEFINE(cxgb); +DEBUGNET_DEFINE(cxgb); static struct mtx t3_list_lock; static SLIST_HEAD(, adapter) t3_list; @@ -1053,8 +1053,8 @@ cxgb_port_attach(device_t dev) ether_ifattach(ifp, p->hw_addr); - /* Attach driver netdump methods. */ - NETDUMP_SET(ifp, cxgb); + /* Attach driver debugnet methods. */ + DEBUGNET_SET(ifp, cxgb); #ifdef DEFAULT_JUMBO if (sc->params.nports <= 2) @@ -3590,9 +3590,9 @@ cxgbc_mod_event(module_t mod, int cmd, void *arg) return (rc); } -#ifdef NETDUMP +#ifdef DEBUGNET static void -cxgb_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) +cxgb_debugnet_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) { struct port_info *pi; adapter_t *adap; @@ -3607,18 +3607,18 @@ cxgb_netdump_init(struct ifnet *ifp, int *nrxr, int *n } static void -cxgb_netdump_event(struct ifnet *ifp, enum netdump_ev event) +cxgb_debugnet_event(struct ifnet *ifp, enum debugnet_ev event) { struct port_info *pi; struct sge_qset *qs; int i; pi = if_getsoftc(ifp); - if (event == NETDUMP_START) + if (event == DEBUGNET_START) for (i = 0; i < pi->adapter->nqsets; i++) { qs = &pi->adapter->sge.qs[i]; - /* Need to reinit after netdump_mbuf_dump(). */ + /* Need to reinit after debugnet_mbuf_start(). */ qs->fl[0].zone = zone_pack; qs->fl[1].zone = zone_clust; qs->lro.enabled = 0; @@ -3626,7 +3626,7 @@ cxgb_netdump_event(struct ifnet *ifp, enum netdump_ev } static int -cxgb_netdump_transmit(struct ifnet *ifp, struct mbuf *m) +cxgb_debugnet_transmit(struct ifnet *ifp, struct mbuf *m) { struct port_info *pi; struct sge_qset *qs; @@ -3637,11 +3637,11 @@ cxgb_netdump_transmit(struct ifnet *ifp, struct mbuf * return (ENOENT); qs = &pi->adapter->sge.qs[pi->first_qset]; - return (cxgb_netdump_encap(qs, &m)); + return (cxgb_debugnet_encap(qs, &m)); } static int -cxgb_netdump_poll(struct ifnet *ifp, int count) +cxgb_debugnet_poll(struct ifnet *ifp, int count) { struct port_info *pi; adapter_t *adap; @@ -3653,8 +3653,8 @@ cxgb_netdump_poll(struct ifnet *ifp, int count) adap = pi->adapter; for (i = 0; i < adap->nqsets; i++) - (void)cxgb_netdump_poll_rx(adap, &adap->sge.qs[i]); - (void)cxgb_netdump_poll_tx(&adap->sge.qs[pi->first_qset]); + (void)cxgb_debugnet_poll_rx(adap, &adap->sge.qs[i]); + (void)cxgb_debugnet_poll_tx(&adap->sge.qs[pi->first_qset]); return (0); } -#endif /* NETDUMP */ +#endif /* DEBUGNET */ Modified: head/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- head/sys/dev/cxgb/cxgb_sge.c Thu Oct 17 16:20:24 2019 (r353684) +++ head/sys/dev/cxgb/cxgb_sge.c Thu Oct 17 16:23:03 2019 (r353685) @@ -390,9 +390,9 @@ reclaim_completed_tx(struct sge_qset *qs, int reclaim_ return (reclaim); } -#ifdef NETDUMP +#ifdef DEBUGNET int -cxgb_netdump_poll_tx(struct sge_qset *qs) +cxgb_debugnet_poll_tx(struct sge_qset *qs) { return (reclaim_completed_tx(qs, TX_RECLAIM_MAX, TXQ_ETH)); @@ -1595,9 +1595,9 @@ t3_encap(struct sge_qset *qs, struct mbuf **m) return (0); } -#ifdef NETDUMP +#ifdef DEBUGNET int -cxgb_netdump_encap(struct sge_qset *qs, struct mbuf **m) +cxgb_debugnet_encap(struct sge_qset *qs, struct mbuf **m) { int error; @@ -3040,9 +3040,9 @@ process_responses_gts(adapter_t *adap, struct sge_rspq return (work); } -#ifdef NETDUMP +#ifdef DEBUGNET int -cxgb_netdump_poll_rx(adapter_t *adap, struct sge_qset *qs) +cxgb_debugnet_poll_rx(adapter_t *adap, struct sge_qset *qs) { return (process_responses_gts(adap, &qs->rspq)); Modified: head/sys/dev/mlx4/mlx4_en/en.h ============================================================================== --- head/sys/dev/mlx4/mlx4_en/en.h Thu Oct 17 16:20:24 2019 (r353684) +++ head/sys/dev/mlx4/mlx4_en/en.h Thu Oct 17 16:23:03 2019 (r353685) @@ -53,8 +53,8 @@ #include #include +#include #include -#include #include "en_port.h" #include Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Thu Oct 17 16:20:24 2019 (r353684) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Thu Oct 17 16:23:03 2019 (r353685) @@ -54,7 +54,7 @@ #include "en.h" #include "en_port.h" -NETDUMP_DEFINE(mlx4_en); +DEBUGNET_DEFINE(mlx4_en); static void mlx4_en_sysctl_stat(struct mlx4_en_priv *priv); static void mlx4_en_sysctl_conf(struct mlx4_en_priv *priv); @@ -2304,7 +2304,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL); ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO); - NETDUMP_SET(dev, mlx4_en); + DEBUGNET_SET(dev, mlx4_en); en_warn(priv, "Using %d TX rings\n", prof->tx_ring_num); en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num); @@ -2888,27 +2888,27 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p } } -#ifdef NETDUMP +#ifdef DEBUGNET static void -mlx4_en_netdump_init(struct ifnet *dev, int *nrxr, int *ncl, int *clsize) +mlx4_en_debugnet_init(struct ifnet *dev, int *nrxr, int *ncl, int *clsize) { struct mlx4_en_priv *priv; priv = if_getsoftc(dev); mutex_lock(&priv->mdev->state_lock); *nrxr = priv->rx_ring_num; - *ncl = NETDUMP_MAX_IN_FLIGHT; + *ncl = DEBUGNET_MAX_IN_FLIGHT; *clsize = priv->rx_mb_size; mutex_unlock(&priv->mdev->state_lock); } static void -mlx4_en_netdump_event(struct ifnet *dev, enum netdump_ev event) +mlx4_en_debugnet_event(struct ifnet *dev, enum debugnet_ev event) { } static int -mlx4_en_netdump_transmit(struct ifnet *dev, struct mbuf *m) +mlx4_en_debugnet_transmit(struct ifnet *dev, struct mbuf *m) { struct mlx4_en_priv *priv; int err; @@ -2925,7 +2925,7 @@ mlx4_en_netdump_transmit(struct ifnet *dev, struct mbu } static int -mlx4_en_netdump_poll(struct ifnet *dev, int count) +mlx4_en_debugnet_poll(struct ifnet *dev, int count) { struct mlx4_en_priv *priv; @@ -2937,4 +2937,4 @@ mlx4_en_netdump_poll(struct ifnet *dev, int count) return (0); } -#endif /* NETDUMP */ +#endif /* DEBUGNET */ Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Thu Oct 17 16:20:24 2019 (r353684) +++ head/sys/dev/re/if_re.c Thu Oct 17 16:23:03 2019 (r353685) @@ -128,6 +128,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -139,8 +140,6 @@ __FBSDID("$FreeBSD$"); #include -#include - #include #include #include @@ -310,7 +309,7 @@ static void re_setwol (struct rl_softc *); static void re_clrwol (struct rl_softc *); static void re_set_linkspeed (struct rl_softc *); -NETDUMP_DEFINE(re); +DEBUGNET_DEFINE(re); #ifdef DEV_NETMAP /* see ixgbe.c for details */ #include @@ -1745,7 +1744,7 @@ re_attach(device_t dev) goto fail; } - NETDUMP_SET(ifp, re); + DEBUGNET_SET(ifp, re); fail: if (error) @@ -4093,28 +4092,28 @@ sysctl_hw_re_int_mod(SYSCTL_HANDLER_ARGS) RL_TIMER_MAX)); } -#ifdef NETDUMP +#ifdef DEBUGNET static void -re_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) +re_debugnet_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) { struct rl_softc *sc; sc = if_getsoftc(ifp); RL_LOCK(sc); *nrxr = sc->rl_ldata.rl_rx_desc_cnt; - *ncl = NETDUMP_MAX_IN_FLIGHT; + *ncl = DEBUGNET_MAX_IN_FLIGHT; *clsize = (ifp->if_mtu > RL_MTU && (sc->rl_flags & RL_FLAG_JUMBOV2) != 0) ? MJUM9BYTES : MCLBYTES; RL_UNLOCK(sc); } static void -re_netdump_event(struct ifnet *ifp __unused, enum netdump_ev event __unused) +re_debugnet_event(struct ifnet *ifp __unused, enum debugnet_ev event __unused) { } static int -re_netdump_transmit(struct ifnet *ifp, struct mbuf *m) +re_debugnet_transmit(struct ifnet *ifp, struct mbuf *m) { struct rl_softc *sc; int error; @@ -4131,7 +4130,7 @@ re_netdump_transmit(struct ifnet *ifp, struct mbuf *m) } static int -re_netdump_poll(struct ifnet *ifp, int count) +re_debugnet_poll(struct ifnet *ifp, int count) { struct rl_softc *sc; int error; @@ -4147,4 +4146,4 @@ re_netdump_poll(struct ifnet *ifp, int count) return (error); return (0); } -#endif /* NETDUMP */ +#endif /* DEBUGNET */ Modified: head/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- head/sys/dev/virtio/network/if_vtnet.c Thu Oct 17 16:20:24 2019 (r353684) +++ head/sys/dev/virtio/network/if_vtnet.c Thu Oct 17 16:23:03 2019 (r353685) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -69,7 +70,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -230,7 +230,7 @@ static void vtnet_disable_interrupts(struct vtnet_soft static int vtnet_tunable_int(struct vtnet_softc *, const char *, int); -NETDUMP_DEFINE(vtnet); +DEBUGNET_DEFINE(vtnet); /* Tunables. */ static SYSCTL_NODE(_hw, OID_AUTO, vtnet, CTLFLAG_RD, 0, "VNET driver parameters"); @@ -1025,7 +1025,7 @@ vtnet_setup_interface(struct vtnet_softc *sc) vtnet_set_rx_process_limit(sc); vtnet_set_tx_intr_threshold(sc); - NETDUMP_SET(ifp, vtnet); + DEBUGNET_SET(ifp, vtnet); return (0); } @@ -3972,9 +3972,9 @@ vtnet_tunable_int(struct vtnet_softc *sc, const char * return (def); } -#ifdef NETDUMP +#ifdef DEBUGNET static void -vtnet_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) +vtnet_debugnet_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) { struct vtnet_softc *sc; @@ -3982,7 +3982,7 @@ vtnet_netdump_init(struct ifnet *ifp, int *nrxr, int * VTNET_CORE_LOCK(sc); *nrxr = sc->vtnet_max_vq_pairs; - *ncl = NETDUMP_MAX_IN_FLIGHT; + *ncl = DEBUGNET_MAX_IN_FLIGHT; *clsize = sc->vtnet_rx_clsize; VTNET_CORE_UNLOCK(sc); @@ -3992,17 +3992,17 @@ vtnet_netdump_init(struct ifnet *ifp, int *nrxr, int * * XXX add a separate zone like we do for mbufs? otherwise we may alloc * buckets */ - uma_zone_reserve(vtnet_tx_header_zone, NETDUMP_MAX_IN_FLIGHT * 2); - uma_prealloc(vtnet_tx_header_zone, NETDUMP_MAX_IN_FLIGHT * 2); + uma_zone_reserve(vtnet_tx_header_zone, DEBUGNET_MAX_IN_FLIGHT * 2); + uma_prealloc(vtnet_tx_header_zone, DEBUGNET_MAX_IN_FLIGHT * 2); } static void -vtnet_netdump_event(struct ifnet *ifp __unused, enum netdump_ev event __unused) +vtnet_debugnet_event(struct ifnet *ifp __unused, enum debugnet_ev event __unused) { } static int -vtnet_netdump_transmit(struct ifnet *ifp, struct mbuf *m) +vtnet_debugnet_transmit(struct ifnet *ifp, struct mbuf *m) { struct vtnet_softc *sc; struct vtnet_txq *txq; @@ -4021,7 +4021,7 @@ vtnet_netdump_transmit(struct ifnet *ifp, struct mbuf } static int -vtnet_netdump_poll(struct ifnet *ifp, int count) +vtnet_debugnet_poll(struct ifnet *ifp, int count) { struct vtnet_softc *sc; int i; @@ -4036,4 +4036,4 @@ vtnet_netdump_poll(struct ifnet *ifp, int count) (void)vtnet_rxq_eof(&sc->vtnet_rxqs[i]); return (0); } -#endif /* NETDUMP */ +#endif /* DEBUGNET */ Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Thu Oct 17 16:20:24 2019 (r353684) +++ head/sys/i386/conf/GENERIC Thu Oct 17 16:23:03 2019 (r353685) @@ -99,6 +99,7 @@ options VERBOSE_SYSINIT=0 # Support debug.verbose_sys options EKCD # Support for encrypted kernel dumps options GZIO # gzip-compressed kernel and user dumps options ZSTDIO # zstd-compressed kernel and user dumps +options DEBUGNET # debugnet networking options NETDUMP # netdump(4) client support # To make an SMP kernel, the next two lines are needed Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Thu Oct 17 16:20:24 2019 (r353684) +++ head/sys/kern/kern_mbuf.c Thu Oct 17 16:23:03 2019 (r353685) @@ -413,10 +413,10 @@ mbuf_init(void *dummy) } SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbuf_init, NULL); -#ifdef NETDUMP +#ifdef DEBUGNET /* - * netdump makes use of a pre-allocated pool of mbufs and clusters. When - * netdump is configured, we initialize a set of UMA cache zones which return + * debugnet makes use of a pre-allocated pool of mbufs and clusters. When + * debugnet is configured, we initialize a set of UMA cache zones which return * items from this pool. At panic-time, the regular UMA zone pointers are * overwritten with those of the cache zones so that drivers may allocate and * free mbufs and clusters without attempting to allocate physical memory. @@ -424,18 +424,28 @@ SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbuf_init, * We keep mbufs and clusters in a pair of mbuf queues. In particular, for * the purpose of caching clusters, we treat them as mbufs. */ -static struct mbufq nd_mbufq = - { STAILQ_HEAD_INITIALIZER(nd_mbufq.mq_head), 0, INT_MAX }; -static struct mbufq nd_clustq = - { STAILQ_HEAD_INITIALIZER(nd_clustq.mq_head), 0, INT_MAX }; +static struct mbufq dn_mbufq = + { STAILQ_HEAD_INITIALIZER(dn_mbufq.mq_head), 0, INT_MAX }; +static struct mbufq dn_clustq = + { STAILQ_HEAD_INITIALIZER(dn_clustq.mq_head), 0, INT_MAX }; -static int nd_clsize; -static uma_zone_t nd_zone_mbuf; -static uma_zone_t nd_zone_clust; -static uma_zone_t nd_zone_pack; +static int dn_clsize; +static uma_zone_t dn_zone_mbuf; +static uma_zone_t dn_zone_clust; +static uma_zone_t dn_zone_pack; +static struct debugnet_saved_zones { + uma_zone_t dsz_mbuf; + uma_zone_t dsz_clust; + uma_zone_t dsz_pack; + uma_zone_t dsz_jumbop; + uma_zone_t dsz_jumbo9; + uma_zone_t dsz_jumbo16; + bool dsz_debugnet_zones_enabled; +} dn_saved_zones; + static int -nd_buf_import(void *arg, void **store, int count, int domain __unused, +dn_buf_import(void *arg, void **store, int count, int domain __unused, int flags) { struct mbufq *q; @@ -448,7 +458,7 @@ nd_buf_import(void *arg, void **store, int count, int m = mbufq_dequeue(q); if (m == NULL) break; - trash_init(m, q == &nd_mbufq ? MSIZE : nd_clsize, flags); + trash_init(m, q == &dn_mbufq ? MSIZE : dn_clsize, flags); store[i] = m; } KASSERT((flags & M_WAITOK) == 0 || i == count, @@ -457,7 +467,7 @@ nd_buf_import(void *arg, void **store, int count, int } static void -nd_buf_release(void *arg, void **store, int count) +dn_buf_release(void *arg, void **store, int count) { struct mbufq *q; struct mbuf *m; @@ -472,7 +482,7 @@ nd_buf_release(void *arg, void **store, int count) } static int -nd_pack_import(void *arg __unused, void **store, int count, int domain __unused, +dn_pack_import(void *arg __unused, void **store, int count, int domain __unused, int flags __unused) { struct mbuf *m; @@ -483,12 +493,12 @@ nd_pack_import(void *arg __unused, void **store, int c m = m_get(MT_DATA, M_NOWAIT); if (m == NULL) break; - clust = uma_zalloc(nd_zone_clust, M_NOWAIT); + clust = uma_zalloc(dn_zone_clust, M_NOWAIT); if (clust == NULL) { m_free(m); break; } - mb_ctor_clust(clust, nd_clsize, m, 0); + mb_ctor_clust(clust, dn_clsize, m, 0); store[i] = m; } KASSERT((flags & M_WAITOK) == 0 || i == count, @@ -497,7 +507,7 @@ nd_pack_import(void *arg __unused, void **store, int c } static void -nd_pack_release(void *arg __unused, void **store, int count) +dn_pack_release(void *arg __unused, void **store, int count) { struct mbuf *m; void *clust; @@ -506,109 +516,142 @@ nd_pack_release(void *arg __unused, void **store, int for (i = 0; i < count; i++) { m = store[i]; clust = m->m_ext.ext_buf; - uma_zfree(nd_zone_clust, clust); - uma_zfree(nd_zone_mbuf, m); + uma_zfree(dn_zone_clust, clust); + uma_zfree(dn_zone_mbuf, m); } } /* - * Free the pre-allocated mbufs and clusters reserved for netdump, and destroy + * Free the pre-allocated mbufs and clusters reserved for debugnet, and destroy * the corresponding UMA cache zones. */ void -netdump_mbuf_drain(void) +debugnet_mbuf_drain(void) { struct mbuf *m; void *item; - if (nd_zone_mbuf != NULL) { - uma_zdestroy(nd_zone_mbuf); - nd_zone_mbuf = NULL; + if (dn_zone_mbuf != NULL) { + uma_zdestroy(dn_zone_mbuf); + dn_zone_mbuf = NULL; } - if (nd_zone_clust != NULL) { - uma_zdestroy(nd_zone_clust); - nd_zone_clust = NULL; + if (dn_zone_clust != NULL) { + uma_zdestroy(dn_zone_clust); + dn_zone_clust = NULL; } - if (nd_zone_pack != NULL) { - uma_zdestroy(nd_zone_pack); - nd_zone_pack = NULL; + if (dn_zone_pack != NULL) { + uma_zdestroy(dn_zone_pack); + dn_zone_pack = NULL; } - while ((m = mbufq_dequeue(&nd_mbufq)) != NULL) + while ((m = mbufq_dequeue(&dn_mbufq)) != NULL) m_free(m); - while ((item = mbufq_dequeue(&nd_clustq)) != NULL) - uma_zfree(m_getzone(nd_clsize), item); + while ((item = mbufq_dequeue(&dn_clustq)) != NULL) + uma_zfree(m_getzone(dn_clsize), item); } /* - * Callback invoked immediately prior to starting a netdump. + * Callback invoked immediately prior to starting a debugnet connection. */ void -netdump_mbuf_dump(void) +debugnet_mbuf_start(void) { + MPASS(!dn_saved_zones.dsz_debugnet_zones_enabled); + + /* Save the old zone pointers to restore when debugnet is closed. */ + dn_saved_zones = (struct debugnet_saved_zones) { + .dsz_debugnet_zones_enabled = true, + .dsz_mbuf = zone_mbuf, + .dsz_clust = zone_clust, + .dsz_pack = zone_pack, + .dsz_jumbop = zone_jumbop, + .dsz_jumbo9 = zone_jumbo9, + .dsz_jumbo16 = zone_jumbo16, + }; + /* * All cluster zones return buffers of the size requested by the * drivers. It's up to the driver to reinitialize the zones if the - * MTU of a netdump-enabled interface changes. + * MTU of a debugnet-enabled interface changes. */ - printf("netdump: overwriting mbuf zone pointers\n"); - zone_mbuf = nd_zone_mbuf; - zone_clust = nd_zone_clust; - zone_pack = nd_zone_pack; - zone_jumbop = nd_zone_clust; - zone_jumbo9 = nd_zone_clust; - zone_jumbo16 = nd_zone_clust; + printf("debugnet: overwriting mbuf zone pointers\n"); + zone_mbuf = dn_zone_mbuf; + zone_clust = dn_zone_clust; + zone_pack = dn_zone_pack; + zone_jumbop = dn_zone_clust; + zone_jumbo9 = dn_zone_clust; + zone_jumbo16 = dn_zone_clust; } /* - * Reinitialize the netdump mbuf+cluster pool and cache zones. + * Callback invoked when a debugnet connection is closed/finished. */ void -netdump_mbuf_reinit(int nmbuf, int nclust, int clsize) +debugnet_mbuf_finish(void) { + + MPASS(dn_saved_zones.dsz_debugnet_zones_enabled); + + printf("debugnet: restoring mbuf zone pointers\n"); + zone_mbuf = dn_saved_zones.dsz_mbuf; + zone_clust = dn_saved_zones.dsz_clust; + zone_pack = dn_saved_zones.dsz_pack; + zone_jumbop = dn_saved_zones.dsz_jumbop; + zone_jumbo9 = dn_saved_zones.dsz_jumbo9; + zone_jumbo16 = dn_saved_zones.dsz_jumbo16; + + memset(&dn_saved_zones, 0, sizeof(dn_saved_zones)); +} + +/* + * Reinitialize the debugnet mbuf+cluster pool and cache zones. + */ +void +debugnet_mbuf_reinit(int nmbuf, int nclust, int clsize) +{ struct mbuf *m; void *item; - netdump_mbuf_drain(); + debugnet_mbuf_drain(); - nd_clsize = clsize; + dn_clsize = clsize; - nd_zone_mbuf = uma_zcache_create("netdump_" MBUF_MEM_NAME, + dn_zone_mbuf = uma_zcache_create("debugnet_" MBUF_MEM_NAME, MSIZE, mb_ctor_mbuf, mb_dtor_mbuf, #ifdef INVARIANTS trash_init, trash_fini, #else NULL, NULL, #endif - nd_buf_import, nd_buf_release, - &nd_mbufq, UMA_ZONE_NOBUCKET); + dn_buf_import, dn_buf_release, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Oct 17 16:38:45 2019 Return-Path: Delivered-To: svn-src-all@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 9D3F1156F04; Thu, 17 Oct 2019 16:38:45 +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 46vFGs3hqnz4Pbc; Thu, 17 Oct 2019 16:38:45 +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 62B5C233E7; Thu, 17 Oct 2019 16:38:45 +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 x9HGcjR9090674; Thu, 17 Oct 2019 16:38:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HGcjJK090673; Thu, 17 Oct 2019 16:38:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201910171638.x9HGcjJK090673@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 17 Oct 2019 16:38:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353686 - in head/sys/dev/vt: . logo X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys/dev/vt: . logo X-SVN-Commit-Revision: 353686 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 16:38:45 -0000 Author: emaste Date: Thu Oct 17 16:38:44 2019 New Revision: 353686 URL: https://svnweb.freebsd.org/changeset/base/353686 Log: Update Conrad Meyer's email cem is now a committer Approved by: cem Modified: head/sys/dev/vt/logo/logo_beastie.c head/sys/dev/vt/vt_cpulogos.c Modified: head/sys/dev/vt/logo/logo_beastie.c ============================================================================== --- head/sys/dev/vt/logo/logo_beastie.c Thu Oct 17 16:23:03 2019 (r353685) +++ head/sys/dev/vt/logo/logo_beastie.c Thu Oct 17 16:38:44 2019 (r353686) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Conrad Meyer + * Copyright (c) 2015 Conrad Meyer * Copyright (c) 2005 The FreeBSD Foundation * Copyright (c) 1996 Larry Ewing * Copyright (c) 1988 Kirk McKusick Modified: head/sys/dev/vt/vt_cpulogos.c ============================================================================== --- head/sys/dev/vt/vt_cpulogos.c Thu Oct 17 16:23:03 2019 (r353685) +++ head/sys/dev/vt/vt_cpulogos.c Thu Oct 17 16:38:44 2019 (r353686) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Conrad Meyer + * Copyright (c) 2015 Conrad Meyer * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-all@freebsd.org Thu Oct 17 16:51:45 2019 Return-Path: Delivered-To: svn-src-all@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 3F128157370; Thu, 17 Oct 2019 16:51:45 +0000 (UTC) (envelope-from markjdb@gmail.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 46vFYs0x4Fz4QGM; Thu, 17 Oct 2019 16:51:44 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt1-x832.google.com with SMTP id m15so4608701qtq.2; Thu, 17 Oct 2019 09:51:44 -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=TMKTsIrENQ0SxrnrsiN6wNDNLgB5AusSjxXzNHE3dsw=; b=ch8QAlyV7HjmkE0PBbJTXwyrmIXlQbb2CgfCRWFDnRenjO5QxaS3U6RE1TvcvIjBrB rTKwWrsTFuHdt4FWoe0DWvneJgKpxfgCbasobaK0T7nsIER9lN6TZc4oRZIqFMaxFbdn bS6L/fyFQ9H3lamDjntwBLTrTa5IGkkaiD6vD/PU6sxERaCLQML9xVx540cC/hltNUa8 oNaROOzYFZGq0DJRxnDNCq4deUFhQC862ZVh7urqD9hEiaEecp94hDXnDsLl/HFOmizD 6d0DVG+c9hZPycYy7pw+saIJ3eXZNGDYPEK6JeUjWKnJ++syOGG/IEJRfFlRea4jyHVH ZC4w== 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=TMKTsIrENQ0SxrnrsiN6wNDNLgB5AusSjxXzNHE3dsw=; b=ShjX2EtVbWIrmm4FoQ90gbBLaIflgnzBWDs5gqdwrjC+AD6o+SUsN6kPTGq3IiaHcP TO+WR3TqEgDruc/erkWfp/T2caAuBSATj4txWTJCclTFYOVBOGhoPmXlGYGtyF2qWIXI MrBLvUDgwPPYcKCMVNJptAHg2d3/iqbKRHxcYHK44dCOEQLpCc1oGe5TvVGIWsV/7aTO uh+d4a4HCRfBVAlPMOpwWeYGe1b4QIN1u+bMjA2Go+7cZWK1b7j0msudtRmt//4Kl1OP 1lXzKauRTam5dZNKk5DGgw83MkLvjvGPiEA/gn1VxP4QtJ4S1RpJHg3a2l25wIg9wxrZ IchA== X-Gm-Message-State: APjAAAWFndtwtel4JYY2JcENsAK+iG010D2t4xqdYd1h4xSAcFmZ+6M0 o+vOlBPOx3HUIZrIjeRc1xeW6n3D7ho= X-Google-Smtp-Source: APXvYqzL6Uvi0PUKg6O8mRrZkFtQ10Q2s3TLt0F2mPwv/eZ4/TC16pAXRuJ5x8a/HAbdgWZN3YQJgQ== X-Received: by 2002:ac8:290f:: with SMTP id y15mr5026505qty.181.1571331103225; Thu, 17 Oct 2019 09:51:43 -0700 (PDT) Received: from raichu (toroon0560w-lp130-05-69-158-183-252.dsl.bell.ca. [69.158.183.252]) by smtp.gmail.com with ESMTPSA id c18sm1256442qkk.17.2019.10.17.09.51.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 09:51:41 -0700 (PDT) Sender: Mark Johnston Date: Thu, 17 Oct 2019 12:51:35 -0400 From: Mark Johnston To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353683 - head/sys/netinet Message-ID: <20191017165135.GA35363@raichu> References: <201910171602.x9HG2YHg072397@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201910171602.x9HG2YHg072397@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46vFYs0x4Fz4QGM X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 16:51:45 -0000 On Thu, Oct 17, 2019 at 04:02:34PM +0000, Gleb Smirnoff wrote: > Author: glebius > Date: Thu Oct 17 16:02:34 2019 > New Revision: 353683 > URL: https://svnweb.freebsd.org/changeset/base/353683 > > Log: > igmp_v1v2_queue_report() doesn't require epoch. igmp_v1v2_queue_report() calls netisr_dispatch(), which does require epoch. From owner-svn-src-all@freebsd.org Thu Oct 17 17:00:34 2019 Return-Path: Delivered-To: svn-src-all@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 E6E3E1575F4; Thu, 17 Oct 2019 17:00:34 +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 46vFm24t2tz4QbS; Thu, 17 Oct 2019 17:00:34 +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 x9HH0RDH047703 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 17 Oct 2019 10:00:27 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x9HH0Q71047702; Thu, 17 Oct 2019 10:00:26 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Thu, 17 Oct 2019 10:00:26 -0700 From: Gleb Smirnoff To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353683 - head/sys/netinet Message-ID: <20191017170026.GZ4086@FreeBSD.org> References: <201910171602.x9HG2YHg072397@repo.freebsd.org> <20191017165135.GA35363@raichu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191017165135.GA35363@raichu> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46vFm24t2tz4QbS X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.994,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 17:00:35 -0000 On Thu, Oct 17, 2019 at 12:51:35PM -0400, Mark Johnston wrote: M> On Thu, Oct 17, 2019 at 04:02:34PM +0000, Gleb Smirnoff wrote: M> > Author: glebius M> > Date: Thu Oct 17 16:02:34 2019 M> > New Revision: 353683 M> > URL: https://svnweb.freebsd.org/changeset/base/353683 M> > M> > Log: M> > igmp_v1v2_queue_report() doesn't require epoch. M> M> igmp_v1v2_queue_report() calls netisr_dispatch(), which does require M> epoch. Doh! Will fix. -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Thu Oct 17 17:02:51 2019 Return-Path: Delivered-To: svn-src-all@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 663BC157838; Thu, 17 Oct 2019 17:02:51 +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 46vFpg20kmz4Qyn; Thu, 17 Oct 2019 17:02:51 +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 2870023942; Thu, 17 Oct 2019 17:02:51 +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 x9HH2pFU007890; Thu, 17 Oct 2019 17:02:51 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HH2ppi007889; Thu, 17 Oct 2019 17:02:51 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910171702.x9HH2ppi007889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 17 Oct 2019 17:02:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353687 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 353687 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 17:02:51 -0000 Author: glebius Date: Thu Oct 17 17:02:50 2019 New Revision: 353687 URL: https://svnweb.freebsd.org/changeset/base/353687 Log: Quickly fix up r353683: enter the epoch before calling into netisr_dispatch(). Modified: head/sys/netinet/igmp.c Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Thu Oct 17 16:38:44 2019 (r353686) +++ head/sys/netinet/igmp.c Thu Oct 17 17:02:50 2019 (r353687) @@ -2174,6 +2174,7 @@ igmp_slowtimo_vnet(void) static int igmp_v1v2_queue_report(struct in_multi *inm, const int type) { + struct epoch_tracker et; struct ifnet *ifp; struct igmp *igmp; struct ip *ip; @@ -2223,7 +2224,9 @@ igmp_v1v2_queue_report(struct in_multi *inm, const int m->m_flags |= M_IGMP_LOOP; CTR2(KTR_IGMPV3, "%s: netisr_dispatch(NETISR_IGMP, %p)", __func__, m); + NET_EPOCH_ENTER(et); netisr_dispatch(NETISR_IGMP, m); + NET_EPOCH_EXIT(et); return (0); } From owner-svn-src-all@freebsd.org Thu Oct 17 17:19:16 2019 Return-Path: Delivered-To: svn-src-all@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 EEE8B157BA1; Thu, 17 Oct 2019 17:19:16 +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 46vG9c5vHMz4RVr; Thu, 17 Oct 2019 17:19:16 +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 ADD5D23B17; Thu, 17 Oct 2019 17:19:16 +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 x9HHJGov013981; Thu, 17 Oct 2019 17:19:16 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HHJGKF013980; Thu, 17 Oct 2019 17:19:16 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910171719.x9HHJGKF013980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 17 Oct 2019 17:19:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353688 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353688 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 17:19:17 -0000 Author: cem Date: Thu Oct 17 17:19:16 2019 New Revision: 353688 URL: https://svnweb.freebsd.org/changeset/base/353688 Log: debugnet(4): Check hardware-validated UDP checksums Similar to INET checksums, lazily validate UDP checksums when the driver has already performed the check for us. Like debugnet(4) INET checksums, validation in software is left as future work. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D21745 Modified: head/sys/net/debugnet_inet.c Modified: head/sys/net/debugnet_inet.c ============================================================================== --- head/sys/net/debugnet_inet.c Thu Oct 17 17:02:50 2019 (r353687) +++ head/sys/net/debugnet_inet.c Thu Oct 17 17:19:16 2019 (r353688) @@ -196,6 +196,15 @@ debugnet_handle_ip(struct debugnet_pcb *pcb, struct mb return; } + if ((m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) != 0) { + if ((m->m_pkthdr.csum_flags & CSUM_DATA_VALID) == 0) { + DNETDEBUG("bad UDP checksum\n"); + return; + } + } else { + /* XXX */ ; + } + /* UDP custom is to have packet length not include IP header. */ ip->ip_len -= hlen; From owner-svn-src-all@freebsd.org Thu Oct 17 17:37:59 2019 Return-Path: Delivered-To: svn-src-all@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 14242158329; Thu, 17 Oct 2019 17:37:59 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) (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 46vGb950jBz4SVK; Thu, 17 Oct 2019 17:37:57 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi1-f175.google.com with SMTP id g81so2864884oib.8; Thu, 17 Oct 2019 10:37:57 -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=pICgastKNGMeguBEoNLrPCdXDGjxeBPSgOPy7UohcrU=; b=FPyZ40k+TUl4tP09geoaseCl9OPu4PD/atuaGg5jGjq14eeAwxNWUTAj5gw7qye4/a SzpEmfJ3zYRIh3CNx8dULLRLwyhHMnYsxQQNBf8FvKZqzx/BVPwK3cGekCBRBHCc4FTw BqH+jXK8LDBRTo7oeDtw46werfY+r0ZSS4+XSDvGXrfv4ysX7XcxZSV6TrtD9fKB7aao KdvdNVpF7Qwu7P4rTDFC14dV9wlGFUx0Z96UF3cNCgiZ36K5nzv+39s37oiUFdQRdWHC c1dFW0/vEPy0x1gKPW6hH7DAWMiz0GTMH37P+yz/dzb/54J5saX9H7CwdjOEzCOl+1Wi iCJA== X-Gm-Message-State: APjAAAUA1/slAo4q4zmnsfCDhiTmWqQqj9bQbFYIf4HaJX0FsbCHjcmA Hacq2I/LKvgZ2ChqlSaqmq09a/5sq3ANOoTzdnryX7gIzQQ= X-Google-Smtp-Source: APXvYqxOs99A0L3PRoFUL2kri0ZWnUblyRrg7dBXH++TuYCMEYjxdP5p6IJW1JAxfoC5fo02WR2WP1OMFQp8FQ6YwSI= X-Received: by 2002:aca:1c02:: with SMTP id c2mr4205725oic.73.1571333876330; Thu, 17 Oct 2019 10:37:56 -0700 (PDT) MIME-Version: 1.0 References: <201909301728.x8UHS0QF070658@repo.freebsd.org> In-Reply-To: <201909301728.x8UHS0QF070658@repo.freebsd.org> From: Alan Somers Date: Thu, 17 Oct 2019 11:37:44 -0600 Message-ID: Subject: Re: svn commit: r352909 - in head: contrib/elftoolchain/nm usr.bin/nm To: Mark Johnston Cc: src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46vGb950jBz4SVK X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.167.175 as permitted sender) smtp.mailfrom=asomers@gmail.com X-Spamd-Result: default: False [-3.15 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; 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)[multipart/alternative,text/plain]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-1.15)[ip: (-0.35), ipnet: 209.85.128.0/17(-3.24), asn: 15169(-2.10), country: US(-0.05)]; TO_DN_ALL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[175.167.85.209.list.dnswl.org : 127.0.5.0]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[175.167.85.209.rep.mailspike.net : 127.0.0.17]; MIME_TRACE(0.00)[0:+,1:+,2:~]; 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)[asomers@freebsd.org,asomers@gmail.com]; 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 17:37:59 -0000 On Mon, Sep 30, 2019 at 11:28 AM Mark Johnston wrote: > Author: markj > Date: Mon Sep 30 17:27:59 2019 > New Revision: 352909 > URL: https://svnweb.freebsd.org/changeset/base/352909 > > Log: > Capsicumize nm(1). > > Reviewed by: emaste > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D21107 > > Modified: > head/contrib/elftoolchain/nm/nm.c > head/usr.bin/nm/Makefile > I can no longer build world after this change. I think nm is being built before libcasper, because I don't see libcasper.h in my object directory. Has anybody else had this problem? In file included from /usr/home/somers/freebsd/base/head/contrib/elftoolchain/nm/nm.c:32: /usr/include/capsicum_helpers.h:42:10: fatal error: 'libcasper.h' file not found #include ^~~~~~~~~~~~~ 1 error generated. *** [nm.o] Error code 1 make[3]: stopped in /usr/home/somers/freebsd/base/head/usr.bin/nm 1 error From owner-svn-src-all@freebsd.org Thu Oct 17 17:48:09 2019 Return-Path: Delivered-To: svn-src-all@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 73DA4158F12; Thu, 17 Oct 2019 17:48:09 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) (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 46vGpx2Tg0z4TVC; Thu, 17 Oct 2019 17:48:09 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x72b.google.com with SMTP id e66so2646212qkf.13; Thu, 17 Oct 2019 10:48:09 -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=UaEuwhuszGUOiRNRL+8kOx3eAbUDFah2+iSIaXjKNfU=; b=Svq5maRwa3ZKHXxdph44TelXfn/HMAAU8E0JF6arLLLc75G5KbmrNP0sDCkUcpT7Gu E2cq4sl17lXdO5BUriG8pHgj+mtd/JxKDhFb8LUZ1Rlzt8kZy6D1abSlKAVtaJrCizHR zzYhehKsYaK53KyeQ0VMyKXLcAm9aR7CdUIhv3m0e6bL3kOpQBm9fzd5rzAeM3akeXvz Bev9uizh9c7hLXb9LFyxkMUTLxGwrxPTY9wMqEQLq6xkjPuEThA5KuBXivXqt8Cvbk1+ 1IMY1skFmPnnF+zttaSQ+0ZXHmjKHCHs+klv6XjUUVGRG0tI8rpZnnsGHl86LUDyva0+ cLxA== 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=UaEuwhuszGUOiRNRL+8kOx3eAbUDFah2+iSIaXjKNfU=; b=jehLvP62M+mRUPDZMGvh2SlW2Ysb8vjITR6kir6WkFnm9wuP5etAQi54R6YSS3WNaa 6azn/gfQEwe3CN9b145gZDe4mGDcboINsP3tMBLhbS6Cg5YGdypoA9koVNauHoEwX6eA 1HTMGCO0x+dPh4oZx2MgoSaCLnn7w5O3dtet1kjpxJMND0VWmPZjDmmAdM1vCBLqtvW9 oxPtXvw5OKrL9N/GFZd4TuQE1qMNYhv7+8ohfRAyC/QZYbX+mttH+z7/es3VRVYBC5nS ebP15SfkVZiwy/WGjq5KmRrw3Gc8nxVhbna46pP8ukT6Cp8xJaYR5aV2XgPocmkB2wwK daNA== X-Gm-Message-State: APjAAAXqdYmlUxz/lva0OvBZEGv/8LxuYQAcL8D1tnKFvs8hKEDEeD9n Jsucha8llEHcp4ZmmZXxwCJNn0nR X-Google-Smtp-Source: APXvYqzVB81l+pnwnf9VWwwlBaaHF4wvzUoSurw51+7ILl17xfLvTnNNbpbWvspoZ+UoM8V4j++v0Q== X-Received: by 2002:a37:44a:: with SMTP id 71mr4573721qke.442.1571334487399; Thu, 17 Oct 2019 10:48:07 -0700 (PDT) Received: from raichu (toroon0560w-lp130-05-69-158-183-252.dsl.bell.ca. [69.158.183.252]) by smtp.gmail.com with ESMTPSA id f37sm64304qtb.65.2019.10.17.10.48.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 10:48:06 -0700 (PDT) Sender: Mark Johnston Date: Thu, 17 Oct 2019 13:48:01 -0400 From: Mark Johnston To: Alan Somers Cc: src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r352909 - in head: contrib/elftoolchain/nm usr.bin/nm Message-ID: <20191017174801.GA6447@raichu> References: <201909301728.x8UHS0QF070658@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46vGpx2Tg0z4TVC X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 17:48:09 -0000 On Thu, Oct 17, 2019 at 11:37:44AM -0600, Alan Somers wrote: > On Mon, Sep 30, 2019 at 11:28 AM Mark Johnston wrote: > > > Author: markj > > Date: Mon Sep 30 17:27:59 2019 > > New Revision: 352909 > > URL: https://svnweb.freebsd.org/changeset/base/352909 > > > > Log: > > Capsicumize nm(1). > > > > Reviewed by: emaste > > Sponsored by: The FreeBSD Foundation > > Differential Revision: https://reviews.freebsd.org/D21107 > > > > Modified: > > head/contrib/elftoolchain/nm/nm.c > > head/usr.bin/nm/Makefile > > > > I can no longer build world after this change. I think nm is being built > before libcasper, because I don't see libcasper.h in my object directory. > Has anybody else had this problem? > > In file included from > /usr/home/somers/freebsd/base/head/contrib/elftoolchain/nm/nm.c:32: > /usr/include/capsicum_helpers.h:42:10: fatal error: 'libcasper.h' file not > found > #include > ^~~~~~~~~~~~~ > 1 error generated. > *** [nm.o] Error code 1 > > make[3]: stopped in /usr/home/somers/freebsd/base/head/usr.bin/nm > 1 error Could you share the full build log somewhere? I haven't seen any other reports of this, and other elftoolchain utilities have been making use of libcasper for a long time. From owner-svn-src-all@freebsd.org Thu Oct 17 17:48:33 2019 Return-Path: Delivered-To: svn-src-all@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 3BEF6158FEA; Thu, 17 Oct 2019 17:48:33 +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 46vGqP0rXvz4Tf2; Thu, 17 Oct 2019 17:48:33 +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 019EC2409D; Thu, 17 Oct 2019 17:48:33 +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 x9HHmWTD031491; Thu, 17 Oct 2019 17:48:32 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HHmWm3031490; Thu, 17 Oct 2019 17:48:32 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910171748.x9HHmWm3031490@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 17 Oct 2019 17:48:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353689 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353689 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 17:48:33 -0000 Author: cem Date: Thu Oct 17 17:48:32 2019 New Revision: 353689 URL: https://svnweb.freebsd.org/changeset/base/353689 Log: debugnet: Respond to broadcast ARP requests The in-tree netdump code has always ignored non-directed ARP requests, and that seems to work most of the time for netdump. In my work and testing on NetGDB, it seems like sometimes the remote FreeBSD conversant (the non-panic system) will send broadcast-destination ARP requests to the debugnet kernel; without this change, those are dropped and the remote will see EHOSTDOWN "Host is down" errors from the userspace interface of the network stack. Discussed with: markj Modified: head/sys/net/debugnet.c Modified: head/sys/net/debugnet.c ============================================================================== --- head/sys/net/debugnet.c Thu Oct 17 17:19:16 2019 (r353688) +++ head/sys/net/debugnet.c Thu Oct 17 17:48:32 2019 (r353689) @@ -434,7 +434,8 @@ debugnet_pkt_in(struct ifnet *ifp, struct mbuf *m) goto done; } if (memcmp(ifr.ifr_addr.sa_data, eh->ether_dhost, - ETHER_ADDR_LEN) != 0) { + ETHER_ADDR_LEN) != 0 && + (etype != ETHERTYPE_ARP || !ETHER_IS_BROADCAST(eh->ether_dhost))) { DNETDEBUG_IF(ifp, "discard frame with incorrect destination addr\n"); goto done; From owner-svn-src-all@freebsd.org Thu Oct 17 18:17:39 2019 Return-Path: Delivered-To: svn-src-all@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 8E27315A116; Thu, 17 Oct 2019 18:17:39 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) (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 46vHSz3FZFz4Wt6; Thu, 17 Oct 2019 18:17:39 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi1-f180.google.com with SMTP id g81so2970083oib.8; Thu, 17 Oct 2019 11:17:39 -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=0WlocjftCdC0fQLFD2inbFbtTFw56D1K7/tSZ3BpuRE=; b=W3urh8uZieTFP8jpywV+BzZOiBHABwzv8k0bHqcKRVYSbqXEi0LdY5GBs0BgyVJrXR LwR5e0A8Tlj1zYbCtQAMDD3VXgFSnamhjlo/8YoubhwGSPMNb0yn6KuvtDixnOQBVkjd XRBHqWgRvCAzvcuPt/V3hulWnlEjbJznodoD3tWe6JpTGyNffkCUtYBAXc9sXBP/SnlS o7bDeymdNz2ob2iCjh6pTqhfEYcZFSenAeUHiGQhzLXrhchdkGVOY3AjkSr4M9Pt17YV 1B8qD3nXkn/2g4+IG5z4xIj85YN8AjDnYOYSm2r/gKnMLFl1xOjKMoGU5IsHYyF4vRIx 4JlA== X-Gm-Message-State: APjAAAV9rOYCGoD/jsSqCRRAAP7K8i9v4Gv5OgZC9WmvwPg2JSVQOv+y RuRK4H+ItoVvNc6B+oCxoMuMC3GV5LUM0DExed3XCimj X-Google-Smtp-Source: APXvYqzoJNMwjzexSoyscVVwhRnktlgijtR1OY15fKh5c4hIKlg1Fvsyw4K/zVfll81N7c9ZupDdXYZlqp4vD0ZanDU= X-Received: by 2002:aca:cf92:: with SMTP id f140mr4483653oig.57.1571336257475; Thu, 17 Oct 2019 11:17:37 -0700 (PDT) MIME-Version: 1.0 References: <201909301728.x8UHS0QF070658@repo.freebsd.org> <20191017174801.GA6447@raichu> In-Reply-To: <20191017174801.GA6447@raichu> From: Alan Somers Date: Thu, 17 Oct 2019 12:17:26 -0600 Message-ID: Subject: Re: svn commit: r352909 - in head: contrib/elftoolchain/nm usr.bin/nm To: Mark Johnston Cc: src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46vHSz3FZFz4Wt6 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 18:17:39 -0000 There might be something wrong with my environment: /usr/include/libcasper.h is absent. But still, shouldn't the build be using the version from the source tree, instead of from the environment? -Alan On Thu, Oct 17, 2019 at 11:48 AM Mark Johnston wrote: > On Thu, Oct 17, 2019 at 11:37:44AM -0600, Alan Somers wrote: > > On Mon, Sep 30, 2019 at 11:28 AM Mark Johnston > wrote: > > > > > Author: markj > > > Date: Mon Sep 30 17:27:59 2019 > > > New Revision: 352909 > > > URL: https://svnweb.freebsd.org/changeset/base/352909 > > > > > > Log: > > > Capsicumize nm(1). > > > > > > Reviewed by: emaste > > > Sponsored by: The FreeBSD Foundation > > > Differential Revision: https://reviews.freebsd.org/D21107 > > > > > > Modified: > > > head/contrib/elftoolchain/nm/nm.c > > > head/usr.bin/nm/Makefile > > > > > > > I can no longer build world after this change. I think nm is being built > > before libcasper, because I don't see libcasper.h in my object directory. > > Has anybody else had this problem? > > > > In file included from > > /usr/home/somers/freebsd/base/head/contrib/elftoolchain/nm/nm.c:32: > > /usr/include/capsicum_helpers.h:42:10: fatal error: 'libcasper.h' file > not > > found > > #include > > ^~~~~~~~~~~~~ > > 1 error generated. > > *** [nm.o] Error code 1 > > > > make[3]: stopped in /usr/home/somers/freebsd/base/head/usr.bin/nm > > 1 error > > Could you share the full build log somewhere? I haven't seen any other > reports of this, and other elftoolchain utilities have been making use > of libcasper for a long time. > From owner-svn-src-all@freebsd.org Thu Oct 17 18:29:45 2019 Return-Path: Delivered-To: svn-src-all@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 8988015A7FA; Thu, 17 Oct 2019 18:29:45 +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 46vHkx34MXz4Xvl; Thu, 17 Oct 2019 18:29:45 +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 4DC1E2485E; Thu, 17 Oct 2019 18:29:45 +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 x9HITjfG058650; Thu, 17 Oct 2019 18:29:45 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HITiHg058649; Thu, 17 Oct 2019 18:29:44 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910171829.x9HITiHg058649@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 17 Oct 2019 18:29:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353690 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 353690 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 18:29:45 -0000 Author: cem Date: Thu Oct 17 18:29:44 2019 New Revision: 353690 URL: https://svnweb.freebsd.org/changeset/base/353690 Log: Add a very limited DDB dumpon(8)-alike to MI dumper code This allows ddb(4) commands to construct a static dumperinfo during panic/debug and invoke doadump(false) using the provided dumper configuration (always inserted first in the list). The intended usecase is a ddb(4)-time netdump(4) command. Reviewed by: markj (earlier version) Differential Revision: https://reviews.freebsd.org/D21448 Modified: head/sys/kern/kern_shutdown.c head/sys/sys/conf.h Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Thu Oct 17 17:48:32 2019 (r353689) +++ head/sys/kern/kern_shutdown.c Thu Oct 17 18:29:44 2019 (r353690) @@ -1267,6 +1267,20 @@ cleanup: return (error); } +#ifdef DDB +void +dumper_ddb_insert(struct dumperinfo *newdi) +{ + TAILQ_INSERT_HEAD(&dumper_configs, newdi, di_next); +} + +void +dumper_ddb_remove(struct dumperinfo *di) +{ + TAILQ_REMOVE(&dumper_configs, di, di_next); +} +#endif + static bool dumper_config_match(const struct dumperinfo *di, const char *devname, const struct diocskerneldump_arg *kda) Modified: head/sys/sys/conf.h ============================================================================== --- head/sys/sys/conf.h Thu Oct 17 17:48:32 2019 (r353689) +++ head/sys/sys/conf.h Thu Oct 17 18:29:44 2019 (r353690) @@ -366,6 +366,10 @@ int dumper_insert(const struct dumperinfo *di_template const struct diocskerneldump_arg *kda); int dumper_remove(const char *devname, const struct diocskerneldump_arg *kda); +/* For ddb(4)-time use only. */ +void dumper_ddb_insert(struct dumperinfo *); +void dumper_ddb_remove(struct dumperinfo *); + int dump_start(struct dumperinfo *di, struct kerneldumpheader *kdh); int dump_append(struct dumperinfo *, void *, vm_offset_t, size_t); int dump_write(struct dumperinfo *, void *, vm_offset_t, off_t, size_t); From owner-svn-src-all@freebsd.org Thu Oct 17 18:45:12 2019 Return-Path: Delivered-To: svn-src-all@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 7BEB915AFB1; Thu, 17 Oct 2019 18:45:12 +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 46vJ4m2TKGz4ZCN; Thu, 17 Oct 2019 18:45:12 +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 39B3A24C27; Thu, 17 Oct 2019 18:45:12 +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 x9HIjCPl070481; Thu, 17 Oct 2019 18:45:12 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HIjCdi070480; Thu, 17 Oct 2019 18:45:12 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910171845.x9HIjCdi070480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 17 Oct 2019 18:45:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353691 - head/sys/dev/acpica X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/dev/acpica X-SVN-Commit-Revision: 353691 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 18:45:12 -0000 Author: cem Date: Thu Oct 17 18:45:11 2019 New Revision: 353691 URL: https://svnweb.freebsd.org/changeset/base/353691 Log: acpica: Match ID_PROBE default implementation to interface After r339754, the additional interface parameter was accidentally left out of the default acpi_generic_id_probe implementation. Apparently this does not cause any real problems, so this fix is mostly stylistic. No functional change intended. X-MFC-With: r339754 Modified: head/sys/dev/acpica/acpi_if.m Modified: head/sys/dev/acpica/acpi_if.m ============================================================================== --- head/sys/dev/acpica/acpi_if.m Thu Oct 17 18:29:44 2019 (r353690) +++ head/sys/dev/acpica/acpi_if.m Thu Oct 17 18:45:11 2019 (r353691) @@ -62,7 +62,8 @@ HEADER { # CODE { static char * - acpi_generic_id_probe(device_t bus, device_t dev, char **ids) + acpi_generic_id_probe(device_t bus, device_t dev, char **ids, + char **match) { return (NULL); } From owner-svn-src-all@freebsd.org Thu Oct 17 18:48:15 2019 Return-Path: Delivered-To: svn-src-all@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 3B11715B0B9 for ; Thu, 17 Oct 2019 18:48:15 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (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 46vJ8G619Pz4ZRt for ; Thu, 17 Oct 2019 18:48:14 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1571338093; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=oWk2e33jvC9G7lqSGRCFwnBl5VHQhM0HqaKJJMv2EDBHwjCNrIll657mo31IOeJE9DwyCxAQBiapK 1vN2rGjjSuE5fSc7tY9sO9GotVzjcIyPXRa3NBfzwVnLD6NsxF9NOhRTfGqYpnwKmchdhFCAGQGE0b E0r6dhlX44uGsnoPoyaHZnHYL5BYQCbh5Bg+I37m9tKl9kPLge72yQLXMh+pdGb1kIHOyShK6LcbKL gOs4X0UQOnt376QqVO5kYaGSRGZYA5D4l47Aqbjda1Lcessz0yywfcosAmFDXW6q1XgdVnE/ERBlL7 gagAZYChYu3DHnbBOm3e9k5QvGYAUqA== 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:cc:to:from:subject:message-id:dkim-signature:from; bh=E/PblsiARz1wY1feclCOfq7zThHyy7QP5xxiGMJEomE=; b=vu9XZBovG/sfl8imRzUG09bSHSY0zSpGRrrpAXQGQXFNz7A2JZzUzV0C+FQ26yXpJVfTKsd4G0nWp u08gVi+pI/KpnNM9f0UJr2zJebltOv6ATXjISMSce8gvAoo3ffsLa/jbibnghenTFSuwUsrpd/nygj kTl6Cq4iCKryT71ZPH0RnVD4armUHHNGQ6A3Cfd+ZVDXbOK0XDfgONKZrmemjh4IBFfQjLX+sGYqCA l6ilce1iTrM4ZCeyZuyW6UV8BY36kUuIxdg1PI2XSzGq/G1+j1wiOLHevRsSbS843XI3RfknvzWwkt HLY5vDN77vPynXLNexUGhs87IFvZoPQ== ARC-Authentication-Results: i=1; outbound3.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:cc:to:from:subject:message-id:from; bh=E/PblsiARz1wY1feclCOfq7zThHyy7QP5xxiGMJEomE=; b=WcfK2zx+uivx2hxSnBYpzhN9Q/CrZH56VM8+XcCWtwZjSPsPAG5gD8AHJbnE82xdK4/Fh69kejDHp +gkeAZt7rVDq88iLuSP9q3/0yG1Hsnrx8wtjogI8hRCd68L5MhXfMQFmrFc/OXjk4X4/AByY/OwOoE kssaD1pf/lvsuTey98Uy4zQY0EhsWU8BSGxo33taepLMlY6Cdhwf0MIM+LhmBPt6bicBqfxqrgtKJp vrfsNjendg9WtZkHHm+2c/UCJl6IVPT27/beE4OwWkZIIygoU+zmH/4/63Pzuren89TSbYhygW7EbZ uM2sWVOroVZrxJ+PyINrZrQKM4S+cxQ== X-MHO-RoutePath: aGlwcGll X-MHO-User: aa845d75-f10e-11e9-955f-dfabc1efb494 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 outbound3.ore.mailhop.org (Halon) with ESMTPSA id aa845d75-f10e-11e9-955f-dfabc1efb494; Thu, 17 Oct 2019 18:48:11 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x9HImAT5018287; Thu, 17 Oct 2019 12:48:10 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r352909 - in head: contrib/elftoolchain/nm usr.bin/nm From: Ian Lepore To: Alan Somers , Mark Johnston Cc: src-committers , svn-src-all , svn-src-head Date: Thu, 17 Oct 2019 12:48:10 -0600 In-Reply-To: References: <201909301728.x8UHS0QF070658@repo.freebsd.org> <20191017174801.GA6447@raichu> 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: 46vJ8G619Pz4ZRt X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.76 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.76)[-0.758,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 18:48:15 -0000 On Thu, 2019-10-17 at 12:17 -0600, Alan Somers wrote: > There might be something wrong with my environment: > /usr/include/libcasper.h is absent. But still, shouldn't the build > be > using the version from the source tree, instead of from the > environment? > -Alan > There should be copies of libcasper.h in your objdir: obj/arm.armv7/tmp/legacy/usr/include/libcasper.h obj/arm.armv7/tmp/usr/include/libcasper.h -- Ian > On Thu, Oct 17, 2019 at 11:48 AM Mark Johnston > wrote: > > > On Thu, Oct 17, 2019 at 11:37:44AM -0600, Alan Somers wrote: > > > On Mon, Sep 30, 2019 at 11:28 AM Mark Johnston > > > > > > > wrote: > > > > > > > Author: markj > > > > Date: Mon Sep 30 17:27:59 2019 > > > > New Revision: 352909 > > > > URL: https://svnweb.freebsd.org/changeset/base/352909 > > > > > > > > Log: > > > > Capsicumize nm(1). > > > > > > > > Reviewed by: emaste > > > > Sponsored by: The FreeBSD Foundation > > > > Differential Revision: > > > > https://reviews.freebsd.org/D21107 > > > > > > > > Modified: > > > > head/contrib/elftoolchain/nm/nm.c > > > > head/usr.bin/nm/Makefile > > > > > > > > > > I can no longer build world after this change. I think nm is > > > being built > > > before libcasper, because I don't see libcasper.h in my object > > > directory. > > > Has anybody else had this problem? > > > > > > In file included from > > > /usr/home/somers/freebsd/base/head/contrib/elftoolchain/nm/nm.c:3 > > > 2: > > > /usr/include/capsicum_helpers.h:42:10: fatal error: 'libcasper.h' > > > file > > > > not > > > found > > > #include > > > ^~~~~~~~~~~~~ > > > 1 error generated. > > > *** [nm.o] Error code 1 > > > > > > make[3]: stopped in /usr/home/somers/freebsd/base/head/usr.bin/nm > > > 1 error > > > > Could you share the full build log somewhere? I haven't seen any > > other > > reports of this, and other elftoolchain utilities have been making > > use > > of libcasper for a long time. > > From owner-svn-src-all@freebsd.org Thu Oct 17 19:05:55 2019 Return-Path: Delivered-To: svn-src-all@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 29E2815B5B1; Thu, 17 Oct 2019 19:05:55 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) (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 46vJXg0ClPz4bP0; Thu, 17 Oct 2019 19:05:54 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi1-f178.google.com with SMTP id a15so3143287oic.0; Thu, 17 Oct 2019 12:05:54 -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=xSFHWSaQQDqzLfmEeVLgMnOLiUTtk4rBV/37YdDyxXM=; b=f42evAp3vwQENV/FcSe24B1UQkaspFCenbSK4HhRIhMa80kZeUoXMOx18sLXm82ZDu iy33iKzJeMdjReSU9H0ItV5H2L6c4nG21HjJujMNd3EEnbXhA1WkmZ4lFwlQ1c9Mq844 K++UT6JaaLKwt9fkjgQypBE6CEl0PtR/5DkMO3Y1xVxDUZxEztx2WDaEQ/u7zhIMqnD8 O4GkItQxLBWMuWsMYD/YwStQYTu2Klyka9b2T76QoWnRp4uDp3LfGMfsePHxvClaDpX4 KPgakZHvW4AsJ13xrUQ9OxKCddTwIspmjdAuDPdFwCKo7HKtKKq0uwXOtuE4WUn70BrF +rSg== X-Gm-Message-State: APjAAAV/AR3+jeeT4qAVHDrVJkUOcRbDZMrR881nyZhiH9rLiXwm6wm6 acabg/wjUjdd+/cUY8oP1I9iN9LXKbFXWWk1BrZv5HPhmLc= X-Google-Smtp-Source: APXvYqwS+jeBsVnhZTtg/D+6Ca+U3yM5taZPUvQbQCGVyWx0O9fk/x2Y7t3mckLdhBOZVJV/jgeSgpgrUfXDQYZrhFY= X-Received: by 2002:aca:4302:: with SMTP id q2mr4355304oia.173.1571339153624; Thu, 17 Oct 2019 12:05:53 -0700 (PDT) MIME-Version: 1.0 References: <201909301728.x8UHS0QF070658@repo.freebsd.org> <20191017174801.GA6447@raichu> In-Reply-To: From: Alan Somers Date: Thu, 17 Oct 2019 13:05:42 -0600 Message-ID: Subject: Re: svn commit: r352909 - in head: contrib/elftoolchain/nm usr.bin/nm To: Ian Lepore Cc: Mark Johnston , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46vJXg0ClPz4bP0 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 19:05:55 -0000 On Thu, Oct 17, 2019 at 12:48 PM Ian Lepore wrote: > On Thu, 2019-10-17 at 12:17 -0600, Alan Somers wrote: > > There might be something wrong with my environment: > > /usr/include/libcasper.h is absent. But still, shouldn't the build > > be > > using the version from the source tree, instead of from the > > environment? > > -Alan > > > > There should be copies of libcasper.h in your objdir: > > obj/arm.armv7/tmp/legacy/usr/include/libcasper.h > obj/arm.armv7/tmp/usr/include/libcasper.h > > -- Ian Uh, I found the problem. I had WITHOUT_CASPER=1 in /etc/src.conf. So the problem is that nm can't build without casper. Perhaps the #include should be guarded, as it is in usr.bin/kdump/kdump.c. But plenty of other programs, like usr.bin/tail and usr.bin/wc, don't have such guards. And looking at lib/libcasper/libcasper/Makefile, it seems as though libcasper.h should be installed regardless. So I still need to figure out why it wasn't installed on my system. -Alan From owner-svn-src-all@freebsd.org Thu Oct 17 19:49:21 2019 Return-Path: Delivered-To: svn-src-all@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 CDDD015C328; Thu, 17 Oct 2019 19:49:21 +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 46vKVn5pdcz4dGY; Thu, 17 Oct 2019 19:49:21 +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 AB9A9257A9; Thu, 17 Oct 2019 19:49:21 +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 x9HJnLUK006038; Thu, 17 Oct 2019 19:49:21 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HJnKGP006033; Thu, 17 Oct 2019 19:49:20 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910171949.x9HJnKGP006033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 17 Oct 2019 19:49:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353692 - in head: share/man/man4 sys/net sys/netinet/netdump X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: share/man/man4 sys/net sys/netinet/netdump X-SVN-Commit-Revision: 353692 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 19:49:21 -0000 Author: cem Date: Thu Oct 17 19:49:20 2019 New Revision: 353692 URL: https://svnweb.freebsd.org/changeset/base/353692 Log: Add ddb(4) 'netdump' command to netdump a core without preconfiguration Add a 'X -s -c [-g ] -i ' subroutine to the generic debugnet code. The imagined use is both netdump, shown here, and NetGDB (vaporware). It uses the ddb(4) lexer, with some new extensions, to parse out IPv4 addresses. 'Netdump' uses the generic debugnet routine to load a configuration and start a dump, without any netdump configuration prior to panic. Loosely derived from work by: John Reimer Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D21460 Modified: head/share/man/man4/ddb.4 head/share/man/man4/netdump.4 head/sys/net/debugnet.c head/sys/net/debugnet.h head/sys/netinet/netdump/netdump_client.c Modified: head/share/man/man4/ddb.4 ============================================================================== --- head/share/man/man4/ddb.4 Thu Oct 17 18:45:11 2019 (r353691) +++ head/share/man/man4/ddb.4 Thu Oct 17 19:49:20 2019 (r353692) @@ -24,43 +24,9 @@ .\" any improvements or extensions that they make and grant Carnegie Mellon .\" the rights to redistribute these changes. .\" -.\" changed a \# to #, since groff choked on it. -.\" -.\" HISTORY -.\" ddb.4,v -.\" Revision 1.1 1993/07/15 18:41:02 brezak -.\" Man page for DDB -.\" -.\" Revision 2.6 92/04/08 08:52:57 rpd -.\" Changes from OSF. -.\" [92/01/17 14:19:22 jsb] -.\" Changes for OSF debugger modifications. -.\" [91/12/12 tak] -.\" -.\" Revision 2.5 91/06/25 13:50:22 rpd -.\" Added some watchpoint explanation. -.\" [91/06/25 rpd] -.\" -.\" Revision 2.4 91/06/17 15:47:31 jsb -.\" Added documentation for continue/c, match, search, and watchpoints. -.\" I've not actually explained what a watchpoint is; maybe Rich can -.\" do that (hint, hint). -.\" [91/06/17 10:58:08 jsb] -.\" -.\" Revision 2.3 91/05/14 17:04:23 mrt -.\" Correcting copyright -.\" -.\" Revision 2.2 91/02/14 14:10:06 mrt -.\" Changed to new Mach copyright -.\" [91/02/12 18:10:12 mrt] -.\" -.\" Revision 2.2 90/08/30 14:23:15 dbg -.\" Created. -.\" [90/08/30 dbg] -.\" .\" $FreeBSD$ .\" -.Dd October 10, 2019 +.Dd October 17, 2019 .Dt DDB 4 .Os .Sh NAME @@ -212,7 +178,12 @@ arrow keys may be used to browse through the history buffer, and move the cursor within the current line. .Sh COMMANDS +.Ss COMMON DEBUGGER COMMANDS .Bl -tag -width indent -compact +.It Ic help +Print a short summary of the available commands and command +abbreviations. +.Pp .It Xo .Ic examine Ns Op Li / Ns Cm AISabcdghilmorsuxz ... .Oo Ar addr Oc Ns Op , Ns Ar count @@ -396,6 +367,9 @@ command, or by omitting to get the default address of .Va dot . .Pp +.It Ic halt +Halt the system. +.Pp .It Ic watch Oo Ar addr Oc Ns Op , Ns Ar size Set a watchpoint for a region. Execution stops when an attempt to modify the region occurs. @@ -429,6 +403,20 @@ its use on user mode address spaces. .It Ic dhwatch Oo Ar addr Oc Ns Op , Ns Ar size Delete specified hardware watchpoint. .Pp +.It Ic kill Ar sig pid +Send signal +.Ar sig +to process +.Ar pid . +The signal is acted on upon returning from the debugger. +This command can be used to kill a process causing resource contention +in the case of a hung system. +See +.Xr signal 3 +for a list of signals. +Note that the arguments are reversed relative to +.Xr kill 2 . +.Pp .It Ic step Ns Oo Li / Ns Cm p Oc Ns Op , Ns Ar count .It Ic s Ns Oo Li / Ns Cm p Oc Ns Op , Ns Ar count Single step @@ -529,6 +517,25 @@ The optional argument limits the search. .\" .Pp +.It Ic reboot Op Ar seconds +.It Ic reset Op Ar seconds +Hard reset the system. +If the optional argument +.Ar seconds +is given, the debugger will wait for this long, at most a week, +before rebooting. +.Pp +.It Ic thread Ar addr | tid +Switch the debugger to the thread with ID +.Ar tid , +if the argument is a decimal number, or address +.Ar addr , +otherwise. +.El +.Pp +.Ss SPECIALIZED HELPER COMMANDS +.Pp +.Bl -tag -width indent -compact .It Xo .Ic findstack .Ar addr @@ -1174,47 +1181,36 @@ Shows watchpoints set with "watch" command. Shows information about lock acquisition coming from the .Xr witness 4 subsystem. -.\" +.El .Pp +.Ss OFFLINE DEBUGGING COMMANDS +.Bl -tag -width indent -compact .It Ic gdb -Toggles between remote GDB and DDB mode. +Switches to remote GDB mode. In remote GDB mode, another machine is required that runs .Xr gdb 1 using the remote debug feature, with a connection to the serial console port on the target machine. -Currently only available on the -i386 -architecture. .Pp -.It Ic halt -Halt the system. +.It Ic netdump Fl s Ar server Oo Fl g Ar gateway Oc Fl c Ar client Fl i Ar iface +Configure +.Xr netdump 4 +with the provided parameters, and immediately perform a netdump. .Pp -.It Ic kill Ar sig pid -Send signal -.Ar sig -to process -.Ar pid . -The signal is acted on upon returning from the debugger. -This command can be used to kill a process causing resource contention -in the case of a hung system. -See -.Xr signal 3 -for a list of signals. -Note that the arguments are reversed relative to -.Xr kill 2 . +There are some known limitations. +Principally, +.Xr netdump 4 +only supports IPv4 at this time. +The address arguments to the +.Ic netdump +command must be dotted decimal IPv4 addresses. +(Hostnames are not supported.) +At present, the command only works if the machine is in a panic state. +Finally, the +.Nm +.Ic netdump +command does not provide any way to configure compression or encryption. .Pp -.It Ic reboot Op Ar seconds -.It Ic reset Op Ar seconds -Hard reset the system. -If the optional argument -.Ar seconds -is given, the debugger will wait for this long, at most a week, -before rebooting. -.Pp -.It Ic help -Print a short summary of the available commands and command -abbreviations. -.Pp .It Ic capture on .It Ic capture off .It Ic capture reset @@ -1286,13 +1282,6 @@ rather than a traditional memory dump or minidump. reports whether a textdump has been scheduled. .Ic textdump unset cancels a request to perform a textdump as the next kernel core dump. -.Pp -.It Ic thread Ar addr | tid -Switch the debugger to the thread with ID -.Ar tid , -if the argument is a decimal number, or address -.Ar addr , -otherwise. .El .Sh VARIABLES The debugger accesses registers and variables as Modified: head/share/man/man4/netdump.4 ============================================================================== --- head/share/man/man4/netdump.4 Thu Oct 17 18:45:11 2019 (r353691) +++ head/share/man/man4/netdump.4 Thu Oct 17 19:49:20 2019 (r353692) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 5, 2018 +.Dd October 17, 2019 .Dt NETDUMP 4 .Os .Sh NAME @@ -46,7 +46,10 @@ daemon, available in ports as .Nm clients are configured using the .Xr dumpon 8 -utility. +utility or the +.Ic netdump +command in +.Xr ddb 4 . .Pp .Nm client messages consist of a fixed-size header followed by a variable-sized Modified: head/sys/net/debugnet.c ============================================================================== --- head/sys/net/debugnet.c Thu Oct 17 18:45:11 2019 (r353691) +++ head/sys/net/debugnet.c Thu Oct 17 19:49:20 2019 (r353692) @@ -31,6 +31,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_ddb.h" #include "opt_inet.h" #include @@ -40,6 +41,11 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef DDB +#include +#include +#endif + #include #include #include @@ -654,3 +660,223 @@ dn_evh_init(void *ctx __unused) dn_ifnet_event, NULL, EVENTHANDLER_PRI_ANY); } SYSINIT(dn_evh_init, SI_SUB_EVENTHANDLER + 1, SI_ORDER_ANY, dn_evh_init, NULL); + +/* + * DDB parsing helpers for debugnet(4) consumers. + */ +#ifdef DDB +struct my_inet_opt { + bool has_opt; + const char *printname; + in_addr_t *result; +}; + +static int +dn_parse_optarg_ipv4(struct my_inet_opt *opt) +{ + in_addr_t tmp; + unsigned octet; + int t; + + tmp = 0; + for (octet = 0; octet < 4; octet++) { + t = db_read_token_flags(DRT_WSPACE | DRT_DECIMAL); + if (t != tNUMBER) { + db_printf("%s:%s: octet %u expected number; found %d\n", + __func__, opt->printname, octet, t); + return (EINVAL); + } + /* + * db_lex lexes '-' distinctly from the number itself, but + * let's document that invariant. + */ + MPASS(db_tok_number >= 0); + + if (db_tok_number > UINT8_MAX) { + db_printf("%s:%s: octet %u out of range: %jd\n", __func__, + opt->printname, octet, (intmax_t)db_tok_number); + return (EDOM); + } + + /* Constructed host-endian and converted to network later. */ + tmp = (tmp << 8) | db_tok_number; + + if (octet < 3) { + t = db_read_token_flags(DRT_WSPACE); + if (t != tDOT) { + db_printf("%s:%s: octet %u expected '.'; found" + " %d\n", __func__, opt->printname, octet, + t); + return (EINVAL); + } + } + } + + *opt->result = htonl(tmp); + opt->has_opt = true; + return (0); +} + +int +debugnet_parse_ddb_cmd(const char *cmd, struct debugnet_ddb_config *result) +{ + struct ifnet *ifp; + int t, error; + bool want_ifp; + char ch; + + struct my_inet_opt opt_client = { + .printname = "client", + .result = &result->dd_client, + }, + opt_server = { + .printname = "server", + .result = &result->dd_server, + }, + opt_gateway = { + .printname = "gateway", + .result = &result->dd_gateway, + }, + *cur_inet_opt; + + ifp = NULL; + memset(result, 0, sizeof(*result)); + + /* + * command [space] [-] [opt] [[space] [optarg]] ... + * + * db_command has already lexed 'command' for us. + */ + t = db_read_token_flags(DRT_WSPACE); + if (t == tWSPACE) + t = db_read_token_flags(DRT_WSPACE); + + while (t != tEOL) { + if (t != tMINUS) { + db_printf("%s: Bad syntax; expected '-', got %d\n", + cmd, t); + goto usage; + } + + t = db_read_token_flags(DRT_WSPACE); + if (t != tIDENT) { + db_printf("%s: Bad syntax; expected tIDENT, got %d\n", + cmd, t); + goto usage; + } + + if (strlen(db_tok_string) > 1) { + db_printf("%s: Bad syntax; expected single option " + "flag, got '%s'\n", cmd, db_tok_string); + goto usage; + } + + want_ifp = false; + cur_inet_opt = NULL; + switch ((ch = db_tok_string[0])) { + default: + DNETDEBUG("Unexpected: '%c'\n", ch); + /* FALLTHROUGH */ + case 'h': + goto usage; + case 'c': + cur_inet_opt = &opt_client; + break; + case 'g': + cur_inet_opt = &opt_gateway; + break; + case 's': + cur_inet_opt = &opt_server; + break; + case 'i': + want_ifp = true; + break; + } + + t = db_read_token_flags(DRT_WSPACE); + if (t != tWSPACE) { + db_printf("%s: Bad syntax; expected space after " + "flag %c, got %d\n", cmd, ch, t); + goto usage; + } + + if (want_ifp) { + t = db_read_token_flags(DRT_WSPACE); + if (t != tIDENT) { + db_printf("%s: Expected interface but got %d\n", + cmd, t); + goto usage; + } + + CURVNET_SET(vnet0); + /* + * We *don't* take a ref here because the only current + * consumer, db_netdump_cmd, does not need it. It + * (somewhat redundantly) extracts the if_name(), + * re-lookups the ifp, and takes its own reference. + */ + ifp = ifunit(db_tok_string); + CURVNET_RESTORE(); + if (ifp == NULL) { + db_printf("Could not locate interface %s\n", + db_tok_string); + goto cleanup; + } + } else { + MPASS(cur_inet_opt != NULL); + /* Assume IPv4 for now. */ + error = dn_parse_optarg_ipv4(cur_inet_opt); + if (error != 0) + goto cleanup; + } + + /* Skip (mandatory) whitespace after option, if not EOL. */ + t = db_read_token_flags(DRT_WSPACE); + if (t == tEOL) + break; + if (t != tWSPACE) { + db_printf("%s: Bad syntax; expected space after " + "flag %c option; got %d\n", cmd, ch, t); + goto usage; + } + t = db_read_token_flags(DRT_WSPACE); + } + + /* Currently, all three are required. */ + if (!opt_client.has_opt || !opt_server.has_opt || ifp == NULL) { + db_printf("%s needs all of client, server, and interface " + "specified.\n", cmd); + goto usage; + } + + result->dd_has_gateway = opt_gateway.has_opt; + + /* Iface validation stolen from netdump_configure. */ + if (!DEBUGNET_SUPPORTED_NIC(ifp)) { + db_printf("%s: interface '%s' does not support debugnet\n", + cmd, if_name(ifp)); + error = ENODEV; + goto cleanup; + } + if ((if_getflags(ifp) & IFF_UP) == 0) { + db_printf("%s: interface '%s' link is down\n", cmd, + if_name(ifp)); + error = ENXIO; + goto cleanup; + } + + result->dd_ifp = ifp; + + /* We parsed the full line to tEOL already, or bailed with an error. */ + return (0); + +usage: + db_printf("Usage: %s -s [-g ] -c " + "-i \n", cmd); + error = EINVAL; + /* FALLTHROUGH */ +cleanup: + db_skip_to_eol(); + return (error); +} +#endif /* DDB */ Modified: head/sys/net/debugnet.h ============================================================================== --- head/sys/net/debugnet.h Thu Oct 17 18:45:11 2019 (r353691) +++ head/sys/net/debugnet.h Thu Oct 17 19:49:20 2019 (r353692) @@ -173,6 +173,29 @@ const unsigned char *debugnet_get_gw_mac(const struct */ void debugnet_any_ifnet_update(struct ifnet *); +/* + * DDB parsing helper for common debugnet options. + * + * -s [-g -i + * + * Order is not significant. Interface is an online interface that supports + * debugnet and can route to the debugnet server. The other parameters are all + * IP addresses. For now, all parameters are mandatory, except gateway. + * + * Provides basic '-h' using provided 'cmd' string. + * + * Returns zero on success, or errno. + */ +struct debugnet_ddb_config { + struct ifnet *dd_ifp; /* not ref'd */ + in_addr_t dd_client; + in_addr_t dd_server; + in_addr_t dd_gateway; + bool dd_has_gateway : 1; +}; +int debugnet_parse_ddb_cmd(const char *cmd, + struct debugnet_ddb_config *result); + /* Expose sysctl variables for netdump(4) to alias. */ extern int debugnet_npolls; extern int debugnet_nretries; Modified: head/sys/netinet/netdump/netdump_client.c ============================================================================== --- head/sys/netinet/netdump/netdump_client.c Thu Oct 17 18:45:11 2019 (r353691) +++ head/sys/netinet/netdump/netdump_client.c Thu Oct 17 19:49:20 2019 (r353692) @@ -34,6 +34,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_ddb.h" + #include #include #include @@ -52,6 +54,11 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef DDB +#include +#include +#endif + #include #include #include @@ -387,15 +394,24 @@ netdump_ifdetach(void *arg __unused, struct ifnet *ifp NETDUMP_WUNLOCK(); } +/* + * td of NULL is a sentinel value that indicates a kernel caller (ddb(4) or + * modload-based tunable parameters). + */ static int netdump_configure(struct diocskerneldump_arg *conf, struct thread *td) { struct ifnet *ifp; + struct vnet *vnet; NETDUMP_ASSERT_WLOCKED(); - CURVNET_SET(TD_TO_VNET(td)); - if (!IS_DEFAULT_VNET(curvnet)) { + if (td != NULL) + vnet = TD_TO_VNET(td); + else + vnet = vnet0; + CURVNET_SET(vnet); + if (td != NULL && !IS_DEFAULT_VNET(curvnet)) { CURVNET_RESTORE(); return (EINVAL); } @@ -699,7 +715,7 @@ netdump_modevent(module_t mod __unused, int what, void /* Ignore errors; we print a message to the console. */ NETDUMP_WLOCK(); - (void)netdump_configure(&conf, curthread); + (void)netdump_configure(&conf, NULL); NETDUMP_WUNLOCK(); } break; @@ -729,3 +745,72 @@ static moduledata_t netdump_mod = { MODULE_VERSION(netdump, 1); DECLARE_MODULE(netdump, netdump_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); + +#ifdef DDB +/* + * Usage: netdump -s [-g -i + * + * Order is not significant. + * + * Currently, this command does not support configuring encryption or + * compression. + */ +DB_FUNC(netdump, db_netdump_cmd, db_cmd_table, CS_OWN, NULL) +{ + static struct diocskerneldump_arg conf; + static char blockbuf[NETDUMP_DATASIZE]; + static union { + struct dumperinfo di; + /* For valid di_devname. */ + char di_buf[sizeof(struct dumperinfo) + 1]; + } u; + + struct debugnet_ddb_config params; + int error; + + error = debugnet_parse_ddb_cmd("netdump", ¶ms); + if (error != 0) { + db_printf("Error configuring netdump: %d\n", error); + return; + } + + /* Translate to a netdump dumper config. */ + memset(&conf, 0, sizeof(conf)); + strlcpy(conf.kda_iface, if_name(params.dd_ifp), sizeof(conf.kda_iface)); + + conf.kda_af = AF_INET; + conf.kda_server.in4 = (struct in_addr) { params.dd_server }; + conf.kda_client.in4 = (struct in_addr) { params.dd_client }; + if (params.dd_has_gateway) + conf.kda_gateway.in4 = (struct in_addr) { params.dd_gateway }; + else + conf.kda_gateway.in4 = (struct in_addr) { INADDR_ANY }; + + /* Set the global netdump config to these options. */ + error = netdump_configure(&conf, NULL); + if (error != 0) { + db_printf("Error enabling netdump: %d\n", error); + return; + } + + /* Fake the generic dump configuration list entry to avoid malloc. */ + memset(&u.di_buf, 0, sizeof(u.di_buf)); + u.di.dumper_start = netdump_start; + u.di.dumper_hdr = netdump_write_headers; + u.di.dumper = netdump_dumper; + u.di.priv = NULL; + u.di.blocksize = NETDUMP_DATASIZE; + u.di.maxiosize = MAXDUMPPGS * PAGE_SIZE; + u.di.mediaoffset = 0; + u.di.mediasize = 0; + u.di.blockbuf = blockbuf; + + dumper_ddb_insert(&u.di); + + error = doadump(false); + + dumper_ddb_remove(&u.di); + if (error != 0) + db_printf("Cannot dump: %d\n", error); +} +#endif /* DDB */ From owner-svn-src-all@freebsd.org Thu Oct 17 19:53:56 2019 Return-Path: Delivered-To: svn-src-all@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 7FEAD15C588; Thu, 17 Oct 2019 19:53:56 +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 46vKc42gW6z4dgN; Thu, 17 Oct 2019 19:53:56 +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 3F73D25973; Thu, 17 Oct 2019 19:53:56 +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 x9HJruM1011477; Thu, 17 Oct 2019 19:53:56 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HJruHx011476; Thu, 17 Oct 2019 19:53:56 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910171953.x9HJruHx011476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 17 Oct 2019 19:53:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353693 - head/sys/dev/acpica X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/dev/acpica X-SVN-Commit-Revision: 353693 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 19:53:56 -0000 Author: cem Date: Thu Oct 17 19:53:55 2019 New Revision: 353693 URL: https://svnweb.freebsd.org/changeset/base/353693 Log: acpica: Fix for the fix, unfortunately Follow-up to incomplete pedantic change in r353691 by actually fixing the default implementation to match the interface type. Mea culpa. X-MFC-With: r353691, r339754 Modified: head/sys/dev/acpica/acpi_if.m Modified: head/sys/dev/acpica/acpi_if.m ============================================================================== --- head/sys/dev/acpica/acpi_if.m Thu Oct 17 19:49:20 2019 (r353692) +++ head/sys/dev/acpica/acpi_if.m Thu Oct 17 19:53:55 2019 (r353693) @@ -61,11 +61,11 @@ HEADER { # Default implementation for acpi_id_probe(). # CODE { - static char * + static int acpi_generic_id_probe(device_t bus, device_t dev, char **ids, char **match) { - return (NULL); + return (ENXIO); } }; From owner-svn-src-all@freebsd.org Thu Oct 17 20:10:34 2019 Return-Path: Delivered-To: svn-src-all@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 0586615C930; Thu, 17 Oct 2019 20:10:34 +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 46vKzF67H3z4fFR; Thu, 17 Oct 2019 20:10:33 +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 B59D525B50; Thu, 17 Oct 2019 20:10:33 +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 x9HKAXnu017831; Thu, 17 Oct 2019 20:10:33 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HKAWMa017826; Thu, 17 Oct 2019 20:10:32 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910172010.x9HKAWMa017826@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 17 Oct 2019 20:10:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353694 - in head: share/man/man4 sys/net sys/netinet/netdump X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: share/man/man4 sys/net sys/netinet/netdump X-SVN-Commit-Revision: 353694 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 20:10:34 -0000 Author: cem Date: Thu Oct 17 20:10:32 2019 New Revision: 353694 URL: https://svnweb.freebsd.org/changeset/base/353694 Log: debugnet(4): Infer non-server connection parameters Loosen requirements for connecting to debugnet-type servers. Only require a destination address; the rest can theoretically be inferred from the routing table. Relax corresponding constraints in netdump(4) and move ifp validation to debugnet connection time. Submitted by: John Reimer (earlier version) Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D21482 Modified: head/share/man/man4/ddb.4 head/sys/net/debugnet.c head/sys/net/debugnet.h head/sys/net/debugnet_int.h head/sys/netinet/netdump/netdump_client.c Modified: head/share/man/man4/ddb.4 ============================================================================== --- head/share/man/man4/ddb.4 Thu Oct 17 19:53:55 2019 (r353693) +++ head/share/man/man4/ddb.4 Thu Oct 17 20:10:32 2019 (r353694) @@ -1192,7 +1192,7 @@ In remote GDB mode, another machine is required that r using the remote debug feature, with a connection to the serial console port on the target machine. .Pp -.It Ic netdump Fl s Ar server Oo Fl g Ar gateway Oc Fl c Ar client Fl i Ar iface +.It Ic netdump Fl s Ar server Oo Fl g Ar gateway Fl c Ar client Fl i Ar iface Oc Configure .Xr netdump 4 with the provided parameters, and immediately perform a netdump. Modified: head/sys/net/debugnet.c ============================================================================== --- head/sys/net/debugnet.c Thu Oct 17 19:53:55 2019 (r353693) +++ head/sys/net/debugnet.c Thu Oct 17 20:10:32 2019 (r353694) @@ -491,8 +491,12 @@ debugnet_free(struct debugnet_pcb *pcb) MPASS(pcb == &g_dnet_pcb); ifp = pcb->dp_ifp; - ifp->if_input = pcb->dp_drv_input; - ifp->if_debugnet_methods->dn_event(ifp, DEBUGNET_END); + if (ifp != NULL) { + if (pcb->dp_drv_input != NULL) + ifp->if_input = pcb->dp_drv_input; + if (pcb->dp_event_started) + ifp->if_debugnet_methods->dn_event(ifp, DEBUGNET_END); + } debugnet_mbuf_finish(); g_debugnet_pcb_inuse = false; @@ -527,8 +531,87 @@ debugnet_connect(const struct debugnet_conn_params *dc /* Switch to the debugnet mbuf zones. */ debugnet_mbuf_start(); + /* At least one needed parameter is missing; infer it. */ + if (pcb->dp_client == INADDR_ANY || pcb->dp_gateway == INADDR_ANY || + pcb->dp_ifp == NULL) { + struct sockaddr_in dest_sin, *gw_sin, *local_sin; + struct rtentry *dest_rt; + struct ifnet *rt_ifp; + + memset(&dest_sin, 0, sizeof(dest_sin)); + dest_sin = (struct sockaddr_in) { + .sin_len = sizeof(dest_sin), + .sin_family = AF_INET, + .sin_addr.s_addr = pcb->dp_server, + }; + + CURVNET_SET(vnet0); + dest_rt = rtalloc1((struct sockaddr *)&dest_sin, 0, + RTF_RNH_LOCKED); + CURVNET_RESTORE(); + + if (dest_rt == NULL) { + db_printf("%s: Could not get route for that server.\n", + __func__); + error = ENOENT; + goto cleanup; + } + + if (dest_rt->rt_gateway->sa_family == AF_INET) + gw_sin = (struct sockaddr_in *)dest_rt->rt_gateway; + else { + if (dest_rt->rt_gateway->sa_family == AF_LINK) + DNETDEBUG("Destination address is on link.\n"); + gw_sin = NULL; + } + + MPASS(dest_rt->rt_ifa->ifa_addr->sa_family == AF_INET); + local_sin = (struct sockaddr_in *)dest_rt->rt_ifa->ifa_addr; + + rt_ifp = dest_rt->rt_ifp; + + if (pcb->dp_client == INADDR_ANY) + pcb->dp_client = local_sin->sin_addr.s_addr; + if (pcb->dp_gateway == INADDR_ANY && gw_sin != NULL) + pcb->dp_gateway = gw_sin->sin_addr.s_addr; + if (pcb->dp_ifp == NULL) + pcb->dp_ifp = rt_ifp; + + RTFREE_LOCKED(dest_rt); + } + ifp = pcb->dp_ifp; + + if (debugnet_debug > 0) { + char serbuf[INET_ADDRSTRLEN], clibuf[INET_ADDRSTRLEN], + gwbuf[INET_ADDRSTRLEN]; + inet_ntop(AF_INET, &pcb->dp_server, serbuf, sizeof(serbuf)); + inet_ntop(AF_INET, &pcb->dp_client, clibuf, sizeof(clibuf)); + if (pcb->dp_gateway != INADDR_ANY) + inet_ntop(AF_INET, &pcb->dp_gateway, gwbuf, sizeof(gwbuf)); + DNETDEBUG("Connecting to %s:%d%s%s from %s:%d on %s\n", + serbuf, pcb->dp_server_port, + (pcb->dp_gateway == INADDR_ANY) ? "" : " via ", + (pcb->dp_gateway == INADDR_ANY) ? "" : gwbuf, + clibuf, pcb->dp_client_ack_port, if_name(ifp)); + } + + /* Validate iface is online and supported. */ + if (!DEBUGNET_SUPPORTED_NIC(ifp)) { + printf("%s: interface '%s' does not support debugnet\n", + __func__, if_name(ifp)); + error = ENODEV; + goto cleanup; + } + if ((if_getflags(ifp) & IFF_UP) == 0) { + printf("%s: interface '%s' link is down\n", __func__, + if_name(ifp)); + error = ENXIO; + goto cleanup; + } + ifp->if_debugnet_methods->dn_event(ifp, DEBUGNET_START); + pcb->dp_event_started = true; /* * We maintain the invariant that g_debugnet_pcb_inuse is always true @@ -842,37 +925,21 @@ debugnet_parse_ddb_cmd(const char *cmd, struct debugne t = db_read_token_flags(DRT_WSPACE); } - /* Currently, all three are required. */ - if (!opt_client.has_opt || !opt_server.has_opt || ifp == NULL) { - db_printf("%s needs all of client, server, and interface " - "specified.\n", cmd); + if (!opt_server.has_opt) { + db_printf("%s: need a destination server address\n", cmd); goto usage; } + result->dd_has_client = opt_client.has_opt; result->dd_has_gateway = opt_gateway.has_opt; - - /* Iface validation stolen from netdump_configure. */ - if (!DEBUGNET_SUPPORTED_NIC(ifp)) { - db_printf("%s: interface '%s' does not support debugnet\n", - cmd, if_name(ifp)); - error = ENODEV; - goto cleanup; - } - if ((if_getflags(ifp) & IFF_UP) == 0) { - db_printf("%s: interface '%s' link is down\n", cmd, - if_name(ifp)); - error = ENXIO; - goto cleanup; - } - result->dd_ifp = ifp; /* We parsed the full line to tEOL already, or bailed with an error. */ return (0); usage: - db_printf("Usage: %s -s [-g ] -c " - "-i \n", cmd); + db_printf("Usage: %s -s [-g -c " + "-i ]\n", cmd); error = EINVAL; /* FALLTHROUGH */ cleanup: Modified: head/sys/net/debugnet.h ============================================================================== --- head/sys/net/debugnet.h Thu Oct 17 19:53:55 2019 (r353693) +++ head/sys/net/debugnet.h Thu Oct 17 20:10:32 2019 (r353694) @@ -176,11 +176,12 @@ void debugnet_any_ifnet_update(struct ifnet *); /* * DDB parsing helper for common debugnet options. * - * -s [-g -i + * -s [-g -i ] * * Order is not significant. Interface is an online interface that supports * debugnet and can route to the debugnet server. The other parameters are all - * IP addresses. For now, all parameters are mandatory, except gateway. + * IP addresses. Only the server parameter is required. The others are + * inferred automatically from the routing table, if not explicitly provided. * * Provides basic '-h' using provided 'cmd' string. * @@ -191,6 +192,7 @@ struct debugnet_ddb_config { in_addr_t dd_client; in_addr_t dd_server; in_addr_t dd_gateway; + bool dd_has_client : 1; bool dd_has_gateway : 1; }; int debugnet_parse_ddb_cmd(const char *cmd, Modified: head/sys/net/debugnet_int.h ============================================================================== --- head/sys/net/debugnet_int.h Thu Oct 17 19:53:55 2019 (r353693) +++ head/sys/net/debugnet_int.h Thu Oct 17 20:10:32 2019 (r353694) @@ -69,6 +69,7 @@ struct debugnet_pcb { enum dnet_pcb_st dp_state; uint16_t dp_client_ack_port; + bool dp_event_started; }; /* TODO(CEM): Obviate this assertion by using a BITSET(9) for acks. */ Modified: head/sys/netinet/netdump/netdump_client.c ============================================================================== --- head/sys/netinet/netdump/netdump_client.c Thu Oct 17 19:53:55 2019 (r353693) +++ head/sys/netinet/netdump/netdump_client.c Thu Oct 17 20:10:32 2019 (r353694) @@ -138,8 +138,8 @@ static int nd_debug; SYSCTL_INT(_net_netdump, OID_AUTO, debug, CTLFLAG_RWTUN, &nd_debug, 0, "Debug message verbosity"); -SYSCTL_PROC(_net_netdump, OID_AUTO, enabled, CTLFLAG_RD | CTLTYPE_INT, - &nd_ifp, 0, netdump_enabled_sysctl, "I", "netdump configuration status"); +SYSCTL_PROC(_net_netdump, OID_AUTO, enabled, CTLFLAG_RD | CTLTYPE_INT, NULL, 0, + netdump_enabled_sysctl, "I", "netdump configuration status"); static char nd_path[MAXPATHLEN]; SYSCTL_STRING(_net_netdump, OID_AUTO, path, CTLFLAG_RW, nd_path, sizeof(nd_path), @@ -158,14 +158,23 @@ SYSCTL_INT(_net_netdump, OID_AUTO, arp_retries, CTLFLA &debugnet_arp_nretries, 0, "Number of ARP attempts before giving up"); +static bool nd_is_enabled; static bool netdump_enabled(void) { NETDUMP_ASSERT_LOCKED(); - return (nd_ifp != NULL); + return (nd_is_enabled); } +static void +netdump_set_enabled(bool status) +{ + + NETDUMP_ASSERT_LOCKED(); + nd_is_enabled = status; +} + static int netdump_enabled_sysctl(SYSCTL_HANDLER_ARGS) { @@ -296,10 +305,6 @@ netdump_start(struct dumperinfo *di) printf("netdump_start: can't netdump; no server IP given\n"); return (EINVAL); } - if (nd_client.s_addr == INADDR_ANY) { - printf("netdump_start: can't netdump; no client IP given\n"); - return (EINVAL); - } /* We start dumping at offset 0. */ di->dumpoff = 0; @@ -369,14 +374,16 @@ netdump_unconfigure(void) struct diocskerneldump_arg kda; NETDUMP_ASSERT_WLOCKED(); - KASSERT(netdump_enabled(), ("%s: nd_ifp NULL", __func__)); + KASSERT(netdump_enabled(), ("%s: not enabled", __func__)); bzero(&kda, sizeof(kda)); kda.kda_index = KDA_REMOVE_DEV; (void)dumper_remove(nd_conf.ndc_iface, &kda); - if_rele(nd_ifp); + if (nd_ifp != NULL) + if_rele(nd_ifp); nd_ifp = NULL; + netdump_set_enabled(false); log(LOG_WARNING, "netdump: Lost configured interface %s\n", nd_conf.ndc_iface); @@ -406,32 +413,25 @@ netdump_configure(struct diocskerneldump_arg *conf, st NETDUMP_ASSERT_WLOCKED(); - if (td != NULL) - vnet = TD_TO_VNET(td); - else - vnet = vnet0; - CURVNET_SET(vnet); - if (td != NULL && !IS_DEFAULT_VNET(curvnet)) { + if (conf->kda_iface[0] != 0) { + if (td != NULL) + vnet = TD_TO_VNET(td); + else + vnet = vnet0; + CURVNET_SET(vnet); + if (td != NULL && !IS_DEFAULT_VNET(curvnet)) { + CURVNET_RESTORE(); + return (EINVAL); + } + ifp = ifunit_ref(conf->kda_iface); CURVNET_RESTORE(); - return (EINVAL); - } - ifp = ifunit_ref(conf->kda_iface); - CURVNET_RESTORE(); + } else + ifp = NULL; - if (ifp == NULL) - return (ENOENT); - if ((if_getflags(ifp) & IFF_UP) == 0) { - if_rele(ifp); - return (ENXIO); - } - if (!DEBUGNET_SUPPORTED_NIC(ifp)) { - if_rele(ifp); - return (ENODEV); - } - - if (netdump_enabled()) + if (nd_ifp != NULL) if_rele(nd_ifp); nd_ifp = ifp; + netdump_set_enabled(true); #define COPY_SIZED(elm) do { \ _Static_assert(sizeof(nd_conf.ndc_ ## elm) == \ @@ -527,8 +527,9 @@ netdump_ioctl(struct cdev *dev __unused, u_long cmd, c break; } - strlcpy(conf12->ndc12_iface, nd_ifp->if_xname, - sizeof(conf12->ndc12_iface)); + if (nd_ifp != NULL) + strlcpy(conf12->ndc12_iface, nd_ifp->if_xname, + sizeof(conf12->ndc12_iface)); memcpy(&conf12->ndc12_server, &nd_server, sizeof(conf12->ndc12_server)); memcpy(&conf12->ndc12_client, &nd_client, @@ -549,8 +550,9 @@ netdump_ioctl(struct cdev *dev __unused, u_long cmd, c break; } - strlcpy(conf->kda_iface, nd_ifp->if_xname, - sizeof(conf->kda_iface)); + if (nd_ifp != NULL) + strlcpy(conf->kda_iface, nd_ifp->if_xname, + sizeof(conf->kda_iface)); memcpy(&conf->kda_server, &nd_server, sizeof(nd_server)); memcpy(&conf->kda_client, &nd_client, sizeof(nd_client)); memcpy(&conf->kda_gateway, &nd_gateway, sizeof(nd_gateway)); @@ -776,11 +778,17 @@ DB_FUNC(netdump, db_netdump_cmd, db_cmd_table, CS_OWN, /* Translate to a netdump dumper config. */ memset(&conf, 0, sizeof(conf)); - strlcpy(conf.kda_iface, if_name(params.dd_ifp), sizeof(conf.kda_iface)); + if (params.dd_ifp != NULL) + strlcpy(conf.kda_iface, if_name(params.dd_ifp), + sizeof(conf.kda_iface)); + conf.kda_af = AF_INET; conf.kda_server.in4 = (struct in_addr) { params.dd_server }; - conf.kda_client.in4 = (struct in_addr) { params.dd_client }; + if (params.dd_has_client) + conf.kda_client.in4 = (struct in_addr) { params.dd_client }; + else + conf.kda_client.in4 = (struct in_addr) { INADDR_ANY }; if (params.dd_has_gateway) conf.kda_gateway.in4 = (struct in_addr) { params.dd_gateway }; else From owner-svn-src-all@freebsd.org Thu Oct 17 20:18:08 2019 Return-Path: Delivered-To: svn-src-all@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 79D1515CB24; Thu, 17 Oct 2019 20:18:08 +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 46vL802dbXz4ffV; Thu, 17 Oct 2019 20:18:08 +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 3966E25D2C; Thu, 17 Oct 2019 20:18:08 +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 x9HKI8A2023773; Thu, 17 Oct 2019 20:18:08 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HKI8bJ023772; Thu, 17 Oct 2019 20:18:08 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910172018.x9HKI8bJ023772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 17 Oct 2019 20:18:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353695 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353695 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 20:18:08 -0000 Author: glebius Date: Thu Oct 17 20:18:07 2019 New Revision: 353695 URL: https://svnweb.freebsd.org/changeset/base/353695 Log: Revert two parts of r353292 that enter epoch when processing vlan capabilities. It could be that entering epoch isn't necessary here, but better take a conservative approach. Submitted by: kp Modified: head/sys/net/if_vlan.c Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Thu Oct 17 20:10:32 2019 (r353694) +++ head/sys/net/if_vlan.c Thu Oct 17 20:18:07 2019 (r353695) @@ -1625,14 +1625,16 @@ vlan_setflags(struct ifnet *ifp, int status) static void vlan_link_state(struct ifnet *ifp) { + struct epoch_tracker et; struct ifvlantrunk *trunk; struct ifvlan *ifv; - NET_EPOCH_ASSERT(); - + NET_EPOCH_ENTER(et); trunk = ifp->if_vlantrunk; - if (trunk == NULL) + if (trunk == NULL) { + NET_EPOCH_EXIT(et); return; + } TRUNK_WLOCK(trunk); VLAN_FOREACH(ifv, trunk) { @@ -1641,6 +1643,7 @@ vlan_link_state(struct ifnet *ifp) trunk->parent->if_link_state); } TRUNK_WUNLOCK(trunk); + NET_EPOCH_EXIT(et); } static void @@ -1770,6 +1773,7 @@ vlan_capabilities(struct ifvlan *ifv) static void vlan_trunk_capabilities(struct ifnet *ifp) { + struct epoch_tracker et; struct ifvlantrunk *trunk; struct ifvlan *ifv; @@ -1779,8 +1783,10 @@ vlan_trunk_capabilities(struct ifnet *ifp) VLAN_SUNLOCK(); return; } + NET_EPOCH_ENTER(et); VLAN_FOREACH(ifv, trunk) vlan_capabilities(ifv); + NET_EPOCH_EXIT(et); VLAN_SUNLOCK(); } From owner-svn-src-all@freebsd.org Thu Oct 17 20:25:17 2019 Return-Path: Delivered-To: svn-src-all@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 35CF815CD9F; Thu, 17 Oct 2019 20:25:17 +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 46vLJF0Yz9z4g7w; Thu, 17 Oct 2019 20:25:17 +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 E665F25EEC; Thu, 17 Oct 2019 20:25:16 +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 x9HKPGUp029388; Thu, 17 Oct 2019 20:25:16 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HKPGZ8029384; Thu, 17 Oct 2019 20:25:16 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910172025.x9HKPGZ8029384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 17 Oct 2019 20:25:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353696 - in head/sys: net netinet/netdump X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: net netinet/netdump X-SVN-Commit-Revision: 353696 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 20:25:17 -0000 Author: cem Date: Thu Oct 17 20:25:15 2019 New Revision: 353696 URL: https://svnweb.freebsd.org/changeset/base/353696 Log: debugnet(4): Add optional full-duplex mode It remains unattached to any client protocol. Netdump is unaffected (remaining half-duplex). The intended consumer is NetGDB. Submitted by: John Reimer (earlier version) Discussed with: markj Differential Revision: https://reviews.freebsd.org/D21541 Modified: head/sys/net/debugnet.c head/sys/net/debugnet.h head/sys/net/debugnet_int.h head/sys/netinet/netdump/netdump_client.c Modified: head/sys/net/debugnet.c ============================================================================== --- head/sys/net/debugnet.c Thu Oct 17 20:18:07 2019 (r353695) +++ head/sys/net/debugnet.c Thu Oct 17 20:25:15 2019 (r353696) @@ -175,7 +175,7 @@ debugnet_udp_output(struct debugnet_pcb *pcb, struct m udp = mtod(m, void *); udp->uh_ulen = htons(m->m_pkthdr.len); /* Use this src port so that the server can connect() the socket */ - udp->uh_sport = htons(pcb->dp_client_ack_port); + udp->uh_sport = htons(pcb->dp_client_port); udp->uh_dport = htons(pcb->dp_server_port); /* Computed later (protocol-dependent). */ udp->uh_sum = 0; @@ -183,6 +183,28 @@ debugnet_udp_output(struct debugnet_pcb *pcb, struct m return (debugnet_ip_output(pcb, m)); } +static int +debugnet_ack_output(struct debugnet_pcb *pcb, uint32_t seqno /* net endian */) +{ + struct debugnet_ack *dn_ack; + struct mbuf *m; + + DNETDEBUG("Acking with seqno %u\n", ntohl(seqno)); + + m = m_gethdr(M_NOWAIT, MT_DATA); + if (m == NULL) { + printf("%s: Out of mbufs\n", __func__); + return (ENOBUFS); + } + m->m_len = sizeof(*dn_ack); + m->m_pkthdr.len = sizeof(*dn_ack); + MH_ALIGN(m, sizeof(*dn_ack)); + dn_ack = mtod(m, void *); + dn_ack->da_seqno = seqno; + + return (debugnet_udp_output(pcb, m)); +} + /* * Dummy free function for debugnet clusters. */ @@ -216,6 +238,9 @@ debugnet_send(struct debugnet_pcb *pcb, uint32_t type, uint32_t i, pktlen, sent_so_far; int retries, polls, error; + if (pcb->dp_state == DN_STATE_REMOTE_CLOSED) + return (ECONNRESET); + want_acks = 0; pcb->dp_rcvd_acks = 0; retries = 0; @@ -307,6 +332,8 @@ retransmit: } debugnet_network_poll(pcb->dp_ifp); DELAY(500); + if (pcb->dp_state == DN_STATE_REMOTE_CLOSED) + return (ECONNRESET); } pcb->dp_seqno += i; return (0); @@ -316,7 +343,63 @@ retransmit: * Network input primitives. */ +/* + * Just introspect the header enough to fire off a seqno ack and validate + * length fits. + */ static void +debugnet_handle_rx_msg(struct debugnet_pcb *pcb, struct mbuf **mb) +{ + const struct debugnet_msg_hdr *dnh; + struct mbuf *m; + int error; + + m = *mb; + + if (m->m_pkthdr.len < sizeof(*dnh)) { + DNETDEBUG("ignoring small debugnet_msg packet\n"); + return; + } + + /* Get ND header. */ + if (m->m_len < sizeof(*dnh)) { + m = m_pullup(m, sizeof(*dnh)); + *mb = m; + if (m == NULL) { + DNETDEBUG("m_pullup failed\n"); + return; + } + } + dnh = mtod(m, const void *); + + if (ntohl(dnh->mh_len) + sizeof(*dnh) > m->m_pkthdr.len) { + DNETDEBUG("Dropping short packet.\n"); + return; + } + + /* + * If the issue is transient (ENOBUFS), sender should resend. If + * non-transient (like driver objecting to rx -> tx from the same + * thread), not much else we can do. + */ + error = debugnet_ack_output(pcb, dnh->mh_seqno); + if (error != 0) + return; + + if (ntohl(dnh->mh_type) == DEBUGNET_FINISHED) { + printf("Remote shut down the connection on us!\n"); + pcb->dp_state = DN_STATE_REMOTE_CLOSED; + + /* + * Continue through to the user handler so they are signalled + * not to wait for further rx. + */ + } + + pcb->dp_rx_handler(pcb, mb); +} + +static void debugnet_handle_ack(struct debugnet_pcb *pcb, struct mbuf **mb, uint16_t sport) { const struct debugnet_ack *dn_ack; @@ -325,10 +408,6 @@ debugnet_handle_ack(struct debugnet_pcb *pcb, struct m m = *mb; - if (m->m_pkthdr.len < sizeof(*dn_ack)) { - DNETDEBUG("ignoring small ACK packet\n"); - return; - } /* Get Ack. */ if (m->m_len < sizeof(*dn_ack)) { m = m_pullup(m, sizeof(*dn_ack)); @@ -363,7 +442,7 @@ debugnet_handle_udp(struct debugnet_pcb *pcb, struct m { const struct udphdr *udp; struct mbuf *m; - uint16_t sport; + uint16_t sport, ulen; /* UDP processing. */ @@ -384,15 +463,39 @@ debugnet_handle_udp(struct debugnet_pcb *pcb, struct m } udp = mtod(m, const void *); - /* For now, the only UDP packets we expect to receive are acks. */ - if (ntohs(udp->uh_dport) != pcb->dp_client_ack_port) { - DNETDEBUG("not on the expected ACK port.\n"); + /* We expect to receive UDP packets on the configured client port. */ + if (ntohs(udp->uh_dport) != pcb->dp_client_port) { + DNETDEBUG("not on the expected port.\n"); return; } + + /* Check that ulen does not exceed actual size of data. */ + ulen = ntohs(udp->uh_ulen); + if (m->m_pkthdr.len < ulen) { + DNETDEBUG("ignoring runt UDP packet\n"); + return; + } + sport = ntohs(udp->uh_sport); m_adj(m, sizeof(*udp)); - debugnet_handle_ack(pcb, mb, sport); + ulen -= sizeof(*udp); + + if (ulen == sizeof(struct debugnet_ack)) { + debugnet_handle_ack(pcb, mb, sport); + return; + } + + if (pcb->dp_rx_handler == NULL) { + if (ulen < sizeof(struct debugnet_ack)) + DNETDEBUG("ignoring small ACK packet\n"); + else + DNETDEBUG("ignoring unexpected non-ACK packet on " + "half-duplex connection.\n"); + return; + } + + debugnet_handle_rx_msg(pcb, mb); } /* @@ -523,9 +626,10 @@ debugnet_connect(const struct debugnet_conn_params *dc .dp_server = dcp->dc_server, .dp_gateway = dcp->dc_gateway, .dp_server_port = dcp->dc_herald_port, /* Initially */ - .dp_client_ack_port = dcp->dc_client_ack_port, + .dp_client_port = dcp->dc_client_port, .dp_seqno = 1, .dp_ifp = dcp->dc_ifp, + .dp_rx_handler = dcp->dc_rx_handler, }; /* Switch to the debugnet mbuf zones. */ @@ -593,7 +697,7 @@ debugnet_connect(const struct debugnet_conn_params *dc serbuf, pcb->dp_server_port, (pcb->dp_gateway == INADDR_ANY) ? "" : " via ", (pcb->dp_gateway == INADDR_ANY) ? "" : gwbuf, - clibuf, pcb->dp_client_ack_port, if_name(ifp)); + clibuf, pcb->dp_client_port, if_name(ifp)); } /* Validate iface is online and supported. */ Modified: head/sys/net/debugnet.h ============================================================================== --- head/sys/net/debugnet.h Thu Oct 17 20:18:07 2019 (r353695) +++ head/sys/net/debugnet.h Thu Oct 17 20:25:15 2019 (r353696) @@ -90,6 +90,8 @@ struct debugnet_methods { #define DEBUGNET_SUPPORTED_NIC(ifp) \ ((ifp)->if_debugnet_methods != NULL && (ifp)->if_type == IFT_ETHER) +struct debugnet_pcb; /* opaque */ + /* * Debugnet consumer API. */ @@ -100,13 +102,30 @@ struct debugnet_conn_params { in_addr_t dc_gateway; uint16_t dc_herald_port; - uint16_t dc_client_ack_port; + uint16_t dc_client_port; const void *dc_herald_data; uint32_t dc_herald_datalen; -}; -struct debugnet_pcb; /* opaque */ + /* + * If NULL, debugnet is a unidirectional channel from panic machine to + * remote server (like netdump). + * + * If handler is non-NULL, packets received on the client port that are + * not just tx acks are forwarded to the provided handler. + * + * The mbuf chain will have all non-debugnet framing headers removed + * (ethernet, inet, udp). It will start with a debugnet_msg_hdr, of + * which the header is guaranteed to be contiguous. If m_pullup is + * used, the supplied in-out mbuf pointer should be updated + * appropriately. + * + * If the handler frees the mbuf chain, it should set the mbuf pointer + * to NULL. Otherwise, the debugnet input framework will free the + * chain. + */ + void (*dc_rx_handler)(struct debugnet_pcb *, struct mbuf **); +}; /* * Open a unidirectional stream to the specified server's herald port. Modified: head/sys/net/debugnet_int.h ============================================================================== --- head/sys/net/debugnet_int.h Thu Oct 17 20:18:07 2019 (r353695) +++ head/sys/net/debugnet_int.h Thu Oct 17 20:25:15 2019 (r353696) @@ -50,6 +50,7 @@ enum dnet_pcb_st { DN_STATE_INIT = 1, DN_STATE_HAVE_GW_MAC, DN_STATE_GOT_HERALD_PORT, + DN_STATE_REMOTE_CLOSED, }; struct debugnet_pcb { @@ -67,8 +68,12 @@ struct debugnet_pcb { /* Saved driver if_input to restore on close. */ void (*dp_drv_input)(struct ifnet *, struct mbuf *); + /* RX handler for bidirectional protocols. */ + void (*dp_rx_handler)(struct debugnet_pcb *, + struct mbuf **); + enum dnet_pcb_st dp_state; - uint16_t dp_client_ack_port; + uint16_t dp_client_port; bool dp_event_started; }; Modified: head/sys/netinet/netdump/netdump_client.c ============================================================================== --- head/sys/netinet/netdump/netdump_client.c Thu Oct 17 20:18:07 2019 (r353695) +++ head/sys/netinet/netdump/netdump_client.c Thu Oct 17 20:25:15 2019 (r353696) @@ -316,7 +316,7 @@ netdump_start(struct dumperinfo *di) dcp.dc_gateway = nd_gateway.s_addr; dcp.dc_herald_port = NETDUMP_PORT; - dcp.dc_client_ack_port = NETDUMP_ACKPORT; + dcp.dc_client_port = NETDUMP_ACKPORT; dcp.dc_herald_data = nd_path; dcp.dc_herald_datalen = (nd_path[0] == 0) ? 0 : strlen(nd_path) + 1; From owner-svn-src-all@freebsd.org Thu Oct 17 20:40:07 2019 Return-Path: Delivered-To: svn-src-all@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 7B71815D216; Thu, 17 Oct 2019 20:40:07 +0000 (UTC) (envelope-from sjg@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 46vLdM2kmnz3CKh; Thu, 17 Oct 2019 20:40:07 +0000 (UTC) (envelope-from sjg@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 42759260CD; Thu, 17 Oct 2019 20:40:07 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9HKe72L035519; Thu, 17 Oct 2019 20:40:07 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HKe71B035518; Thu, 17 Oct 2019 20:40:07 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201910172040.x9HKe71B035518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Thu, 17 Oct 2019 20:40:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353697 - head/stand/efi/loader X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: head/stand/efi/loader X-SVN-Commit-Revision: 353697 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 20:40:07 -0000 Author: sjg Date: Thu Oct 17 20:40:06 2019 New Revision: 353697 URL: https://svnweb.freebsd.org/changeset/base/353697 Log: Allow loader.efi to identify non-standard boot setup PATH_BOOTABLE_TOKEN can be set to a non-standard path that identifies a device as bootable. Reviewed by: kevans, bcran Differential Revision: https://reviews.freebsd.org/D22062 Modified: head/stand/efi/loader/main.c Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Thu Oct 17 20:25:15 2019 (r353696) +++ head/stand/efi/loader/main.c Thu Oct 17 20:40:06 2019 (r353697) @@ -239,6 +239,9 @@ sanity_check_currdev(void) struct stat st; return (stat(PATH_DEFAULTS_LOADER_CONF, &st) == 0 || +#ifdef PATH_BOOTABLE_TOKEN + stat(PATH_BOOTABLE_TOKEN, &st) == 0 || /* non-standard layout */ +#endif stat(PATH_KERNEL, &st) == 0); } From owner-svn-src-all@freebsd.org Thu Oct 17 20:46:34 2019 Return-Path: Delivered-To: svn-src-all@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 9A3A515D514; Thu, 17 Oct 2019 20:46:34 +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 46vLmp3d3xz3D3T; Thu, 17 Oct 2019 20:46:34 +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 5FAB426292; Thu, 17 Oct 2019 20:46:34 +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 x9HKkYAw041831; Thu, 17 Oct 2019 20:46:34 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HKkYYX041830; Thu, 17 Oct 2019 20:46:34 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910172046.x9HKkYYX041830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 17 Oct 2019 20:46:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353698 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 353698 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 20:46:34 -0000 Author: markj Date: Thu Oct 17 20:46:33 2019 New Revision: 353698 URL: https://svnweb.freebsd.org/changeset/base/353698 Log: Belatedly bump __FreeBSD_version for r353537 and related commits. At least one small update to the out-of-tree DRM drivers is required now that cdev_pager_free_page() expects an xbusy page. Discussed with: jeff, zeising Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Thu Oct 17 20:40:06 2019 (r353697) +++ head/sys/sys/param.h Thu Oct 17 20:46:33 2019 (r353698) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300051 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300052 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Thu Oct 17 21:08:48 2019 Return-Path: Delivered-To: svn-src-all@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 AFAD915DB31; Thu, 17 Oct 2019 21:08:48 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) (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 46vMGS47D2z3F8L; Thu, 17 Oct 2019 21:08:48 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt1-x82e.google.com with SMTP id w14so5706993qto.9; Thu, 17 Oct 2019 14:08:48 -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=QQs3SliRwbiyj8tsHxGfpsPhYDdTnPioAe1PynUb8X0=; b=bjs4XtoFignGD1eRlbDjNzJfNtMRhr9lQUOc0EwR1njeHblqsUVJ7zyuHbDhtRrGtc bWsY7GRaxIFJVxSRzYFAxwNZYPCKcjlffwc/pW70dnrHGYjnXECPTJQgJ/6Dxt8YfWeg u6TsMZI9RLcYlUSGd0rW2p/d4V7lth/zNCHcV/ivoRfEkIduI7GSU0CQCxYe3tG7KeuA DBFI9tLbWAkkehCgcZHytLyRp3AcP79t3goYVBeJmrN1pVGEkz9hFu432fLDPoQRszt9 PblZhMPzF5JWiEliY83Gyvwo7dox7jlwS1hq3iIyC32hnfU+jWpfs344q06cGmNpYTpF nsPg== 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=QQs3SliRwbiyj8tsHxGfpsPhYDdTnPioAe1PynUb8X0=; b=GgveXvLefs1Cdsb4ySnXs/S+2nFd3klKAB5DLtDPqMDkhxi5pju/IybHjZ8oRopHYS X99MaFefVvMQ8erggHja7Y5IBVUdoZfPtwCQyBZbJzrFEV9tgocPafNt/AfRy8rR+AfK F7/LjpJdyMCGfUx7PD2yv8ygG5IyIBFNURCZQqh8bSd4Rvpn/dDMsDHPgRLWDePD+Er4 h13xVFAXublW4dYR9zF4uMCeFFcNAkh31N8pTBT4AWIDZatLejntfucWoV3VMyzpDGV4 l+713DM6bZPaTF1ViFfZLhzshaG0trXOkVcuPe4PALolJIIEBdgVf0pBdpmmGzL/LCam LFXw== X-Gm-Message-State: APjAAAV5FbFKL9yM5S8RnA0/1N/FXcm1shWkhev+tmV9Yb0ALz4aaF2R Mm4ZcsQgDn81lEnZohgDZe/zuzY39uU= X-Google-Smtp-Source: APXvYqx4GbI5UfiMGt3VcWVTKdZjFtvuEejwJzuhmw5ASsxJAk4l7rlxZuYDP2p8I3p2R4xwhCxRYA== X-Received: by 2002:a0c:ee8f:: with SMTP id u15mr6302612qvr.0.1571346526725; Thu, 17 Oct 2019 14:08:46 -0700 (PDT) Received: from raichu (toroon0560w-lp130-05-69-158-183-252.dsl.bell.ca. [69.158.183.252]) by smtp.gmail.com with ESMTPSA id i30sm2277208qte.27.2019.10.17.14.08.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 14:08:45 -0700 (PDT) Sender: Mark Johnston Date: Thu, 17 Oct 2019 17:08:38 -0400 From: Mark Johnston To: Alan Somers Cc: Ian Lepore , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r352909 - in head: contrib/elftoolchain/nm usr.bin/nm Message-ID: <20191017210838.GA23659@raichu> References: <201909301728.x8UHS0QF070658@repo.freebsd.org> <20191017174801.GA6447@raichu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46vMGS47D2z3F8L X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 21:08:48 -0000 On Thu, Oct 17, 2019 at 01:05:42PM -0600, Alan Somers wrote: > On Thu, Oct 17, 2019 at 12:48 PM Ian Lepore wrote: > > > On Thu, 2019-10-17 at 12:17 -0600, Alan Somers wrote: > > > There might be something wrong with my environment: > > > /usr/include/libcasper.h is absent. But still, shouldn't the build > > > be > > > using the version from the source tree, instead of from the > > > environment? > > > -Alan > > > > > > > There should be copies of libcasper.h in your objdir: > > > > obj/arm.armv7/tmp/legacy/usr/include/libcasper.h > > obj/arm.armv7/tmp/usr/include/libcasper.h > > > > -- Ian > > > Uh, I found the problem. I had WITHOUT_CASPER=1 in /etc/src.conf. So the > problem is that nm can't build without casper. Perhaps the #include should > be guarded, as it is in usr.bin/kdump/kdump.c. But plenty of other > programs, like usr.bin/tail and usr.bin/wc, don't have such guards. And > looking at lib/libcasper/libcasper/Makefile, it seems as though libcasper.h > should be installed regardless. So I still need to figure out why it > wasn't installed on my system. Indeed, "make -C usr.bin/nm WITHOUT_CASPER=" builds fine for me. libcasper.h provides stub routines unless WITH_CASPER is defined in the preprocessor, so applications which make use of casper must define this symbol unless the make variable WITHOUT_CASPER is set. From owner-svn-src-all@freebsd.org Thu Oct 17 21:16:30 2019 Return-Path: Delivered-To: svn-src-all@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 B48DB15DD66 for ; Thu, 17 Oct 2019 21:16:30 +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 46vMRL2BBhz3Fhr for ; Thu, 17 Oct 2019 21:16:30 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1571346989; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=P97h+Es4feGxtAozfEOsLRrxy4OAydyoLRopIniuabQ4c4hPY4UTPUASkxdzFEROBgGUVuL2FXy7j qj3hdiB4kEztcRwjlmDsuCrVUwbu16GLm586833Xsy0vOBSUK5CI4Kbj/Q5vvmMpwxA6X+a7zfqmKA Zw8U2wmIYjOqun2rz9sYqTptWbhi+3K83RIr/JV/V4KCObsCC0P2f757xckurWqsoT5M5kCmYizeJ4 V7WAmhRGyyI4HJwewIezezX5OHkqaIayYTzKTOJ8XrkkHLJpsz5aHfyrrqVZCh0e2vCgVjkdX65pnh 3Vgz5e983homhecj6zRxJUyWJDG6htw== 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:cc:to:from:subject:message-id:dkim-signature:from; bh=l+Rm6a2oiw2zQaqnJ++OpOiAmylKMotlKmrGgdofYlc=; b=Z3DZG8D9kjFbcDqtlS3Bm4g73l0oKhJlW/avyXDRCzj2yN5e0mobdKaKujxCqEWKDLMo9FVyqvoaj SLutvlsGG1lKKu1ikCMSls8Dzjsl9K5Hy3H55ljpA+RQ23Du3R96WmxziA2H+Kt1170uOXUkMfRc1O dNmuyTv4l29d9bKTyYCw8SvnfgTNVbsz9BDIjDkQuTLdHTnl8d/ldh7+kzwjnHlJfDyfURxQW4iShm TXu8XY3dtAPE9ridnAnuoZ3QHPr6fKLfZDhbVWQqpFGgnKmUmaASq9pm7jYEA2LLfqEaiALBdXsCYm xEm+R29HIChqZqv5JQ98D+ArzW6ATww== 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:cc:to:from:subject:message-id:from; bh=l+Rm6a2oiw2zQaqnJ++OpOiAmylKMotlKmrGgdofYlc=; b=vL9SkXlHGZUVMlaVqE/Qe4vkvJeglKEiDvt0lZCLYCOkCWLfITSURKTPfjDP6/lNTfgK8YrGDnZ9t 8si5aeFvj3cQJNEaSgbw0uQhnQytt9u+iDmvYLuxR69msJ1A9AnvwZ8ebdjZA4wLF9vIX3EaBYeLFz 29IrKr8cFT5w9yFY09geJZ8mUozSDq2n0mNiI5YCO/Iz2qfqc3nNeOdxrKWIN2ZyrXTLqxqHCIXgcV CkXTEpQgToU8OEKAb/iSWBj/t7WGJ60tqVKY8AppQJ+1aKmDhhz9cdwOOXrP7Y49ofLfPnTp0nwArO FevRxjEvAAeymJHXosASCTq3r0JrRIA== X-MHO-RoutePath: aGlwcGll X-MHO-User: 613586fe-f123-11e9-85ed-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 613586fe-f123-11e9-85ed-13b9aae3a1d2; Thu, 17 Oct 2019 21:16:27 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x9HLGQ0g018735; Thu, 17 Oct 2019 15:16:26 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <179d7a5e30169f4b51fe0123a173571605fb8f28.camel@freebsd.org> Subject: Re: svn commit: r352909 - in head: contrib/elftoolchain/nm usr.bin/nm From: Ian Lepore To: Alan Somers Cc: Mark Johnston , src-committers , svn-src-all , svn-src-head Date: Thu, 17 Oct 2019 15:16:26 -0600 In-Reply-To: References: <201909301728.x8UHS0QF070658@repo.freebsd.org> <20191017174801.GA6447@raichu> 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: 46vMRL2BBhz3Fhr X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.76 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.76)[-0.758,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 21:16:30 -0000 On Thu, 2019-10-17 at 13:05 -0600, Alan Somers wrote: > On Thu, Oct 17, 2019 at 12:48 PM Ian Lepore wrote: > > > On Thu, 2019-10-17 at 12:17 -0600, Alan Somers wrote: > > > There might be something wrong with my environment: > > > /usr/include/libcasper.h is absent. But still, shouldn't the > > > build > > > be > > > using the version from the source tree, instead of from the > > > environment? > > > -Alan > > > > > > > There should be copies of libcasper.h in your objdir: > > > > obj/arm.armv7/tmp/legacy/usr/include/libcasper.h > > obj/arm.armv7/tmp/usr/include/libcasper.h > > > > -- Ian > > > Uh, I found the problem. I had WITHOUT_CASPER=1 in > /etc/src.conf. So the > problem is that nm can't build without casper. Perhaps the #include > should > be guarded, as it is in usr.bin/kdump/kdump.c. But plenty of other > programs, like usr.bin/tail and usr.bin/wc, don't have such > guards. And > looking at lib/libcasper/libcasper/Makefile, it seems as though > libcasper.h > should be installed regardless. So I still need to figure out why it > wasn't installed on my system. > > -Alan It's probably because Makefile.inc1 contains: .if ${MK_CASPER} != "no" _lib_casper= lib/libcasper .endif so WITHOUT_CASPER means that the libcasper dir isn't even visited when prebuilding libs. But you need to visit that dir so that it can install the header file (but not the lib, because MK_CASPER will be "no"). I think lib/libcasper just needs to be unconditionally listed as one of the prebuild libs in Makefile.inc1. -- Ian From owner-svn-src-all@freebsd.org Thu Oct 17 21:25:50 2019 Return-Path: Delivered-To: svn-src-all@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 E543B15DFF4; Thu, 17 Oct 2019 21:25:50 +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 46vMf65Xn5z3GBN; Thu, 17 Oct 2019 21:25:50 +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 A1BCB269AC; Thu, 17 Oct 2019 21:25:50 +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 x9HLPoK7065421; Thu, 17 Oct 2019 21:25:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HLPoKB065420; Thu, 17 Oct 2019 21:25:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910172125.x9HLPoKB065420@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 17 Oct 2019 21:25:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353699 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 353699 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 21:25:51 -0000 Author: markj Date: Thu Oct 17 21:25:50 2019 New Revision: 353699 URL: https://svnweb.freebsd.org/changeset/base/353699 Log: Clean up some nits in link_elf_(un)load_file(). - Remove a redundant assignment of ef->address. - Don't return a Mach error number to the caller if vm_map_find() fails. - Use ptoa() and fix style. MFC after: 2 weeks Sponsored by: Netflix Modified: head/sys/kern/link_elf_obj.c Modified: head/sys/kern/link_elf_obj.c ============================================================================== --- head/sys/kern/link_elf_obj.c Thu Oct 17 20:46:33 2019 (r353698) +++ head/sys/kern/link_elf_obj.c Thu Oct 17 21:25:50 2019 (r353699) @@ -779,7 +779,6 @@ link_elf_load_file(linker_class_t cls, const char *fil error = ENOMEM; goto out; } - ef->address = (caddr_t) vm_map_min(kernel_map); /* * In order to satisfy amd64's architectural requirements on the @@ -794,9 +793,10 @@ link_elf_load_file(linker_class_t cls, const char *fil error = vm_map_find(kernel_map, ef->object, 0, &mapbase, round_page(mapsize), 0, VMFS_OPTIMAL_SPACE, VM_PROT_ALL, VM_PROT_ALL, 0); - if (error) { + if (error != KERN_SUCCESS) { vm_object_deallocate(ef->object); - ef->object = 0; + ef->object = NULL; + error = ENOMEM; goto out; } @@ -1084,11 +1084,9 @@ link_elf_unload_file(linker_file_t file) free(ef->relatab, M_LINKER); free(ef->progtab, M_LINKER); - if (ef->object) { - vm_map_remove(kernel_map, (vm_offset_t) ef->address, - (vm_offset_t) ef->address + - (ef->object->size << PAGE_SHIFT)); - } + if (ef->object != NULL) + vm_map_remove(kernel_map, (vm_offset_t)ef->address, + (vm_offset_t)ef->address + ptoa(ef->object->size)); free(ef->e_shdr, M_LINKER); free(ef->ddbsymtab, M_LINKER); free(ef->ddbstrtab, M_LINKER); From owner-svn-src-all@freebsd.org Thu Oct 17 21:33:05 2019 Return-Path: Delivered-To: svn-src-all@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 0535115E330; Thu, 17 Oct 2019 21:33:05 +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 46vMpS72C4z3GpJ; Thu, 17 Oct 2019 21:33:04 +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 D586726B68; Thu, 17 Oct 2019 21:33:04 +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 x9HLX43g071064; Thu, 17 Oct 2019 21:33:04 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HLX1kl071044; Thu, 17 Oct 2019 21:33:01 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910172133.x9HLX1kl071044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 17 Oct 2019 21:33:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys X-SVN-Commit-Revision: 353700 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 21:33:05 -0000 Author: cem Date: Thu Oct 17 21:33:01 2019 New Revision: 353700 URL: https://svnweb.freebsd.org/changeset/base/353700 Log: Implement NetGDB(4) NetGDB(4) is a component of a system using a panic-time network stack to remotely debug crashed FreeBSD kernels over the network, instead of traditional serial interfaces. There are three pieces in the complete NetGDB system. First, a dedicated proxy server must be running to accept connections from both NetGDB and gdb(1), and pass bidirectional traffic between the two protocols. Second, the NetGDB client is activated much like ordinary 'gdb' and similarly to 'netdump' in ddb(4) after a panic. Like other debugnet(4) clients (netdump(4)), the network interface on the route to the proxy server must be online and support debugnet(4). Finally, the remote (k)gdb(1) uses 'target remote :' (like any other TCP remote) to connect to the proxy server. The NetGDB v1 protocol speaks the literal GDB remote serial protocol, and uses a 1:1 relationship between GDB packets and sequences of debugnet packets (fragmented by MTU). There is no encryption utilized to keep debugging sessions private, so this is only appropriate for local segments or trusted networks. Submitted by: John Reimer (earlier version) Discussed some with: emaste, markj Relnotes: sure Differential Revision: https://reviews.freebsd.org/D21568 Added: head/share/man/man4/netgdb.4 (contents, props changed) head/sys/gdb/netgdb.c (contents, props changed) head/sys/gdb/netgdb.h (contents, props changed) Modified: head/share/man/man4/Makefile head/share/man/man4/ddb.4 head/sys/amd64/conf/GENERIC head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options head/sys/gdb/gdb.h head/sys/gdb/gdb_int.h head/sys/gdb/gdb_main.c head/sys/gdb/gdb_packet.c head/sys/i386/conf/GENERIC head/sys/kern/subr_kdb.c head/sys/net/debugnet.c head/sys/net/debugnet.h head/sys/net/debugnet_inet.c head/sys/net/debugnet_int.h head/sys/sys/kdb.h head/sys/sys/param.h Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Thu Oct 17 21:25:50 2019 (r353699) +++ head/share/man/man4/Makefile Thu Oct 17 21:33:01 2019 (r353700) @@ -307,6 +307,7 @@ MAN= aac.4 \ net80211.4 \ netdump.4 \ netfpga10g_nf10bmac.4 \ + netgdb.4 \ netgraph.4 \ netintro.4 \ netmap.4 \ Modified: head/share/man/man4/ddb.4 ============================================================================== --- head/share/man/man4/ddb.4 Thu Oct 17 21:25:50 2019 (r353699) +++ head/share/man/man4/ddb.4 Thu Oct 17 21:33:01 2019 (r353700) @@ -1211,6 +1211,15 @@ Finally, the .Ic netdump command does not provide any way to configure compression or encryption. .Pp +.It Ic netgdb Fl s Ar server Oo Fl g Ar gateway Fl c Ar client Fl i Ar iface Oc +Initiate a +.Xr netgdb 4 +session with the provided parameters. +.Pp +.Ic netgdb +has identical limitations to +.Ic netdump . +.Pp .It Ic capture on .It Ic capture off .It Ic capture reset Added: head/share/man/man4/netgdb.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/netgdb.4 Thu Oct 17 21:33:01 2019 (r353700) @@ -0,0 +1,147 @@ +.\"- +.\" 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$ +.\" +.Dd October 17, 2019 +.Dt NETGDB 4 +.Os +.Sh NAME +.Nm netgdb +.Nd protocol for debugging the kernel with GDB over the network +.Sh SYNOPSIS +NetGDB support is compiled by default, if DDB, GDB, and INET are enabled. +To build a kernel without it, add the following line to your kernel +configuration file: +.Bd -ragged -offset indent +.Cd "nooptions NETGDB" +.Ed +.Sh DESCRIPTION +.Nm +is a UDP-based protocol for communicating with a remote GDB client via an +intermediary proxy. +.Pp +A +.Nm +session is started by using the +.Ic netgdb Fl s Ar server Oo Fl g Ar gateway Fl c Ar client Fl i Ar iface Oc +command in +.Xr ddb 4 +to connect to a proxy server. +When the connection is made, the proxy server logs a message that a +.Nm +client has connected. +It subsequently establishes a TCP listening socket and logs a message +specifying which port it is listening on. +Then it waits for a GDB client to connect. +The GDB command to connect is: +.Bd -ragged -offset indent +.Ic target remote Aq Ar proxyip:proxyport +.Ed +.Pp +At this point, the server proxies traffic back and forth between +.Nm +and the ordinary GDB client, speaking the ordinary GDB remote protocol. +The +.Nm +session is identical to any other kernel GDB sesssion from the perspective +of the GDB debugger. +.Sh IMPLEMENTATION NOTES +The UDP protocol is based on the same packet structure and a subset of the +exact same message types as +.Xr netdump 4 . +It uses the +.Dv HERALD , +.Dv DATA ( née VMCORE ) , +and +.Dv FINISHED +message types. +Like +.Xr netdump 4 , +the client's initial +.Dv HERALD +message is acknowledged from a random source port, and the client sends +subsequent communication to that port. +.Pp +Unlike +.Xr netdump 4 , +the initial +.Dv HERALD +port is 20025. +Additionally, +the proxy server sends responses to the source port of the client's initial +.Dv HERALD , +rather than a separate reserved port. +.Nm +message and acknowledgements are bidirectional. +The sequence number and acknowledgement protocol is otherwise identical to +the unidirectional version used by netdump; it just runs in both directions. +Acknowledgements are sent to and from the same addresses and ports as +regular messages. +.Pp +The first version of the +.Nm +protocol uses the protocol number +.Dv Sq 0x2515f095 +in the 32-bit +.Va aux2 +parameter of the initial +.Dv HERALD +message. +.Pp +The list of supported network drivers and protocol families is identical to +that of +.Xr netdump 4 . +.Sh DIAGNOSTICS +The following variable is available via both +.Xr sysctl 8 +and +.Xr loader 8 +(as a tunable): +.Bl -tag -width "indent" +.It Va debug.gdb.netgdb.debug +Control debug message verbosity. +Debug messages are disabled by default. +They may be enabled by setting the variable to a non-zero value. +.El +.Sh SEE ALSO +.Xr ddb 4 , +.Xr gdb 4 , +.Xr netdump 4 +.Sh HISTORY +.Nm +first appeared in +.Fx 13.0 . +.Sh BUGS +.Nm +may only be used after the kernel has panicked, due to limitations in the +treatment of locking primitives under +.Xr ddb 4 . +.Sh SECURITY CONSIDERATIONS +Version 1 of the +.Nm +protocol has no security properties whatsoever. +All messages are sent and acknowledged in cleartext, and no message +authentication codes are used to prevent attackers from forging messages. +It is absolutely inappropriate for use across the public internet. Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Thu Oct 17 21:25:50 2019 (r353699) +++ head/sys/amd64/conf/GENERIC Thu Oct 17 21:33:01 2019 (r353700) @@ -113,6 +113,7 @@ options GZIO # gzip-compressed kernel and user dump options ZSTDIO # zstd-compressed kernel and user dumps options DEBUGNET # debugnet networking options NETDUMP # netdump(4) client support +options NETGDB # netgdb(4) client support # Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Thu Oct 17 21:25:50 2019 (r353699) +++ head/sys/conf/NOTES Thu Oct 17 21:33:01 2019 (r353700) @@ -1038,13 +1038,17 @@ options TCP_SIGNATURE #include support for RFC 2385 # a smooth scheduling of the traffic. options DUMMYNET +# The DEBUGNET option enables a basic debug/panic-time networking API. It +# is used by NETDUMP and NETGDB. +options DEBUGNET + # The NETDUMP option enables netdump(4) client support in the kernel. # This allows a panicking kernel to transmit a kernel dump to a remote host. options NETDUMP -# The DEBUGNET option enables a basic debug/panic-time networking API. It -# is used by NETDUMP. -options DEBUGNET +# The NETGDB option enables netgdb(4) support in the kernel. This allows a +# panicking kernel to be debugged as a GDB remote over the network. +options NETGDB ##################################################################### # FILESYSTEM OPTIONS Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Oct 17 21:25:50 2019 (r353699) +++ head/sys/conf/files Thu Oct 17 21:33:01 2019 (r353700) @@ -3546,6 +3546,7 @@ fs/tmpfs/tmpfs_subr.c optional tmpfs gdb/gdb_cons.c optional gdb gdb/gdb_main.c optional gdb gdb/gdb_packet.c optional gdb +gdb/netgdb.c optional ddb debugnet gdb netgdb inet geom/bde/g_bde.c optional geom_bde geom/bde/g_bde_crypt.c optional geom_bde geom/bde/g_bde_lock.c optional geom_bde Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Thu Oct 17 21:25:50 2019 (r353699) +++ head/sys/conf/options Thu Oct 17 21:33:01 2019 (r353700) @@ -319,10 +319,12 @@ NFS_ROOT opt_nfsroot.h # SMB/CIFS requester NETSMB opt_netsmb.h -# Enable netdump(4) client support. -NETDUMP opt_global.h # Enable debugnet(4) networking support. DEBUGNET opt_global.h +# Enable netdump(4) client support. +NETDUMP opt_global.h +# Enable netgdb(4) support. +NETGDB opt_global.h # Options used only in subr_param.c. HZ opt_param.h Modified: head/sys/gdb/gdb.h ============================================================================== --- head/sys/gdb/gdb.h Thu Oct 17 21:25:50 2019 (r353699) +++ head/sys/gdb/gdb.h Thu Oct 17 21:33:01 2019 (r353700) @@ -46,7 +46,15 @@ struct gdb_dbgport { gdb_putc_f *gdb_putc; gdb_term_f *gdb_term; int gdb_active; + void (*gdb_sendpacket)(const void *, size_t); + int gdb_dbfeatures; }; + +#define GDB_DBGP_FEAT_WANTTERM 0x1 /* Want gdb_term() invocation when + leaving GDB. gdb_term has been + deadcode and never invoked for so + long I don't want to just blindly + start invoking it without opt-in. */ #define GDB_DBGPORT(name, probe, init, term, getc, putc) \ static struct gdb_dbgport name##_gdb_dbgport = { \ Modified: head/sys/gdb/gdb_int.h ============================================================================== --- head/sys/gdb/gdb_int.h Thu Oct 17 21:25:50 2019 (r353699) +++ head/sys/gdb/gdb_int.h Thu Oct 17 21:33:01 2019 (r353700) @@ -31,8 +31,14 @@ #ifndef _GDB_GDB_INT_H_ #define _GDB_GDB_INT_H_ +#include "opt_ddb.h" + #include +#ifdef DDB +#include +#endif + #ifndef EOF #define EOF (-1) #endif @@ -47,6 +53,11 @@ void gdb_consinit(void); extern char *gdb_rxp; extern size_t gdb_rxsz; extern char *gdb_txp; + +#ifdef DDB +/* If set, return to DDB when controlling GDB detaches. */ +extern bool gdb_return_to_ddb; +#endif int gdb_rx_begin(void); int gdb_rx_equal(const char *); Modified: head/sys/gdb/gdb_main.c ============================================================================== --- head/sys/gdb/gdb_main.c Thu Oct 17 21:25:50 2019 (r353699) +++ head/sys/gdb/gdb_main.c Thu Oct 17 21:33:01 2019 (r353700) @@ -60,6 +60,10 @@ int gdb_listening = 0; static unsigned char gdb_bindata[64]; +#ifdef DDB +bool gdb_return_to_ddb = false; +#endif + static int gdb_init(void) { @@ -569,6 +573,26 @@ unrecognized: return; } +static void +gdb_handle_detach(void) +{ + kdb_cpu_clear_singlestep(); + gdb_listening = 0; + + if (gdb_cur->gdb_dbfeatures & GDB_DBGP_FEAT_WANTTERM) + gdb_cur->gdb_term(); + +#ifdef DDB + if (!gdb_return_to_ddb) + return; + + gdb_return_to_ddb = false; + + if (kdb_dbbe_select("ddb") != 0) + printf("The ddb backend could not be selected.\n"); +#endif +} + static int gdb_trap(int type, int code) { @@ -638,7 +662,7 @@ gdb_trap(int type, int code) } case 'D': { /* Detach */ gdb_tx_ok(); - kdb_cpu_clear_singlestep(); + gdb_handle_detach(); return (1); } case 'g': { /* Read registers. */ @@ -675,8 +699,7 @@ gdb_trap(int type, int code) break; } case 'k': /* Kill request. */ - kdb_cpu_clear_singlestep(); - gdb_listening = 1; + gdb_handle_detach(); return (1); case 'm': { /* Read memory. */ uintmax_t addr, size; Modified: head/sys/gdb/gdb_packet.c ============================================================================== --- head/sys/gdb/gdb_packet.c Thu Oct 17 21:25:50 2019 (r353699) +++ head/sys/gdb/gdb_packet.c Thu Oct 17 21:33:01 2019 (r353700) @@ -45,7 +45,27 @@ __FBSDID("$FreeBSD$"); static char gdb_rxbuf[GDB_BUFSZ]; char *gdb_rxp = NULL; size_t gdb_rxsz = 0; -static char gdb_txbuf[GDB_BUFSZ]; + +/* + * The goal here is to allow in-place framing without making the math around + * 'gdb_txbuf' more complicated. A generous reading of union special rule for + * "common initial sequence" suggests this may be valid in standard C99 and + * later. + */ +static union { + struct _midbuf { + char mb_pad1; + char mb_buf[GDB_BUFSZ]; + char mb_pad2[4]; + } __packed txu_midbuf; + /* sizeof includes trailing nul byte and this is intentional. */ + char txu_fullbuf[GDB_BUFSZ + sizeof("$#..")]; +} gdb_tx_u; +#define gdb_txbuf gdb_tx_u.txu_midbuf.mb_buf +#define gdb_tx_fullbuf gdb_tx_u.txu_fullbuf +_Static_assert(sizeof(gdb_tx_u.txu_midbuf) == sizeof(gdb_tx_u.txu_fullbuf) && + offsetof(struct _midbuf, mb_buf) == 1, + "assertions necessary for correctness"); char *gdb_txp = NULL; /* Used in inline functions. */ #define C2N(c) (((c) < 'A') ? (c) - '0' : \ @@ -68,6 +88,9 @@ gdb_getc(void) if (c == CTRL('C')) { printf("Received ^C; trying to switch back to ddb.\n"); + if (gdb_cur->gdb_dbfeatures & GDB_DBGP_FEAT_WANTTERM) + gdb_cur->gdb_term(); + if (kdb_dbbe_select("ddb") != 0) printf("The ddb backend could not be selected.\n"); else { @@ -218,6 +241,29 @@ gdb_tx_begin(char tp) gdb_tx_char(tp); } +/* + * Take raw packet buffer and perform typical GDB packet framing, but not run- + * length encoding, before forwarding to driver ::gdb_sendpacket() routine. + */ +static void +gdb_tx_sendpacket(void) +{ + size_t msglen, i; + unsigned char csum; + + msglen = gdb_txp - gdb_txbuf; + + /* Add GDB packet framing */ + gdb_tx_fullbuf[0] = '$'; + + csum = 0; + for (i = 0; i < msglen; i++) + csum += (unsigned char)gdb_txbuf[i]; + snprintf(&gdb_tx_fullbuf[1 + msglen], 4, "#%02x", (unsigned)csum); + + gdb_cur->gdb_sendpacket(gdb_tx_fullbuf, msglen + 4); +} + int gdb_tx_end(void) { @@ -226,6 +272,11 @@ gdb_tx_end(void) unsigned char c, cksum; do { + if (gdb_cur->gdb_sendpacket != NULL) { + gdb_tx_sendpacket(); + goto getack; + } + gdb_cur->gdb_putc('$'); cksum = 0; @@ -284,6 +335,7 @@ gdb_tx_end(void) c = cksum & 0x0f; gdb_cur->gdb_putc(N2C(c)); +getack: c = gdb_getc(); } while (c != '+'); Added: head/sys/gdb/netgdb.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/gdb/netgdb.c Thu Oct 17 21:33:01 2019 (r353700) @@ -0,0 +1,406 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Isilon Systems, LLC. + * + * 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. + */ + +/* + * netgdb.c + * FreeBSD subsystem supporting debugging the FreeBSD kernel over the network. + * + * There are three pieces necessary to use NetGDB. + * + * First, a dedicated proxy server must be running to accept connections from + * both NetGDB and gdb(1), and pass bidirectional traffic between the two + * protocols. + * + * Second, The NetGDB client is activated much like ordinary 'gdb' and + * similarly to 'netdump' in ddb(4). Like other debugnet(4) clients + * (netdump(4)), the network interface on the route to the proxy server must be + * online and support debugnet(4). + * + * Finally, the remote (k)gdb(1) uses 'target remote :' to connect + * to the proxy server. + * + * NetGDBv1 speaks the literal GDB remote serial protocol, and uses a 1:1 + * relationship between GDB packets and plain debugnet packets. There is no + * encryption utilized to keep debugging sessions private, so this is only + * appropriate for local segments or trusted networks. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_ddb.h" +#ifndef DDB +#error "NetGDB cannot be used without DDB at this time" +#endif + +#include +#include +#include +#include +#include +#include + +#include + +#ifdef DDB +#include +#include +#include +#endif + +#include +#include +#include +#include + +#include +#include +#include + +FEATURE(netgdb, "NetGDB support"); +SYSCTL_NODE(_debug_gdb, OID_AUTO, netgdb, CTLFLAG_RD, NULL, + "NetGDB parameters"); + +static unsigned netgdb_debug; +SYSCTL_UINT(_debug_gdb_netgdb, OID_AUTO, debug, CTLFLAG_RWTUN, + &netgdb_debug, 0, + "Debug message verbosity (0: off; 1: on)"); + +#define NETGDB_DEBUG(f, ...) do { \ + if (netgdb_debug > 0) \ + printf(("%s [%s:%d]: " f), __func__, __FILE__, __LINE__, ## \ + __VA_ARGS__); \ +} while (false) + +static void netgdb_fini(void); + +/* Runtime state. */ +static char netgdb_rxbuf[GDB_BUFSZ + 16]; /* Some overhead for framing. */ +static struct sbuf netgdb_rxsb; +static ssize_t netgdb_rx_off; + +static struct debugnet_pcb *netgdb_conn; +static struct gdb_dbgport *netgdb_prev_dbgport; +static int *netgdb_prev_kdb_inactive; + +/* TODO(CEM) disable ack mode */ + +/* + * Receive non-TX ACK packets on the client port. + * + * The mbuf chain will have all non-debugnet framing headers removed + * (ethernet, inet, udp). It will start with a debugnet_msg_hdr, of + * which the header is guaranteed to be contiguous. If m_pullup is + * used, the supplied in-out mbuf pointer should be updated + * appropriately. + * + * If the handler frees the mbuf chain, it should set the mbuf pointer + * to NULL. Otherwise, the debugnet input framework will free the + * chain. + */ +static void +netgdb_rx(struct debugnet_pcb *pcb, struct mbuf **mb) +{ + const struct debugnet_msg_hdr *dnh; + struct mbuf *m; + uint32_t rlen, count; + int error; + + m = *mb; + dnh = mtod(m, const void *); + + if (ntohl(dnh->mh_type) == DEBUGNET_FINISHED) { + sbuf_putc(&netgdb_rxsb, CTRL('C')); + return; + } + + if (ntohl(dnh->mh_type) != DEBUGNET_DATA) { + printf("%s: Got unexpected debugnet message %u\n", + __func__, ntohl(dnh->mh_type)); + return; + } + + rlen = ntohl(dnh->mh_len); +#define _SBUF_FREESPACE(s) ((s)->s_size - ((s)->s_len + 1)) + if (_SBUF_FREESPACE(&netgdb_rxsb) < rlen) { + NETGDB_DEBUG("Backpressure: Not ACKing RX of packet that " + "would overflow our buffer (%zd/%zd used).\n", + netgdb_rxsb.s_len, netgdb_rxsb.s_size); + return; + } +#undef _SBUF_FREESPACE + + error = debugnet_ack_output(pcb, dnh->mh_seqno); + if (error != 0) { + printf("%s: Couldn't ACK rx packet %u; %d\n", __func__, + ntohl(dnh->mh_seqno), error); + /* + * Sender will re-xmit, and assuming the condition is + * transient, we'll process the packet's contentss later. + */ + return; + } + + m_adj(m, sizeof(*dnh)); + dnh = NULL; + + /* + * Inlined m_apply -- why isn't there a macro or inline function + * version? + */ + while (m != NULL && m->m_len == 0) + m = m->m_next; + while (rlen > 0) { + MPASS(m != NULL && m->m_len >= 0); + count = min((uint32_t)m->m_len, rlen); + (void)sbuf_bcat(&netgdb_rxsb, mtod(m, const void *), count); + rlen -= count; + m = m->m_next; + } +} + +/* + * The following routines implement a pseudo GDB debugport (an emulated serial + * driver that the MI gdb(4) code does I/O with). + */ + +static int +netgdb_dbg_getc(void) +{ + int c; + + while (true) { + /* Pull bytes off any currently cached packet first. */ + if (netgdb_rx_off < sbuf_len(&netgdb_rxsb)) { + c = netgdb_rxsb.s_buf[netgdb_rx_off]; + netgdb_rx_off++; + break; + } + + /* Reached EOF? Reuse buffer. */ + sbuf_clear(&netgdb_rxsb); + netgdb_rx_off = 0; + + /* Check for CTRL-C on console/serial, if any. */ + if (netgdb_prev_dbgport != NULL) { + c = netgdb_prev_dbgport->gdb_getc(); + if (c == CTRL('C')) + break; + } + + debugnet_network_poll(netgdb_conn); + } + + if (c == CTRL('C')) { + netgdb_fini(); + /* Caller gdb_getc() will print that we got ^C. */ + } + return (c); +} + +static void +netgdb_dbg_sendpacket(const void *buf, size_t len) +{ + struct debugnet_proto_aux aux; + int error; + + MPASS(len <= UINT32_MAX); + + /* + * GDB packet boundaries matter. debugnet_send() fragments a single + * request into many sequential debugnet messages. Mark full packet + * length and offset for potential reassembly by the proxy. + */ + aux = (struct debugnet_proto_aux) { + .dp_aux2 = len, + }; + + error = debugnet_send(netgdb_conn, DEBUGNET_DATA, buf, len, &aux); + if (error != 0) { + printf("%s: Network error: %d; trying to switch back to ddb.\n", + __func__, error); + netgdb_fini(); + + if (kdb_dbbe_select("ddb") != 0) + printf("The ddb backend could not be selected.\n"); + else { + printf("using longjmp, hope it works!\n"); + kdb_reenter(); + } + } + +} + +/* Just used for + / - GDB-level ACKs. */ +static void +netgdb_dbg_putc(int i) +{ + char c; + + c = i; + netgdb_dbg_sendpacket(&c, 1); + +} + +static struct gdb_dbgport netgdb_gdb_dbgport = { + .gdb_name = "netgdb", + .gdb_getc = netgdb_dbg_getc, + .gdb_putc = netgdb_dbg_putc, + .gdb_term = netgdb_fini, + .gdb_sendpacket = netgdb_dbg_sendpacket, + .gdb_dbfeatures = GDB_DBGP_FEAT_WANTTERM, +}; + +static void +netgdb_init(void) +{ + struct kdb_dbbe *be, **iter; + + /* + * Force enable GDB. (If no other debugports were registered at boot, + * KDB thinks it doesn't exist.) + */ + SET_FOREACH(iter, kdb_dbbe_set) { + be = *iter; + if (strcmp(be->dbbe_name, "gdb") != 0) + continue; + if (be->dbbe_active == -1) { + netgdb_prev_kdb_inactive = &be->dbbe_active; + be->dbbe_active = 0; + } + break; + } + + /* Force netgdb debugport. */ + netgdb_prev_dbgport = gdb_cur; + gdb_cur = &netgdb_gdb_dbgport; + + sbuf_new(&netgdb_rxsb, netgdb_rxbuf, sizeof(netgdb_rxbuf), + SBUF_FIXEDLEN); + netgdb_rx_off = 0; +} + +static void +netgdb_fini(void) +{ + + /* TODO: tear down conn gracefully? */ + if (netgdb_conn != NULL) { + debugnet_free(netgdb_conn); + netgdb_conn = NULL; + } + + sbuf_delete(&netgdb_rxsb); + + gdb_cur = netgdb_prev_dbgport; + + if (netgdb_prev_kdb_inactive != NULL) { + *netgdb_prev_kdb_inactive = -1; + netgdb_prev_kdb_inactive = NULL; + } +} + +#ifdef DDB +/* + * Usage: netgdb -s [-g -i ] + * + * Order is not significant. + * + * Currently, this command does not support configuring encryption or + * compression. + */ +DB_FUNC(netgdb, db_netgdb_cmd, db_cmd_table, CS_OWN, NULL) +{ + struct debugnet_ddb_config params; + struct debugnet_conn_params dcp; + struct debugnet_pcb *pcb; + int error; + + if (panicstr == NULL) { + /* TODO: This limitation should be removed in future work. */ + printf("%s: netgdb is currently limited to use only after a " + "panic. Sorry.\n", __func__); + return; + } + + error = debugnet_parse_ddb_cmd("netgdb", ¶ms); + if (error != 0) { + db_printf("Error configuring netgdb: %d\n", error); + return; + } + + /* + * Must initialize netgdb_rxsb before debugnet_connect(), because we + * might be getting rx handler callbacks from the send->poll path + * during debugnet_connect(). + */ + netgdb_init(); + + if (!params.dd_has_client) + params.dd_client = INADDR_ANY; + if (!params.dd_has_gateway) + params.dd_gateway = INADDR_ANY; + + dcp = (struct debugnet_conn_params) { + .dc_ifp = params.dd_ifp, + .dc_client = params.dd_client, + .dc_server = params.dd_server, + .dc_gateway = params.dd_gateway, + .dc_herald_port = NETGDB_HERALDPORT, + .dc_client_port = NETGDB_CLIENTPORT, + .dc_herald_aux2 = NETGDB_PROTO_V1, + .dc_rx_handler = netgdb_rx, + }; + + error = debugnet_connect(&dcp, &pcb); + if (error != 0) { + printf("failed to contact netgdb server: %d\n", error); + netgdb_fini(); + return; + } + + netgdb_conn = pcb; + + if (kdb_dbbe_select("gdb") != 0) { + db_printf("The remote GDB backend could not be selected.\n"); + netgdb_fini(); + return; + } + + /* + * Mark that we are done in ddb(4). Return -> kdb_trap() should + * re-enter with the new backend. + */ + db_cmd_loop_done = 1; + gdb_return_to_ddb = true; + db_printf("(detaching GDB will return control to DDB)\n"); +#if 0 + /* Aspirational, but does not work reliably. */ + db_printf("(ctrl-c will return control to ddb)\n"); +#endif +} +#endif /* DDB */ Added: head/sys/gdb/netgdb.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/gdb/netgdb.h Thu Oct 17 21:33:01 2019 (r353700) @@ -0,0 +1,44 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Isilon Systems, LLC. + * + * 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 + +/* + * Protocol information, for use by the userspace proxy server. + * + * It might make sense to allow not hardcoding these parameters as future work + * (e.g., for use in environments with arbitrary port filtering). + * + * The herald port is only used for initial handshake. The proxy server will + * choose a different remote port to connect back to the NetGDB client on by + * sending the HERALD ACK from that other port. + */ +#define NETGDB_HERALDPORT 20025 +#define NETGDB_CLIENTPORT 20026 + +#define NETGDB_PROTO_V1 0x2515f095 /* Rolled a 2^32 sided die. */ Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Thu Oct 17 21:25:50 2019 (r353699) +++ head/sys/i386/conf/GENERIC Thu Oct 17 21:33:01 2019 (r353700) @@ -101,6 +101,7 @@ options GZIO # gzip-compressed kernel and user dump options ZSTDIO # zstd-compressed kernel and user dumps options DEBUGNET # debugnet networking options NETDUMP # netdump(4) client support +options NETGDB # netgdb(4) client support # To make an SMP kernel, the next two lines are needed options SMP # Symmetric MultiProcessor Kernel Modified: head/sys/kern/subr_kdb.c ============================================================================== --- head/sys/kern/subr_kdb.c Thu Oct 17 21:25:50 2019 (r353699) +++ head/sys/kern/subr_kdb.c Thu Oct 17 21:33:01 2019 (r353700) @@ -77,7 +77,6 @@ static int kdb_break_to_debugger = KDB_BREAK_TO_DEBUGG static int kdb_alt_break_to_debugger = KDB_ALT_BREAK_TO_DEBUGGER; KDB_BACKEND(null, NULL, NULL, NULL, NULL); -SET_DECLARE(kdb_dbbe_set, struct kdb_dbbe); static int kdb_sysctl_available(SYSCTL_HANDLER_ARGS); static int kdb_sysctl_current(SYSCTL_HANDLER_ARGS); Modified: head/sys/net/debugnet.c ============================================================================== --- head/sys/net/debugnet.c Thu Oct 17 21:25:50 2019 (r353699) +++ head/sys/net/debugnet.c Thu Oct 17 21:33:01 2019 (r353700) @@ -183,7 +183,7 @@ debugnet_udp_output(struct debugnet_pcb *pcb, struct m return (debugnet_ip_output(pcb, m)); } -static int +int debugnet_ack_output(struct debugnet_pcb *pcb, uint32_t seqno /* net endian */) { struct debugnet_ack *dn_ack; @@ -330,7 +330,7 @@ retransmit: printf(". "); goto retransmit; } - debugnet_network_poll(pcb->dp_ifp); + debugnet_network_poll(pcb); DELAY(500); if (pcb->dp_state == DN_STATE_REMOTE_CLOSED) return (ECONNRESET); @@ -577,8 +577,11 @@ done: * driver directly for packets. */ void -debugnet_network_poll(struct ifnet *ifp) +debugnet_network_poll(struct debugnet_pcb *pcb) { + struct ifnet *ifp; + + ifp = pcb->dp_ifp; ifp->if_debugnet_methods->dn_poll(ifp, 1000); } @@ -610,6 +613,7 @@ int debugnet_connect(const struct debugnet_conn_params *dcp, struct debugnet_pcb **pcb_out) { + struct debugnet_proto_aux herald_auxdata; struct debugnet_pcb *pcb; struct ifnet *ifp; int error; @@ -738,8 +742,12 @@ debugnet_connect(const struct debugnet_conn_params *dc } MPASS(pcb->dp_state == DN_STATE_HAVE_GW_MAC); + herald_auxdata = (struct debugnet_proto_aux) { + .dp_offset_start = dcp->dc_herald_offset, + .dp_aux2 = dcp->dc_herald_aux2, + }; error = debugnet_send(pcb, DEBUGNET_HERALD, dcp->dc_herald_data, - dcp->dc_herald_datalen, NULL); + dcp->dc_herald_datalen, &herald_auxdata); if (error != 0) { printf("%s: failed to herald debugnet server\n", __func__); goto cleanup; Modified: head/sys/net/debugnet.h ============================================================================== --- head/sys/net/debugnet.h Thu Oct 17 21:25:50 2019 (r353699) +++ head/sys/net/debugnet.h Thu Oct 17 21:33:01 2019 (r353700) @@ -108,6 +108,14 @@ struct debugnet_conn_params { uint32_t dc_herald_datalen; /* + * Consistent with debugnet_send(), aux paramaters to debugnet + * functions are provided host-endian (but converted to + * network endian on the wire). + */ + uint32_t dc_herald_aux2; + uint64_t dc_herald_offset; + + /* * If NULL, debugnet is a unidirectional channel from panic machine to * remote server (like netdump). * @@ -123,12 +131,14 @@ struct debugnet_conn_params { * If the handler frees the mbuf chain, it should set the mbuf pointer * to NULL. Otherwise, the debugnet input framework will free the * chain. + * + * The handler should ACK receieved packets with debugnet_ack_output. */ void (*dc_rx_handler)(struct debugnet_pcb *, struct mbuf **); }; /* - * Open a unidirectional stream to the specified server's herald port. + * Open a stream to the specified server's herald port. * * If all goes well, the server will send ACK from a different port to our ack * port. This allows servers to somewhat gracefully handle multiple debugnet @@ -176,6 +186,16 @@ debugnet_sendempty(struct debugnet_pcb *pcb, uint32_t *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Oct 17 21:39:24 2019 Return-Path: Delivered-To: svn-src-all@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 A0EE715E59A; Thu, 17 Oct 2019 21:39:24 +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 46vMxm3ltpz3HDQ; Thu, 17 Oct 2019 21:39:24 +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 64CC326B9E; Thu, 17 Oct 2019 21:39:24 +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 x9HLdOw9071415; Thu, 17 Oct 2019 21:39:24 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HLdOGl071414; Thu, 17 Oct 2019 21:39:24 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910172139.x9HLdOGl071414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 17 Oct 2019 21:39:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353701 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 353701 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 21:39:24 -0000 Author: markj Date: Thu Oct 17 21:39:23 2019 New Revision: 353701 URL: https://svnweb.freebsd.org/changeset/base/353701 Log: Add an ldscript for amd64 kernel modules. Use it to pad the text and read-only data sections to a 4KB boundary. This will be used to enforce strict memory protections for some sections of loadable kernel modules. Reviewed by: kib MFC after: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21970 Added: head/sys/conf/ldscript.kmod.amd64 (contents, props changed) Added: head/sys/conf/ldscript.kmod.amd64 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/conf/ldscript.kmod.amd64 Thu Oct 17 21:39:23 2019 (r353701) @@ -0,0 +1,48 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 Mark Johnston + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + + /* + * Coalesce executable and read-only sections, and pad to page alignment so + * that memory protections can be strictly enforced. + */ + +SECTIONS +{ + .text : + { + *(.text .text.*) + . = ALIGN(CONSTANT(COMMONPAGESIZE)); + } + + .rodata : + { + *(.rodata .rodata.*) + . = ALIGN(CONSTANT(COMMONPAGESIZE)); + } +} From owner-svn-src-all@freebsd.org Thu Oct 17 22:37:27 2019 Return-Path: Delivered-To: svn-src-all@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 59E5515F3BA; Thu, 17 Oct 2019 22:37:27 +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 46vPDl1fp8z3Kgy; Thu, 17 Oct 2019 22:37:27 +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 15FEF27675; Thu, 17 Oct 2019 22:37:27 +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 x9HMbQaT006497; Thu, 17 Oct 2019 22:37:26 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HMbQ0a006493; Thu, 17 Oct 2019 22:37:26 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910172237.x9HMbQ0a006493@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 17 Oct 2019 22:37:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353702 - head/sys/gdb X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/gdb X-SVN-Commit-Revision: 353702 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 22:37:27 -0000 Author: cem Date: Thu Oct 17 22:37:25 2019 New Revision: 353702 URL: https://svnweb.freebsd.org/changeset/base/353702 Log: gdb(4): Implement support for NoAckMode When the underlying debugport transport is reliable, GDB's additional checksums and acknowledgements are redundant. NoAckMode eliminates the the acks and allows us to skip checking RX checksums. The GDB packet framing does not change, so unfortunately (valid) checksums are still included as message trailers. The gdb(4) stub in FreeBSD advertises support for the feature in response to the client's 'qSupported' request IFF the current debugport has the gdb_dbfeatures flag GDB_DBGP_FEAT_RELIABLE set. Currently, only netgdb(4) supports this feature. If the remote GDB client supports the feature and does not have it disabled via a GDB configuration knob, it may instruct our gdb(4) stub to enter NoAckMode. Unless and until it issues that command, we must continue to transmit acks as usual (and for now, we continue to wait until we receive them as well, even if we know the debugport is on a reliable transport). In the kernel sources, the sense of the flag representing the state of the feature is reversed from that of the GDB command. (I.e., it is 'gdb_ackmode', not 'gdb_noackmode.') This is to avoid confusing double- negative conditions. For reference, see: * https://sourceware.org/gdb/onlinedocs/gdb/Packet-Acknowledgment.html * https://sourceware.org/gdb/onlinedocs/gdb/General-Query-Packets.html#QStartNoAckMode Reviewed by: jhb, markj (both earlier version) Differential Revision: https://reviews.freebsd.org/D21761 Modified: head/sys/gdb/gdb.h head/sys/gdb/gdb_int.h head/sys/gdb/gdb_main.c head/sys/gdb/gdb_packet.c head/sys/gdb/netgdb.c Modified: head/sys/gdb/gdb.h ============================================================================== --- head/sys/gdb/gdb.h Thu Oct 17 21:39:23 2019 (r353701) +++ head/sys/gdb/gdb.h Thu Oct 17 22:37:25 2019 (r353702) @@ -55,6 +55,9 @@ struct gdb_dbgport { deadcode and never invoked for so long I don't want to just blindly start invoking it without opt-in. */ +#define GDB_DBGP_FEAT_RELIABLE 0x2 /* The debugport promises it is a + reliable transport, which allows GDB + acks to be turned off. */ #define GDB_DBGPORT(name, probe, init, term, getc, putc) \ static struct gdb_dbgport name##_gdb_dbgport = { \ Modified: head/sys/gdb/gdb_int.h ============================================================================== --- head/sys/gdb/gdb_int.h Thu Oct 17 21:39:23 2019 (r353701) +++ head/sys/gdb/gdb_int.h Thu Oct 17 22:37:25 2019 (r353702) @@ -54,6 +54,8 @@ extern char *gdb_rxp; extern size_t gdb_rxsz; extern char *gdb_txp; +extern bool gdb_ackmode; + #ifdef DDB /* If set, return to DDB when controlling GDB detaches. */ extern bool gdb_return_to_ddb; @@ -132,6 +134,20 @@ static __inline void gdb_tx_varhex(uintmax_t n) { gdb_txp += sprintf(gdb_txp, "%jx", n); +} + +static __inline void +gdb_nack(void) +{ + if (gdb_ackmode) + gdb_cur->gdb_putc('-'); +} + +static __inline void +gdb_ack(void) +{ + if (gdb_ackmode) + gdb_cur->gdb_putc('+'); } #endif /* !_GDB_GDB_INT_H_ */ Modified: head/sys/gdb/gdb_main.c ============================================================================== --- head/sys/gdb/gdb_main.c Thu Oct 17 21:39:23 2019 (r353701) +++ head/sys/gdb/gdb_main.c Thu Oct 17 22:37:25 2019 (r353702) @@ -57,6 +57,7 @@ SET_DECLARE(gdb_dbgport_set, struct gdb_dbgport); struct gdb_dbgport *gdb_cur = NULL; int gdb_listening = 0; +bool gdb_ackmode = true; static unsigned char gdb_bindata[64]; @@ -262,6 +263,14 @@ gdb_do_qsupported(uint32_t *feat) gdb_tx_str(";qXfer:threads:read+"); /* + * If the debugport is a reliable transport, request No Ack mode from + * the server. The server may or may not choose to enter No Ack mode. + * https://sourceware.org/gdb/onlinedocs/gdb/Packet-Acknowledgment.html + */ + if (gdb_cur->gdb_dbfeatures & GDB_DBGP_FEAT_RELIABLE) + gdb_tx_str(";QStartNoAckMode+"); + + /* * Future consideration: * - vCont * - multiprocess @@ -610,6 +619,8 @@ gdb_trap(int type, int code) } gdb_listening = 0; + gdb_ackmode = true; + /* * Send a T packet. We currently do not support watchpoints (the * awatch, rwatch or watch elements). @@ -759,6 +770,22 @@ gdb_trap(int type, int code) } else if (gdb_rx_equal("Search:memory:")) { gdb_do_mem_search(); } else if (!gdb_cpu_query()) + gdb_tx_empty(); + break; + case 'Q': + if (gdb_rx_equal("StartNoAckMode")) { + if ((gdb_cur->gdb_dbfeatures & + GDB_DBGP_FEAT_RELIABLE) == 0) { + /* + * Shouldn't happen if we didn't + * advertise support. Reject. + */ + gdb_tx_empty(); + break; + } + gdb_ackmode = false; + gdb_tx_ok(); + } else gdb_tx_empty(); break; case 's': { /* Step. */ Modified: head/sys/gdb/gdb_packet.c ============================================================================== --- head/sys/gdb/gdb_packet.c Thu Oct 17 21:39:23 2019 (r353701) +++ head/sys/gdb/gdb_packet.c Thu Oct 17 22:37:25 2019 (r353702) @@ -134,18 +134,28 @@ gdb_rx_begin(void) /* Bail out on a buffer overflow. */ if (c != '#') { - gdb_cur->gdb_putc('-'); + gdb_nack(); return (ENOSPC); } + /* + * In Not-AckMode, we can assume reliable transport and neither + * need to verify checksums nor send Ack/Nack. + */ + if (!gdb_ackmode) + break; + c = gdb_getc(); cksum -= (C2N(c) << 4) & 0xf0; c = gdb_getc(); cksum -= C2N(c) & 0x0f; - gdb_cur->gdb_putc((cksum == 0) ? '+' : '-'); - if (cksum != 0) + if (cksum == 0) { + gdb_ack(); + } else { + gdb_nack(); printf("GDB: packet `%s' has invalid checksum\n", gdb_rxbuf); + } } while (cksum != 0); gdb_rxp = gdb_rxbuf; @@ -336,6 +346,14 @@ gdb_tx_end(void) gdb_cur->gdb_putc(N2C(c)); getack: + /* + * In NoAckMode, it is assumed that the underlying transport is + * reliable and thus neither conservant sends acknowledgements; + * there is nothing to wait for here. + */ + if (!gdb_ackmode) + break; + c = gdb_getc(); } while (c != '+'); Modified: head/sys/gdb/netgdb.c ============================================================================== --- head/sys/gdb/netgdb.c Thu Oct 17 21:39:23 2019 (r353701) +++ head/sys/gdb/netgdb.c Thu Oct 17 22:37:25 2019 (r353702) @@ -272,7 +272,7 @@ static struct gdb_dbgport netgdb_gdb_dbgport = { .gdb_putc = netgdb_dbg_putc, .gdb_term = netgdb_fini, .gdb_sendpacket = netgdb_dbg_sendpacket, - .gdb_dbfeatures = GDB_DBGP_FEAT_WANTTERM, + .gdb_dbfeatures = GDB_DBGP_FEAT_WANTTERM | GDB_DBGP_FEAT_RELIABLE, }; static void From owner-svn-src-all@freebsd.org Thu Oct 17 23:17:58 2019 Return-Path: Delivered-To: svn-src-all@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 27EA015FD84; Thu, 17 Oct 2019 23:17:58 +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 46vQ7T703gz3MBM; Thu, 17 Oct 2019 23:17:57 +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 CEE9527D7D; Thu, 17 Oct 2019 23:17:57 +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 x9HNHvqe029799; Thu, 17 Oct 2019 23:17:57 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HNHvUo029796; Thu, 17 Oct 2019 23:17:57 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910172317.x9HNHvUo029796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 17 Oct 2019 23:17:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353703 - stable/12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/usr.sbin/bhyve X-SVN-Commit-Revision: 353703 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 23:17:58 -0000 Author: jhb Date: Thu Oct 17 23:17:56 2019 New Revision: 353703 URL: https://svnweb.freebsd.org/changeset/base/353703 Log: MFC 348212,348712: Add support for writing to guest memory in the debug server. 348212: Add support for writing to guest memory in the debug server. - Add a write_mem counterpart to read_mem to handle writes to MMIO. - Add support for the GDB 'M' packet to write bytes to the guest's memory. For MMIO writes, attempt to batch writes up into words. This is imprecise, but if you write a single 2 or 4-byte aligned word, it should be treated as a single MMIO write operation. - While here, tidy up the parsing of the 'm' command used for reading memory to match 'M'. 348712: Use parse_integer to avoid sign extension. Coverity warned about gdb_write_mem sign extending the result of parse_byte shifted left by 24 bits when generating a 32-bit memory write value for MMIO. Simplify the code by using parse_integer instead of unrolled parse_byte calls. Modified: stable/12/usr.sbin/bhyve/gdb.c stable/12/usr.sbin/bhyve/mem.c stable/12/usr.sbin/bhyve/mem.h Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/gdb.c ============================================================================== --- stable/12/usr.sbin/bhyve/gdb.c Thu Oct 17 22:37:25 2019 (r353702) +++ stable/12/usr.sbin/bhyve/gdb.c Thu Oct 17 23:17:56 2019 (r353703) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #ifndef WITHOUT_CAPSICUM #include #endif +#include #include #include #include @@ -768,15 +769,24 @@ gdb_read_mem(const uint8_t *data, size_t len) bool started; int error; + /* Skip 'm' */ + data += 1; + len -= 1; + + /* Parse and consume address. */ cp = memchr(data, ',', len); - if (cp == NULL) { + if (cp == NULL || cp == data) { send_error(EINVAL); return; } - gva = parse_integer(data + 1, cp - (data + 1)); - resid = parse_integer(cp + 1, len - (cp + 1 - data)); - started = false; + gva = parse_integer(data, cp - data); + len -= (cp - data) + 1; + data += (cp - data) + 1; + /* Parse length. */ + resid = parse_integer(data, len); + + started = false; while (resid > 0) { error = guest_vaddr2paddr(cur_vcpu, gva, &gpa); if (error == -1) { @@ -862,6 +872,115 @@ gdb_read_mem(const uint8_t *data, size_t len) finish_packet(); } +static void +gdb_write_mem(const uint8_t *data, size_t len) +{ + uint64_t gpa, gva, val; + uint8_t *cp; + size_t resid, todo, bytes; + int error; + + /* Skip 'M' */ + data += 1; + len -= 1; + + /* Parse and consume address. */ + cp = memchr(data, ',', len); + if (cp == NULL || cp == data) { + send_error(EINVAL); + return; + } + gva = parse_integer(data, cp - data); + len -= (cp - data) + 1; + data += (cp - data) + 1; + + /* Parse and consume length. */ + cp = memchr(data, ':', len); + if (cp == NULL || cp == data) { + send_error(EINVAL); + return; + } + resid = parse_integer(data, cp - data); + len -= (cp - data) + 1; + data += (cp - data) + 1; + + /* Verify the available bytes match the length. */ + if (len != resid * 2) { + send_error(EINVAL); + return; + } + + while (resid > 0) { + error = guest_vaddr2paddr(cur_vcpu, gva, &gpa); + if (error == -1) { + send_error(errno); + return; + } + if (error == 0) { + send_error(EFAULT); + return; + } + + /* Write bytes to current page. */ + todo = getpagesize() - gpa % getpagesize(); + if (todo > resid) + todo = resid; + + cp = paddr_guest2host(ctx, gpa, todo); + if (cp != NULL) { + /* + * If this page is guest RAM, write it a byte + * at a time. + */ + while (todo > 0) { + assert(len >= 2); + *cp = parse_byte(data); + data += 2; + len -= 2; + cp++; + gpa++; + gva++; + resid--; + todo--; + } + } else { + /* + * If this page isn't guest RAM, try to handle + * it via MMIO. For MMIO requests, use + * aligned writes of words when possible. + */ + while (todo > 0) { + if (gpa & 1 || todo == 1) { + bytes = 1; + val = parse_byte(data); + } else if (gpa & 2 || todo == 2) { + bytes = 2; + val = be16toh(parse_integer(data, 4)); + } else { + bytes = 4; + val = be32toh(parse_integer(data, 8)); + } + error = write_mem(ctx, cur_vcpu, gpa, val, + bytes); + if (error == 0) { + gpa += bytes; + gva += bytes; + resid -= bytes; + todo -= bytes; + data += 2 * bytes; + len -= 2 * bytes; + } else { + send_error(EFAULT); + return; + } + } + } + assert(resid == 0 || gpa % getpagesize() == 0); + } + assert(len == 0); + send_ok(); +} + static bool command_equals(const uint8_t *data, size_t len, const char *cmd) { @@ -1001,6 +1120,9 @@ handle_command(const uint8_t *data, size_t len) case 'm': gdb_read_mem(data, len); break; + case 'M': + gdb_write_mem(data, len); + break; case 'T': { int tid; @@ -1036,7 +1158,6 @@ handle_command(const uint8_t *data, size_t len) finish_packet(); break; case 'G': /* TODO */ - case 'M': /* TODO */ case 'v': /* Handle 'vCont' */ /* 'vCtrlC' */ Modified: stable/12/usr.sbin/bhyve/mem.c ============================================================================== --- stable/12/usr.sbin/bhyve/mem.c Thu Oct 17 22:37:25 2019 (r353702) +++ stable/12/usr.sbin/bhyve/mem.c Thu Oct 17 23:17:56 2019 (r353703) @@ -251,30 +251,43 @@ emulate_mem(struct vmctx *ctx, int vcpu, uint64_t padd return (access_memory(ctx, vcpu, paddr, emulate_mem_cb, &ema)); } -struct read_mem_args { - uint64_t *rval; +struct rw_mem_args { + uint64_t *val; int size; + int operation; }; static int -read_mem_cb(struct vmctx *ctx, int vcpu, uint64_t paddr, struct mem_range *mr, +rw_mem_cb(struct vmctx *ctx, int vcpu, uint64_t paddr, struct mem_range *mr, void *arg) { - struct read_mem_args *rma; + struct rw_mem_args *rma; rma = arg; - return (mr->handler(ctx, vcpu, MEM_F_READ, paddr, rma->size, - rma->rval, mr->arg1, mr->arg2)); + return (mr->handler(ctx, vcpu, rma->operation, paddr, rma->size, + rma->val, mr->arg1, mr->arg2)); } int read_mem(struct vmctx *ctx, int vcpu, uint64_t gpa, uint64_t *rval, int size) { - struct read_mem_args rma; + struct rw_mem_args rma; - rma.rval = rval; + rma.val = rval; rma.size = size; - return (access_memory(ctx, vcpu, gpa, read_mem_cb, &rma)); + rma.operation = MEM_F_READ; + return (access_memory(ctx, vcpu, gpa, rw_mem_cb, &rma)); +} + +int +write_mem(struct vmctx *ctx, int vcpu, uint64_t gpa, uint64_t wval, int size) +{ + struct rw_mem_args rma; + + rma.val = &wval; + rma.size = size; + rma.operation = MEM_F_WRITE; + return (access_memory(ctx, vcpu, gpa, rw_mem_cb, &rma)); } static int Modified: stable/12/usr.sbin/bhyve/mem.h ============================================================================== --- stable/12/usr.sbin/bhyve/mem.h Thu Oct 17 22:37:25 2019 (r353702) +++ stable/12/usr.sbin/bhyve/mem.h Thu Oct 17 23:17:56 2019 (r353703) @@ -61,5 +61,7 @@ int read_mem(struct vmctx *ctx, int vcpu, uint64_t gpa int register_mem(struct mem_range *memp); int register_mem_fallback(struct mem_range *memp); int unregister_mem(struct mem_range *memp); +int write_mem(struct vmctx *ctx, int vcpu, uint64_t gpa, uint64_t wval, + int size); #endif /* _MEM_H_ */ From owner-svn-src-all@freebsd.org Thu Oct 17 23:22:01 2019 Return-Path: Delivered-To: svn-src-all@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 508A315FF75; Thu, 17 Oct 2019 23:22:01 +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 46vQD91Nwyz3MWT; Thu, 17 Oct 2019 23:22:01 +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 132EF27F10; Thu, 17 Oct 2019 23:22:01 +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 x9HNM0Cj032345; Thu, 17 Oct 2019 23:22:00 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HNM0Yb032344; Thu, 17 Oct 2019 23:22:00 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910172322.x9HNM0Yb032344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 17 Oct 2019 23:22:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353704 - stable/12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/usr.sbin/bhyve X-SVN-Commit-Revision: 353704 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 23:22:01 -0000 Author: jhb Date: Thu Oct 17 23:22:00 2019 New Revision: 353704 URL: https://svnweb.freebsd.org/changeset/base/353704 Log: MFC 348253: Add initial support for 'qSupported' to the debug server. This doesn't recognize any features yet, but does parse the features string. It advertises an arbitrary packet size of 4k. Modified: stable/12/usr.sbin/bhyve/gdb.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/gdb.c ============================================================================== --- stable/12/usr.sbin/bhyve/gdb.c Thu Oct 17 23:17:56 2019 (r353703) +++ stable/12/usr.sbin/bhyve/gdb.c Thu Oct 17 23:22:00 2019 (r353704) @@ -991,13 +991,72 @@ command_equals(const uint8_t *data, size_t len, const } static void +check_features(const uint8_t *data, size_t len) +{ + char *feature, *next_feature, *str, *value; + bool supported; + + str = malloc(len + 1); + memcpy(str, data, len); + str[len] = '\0'; + next_feature = str; + + while ((feature = strsep(&next_feature, ";")) != NULL) { + /* + * Null features shouldn't exist, but skip if they + * do. + */ + if (strcmp(feature, "") == 0) + continue; + + /* + * Look for the value or supported / not supported + * flag. + */ + value = strchr(feature, '='); + if (value != NULL) { + *value = '\0'; + value++; + supported = true; + } else { + value = feature + strlen(feature) - 1; + switch (*value) { + case '+': + supported = true; + break; + case '-': + supported = false; + break; + default: + /* + * This is really a protocol error, + * but we just ignore malformed + * features for ease of + * implementation. + */ + continue; + } + value = NULL; + } + + /* No currently supported features. */ + } + free(str); + + start_packet(); + + /* This is an arbitrary limit. */ + append_string("PacketSize=4096"); + finish_packet(); +} + +static void gdb_query(const uint8_t *data, size_t len) { /* * TODO: * - qSearch - * - qSupported */ if (command_equals(data, len, "qAttached")) { start_packet(); @@ -1035,6 +1094,10 @@ gdb_query(const uint8_t *data, size_t len) start_packet(); append_char('l'); finish_packet(); + } else if (command_equals(data, len, "qSupported")) { + data += strlen("qSupported"); + len -= strlen("qSupported"); + check_features(data, len); } else if (command_equals(data, len, "qThreadExtraInfo")) { char buf[16]; int tid; From owner-svn-src-all@freebsd.org Thu Oct 17 23:26:39 2019 Return-Path: Delivered-To: svn-src-all@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 BF8671600FA; Thu, 17 Oct 2019 23:26:39 +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 46vQKW4dGQz3Mm0; Thu, 17 Oct 2019 23:26:39 +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 7E26F27F47; Thu, 17 Oct 2019 23:26:39 +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 x9HNQdpY035758; Thu, 17 Oct 2019 23:26:39 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HNQdVc035757; Thu, 17 Oct 2019 23:26:39 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910172326.x9HNQdVc035757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 17 Oct 2019 23:26:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353705 - stable/12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/usr.sbin/bhyve X-SVN-Commit-Revision: 353705 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 23:26:39 -0000 Author: jhb Date: Thu Oct 17 23:26:39 2019 New Revision: 353705 URL: https://svnweb.freebsd.org/changeset/base/353705 Log: MFC 348778,348998: Enable memory and I/O decoding in PCI devices on demand. 348778: Enable memory and I/O decoding in PCI devices on demand. Rather than uncoditionally setting the MEMEN and PORTEN bits in PCIR_COMMAND for PCI devices, set the respective bit when the first BAR of a given type is added to the device. This more closely matches what firmware does on bare metal. BUSMASTEREN is still set unconditionally. Eventually this bit should move into the device models as not all device models need this set. 348998: Remove a spurious break when setting up a 64-bit memory BAR. This was causing 'enbit' to not be initialized in this case. Modified: stable/12/usr.sbin/bhyve/pci_emul.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/pci_emul.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_emul.c Thu Oct 17 23:22:00 2019 (r353704) +++ stable/12/usr.sbin/bhyve/pci_emul.c Thu Oct 17 23:26:39 2019 (r353705) @@ -586,6 +586,7 @@ pci_emul_alloc_pbar(struct pci_devinst *pdi, int idx, { int error; uint64_t *baseptr, limit, addr, mask, lobits, bar; + uint16_t cmd, enbit; assert(idx >= 0 && idx <= PCI_BARMAX); @@ -604,13 +605,14 @@ pci_emul_alloc_pbar(struct pci_devinst *pdi, int idx, switch (type) { case PCIBAR_NONE: baseptr = NULL; - addr = mask = lobits = 0; + addr = mask = lobits = enbit = 0; break; case PCIBAR_IO: baseptr = &pci_emul_iobase; limit = PCI_EMUL_IOLIMIT; mask = PCIM_BAR_IO_BASE; lobits = PCIM_BAR_IO_SPACE; + enbit = PCIM_CMD_PORTEN; break; case PCIBAR_MEM64: /* @@ -632,19 +634,20 @@ pci_emul_alloc_pbar(struct pci_devinst *pdi, int idx, mask = PCIM_BAR_MEM_BASE; lobits = PCIM_BAR_MEM_SPACE | PCIM_BAR_MEM_64 | PCIM_BAR_MEM_PREFETCH; - break; } else { baseptr = &pci_emul_membase32; limit = PCI_EMUL_MEMLIMIT32; mask = PCIM_BAR_MEM_BASE; lobits = PCIM_BAR_MEM_SPACE | PCIM_BAR_MEM_64; } + enbit = PCIM_CMD_MEMEN; break; case PCIBAR_MEM32: baseptr = &pci_emul_membase32; limit = PCI_EMUL_MEMLIMIT32; mask = PCIM_BAR_MEM_BASE; lobits = PCIM_BAR_MEM_SPACE | PCIM_BAR_MEM_32; + enbit = PCIM_CMD_MEMEN; break; default: printf("pci_emul_alloc_base: invalid bar type %d\n", type); @@ -671,6 +674,9 @@ pci_emul_alloc_pbar(struct pci_devinst *pdi, int idx, pci_set_cfgdata32(pdi, PCIR_BAR(idx + 1), bar >> 32); } + cmd = pci_get_cfgdata16(pdi, PCIR_COMMAND); + if ((cmd & enbit) != enbit) + pci_set_cfgdata16(pdi, PCIR_COMMAND, cmd | enbit); register_bar(pdi, idx); return (0); @@ -756,8 +762,7 @@ pci_emul_init(struct vmctx *ctx, struct pci_devemu *pd pci_set_cfgdata8(pdi, PCIR_INTLINE, 255); pci_set_cfgdata8(pdi, PCIR_INTPIN, 0); - pci_set_cfgdata8(pdi, PCIR_COMMAND, - PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN); + pci_set_cfgdata8(pdi, PCIR_COMMAND, PCIM_CMD_BUSMASTEREN); err = (*pde->pe_init)(ctx, pdi, fi->fi_param); if (err == 0) From owner-svn-src-all@freebsd.org Thu Oct 17 23:29:53 2019 Return-Path: Delivered-To: svn-src-all@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 E2E371601B2; Thu, 17 Oct 2019 23:29:53 +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 46vQPF5hRVz3Mtx; Thu, 17 Oct 2019 23:29:53 +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 8835027F4C; Thu, 17 Oct 2019 23:29:53 +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 x9HNTrZ5035950; Thu, 17 Oct 2019 23:29:53 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HNTqCs035947; Thu, 17 Oct 2019 23:29:52 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910172329.x9HNTqCs035947@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 17 Oct 2019 23:29:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353706 - stable/12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/usr.sbin/bhyve X-SVN-Commit-Revision: 353706 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 23:29:53 -0000 Author: jhb Date: Thu Oct 17 23:29:52 2019 New Revision: 353706 URL: https://svnweb.freebsd.org/changeset/base/353706 Log: MFC 348779: Keep the shadow PCIR_COMMAND synced with the real one for pass through. This ensures that bhyve properly recognizes when decoding is disabled for BARs on passthru devices. To properly handle writes to the register, export a pci_emul_cmd_changed function from pci_emul.c that the pass through device model invokes for config writes that change PCIR_COMMAND. Modified: stable/12/usr.sbin/bhyve/pci_emul.c stable/12/usr.sbin/bhyve/pci_emul.h stable/12/usr.sbin/bhyve/pci_passthru.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/pci_emul.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_emul.c Thu Oct 17 23:26:39 2019 (r353705) +++ stable/12/usr.sbin/bhyve/pci_emul.c Thu Oct 17 23:29:52 2019 (r353706) @@ -1686,33 +1686,20 @@ pci_emul_hdrtype_fixup(int bus, int slot, int off, int } } -static void -pci_emul_cmdsts_write(struct pci_devinst *pi, int coff, uint32_t new, int bytes) +/* + * Update device state in response to changes to the PCI command + * register. + */ +void +pci_emul_cmd_changed(struct pci_devinst *pi, uint16_t old) { - int i, rshift; - uint32_t cmd, cmd2, changed, old, readonly; + int i; + uint16_t changed, new; - cmd = pci_get_cfgdata16(pi, PCIR_COMMAND); /* stash old value */ + new = pci_get_cfgdata16(pi, PCIR_COMMAND); + changed = old ^ new; /* - * From PCI Local Bus Specification 3.0 sections 6.2.2 and 6.2.3. - * - * XXX Bits 8, 11, 12, 13, 14 and 15 in the status register are - * 'write 1 to clear'. However these bits are not set to '1' by - * any device emulation so it is simpler to treat them as readonly. - */ - rshift = (coff & 0x3) * 8; - readonly = 0xFFFFF880 >> rshift; - - old = CFGREAD(pi, coff, bytes); - new &= ~readonly; - new |= (old & readonly); - CFGWRITE(pi, coff, new, bytes); /* update config */ - - cmd2 = pci_get_cfgdata16(pi, PCIR_COMMAND); /* get updated value */ - changed = cmd ^ cmd2; - - /* * If the MMIO or I/O address space decoding has changed then * register/unregister all BARs that decode that address space. */ @@ -1724,7 +1711,7 @@ pci_emul_cmdsts_write(struct pci_devinst *pi, int coff case PCIBAR_IO: /* I/O address space decoding changed? */ if (changed & PCIM_CMD_PORTEN) { - if (porten(pi)) + if (new & PCIM_CMD_PORTEN) register_bar(pi, i); else unregister_bar(pi, i); @@ -1734,7 +1721,7 @@ pci_emul_cmdsts_write(struct pci_devinst *pi, int coff case PCIBAR_MEM64: /* MMIO address space decoding changed? */ if (changed & PCIM_CMD_MEMEN) { - if (memen(pi)) + if (new & PCIM_CMD_MEMEN) register_bar(pi, i); else unregister_bar(pi, i); @@ -1750,6 +1737,32 @@ pci_emul_cmdsts_write(struct pci_devinst *pi, int coff * interrupt. */ pci_lintr_update(pi); +} + +static void +pci_emul_cmdsts_write(struct pci_devinst *pi, int coff, uint32_t new, int bytes) +{ + int rshift; + uint32_t cmd, old, readonly; + + cmd = pci_get_cfgdata16(pi, PCIR_COMMAND); /* stash old value */ + + /* + * From PCI Local Bus Specification 3.0 sections 6.2.2 and 6.2.3. + * + * XXX Bits 8, 11, 12, 13, 14 and 15 in the status register are + * 'write 1 to clear'. However these bits are not set to '1' by + * any device emulation so it is simpler to treat them as readonly. + */ + rshift = (coff & 0x3) * 8; + readonly = 0xFFFFF880 >> rshift; + + old = CFGREAD(pi, coff, bytes); + new &= ~readonly; + new |= (old & readonly); + CFGWRITE(pi, coff, new, bytes); /* update config */ + + pci_emul_cmd_changed(pi, cmd); } static void Modified: stable/12/usr.sbin/bhyve/pci_emul.h ============================================================================== --- stable/12/usr.sbin/bhyve/pci_emul.h Thu Oct 17 23:26:39 2019 (r353705) +++ stable/12/usr.sbin/bhyve/pci_emul.h Thu Oct 17 23:29:52 2019 (r353706) @@ -223,6 +223,7 @@ int pci_emul_alloc_pbar(struct pci_devinst *pdi, int i uint64_t hostbase, enum pcibar_type type, uint64_t size); int pci_emul_add_msicap(struct pci_devinst *pi, int msgnum); int pci_emul_add_pciecap(struct pci_devinst *pi, int pcie_device_type); +void pci_emul_cmd_changed(struct pci_devinst *pi, uint16_t old); void pci_generate_msi(struct pci_devinst *pi, int msgnum); void pci_generate_msix(struct pci_devinst *pi, int msgnum); void pci_lintr_assert(struct pci_devinst *pi); Modified: stable/12/usr.sbin/bhyve/pci_passthru.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_passthru.c Thu Oct 17 23:26:39 2019 (r353705) +++ stable/12/usr.sbin/bhyve/pci_passthru.c Thu Oct 17 23:29:52 2019 (r353706) @@ -639,6 +639,9 @@ cfginit(struct vmctx *ctx, struct pci_devinst *pi, int goto done; } + pci_set_cfgdata16(pi, PCIR_COMMAND, read_config(&sc->psc_sel, + PCIR_COMMAND, 2)); + error = 0; /* success */ done: return (error); @@ -815,6 +818,7 @@ passthru_cfgwrite(struct vmctx *ctx, int vcpu, struct { int error, msix_table_entries, i; struct passthru_softc *sc; + uint16_t cmd_old; sc = pi->pi_arg; @@ -871,6 +875,14 @@ passthru_cfgwrite(struct vmctx *ctx, int vcpu, struct #endif write_config(&sc->psc_sel, coff, bytes, val); + if (coff == PCIR_COMMAND) { + cmd_old = pci_get_cfgdata16(pi, PCIR_COMMAND); + if (bytes == 1) + pci_set_cfgdata8(pi, PCIR_COMMAND, val); + else if (bytes == 2) + pci_set_cfgdata16(pi, PCIR_COMMAND, val); + pci_emul_cmd_changed(pi, cmd_old); + } return (0); } From owner-svn-src-all@freebsd.org Thu Oct 17 23:41:04 2019 Return-Path: Delivered-To: svn-src-all@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 7623A1605F3; Thu, 17 Oct 2019 23:41:04 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (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 46vQf82WcTz3NWf; Thu, 17 Oct 2019 23:41:04 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 32CD2260298; Thu, 17 Oct 2019 17:53:55 +0200 (CEST) Subject: Re: svn commit: r353635 - in head/sys: netinet netinet6 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Gleb Smirnoff References: <201910160911.x9G9BonH076337@repo.freebsd.org> <20191016165722.GU4086@FreeBSD.org> <138998a2-b304-fbe3-065d-e1df0a09af14@selasky.org> <20191017150822.GY4086@FreeBSD.org> From: Hans Petter Selasky Message-ID: <76f19c59-8ea5-b80a-a7b2-6f7df9030851@selasky.org> Date: Thu, 17 Oct 2019 17:51:28 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: <20191017150822.GY4086@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46vQf82WcTz3NWf X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 23:41:04 -0000 On 2019-10-17 17:08, Gleb Smirnoff wrote: > On Wed, Oct 16, 2019 at 10:46:44PM +0200, Hans Petter Selasky wrote: > H> > as far as I remember I was against this changeset and I had > H> > several other developers agreed that this should be fixed in > H> > different way. Why did you proceed with checking it in? :( > H> > H> Hi Gleb, > H> > H> This issue has been discussed in-depth at various transport meetings and > H> we have agreed on a solution. > > Is the list of people who agreed longer than "Reviewed by" list? Yes. > > H> Are you seeing something broken as of this patch? > > As I already explained, first, we are dropping absolutely legitimate > packets. At the time of arrival there were nothing wrong about them. > This is idelogically wrong from viewpoint of abstract network stack. No packets are dropped. This was the initial version of my patch. Please re-read the history of the differential revision. > Second, the problem should be fixed in a different way: when we put > packets on the queue, we should take all important values out of the > ifnet and store them on queue entry. No, this won't work. Sometimes you need to send an ICMP error message back, but to which interface? You cannot use unit-numbers (risking the packet goes to wrong interface) nor pointers, which then can point to freed memory. --HPS From owner-svn-src-all@freebsd.org Thu Oct 17 23:48:29 2019 Return-Path: Delivered-To: svn-src-all@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 EA8681608DE; Thu, 17 Oct 2019 23:48:29 +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 46vQpj5rqzz3P1m; Thu, 17 Oct 2019 23:48:29 +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 ACECE34A; Thu, 17 Oct 2019 23:48:29 +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 x9HNmTZi047615; Thu, 17 Oct 2019 23:48:29 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9HNmTae047614; Thu, 17 Oct 2019 23:48:29 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910172348.x9HNmTae047614@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 17 Oct 2019 23:48:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353707 - stable/12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/usr.sbin/bhyve X-SVN-Commit-Revision: 353707 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2019 23:48:30 -0000 Author: jhb Date: Thu Oct 17 23:48:29 2019 New Revision: 353707 URL: https://svnweb.freebsd.org/changeset/base/353707 Log: MFC 348472: Whitespace cleanups, no functional change. Modified: stable/12/usr.sbin/bhyve/pci_emul.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/pci_emul.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_emul.c Thu Oct 17 23:29:52 2019 (r353706) +++ stable/12/usr.sbin/bhyve/pci_emul.c Thu Oct 17 23:48:29 2019 (r353707) @@ -56,8 +56,8 @@ __FBSDID("$FreeBSD$"); #include "pci_irq.h" #include "pci_lpc.h" -#define CONF1_ADDR_PORT 0x0cf8 -#define CONF1_DATA_PORT 0x0cfc +#define CONF1_ADDR_PORT 0x0cf8 +#define CONF1_DATA_PORT 0x0cfc #define CONF1_ENABLE 0x80000000ul @@ -479,7 +479,7 @@ modify_bar_registration(struct pci_devinst *pi, int id iop.handler = pci_emul_io_handler; iop.arg = pi; error = register_inout(&iop); - } else + } else error = unregister_inout(&iop); break; case PCIBAR_MEM32: @@ -547,7 +547,7 @@ memen(struct pci_devinst *pi) * the address range decoded by the BAR register. */ static void -update_bar_address(struct pci_devinst *pi, uint64_t addr, int idx, int type) +update_bar_address(struct pci_devinst *pi, uint64_t addr, int idx, int type) { int decode; @@ -673,7 +673,7 @@ pci_emul_alloc_pbar(struct pci_devinst *pdi, int idx, pdi->pi_bar[idx + 1].type = PCIBAR_MEMHI64; pci_set_cfgdata32(pdi, PCIR_BAR(idx + 1), bar >> 32); } - + cmd = pci_get_cfgdata16(pdi, PCIR_COMMAND); if ((cmd & enbit) != enbit) pci_set_cfgdata16(pdi, PCIR_COMMAND, cmd | enbit); @@ -848,7 +848,7 @@ pci_emul_add_msixcap(struct pci_devinst *pi, int msgnu assert(msgnum >= 1 && msgnum <= MAX_MSIX_TABLE_ENTRIES); assert(barnum >= 0 && barnum <= PCIR_MAX_BAR_0); - + tab_size = msgnum * MSIX_TABLE_ENTRY_SIZE; /* Align table size to nearest 4K */ @@ -1106,7 +1106,7 @@ init_pci(struct vmctx *ctx) for (bus = 0; bus < MAXBUSES; bus++) { if ((bi = pci_businfo[bus]) == NULL) continue; - /* + /* * Keep track of the i/o and memory resources allocated to * this bus. */ @@ -1726,9 +1726,9 @@ pci_emul_cmd_changed(struct pci_devinst *pi, uint16_t else unregister_bar(pi, i); } - break; + break; default: - assert(0); + assert(0); } } @@ -1970,7 +1970,7 @@ INOUT_PORT(pci_cfgdata, CONF1_DATA_PORT+3, IOPORT_F_IN #define DIOSZ 8 #define DMEMSZ 4096 struct pci_emul_dsoftc { - uint8_t ioregs[DIOSZ]; + uint8_t ioregs[DIOSZ]; uint8_t memregs[2][DMEMSZ]; }; @@ -2062,7 +2062,7 @@ pci_emul_diow(struct vmctx *ctx, int vcpu, struct pci_ } else { printf("diow: memw unknown size %d\n", size); } - + /* * magic interrupt ?? */ @@ -2087,7 +2087,7 @@ pci_emul_dior(struct vmctx *ctx, int vcpu, struct pci_ offset, size); return (0); } - + value = 0; if (size == 1) { value = sc->ioregs[offset]; @@ -2106,7 +2106,7 @@ pci_emul_dior(struct vmctx *ctx, int vcpu, struct pci_ offset, size); return (0); } - + i = baridx - 1; /* 'memregs' index */ if (size == 1) { From owner-svn-src-all@freebsd.org Fri Oct 18 00:00:12 2019 Return-Path: Delivered-To: svn-src-all@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 CDE58160EC3; Fri, 18 Oct 2019 00:00:12 +0000 (UTC) (envelope-from gjb@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 46vR4D4b6sz3PdL; Fri, 18 Oct 2019 00:00:12 +0000 (UTC) (envelope-from gjb@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 81A02583; Fri, 18 Oct 2019 00:00:12 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9I00CKc053794; Fri, 18 Oct 2019 00:00:12 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9I00CJ5053792; Fri, 18 Oct 2019 00:00:12 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201910180000.x9I00CJ5053792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 18 Oct 2019 00:00:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r353708 - in releng/12.1: release/pkg_repos sys/conf X-SVN-Group: releng X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in releng/12.1: release/pkg_repos sys/conf X-SVN-Commit-Revision: 353708 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 00:00:12 -0000 Author: gjb Date: Fri Oct 18 00:00:11 2019 New Revision: 353708 URL: https://svnweb.freebsd.org/changeset/base/353708 Log: - Update releng/12.1 from RC1 to RC2 as part of the 12.1-RELEASE cycle. - Update the dvd1.iso pkg(8) configuration to use the release_1 package set to populate the dvd. Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC (Netgate) Modified: releng/12.1/release/pkg_repos/release-dvd.conf releng/12.1/sys/conf/newvers.sh Modified: releng/12.1/release/pkg_repos/release-dvd.conf ============================================================================== --- releng/12.1/release/pkg_repos/release-dvd.conf Thu Oct 17 23:48:29 2019 (r353707) +++ releng/12.1/release/pkg_repos/release-dvd.conf Fri Oct 18 00:00:11 2019 (r353708) @@ -1,6 +1,6 @@ # $FreeBSD$ release: { - url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly", + url: "pkg+http://pkg.FreeBSD.org/${ABI}/release_1", mirror_type: "srv", signature_type: "fingerprints", fingerprints: "/usr/share/keys/pkg", Modified: releng/12.1/sys/conf/newvers.sh ============================================================================== --- releng/12.1/sys/conf/newvers.sh Thu Oct 17 23:48:29 2019 (r353707) +++ releng/12.1/sys/conf/newvers.sh Fri Oct 18 00:00:11 2019 (r353708) @@ -46,7 +46,7 @@ TYPE="FreeBSD" REVISION="12.1" -BRANCH="RC1" +BRANCH="RC2" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@freebsd.org Fri Oct 18 00:00:18 2019 Return-Path: Delivered-To: svn-src-all@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 0F5F3160EE6; Fri, 18 Oct 2019 00:00:18 +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 46vR4K61wJz3PfJ; Fri, 18 Oct 2019 00:00:17 +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 A3BE0584; Fri, 18 Oct 2019 00:00:17 +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 x9I00Hcx053844; Fri, 18 Oct 2019 00:00:17 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9I00H8s053843; Fri, 18 Oct 2019 00:00:17 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910180000.x9I00H8s053843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 18 Oct 2019 00:00:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353709 - head/lib/libz X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/lib/libz X-SVN-Commit-Revision: 353709 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 00:00:18 -0000 Author: brooks Date: Fri Oct 18 00:00:17 2019 New Revision: 353709 URL: https://svnweb.freebsd.org/changeset/base/353709 Log: Remove obsolete, non-use of CLANG_NO_IAS. CLANG_NO_IAS was removed in r351661. Modified: head/lib/libz/Makefile Modified: head/lib/libz/Makefile ============================================================================== --- head/lib/libz/Makefile Fri Oct 18 00:00:11 2019 (r353708) +++ head/lib/libz/Makefile Fri Oct 18 00:00:17 2019 (r353709) @@ -68,6 +68,3 @@ FILES= zlib.pc FILESDIR= ${LIBDATADIR}/pkgconfig .include - -## XXX: clang integrated-as doesn't grok .intel_syntax directives yet -#ACFLAGS.gvmat64.S= ${CLANG_NO_IAS} From owner-svn-src-all@freebsd.org Fri Oct 18 01:46:38 2019 Return-Path: Delivered-To: svn-src-all@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 F0706163D38; Fri, 18 Oct 2019 01:46:38 +0000 (UTC) (envelope-from mhorne@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 46vTR25z0gz40nF; Fri, 18 Oct 2019 01:46:38 +0000 (UTC) (envelope-from mhorne@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 AB77018E7; Fri, 18 Oct 2019 01:46:38 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9I1kcwu017932; Fri, 18 Oct 2019 01:46:38 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9I1kcIG017931; Fri, 18 Oct 2019 01:46:38 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201910180146.x9I1kcIG017931@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 18 Oct 2019 01:46:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353711 - head/lib/clang/libllvm X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/lib/clang/libllvm X-SVN-Commit-Revision: 353711 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 01:46:39 -0000 Author: mhorne Date: Fri Oct 18 01:46:38 2019 New Revision: 353711 URL: https://svnweb.freebsd.org/changeset/base/353711 Log: Fix build of LLVM RISC-V backend Reviewed by: dim MFC with: r353358 Differential Revision: https://reviews.freebsd.org/D21963 Modified: head/lib/clang/libllvm/Makefile Modified: head/lib/clang/libllvm/Makefile ============================================================================== --- head/lib/clang/libllvm/Makefile Fri Oct 18 00:19:45 2019 (r353710) +++ head/lib/clang/libllvm/Makefile Fri Oct 18 01:46:38 2019 (r353711) @@ -1185,6 +1185,7 @@ SRCS_MIN+= Target/RISCV/RISCVRegisterInfo.cpp SRCS_MIN+= Target/RISCV/RISCVSubtarget.cpp SRCS_MIN+= Target/RISCV/RISCVTargetMachine.cpp SRCS_MIN+= Target/RISCV/RISCVTargetObjectFile.cpp +SRCS_MIN+= Target/RISCV/RISCVTargetTransformInfo.cpp SRCS_MIN+= Target/RISCV/TargetInfo/RISCVTargetInfo.cpp SRCS_MIN+= Target/RISCV/Utils/RISCVBaseInfo.cpp SRCS_MIN+= Target/RISCV/Utils/RISCVMatInt.cpp From owner-svn-src-all@freebsd.org Fri Oct 18 02:18:18 2019 Return-Path: Delivered-To: svn-src-all@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 D131C164501; Fri, 18 Oct 2019 02:18:18 +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 46vV7Z4xtQz421b; Fri, 18 Oct 2019 02:18:18 +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 8847D1E39; Fri, 18 Oct 2019 02:18:18 +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 x9I2IIjH035555; Fri, 18 Oct 2019 02:18:18 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9I2IH0l035551; Fri, 18 Oct 2019 02:18:17 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910180218.x9I2IH0l035551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 18 Oct 2019 02:18:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353712 - in head/sys/x86: include x86 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys/x86: include x86 X-SVN-Commit-Revision: 353712 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 02:18:18 -0000 Author: cem Date: Fri Oct 18 02:18:17 2019 New Revision: 353712 URL: https://svnweb.freebsd.org/changeset/base/353712 Log: x86: Fetch and save standard CPUID leaf 6 in identcpu Rather than a few scattered places in the tree. Organize flag names in a contiguous region of specialreg.h. While here, delete deprecated PCOMMIT from leaf 7. No functional change. Modified: head/sys/x86/include/specialreg.h head/sys/x86/include/x86_var.h head/sys/x86/x86/identcpu.c head/sys/x86/x86/local_apic.c head/sys/x86/x86/tsc.c Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Fri Oct 18 01:46:38 2019 (r353711) +++ head/sys/x86/include/specialreg.h Fri Oct 18 02:18:17 2019 (r353712) @@ -183,21 +183,6 @@ #define CPUID2_RDRAND 0x40000000 #define CPUID2_HV 0x80000000 -/* - * Important bits in the Thermal and Power Management flags - * CPUID.6 EAX and ECX. - */ -#define CPUTPM1_SENSOR 0x00000001 -#define CPUTPM1_TURBO 0x00000002 -#define CPUTPM1_ARAT 0x00000004 -#define CPUTPM1_HWP 0x00000080 -#define CPUTPM1_HWP_NOTIFICATION 0x00000100 -#define CPUTPM1_HWP_ACTIVITY_WINDOW 0x00000200 -#define CPUTPM1_HWP_PERF_PREF 0x00000400 -#define CPUTPM1_HWP_PKG 0x00000800 -#define CPUTPM1_HWP_FLEXIBLE 0x00020000 -#define CPUTPM2_EFFREQ 0x00000001 - /* Intel Processor Trace CPUID. */ /* Leaf 0 ebx. */ @@ -326,11 +311,35 @@ #define MWAIT_INTRBREAK 0x00000001 /* - * CPUID instruction 6 ecx info + * CPUID leaf 6: Thermal and Power management. */ -#define CPUID_PERF_STAT 0x00000001 -#define CPUID_PERF_BIAS 0x00000008 +/* Eax. */ +#define CPUTPM1_SENSOR 0x00000001 +#define CPUTPM1_TURBO 0x00000002 +#define CPUTPM1_ARAT 0x00000004 +#define CPUTPM1_PLN 0x00000010 +#define CPUTPM1_ECMD 0x00000020 +#define CPUTPM1_PTM 0x00000040 +#define CPUTPM1_HWP 0x00000080 +#define CPUTPM1_HWP_NOTIFICATION 0x00000100 +#define CPUTPM1_HWP_ACTIVITY_WINDOW 0x00000200 +#define CPUTPM1_HWP_PERF_PREF 0x00000400 +#define CPUTPM1_HWP_PKG 0x00000800 +#define CPUTPM1_HDC 0x00002000 +#define CPUTPM1_TURBO30 0x00004000 +#define CPUTPM1_HWP_CAPABILITIES 0x00008000 +#define CPUTPM1_HWP_PECI_OVR 0x00010000 +#define CPUTPM1_HWP_FLEXIBLE 0x00020000 +#define CPUTPM1_HWP_FAST_MSR 0x00040000 +#define CPUTPM1_HWP_IGN_IDLE 0x00100000 +/* Ebx. */ +#define CPUTPM_B_NSENSINTTHRESH 0x0000000f + +/* Ecx. */ +#define CPUID_PERF_STAT 0x00000001 +#define CPUID_PERF_BIAS 0x00000008 + /* * CPUID instruction 0xb ebx info. */ @@ -419,7 +428,7 @@ #define CPUID_STDEXT_ADX 0x00080000 #define CPUID_STDEXT_SMAP 0x00100000 #define CPUID_STDEXT_AVX512IFMA 0x00200000 -#define CPUID_STDEXT_PCOMMIT 0x00400000 +/* Formerly PCOMMIT */ #define CPUID_STDEXT_CLFLUSHOPT 0x00800000 #define CPUID_STDEXT_CLWB 0x01000000 #define CPUID_STDEXT_PROCTRACE 0x02000000 Modified: head/sys/x86/include/x86_var.h ============================================================================== --- head/sys/x86/include/x86_var.h Fri Oct 18 01:46:38 2019 (r353711) +++ head/sys/x86/include/x86_var.h Fri Oct 18 02:18:17 2019 (r353712) @@ -67,6 +67,10 @@ extern u_int cpu_mon_mwait_flags; extern u_int cpu_mon_min_size; extern u_int cpu_mon_max_size; extern u_int cpu_maxphyaddr; +extern u_int cpu_power_eax; +extern u_int cpu_power_ebx; +extern u_int cpu_power_ecx; +extern u_int cpu_power_edx; extern char ctx_switch_xsave[]; extern u_int hv_base; extern u_int hv_high; Modified: head/sys/x86/x86/identcpu.c ============================================================================== --- head/sys/x86/x86/identcpu.c Fri Oct 18 01:46:38 2019 (r353711) +++ head/sys/x86/x86/identcpu.c Fri Oct 18 02:18:17 2019 (r353712) @@ -118,6 +118,10 @@ u_int cpu_mon_mwait_flags; /* MONITOR/MWAIT flags (CPU u_int cpu_mon_min_size; /* MONITOR minimum range size, bytes */ u_int cpu_mon_max_size; /* MONITOR minimum range size, bytes */ u_int cpu_maxphyaddr; /* Max phys addr width in bits */ +u_int cpu_power_eax; /* 06H: Power management leaf, %eax */ +u_int cpu_power_ebx; /* 06H: Power management leaf, %eax */ +u_int cpu_power_ecx; /* 06H: Power management leaf, %eax */ +u_int cpu_power_edx; /* 06H: Power management leaf, %eax */ char machine[] = MACHINE; SYSCTL_UINT(_hw, OID_AUTO, via_feature_rng, CTLFLAG_RD, @@ -960,7 +964,8 @@ printcpuinfo(void) /* Supervisor Mode Access Prevention */ "\025SMAP" "\026AVX512IFMA" - "\027PCOMMIT" + /* Formerly PCOMMIT */ + "\027" "\030CLFLUSHOPT" "\031CLWB" "\032PROCTRACE" @@ -1550,6 +1555,14 @@ void identify_cpu2(void) { u_int regs[4], cpu_stdext_disable; + + if (cpu_high >= 6) { + cpuid_count(6, 0, regs); + cpu_power_eax = regs[0]; + cpu_power_ebx = regs[1]; + cpu_power_ecx = regs[2]; + cpu_power_edx = regs[3]; + } if (cpu_high >= 7) { cpuid_count(7, 0, regs); Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Fri Oct 18 01:46:38 2019 (r353711) +++ head/sys/x86/x86/local_apic.c Fri Oct 18 02:18:17 2019 (r353712) @@ -480,8 +480,8 @@ native_lapic_init(vm_paddr_t addr) uint64_t r, r1, r2, rx; #endif uint32_t ver; - u_int regs[4]; - int i, arat; + int i; + bool arat; /* * Enable x2APIC mode if possible. Map the local APIC @@ -526,16 +526,9 @@ native_lapic_init(vm_paddr_t addr) SDT_APIC, SEL_KPL, GSEL_APIC); if ((resource_int_value("apic", 0, "clock", &i) != 0 || i != 0)) { - arat = 0; - /* Intel CPUID 0x06 EAX[2] set if APIC timer runs in C3. */ - if (cpu_vendor_id == CPU_VENDOR_INTEL && cpu_high >= 6) { - do_cpuid(0x06, regs); - if ((regs[0] & CPUTPM1_ARAT) != 0) - arat = 1; - } else if (cpu_vendor_id == CPU_VENDOR_AMD && - CPUID_TO_FAMILY(cpu_id) >= 0x12) { - arat = 1; - } + /* Set if APIC timer runs in C3. */ + arat = (cpu_power_eax & CPUTPM1_ARAT); + bzero(&lapic_et, sizeof(lapic_et)); lapic_et.et_name = "LAPIC"; lapic_et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT | Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Fri Oct 18 01:46:38 2019 (r353711) +++ head/sys/x86/x86/tsc.c Fri Oct 18 02:18:17 2019 (r353712) @@ -232,20 +232,16 @@ probe_tsc_freq(void) uint64_t tsc1, tsc2; uint16_t bootflags; - if (cpu_high >= 6) { - do_cpuid(6, regs); - if ((regs[2] & CPUID_PERF_STAT) != 0) { - /* - * XXX Some emulators expose host CPUID without actual - * support for these MSRs. We must test whether they - * really work. - */ - wrmsr(MSR_MPERF, 0); - wrmsr(MSR_APERF, 0); - DELAY(10); - if (rdmsr(MSR_MPERF) > 0 && rdmsr(MSR_APERF) > 0) - tsc_perf_stat = 1; - } + if (cpu_power_ecx & CPUID_PERF_STAT) { + /* + * XXX Some emulators expose host CPUID without actual support + * for these MSRs. We must test whether they really work. + */ + wrmsr(MSR_MPERF, 0); + wrmsr(MSR_APERF, 0); + DELAY(10); + if (rdmsr(MSR_MPERF) > 0 && rdmsr(MSR_APERF) > 0) + tsc_perf_stat = 1; } if (vm_guest == VM_GUEST_VMWARE) { From owner-svn-src-all@freebsd.org Fri Oct 18 02:25:31 2019 Return-Path: Delivered-To: svn-src-all@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 3975D1647BF; Fri, 18 Oct 2019 02:25:31 +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 46vVHv0dwcz42QT; Fri, 18 Oct 2019 02:25:31 +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 ED42F1FF1; Fri, 18 Oct 2019 02:25:30 +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 x9I2PUGj041372; Fri, 18 Oct 2019 02:25:30 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9I2PUn1041371; Fri, 18 Oct 2019 02:25:30 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910180225.x9I2PUn1041371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 18 Oct 2019 02:25:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353713 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 353713 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 02:25:31 -0000 Author: cem Date: Fri Oct 18 02:25:30 2019 New Revision: 353713 URL: https://svnweb.freebsd.org/changeset/base/353713 Log: x86: Remove unused variable from r353712 It was in my git tree (uncommitted) and didn't get carried over to SVN in r353712. X-MFC-With: r353712 Modified: head/sys/x86/x86/tsc.c Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Fri Oct 18 02:18:17 2019 (r353712) +++ head/sys/x86/x86/tsc.c Fri Oct 18 02:25:30 2019 (r353713) @@ -228,7 +228,6 @@ tsc_freq_intel(void) static void probe_tsc_freq(void) { - u_int regs[4]; uint64_t tsc1, tsc2; uint16_t bootflags; From owner-svn-src-all@freebsd.org Fri Oct 18 03:01:22 2019 Return-Path: Delivered-To: svn-src-all@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 AF96D164CC7; Fri, 18 Oct 2019 03:01: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 46vW5G2WSJz43gX; Fri, 18 Oct 2019 03:01: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 3B3D125BC; Fri, 18 Oct 2019 03:01: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 x9I31M8t064002; Fri, 18 Oct 2019 03:01:22 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9I31M9I064001; Fri, 18 Oct 2019 03:01:22 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910180301.x9I31M9I064001@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 18 Oct 2019 03:01:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353714 - head/sys/dev/nvdimm X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/dev/nvdimm X-SVN-Commit-Revision: 353714 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 03:01:22 -0000 Author: cem Date: Fri Oct 18 03:01:21 2019 New Revision: 353714 URL: https://svnweb.freebsd.org/changeset/base/353714 Log: nvdimm_e820: Fix braino in size=all SPA hint The sentinel value for "use the rest of the region," -1, isn't zero modulo PAGE_SIZE. Relax the check to permit the intended special value. X-MFC-With: r353110 Sponsored by: Dell EMC Isilon Modified: head/sys/dev/nvdimm/nvdimm_e820.c Modified: head/sys/dev/nvdimm/nvdimm_e820.c ============================================================================== --- head/sys/dev/nvdimm/nvdimm_e820.c Fri Oct 18 02:25:30 2019 (r353713) +++ head/sys/dev/nvdimm/nvdimm_e820.c Fri Oct 18 03:01:21 2019 (r353714) @@ -138,8 +138,8 @@ nvdimm_e820_create_spas(device_t dev) hintaddr = (vm_paddr_t)hintaddrl; hintsize = (vm_size_t)hintsizel; - if ((hintaddr & PAGE_MASK) != 0 || (hintsize & PAGE_MASK) != 0) - { + if ((hintaddr & PAGE_MASK) != 0 || + ((hintsize & PAGE_MASK) != 0 && hintsize != HINT_ALL)) { device_printf(dev, "hint.nvdimm_spa.%u addr or size " "not page aligned\n", i); continue; From owner-svn-src-all@freebsd.org Fri Oct 18 03:36:26 2019 Return-Path: Delivered-To: svn-src-all@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 B20F41654A6; Fri, 18 Oct 2019 03:36:26 +0000 (UTC) (envelope-from kp@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 46vWsk4FHRz4575; Fri, 18 Oct 2019 03:36:26 +0000 (UTC) (envelope-from kp@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 750B52CBC; Fri, 18 Oct 2019 03:36:26 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9I3aQFi083540; Fri, 18 Oct 2019 03:36:26 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9I3aQ5p083539; Fri, 18 Oct 2019 03:36:26 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201910180336.x9I3aQ5p083539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Fri, 18 Oct 2019 03:36:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353715 - head/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/netpfil/pf X-SVN-Commit-Revision: 353715 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 03:36:26 -0000 Author: kp Date: Fri Oct 18 03:36:26 2019 New Revision: 353715 URL: https://svnweb.freebsd.org/changeset/base/353715 Log: pf: Must be in NET_EPOCH to call icmp_error icmp_reflect(), called through icmp_error() requires us to be in NET_EPOCH. Failure to hold it leads to the following panic (with INVARIANTS): panic: Assertion in_epoch(net_epoch_preempt) failed at /usr/src/sys/netinet/ip_icmp.c:742 cpuid = 2 time = 1571233273 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00e0977920 vpanic() at vpanic+0x17e/frame 0xfffffe00e0977980 panic() at panic+0x43/frame 0xfffffe00e09779e0 icmp_reflect() at icmp_reflect+0x625/frame 0xfffffe00e0977aa0 icmp_error() at icmp_error+0x720/frame 0xfffffe00e0977b10 pf_intr() at pf_intr+0xd5/frame 0xfffffe00e0977b50 ithread_loop() at ithread_loop+0x1c6/frame 0xfffffe00e0977bb0 fork_exit() at fork_exit+0x80/frame 0xfffffe00e0977bf0 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe00e0977bf0 Note that we now enter NET_EPOCH twice if we enter ip_output() from pf_intr(), but ip_output() will soon be converted to a function that requires epoch, so entering NET_EPOCH directly from pf_intr() makes more sense. Discussed with: glebius@ Modified: head/sys/netpfil/pf/pf.c Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Fri Oct 18 03:01:21 2019 (r353714) +++ head/sys/netpfil/pf/pf.c Fri Oct 18 03:36:26 2019 (r353715) @@ -1428,6 +1428,7 @@ pf_send(struct pf_send_entry *pfse) void pf_intr(void *v) { + struct epoch_tracker et; struct pf_send_head queue; struct pf_send_entry *pfse, *next; @@ -1438,6 +1439,8 @@ pf_intr(void *v) STAILQ_INIT(&V_pf_sendqueue); PF_SENDQ_UNLOCK(); + NET_EPOCH_ENTER(et); + STAILQ_FOREACH_SAFE(pfse, &queue, pfse_next, next) { switch (pfse->pfse_type) { #ifdef INET @@ -1464,6 +1467,7 @@ pf_intr(void *v) } free(pfse, M_PFTEMP); } + NET_EPOCH_EXIT(et); CURVNET_RESTORE(); } From owner-svn-src-all@freebsd.org Fri Oct 18 03:38:01 2019 Return-Path: Delivered-To: svn-src-all@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 E5E4D16553A; Fri, 18 Oct 2019 03:38:01 +0000 (UTC) (envelope-from kp@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 46vWvY5lgVz45Ft; Fri, 18 Oct 2019 03:38:01 +0000 (UTC) (envelope-from kp@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 A8D222CBD; Fri, 18 Oct 2019 03:38:01 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9I3c1Xf083655; Fri, 18 Oct 2019 03:38:01 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9I3c14L083654; Fri, 18 Oct 2019 03:38:01 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201910180338.x9I3c14L083654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Fri, 18 Oct 2019 03:38:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353716 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 353716 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 03:38:02 -0000 Author: kp Date: Fri Oct 18 03:38:01 2019 New Revision: 353716 URL: https://svnweb.freebsd.org/changeset/base/353716 Log: MFC r353443 mountroot: run statfs after mounting devfs The usual flow for mounting a file system is to VFS_MOUNT() and then immediately VFS_STATFS(). That's not done in vfs_mountroot_devfs(), which means the mp->mnt_stat.f_iosize field is not correctly populated, which in turn causes us to mark valid aio operations as unsafe (because the io size is set to 0), ultimately causing the aio_test:md_waitcomplete test to fail. Sponsored by: Axiado Modified: stable/12/sys/kern/vfs_mountroot.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/vfs_mountroot.c ============================================================================== --- stable/12/sys/kern/vfs_mountroot.c Fri Oct 18 03:36:26 2019 (r353715) +++ stable/12/sys/kern/vfs_mountroot.c Fri Oct 18 03:38:01 2019 (r353716) @@ -262,6 +262,11 @@ vfs_mountroot_devfs(struct thread *td, struct mount ** if (error) return (error); + error = VFS_STATFS(mp, &mp->mnt_stat); + KASSERT(error == 0, ("VFS_STATFS(devfs) failed %d", error)); + if (error) + return (error); + opts = malloc(sizeof(struct vfsoptlist), M_MOUNT, M_WAITOK); TAILQ_INIT(opts); mp->mnt_opt = opts; From owner-svn-src-all@freebsd.org Fri Oct 18 03:38:03 2019 Return-Path: Delivered-To: svn-src-all@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 5FA0416555B; Fri, 18 Oct 2019 03:38:03 +0000 (UTC) (envelope-from kp@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 46vWvb1vGBz45G0; Fri, 18 Oct 2019 03:38:03 +0000 (UTC) (envelope-from kp@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 2454E2CBE; Fri, 18 Oct 2019 03:38:03 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9I3c2qP083699; Fri, 18 Oct 2019 03:38:02 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9I3c2rc083698; Fri, 18 Oct 2019 03:38:02 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201910180338.x9I3c2rc083698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Fri, 18 Oct 2019 03:38:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353717 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 353717 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 03:38:03 -0000 Author: kp Date: Fri Oct 18 03:38:02 2019 New Revision: 353717 URL: https://svnweb.freebsd.org/changeset/base/353717 Log: MFC r353443 mountroot: run statfs after mounting devfs The usual flow for mounting a file system is to VFS_MOUNT() and then immediately VFS_STATFS(). That's not done in vfs_mountroot_devfs(), which means the mp->mnt_stat.f_iosize field is not correctly populated, which in turn causes us to mark valid aio operations as unsafe (because the io size is set to 0), ultimately causing the aio_test:md_waitcomplete test to fail. Sponsored by: Axiado Modified: stable/11/sys/kern/vfs_mountroot.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_mountroot.c ============================================================================== --- stable/11/sys/kern/vfs_mountroot.c Fri Oct 18 03:38:01 2019 (r353716) +++ stable/11/sys/kern/vfs_mountroot.c Fri Oct 18 03:38:02 2019 (r353717) @@ -258,6 +258,11 @@ vfs_mountroot_devfs(struct thread *td, struct mount ** if (error) return (error); + error = VFS_STATFS(mp, &mp->mnt_stat); + KASSERT(error == 0, ("VFS_STATFS(devfs) failed %d", error)); + if (error) + return (error); + opts = malloc(sizeof(struct vfsoptlist), M_MOUNT, M_WAITOK); TAILQ_INIT(opts); mp->mnt_opt = opts; From owner-svn-src-all@freebsd.org Fri Oct 18 07:55:02 2019 Return-Path: Delivered-To: svn-src-all@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 523DE149237; Fri, 18 Oct 2019 07:55:02 +0000 (UTC) (envelope-from phk@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 46vdc61GTcz4Gp4; Fri, 18 Oct 2019 07:55:02 +0000 (UTC) (envelope-from phk@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 E546F5DB5; Fri, 18 Oct 2019 07:55:01 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9I7t152036486; Fri, 18 Oct 2019 07:55:01 GMT (envelope-from phk@FreeBSD.org) Received: (from phk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9I7t1da036485; Fri, 18 Oct 2019 07:55:01 GMT (envelope-from phk@FreeBSD.org) Message-Id: <201910180755.x9I7t1da036485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phk set sender to phk@FreeBSD.org using -f From: Poul-Henning Kamp Date: Fri, 18 Oct 2019 07:55:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353718 - head/usr.bin/ministat X-SVN-Group: head X-SVN-Commit-Author: phk X-SVN-Commit-Paths: head/usr.bin/ministat X-SVN-Commit-Revision: 353718 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 07:55:02 -0000 Author: phk Date: Fri Oct 18 07:55:01 2019 New Revision: 353718 URL: https://svnweb.freebsd.org/changeset/base/353718 Log: Improve the way we calculate variance to reduce the rounding errors when variance is small relative to data points. Now [0, 1, 2] shows same standard deviation as [10000000000000, ...1, ...2] Also: Various nitpickery from my own tree. Modified: head/usr.bin/ministat/ministat.c Modified: head/usr.bin/ministat/ministat.c ============================================================================== --- head/usr.bin/ministat/ministat.c Fri Oct 18 03:38:02 2019 (r353717) +++ head/usr.bin/ministat/ministat.c Fri Oct 18 07:55:01 2019 (r353718) @@ -18,6 +18,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -31,7 +32,7 @@ __FBSDID("$FreeBSD$"); #define NSTUDENT 100 #define NCONF 6 static double const studentpct[] = { 80, 90, 95, 98, 99, 99.5 }; -static double student[NSTUDENT + 1][NCONF] = { +static double const student[NSTUDENT + 1][NCONF] = { /* inf */ { 1.282, 1.645, 1.960, 2.326, 2.576, 3.090 }, /* 1. */ { 3.078, 6.314, 12.706, 31.821, 63.657, 318.313 }, /* 2. */ { 1.886, 2.920, 4.303, 6.965, 9.925, 22.327 }, @@ -152,8 +153,11 @@ NewSet(void) struct dataset *ds; ds = calloc(1, sizeof *ds); + assert(ds != NULL); ds->lpoints = 100000; ds->points = calloc(sizeof *ds->points, ds->lpoints); + assert(ds->points != NULL); + ds->syy = NAN; return(ds); } @@ -166,55 +170,58 @@ AddPoint(struct dataset *ds, double a) dp = ds->points; ds->lpoints *= 4; ds->points = calloc(sizeof *ds->points, ds->lpoints); + assert(ds->points != NULL); memcpy(ds->points, dp, sizeof *dp * ds->n); free(dp); } ds->points[ds->n++] = a; ds->sy += a; - ds->syy += a * a; } static double -Min(struct dataset *ds) +Min(const struct dataset *ds) { return (ds->points[0]); } static double -Max(struct dataset *ds) +Max(const struct dataset *ds) { return (ds->points[ds->n -1]); } static double -Avg(struct dataset *ds) +Avg(const struct dataset *ds) { return(ds->sy / ds->n); } static double -Median(struct dataset *ds) +Median(const struct dataset *ds) { + const unsigned m = ds->n / 2; + if ((ds->n % 2) == 0) - return ((ds->points[ds->n / 2] + (ds->points[(ds->n / 2) - 1])) / 2); - else - return (ds->points[ds->n / 2]); + return ((ds->points[m] + (ds->points[m - 1])) / 2); + return (ds->points[m]); } static double Var(struct dataset *ds) { + unsigned n; + const double a = Avg(ds); - /* - * Due to limited precision it is possible that sy^2/n > syy, - * but variance cannot actually be negative. - */ - if (ds->syy <= ds->sy * ds->sy / ds->n) - return (0); - return (ds->syy - ds->sy * ds->sy / ds->n) / (ds->n - 1.0); + if (isnan(ds->syy)) { + ds->syy = 0.0; + for (n = 0; n < ds->n; n++) + ds->syy += (ds->points[n] - a) * (ds->points[n] - a); + } + + return (ds->syy / (ds->n - 1.0)); } static double @@ -265,7 +272,7 @@ Relative(struct dataset *ds, struct dataset *rs, int c re = t * sqrt(re); if (fabs(d) > e) { - + printf("Difference at %.1f%% confidence\n", studentpct[confidx]); printf(" %g +/- %g\n", d, e); printf(" %g%% +/- %g%%\n", d * 100 / Avg(rs), re * 100 / Avg(rs)); @@ -349,13 +356,17 @@ PlotSet(struct dataset *ds, int val) else bar = 0; - if (pl->bar == NULL) + if (pl->bar == NULL) { pl->bar = calloc(sizeof(char *), pl->num_datasets); + assert(pl->bar != NULL); + } + if (pl->bar[bar] == NULL) { pl->bar[bar] = malloc(pl->width); + assert(pl->bar[bar] != NULL); memset(pl->bar[bar], 0, pl->width); } - + m = 1; i = -1; j = 0; @@ -373,6 +384,7 @@ PlotSet(struct dataset *ds, int val) m += 1; if (m > pl->height) { pl->data = realloc(pl->data, pl->width * m); + assert(pl->data != NULL); memset(pl->data + pl->height * pl->width, 0, (m - pl->height) * pl->width); } @@ -477,6 +489,7 @@ ReadSet(FILE *f, const char *n, int column, const char s = NewSet(); s->name = strdup(n); + assert(s->name != NULL); line = 0; while (fgets(buf, sizeof buf, f) != NULL) { line++; @@ -619,7 +632,10 @@ main(int argc, char **argv) nds = argc; for (i = 0; i < nds; i++) { setfilenames[i] = argv[i]; - setfiles[i] = fopen(argv[i], "r"); + if (!strcmp(argv[i], "-")) + setfiles[0] = stdin; + else + setfiles[i] = fopen(argv[i], "r"); if (setfiles[i] == NULL) err(2, "Cannot open %s", argv[i]); } @@ -639,10 +655,11 @@ main(int argc, char **argv) for (i = 0; i < nds; i++) { ds[i] = ReadSet(setfiles[i], setfilenames[i], column, delim); - fclose(setfiles[i]); + if (setfiles[i] != stdin) + fclose(setfiles[i]); } - for (i = 0; i < nds; i++) + for (i = 0; i < nds; i++) printf("%c %s\n", symbol[i+1], ds[i]->name); if (!flag_n && !suppress_plot) { From owner-svn-src-all@freebsd.org Fri Oct 18 08:34:53 2019 Return-Path: Delivered-To: svn-src-all@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 99C6814A0AA; Fri, 18 Oct 2019 08:34:53 +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 46vfV53FtWz4JB4; Fri, 18 Oct 2019 08:34:53 +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 4EF0E64D1; Fri, 18 Oct 2019 08:34:53 +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 x9I8Yr8B059777; Fri, 18 Oct 2019 08:34:53 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9I8YrbE059776; Fri, 18 Oct 2019 08:34:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910180834.x9I8YrbE059776@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 18 Oct 2019 08:34:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353719 - stable/12/sys/fs/msdosfs X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/fs/msdosfs X-SVN-Commit-Revision: 353719 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 08:34:53 -0000 Author: kib Date: Fri Oct 18 08:34:52 2019 New Revision: 353719 URL: https://svnweb.freebsd.org/changeset/base/353719 Log: MFC r353446: Plug the rest of undef behavior places that were missed in r337456. Modified: stable/12/sys/fs/msdosfs/msdosfs_fat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/12/sys/fs/msdosfs/msdosfs_fat.c Fri Oct 18 07:55:01 2019 (r353718) +++ stable/12/sys/fs/msdosfs/msdosfs_fat.c Fri Oct 18 08:34:52 2019 (r353719) @@ -389,9 +389,10 @@ usemap_alloc(struct msdosfsmount *pmp, u_long cn) pmp->pm_maxcluster)); KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0, ("usemap_alloc on ro msdosfs mount")); - KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS))) - == 0, ("Allocating used sector %ld %ld %x", cn, cn % N_INUSEBITS, - (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS])); + KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & + (1U << (cn % N_INUSEBITS))) == 0, + ("Allocating used sector %ld %ld %x", cn, cn % N_INUSEBITS, + (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS])); pmp->pm_inusemap[cn / N_INUSEBITS] |= 1U << (cn % N_INUSEBITS); KASSERT(pmp->pm_freeclustercount > 0, ("usemap_alloc: too little")); pmp->pm_freeclustercount--; @@ -410,9 +411,10 @@ usemap_free(struct msdosfsmount *pmp, u_long cn) ("usemap_free on ro msdosfs mount")); pmp->pm_freeclustercount++; pmp->pm_flags |= MSDOSFS_FSIMOD; - KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS))) - != 0, ("Freeing unused sector %ld %ld %x", cn, cn % N_INUSEBITS, - (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS])); + KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & + (1U << (cn % N_INUSEBITS))) != 0, + ("Freeing unused sector %ld %ld %x", cn, cn % N_INUSEBITS, + (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS])); pmp->pm_inusemap[cn / N_INUSEBITS] &= ~(1U << (cn % N_INUSEBITS)); } @@ -651,7 +653,7 @@ chainlength(struct msdosfsmount *pmp, u_long start, u_ idx = start / N_INUSEBITS; start %= N_INUSEBITS; map = pmp->pm_inusemap[idx]; - map &= ~((1 << start) - 1); + map &= ~((1U << start) - 1); if (map) { len = ffs(map) - 1 - start; len = MIN(len, count); From owner-svn-src-all@freebsd.org Fri Oct 18 08:36:09 2019 Return-Path: Delivered-To: svn-src-all@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 A8C8214A19C; Fri, 18 Oct 2019 08:36:09 +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 46vfWY4040z4JLb; Fri, 18 Oct 2019 08:36:09 +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 6C36D64D2; Fri, 18 Oct 2019 08:36:09 +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 x9I8a9Eg059903; Fri, 18 Oct 2019 08:36:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9I8a9eG059902; Fri, 18 Oct 2019 08:36:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910180836.x9I8a9eG059902@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 18 Oct 2019 08:36:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353720 - stable/12/sys/fs/devfs X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/fs/devfs X-SVN-Commit-Revision: 353720 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 08:36:09 -0000 Author: kib Date: Fri Oct 18 08:36:08 2019 New Revision: 353720 URL: https://svnweb.freebsd.org/changeset/base/353720 Log: MFC r353447: devfs_vptocnp(): correct the component name when node is not at top. Modified: stable/12/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/12/sys/fs/devfs/devfs_vnops.c Fri Oct 18 08:34:52 2019 (r353719) +++ stable/12/sys/fs/devfs/devfs_vnops.c Fri Oct 18 08:36:08 2019 (r353720) @@ -283,38 +283,27 @@ devfs_vptocnp(struct vop_vptocnp_args *ap) if (error != 0) return (error); - i = *buflen; + if (vp->v_type != VCHR && vp->v_type != VDIR) { + error = ENOENT; + goto finished; + } + dd = vp->v_data; + if (vp->v_type == VDIR && dd == dmp->dm_rootdir) { + *dvp = vp; + vref(*dvp); + goto finished; + } - if (vp->v_type == VCHR) { - i -= strlen(dd->de_cdp->cdp_c.si_name); - if (i < 0) { - error = ENOMEM; - goto finished; - } - bcopy(dd->de_cdp->cdp_c.si_name, buf + i, - strlen(dd->de_cdp->cdp_c.si_name)); - de = dd->de_dir; - } else if (vp->v_type == VDIR) { - if (dd == dmp->dm_rootdir) { - *dvp = vp; - vref(*dvp); - goto finished; - } - i -= dd->de_dirent->d_namlen; - if (i < 0) { - error = ENOMEM; - goto finished; - } - bcopy(dd->de_dirent->d_name, buf + i, - dd->de_dirent->d_namlen); - de = dd; - } else { - error = ENOENT; + i = *buflen; + i -= dd->de_dirent->d_namlen; + if (i < 0) { + error = ENOMEM; goto finished; } + bcopy(dd->de_dirent->d_name, buf + i, dd->de_dirent->d_namlen); *buflen = i; - de = devfs_parent_dirent(de); + de = devfs_parent_dirent(dd); if (de == NULL) { error = ENOENT; goto finished; From owner-svn-src-all@freebsd.org Fri Oct 18 08:38:08 2019 Return-Path: Delivered-To: svn-src-all@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 659B814A262; Fri, 18 Oct 2019 08:38: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 46vfYr24KTz4JTX; Fri, 18 Oct 2019 08:38:08 +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 25F6E64D3; Fri, 18 Oct 2019 08:38:08 +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 x9I8c7PT060046; Fri, 18 Oct 2019 08:38:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9I8c7iF060045; Fri, 18 Oct 2019 08:38:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910180838.x9I8c7iF060045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 18 Oct 2019 08:38:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353721 - stable/11/sys/fs/msdosfs X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/fs/msdosfs X-SVN-Commit-Revision: 353721 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 08:38:08 -0000 Author: kib Date: Fri Oct 18 08:38:07 2019 New Revision: 353721 URL: https://svnweb.freebsd.org/changeset/base/353721 Log: MFC r353446: Plug the rest of undef behavior places that were missed in r337456. Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/11/sys/fs/msdosfs/msdosfs_fat.c Fri Oct 18 08:36:08 2019 (r353720) +++ stable/11/sys/fs/msdosfs/msdosfs_fat.c Fri Oct 18 08:38:07 2019 (r353721) @@ -387,9 +387,10 @@ usemap_alloc(struct msdosfsmount *pmp, u_long cn) pmp->pm_maxcluster)); KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0, ("usemap_alloc on ro msdosfs mount")); - KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS))) - == 0, ("Allocating used sector %ld %ld %x", cn, cn % N_INUSEBITS, - (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS])); + KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & + (1U << (cn % N_INUSEBITS))) == 0, + ("Allocating used sector %ld %ld %x", cn, cn % N_INUSEBITS, + (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS])); pmp->pm_inusemap[cn / N_INUSEBITS] |= 1U << (cn % N_INUSEBITS); KASSERT(pmp->pm_freeclustercount > 0, ("usemap_alloc: too little")); pmp->pm_freeclustercount--; @@ -408,9 +409,10 @@ usemap_free(struct msdosfsmount *pmp, u_long cn) ("usemap_free on ro msdosfs mount")); pmp->pm_freeclustercount++; pmp->pm_flags |= MSDOSFS_FSIMOD; - KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS))) - != 0, ("Freeing unused sector %ld %ld %x", cn, cn % N_INUSEBITS, - (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS])); + KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & + (1U << (cn % N_INUSEBITS))) != 0, + ("Freeing unused sector %ld %ld %x", cn, cn % N_INUSEBITS, + (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS])); pmp->pm_inusemap[cn / N_INUSEBITS] &= ~(1U << (cn % N_INUSEBITS)); } @@ -649,7 +651,7 @@ chainlength(struct msdosfsmount *pmp, u_long start, u_ idx = start / N_INUSEBITS; start %= N_INUSEBITS; map = pmp->pm_inusemap[idx]; - map &= ~((1 << start) - 1); + map &= ~((1U << start) - 1); if (map) { len = ffs(map) - 1 - start; len = MIN(len, count); From owner-svn-src-all@freebsd.org Fri Oct 18 08:39:11 2019 Return-Path: Delivered-To: svn-src-all@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 9515914A2F2; Fri, 18 Oct 2019 08:39:11 +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 46vfb32SF4z4JcW; Fri, 18 Oct 2019 08:39:11 +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 3804064D5; Fri, 18 Oct 2019 08:39:11 +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 x9I8dBPG060147; Fri, 18 Oct 2019 08:39:11 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9I8dBuY060146; Fri, 18 Oct 2019 08:39:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910180839.x9I8dBuY060146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 18 Oct 2019 08:39:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353722 - stable/11/sys/fs/devfs X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/fs/devfs X-SVN-Commit-Revision: 353722 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 08:39:11 -0000 Author: kib Date: Fri Oct 18 08:39:10 2019 New Revision: 353722 URL: https://svnweb.freebsd.org/changeset/base/353722 Log: MFC r353447: devfs_vptocnp(): correct the component name when node is not at top. Modified: stable/11/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/11/sys/fs/devfs/devfs_vnops.c Fri Oct 18 08:38:07 2019 (r353721) +++ stable/11/sys/fs/devfs/devfs_vnops.c Fri Oct 18 08:39:10 2019 (r353722) @@ -280,38 +280,27 @@ devfs_vptocnp(struct vop_vptocnp_args *ap) if (error != 0) return (error); - i = *buflen; + if (vp->v_type != VCHR && vp->v_type != VDIR) { + error = ENOENT; + goto finished; + } + dd = vp->v_data; + if (vp->v_type == VDIR && dd == dmp->dm_rootdir) { + *dvp = vp; + vref(*dvp); + goto finished; + } - if (vp->v_type == VCHR) { - i -= strlen(dd->de_cdp->cdp_c.si_name); - if (i < 0) { - error = ENOMEM; - goto finished; - } - bcopy(dd->de_cdp->cdp_c.si_name, buf + i, - strlen(dd->de_cdp->cdp_c.si_name)); - de = dd->de_dir; - } else if (vp->v_type == VDIR) { - if (dd == dmp->dm_rootdir) { - *dvp = vp; - vref(*dvp); - goto finished; - } - i -= dd->de_dirent->d_namlen; - if (i < 0) { - error = ENOMEM; - goto finished; - } - bcopy(dd->de_dirent->d_name, buf + i, - dd->de_dirent->d_namlen); - de = dd; - } else { - error = ENOENT; + i = *buflen; + i -= dd->de_dirent->d_namlen; + if (i < 0) { + error = ENOMEM; goto finished; } + bcopy(dd->de_dirent->d_name, buf + i, dd->de_dirent->d_namlen); *buflen = i; - de = devfs_parent_dirent(de); + de = devfs_parent_dirent(dd); if (de == NULL) { error = ENOENT; goto finished; From owner-svn-src-all@freebsd.org Fri Oct 18 09:09:33 2019 Return-Path: Delivered-To: svn-src-all@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 A92C214B17C; Fri, 18 Oct 2019 09:09:33 +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 46vgG53vTmz4L8W; Fri, 18 Oct 2019 09:09:33 +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 690C26A1B; Fri, 18 Oct 2019 09:09:33 +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 x9I99XvB077826; Fri, 18 Oct 2019 09:09:33 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9I99XdC077825; Fri, 18 Oct 2019 09:09:33 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201910180909.x9I99XdC077825@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 18 Oct 2019 09:09:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353723 - stable/12/sbin/ipfw X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/12/sbin/ipfw X-SVN-Commit-Revision: 353723 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 09:09:33 -0000 Author: ae Date: Fri Oct 18 09:09:32 2019 New Revision: 353723 URL: https://svnweb.freebsd.org/changeset/base/353723 Log: MFC r353545: Explicitly initialize the memory buffer to store O_ICMP6TYPE opcode. By default next_cmd() initializes only first u32 of opcode. O_ICMP6TYPE opcode has array of bit masks to store corresponding ICMPv6 types. An opcode that precedes O_ICMP6TYPE, e.g. O_IP6_DST, can have variable length and during opcode filling it can modify memory that will be used by O_ICMP6TYPE opcode. Without explicit initialization this leads to creation of wrong opcode. Reported by: Boris N. Lytochkin Obtained from: Yandex LLC Modified: stable/12/sbin/ipfw/ipv6.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ipfw/ipv6.c ============================================================================== --- stable/12/sbin/ipfw/ipv6.c Fri Oct 18 08:39:10 2019 (r353722) +++ stable/12/sbin/ipfw/ipv6.c Fri Oct 18 09:09:32 2019 (r353723) @@ -143,6 +143,7 @@ fill_icmp6types(ipfw_insn_icmp6 *cmd, char *av, int cb uint8_t type; CHECK_LENGTH(cblen, F_INSN_SIZE(ipfw_insn_icmp6)); + memset(cmd, 0, sizeof(*cmd)); while (*av) { if (*av == ',') av++; From owner-svn-src-all@freebsd.org Fri Oct 18 10:26:23 2019 Return-Path: Delivered-To: svn-src-all@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 F056214C896; Fri, 18 Oct 2019 10:26:23 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46vhyl04wKz4PQt; Fri, 18 Oct 2019 10:26:22 +0000 (UTC) (envelope-from ohartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1571394379; bh=IwIVUtUT4FmVdQwwFKJlmAMTuyQyacBBho1pVtwy54A=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=l1xS3HWyPLbPPqPtv2al0TaU63Xc7/VMQU836sgSnoh2y6QamTjo6iQr+aNTq5jvw EIVqum+yqkUgo577TYDT0QCdYiMHJ8N4BuDqeBsAUxhFe25cvonwOad5EtYcVg32hW JQFR1IXlAPeGD4E+EX5rhkZvzixnWrEdh+6ALnlU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermann.fritz.box ([91.65.85.161]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MFKGZ-1iEYpH0wHp-00FlLh; Fri, 18 Oct 2019 12:21:14 +0200 Date: Fri, 18 Oct 2019 12:21:04 +0200 From: "Hartmann, O." To: Conrad Meyer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys Message-ID: <20191018122104.389ffb7a@hermann.fritz.box> In-Reply-To: <201910172133.x9HLX1kl071044@repo.freebsd.org> References: <201910172133.x9HLX1kl071044@repo.freebsd.org> Organization: walstatt.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/Y2gjt=bMes0nx.KMhlJv2oM"; protocol="application/pgp-signature" X-Provags-ID: V03:K1:iBcBTqOmxloBk/cFhXtyyCwdHIMOj/wPkh8NweFa8kKMHtBetn9 HOwSsnFzihidUY0+9V49gNwPimQ0xihKfRxGkESy1P2l2f/y6/9tscOlE2vZlBMLdjrlBGo on+puYdO6TVKdvG8dSwW8cDsvEz7spYzsrXMRfVSWnyQQLpHxlt0JYRspqwK1quSzm2QjoD LWhTBvqdGFKuTRXyrVISg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:PbU/pB9sUMI=:TdiVD51qOESMleQZ7g5PZl hM6L9WaNV0ZV6AXjZf+lTRT2Xi4cq2TNGEi9UYifIFsUp6INRv/Ugw9SYikBN8NLzz8qIDX7Z T/ueAJiQqZHOFqXBjui6sG2x0tluzr3VADN+vf7mmxnBK9adXnKKh7V2SWQB7mkmMllkGyJiQ XrFAzu9YNVEfdIJkgonEkhxYxtFflFjEE0nCVZ5Bl/n6Ptx84k7n3cTJ6krXYisJZiAxE7WAS qg8hnNQMhC2df/JOtNaXwUWWsOzwD0jHXKVQuRm6mHyfynMjiUX1RqcJDNyX7PjnO3rv7WWYq BW64PglDCP2fljUQVGOL4+tFHoB3hzxPihWbF/l/DA8a2xJ6h1tok/gGp6iKC1aBY0+W9TSvO O+QSgrlRenAlDjqoy/k9MKo8Qn+qD+8cJNcN6JZd00d91/8OuI14qFkQuLrw6wEuUIUCt2bZU Qa3lGfAcTsrJSeB4mYreoF0Q4x/gBYtUDYQP+dJ370SolLCnOyl8Rze6EOxS+yNLFW8nJpA3H a0oDTfqkErLzCfOVfRCXzifT9RdXqp/tyNn8lqcPWsQO7DXlNkbhY5/wxMPkTwCiueiiomwHX 79aL33OMPBVDv1TS3lF3LeG9L7eIycC9AbK5V0sp0HAlRF1xh/5OETe3ptKn14741JllYQGTq kfytWbnUnWIZiJeDDZQ/hhMn7wgDfFaizxaczQ/IOVrGuT+l1dj6RH74TqWN/Is8hcuYdIxoc B02duXFNqvaXrur5E0++19RIp3Wtu31rR+OxjRLCDMPt4NhJbkxBVj1QuYpY/Ti5+4FazQHsU BTvJ+FZnt2fDzio7dwzEc6QU80DaoZTHXrkbrMLAMtREAwWgTTv90rRoipuJdqz084x1/ztq4 jioiNp83ycdIo1J+eVyp2tdxT9OLwidXp0acB7JTCobVz17rlfRt9TlnAWltWHp6SY8ke9dHd MNSznYeas+N7+pAj4YzokpPp14jd4NvYUw2/NTmcg0GaR7YK84PTH4DeeekPcPnu6Ymctvfk8 UY2eTV3/Qt3eGpPUUJ84PhxZSPIMw+wZH2VSQjk8YaqZjBsookeo1eiUbjfpK07v1dowlw+4C YkfJtfogpOliqx2UL/JABuno8TH1sNJGin28mR2cRa6ngTz9LThFKoDWbWx9Dr+WIt1iqvXLH gYYIvLjsLIjVE/eyc3Mv9ydjOeTmCVrLxW8HAZXOZDPk0vr5QjDsZONtCnnJuYN9J9fWKyeFP j2E6jqH4014+PGGakA5pHN9iHPpC8oL2AJNrp8wkDC/qHq/3mDHgkPkOQ3lg= X-Rspamd-Queue-Id: 46vhyl04wKz4PQt X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.b=l1xS3HWy; dmarc=none; spf=none (mx1.freebsd.org: domain of ohartmann@walstatt.org has no SPF policy when checking 212.227.15.19) smtp.mailfrom=ohartmann@walstatt.org X-Spamd-Result: default: False [-5.58 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmx.net:s=badeba3b8450]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[walstatt.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; HAS_ORG_HEADER(0.00)[]; DKIM_TRACE(0.00)[gmx.net:+]; RCVD_IN_DNSWL_NONE(0.00)[19.15.227.212.list.dnswl.org : 127.0.3.0]; R_SPF_NA(0.00)[]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-1.18)[ip: (-6.55), ipnet: 212.227.0.0/16(-1.34), asn: 8560(2.00), country: DE(-0.01)]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[161.85.65.91.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 10:26:24 -0000 --Sig_/Y2gjt=bMes0nx.KMhlJv2oM Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Thu, 17 Oct 2019 21:33:01 +0000 (UTC) Conrad Meyer wrote: > Author: cem > Date: Thu Oct 17 21:33:01 2019 > New Revision: 353700 > URL: https://svnweb.freebsd.org/changeset/base/353700 >=20 > Log: > Implement NetGDB(4) > =20 > NetGDB(4) is a component of a system using a panic-time network > stack to remotely debug crashed FreeBSD kernels over the network, > instead of traditional serial interfaces. > =20 > There are three pieces in the complete NetGDB system. > =20 > First, a dedicated proxy server must be running to accept > connections from both NetGDB and gdb(1), and pass bidirectional > traffic between the two protocols. > =20 > Second, the NetGDB client is activated much like ordinary 'gdb' and > similarly to 'netdump' in ddb(4) after a panic. Like other > debugnet(4) clients (netdump(4)), the network interface on the route > to the proxy server must be online and support debugnet(4). > =20 > Finally, the remote (k)gdb(1) uses 'target remote :' > (like any other TCP remote) to connect to the proxy server. > =20 > The NetGDB v1 protocol speaks the literal GDB remote serial > protocol, and uses a 1:1 relationship between GDB packets and > sequences of debugnet packets (fragmented by MTU). There is no > encryption utilized to keep debugging sessions private, so this is > only appropriate for local segments or trusted networks. > =20 > Submitted by: John Reimer (earlier > version) Discussed some with: emaste, markj > Relnotes: sure > Differential Revision: https://reviews.freebsd.org/D21568 >=20 > Added: > head/share/man/man4/netgdb.4 (contents, props changed) > head/sys/gdb/netgdb.c (contents, props changed) > head/sys/gdb/netgdb.h (contents, props changed) > Modified: > head/share/man/man4/Makefile > head/share/man/man4/ddb.4 > head/sys/amd64/conf/GENERIC > head/sys/conf/NOTES > head/sys/conf/files > head/sys/conf/options > head/sys/gdb/gdb.h > head/sys/gdb/gdb_int.h > head/sys/gdb/gdb_main.c > head/sys/gdb/gdb_packet.c > head/sys/i386/conf/GENERIC > head/sys/kern/subr_kdb.c > head/sys/net/debugnet.c > head/sys/net/debugnet.h > head/sys/net/debugnet_inet.c > head/sys/net/debugnet_int.h > head/sys/sys/kdb.h > head/sys/sys/param.h >=20 > Modified: head/share/man/man4/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/share/man/man4/Makefile Thu Oct 17 21:25:50 > 2019 (r353699) +++ head/share/man/man4/Makefile Thu Oct > 17 21:33:01 2019 (r353700) @@ -307,6 +307,7 @@ MAN=3D > aac.4 \ net80211.4 \ > netdump.4 \ > netfpga10g_nf10bmac.4 \ > + netgdb.4 \ > netgraph.4 \ > netintro.4 \ > netmap.4 \ >=20 [...] Having "nooptions NETGDB # netgdb(4) client support" defined in my kernel config file, buildkernel fails with the error shown below. [...] --- debugnet.o --- /usr/src/sys/net/debugnet.c:662:4: error: implicit declaration of function 'db_printf' is invalid in C99 [-Werror,-Wimplicit-function-declaration] db_printf("%s: Could not get route for that server.\n", ^ /usr/src/sys/net/debugnet.c:662:4: note: did you mean 'if_printf'? /usr/src/sys/net/if_var.h:679:5: note: 'if_printf' declared here int if_printf(struct ifnet *, const char *, ...) __printflike(2, 3); ^ 1 error generated. --Sig_/Y2gjt=bMes0nx.KMhlJv2oM Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQSy8IBxAPDkqVBaTJ44N1ZZPba5RwUCXamSEAAKCRA4N1ZZPba5 R2g1APsFaVSlvFoAYQj9cVc9ODLVlsVFCQp6PhVr0uyhyDVOowEA6OiM6vttm1ku Fv44ybhnNjqJnGtuLL8qJy8sjyhkEAY= =N8pF -----END PGP SIGNATURE----- --Sig_/Y2gjt=bMes0nx.KMhlJv2oM-- From owner-svn-src-all@freebsd.org Fri Oct 18 10:28:10 2019 Return-Path: Delivered-To: svn-src-all@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 0DFE514C950; Fri, 18 Oct 2019 10:28:10 +0000 (UTC) (envelope-from yuripv@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 46vj0n4w97z4PZ6; Fri, 18 Oct 2019 10:28:09 +0000 (UTC) (envelope-from yuripv@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 87D577876; Fri, 18 Oct 2019 10:28:09 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9IAS9EO024673; Fri, 18 Oct 2019 10:28:09 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9IAS8Du024670; Fri, 18 Oct 2019 10:28:08 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201910181028.x9IAS8Du024670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Fri, 18 Oct 2019 10:28:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353724 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 353724 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 10:28:10 -0000 Author: yuripv Date: Fri Oct 18 10:28:08 2019 New Revision: 353724 URL: https://svnweb.freebsd.org/changeset/base/353724 Log: linux: provide just one instance of futex_list Move futex_list definition to linux.c which is included once in linux.ko (i386) and in linux_common.ko (amd64 and aarch64) allowing 32/64 bit linux programs to access the same futexes in the latter case. PR: 240989 Reviewed by: dchagin Differential Revision: https://reviews.freebsd.org/D22073 Modified: head/sys/compat/linux/linux.c head/sys/compat/linux/linux.h head/sys/compat/linux/linux_futex.c head/sys/compat/linux/linux_futex.h Modified: head/sys/compat/linux/linux.c ============================================================================== --- head/sys/compat/linux/linux.c Fri Oct 18 09:09:32 2019 (r353723) +++ head/sys/compat/linux/linux.c Fri Oct 18 10:28:08 2019 (r353724) @@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$"); #include #include +struct futex_list futex_list; + CTASSERT(LINUX_IFNAMSIZ == IFNAMSIZ); static int bsd_to_linux_sigtbl[LINUX_SIGTBLSZ] = { Modified: head/sys/compat/linux/linux.h ============================================================================== --- head/sys/compat/linux/linux.h Fri Oct 18 09:09:32 2019 (r353723) +++ head/sys/compat/linux/linux.h Fri Oct 18 10:28:08 2019 (r353724) @@ -140,4 +140,6 @@ void bsd_to_linux_sigset(sigset_t *, l_sigset_t *); int linux_to_bsd_signal(int sig); int bsd_to_linux_signal(int sig); +extern LIST_HEAD(futex_list, futex) futex_list; + #endif /* _LINUX_MI_H_ */ Modified: head/sys/compat/linux/linux_futex.c ============================================================================== --- head/sys/compat/linux/linux_futex.c Fri Oct 18 09:09:32 2019 (r353723) +++ head/sys/compat/linux/linux_futex.c Fri Oct 18 10:28:08 2019 (r353724) @@ -207,8 +207,6 @@ struct futex { TAILQ_HEAD(lf_waiting_proc, waiting_proc) f_waiting_proc; }; -struct futex_list futex_list; - #define FUTEX_LOCK(f) mtx_lock(&(f)->f_lck) #define FUTEX_LOCKED(f) mtx_owned(&(f)->f_lck) #define FUTEX_UNLOCK(f) mtx_unlock(&(f)->f_lck) Modified: head/sys/compat/linux/linux_futex.h ============================================================================== --- head/sys/compat/linux/linux_futex.h Fri Oct 18 09:09:32 2019 (r353723) +++ head/sys/compat/linux/linux_futex.h Fri Oct 18 10:28:08 2019 (r353724) @@ -38,7 +38,6 @@ #ifndef _LINUX_FUTEX_H #define _LINUX_FUTEX_H -extern LIST_HEAD(futex_list, futex) futex_list; extern struct mtx futex_mtx; #define LINUX_FUTEX_WAIT 0 From owner-svn-src-all@freebsd.org Fri Oct 18 12:00:50 2019 Return-Path: Delivered-To: svn-src-all@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 6E95114E595; Fri, 18 Oct 2019 12:00:50 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) (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 46vl3h6HM7z4TVX; Fri, 18 Oct 2019 12:00:48 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: by mail-wr1-x441.google.com with SMTP id l10so5556022wrb.2; Fri, 18 Oct 2019 05:00:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=Fb3Qby4PLx8rMvhIkir0Z7U7ySyaF0qbX9sSKBCVSdg=; b=e51OOWw0OjumnJ6TUyG9xC1zLFv5Fj8gRnIyJW7CdrKpSL/Q6CeYSYr2fMhRAYvy5I 5jlu6K59HiojaRn1PPtU4nbLUjZBOaxYQpvF5nHx00E0jRDXHM25EYyS88nU3YQ9RB27 zF8a72zvzkrbSnC5Hoz2D/R9WCzEVBXmR6SZgFOJsJRrQaU8IJkIgiUD7fw+6T2XsKx+ tX0VRQKx2Wnxy2feOpB2RKittIH/zCN2UUbBs0Hm3GlEriU6naKKkoClcHGB9f9PLeZ4 BVFwN0HrsIux1+3FDQGP6eklDvxKHE9pQpsDYwzZpj8E7PycqZJTgZ83Mv/WyUpTxV8+ hh6A== 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:cc:subject:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=Fb3Qby4PLx8rMvhIkir0Z7U7ySyaF0qbX9sSKBCVSdg=; b=JdYInxsf+gwHNFZdqsKJeG38bj0pb/B/6Dv2dTWSv/O52/r00+UMqCBlO7FtIW+X0x OH863dN6qbXdpjFfSNpjguLWh0X/LSj4wKafhouMqfWpox1gqk2kU3Pmi47wYkdU2QwF 59DxbSZssm4r1rhC4N7PgK3juHFjBaS2j7u04kfRZn4ywgerE3iTudO+lJeNnHpPUWlb vPSXalTt8RcfPusBkPn6GdLEeitovxnrDNqjwz2A7Vo74j1SOatgV5+pgbfwefnQ7pDR WVAWAvlE7t6b2DkPTTecHMdwYzr7luovUTUQRScPf54TE53rdHNKmQ6W+cDbZ9N7XWU+ SjHw== X-Gm-Message-State: APjAAAW/2Y3sNrCWbhDp5J2vpSee7qBbZQ2qWp9psQ5anECvDGYUAQCU 1UTpM9jF/OMVhbliOmb3v5M= X-Google-Smtp-Source: APXvYqxMBD7EEQ2HfDbAmiPwY/BPPtFGQ0N4zYP2BfjEkG+Ra8AX0Ju4WvuHIkzS4kgtHWqxfsE2+Q== X-Received: by 2002:adf:dec9:: with SMTP id i9mr7274662wrn.230.1571400047041; Fri, 18 Oct 2019 05:00:47 -0700 (PDT) Received: from ernst.home (p5B3BE71A.dip0.t-ipconnect.de. [91.59.231.26]) by smtp.gmail.com with ESMTPSA id p12sm5866552wrm.62.2019.10.18.05.00.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 05:00:46 -0700 (PDT) Date: Fri, 18 Oct 2019 14:00:45 +0200 From: Gary Jennejohn To: "Hartmann, O." Cc: Conrad Meyer , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys Message-ID: <20191018140045.31d269b0@ernst.home> In-Reply-To: <20191018122104.389ffb7a@hermann.fritz.box> References: <201910172133.x9HLX1kl071044@repo.freebsd.org> <20191018122104.389ffb7a@hermann.fritz.box> Reply-To: gljennjohn@gmail.com X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46vl3h6HM7z4TVX X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=e51OOWw0; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of gljennjohn@gmail.com designates 2a00:1450:4864:20::441 as permitted sender) smtp.mailfrom=gljennjohn@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[gljennjohn@gmail.com]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RECEIVED_SPAMHAUS_PBL(0.00)[26.231.59.91.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/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_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; FREEMAIL_REPLYTO(0.00)[gmail.com]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[1.4.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; IP_SCORE(0.00)[ip: (2.77), ipnet: 2a00:1450::/32(-2.84), asn: 15169(-2.09), country: US(-0.05)]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 12:00:50 -0000 On Fri, 18 Oct 2019 12:21:04 +0200 "Hartmann, O." wrote: > On Thu, 17 Oct 2019 21:33:01 +0000 (UTC) > Conrad Meyer wrote: > > > Author: cem > > Date: Thu Oct 17 21:33:01 2019 > > New Revision: 353700 > > URL: https://svnweb.freebsd.org/changeset/base/353700 > > > > Log: > > Implement NetGDB(4) > > > > NetGDB(4) is a component of a system using a panic-time network > > stack to remotely debug crashed FreeBSD kernels over the network, > > instead of traditional serial interfaces. > > > > There are three pieces in the complete NetGDB system. > > > > First, a dedicated proxy server must be running to accept > > connections from both NetGDB and gdb(1), and pass bidirectional > > traffic between the two protocols. > > > > Second, the NetGDB client is activated much like ordinary 'gdb' and > > similarly to 'netdump' in ddb(4) after a panic. Like other > > debugnet(4) clients (netdump(4)), the network interface on the route > > to the proxy server must be online and support debugnet(4). > > > > Finally, the remote (k)gdb(1) uses 'target remote :' > > (like any other TCP remote) to connect to the proxy server. > > > > The NetGDB v1 protocol speaks the literal GDB remote serial > > protocol, and uses a 1:1 relationship between GDB packets and > > sequences of debugnet packets (fragmented by MTU). There is no > > encryption utilized to keep debugging sessions private, so this is > > only appropriate for local segments or trusted networks. > > > > Submitted by: John Reimer (earlier > > version) Discussed some with: emaste, markj > > Relnotes: sure > > Differential Revision: https://reviews.freebsd.org/D21568 > > > > Added: > > head/share/man/man4/netgdb.4 (contents, props changed) > > head/sys/gdb/netgdb.c (contents, props changed) > > head/sys/gdb/netgdb.h (contents, props changed) > > Modified: > > head/share/man/man4/Makefile > > head/share/man/man4/ddb.4 > > head/sys/amd64/conf/GENERIC > > head/sys/conf/NOTES > > head/sys/conf/files > > head/sys/conf/options > > head/sys/gdb/gdb.h > > head/sys/gdb/gdb_int.h > > head/sys/gdb/gdb_main.c > > head/sys/gdb/gdb_packet.c > > head/sys/i386/conf/GENERIC > > head/sys/kern/subr_kdb.c > > head/sys/net/debugnet.c > > head/sys/net/debugnet.h > > head/sys/net/debugnet_inet.c > > head/sys/net/debugnet_int.h > > head/sys/sys/kdb.h > > head/sys/sys/param.h > > > > Modified: head/share/man/man4/Makefile > > ============================================================================== > > --- head/share/man/man4/Makefile Thu Oct 17 21:25:50 > > 2019 (r353699) +++ head/share/man/man4/Makefile Thu Oct > > 17 21:33:01 2019 (r353700) @@ -307,6 +307,7 @@ MAN= > > aac.4 \ net80211.4 \ > > netdump.4 \ > > netfpga10g_nf10bmac.4 \ > > + netgdb.4 \ > > netgraph.4 \ > > netintro.4 \ > > netmap.4 \ > > > [...] > > > Having "nooptions NETGDB # netgdb(4) client support" > defined in my kernel config file, buildkernel fails with the error > shown below. > > [...] > --- debugnet.o --- > /usr/src/sys/net/debugnet.c:662:4: error: implicit declaration of > function 'db_printf' is invalid in C99 > [-Werror,-Wimplicit-function-declaration] db_printf("%s: Could not get > route for that server.\n", ^ /usr/src/sys/net/debugnet.c:662:4: note: > did you mean 'if_printf'? /usr/src/sys/net/if_var.h:679:5: note: > 'if_printf' declared here int if_printf(struct ifnet *, const char > *, ...) __printflike(2, 3); ^ > 1 error generated. And I also had to add "nooptions NETDUMP" to get the kernel to compile and link. -- Gary Jennejohn From owner-svn-src-all@freebsd.org Fri Oct 18 12:25:35 2019 Return-Path: Delivered-To: svn-src-all@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 9874514F53A; Fri, 18 Oct 2019 12:25:35 +0000 (UTC) (envelope-from yuripv@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 46vlcH27Ltz4Vqm; Fri, 18 Oct 2019 12:25:35 +0000 (UTC) (envelope-from yuripv@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 293478E4D; Fri, 18 Oct 2019 12:25:35 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9ICPZPa094665; Fri, 18 Oct 2019 12:25:35 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ICPX4t094655; Fri, 18 Oct 2019 12:25:33 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201910181225.x9ICPX4t094655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Fri, 18 Oct 2019 12:25:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353725 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Commit-Revision: 353725 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 12:25:35 -0000 Author: yuripv Date: Fri Oct 18 12:25:33 2019 New Revision: 353725 URL: https://svnweb.freebsd.org/changeset/base/353725 Log: linux: futex_mtx should follow futex_list Move futex_mtx to linux_common.ko for amd64 and aarch64 along with respective list/mutex init/destroy. PR: 240989 Reported by: Alex S Modified: head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/arm64/linux/linux_sysvec.c head/sys/compat/linux/linux.c head/sys/compat/linux/linux.h head/sys/compat/linux/linux_common.c head/sys/compat/linux/linux_futex.c head/sys/compat/linux/linux_futex.h head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Fri Oct 18 10:28:08 2019 (r353724) +++ head/sys/amd64/linux/linux_sysvec.c Fri Oct 18 12:25:33 2019 (r353725) @@ -75,7 +75,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -865,8 +864,6 @@ linux64_elf_modevent(module_t mod, int type, void *dat if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux_ioctl_register_handler(*lihp); - LIST_INIT(&futex_list); - mtx_init(&futex_mtx, "ftllk64", NULL, MTX_DEF); stclohz = (stathz ? stathz : hz); if (bootverbose) printf("Linux x86-64 ELF exec handler installed\n"); @@ -887,7 +884,6 @@ linux64_elf_modevent(module_t mod, int type, void *dat if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux_ioctl_unregister_handler(*lihp); - mtx_destroy(&futex_mtx); if (bootverbose) printf("Linux ELF exec handler removed\n"); } else Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Fri Oct 18 10:28:08 2019 (r353724) +++ head/sys/amd64/linux32/linux32_sysvec.c Fri Oct 18 12:25:33 2019 (r353725) @@ -81,7 +81,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -1023,8 +1022,6 @@ linux_elf_modevent(module_t mod, int type, void *data) if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux32_ioctl_register_handler(*lihp); - LIST_INIT(&futex_list); - mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF); stclohz = (stathz ? stathz : hz); if (bootverbose) printf("Linux ELF exec handler installed\n"); @@ -1045,7 +1042,6 @@ linux_elf_modevent(module_t mod, int type, void *data) if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux32_ioctl_unregister_handler(*lihp); - mtx_destroy(&futex_mtx); if (bootverbose) printf("Linux ELF exec handler removed\n"); } else Modified: head/sys/arm64/linux/linux_sysvec.c ============================================================================== --- head/sys/arm64/linux/linux_sysvec.c Fri Oct 18 10:28:08 2019 (r353724) +++ head/sys/arm64/linux/linux_sysvec.c Fri Oct 18 12:25:33 2019 (r353725) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -494,8 +493,6 @@ linux64_elf_modevent(module_t mod, int type, void *dat if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux_ioctl_register_handler(*lihp); - LIST_INIT(&futex_list); - mtx_init(&futex_mtx, "ftllk64", NULL, MTX_DEF); stclohz = (stathz ? stathz : hz); if (bootverbose) printf("Linux arm64 ELF exec handler installed\n"); @@ -515,7 +512,6 @@ linux64_elf_modevent(module_t mod, int type, void *dat if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux_ioctl_unregister_handler(*lihp); - mtx_destroy(&futex_mtx); if (bootverbose) printf("Linux ELF exec handler removed\n"); } else Modified: head/sys/compat/linux/linux.c ============================================================================== --- head/sys/compat/linux/linux.c Fri Oct 18 10:28:08 2019 (r353724) +++ head/sys/compat/linux/linux.c Fri Oct 18 12:25:33 2019 (r353725) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include struct futex_list futex_list; +struct mtx futex_mtx; /* protects the futex list */ CTASSERT(LINUX_IFNAMSIZ == IFNAMSIZ); Modified: head/sys/compat/linux/linux.h ============================================================================== --- head/sys/compat/linux/linux.h Fri Oct 18 10:28:08 2019 (r353724) +++ head/sys/compat/linux/linux.h Fri Oct 18 12:25:33 2019 (r353725) @@ -141,5 +141,6 @@ int linux_to_bsd_signal(int sig); int bsd_to_linux_signal(int sig); extern LIST_HEAD(futex_list, futex) futex_list; +extern struct mtx futex_mtx; #endif /* _LINUX_MI_H_ */ Modified: head/sys/compat/linux/linux_common.c ============================================================================== --- head/sys/compat/linux/linux_common.c Fri Oct 18 10:28:08 2019 (r353724) +++ head/sys/compat/linux/linux_common.c Fri Oct 18 12:25:33 2019 (r353725) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -76,11 +77,14 @@ linux_common_modevent(module_t mod, int type, void *da linux_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); SET_FOREACH(ldhp, linux_device_handler_set) linux_device_register_handler(*ldhp); + LIST_INIT(&futex_list); + mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF); break; case MOD_UNLOAD: linux_osd_jail_deregister(); SET_FOREACH(ldhp, linux_device_handler_set) linux_device_unregister_handler(*ldhp); + mtx_destroy(&futex_mtx); EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag); EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag); EVENTHANDLER_DEREGISTER(thread_dtor, linux_thread_dtor_tag); Modified: head/sys/compat/linux/linux_futex.c ============================================================================== --- head/sys/compat/linux/linux_futex.c Fri Oct 18 10:28:08 2019 (r353724) +++ head/sys/compat/linux/linux_futex.c Fri Oct 18 12:25:33 2019 (r353725) @@ -224,7 +224,6 @@ struct futex { #define FUTEX_ASSERT_LOCKED(f) mtx_assert(&(f)->f_lck, MA_OWNED) #define FUTEX_ASSERT_UNLOCKED(f) mtx_assert(&(f)->f_lck, MA_NOTOWNED) -struct mtx futex_mtx; /* protects the futex list */ #define FUTEXES_LOCK do { \ mtx_lock(&futex_mtx); \ LIN_SDT_PROBE1(locks, futex_mtx, \ Modified: head/sys/compat/linux/linux_futex.h ============================================================================== --- head/sys/compat/linux/linux_futex.h Fri Oct 18 10:28:08 2019 (r353724) +++ head/sys/compat/linux/linux_futex.h Fri Oct 18 12:25:33 2019 (r353725) @@ -38,8 +38,6 @@ #ifndef _LINUX_FUTEX_H #define _LINUX_FUTEX_H -extern struct mtx futex_mtx; - #define LINUX_FUTEX_WAIT 0 #define LINUX_FUTEX_WAKE 1 #define LINUX_FUTEX_FD 2 /* unused */ Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Fri Oct 18 10:28:08 2019 (r353724) +++ head/sys/i386/linux/linux_sysvec.c Fri Oct 18 12:25:33 2019 (r353725) @@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include From owner-svn-src-all@freebsd.org Fri Oct 18 12:32:02 2019 Return-Path: Delivered-To: svn-src-all@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 C85A414F98B; Fri, 18 Oct 2019 12:32:02 +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 46vllk4s8kz4WNS; Fri, 18 Oct 2019 12:32:02 +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 8B3188EE0; Fri, 18 Oct 2019 12:32:02 +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 x9ICW2Ne000261; Fri, 18 Oct 2019 12:32:02 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ICW25R000259; Fri, 18 Oct 2019 12:32:02 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910181232.x9ICW25R000259@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 18 Oct 2019 12:32:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353726 - in head: sbin/ddb share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head: sbin/ddb share/man/man4 X-SVN-Commit-Revision: 353726 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 12:32:02 -0000 Author: avg Date: Fri Oct 18 12:32:01 2019 New Revision: 353726 URL: https://svnweb.freebsd.org/changeset/base/353726 Log: ddb: use 'textdump dump' instead of 'call doadump' The change is for the example in textdump.4 and the default ddb.conf. First of all, doadump now requires an argument and it won't do a textdump if the argument is not 'true'. And 'textdump dump' is more idiomatic anyway. For what it's worth, ddb 'dump' command seems to always request a vmcore dump even if a textdump was requested earlier, e.g., by 'textdump set'. Finally, ddb 'call' command is not documented. MFC after: 2 weeks Modified: head/sbin/ddb/ddb.conf head/share/man/man4/textdump.4 Modified: head/sbin/ddb/ddb.conf ============================================================================== --- head/sbin/ddb/ddb.conf Fri Oct 18 12:25:33 2019 (r353725) +++ head/sbin/ddb/ddb.conf Fri Oct 18 12:32:01 2019 (r353726) @@ -9,7 +9,7 @@ script lockinfo=show locks; show alllocks; show lockedvnods # kdb.enter.panic panic(9) was called. -script kdb.enter.panic=textdump set; capture on; run lockinfo; show pcpu; bt; ps; alltrace; capture off; call doadump; reset +script kdb.enter.panic=textdump set; capture on; run lockinfo; show pcpu; bt; ps; alltrace; capture off; textdump dump; reset # kdb.enter.witness witness(4) detected a locking error. script kdb.enter.witness=run lockinfo Modified: head/share/man/man4/textdump.4 ============================================================================== --- head/share/man/man4/textdump.4 Fri Oct 18 12:25:33 2019 (r353725) +++ head/share/man/man4/textdump.4 Fri Oct 18 12:32:01 2019 (r353726) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 30, 2018 +.Dd October 18, 2019 .Dt TEXTDUMP 4 .Os .Sh NAME @@ -162,7 +162,7 @@ invoke panic in order to force a kernel dump to be wri reboot: .Bd -literal -offset indent script kdb.enter.panic=textdump set; capture on; show allpcpu; bt; - ps; alltrace; show alllocks; call doadump; reset + ps; alltrace; show alllocks; textdump dump; reset .Ed .Pp In the following example, the script From owner-svn-src-all@freebsd.org Fri Oct 18 12:34:31 2019 Return-Path: Delivered-To: svn-src-all@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 A3FD614FB15; Fri, 18 Oct 2019 12:34:31 +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 46vlpb3pCgz4WZb; Fri, 18 Oct 2019 12:34:31 +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 6713C9023; Fri, 18 Oct 2019 12:34:31 +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 x9ICYVeq000421; Fri, 18 Oct 2019 12:34:31 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ICYVKb000420; Fri, 18 Oct 2019 12:34:31 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910181234.x9ICYVKb000420@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 18 Oct 2019 12:34:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353727 - head/sys/dev/gpio X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/gpio X-SVN-Commit-Revision: 353727 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 12:34:31 -0000 Author: avg Date: Fri Oct 18 12:34:30 2019 New Revision: 353727 URL: https://svnweb.freebsd.org/changeset/base/353727 Log: gpioiic: add the detach method bus_generic_detach was not enough, we also need to clean up the iicbus child device. MFC after: 1 week Modified: head/sys/dev/gpio/gpioiic.c Modified: head/sys/dev/gpio/gpioiic.c ============================================================================== --- head/sys/dev/gpio/gpioiic.c Fri Oct 18 12:32:01 2019 (r353726) +++ head/sys/dev/gpio/gpioiic.c Fri Oct 18 12:34:30 2019 (r353727) @@ -143,6 +143,15 @@ gpioiic_attach(device_t dev) return (0); } +static int +gpioiic_detach(device_t dev) +{ + + bus_generic_detach(dev); + device_delete_children(dev); + return (0); +} + /* * Reset bus by setting SDA first and then SCL. * Must always be called with gpio bus locked. @@ -241,7 +250,7 @@ static device_method_t gpioiic_methods[] = { /* Device interface */ DEVMETHOD(device_probe, gpioiic_probe), DEVMETHOD(device_attach, gpioiic_attach), - DEVMETHOD(device_detach, bus_generic_detach), + DEVMETHOD(device_detach, gpioiic_detach), /* iicbb interface */ DEVMETHOD(iicbb_setsda, gpioiic_setsda), From owner-svn-src-all@freebsd.org Fri Oct 18 12:48:31 2019 Return-Path: Delivered-To: svn-src-all@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 20FCC14FFF4; Fri, 18 Oct 2019 12:48:31 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (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 46vm6k0rwLz4XCc; Fri, 18 Oct 2019 12:48:29 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-qt1-f195.google.com with SMTP id n17so8876991qtr.4; Fri, 18 Oct 2019 05:48:29 -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=ptwrXBQ/S7XqHblVwTVS2rrB6Q4RfrB/tZugCHCGG5Q=; b=AzOxip0lISl+H1MuthCrvITWk2wcbYlebzXfxYlIqS1C+zWNzbfquBcBpod8wWLxU2 ZIAwX8rV1wByvKN+NbjMbI2iDiIxXXb6qAENenPBNb3nAfLvKgC7a1Zn54CYSf8NxSiX v9DcWyqHzHsczjEtNtRtF/pAh53e+snQAtOzteOINQjiA8WMvYMkqb3S9gRcpDxgIEMI zCYStY7Nj9flhwci5Wz7nup4v3aHrRhh3tqQBjMXiy5I4ed2aE2E8OXdPxfxnCNuTeUo MbZBOum1PRxZDUd8YS3xKG7RnLUZXuT7L5SI1i/7zzFSf3vEHgROWInwr75Yz3ZdguuX tWRQ== X-Gm-Message-State: APjAAAXrNHd4uXquOTUVWjgHuNYcQuDsXCsrTs/2hDe3USUH44yWYLMF f2ZYNMAj7X6HlscWfsg9ntZGvBn2 X-Google-Smtp-Source: APXvYqxmwPzz2VkolHq/RB5n8FYe3YTcf+1ZoQ0cIVXkZc4/ZJW4rtBt/q2b4mfsH6HxlqSPwgYtjA== X-Received: by 2002:ac8:7595:: with SMTP id s21mr9384413qtq.373.1571402908786; Fri, 18 Oct 2019 05:48:28 -0700 (PDT) Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com. [209.85.160.173]) by smtp.gmail.com with ESMTPSA id e42sm4742981qte.26.2019.10.18.05.48.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 18 Oct 2019 05:48:28 -0700 (PDT) Received: by mail-qt1-f173.google.com with SMTP id u40so8830567qth.11; Fri, 18 Oct 2019 05:48:28 -0700 (PDT) X-Received: by 2002:ad4:524b:: with SMTP id s11mr9291670qvq.112.1571402908278; Fri, 18 Oct 2019 05:48:28 -0700 (PDT) MIME-Version: 1.0 References: <201910172133.x9HLX1kl071044@repo.freebsd.org> <20191018122104.389ffb7a@hermann.fritz.box> <20191018140045.31d269b0@ernst.home> In-Reply-To: <20191018140045.31d269b0@ernst.home> From: Kyle Evans Date: Fri, 18 Oct 2019 07:48:16 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys To: gljennjohn@gmail.com Cc: "Hartmann, O." , Conrad Meyer , svn-src-head , svn-src-all , src-committers Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46vm6k0rwLz4XCc X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of byondlenox@gmail.com designates 209.85.160.195 as permitted sender) smtp.mailfrom=byondlenox@gmail.com X-Spamd-Result: default: False [-3.93 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[kyle-evans.net]; RWL_MAILSPIKE_GOOD(0.00)[195.160.85.209.rep.mailspike.net : 127.0.0.18]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[195.160.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; IP_SCORE(-1.93)[ip: (-4.24), ipnet: 209.85.128.0/17(-3.24), asn: 15169(-2.09), country: US(-0.05)]; FORGED_SENDER(0.30)[self@kyle-evans.net,byondlenox@gmail.com]; FREEMAIL_TO(0.00)[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)[self@kyle-evans.net,byondlenox@gmail.com]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 12:48:31 -0000 On Fri, Oct 18, 2019 at 7:00 AM Gary Jennejohn wrote: > > On Fri, 18 Oct 2019 12:21:04 +0200 > "Hartmann, O." wrote: > > > On Thu, 17 Oct 2019 21:33:01 +0000 (UTC) > > Conrad Meyer wrote: > > > > > Author: cem > > > Date: Thu Oct 17 21:33:01 2019 > > > New Revision: 353700 > > > URL: https://svnweb.freebsd.org/changeset/base/353700 > > > > > > Log: > > > Implement NetGDB(4) > > > > > > NetGDB(4) is a component of a system using a panic-time network > > > stack to remotely debug crashed FreeBSD kernels over the network, > > > instead of traditional serial interfaces. > > > > > > There are three pieces in the complete NetGDB system. > > > > > > First, a dedicated proxy server must be running to accept > > > connections from both NetGDB and gdb(1), and pass bidirectional > > > traffic between the two protocols. > > > > > > Second, the NetGDB client is activated much like ordinary 'gdb' and > > > similarly to 'netdump' in ddb(4) after a panic. Like other > > > debugnet(4) clients (netdump(4)), the network interface on the route > > > to the proxy server must be online and support debugnet(4). > > > > > > Finally, the remote (k)gdb(1) uses 'target remote :' > > > (like any other TCP remote) to connect to the proxy server. > > > > > > The NetGDB v1 protocol speaks the literal GDB remote serial > > > protocol, and uses a 1:1 relationship between GDB packets and > > > sequences of debugnet packets (fragmented by MTU). There is no > > > encryption utilized to keep debugging sessions private, so this is > > > only appropriate for local segments or trusted networks. > > > > > > Submitted by: John Reimer (earlier > > > version) Discussed some with: emaste, markj > > > Relnotes: sure > > > Differential Revision: https://reviews.freebsd.org/D21568 > > > > > > Added: > > > head/share/man/man4/netgdb.4 (contents, props changed) > > > head/sys/gdb/netgdb.c (contents, props changed) > > > head/sys/gdb/netgdb.h (contents, props changed) > > > Modified: > > > head/share/man/man4/Makefile > > > head/share/man/man4/ddb.4 > > > head/sys/amd64/conf/GENERIC > > > head/sys/conf/NOTES > > > head/sys/conf/files > > > head/sys/conf/options > > > head/sys/gdb/gdb.h > > > head/sys/gdb/gdb_int.h > > > head/sys/gdb/gdb_main.c > > > head/sys/gdb/gdb_packet.c > > > head/sys/i386/conf/GENERIC > > > head/sys/kern/subr_kdb.c > > > head/sys/net/debugnet.c > > > head/sys/net/debugnet.h > > > head/sys/net/debugnet_inet.c > > > head/sys/net/debugnet_int.h > > > head/sys/sys/kdb.h > > > head/sys/sys/param.h > > > > > > Modified: head/share/man/man4/Makefile > > > ============================================================================== > > > --- head/share/man/man4/Makefile Thu Oct 17 21:25:50 > > > 2019 (r353699) +++ head/share/man/man4/Makefile Thu Oct > > > 17 21:33:01 2019 (r353700) @@ -307,6 +307,7 @@ MAN= > > > aac.4 \ net80211.4 \ > > > netdump.4 \ > > > netfpga10g_nf10bmac.4 \ > > > + netgdb.4 \ > > > netgraph.4 \ > > > netintro.4 \ > > > netmap.4 \ > > > > > [...] > > > > > > Having "nooptions NETGDB # netgdb(4) client support" > > defined in my kernel config file, buildkernel fails with the error > > shown below. > > > > [...] > > --- debugnet.o --- > > /usr/src/sys/net/debugnet.c:662:4: error: implicit declaration of > > function 'db_printf' is invalid in C99 > > [-Werror,-Wimplicit-function-declaration] db_printf("%s: Could not get > > route for that server.\n", ^ /usr/src/sys/net/debugnet.c:662:4: note: > > did you mean 'if_printf'? /usr/src/sys/net/if_var.h:679:5: note: > > 'if_printf' declared here int if_printf(struct ifnet *, const char > > *, ...) __printflike(2, 3); ^ > > 1 error generated. > > And I also had to add "nooptions NETDUMP" to get the kernel to compile > and link. > diff --git a/sys/conf/files b/sys/conf/files index e47fe27466c..4bc5770e08c 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4298,7 +4298,7 @@ netinet/libalias/alias_mod.c optional libalias | netgraph_nat netinet/libalias/alias_proxy.c optional libalias inet | netgraph_nat inet netinet/libalias/alias_util.c optional libalias inet | netgraph_nat inet netinet/libalias/alias_sctp.c optional libalias inet | netgraph_nat inet -netinet/netdump/netdump_client.c optional inet netdump +netinet/netdump/netdump_client.c optional inet debugnet netdump netinet6/dest6.c optional inet6 netinet6/frag6.c optional inet6 netinet6/icmp6.c optional inet6 That should fix that one. Thanks, Kyle Evans From owner-svn-src-all@freebsd.org Fri Oct 18 13:41:09 2019 Return-Path: Delivered-To: svn-src-all@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 55FA01510B0; Fri, 18 Oct 2019 13:41:09 +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 46vnHT1JXDz4ZV3; Fri, 18 Oct 2019 13:41:09 +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 0AF689C06; Fri, 18 Oct 2019 13:41:09 +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 x9IDf8nj038813; Fri, 18 Oct 2019 13:41:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9IDf86C038812; Fri, 18 Oct 2019 13:41:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910181341.x9IDf86C038812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 18 Oct 2019 13:41:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353728 - stable/12/sys/dev/xen/netback X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/dev/xen/netback X-SVN-Commit-Revision: 353728 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 13:41:09 -0000 Author: markj Date: Fri Oct 18 13:41:08 2019 New Revision: 353728 URL: https://svnweb.freebsd.org/changeset/base/353728 Log: MFC r353444: Remove an unneeded include of opt_sctp.h. Modified: stable/12/sys/dev/xen/netback/netback.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/xen/netback/netback.c ============================================================================== --- stable/12/sys/dev/xen/netback/netback.c Fri Oct 18 12:34:30 2019 (r353727) +++ stable/12/sys/dev/xen/netback/netback.c Fri Oct 18 13:41:08 2019 (r353728) @@ -46,8 +46,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_sctp.h" - #include #include From owner-svn-src-all@freebsd.org Fri Oct 18 13:53:15 2019 Return-Path: Delivered-To: svn-src-all@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 A20421516D0; Fri, 18 Oct 2019 13:53:15 +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 46vnYR3rmJz4bJp; Fri, 18 Oct 2019 13:53:15 +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 676529E61; Fri, 18 Oct 2019 13:53: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 x9IDrFdd047001; Fri, 18 Oct 2019 13:53:15 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9IDrFu7047000; Fri, 18 Oct 2019 13:53:15 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910181353.x9IDrFu7047000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 18 Oct 2019 13:53:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353729 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 353729 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 13:53:15 -0000 Author: markj Date: Fri Oct 18 13:53:14 2019 New Revision: 353729 URL: https://svnweb.freebsd.org/changeset/base/353729 Log: Apply mapping protections to .o kernel modules. Use the section flags to derive mapping protections. When multiple sections overlap within a page, the union of their protections must be applied. With r353701 the .text and .rodata sections are padded to ensure that this does not happen on amd64. Reviewed by: kib MFC after: 1 month Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21896 Modified: head/sys/kern/link_elf_obj.c Modified: head/sys/kern/link_elf_obj.c ============================================================================== --- head/sys/kern/link_elf_obj.c Fri Oct 18 13:41:08 2019 (r353728) +++ head/sys/kern/link_elf_obj.c Fri Oct 18 13:53:14 2019 (r353729) @@ -70,8 +70,8 @@ __FBSDID("$FreeBSD$"); typedef struct { void *addr; Elf_Off size; - int flags; - int sec; /* Original section */ + int flags; /* Section flags. */ + int sec; /* Original section number. */ char *name; } Elf_progent; @@ -196,6 +196,119 @@ link_elf_init(void *arg) SYSINIT(link_elf_obj, SI_SUB_KLD, SI_ORDER_SECOND, link_elf_init, NULL); +static void +link_elf_protect_range(elf_file_t ef, vm_offset_t start, vm_offset_t end, + vm_prot_t prot) +{ + int error __unused; + + KASSERT(start <= end && start >= (vm_offset_t)ef->address && + end <= round_page((vm_offset_t)ef->address + ef->lf.size), + ("link_elf_protect_range: invalid range %#jx-%#jx", + (uintmax_t)start, (uintmax_t)end)); + + if (start == end) + return; + error = vm_map_protect(kernel_map, start, end, prot, FALSE); + KASSERT(error == KERN_SUCCESS, + ("link_elf_protect_range: vm_map_protect() returned %d", error)); +} + +/* + * Restrict permissions on linker file memory based on section flags. + * Sections need not be page-aligned, so overlap within a page is possible. + */ +static void +link_elf_protect(elf_file_t ef) +{ + vm_offset_t end, segend, segstart, start; + vm_prot_t gapprot, prot, segprot; + int i; + + /* + * If the file was preloaded, the last page may contain other preloaded + * data which may need to be writeable. ELF files are always + * page-aligned, but other preloaded data, such as entropy or CPU + * microcode may be loaded with a smaller alignment. + */ + gapprot = ef->preloaded ? VM_PROT_RW : VM_PROT_READ; + + start = end = (vm_offset_t)ef->address; + prot = VM_PROT_READ; + for (i = 0; i < ef->nprogtab; i++) { + /* + * VNET and DPCPU sections have their memory allocated by their + * respective subsystems. + */ + if (ef->progtab[i].name != NULL && ( +#ifdef VIMAGE + strcmp(ef->progtab[i].name, VNET_SETNAME) == 0 || +#endif + strcmp(ef->progtab[i].name, DPCPU_SETNAME) == 0)) + continue; + + segstart = trunc_page((vm_offset_t)ef->progtab[i].addr); + segend = round_page((vm_offset_t)ef->progtab[i].addr + + ef->progtab[i].size); + segprot = VM_PROT_READ; + if ((ef->progtab[i].flags & SHF_WRITE) != 0) + segprot |= VM_PROT_WRITE; + if ((ef->progtab[i].flags & SHF_EXECINSTR) != 0) + segprot |= VM_PROT_EXECUTE; + + if (end <= segstart) { + /* + * Case 1: there is no overlap between the previous + * segment and this one. Apply protections to the + * previous segment, and protect the gap between the + * previous and current segments, if any. + */ + link_elf_protect_range(ef, start, end, prot); + link_elf_protect_range(ef, end, segstart, gapprot); + + start = segstart; + end = segend; + prot = segprot; + } else if (start < segstart && end == segend) { + /* + * Case 2: the current segment is a subrange of the + * previous segment. Apply protections to the + * non-overlapping portion of the previous segment. + */ + link_elf_protect_range(ef, start, segstart, prot); + + start = segstart; + prot |= segprot; + } else if (end < segend) { + /* + * Case 3: there is partial overlap between the previous + * and current segments. Apply protections to the + * non-overlapping portion of the previous segment, and + * then the overlap, which must use the union of the two + * segments' protections. + */ + link_elf_protect_range(ef, start, segstart, prot); + link_elf_protect_range(ef, segstart, end, + prot | segprot); + start = end; + end = segend; + prot = segprot; + } else { + /* + * Case 4: the two segments reside in the same page. + */ + prot |= segprot; + } + } + + /* + * Fix up the last unprotected segment and trailing data. + */ + link_elf_protect_range(ef, start, end, prot); + link_elf_protect_range(ef, end, + round_page((vm_offset_t)ef->address + ef->lf.size), gapprot); +} + static int link_elf_link_preload(linker_class_t cls, const char *filename, linker_file_t *result) @@ -358,6 +471,7 @@ link_elf_link_preload(linker_class_t cls, const char * else ef->progtab[pb].name = "<>"; ef->progtab[pb].size = shdr[i].sh_size; + ef->progtab[pb].flags = shdr[i].sh_flags; ef->progtab[pb].sec = i; if (ef->shstrtab && shdr[i].sh_name != 0) ef->progtab[pb].name = @@ -783,7 +897,9 @@ link_elf_load_file(linker_class_t cls, const char *fil /* * In order to satisfy amd64's architectural requirements on the * location of code and data in the kernel's address space, request a - * mapping that is above the kernel. + * mapping that is above the kernel. + * + * Protections will be restricted once relocations are applied. */ #ifdef __amd64__ mapbase = KERNBASE; @@ -884,6 +1000,7 @@ link_elf_load_file(linker_class_t cls, const char *fil goto out; } ef->progtab[pb].size = shdr[i].sh_size; + ef->progtab[pb].flags = shdr[i].sh_flags; ef->progtab[pb].sec = i; if (shdr[i].sh_type == SHT_PROGBITS #ifdef __amd64__ @@ -1023,9 +1140,8 @@ link_elf_load_file(linker_class_t cls, const char *fil goto out; #endif - /* Invoke .ctors */ + link_elf_protect(ef); link_elf_invoke_ctors(lf->ctors_addr, lf->ctors_size); - *result = lf; out: From owner-svn-src-all@freebsd.org Fri Oct 18 13:56:46 2019 Return-Path: Delivered-To: svn-src-all@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 6BE9C151882; Fri, 18 Oct 2019 13:56:46 +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 46vndV2Bgjz4bcF; Fri, 18 Oct 2019 13:56:46 +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 2F36F9ED0; Fri, 18 Oct 2019 13:56:46 +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 x9IDuk1v047226; Fri, 18 Oct 2019 13:56:46 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9IDujMe047224; Fri, 18 Oct 2019 13:56:45 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910181356.x9IDujMe047224@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 18 Oct 2019 13:56:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353730 - in head/sys: kern vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: kern vm X-SVN-Commit-Revision: 353730 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 13:56:46 -0000 Author: markj Date: Fri Oct 18 13:56:45 2019 New Revision: 353730 URL: https://svnweb.freebsd.org/changeset/base/353730 Log: Apply mapping protections to preloaded kernel modules on amd64. With an upcoming change the amd64 kernel will map preloaded files RW instead of RWX, so the kernel linker must adjust protections appropriately using pmap_change_prot(). Reviewed by: kib MFC after: 1 month Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21860 Modified: head/sys/kern/link_elf.c head/sys/kern/link_elf_obj.c head/sys/vm/vm_kern.c Modified: head/sys/kern/link_elf.c ============================================================================== --- head/sys/kern/link_elf.c Fri Oct 18 13:53:14 2019 (r353729) +++ head/sys/kern/link_elf.c Fri Oct 18 13:56:45 2019 (r353730) @@ -736,10 +736,47 @@ parse_vnet(elf_file_t ef) #endif #undef LS_PADDING +/* + * Apply the specified protection to the loadable segments of a preloaded linker + * file. + */ static int -link_elf_link_preload(linker_class_t cls, - const char* filename, linker_file_t *result) +preload_protect(elf_file_t ef, vm_prot_t prot) { +#ifdef __amd64__ + Elf_Ehdr *hdr; + Elf_Phdr *phdr, *phlimit; + vm_prot_t nprot; + int error; + + error = 0; + hdr = (Elf_Ehdr *)ef->address; + phdr = (Elf_Phdr *)(ef->address + hdr->e_phoff); + phlimit = phdr + hdr->e_phnum; + for (; phdr < phlimit; phdr++) { + if (phdr->p_type != PT_LOAD) + continue; + + nprot = prot | VM_PROT_READ; + if ((phdr->p_flags & PF_W) != 0) + nprot |= VM_PROT_WRITE; + if ((phdr->p_flags & PF_X) != 0) + nprot |= VM_PROT_EXECUTE; + error = pmap_change_prot((vm_offset_t)ef->address + + phdr->p_vaddr, round_page(phdr->p_memsz), nprot); + if (error != 0) + break; + } + return (error); +#else + return (0); +#endif +} + +static int +link_elf_link_preload(linker_class_t cls, const char *filename, + linker_file_t *result) +{ Elf_Addr *ctors_addrp; Elf_Size *ctors_sizep; caddr_t modptr, baseptr, sizeptr, dynptr; @@ -798,6 +835,8 @@ link_elf_link_preload(linker_class_t cls, if (error == 0) error = parse_vnet(ef); #endif + if (error == 0) + error = preload_protect(ef, VM_PROT_ALL); if (error != 0) { linker_file_unload(lf, LINKER_UNLOAD_FORCE); return (error); @@ -815,6 +854,8 @@ link_elf_link_preload_finish(linker_file_t lf) ef = (elf_file_t) lf; error = relocate_file(ef); + if (error == 0) + error = preload_protect(ef, VM_PROT_NONE); if (error != 0) return (error); (void)link_elf_preload_parse_symbols(ef); @@ -1274,6 +1315,7 @@ link_elf_unload_file(linker_file_t file) static void link_elf_unload_preload(linker_file_t file) { + if (file->pathname != NULL) preload_delete_name(file->pathname); } Modified: head/sys/kern/link_elf_obj.c ============================================================================== --- head/sys/kern/link_elf_obj.c Fri Oct 18 13:53:14 2019 (r353729) +++ head/sys/kern/link_elf_obj.c Fri Oct 18 13:56:45 2019 (r353730) @@ -193,7 +193,6 @@ link_elf_init(void *arg) linker_add_class(&link_elf_class); } - SYSINIT(link_elf_obj, SI_SUB_KLD, SI_ORDER_SECOND, link_elf_init, NULL); static void @@ -209,6 +208,15 @@ link_elf_protect_range(elf_file_t ef, vm_offset_t star if (start == end) return; + if (ef->preloaded) { +#ifdef __amd64__ + error = pmap_change_prot(start, end - start, prot); + KASSERT(error == 0, + ("link_elf_protect_range: pmap_change_prot() returned %d", + error)); +#endif + return; + } error = vm_map_protect(kernel_map, start, end, prot, FALSE); KASSERT(error == KERN_SUCCESS, ("link_elf_protect_range: vm_map_protect() returned %d", error)); @@ -564,6 +572,14 @@ link_elf_link_preload(linker_class_t cls, const char * goto out; } + /* + * The file needs to be writeable and executable while applying + * relocations. Mapping protections are applied once relocation + * processing is complete. + */ + link_elf_protect_range(ef, (vm_offset_t)ef->address, + round_page((vm_offset_t)ef->address + ef->lf.size), VM_PROT_ALL); + /* Local intra-module relocations */ error = link_elf_reloc_local(lf, false); if (error != 0) @@ -616,7 +632,9 @@ link_elf_link_preload_finish(linker_file_t lf) return (error); #endif - /* Invoke .ctors */ + /* Apply protections now that relocation processing is complete. */ + link_elf_protect(ef); + link_elf_invoke_ctors(lf->ctors_addr, lf->ctors_size); return (0); } Modified: head/sys/vm/vm_kern.c ============================================================================== --- head/sys/vm/vm_kern.c Fri Oct 18 13:53:14 2019 (r353729) +++ head/sys/vm/vm_kern.c Fri Oct 18 13:56:45 2019 (r353730) @@ -834,6 +834,14 @@ kmem_bootstrap_free(vm_offset_t start, vm_size_t size) end = trunc_page(start + size); start = round_page(start); +#ifdef __amd64__ + /* + * Preloaded files do not have execute permissions by default on amd64. + * Restore the default permissions to ensure that the direct map alias + * is updated. + */ + pmap_change_prot(start, end - start, VM_PROT_RW); +#endif for (va = start; va < end; va += PAGE_SIZE) { pa = pmap_kextract(va); m = PHYS_TO_VM_PAGE(pa); From owner-svn-src-all@freebsd.org Fri Oct 18 14:05:14 2019 Return-Path: Delivered-To: svn-src-all@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 E19DB151B8B; Fri, 18 Oct 2019 14:05: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 46vnqG5QKnz4c3K; Fri, 18 Oct 2019 14:05: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 9A6ACA08C; Fri, 18 Oct 2019 14:05:14 +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 x9IE5EkL053184; Fri, 18 Oct 2019 14:05:14 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9IE5EgH053182; Fri, 18 Oct 2019 14:05:14 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910181405.x9IE5EgH053182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 18 Oct 2019 14:05:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353731 - in head/sys: amd64/amd64 conf X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: amd64/amd64 conf X-SVN-Commit-Revision: 353731 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 14:05:14 -0000 Author: markj Date: Fri Oct 18 14:05:13 2019 New Revision: 353731 URL: https://svnweb.freebsd.org/changeset/base/353731 Log: Tighten mapping protections on preloaded files on amd64. - We load the kernel at 0x200000. Memory below that address need not be executable, so do not map it as such. - Remove references to .ldata and related sections in the kernel linker script. They come from ld.bfd's default linker script, but are not used, and we now use ld.lld to link the amd64 kernel. lld does not contain a default linker script. - Pad the .bss to a 2MB as we do between .text and .data. This forces the loader to load additional files starting in the following 2MB page, preserving the use of superpage mappings for kernel data. - Map memory above the kernel image with NX. The kernel linker now upgrades protections as needed, and other preloaded file types (e.g., entropy, microcode) need not be mapped with execute permissions in the first place. Reviewed by: kib MFC after: 1 month Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21859 Modified: head/sys/amd64/amd64/pmap.c head/sys/conf/ldscript.amd64 Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Fri Oct 18 13:56:45 2019 (r353730) +++ head/sys/amd64/amd64/pmap.c Fri Oct 18 14:05:13 2019 (r353731) @@ -1422,22 +1422,22 @@ nkpt_init(vm_paddr_t addr) * * This function operates on 2M pages, since we map the kernel space that * way. - * - * Note that this doesn't currently provide any protection for modules. */ static inline pt_entry_t bootaddr_rwx(vm_paddr_t pa) { /* - * Everything in the same 2M page as the start of the kernel - * should be static. On the other hand, things in the same 2M - * page as the end of the kernel could be read-write/executable, - * as the kernel image is not guaranteed to end on a 2M boundary. + * The kernel is loaded at a 2MB-aligned address, and memory below that + * need not be executable. The .bss section is padded to a 2MB + * boundary, so memory following the kernel need not be executable + * either. Preloaded kernel modules have their mapping permissions + * fixed up by the linker. */ if (pa < trunc_2mpage(btext - KERNBASE) || - pa >= trunc_2mpage(_end - KERNBASE)) - return (X86_PG_RW); + pa >= trunc_2mpage(_end - KERNBASE)) + return (X86_PG_RW | pg_nx); + /* * The linker should ensure that the read-only and read-write * portions don't share the same 2M page, so this shouldn't @@ -1446,6 +1446,7 @@ bootaddr_rwx(vm_paddr_t pa) */ if (pa >= trunc_2mpage(brwsection - KERNBASE)) return (X86_PG_RW | pg_nx); + /* * Mark any 2M page containing kernel text as read-only. Mark * other pages with read-only data as read-only and not executable. Modified: head/sys/conf/ldscript.amd64 ============================================================================== --- head/sys/conf/ldscript.amd64 Fri Oct 18 13:56:45 2019 (r353730) +++ head/sys/conf/ldscript.amd64 Fri Oct 18 14:05:13 2019 (r353731) @@ -45,12 +45,6 @@ SECTIONS .rela.got : { *(.rela.got) } .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } - .rel.ldata : { *(.rel.ldata .rel.ldata.* .rel.gnu.linkonce.l.*) } - .rela.ldata : { *(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*) } - .rel.lbss : { *(.rel.lbss .rel.lbss.* .rel.gnu.linkonce.lb.*) } - .rela.lbss : { *(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*) } - .rel.lrodata : { *(.rel.lrodata .rel.lrodata.* .rel.gnu.linkonce.lr.*) } - .rela.lrodata : { *(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*) } .rel.plt : { *(.rel.plt) } .rela.plt : { *(.rela.plt) } .init : @@ -179,30 +173,10 @@ SECTIONS *(.dynbss) *(.bss .bss.* .gnu.linkonce.b.*) *(COMMON) - /* Align here to ensure that the .bss section occupies space up to - _end. Align after .bss to ensure correct alignment even if the - .bss section disappears because there are no input sections. - FIXME: Why do we need it? When there is no .bss section, we don't - pad the .data section. */ - . = ALIGN(. != 0 ? 64 / 8 : 1); + /* Ensure that the .bss section ends at a superpage boundary. + This way it can be mapped using non-executable large pages. */ + . = ALIGN(0x200000); } - .lbss : - { - *(.dynlbss) - *(.lbss .lbss.* .gnu.linkonce.lb.*) - *(LARGE_COMMON) - } - . = ALIGN(64 / 8); - .lrodata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) : - { - *(.lrodata .lrodata.* .gnu.linkonce.lr.*) - } - .ldata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) : - { - *(.ldata .ldata.* .gnu.linkonce.l.*) - . = ALIGN(. != 0 ? 64 / 8 : 1); - } - . = ALIGN(64 / 8); _end = .; PROVIDE (end = .); . = DATA_SEGMENT_END (.); /* Stabs debugging sections. */ From owner-svn-src-all@freebsd.org Fri Oct 18 14:09:51 2019 Return-Path: Delivered-To: svn-src-all@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 4304C151CDD; Fri, 18 Oct 2019 14:09:51 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46vnwY6yBgz4cG7; Fri, 18 Oct 2019 14:09:49 +0000 (UTC) (envelope-from ohartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1571407784; bh=qD3Ney4IWa72pK/yNPS6Y9dLOZR8QnflAIyMDKgrSjE=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=iKHlm0NjYhMc5XsMLUEHZ5+4gQOuxLJy0tkiq+4ZB+4ZbVy0Qz9rSr/mMR/FKFEl6 XJvi0iNRNgLCRDFdg5BHq3OJ9O8S1SA+xvdVrBbI5Anz1O0PqxmML3WDaqIjwrncG9 UwY/03PeUQBaTnOL6TkZYlD4taduRRF66ZKZNttc= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermann.fritz.box ([91.65.85.161]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MWzk3-1iWBGb2lS5-00XJcm; Fri, 18 Oct 2019 16:09:44 +0200 Date: Fri, 18 Oct 2019 16:09:35 +0200 From: "Hartmann, O." To: Gary Jennejohn Cc: "Hartmann, O." , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Conrad Meyer Subject: Re: svn commit: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys Message-ID: <20191018160935.7dda61c4@hermann.fritz.box> In-Reply-To: <20191018140045.31d269b0@ernst.home> References: <201910172133.x9HLX1kl071044@repo.freebsd.org> <20191018122104.389ffb7a@hermann.fritz.box> <20191018140045.31d269b0@ernst.home> Organization: walstatt.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/QDD9BZgeMM6.TJkOIciNb32"; protocol="application/pgp-signature" X-Provags-ID: V03:K1:pDvxVK6+nX2U3ubIPzzQBsmu4n6s5mhIimCutNr1CKsOeNsQ3rR 92EBXRh4wA8aUNc4vucuslcU9o8cTlibnWjqJo03UkBalO6MWL97RrfzcSnEsVM6taYIgrR 1ONcsN1BIwZzgJbqm9DRv36Ss/5iqDHSPWIJFdZfKJKyDbFT0gjYva77VZpXM2KcG6PT6xv qnhOsNC11k16m1EwWmh8Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:Kq25soeZzGE=:RCjuy53WoPW7bYMxpTzYfC BmmXc4+gPr/WtYo45UFFurabbWWBKeZFxQN35jtfNdxPdpQAmaVIfYkIgLFabSwvnklVvrWiw 5g4PG+LFXlKPjAUhM1VdyKnDn9C/jv0B37VAauO2Q1tLhNzibPQnIdz1aDPCJUkeHU9bpl3jJ 4lLrZW8Im3wQX2VZ/ifw7ATi6pFYcDqKx+GFklrAEsfGUtbGlHbcltNwMiikMjyN8U9WvJQzB NeJZzOmAHgUlhYC1xj56IQQGKpO+XNz37Y7w3cD+4mkA4TyQK3BjzifL+70NvZtuaJAmvjF4x BclvYOIaj7zeHPyskC5qFtEPJXL0Nyx0GbPPq7U0tj7Ne7E6F6hPiYyQwv8Nwi8Caq7aVs3GX IL9klPSiY9UKI0e89+jMO3DXuq0mlNeXnsnJu+KVSLn8FTAycuRaSDTKmq90MumRQo2z/o8n8 zhtZJVFG90JwiiRuIYFYz2dHVBBN5R8IqDJkl9cFl+mz8qKmHR9p6EfQLpt8sP9KvT0BGciYf 9qU+eThTgOI7zKCb71NADeCJDl/b3gyIcHTMPBp9axqxSE5v1xdqKPr8Bdz0VQUUmaIuCdXrC zkYhD86ln+DPlKvPhUVNa5jQVy0SzfNZKFuPAClGsUrk5iDdJmKN1C6qBqb54ahxnO1IdAcum F04wzbeZ1whLew7WyTcAdCE2CcG8PIJg/oDRjpKthSzT+JM0OjTsuphGEeIsCPwEJnrjMwlU3 9Q5FzS4im4BlbpW+sUdLWOiBPnT02ZaLKTN6cXKlY/aLNPRzCitRS57ctGYoCVJMv1MUjVrmS malKWRLdemKiezSLEoQ3bwyCBqkKnxs7N+aNivdUwEdqPsT0v2LulU8S7IyapBy9IEzLAB/2H nZ6YTsjdiKvOPABCcHCliKtq5rRT6A6PpwTnrYPgc404LbP3/QDTe9JM8amlh/+FhRgBVnF+n eoe3JiusZIlJeKVKF8+/nnTuB3MuD+uxkQh6BIOSrEFlNHZkuwMO5k2c9zGe92l2gakO1z9v+ HkNs86VABYG/B97+m60LIbGm90Dt27fbmNjzy3mCMMAytpYYrcYsmEAr/LlvtcXGDq2GHbhjv TtsCccQMlFR4qmFOQzFD8c88LZXPIq2R0q/Kt3IxOD2PIqz+lV9/rqSJdbo092ex8V7iCxr7N YZt0/t1ThoY4zgfjWQy0tJEO4fcgZ1ZCm/st4ZHsmQU+bJ+2eqvg8VsYVO9hZJQi5FxuepDOM O6aZY5c1J8HmAkItANRhgPtOupAnh1eRjRjydRoWSil5hk4/tDZ6VfcBe/Xk= X-Rspamd-Queue-Id: 46vnwY6yBgz4cG7 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.b=iKHlm0Nj; dmarc=none; spf=none (mx1.freebsd.org: domain of ohartmann@walstatt.org has no SPF policy when checking 212.227.15.15) smtp.mailfrom=ohartmann@walstatt.org X-Spamd-Result: default: False [-5.62 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmx.net:s=badeba3b8450]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[walstatt.org]; RCPT_COUNT_FIVE(0.00)[6]; HAS_ORG_HEADER(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmx.net:+]; RCVD_IN_DNSWL_NONE(0.00)[15.15.227.212.list.dnswl.org : 127.0.3.0]; R_SPF_NA(0.00)[]; SIGNED_PGP(-2.00)[]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-1.22)[ip: (-6.73), ipnet: 212.227.0.0/16(-1.34), asn: 8560(2.00), country: DE(-0.01)]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[161.85.65.91.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 14:09:51 -0000 --Sig_/QDD9BZgeMM6.TJkOIciNb32 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Fri, 18 Oct 2019 14:00:45 +0200 Gary Jennejohn wrote: > On Fri, 18 Oct 2019 12:21:04 +0200 > "Hartmann, O." wrote: >=20 > > On Thu, 17 Oct 2019 21:33:01 +0000 (UTC) > > Conrad Meyer wrote: > > =20 > > > Author: cem > > > Date: Thu Oct 17 21:33:01 2019 > > > New Revision: 353700 > > > URL: https://svnweb.freebsd.org/changeset/base/353700 > > >=20 > > > Log: > > > Implement NetGDB(4) > > > =20 > > > NetGDB(4) is a component of a system using a panic-time network > > > stack to remotely debug crashed FreeBSD kernels over the network, > > > instead of traditional serial interfaces. > > > =20 > > > There are three pieces in the complete NetGDB system. > > > =20 > > > First, a dedicated proxy server must be running to accept > > > connections from both NetGDB and gdb(1), and pass bidirectional > > > traffic between the two protocols. > > > =20 > > > Second, the NetGDB client is activated much like ordinary 'gdb' > > > and similarly to 'netdump' in ddb(4) after a panic. Like other > > > debugnet(4) clients (netdump(4)), the network interface on the > > > route to the proxy server must be online and support debugnet(4). > > > =20 > > > Finally, the remote (k)gdb(1) uses 'target remote > > > :' (like any other TCP remote) to connect to the > > > proxy server.=20 > > > The NetGDB v1 protocol speaks the literal GDB remote serial > > > protocol, and uses a 1:1 relationship between GDB packets and > > > sequences of debugnet packets (fragmented by MTU). There is no > > > encryption utilized to keep debugging sessions private, so this is > > > only appropriate for local segments or trusted networks. > > > =20 > > > Submitted by: John Reimer > > > (earlier version) Discussed some with: emaste, markj > > > Relnotes: sure > > > Differential Revision: https://reviews.freebsd.org/D21568 > > >=20 > > > Added: > > > head/share/man/man4/netgdb.4 (contents, props changed) > > > head/sys/gdb/netgdb.c (contents, props changed) > > > head/sys/gdb/netgdb.h (contents, props changed) > > > Modified: > > > head/share/man/man4/Makefile > > > head/share/man/man4/ddb.4 > > > head/sys/amd64/conf/GENERIC > > > head/sys/conf/NOTES > > > head/sys/conf/files > > > head/sys/conf/options > > > head/sys/gdb/gdb.h > > > head/sys/gdb/gdb_int.h > > > head/sys/gdb/gdb_main.c > > > head/sys/gdb/gdb_packet.c > > > head/sys/i386/conf/GENERIC > > > head/sys/kern/subr_kdb.c > > > head/sys/net/debugnet.c > > > head/sys/net/debugnet.h > > > head/sys/net/debugnet_inet.c > > > head/sys/net/debugnet_int.h > > > head/sys/sys/kdb.h > > > head/sys/sys/param.h > > >=20 > > > Modified: head/share/man/man4/Makefile > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > > --- head/share/man/man4/Makefile Thu Oct 17 21:25:50 > > > 2019 (r353699) +++ head/share/man/man4/Makefile Thu > > > Oct 17 21:33:01 2019 (r353700) @@ -307,6 +307,7 @@ MAN=3D > > > aac.4 \ net80211.4 \ > > > netdump.4 \ > > > netfpga10g_nf10bmac.4 \ > > > + netgdb.4 \ > > > netgraph.4 \ > > > netintro.4 \ > > > netmap.4 \ > > > =20 > > [...] > >=20 > >=20 > > Having "nooptions NETGDB # netgdb(4) client support" > > defined in my kernel config file, buildkernel fails with the error > > shown below. > >=20 > > [...] > > --- debugnet.o --- > > /usr/src/sys/net/debugnet.c:662:4: error: implicit declaration of > > function 'db_printf' is invalid in C99 > > [-Werror,-Wimplicit-function-declaration] db_printf("%s: Could not > > get route for that server.\n", ^ /usr/src/sys/net/debugnet.c:662:4: > > note: did you mean 'if_printf'? /usr/src/sys/net/if_var.h:679:5: > > note: 'if_printf' declared here int if_printf(struct ifnet *, > > const char *, ...) __printflike(2, 3); ^ > > 1 error generated. =20 >=20 > And I also had to add "nooptions NETDUMP" to get the kernel to compile > and link. >=20 I already had "nooptions NETDUMP" defined. --Sig_/QDD9BZgeMM6.TJkOIciNb32 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQSy8IBxAPDkqVBaTJ44N1ZZPba5RwUCXanHnwAKCRA4N1ZZPba5 RwkDAQDr3BPxOYQ9wVWEHJSdoh9FaZwUL3Da8rq95ilniToCsQEAn41jhqLtxHGy x8/mBqkoANW/I60IdMtYlrRYQt1NAg8= =3ZbB -----END PGP SIGNATURE----- --Sig_/QDD9BZgeMM6.TJkOIciNb32-- From owner-svn-src-all@freebsd.org Fri Oct 18 14:24:20 2019 Return-Path: Delivered-To: svn-src-all@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 7F3EA152489; Fri, 18 Oct 2019 14:24:20 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (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 46vpFH0J7Fz4dD6; Fri, 18 Oct 2019 14:24:18 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id LTAriWW3rsAGkLTAsiWXof; Fri, 18 Oct 2019 08:24:16 -0600 X-Authority-Analysis: v=2.3 cv=WeVylHpX c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=XobE76Q3jBoA:10 a=pGLkceISAAAA:8 a=iaTFZB6CAAAA:8 a=6I5d2MoRAAAA:8 a=G0_B3m8xAAAA:8 a=YxBL1-UpAAAA:8 a=_hhXOdq3uOJBmoHTGhIA:9 a=jPecpB6AOpLXUzJM:21 a=CjuIK1q_8ugA:10 a=QWXrQ9iV8q7LKaLQ9lfw:22 a=IjZwj45LgO3ly-622nXo:22 a=gBgTPrObzSPeouD7eQ2s:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id E680F2E2; Fri, 18 Oct 2019 07:24:12 -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 x9IEOC83013888; Fri, 18 Oct 2019 07:24:12 -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 x9IEOC9q013885; Fri, 18 Oct 2019 07:24:12 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201910181424.x9IEOC9q013885@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: "Hartmann, O." cc: Gary Jennejohn , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Conrad Meyer Subject: Re: svn commit: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys In-reply-to: <20191018160935.7dda61c4@hermann.fritz.box> References: <201910172133.x9HLX1kl071044@repo.freebsd.org> <20191018122104.389ffb7a@hermann.fritz.box> <20191018140045.31d269b0@ernst.home> <20191018160935.7dda61c4@hermann.fritz.box> Comments: In-reply-to "Hartmann, O." message dated "Fri, 18 Oct 2019 16:09:35 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 18 Oct 2019 07:24:12 -0700 X-CMAE-Envelope: MS4wfAQvcwMHM8/AO/ezVkeFJlc9BKXzf4wEO1n6TnUm6OLdgTeq/EEakSb8hDxirVltu0sxMiKziimbKlCbz0zq14xsfv0p34g6zeCjqTKf1SaqL2kKgE7C A7BiZtlklMQWXtAzk56gpjX4phGhH+8nQ1b947IlC+OebeBqTN2/0OZLpGcUdSK1kQddb7+EyPmqNthGki0kT9iflEWXucH1g22qh7+XvYUBsPWr/nUEuGXx oftX1zhDlc9VkXfF86/bDC9SbtuePzmEWuXshhxwe3WbjA7USnyau3olJ9Mzo23D0N8F1gBK1nNz7fBanfI05w== X-Rspamd-Queue-Id: 46vpFH0J7Fz4dD6 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.134.12) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-3.97 / 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)[]; IP_SCORE(-2.37)[ip: (-6.33), ipnet: 64.59.128.0/20(-3.05), asn: 6327(-2.37), country: CA(-0.09)]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[6]; REPLYTO_EQ_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[12.134.59.64.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,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]; FREEMAIL_CC(0.00)[gmail.com]; RCVD_TLS_LAST(0.00)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[12.134.59.64.rep.mailspike.net : 127.0.0.17] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 14:24:20 -0000 In message <20191018160935.7dda61c4@hermann.fritz.box>, "Hartmann, O." writes: > --Sig_/QDD9BZgeMM6.TJkOIciNb32 > Content-Type: text/plain; charset=US-ASCII > Content-Transfer-Encoding: quoted-printable > > On Fri, 18 Oct 2019 14:00:45 +0200 > Gary Jennejohn wrote: > > > On Fri, 18 Oct 2019 12:21:04 +0200 > > "Hartmann, O." wrote: > >=20 > > > On Thu, 17 Oct 2019 21:33:01 +0000 (UTC) > > > Conrad Meyer wrote: > > > =20 > > > > Author: cem > > > > Date: Thu Oct 17 21:33:01 2019 > > > > New Revision: 353700 > > > > URL: https://svnweb.freebsd.org/changeset/base/353700 > > > >=20 > > > > Log: > > > > Implement NetGDB(4) > > > > =20 > > > > NetGDB(4) is a component of a system using a panic-time network > > > > stack to remotely debug crashed FreeBSD kernels over the network, > > > > instead of traditional serial interfaces. > > > > =20 > > > > There are three pieces in the complete NetGDB system. > > > > =20 > > > > First, a dedicated proxy server must be running to accept > > > > connections from both NetGDB and gdb(1), and pass bidirectional > > > > traffic between the two protocols. > > > > =20 > > > > Second, the NetGDB client is activated much like ordinary 'gdb' > > > > and similarly to 'netdump' in ddb(4) after a panic. Like other > > > > debugnet(4) clients (netdump(4)), the network interface on the > > > > route to the proxy server must be online and support debugnet(4). > > > > =20 > > > > Finally, the remote (k)gdb(1) uses 'target remote > > > > :' (like any other TCP remote) to connect to the > > > > proxy server.=20 > > > > The NetGDB v1 protocol speaks the literal GDB remote serial > > > > protocol, and uses a 1:1 relationship between GDB packets and > > > > sequences of debugnet packets (fragmented by MTU). There is no > > > > encryption utilized to keep debugging sessions private, so this is > > > > only appropriate for local segments or trusted networks. > > > > =20 > > > > Submitted by: John Reimer > > > > (earlier version) Discussed some with: emaste, markj > > > > Relnotes: sure > > > > Differential Revision: https://reviews.freebsd.org/D21568 > > > >=20 > > > > Added: > > > > head/share/man/man4/netgdb.4 (contents, props changed) > > > > head/sys/gdb/netgdb.c (contents, props changed) > > > > head/sys/gdb/netgdb.h (contents, props changed) > > > > Modified: > > > > head/share/man/man4/Makefile > > > > head/share/man/man4/ddb.4 > > > > head/sys/amd64/conf/GENERIC > > > > head/sys/conf/NOTES > > > > head/sys/conf/files > > > > head/sys/conf/options > > > > head/sys/gdb/gdb.h > > > > head/sys/gdb/gdb_int.h > > > > head/sys/gdb/gdb_main.c > > > > head/sys/gdb/gdb_packet.c > > > > head/sys/i386/conf/GENERIC > > > > head/sys/kern/subr_kdb.c > > > > head/sys/net/debugnet.c > > > > head/sys/net/debugnet.h > > > > head/sys/net/debugnet_inet.c > > > > head/sys/net/debugnet_int.h > > > > head/sys/sys/kdb.h > > > > head/sys/sys/param.h > > > >=20 > > > > Modified: head/share/man/man4/Makefile > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D > > > > --- head/share/man/man4/Makefile Thu Oct 17 21:25:50 > > > > 2019 (r353699) +++ head/share/man/man4/Makefile Thu > > > > Oct 17 21:33:01 2019 (r353700) @@ -307,6 +307,7 @@ MAN=3D > > > > aac.4 \ net80211.4 \ > > > > netdump.4 \ > > > > netfpga10g_nf10bmac.4 \ > > > > + netgdb.4 \ > > > > netgraph.4 \ > > > > netintro.4 \ > > > > netmap.4 \ > > > > =20 > > > [...] > > >=20 > > >=20 > > > Having "nooptions NETGDB # netgdb(4) client support" > > > defined in my kernel config file, buildkernel fails with the error > > > shown below. > > >=20 > > > [...] > > > --- debugnet.o --- > > > /usr/src/sys/net/debugnet.c:662:4: error: implicit declaration of > > > function 'db_printf' is invalid in C99 > > > [-Werror,-Wimplicit-function-declaration] db_printf("%s: Could not > > > get route for that server.\n", ^ /usr/src/sys/net/debugnet.c:662:4: > > > note: did you mean 'if_printf'? /usr/src/sys/net/if_var.h:679:5: > > > note: 'if_printf' declared here int if_printf(struct ifnet *, > > > const char *, ...) __printflike(2, 3); ^ > > > 1 error generated. =20 > >=20 > > And I also had to add "nooptions NETDUMP" to get the kernel to compile > > and link. > >=20 > > I already had "nooptions NETDUMP" defined. This will fix it. Index: sys/net/debugnet.c =================================================================== --- sys/net/debugnet.c (revision 353717) +++ sys/net/debugnet.c (working copy) @@ -659,8 +659,10 @@ CURVNET_RESTORE(); if (dest_rt == NULL) { +#ifdef DDB db_printf("%s: Could not get route for that server.\n", __func__); +#endif error = ENOENT; goto cleanup; } -- 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-all@freebsd.org Fri Oct 18 15:20:25 2019 Return-Path: Delivered-To: svn-src-all@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 0B5DD153796; Fri, 18 Oct 2019 15:20:25 +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 46vqV06SLlz3CXm; Fri, 18 Oct 2019 15:20:24 +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 C0F7FAD24; Fri, 18 Oct 2019 15:20:24 +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 x9IFKONH094173; Fri, 18 Oct 2019 15:20:24 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9IFKOd2094171; Fri, 18 Oct 2019 15:20:24 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910181520.x9IFKOd2094171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Fri, 18 Oct 2019 15:20:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353732 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353732 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 15:20:25 -0000 Author: glebius Date: Fri Oct 18 15:20:24 2019 New Revision: 353732 URL: https://svnweb.freebsd.org/changeset/base/353732 Log: Make rt_getifa_fib() static. Modified: head/sys/net/route.c head/sys/net/route.h Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Fri Oct 18 14:05:13 2019 (r353731) +++ head/sys/net/route.c Fri Oct 18 15:20:24 2019 (r353732) @@ -135,6 +135,7 @@ VNET_DEFINE_STATIC(uma_zone_t, rtzone); /* Routing ta EVENTHANDLER_LIST_DEFINE(rt_addrmsg); +static int rt_getifa_fib(struct rt_addrinfo *, u_int); static int rtrequest1_fib_change(struct rib_head *, struct rt_addrinfo *, struct rtentry **, u_int); static void rt_setmetrics(const struct rt_addrinfo *, struct rtentry *); Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Fri Oct 18 14:05:13 2019 (r353731) +++ head/sys/net/route.h Fri Oct 18 15:20:24 2019 (r353732) @@ -488,7 +488,6 @@ int rtinit(struct ifaddr *, int, int); * For now the protocol indepedent versions are the same as the AF_INET ones * but this will change.. */ -int rt_getifa_fib(struct rt_addrinfo *, u_int fibnum); void rtalloc_ign_fib(struct route *ro, u_long ignflags, u_int fibnum); struct rtentry *rtalloc1_fib(struct sockaddr *, int, u_long, u_int); int rtioctl_fib(u_long, caddr_t, u_int); From owner-svn-src-all@freebsd.org Fri Oct 18 16:00:00 2019 Return-Path: Delivered-To: svn-src-all@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 8742C1555DF; Fri, 18 Oct 2019 16:00:00 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46vrMg23C8z3GZX; Fri, 18 Oct 2019 15:59:58 +0000 (UTC) (envelope-from ohartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1571414383; bh=E0Hzq67jyMpDXiLIE5+62UlwouI/OT45vg9wu+7KeSQ=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=e7Zw5tcuN7hIwHHDTAw+312NNvfHuNdRB2Bd/SC3xx8h40ujGUvC+2E9/UTLbqY4P YLJCUcH36T0yZL5XQZfJDQU5ROf8fmzvCRH0FtfhDupsL4FFP51ZzE27tae+IZgqVP pA7qmegXqW1X8KizhH3xy5bKaa+iGn4hzvD/NEcI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermann.fritz.box ([91.65.85.161]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N0Fxf-1i9UHG1qP1-00xO8P; Fri, 18 Oct 2019 17:54:17 +0200 Date: Fri, 18 Oct 2019 17:54:06 +0200 From: "Hartmann, O." To: Cy Schubert Cc: "Hartmann, O." , svn-src-head@freebsd.org, Gary Jennejohn , src-committers@freebsd.org, svn-src-all@freebsd.org, Conrad Meyer Subject: Re: svn commit: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys Message-ID: <20191018175406.0ff89bbc@hermann.fritz.box> In-Reply-To: <201910181424.x9IEOC9q013885@slippy.cwsent.com> References: <201910172133.x9HLX1kl071044@repo.freebsd.org> <20191018122104.389ffb7a@hermann.fritz.box> <20191018140045.31d269b0@ernst.home> <20191018160935.7dda61c4@hermann.fritz.box> <201910181424.x9IEOC9q013885@slippy.cwsent.com> Organization: walstatt.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/w8CGTs2D0os+h1ujbS5RYJO"; protocol="application/pgp-signature" X-Provags-ID: V03:K1:vZUR95Jj0HrPjDDmhrG6wVYJwJrHxjGRiGnzpItcJzGTO8EwbW/ NX77oG9kEVf3RghzVNNaucOvFGI4tsdmQuR0sM3i4llLN2GdRz2YMUPdVbUKCyDHmYvvq4U leAyk/oHjxB7iAoJYI8+rtsJb+iTRU/OWpgS58jLqERWgmJhUHb5VBkLkIgF+OLr/4+U2VE dpNetB1eXL/QHsg+uaElw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:k3g4RdYWJNE=:v3s6w4DHEWMKaihoomYWT3 GITKMoMo9tdEYqXNaKxUEq75r2tTHf1rJxsrSTk/P18AjfcXo+Vsuo3txLEQHMBEJ2Jz++UQi xrsSDTuX28CouUiv84z8eWR3vgkwbPeLOLi7yDT9rkGUWDEmggH7jICuhkQfMIXjSR6m81urN jZjb8DyCuKO3eeBRzi8XUqAGJZTy6yx35xky1fMazGTDnCFHySKTqow/MreZxNjYOAQQNCsaa eyLqkQrdPrdUeUZp8icSnyuQIoeOR0G89DcEil/JLO5xFR2Ckem3yOiuO9pJP6MSbZFIOg7cn 1s3hWq1dgtJu+Mb5rt1UoE3W4F/eU6NbVoM1A84MmkKfoQJSAAGwDkQ3znt8sS7c2ZZPyZwb4 t5L3W1u4p9U+cg4DyeD4dPTtXaG8RWfIv463HpJZPHVxGQkQH2P1gg3KNr/rJWzJMnTEv/vwn jax9+sY6cngFhMXlgu9GDF+TrGDDj1g9kS3ZZ0ymPK+MTPPCZ+psI8G8FZw9zps2g0tamVyJY Fk7XLxCKUq0ILRpmpjCOl6yFc/sFHkgHBzEYiLXrck4sk8oWvd6KSsQt6UxBDr0sEhLtHvA5q HhdqOzJ8C3namfm7RYKwGQcSE9XTNFV5HmnHb99aexJhyTwkkHFZwxunkjaxHhseHZkdEzVWb bRLloa2S8oHlPGlXukApfRmmuGVNbA2+Lg8TlH/7LrAVTOHx3ayLaJJoAQzOTkWwY6d4e3FAD KgwhYnCyjf9ueShi7fbS4D8tAZVHUfTpxXIl/qfJFv3K99+OD+MIzQR/CTWstjAyuuV31LYUF 779BheGDbOIK0LU3p0jmnm72yuOYo5u+KgBIr1kxBf0HHQXMkUygIH3YzSNqm2Cjjw5GW5cSz RsK7tEtB3gbSL/beozlcKJqdBdU1wDFiHtWYjJvGVcB4KIaE1YXGuLXe3HAp1F31J07YbltTS cDK5EViTn2sq8La2XnkZ7RKXezsFva5NrDTsarKwL8jVsiRUqG898TV8xam5Nd+IPogfiL9Ua OklFZtfhhZ3hrJTySgoC3wne3ypdKDn6JHWIA2gHXZ6b0VGoCKMMqQpq6jWn5H/7UkbIPG8au CYoC3Hp0Ucidrjxrjx2KNaJTjlTB3zmWT378GGS6NfSOutFGuzRzxw1ijfhIlQLrxjU+WB109 Jud9E9itVtsWAz7jI0fNb452fY9wkrEgNo5MZfgrwGbvZYSLwokD4SFOC3CvyLX2LK6dbT8lp VDDIf/b245aMAmugzUrOYdkW5enT+WAj0VAOuENDNEpdo3WYW7e/vNy1uI4Y= X-Rspamd-Queue-Id: 46vrMg23C8z3GZX X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.b=e7Zw5tcu; dmarc=none; spf=none (mx1.freebsd.org: domain of ohartmann@walstatt.org has no SPF policy when checking 212.227.17.20) smtp.mailfrom=ohartmann@walstatt.org X-Spamd-Result: default: False [-5.67 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmx.net:s=badeba3b8450]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; IP_SCORE(-1.17)[ip: (-6.50), ipnet: 212.227.0.0/16(-1.35), asn: 8560(2.00), country: DE(-0.01)]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[walstatt.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; HAS_ORG_HEADER(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmx.net:+]; RCPT_COUNT_SEVEN(0.00)[7]; R_SPF_NA(0.00)[]; SIGNED_PGP(-2.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[20.17.227.212.list.dnswl.org : 127.0.3.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[161.85.65.91.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 16:00:00 -0000 --Sig_/w8CGTs2D0os+h1ujbS5RYJO Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Fri, 18 Oct 2019 07:24:12 -0700 Cy Schubert wrote: > In message <20191018160935.7dda61c4@hermann.fritz.box>, "Hartmann, > O." writes: > > --Sig_/QDD9BZgeMM6.TJkOIciNb32 > > Content-Type: text/plain; charset=3DUS-ASCII > > Content-Transfer-Encoding: quoted-printable > > > > On Fri, 18 Oct 2019 14:00:45 +0200 > > Gary Jennejohn wrote: > > =20 > > > On Fri, 18 Oct 2019 12:21:04 +0200 > > > "Hartmann, O." wrote: > > >=3D20 =20 > > > > On Thu, 17 Oct 2019 21:33:01 +0000 (UTC) > > > > Conrad Meyer wrote: > > > > =3D20 =20 > > > > > Author: cem > > > > > Date: Thu Oct 17 21:33:01 2019 > > > > > New Revision: 353700 > > > > > URL: https://svnweb.freebsd.org/changeset/base/353700 > > > > >=3D20 > > > > > Log: > > > > > Implement NetGDB(4) > > > > > =3D20 > > > > > NetGDB(4) is a component of a system using a panic-time > > > > > network stack to remotely debug crashed FreeBSD kernels over > > > > > the network, instead of traditional serial interfaces. > > > > > =3D20 > > > > > There are three pieces in the complete NetGDB system. > > > > > =3D20 > > > > > First, a dedicated proxy server must be running to accept > > > > > connections from both NetGDB and gdb(1), and pass > > > > > bidirectional traffic between the two protocols. > > > > > =3D20 > > > > > Second, the NetGDB client is activated much like ordinary > > > > > 'gdb' and similarly to 'netdump' in ddb(4) after a panic. > > > > > Like other debugnet(4) clients (netdump(4)), the network > > > > > interface on the route to the proxy server must be online and > > > > > support debugnet(4). =3D20 > > > > > Finally, the remote (k)gdb(1) uses 'target remote > > > > > :' (like any other TCP remote) to connect to the > > > > > proxy server.=3D20 > > > > > The NetGDB v1 protocol speaks the literal GDB remote serial > > > > > protocol, and uses a 1:1 relationship between GDB packets and > > > > > sequences of debugnet packets (fragmented by MTU). There is > > > > > no encryption utilized to keep debugging sessions private, so > > > > > this is only appropriate for local segments or trusted > > > > > networks. =3D20 > > > > > Submitted by: John Reimer > > > > > (earlier version) Discussed some with: emaste, markj > > > > > Relnotes: sure > > > > > Differential Revision: > > > > > https://reviews.freebsd.org/D21568 > > > > >=3D20 > > > > > Added: > > > > > head/share/man/man4/netgdb.4 (contents, props changed) > > > > > head/sys/gdb/netgdb.c (contents, props changed) > > > > > head/sys/gdb/netgdb.h (contents, props changed) > > > > > Modified: > > > > > head/share/man/man4/Makefile > > > > > head/share/man/man4/ddb.4 > > > > > head/sys/amd64/conf/GENERIC > > > > > head/sys/conf/NOTES > > > > > head/sys/conf/files > > > > > head/sys/conf/options > > > > > head/sys/gdb/gdb.h > > > > > head/sys/gdb/gdb_int.h > > > > > head/sys/gdb/gdb_main.c > > > > > head/sys/gdb/gdb_packet.c > > > > > head/sys/i386/conf/GENERIC > > > > > head/sys/kern/subr_kdb.c > > > > > head/sys/net/debugnet.c > > > > > head/sys/net/debugnet.h > > > > > head/sys/net/debugnet_inet.c > > > > > head/sys/net/debugnet_int.h > > > > > head/sys/sys/kdb.h > > > > > head/sys/sys/param.h > > > > >=3D20 > > > > > Modified: head/share/man/man4/Makefile > > > > > =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D > > > > > =20 > > =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D > > =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D > > =3D3D=3D3D=3D3D=3D3D=3D3D =20 > > > > > --- head/share/man/man4/Makefile Thu Oct 17 21:25:50 > > > > > 2019 (r353699) +++ head/share/man/man4/Makefile > > > > > Thu Oct 17 21:33:01 2019 (r353700) @@ -307,6 +307,7 @@ > > > > > MAN=3D3D aac.4 \ net80211.4 \ > > > > > netdump.4 \ > > > > > netfpga10g_nf10bmac.4 \ > > > > > + netgdb.4 \ > > > > > netgraph.4 \ > > > > > netintro.4 \ > > > > > netmap.4 \ > > > > > =3D20 =20 > > > > [...] > > > >=3D20 > > > >=3D20 > > > > Having "nooptions NETGDB # netgdb(4) client > > > > support" defined in my kernel config file, buildkernel fails > > > > with the error shown below. > > > >=3D20 > > > > [...] > > > > --- debugnet.o --- > > > > /usr/src/sys/net/debugnet.c:662:4: error: implicit declaration > > > > of function 'db_printf' is invalid in C99 > > > > [-Werror,-Wimplicit-function-declaration] db_printf("%s: Could > > > > not get route for that server.\n", ^ > > > > /usr/src/sys/net/debugnet.c:662:4: note: did you mean > > > > 'if_printf'? /usr/src/sys/net/if_var.h:679:5: note: 'if_printf' > > > > declared here int if_printf(struct ifnet *, const char *, > > > > ...) __printflike(2, 3); ^ 1 error generated. =3D20 =20 > > >=3D20 > > > And I also had to add "nooptions NETDUMP" to get the kernel to > > > compile and link. > > >=3D20 =20 > > > > I already had "nooptions NETDUMP" defined. =20 >=20 >=20 > This will fix it. >=20 > Index: sys/net/debugnet.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/net/debugnet.c (revision 353717) > +++ sys/net/debugnet.c (working copy) > @@ -659,8 +659,10 @@ > CURVNET_RESTORE(); > =20 > if (dest_rt =3D=3D NULL) { > +#ifdef DDB > db_printf("%s: Could not get route for that > server.\n", __func__); > +#endif > error =3D ENOENT; > goto cleanup; > } >=20 >=20 >=20 Doesn't work, either. The kernel config in question doesn't have any debugging features enabled, so nooptions DDB is alos part of the configuration. buildkernel still fails. --Sig_/w8CGTs2D0os+h1ujbS5RYJO Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQSy8IBxAPDkqVBaTJ44N1ZZPba5RwUCXangHgAKCRA4N1ZZPba5 R3XjAP95797t8GjhHOEpWzpRgVnqCUqwlILMCfnfNGg7utiT/wD+K68c0jUlNech 9/peDfPKI5RNnoLf2+LYRIsyErjF2g0= =eD7J -----END PGP SIGNATURE----- --Sig_/w8CGTs2D0os+h1ujbS5RYJO-- From owner-svn-src-all@freebsd.org Fri Oct 18 16:26:58 2019 Return-Path: Delivered-To: svn-src-all@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 482441565A4; Fri, 18 Oct 2019 16:26:58 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (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 46vrym6wf4z3J8X; Fri, 18 Oct 2019 16:26:56 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id LV5YiXurmsAGkLV5aiWw5G; Fri, 18 Oct 2019 10:26:55 -0600 X-Authority-Analysis: v=2.3 cv=WeVylHpX c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=XobE76Q3jBoA:10 a=iaTFZB6CAAAA:8 a=YxBL1-UpAAAA:8 a=pGLkceISAAAA:8 a=6I5d2MoRAAAA:8 a=G0_B3m8xAAAA:8 a=VXcI11JvlDucMuln8ncA:9 a=03t3JxZHb-m5AuWU:21 a=QEXdDO2ut3YA:10 a=pThwds9OuXRA_LM2CIoA:9 a=a5S4O0aUlPCBZ32j:21 a=_W_S_7VecoQA:10 a=QWXrQ9iV8q7LKaLQ9lfw:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 a=gBgTPrObzSPeouD7eQ2s:22 Received: from [192.168.1.103] (S0106002401cb186f.gv.shawcable.net [70.67.125.17]) by spqr.komquats.com (Postfix) with ESMTPSA id 9DE3041A; Fri, 18 Oct 2019 09:26:51 -0700 (PDT) Date: Fri, 18 Oct 2019 09:26:51 -0700 User-Agent: K-9 Mail for Android In-Reply-To: <20191018175406.0ff89bbc@hermann.fritz.box> References: <201910172133.x9HLX1kl071044@repo.freebsd.org> <20191018122104.389ffb7a@hermann.fritz.box> <20191018140045.31d269b0@ernst.home> <20191018160935.7dda61c4@hermann.fritz.box> <201910181424.x9IEOC9q013885@slippy.cwsent.com> <20191018175406.0ff89bbc@hermann.fritz.box> MIME-Version: 1.0 Subject: Re: svn commit: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys To: "Hartmann, O." CC: svn-src-head@freebsd.org, Gary Jennejohn , src-committers@freebsd.org, svn-src-all@freebsd.org, Conrad Meyer From: Cy Schubert Message-ID: X-CMAE-Envelope: MS4wfISFSXtsu8/mey7DhLtwY3vCGJjoYz0Kk/IJZ1ydV2JMvge+xLHn5RxS3GJrpXXC+3dOxmZ4WfafAoZRggcWmF3kEW2nVkyGUiwAiZyZ89szKwXn5dDs D3QueFZn5dhCaPwH0GmD20bEmZ1xq28bZiXhYFc9GYymt3ue5t5C/zckGItRyoIbawH0yPmjccKhZzAqJlZYgL9v3LE8p3Dear4Yz12zVCQiyfcB4tSuf3kl pPpMTbP6Fzm6tMiuLth+fVKT8Zp+3GIGDYnXB0DCPSDlNjtErYSXKy5DKyFZMityE2RCO5AhUY3zZm2Duv5bKw== X-Rspamd-Queue-Id: 46vrym6wf4z3J8X 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.134.9) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-3.45 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; RCVD_TLS_LAST(0.00)[]; URI_COUNT_ODD(1.00)[9]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[9.134.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:+,1:+,2:~]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(-2.35)[ip: (-6.23), ipnet: 64.59.128.0/20(-3.05), asn: 6327(-2.37), country: CA(-0.09)]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 16:26:58 -0000 On October 18, 2019 8:54:06 AM PDT, "Hartmann, O=2E" wrote: >On Fri, 18 Oct 2019 07:24:12 -0700 >Cy Schubert wrote: > >> In message <20191018160935=2E7dda61c4@hermann=2Efritz=2Ebox>, "Hartmann= , >> O=2E" writes: >> > --Sig_/QDD9BZgeMM6=2ETJkOIciNb32 >> > Content-Type: text/plain; charset=3DUS-ASCII >> > Content-Transfer-Encoding: quoted-printable >> > >> > On Fri, 18 Oct 2019 14:00:45 +0200 >> > Gary Jennejohn wrote: >> > =20 >> > > On Fri, 18 Oct 2019 12:21:04 +0200 >> > > "Hartmann, O=2E" wrote: >> > >=3D20 =20 >> > > > On Thu, 17 Oct 2019 21:33:01 +0000 (UTC) >> > > > Conrad Meyer wrote: >> > > > =3D20 =20 >> > > > > Author: cem >> > > > > Date: Thu Oct 17 21:33:01 2019 >> > > > > New Revision: 353700 >> > > > > URL: https://svnweb=2Efreebsd=2Eorg/changeset/base/353700 >> > > > >=3D20 >> > > > > Log: >> > > > > Implement NetGDB(4) >> > > > > =3D20 >> > > > > NetGDB(4) is a component of a system using a panic-time >> > > > > network stack to remotely debug crashed FreeBSD kernels over >> > > > > the network, instead of traditional serial interfaces=2E >> > > > > =3D20 >> > > > > There are three pieces in the complete NetGDB system=2E >> > > > > =3D20 >> > > > > First, a dedicated proxy server must be running to accept >> > > > > connections from both NetGDB and gdb(1), and pass >> > > > > bidirectional traffic between the two protocols=2E >> > > > > =3D20 >> > > > > Second, the NetGDB client is activated much like ordinary >> > > > > 'gdb' and similarly to 'netdump' in ddb(4) after a panic=2E >> > > > > Like other debugnet(4) clients (netdump(4)), the network >> > > > > interface on the route to the proxy server must be online and >> > > > > support debugnet(4)=2E =3D20 >> > > > > Finally, the remote (k)gdb(1) uses 'target remote >> > > > > :' (like any other TCP remote) to connect to the >> > > > > proxy server=2E=3D20 >> > > > > The NetGDB v1 protocol speaks the literal GDB remote serial >> > > > > protocol, and uses a 1:1 relationship between GDB packets and >> > > > > sequences of debugnet packets (fragmented by MTU)=2E There is >> > > > > no encryption utilized to keep debugging sessions private, so >> > > > > this is only appropriate for local segments or trusted >> > > > > networks=2E =3D20 >> > > > > Submitted by: John Reimer >> > > > > (earlier version) Discussed some with: emaste, markj >> > > > > Relnotes: sure >> > > > > Differential Revision: >> > > > > https://reviews=2Efreebsd=2Eorg/D21568 >> > > > >=3D20 >> > > > > Added: >> > > > > head/share/man/man4/netgdb=2E4 (contents, props changed) >> > > > > head/sys/gdb/netgdb=2Ec (contents, props changed) >> > > > > head/sys/gdb/netgdb=2Eh (contents, props changed) >> > > > > Modified: >> > > > > head/share/man/man4/Makefile >> > > > > head/share/man/man4/ddb=2E4 >> > > > > head/sys/amd64/conf/GENERIC >> > > > > head/sys/conf/NOTES >> > > > > head/sys/conf/files >> > > > > head/sys/conf/options >> > > > > head/sys/gdb/gdb=2Eh >> > > > > head/sys/gdb/gdb_int=2Eh >> > > > > head/sys/gdb/gdb_main=2Ec >> > > > > head/sys/gdb/gdb_packet=2Ec >> > > > > head/sys/i386/conf/GENERIC >> > > > > head/sys/kern/subr_kdb=2Ec >> > > > > head/sys/net/debugnet=2Ec >> > > > > head/sys/net/debugnet=2Eh >> > > > > head/sys/net/debugnet_inet=2Ec >> > > > > head/sys/net/debugnet_int=2Eh >> > > > > head/sys/sys/kdb=2Eh >> > > > > head/sys/sys/param=2Eh >> > > > >=3D20 >> > > > > Modified: head/share/man/man4/Makefile >> > > > > >=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D= 3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D >> > > > > =20 >> > >=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D= 3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D >> > >=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D= 3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D >> > =3D3D=3D3D=3D3D=3D3D=3D3D =20 >> > > > > --- head/share/man/man4/Makefile Thu Oct 17 21:25:50 >> > > > > 2019 (r353699) +++ head/share/man/man4/Makefile >> > > > > Thu Oct 17 21:33:01 2019 (r353700) @@ -307,6 +307,7 @@ >> > > > > MAN=3D3D aac=2E4 \ net80211=2E4 \ >> > > > > netdump=2E4 \ >> > > > > netfpga10g_nf10bmac=2E4 \ >> > > > > + netgdb=2E4 \ >> > > > > netgraph=2E4 \ >> > > > > netintro=2E4 \ >> > > > > netmap=2E4 \ >> > > > > =3D20 =20 >> > > > [=2E=2E=2E] >> > > >=3D20 >> > > >=3D20 >> > > > Having "nooptions NETGDB # netgdb(4) client >> > > > support" defined in my kernel config file, buildkernel fails >> > > > with the error shown below=2E >> > > >=3D20 >> > > > [=2E=2E=2E] >> > > > --- debugnet=2Eo --- >> > > > /usr/src/sys/net/debugnet=2Ec:662:4: error: implicit declaration >> > > > of function 'db_printf' is invalid in C99 >> > > > [-Werror,-Wimplicit-function-declaration] db_printf("%s: Could >> > > > not get route for that server=2E\n", ^ >> > > > /usr/src/sys/net/debugnet=2Ec:662:4: note: did you mean >> > > > 'if_printf'? /usr/src/sys/net/if_var=2Eh:679:5: note: 'if_printf' >> > > > declared here int if_printf(struct ifnet *, const char *, >> > > > =2E=2E=2E) __printflike(2, 3); ^ 1 error generated=2E =3D20 =20 >> > >=3D20 >> > > And I also had to add "nooptions NETDUMP" to get the kernel to >> > > compile and link=2E >> > >=3D20 =20 >> > >> > I already had "nooptions NETDUMP" defined=2E =20 >>=20 >>=20 >> This will fix it=2E >>=20 >> Index: sys/net/debugnet=2Ec >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- sys/net/debugnet=2Ec (revision 353717) >> +++ sys/net/debugnet=2Ec (working copy) >> @@ -659,8 +659,10 @@ >> CURVNET_RESTORE(); >> =20 >> if (dest_rt =3D=3D NULL) { >> +#ifdef DDB >> db_printf("%s: Could not get route for that >> server=2E\n", __func__); >> +#endif >> error =3D ENOENT; >> goto cleanup; >> } >>=20 >>=20 >>=20 > >Doesn't work, either=2E >The kernel config in question doesn't have any debugging features >enabled, so nooptions DDB is alos part of the configuration=2E >buildkernel still fails=2E Hmm=2E Fixed my firewall build=2E My non-test firewall kernel config has t= he same nooption=2E What other options/nooptions and patches are applied to your tree? --=20 Pardon the typos and autocorrect, small keyboard in use=2E=20 Cy Schubert FreeBSD UNIX: Web: https://www=2EFreeBSD=2Eorg The need of the many outweighs the greed of the few=2E Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E From owner-svn-src-all@freebsd.org Fri Oct 18 16:37:32 2019 Return-Path: Delivered-To: svn-src-all@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 1E8E41567AB; Fri, 18 Oct 2019 16:37:32 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46vsBy5FGdz3Jbm; Fri, 18 Oct 2019 16:37:30 +0000 (UTC) (envelope-from ohartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1571416641; bh=7+hvhbC08P7S+3eqQzRfAEWDi83Hd6+hL4fCI/NYg4k=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=XGuvcNonOHeAHnqbX1FeQ0bAj+Uhls0IWHYEH863Jjv7Kzyj6jISndVfUfEBTBPfz xYmAg2vBWheXdkUhQ+D9/+TnIh7Fsub0XbkJCuy2YdPvrnnlHFYRUDpkqRwrrQtp89 iZdnAJPAproQjNGoj0EjtZ6+FONaCiXDZ0+ybLoA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermann.fritz.box ([91.65.85.161]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N33ET-1htUDt32b7-013NTv; Fri, 18 Oct 2019 18:37:20 +0200 Date: Fri, 18 Oct 2019 18:37:18 +0200 From: "Hartmann, O." To: Cy Schubert Cc: "Hartmann, O." , svn-src-head@freebsd.org, Gary Jennejohn , src-committers@freebsd.org, svn-src-all@freebsd.org, Conrad Meyer Subject: Re: svn commit: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys Message-ID: <20191018183718.5e6b3d62@hermann.fritz.box> In-Reply-To: References: <201910172133.x9HLX1kl071044@repo.freebsd.org> <20191018122104.389ffb7a@hermann.fritz.box> <20191018140045.31d269b0@ernst.home> <20191018160935.7dda61c4@hermann.fritz.box> <201910181424.x9IEOC9q013885@slippy.cwsent.com> <20191018175406.0ff89bbc@hermann.fritz.box> Organization: walstatt.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/icZw9PmU7w9Aj=UqDZhZj.c"; protocol="application/pgp-signature" X-Provags-ID: V03:K1:AWYm/esxchJpRYP42bcADWZVu7bZSgK8+vXQv27OcQSYBGU3akc mfPq8sA7YfOXMjON3LVOD9fwTLNZpmV9Qgg4mIpqx9SBzGz7KkY22+IEVxSBnTBAvpYc0hG q6kST7lARs7E5/FwalFeI+f0rnTUtz2qN9Ckhnrr11a9yCklYfVydMBIJbUKOLflM/HzH0w iAZIODHk9XuFI1DZ0sJyQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:zw/bDLa7l3Y=:TWQABc8XYPAaBVwlRkmEU+ kWeD7n2byvU4KhoSKs7Klf4Yy28JpWhxjn1CPC1XPIcan3r4+rxyeVtRda6+hI3kiFlBFdzHJ MRspfHUxfNPKKtTApejC3MwEhKlnzjE1Qq+b7rG2H+XRZn61d0O/K8qWsVRBetsSUJPeBffUN TuNkNzNnPGoedy+wB7Fnh6R077jjJYGuc0pIOtKhC1wCwhNgcJPdRSI/hhtezdJFPfC1haK1d KXr0sOxlrhoxKn03z63hkl63DacUiiq8ThWNXcmGhJ6CKPfS7uESws2c9pFeEz67ylV0yllbC Qh9NZMpgmnkp3MetKgVnAgwXqN5i+B/imxBy3yvi/AHcsmgSdgs3myEbwO9OV+WVZR1aw21l2 hLuRG1v5V2SNy8YZbyRKdAap+d8eI3rRRpHCcKyyxH7BkhLx54+TJn3hykCcHgMuxdRB1YXRs G0WlPro84hM7tMBa8k3+nRHxu8cJWu63xhu3OqYtB1yP5T3iFQNRt0WL/TecP3Pc7u++lR/W4 I6EQTtaM/wn9eno7oWeVhI3VqpZoui2Hyw0GHpr5cCBc7a6+UIsY4hVh893Rm1S3NR8AlDRSH N1xm3jiYb7HYtJNkVRwHJ4DtvT/vdJzON/9Fd/QKbAwQCIeTC+CzZcYyxVdl3pHRbXBsXAIph I2vNrw6bhoyDPM/aPgyzoOvMG3hlEpcygx8NMGYFengiAmn5dWmys6nLER1O53JFsNMroWBVO jkX0wg/fQekZftc5OTyK13zOEeSU5WWOTSkAErI1rRpshEogM0E3CDx24yJm5j2VLs4rbnwn0 zCC9ZCpAFeJa9vmkPk/FRKOWP1MEZnCl4f9kY13/0MZzZmwHs5QOU6CNFsmgzRbM45FPcFe8k zwfXm7Lt0oTgzkpMtffvp1CXmy2Wq+a8KLDB+6uxYvV0PE+gZZFfxYgYJMX+WnJb8YFwTudvb nQbGNvp+jPYeoWpO7lrL0/QP6Xj2g+lNdMW0v72HqhqbSP1lcLYnuyU3EjUDbs3uZQOvQJRg0 azQwB+c11/nRNYrPzPeJGzGg+MgKBKiSXJJCIzwP9Y076soy78RrI/wl4BAiI/Vd3Eg354fd6 rsiyMmm0OuNfzOibJx9wWH8HPSov5XHwd7C/LUWJrxQXQVYS35ZDYfZ6QLkhoGgXdg/pYgMZ3 dRfQv5Z2xZJ4HOLuj4Kbr5g+ZgsYuesnqFOtMmw9ze5JJumJvnqIWefQGUJQBOqGrudZPDYPe xu4iuilHzQ3766R7F5xCPxJTqU1XJ3PNz7NzsBNYnkQs/2K+Bkb8v+ZqKCS4= X-Rspamd-Queue-Id: 46vsBy5FGdz3Jbm X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.b=XGuvcNon; dmarc=none; spf=none (mx1.freebsd.org: domain of ohartmann@walstatt.org has no SPF policy when checking 212.227.17.22) smtp.mailfrom=ohartmann@walstatt.org X-Spamd-Result: default: False [-5.51 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmx.net:s=badeba3b8450]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; IP_SCORE(-1.01)[ip: (-5.68), ipnet: 212.227.0.0/16(-1.36), asn: 8560(1.99), country: DE(-0.01)]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[walstatt.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; HAS_ORG_HEADER(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmx.net:+]; RCPT_COUNT_SEVEN(0.00)[7]; R_SPF_NA(0.00)[]; SIGNED_PGP(-2.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[22.17.227.212.list.dnswl.org : 127.0.3.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[161.85.65.91.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 16:37:32 -0000 --Sig_/icZw9PmU7w9Aj=UqDZhZj.c Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Fri, 18 Oct 2019 09:26:51 -0700 Cy Schubert wrote: > On October 18, 2019 8:54:06 AM PDT, "Hartmann, O." > wrote: > >On Fri, 18 Oct 2019 07:24:12 -0700 > >Cy Schubert wrote: > > =20 > >> In message <20191018160935.7dda61c4@hermann.fritz.box>, "Hartmann, > >> O." writes: =20 > >> > --Sig_/QDD9BZgeMM6.TJkOIciNb32 > >> > Content-Type: text/plain; charset=3DUS-ASCII > >> > Content-Transfer-Encoding: quoted-printable > >> > > >> > On Fri, 18 Oct 2019 14:00:45 +0200 > >> > Gary Jennejohn wrote: > >> > =20 > >> > > On Fri, 18 Oct 2019 12:21:04 +0200 > >> > > "Hartmann, O." wrote: > >> > >=3D20 =20 > >> > > > On Thu, 17 Oct 2019 21:33:01 +0000 (UTC) > >> > > > Conrad Meyer wrote: > >> > > > =3D20 =20 > >> > > > > Author: cem > >> > > > > Date: Thu Oct 17 21:33:01 2019 > >> > > > > New Revision: 353700 > >> > > > > URL: https://svnweb.freebsd.org/changeset/base/353700 > >> > > > >=3D20 > >> > > > > Log: > >> > > > > Implement NetGDB(4) > >> > > > > =3D20 > >> > > > > NetGDB(4) is a component of a system using a panic-time > >> > > > > network stack to remotely debug crashed FreeBSD kernels > >> > > > > over the network, instead of traditional serial interfaces. > >> > > > > =3D20 > >> > > > > There are three pieces in the complete NetGDB system. > >> > > > > =3D20 > >> > > > > First, a dedicated proxy server must be running to accept > >> > > > > connections from both NetGDB and gdb(1), and pass > >> > > > > bidirectional traffic between the two protocols. > >> > > > > =3D20 > >> > > > > Second, the NetGDB client is activated much like ordinary > >> > > > > 'gdb' and similarly to 'netdump' in ddb(4) after a panic. > >> > > > > Like other debugnet(4) clients (netdump(4)), the network > >> > > > > interface on the route to the proxy server must be online > >> > > > > and support debugnet(4). =3D20 > >> > > > > Finally, the remote (k)gdb(1) uses 'target remote > >> > > > > :' (like any other TCP remote) to connect to > >> > > > > the proxy server.=3D20 > >> > > > > The NetGDB v1 protocol speaks the literal GDB remote > >> > > > > serial protocol, and uses a 1:1 relationship between GDB > >> > > > > packets and sequences of debugnet packets (fragmented by > >> > > > > MTU). There is no encryption utilized to keep debugging > >> > > > > sessions private, so this is only appropriate for local > >> > > > > segments or trusted networks. =3D20 > >> > > > > Submitted by: John Reimer > >> > > > > (earlier version) Discussed some with: emaste, markj > >> > > > > Relnotes: sure > >> > > > > Differential Revision: > >> > > > > https://reviews.freebsd.org/D21568 > >> > > > >=3D20 > >> > > > > Added: > >> > > > > head/share/man/man4/netgdb.4 (contents, props changed) > >> > > > > head/sys/gdb/netgdb.c (contents, props changed) > >> > > > > head/sys/gdb/netgdb.h (contents, props changed) > >> > > > > Modified: > >> > > > > head/share/man/man4/Makefile > >> > > > > head/share/man/man4/ddb.4 > >> > > > > head/sys/amd64/conf/GENERIC > >> > > > > head/sys/conf/NOTES > >> > > > > head/sys/conf/files > >> > > > > head/sys/conf/options > >> > > > > head/sys/gdb/gdb.h > >> > > > > head/sys/gdb/gdb_int.h > >> > > > > head/sys/gdb/gdb_main.c > >> > > > > head/sys/gdb/gdb_packet.c > >> > > > > head/sys/i386/conf/GENERIC > >> > > > > head/sys/kern/subr_kdb.c > >> > > > > head/sys/net/debugnet.c > >> > > > > head/sys/net/debugnet.h > >> > > > > head/sys/net/debugnet_inet.c > >> > > > > head/sys/net/debugnet_int.h > >> > > > > head/sys/sys/kdb.h > >> > > > > head/sys/sys/param.h > >> > > > >=3D20 > >> > > > > Modified: head/share/man/man4/Makefile > >> > > > > =20 > >=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D > >=20 > >> > > > > =20 > >> > =20 > >=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D > >=20 > >> > =20 > >=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D > >=20 > >> > =3D3D=3D3D=3D3D=3D3D=3D3D =20 > >> > > > > --- head/share/man/man4/Makefile Thu Oct 17 21:25:50 > >> > > > > 2019 (r353699) +++ head/share/man/man4/Makefile > >> > > > > Thu Oct 17 21:33:01 2019 (r353700) @@ -307,6 +307,7 > >> > > > > @@ MAN=3D3D aac.4 \ net80211.4 \ > >> > > > > netdump.4 \ > >> > > > > netfpga10g_nf10bmac.4 \ > >> > > > > + netgdb.4 \ > >> > > > > netgraph.4 \ > >> > > > > netintro.4 \ > >> > > > > netmap.4 \ > >> > > > > =3D20 =20 > >> > > > [...] > >> > > >=3D20 > >> > > >=3D20 > >> > > > Having "nooptions NETGDB # netgdb(4) client > >> > > > support" defined in my kernel config file, buildkernel fails > >> > > > with the error shown below. > >> > > >=3D20 > >> > > > [...] > >> > > > --- debugnet.o --- > >> > > > /usr/src/sys/net/debugnet.c:662:4: error: implicit > >> > > > declaration of function 'db_printf' is invalid in C99 > >> > > > [-Werror,-Wimplicit-function-declaration] db_printf("%s: > >> > > > Could not get route for that server.\n", ^ > >> > > > /usr/src/sys/net/debugnet.c:662:4: note: did you mean > >> > > > 'if_printf'? /usr/src/sys/net/if_var.h:679:5: note: > >> > > > 'if_printf' declared here int if_printf(struct ifnet *, > >> > > > const char *, ...) __printflike(2, 3); ^ 1 error generated. > >> > > > =3D20 =20 > >> > >=3D20 > >> > > And I also had to add "nooptions NETDUMP" to get the kernel to > >> > > compile and link. > >> > >=3D20 =20 > >> > > >> > I already had "nooptions NETDUMP" defined. =20 > >>=20 > >>=20 > >> This will fix it. > >>=20 > >> Index: sys/net/debugnet.c > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > >> --- sys/net/debugnet.c (revision 353717) > >> +++ sys/net/debugnet.c (working copy) > >> @@ -659,8 +659,10 @@ > >> CURVNET_RESTORE(); > >> =20 > >> if (dest_rt =3D=3D NULL) { > >> +#ifdef DDB > >> db_printf("%s: Could not get route for > >> that server.\n", __func__); > >> +#endif > >> error =3D ENOENT; > >> goto cleanup; > >> } > >>=20 > >>=20 > >> =20 > > > >Doesn't work, either. > >The kernel config in question doesn't have any debugging features > >enabled, so nooptions DDB is alos part of the configuration. > >buildkernel still fails. =20 >=20 > Hmm. Fixed my firewall build. My non-test firewall kernel config has > the same nooption. >=20 > What other options/nooptions and patches are applied to your tree? >=20 >=20 I use the vanilla CURRENT tree without any extra pachtes. There are lots of other nooptions, especially for drivers I do not need and debugging is completely turned off. Having "nooptions DDB" commeted out fixes the build for me. Anticipating the correct portion of my config file, here are those nooptions I deem relevant. The nooptions are kept in a file added to GENERIC afterwards: [... sorry for the line wrap] nooptions DDB_CTF # Kernel ELF linker loads CTF data nooptions INCLUDE_CONFIG_FILE # Include this file in kernel #options RACCT # Resource accounting framework #options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=3D0 by default #options RCTL # Resource limits # Debugging support. Always need this: #options KDB # Enable kernel debugger support. #options KDB_TRACE # Print a stack trace for a panic. # For full debugger support use (turn off in stable branch): nooptions BUF_TRACKING # Track buffer history nooptions DDB # Support DDB. nooptions FULL_BUF_TRACKING # Track more buffer history nooptions GDB # Support remote GDB. nooptions DEADLKRES # Enable the deadlock resolver nooptions INVARIANTS # Enable calls of extra sanity checking nooptions INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS nooptions WITNESS # Enable checks to detect deadlocks and cycles nooptions WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed nooptions MALLOC_DEBUG_MAXZONES # Separate malloc(9) zones nooptions VERBOSE_SYSINIT # Support debug.verbose_sysinit, off by default # Kernel Sanitizers #options COVERAGE # Generic kernel coverage. Used by KCOV #options KCOV # Kernel Coverage Sanitizer # Warning: KUBSAN can result in a kernel too large for loader to load #options KUBSAN # Kernel Undefined Behavior Sanitizer # Kernel dump features. #options EKCD # Support for encrypted kernel dumps #options GZIO # gzip-compressed kernel and user dumps #options ZSTDIO # zstd-compressed kernel and user dumps nooptions NETDUMP # netdump(4) client support nooptions NETGDB # netgdb(4) client support # Make an SMP-capable kernel by default #options SMP # Symmetric MultiProcessor Kernel #options EARLY_AP_STARTUP --Sig_/icZw9PmU7w9Aj=UqDZhZj.c Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQSy8IBxAPDkqVBaTJ44N1ZZPba5RwUCXanqPgAKCRA4N1ZZPba5 RywrAP4pll79LBiHh2yRWOOz1I56F+ruDKVm2wPDvBixjQc0fQD/ayNkbQ98WGDG FrTV7DEBffsX48/HokDtJo5foWJoNQA= =rKEx -----END PGP SIGNATURE----- --Sig_/icZw9PmU7w9Aj=UqDZhZj.c-- From owner-svn-src-all@freebsd.org Fri Oct 18 17:01:27 2019 Return-Path: Delivered-To: svn-src-all@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 EB8ED156E7C; Fri, 18 Oct 2019 17:01:27 +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 46vskb5fWtz3Kb2; Fri, 18 Oct 2019 17:01:27 +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 A32C7C284; Fri, 18 Oct 2019 17:01:27 +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 x9IH1RQE053701; Fri, 18 Oct 2019 17:01:27 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9IH1RpZ053700; Fri, 18 Oct 2019 17:01:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910181701.x9IH1RpZ053700@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 18 Oct 2019 17:01:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353733 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 353733 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 17:01:28 -0000 Author: markj Date: Fri Oct 18 17:01:27 2019 New Revision: 353733 URL: https://svnweb.freebsd.org/changeset/base/353733 Log: Abbreviate softdep lock names. The softdep lock names were unusually long and tended to stick out in lock profiling reports. Abbreviate them and make them consistent with our conventional style for lock names. Reviewed by: mckusick MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22042 Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Fri Oct 18 15:20:24 2019 (r353732) +++ head/sys/ufs/ffs/ffs_softdep.c Fri Oct 18 17:01:27 2019 (r353733) @@ -968,7 +968,7 @@ static int softdep_count_dependencies(struct buf *bp, * Global lock over all of soft updates. */ static struct mtx lk; -MTX_SYSINIT(softdep_lock, &lk, "Global Softdep Lock", MTX_DEF); +MTX_SYSINIT(softdep_lock, &lk, "global softdep", MTX_DEF); #define ACQUIRE_GBLLOCK(lk) mtx_lock(lk) #define FREE_GBLLOCK(lk) mtx_unlock(lk) @@ -2491,7 +2491,7 @@ softdep_mount(devvp, mp, fs, cred) ump = VFSTOUFS(mp); ump->um_softdep = sdp; MNT_IUNLOCK(mp); - rw_init(LOCK_PTR(ump), "Per-Filesystem Softdep Lock"); + rw_init(LOCK_PTR(ump), "per-fs softdep"); sdp->sd_ump = ump; LIST_INIT(&ump->softdep_workitem_pending); LIST_INIT(&ump->softdep_journal_pending); From owner-svn-src-all@freebsd.org Fri Oct 18 17:36:43 2019 Return-Path: Delivered-To: svn-src-all@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 95826157861; Fri, 18 Oct 2019 17:36:43 +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 46vtWH22Sjz3M63; Fri, 18 Oct 2019 17:36:43 +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 293B3C886; Fri, 18 Oct 2019 17:36:43 +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 x9IHag61076596; Fri, 18 Oct 2019 17:36:42 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9IHagIm076595; Fri, 18 Oct 2019 17:36:42 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910181736.x9IHagIm076595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 18 Oct 2019 17:36:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353734 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353734 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 17:36:43 -0000 Author: markj Date: Fri Oct 18 17:36:42 2019 New Revision: 353734 URL: https://svnweb.freebsd.org/changeset/base/353734 Log: Further constrain the use of per-CPU caches for free pages. In low memory conditions a significant number of pages may end up stuck in the caches, and currently these caches cannot be reaped, leading to spurious memory allocation failures and OOM kills. So: - Take into account the fact that we may cache up to two full buckets of pages per CPU, not just one. - Increase the amount of RAM required per CPU to enable the caches. This is a temporary measure until the page cache management policy is improved. PR: 241048 Reported and tested by: Kevin Oberman Reviewed by: alc, kib Discussed with: jeff MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22040 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Oct 18 17:01:27 2019 (r353733) +++ head/sys/vm/vm_page.c Fri Oct 18 17:36:42 2019 (r353734) @@ -222,10 +222,12 @@ vm_page_init_cache_zones(void *dummy __unused) vmd = VM_DOMAIN(domain); /* - * Don't allow the page caches to take up more than .25% of - * memory. + * Don't allow the page caches to take up more than .1875% of + * memory. A UMA bucket contains at most 256 free pages, and we + * have two buckets per CPU per free pool. */ - if (vmd->vmd_page_count / 400 < 256 * mp_ncpus * VM_NFREEPOOL) + if (vmd->vmd_page_count / 600 < 2 * 256 * mp_ncpus * + VM_NFREEPOOL) continue; for (pool = 0; pool < VM_NFREEPOOL; pool++) { pgcache = &vmd->vmd_pgcache[pool]; From owner-svn-src-all@freebsd.org Fri Oct 18 18:00:47 2019 Return-Path: Delivered-To: svn-src-all@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 E34D4157DA5; Fri, 18 Oct 2019 18:00:47 +0000 (UTC) (envelope-from jkim@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 46vv336QqKz3NCN; Fri, 18 Oct 2019 18:00:47 +0000 (UTC) (envelope-from jkim@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 C111FCC7F; Fri, 18 Oct 2019 18:00:47 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9II0lv5089389; Fri, 18 Oct 2019 18:00:47 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9II0f91088730; Fri, 18 Oct 2019 18:00:41 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201910181800.x9II0f91088730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 18 Oct 2019 18:00:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353735 - in vendor-sys/acpica/dist: . generate/unix/acpinames source/common source/compiler source/components/debugger source/components/disassembler source/components/dispatcher sourc... X-SVN-Group: vendor-sys X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in vendor-sys/acpica/dist: . generate/unix/acpinames source/common source/compiler source/components/debugger source/components/disassembler source/components/dispatcher source/components/events sourc... X-SVN-Commit-Revision: 353735 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 18:00:48 -0000 Author: jkim Date: Fri Oct 18 18:00:41 2019 New Revision: 353735 URL: https://svnweb.freebsd.org/changeset/base/353735 Log: Import ACPICA 20191018. Modified: vendor-sys/acpica/dist/changes.txt vendor-sys/acpica/dist/generate/unix/acpinames/Makefile vendor-sys/acpica/dist/source/common/acgetline.c vendor-sys/acpica/dist/source/common/adisasm.c vendor-sys/acpica/dist/source/common/adwalk.c vendor-sys/acpica/dist/source/common/dmtables.c vendor-sys/acpica/dist/source/common/dmtbdump1.c vendor-sys/acpica/dist/source/common/dmtbdump2.c vendor-sys/acpica/dist/source/common/dmtbdump3.c vendor-sys/acpica/dist/source/compiler/aslanalyze.c vendor-sys/acpica/dist/source/compiler/aslbtypes.c vendor-sys/acpica/dist/source/compiler/aslkeywords.y vendor-sys/acpica/dist/source/compiler/aslload.c vendor-sys/acpica/dist/source/compiler/aslmessages.c vendor-sys/acpica/dist/source/compiler/aslmessages.h vendor-sys/acpica/dist/source/compiler/aslmethod.c vendor-sys/acpica/dist/source/compiler/aslnamesp.c vendor-sys/acpica/dist/source/compiler/aslprepkg.c vendor-sys/acpica/dist/source/compiler/aslresource.c vendor-sys/acpica/dist/source/compiler/aslrestype2.c vendor-sys/acpica/dist/source/compiler/aslrestype2s.c vendor-sys/acpica/dist/source/compiler/aslutils.c vendor-sys/acpica/dist/source/compiler/cvdisasm.c vendor-sys/acpica/dist/source/compiler/cvparser.c vendor-sys/acpica/dist/source/compiler/dtcompile.c vendor-sys/acpica/dist/source/compiler/dtcompiler.h vendor-sys/acpica/dist/source/compiler/dtcompilerparser.l vendor-sys/acpica/dist/source/compiler/dtcompilerparser.y vendor-sys/acpica/dist/source/compiler/dtfield.c vendor-sys/acpica/dist/source/compiler/dtio.c vendor-sys/acpica/dist/source/compiler/dttable2.c vendor-sys/acpica/dist/source/components/debugger/dbconvert.c vendor-sys/acpica/dist/source/components/debugger/dbdisply.c vendor-sys/acpica/dist/source/components/debugger/dbfileio.c vendor-sys/acpica/dist/source/components/debugger/dbinput.c vendor-sys/acpica/dist/source/components/debugger/dbmethod.c vendor-sys/acpica/dist/source/components/debugger/dbnames.c vendor-sys/acpica/dist/source/components/debugger/dbobject.c vendor-sys/acpica/dist/source/components/disassembler/dmdeferred.c vendor-sys/acpica/dist/source/components/disassembler/dmresrc.c vendor-sys/acpica/dist/source/components/disassembler/dmwalk.c vendor-sys/acpica/dist/source/components/dispatcher/dscontrol.c vendor-sys/acpica/dist/source/components/dispatcher/dsfield.c vendor-sys/acpica/dist/source/components/events/evgpeblk.c vendor-sys/acpica/dist/source/components/events/evgpeinit.c vendor-sys/acpica/dist/source/components/events/evmisc.c vendor-sys/acpica/dist/source/components/events/evregion.c vendor-sys/acpica/dist/source/components/events/evrgnini.c vendor-sys/acpica/dist/source/components/hardware/hwxfsleep.c vendor-sys/acpica/dist/source/components/namespace/nsconvert.c vendor-sys/acpica/dist/source/components/namespace/nsdump.c vendor-sys/acpica/dist/source/components/namespace/nsxfname.c vendor-sys/acpica/dist/source/components/parser/psobject.c vendor-sys/acpica/dist/source/components/resources/rscreate.c vendor-sys/acpica/dist/source/components/tables/tbdata.c vendor-sys/acpica/dist/source/components/tables/tbxfload.c vendor-sys/acpica/dist/source/components/utilities/utbuffer.c vendor-sys/acpica/dist/source/components/utilities/utids.c vendor-sys/acpica/dist/source/components/utilities/uttrack.c vendor-sys/acpica/dist/source/include/acdebug.h vendor-sys/acpica/dist/source/include/acpixf.h vendor-sys/acpica/dist/source/include/acstruct.h vendor-sys/acpica/dist/source/include/acutils.h vendor-sys/acpica/dist/source/include/platform/acfreebsd.h vendor-sys/acpica/dist/source/os_specific/service_layers/oswinxf.c vendor-sys/acpica/dist/source/tools/acpiexec/aecommon.h vendor-sys/acpica/dist/source/tools/acpiexec/aehandlers.c vendor-sys/acpica/dist/source/tools/acpiexec/aeinitfile.c vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c vendor-sys/acpica/dist/source/tools/acpiexec/aetests.c vendor-sys/acpica/dist/source/tools/acpihelp/ahdecode.c vendor-sys/acpica/dist/source/tools/acpinames/anstubs.c vendor-sys/acpica/dist/source/tools/acpisrc/asfile.c vendor-sys/acpica/dist/source/tools/acpisrc/asremove.c vendor-sys/acpica/dist/tests/templates/Makefile Modified: vendor-sys/acpica/dist/changes.txt ============================================================================== --- vendor-sys/acpica/dist/changes.txt Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/changes.txt Fri Oct 18 18:00:41 2019 (r353735) @@ -1,4 +1,51 @@ ---------------------------------------- +18 October 2019. Summary of changes for version 20191018: + + +1) ACPICA kernel-resident subsystem: + +Debugger: added a new command: ?Fields [address space ID]?. This command +dumps the contents of all field units that are defined within the +namespace with a particular address space ID. + +Modified the external interface AcpiLoadTable() to return a table index. +This table index can be used for unloading a table for debugging. + ACPI_STATUS + AcpiLoadTable ( + ACPI_TABLE_HEADER *Table, + UINT32 *TableIndex)) + +Implemented a new external interface: AcpiUnloadTable() This new function +takes a table index as an argument and unloads the table. Useful for +debugging only. + ACPI_STATUS + AcpiUnloadTable ( + UINT32 TableIndex)) + +Ported the AcpiNames utility to use the new table initialization +sequence. The utility was broken before this change. Also, it was +required to include most of the AML interpreter into the utility in order +to process table initialization (module-level code execution.) + +Update for results from running Clang V8.0.1. This fixes all "dead +assignment" warnings. There are still several "Dereference of NULL +pointer" warnings, but these have been found to be false positive +warnings. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +iASL: numerous table compiler changes to ensure that the usage of +yacc/bison syntax is POSIX-compliant. + +iASL/disassembler: several simple bug fixes in the data table +disassembler. + +Acpiexec: expanded the initialization file (the -fi option) to initialize +strings, buffers, packages, and field units. + + +---------------------------------------- 16 August 2019. Summary of changes for version 20190816: This release is available at https://acpica.org/downloads Modified: vendor-sys/acpica/dist/generate/unix/acpinames/Makefile ============================================================================== --- vendor-sys/acpica/dist/generate/unix/acpinames/Makefile Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/generate/unix/acpinames/Makefile Fri Oct 18 18:00:41 2019 (r353735) @@ -22,7 +22,9 @@ PROG = $(OBJDIR)/acpinames vpath %.c \ $(ACPINAMES)\ $(ACPICA_DISPATCHER)\ + $(ACPICA_EVENTS)\ $(ACPICA_EXECUTER)\ + $(ACPICA_HARDWARE)\ $(ACPICA_NAMESPACE)\ $(ACPICA_PARSER)\ $(ACPICA_TABLES)\ @@ -39,34 +41,69 @@ OBJECTS = \ $(OBJDIR)/anstubs.o\ $(OBJDIR)/antables.o\ $(OBJDIR)/cmfsize.o\ + $(OBJDIR)/dscontrol.o\ + $(OBJDIR)/dsdebug.o\ $(OBJDIR)/dsfield.o\ $(OBJDIR)/dsinit.o\ + $(OBJDIR)/dsmethod.o\ $(OBJDIR)/dsmthdat.o\ $(OBJDIR)/dsobject.o\ + $(OBJDIR)/dsopcode.o\ $(OBJDIR)/dspkginit.o\ $(OBJDIR)/dsutils.o\ + $(OBJDIR)/dswexec.o\ $(OBJDIR)/dswload.o\ $(OBJDIR)/dswload2.o\ $(OBJDIR)/dswscope.o\ $(OBJDIR)/dswstate.o\ + $(OBJDIR)/evhandler.o\ + $(OBJDIR)/evmisc.o\ + $(OBJDIR)/evregion.o\ + $(OBJDIR)/evrgnini.o\ + $(OBJDIR)/evxfregn.o\ + $(OBJDIR)/exconcat.o\ + $(OBJDIR)/exconfig.o\ + $(OBJDIR)/exconvrt.o\ $(OBJDIR)/excreate.o\ $(OBJDIR)/exdump.o\ + $(OBJDIR)/exfield.o\ + $(OBJDIR)/exfldio.o\ + $(OBJDIR)/exmisc.o\ $(OBJDIR)/exmutex.o\ $(OBJDIR)/exnames.o\ + $(OBJDIR)/exoparg1.o\ + $(OBJDIR)/exoparg2.o\ + $(OBJDIR)/exoparg3.o\ + $(OBJDIR)/exoparg6.o\ $(OBJDIR)/exprep.o\ + $(OBJDIR)/exregion.o\ $(OBJDIR)/exresnte.o\ $(OBJDIR)/exresolv.o\ + $(OBJDIR)/exresop.o\ + $(OBJDIR)/exserial.o\ + $(OBJDIR)/exstore.o\ + $(OBJDIR)/exstoren.o\ + $(OBJDIR)/exstorob.o\ $(OBJDIR)/exsystem.o\ $(OBJDIR)/exutils.o\ $(OBJDIR)/getopt.o\ + $(OBJDIR)/hwpci.o\ + $(OBJDIR)/hwvalid.o\ $(OBJDIR)/nsaccess.o\ $(OBJDIR)/nsalloc.o\ + $(OBJDIR)/nsarguments.o\ + $(OBJDIR)/nsconvert.o\ $(OBJDIR)/nsdump.o\ + $(OBJDIR)/nseval.o\ $(OBJDIR)/nsinit.o\ $(OBJDIR)/nsload.o\ $(OBJDIR)/nsnames.o\ $(OBJDIR)/nsobject.o\ $(OBJDIR)/nsparse.o\ + $(OBJDIR)/nspredef.o\ + $(OBJDIR)/nsprepkg.o\ + $(OBJDIR)/nsrepair.o\ + $(OBJDIR)/nsrepair2.o\ $(OBJDIR)/nssearch.o\ $(OBJDIR)/nsutils.o\ $(OBJDIR)/nswalk.o\ @@ -99,6 +136,7 @@ OBJECTS = \ $(OBJDIR)/utascii.o\ $(OBJDIR)/utbuffer.o\ $(OBJDIR)/utcache.o\ + $(OBJDIR)/utcopy.o\ $(OBJDIR)/utdebug.o\ $(OBJDIR)/utdecode.o\ $(OBJDIR)/utdelete.o\ @@ -117,8 +155,12 @@ OBJECTS = \ $(OBJDIR)/utobject.o\ $(OBJDIR)/utosi.o\ $(OBJDIR)/utownerid.o\ + $(OBJDIR)/utpredef.o\ + $(OBJDIR)/utresrc.o\ $(OBJDIR)/utstate.o\ $(OBJDIR)/utstring.o\ + $(OBJDIR)/utstrsuppt.o\ + $(OBJDIR)/utstrtoul64.o\ $(OBJDIR)/utxface.o\ $(OBJDIR)/utxferror.o\ $(OBJDIR)/utxfinit.o Modified: vendor-sys/acpica/dist/source/common/acgetline.c ============================================================================== --- vendor-sys/acpica/dist/source/common/acgetline.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/common/acgetline.c Fri Oct 18 18:00:41 2019 (r353735) @@ -532,7 +532,7 @@ AcpiOsGetLine ( * Ignore the various keys like insert/delete/home/end, etc. * But we must eat the final character of the ESC sequence. */ - InputChar = getchar (); + (void) getchar (); continue; default: Modified: vendor-sys/acpica/dist/source/common/adisasm.c ============================================================================== --- vendor-sys/acpica/dist/source/common/adisasm.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/common/adisasm.c Fri Oct 18 18:00:41 2019 (r353735) @@ -746,7 +746,6 @@ AdDoExternalFileList ( { ExternalFileList = ExternalFileList->Next; GlobalStatus = AE_TYPE; - Status = AE_OK; continue; } Modified: vendor-sys/acpica/dist/source/common/adwalk.c ============================================================================== --- vendor-sys/acpica/dist/source/common/adwalk.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/common/adwalk.c Fri Oct 18 18:00:41 2019 (r353735) @@ -601,7 +601,9 @@ AcpiDmFindOrphanDescending ( return (AE_OK); } +#ifdef ACPI_UNDER_DEVELOPMENT OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); +#endif switch (Op->Common.AmlOpcode) { @@ -1100,7 +1102,7 @@ AcpiDmCommonDescendingOp ( /* Switch/Case conversion */ Status = AcpiDmProcessSwitch (Op); - return (AE_OK); + return (Status); } Modified: vendor-sys/acpica/dist/source/common/dmtables.c ============================================================================== --- vendor-sys/acpica/dist/source/common/dmtables.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/common/dmtables.c Fri Oct 18 18:00:41 2019 (r353735) @@ -327,7 +327,7 @@ AdCreateTableHeader ( * makes it easier to rename the disassembled ASL file if needed. */ AcpiOsPrintf ( - "DefinitionBlock (\"\", \"%4.4s\", %hu, \"%.6s\", \"%.8s\", 0x%8.8X)\n", + "DefinitionBlock (\"\", \"%4.4s\", %u, \"%.6s\", \"%.8s\", 0x%8.8X)\n", Table->Signature, Table->Revision, Table->OemId, Table->OemTableId, Table->OemRevision); } @@ -601,7 +601,7 @@ AdParseTable ( fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n"); - Status = AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot); + (void) AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot); fprintf (stderr, "\n"); /* Process Resource Templates */ Modified: vendor-sys/acpica/dist/source/common/dmtbdump1.c ============================================================================== --- vendor-sys/acpica/dist/source/common/dmtbdump1.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/common/dmtbdump1.c Fri Oct 18 18:00:41 2019 (r353735) @@ -474,7 +474,6 @@ AcpiDmDumpCsrt ( { return; } - SubSubOffset += InfoLength; } /* Point to next sub-subtable */ @@ -1401,7 +1400,6 @@ AcpiDmDumpHmat ( while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - SubtableOffset = 0; /* Dump HMAT structure header */ @@ -1484,6 +1482,11 @@ AcpiDmDumpHmat ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 4, AcpiDmTableInfoHmat1a); + if (ACPI_FAILURE (Status)) + { + return; + } + SubtableOffset += 4; } @@ -1500,6 +1503,11 @@ AcpiDmDumpHmat ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 4, AcpiDmTableInfoHmat1b); + if (ACPI_FAILURE (Status)) + { + return; + } + SubtableOffset += 4; } @@ -1519,6 +1527,11 @@ AcpiDmDumpHmat ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 2, AcpiDmTableInfoHmat1c); + if (ACPI_FAILURE(Status)) + { + return; + } + SubtableOffset += 2; } } @@ -1542,6 +1555,11 @@ AcpiDmDumpHmat ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 2, AcpiDmTableInfoHmat2a); + if (ACPI_FAILURE (Status)) + { + return; + } + SubtableOffset += 2; } break; Modified: vendor-sys/acpica/dist/source/common/dmtbdump2.c ============================================================================== --- vendor-sys/acpica/dist/source/common/dmtbdump2.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/common/dmtbdump2.c Fri Oct 18 18:00:41 2019 (r353735) @@ -187,6 +187,7 @@ AcpiDmDumpIort ( ACPI_DMTABLE_INFO *InfoTable; char *String; UINT32 i; + UINT32 MappingByteLength; /* Main table */ @@ -314,6 +315,11 @@ AcpiDmDumpIort ( Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 4, AcpiDmTableInfoIort0a); + if (ACPI_FAILURE (Status)) + { + return; + } + NodeOffset += 4; } } @@ -325,8 +331,10 @@ AcpiDmDumpIort ( if (IortNode->Length > NodeOffset) { + MappingByteLength = + IortNode->MappingCount * sizeof (ACPI_IORT_ID_MAPPING); Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, - Table, IortNode->Length - NodeOffset, + Table, IortNode->Length - NodeOffset - MappingByteLength, AcpiDmTableInfoIort1a); if (ACPI_FAILURE (Status)) { @@ -410,7 +418,6 @@ NextSubtable: /* Point to next node subtable */ Offset += IortNode->Length; - IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, IortNode->Length); } } @@ -1211,7 +1218,6 @@ AcpiDmDumpNfit ( /* Has a variable number of 32-bit values at the end */ InfoTable = AcpiDmTableInfoNfit2; - Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable); FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE); break; @@ -1236,7 +1242,6 @@ AcpiDmDumpNfit ( /* Has a variable number of 64-bit addresses at the end */ InfoTable = AcpiDmTableInfoNfit6; - Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable); FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64); break; @@ -1273,6 +1278,7 @@ AcpiDmDumpNfit ( { case ACPI_NFIT_TYPE_INTERLEAVE: + Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable); for (i = 0; i < Interleave->LineCount; i++) { Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, @@ -1308,6 +1314,7 @@ AcpiDmDumpNfit ( case ACPI_NFIT_TYPE_FLUSH_ADDRESS: + Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable); for (i = 0; i < Hint->HintCount; i++) { Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, @@ -1806,6 +1813,11 @@ AcpiDmDumpPptt ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset), 4, AcpiDmTableInfoPptt0a); + if (ACPI_FAILURE (Status)) + { + return; + } + SubtableOffset += 4; } break; @@ -2063,6 +2075,10 @@ AcpiDmDumpSdev ( Status = AcpiDmDumpTable (Table->Length, 0, ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset), VendorDataLength, AcpiDmTableInfoSdev1b); + if (ACPI_FAILURE (Status)) + { + return; + } } break; Modified: vendor-sys/acpica/dist/source/common/dmtbdump3.c ============================================================================== --- vendor-sys/acpica/dist/source/common/dmtbdump3.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/common/dmtbdump3.c Fri Oct 18 18:00:41 2019 (r353735) @@ -410,7 +410,7 @@ AcpiDmDumpStao ( Namepath = ACPI_ADD_PTR (char, Table, Offset); StringLength = strlen (Namepath) + 1; - AcpiDmLineHeader (Offset, StringLength, "Namestring"); + AcpiDmLineHeader (Offset, StringLength, "Namepath"); AcpiOsPrintf ("\"%s\"\n", Namepath); /* Point to next namepath */ @@ -526,7 +526,7 @@ AcpiDmDumpTpm2Rev3 ( { case ACPI_TPM23_ACPI_START_METHOD: - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + (void) AcpiDmDumpTable (Table->Length, Offset, Subtable, Table->Length - Offset, AcpiDmTableInfoTpm23a); break; @@ -591,7 +591,7 @@ AcpiDmDumpTpm2 ( Offset += sizeof (ACPI_TPM2_TRAILER); AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, ArmSubtable, + (void) AcpiDmDumpTable (Table->Length, Offset, ArmSubtable, Table->Length - Offset, AcpiDmTableInfoTpm211); break; Modified: vendor-sys/acpica/dist/source/compiler/aslanalyze.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslanalyze.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/aslanalyze.c Fri Oct 18 18:00:41 2019 (r353735) @@ -569,7 +569,7 @@ ApCheckForGpeNameConflict ( /* Need a null-terminated string version of NameSeg */ - ACPI_MOVE_32_TO_32 (Name, &Op->Asl.NameSeg); + ACPI_MOVE_32_TO_32 (Name, Op->Asl.NameSeg); Name[ACPI_NAMESEG_SIZE] = 0; /* Modified: vendor-sys/acpica/dist/source/compiler/aslbtypes.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslbtypes.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/aslbtypes.c Fri Oct 18 18:00:41 2019 (r353735) @@ -474,7 +474,6 @@ AnFormatBtype ( strcat (Buffer, "|"); } - First = FALSE; strcat (Buffer, "Resource"); } } Modified: vendor-sys/acpica/dist/source/compiler/aslkeywords.y ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslkeywords.y Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/aslkeywords.y Fri Oct 18 18:00:41 2019 (r353735) @@ -202,7 +202,7 @@ AddressKeyword ; AddressSpaceKeyword - : ByteConst {$$ = UtCheckIntegerRange ($1, 0x0A, 0xFF);} + : ByteConst {$$ = UtCheckIntegerRange ($1, ACPI_NUM_PREDEFINED_REGIONS, 0xFF);} | RegionSpaceKeyword {} ; Modified: vendor-sys/acpica/dist/source/compiler/aslload.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslload.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/aslload.c Fri Oct 18 18:00:41 2019 (r353735) @@ -526,13 +526,12 @@ LdNamespace1Begin ( case AML_INT_CONNECTION_OP: - if (Op->Asl.Child->Asl.AmlOpcode != AML_INT_NAMEPATH_OP) { break; } - Arg = Op->Asl.Child; + Arg = Op->Asl.Child; Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Asl.ExternalName, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &Node); @@ -541,15 +540,6 @@ LdNamespace1Begin ( break; } - if (Node->Type == ACPI_TYPE_BUFFER) - { - Arg->Asl.Node = Node; - - Arg = Node->Op->Asl.Child; /* Get namepath */ - Arg = Arg->Asl.Next; /* Get actual buffer */ - Arg = Arg->Asl.Child; /* Buffer length */ - Arg = Arg->Asl.Next; /* RAW_DATA buffer */ - } break; default: @@ -576,7 +566,6 @@ LdNamespace1Begin ( * These opcodes are guaranteed to have a parent. * Examine the parent opcode. */ - Status = AE_OK; ParentOp = Op->Asl.Parent; OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Asl.AmlOpcode); Modified: vendor-sys/acpica/dist/source/compiler/aslmessages.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmessages.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/aslmessages.c Fri Oct 18 18:00:41 2019 (r353735) @@ -387,7 +387,10 @@ const char *AslTableCompilerMsgs /* ASL_MSG_UNKNOWN_LABEL */ "Label is undefined", /* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type", /* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature", -/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero" +/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero", +/* ASL_MSG_INVALID_LABEL */ "Invalid field label detected", +/* ASL_MSG_BUFFER_LIST */ "Invalid buffer initializer list", +/* ASL_MSG_ENTRY_LIST */ "Invalid entry initializer list" }; /* Preprocessor */ Modified: vendor-sys/acpica/dist/source/compiler/aslmessages.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmessages.h Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/aslmessages.h Fri Oct 18 18:00:41 2019 (r353735) @@ -387,6 +387,9 @@ typedef enum ASL_MSG_UNKNOWN_SUBTABLE, ASL_MSG_UNKNOWN_TABLE, ASL_MSG_ZERO_VALUE, + ASL_MSG_INVALID_LABEL, + ASL_MSG_BUFFER_LIST, + ASL_MSG_ENTRY_LIST, /* These messages are used by the Preprocessor only */ Modified: vendor-sys/acpica/dist/source/compiler/aslmethod.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmethod.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/aslmethod.c Fri Oct 18 18:00:41 2019 (r353735) @@ -199,6 +199,8 @@ MtMethodAnalysisWalkBegin ( ACPI_PARSE_OBJECT *NextType; ACPI_PARSE_OBJECT *NextParamType; UINT8 ActualArgs = 0; + BOOLEAN HidExists; + BOOLEAN AdrExists; /* Build cross-reference output file if requested */ @@ -535,11 +537,25 @@ MtMethodAnalysisWalkBegin ( case PARSEOP_DEVICE: - if (!ApFindNameInDeviceTree (METHOD_NAME__HID, Op) && - !ApFindNameInDeviceTree (METHOD_NAME__ADR, Op)) + /* Check usage of _HID and _ADR objects */ + + HidExists = ApFindNameInDeviceTree (METHOD_NAME__HID, Op); + AdrExists = ApFindNameInDeviceTree (METHOD_NAME__ADR, Op); + + if (!HidExists && !AdrExists) { AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, "Device object requires a _HID or _ADR in same scope"); + } + else if (HidExists && AdrExists) + { + /* + * According to the ACPI spec, "A device object must contain + * either an _HID object or an _ADR object, but should not contain + * both". + */ + AslError (ASL_WARNING, ASL_MSG_MULTIPLE_TYPES, Op, + "Device object requires either a _HID or _ADR, but not both"); } break; Modified: vendor-sys/acpica/dist/source/compiler/aslnamesp.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslnamesp.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/aslnamesp.c Fri Oct 18 18:00:41 2019 (r353735) @@ -234,6 +234,10 @@ NsDisplayNamespace ( Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, FALSE, NsDoOneNamespaceObject, NULL, NULL, NULL); + if (ACPI_FAILURE (Status)) + { + return (Status); + } /* Print the full pathname for each namespace node */ Modified: vendor-sys/acpica/dist/source/compiler/aslprepkg.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslprepkg.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/aslprepkg.c Fri Oct 18 18:00:41 2019 (r353735) @@ -458,7 +458,7 @@ ApCheckPackage ( for (i = 0; i < Package->RetInfo4.Count1; ++i) { - Status = ApCheckObjectType (Predefined->Info.Name, Op, + ApCheckObjectType (Predefined->Info.Name, Op, Package->RetInfo4.ObjectType1, i); Op = Op->Asl.Next; } Modified: vendor-sys/acpica/dist/source/compiler/aslresource.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslresource.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/aslresource.c Fri Oct 18 18:00:41 2019 (r353735) @@ -1226,7 +1226,7 @@ RsDoResourceTemplate ( BufferOp->Asl.AmlOpcode = AML_RAW_DATA_CHAIN; BufferOp->Asl.AmlOpcodeLength = 0; BufferOp->Asl.AmlLength = CurrentByteOffset; - BufferOp->Asl.Value.Buffer = (UINT8 *) HeadRnode.Next; + BufferOp->Asl.Value.Buffer = ACPI_CAST_PTR (UINT8, HeadRnode.Next); BufferOp->Asl.CompileFlags |= OP_IS_RESOURCE_DATA; UtSetParseOpName (BufferOp); Modified: vendor-sys/acpica/dist/source/compiler/aslrestype2.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslrestype2.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/aslrestype2.c Fri Oct 18 18:00:41 2019 (r353735) @@ -487,10 +487,7 @@ RsDoInterruptDescriptor ( if (StringLength && ResSourceString) { - strcpy ((char *) Rover, (char *) ResSourceString); - Rover = ACPI_ADD_PTR ( - AML_RESOURCE, &(Rover->ByteItem), StringLength); Descriptor->ExtendedIrq.ResourceLength = (UINT16) (Descriptor->ExtendedIrq.ResourceLength + StringLength); Modified: vendor-sys/acpica/dist/source/compiler/aslrestype2s.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslrestype2s.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/aslrestype2s.c Fri Oct 18 18:00:41 2019 (r353735) @@ -674,7 +674,6 @@ RsDoGpioIoDescriptor ( ResSourceLength = RsGetStringDataLength (InitializerOp); VendorLength = RsGetBufferDataLength (InitializerOp); InterruptLength = RsGetInterruptDataLength (InitializerOp, 10); - PinList = InterruptList; DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO) + ResSourceLength + VendorLength + InterruptLength; Modified: vendor-sys/acpica/dist/source/compiler/aslutils.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslutils.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/aslutils.c Fri Oct 18 18:00:41 2019 (r353735) @@ -223,7 +223,7 @@ UtQueryForOverwrite ( char *Pathname) { struct stat StatInfo; - int InChar = 0x34; + int InChar; if (!stat (Pathname, &StatInfo)) Modified: vendor-sys/acpica/dist/source/compiler/cvdisasm.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/cvdisasm.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/cvdisasm.c Fri Oct 18 18:00:41 2019 (r353735) @@ -544,8 +544,11 @@ CvSwitchFiles( Current = Current->Parent; } - /* Redirect output to Op->Common.CvFilename */ + if (FNode) + { + /* Redirect output to Op->Common.CvFilename */ - AcpiOsRedirectOutput (FNode->File); - AcpiGbl_CurrentFilename = FNode->Filename; + AcpiOsRedirectOutput (FNode->File); + AcpiGbl_CurrentFilename = FNode->Filename; + } } Modified: vendor-sys/acpica/dist/source/compiler/cvparser.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/cvparser.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/cvparser.c Fri Oct 18 18:00:41 2019 (r353735) @@ -912,7 +912,6 @@ CvCaptureCommentsOnly ( /* Not a valid comment option. Revert the AML */ - Aml -= 2; goto DefBlock; } /* End switch statement */ Modified: vendor-sys/acpica/dist/source/compiler/dtcompile.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/dtcompile.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/dtcompile.c Fri Oct 18 18:00:41 2019 (r353735) @@ -276,7 +276,10 @@ DtDoCompile ( if (ACPI_FAILURE (Status)) { - FileNode->ParserErrorDetected = TRUE; + if (FileNode) + { + FileNode->ParserErrorDetected = TRUE; + } /* TBD: temporary error message. Msgs should come from function above */ @@ -572,7 +575,7 @@ DtCompileTable ( ACPI_STATUS Status = AE_OK; - if (!Field) + if (!Field || !Info) { return (AE_BAD_PARAMETER); } @@ -642,6 +645,14 @@ DtCompileTable ( FieldType = DtGetFieldType (Info); AslGbl_InputFieldCount++; + + if (FieldType != DT_FIELD_TYPE_INLINE_SUBTABLE && + strcmp (Info->Name, LocalField->Name)) + { + sprintf (AslGbl_MsgBuffer, "found \"%s\" expected \"%s\"", + LocalField->Name, Info->Name); + DtError (ASL_ERROR, ASL_MSG_INVALID_LABEL, LocalField, AslGbl_MsgBuffer); + } switch (FieldType) { Modified: vendor-sys/acpica/dist/source/compiler/dtcompiler.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/dtcompiler.h Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/dtcompiler.h Fri Oct 18 18:00:41 2019 (r353735) @@ -210,7 +210,18 @@ typedef struct dt_field #define DT_FIELD_NOT_ALLOCATED 1 +/* + * Structure used for each individual key or value + */ +typedef struct dt_table_unit +{ + char *Value; /* Field value (from name : value) */ + UINT32 Line; /* Line number for this field */ + UINT32 Column; /* Start column for field value */ +} DT_TABLE_UNIT; + + /* * Structure used for individual subtables within an ACPI table */ @@ -292,14 +303,6 @@ DtCompilePadding ( UINT32 Length, DT_SUBTABLE **RetSubtable); -void -DtCreateField ( - char *Name, - char *Value, - UINT32 Line, - UINT32 Offset, - UINT32 Column, - UINT32 NameColumn); /* dtio - binary and text input/output */ @@ -435,6 +438,26 @@ DtCompileFlag ( UINT8 *Buffer, DT_FIELD *Field, ACPI_DMTABLE_INFO *Info); + + +/* dtfield - DT_FIELD operations */ + +void +DtLinkField ( + DT_FIELD *Field); + +void +DtCreateField ( + DT_TABLE_UNIT *FieldKey, + DT_TABLE_UNIT *FieldValue, + UINT32 Offset); + +DT_TABLE_UNIT * +DtCreateTableUnit ( + char *Data, + UINT32 Line, + UINT32 Column); + /* dtparser - lex/yacc files */ Modified: vendor-sys/acpica/dist/source/compiler/dtcompilerparser.l ============================================================================== --- vendor-sys/acpica/dist/source/compiler/dtcompilerparser.l Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/dtcompilerparser.l Fri Oct 18 18:00:41 2019 (r353735) @@ -161,18 +161,20 @@ YYSTYPE DtCompilerlval; /* handle locations */ int DtCompilerParsercolumn = 1; +int DtLabelByteOffset = 0; int DtCompilerParserByteOffset = 0; +UINT32 DtTokenFirstLine = 0; +UINT32 DtTokenFirstColumn = 0; + #define YY_USER_ACTION \ - DtCompilerParserlloc.first_line = DtCompilerParserlloc.last_line = DtCompilerParserlineno; \ - DtCompilerParserlloc.first_column = DtCompilerParsercolumn; \ - DtCompilerParserlloc.first_byte_offset = DtCompilerParserByteOffset; \ - DtCompilerParserlloc.last_column = DtCompilerParsercolumn + DtCompilerParserleng-1; \ + DtTokenFirstLine = DtCompilerParserlineno; \ + DtTokenFirstColumn = DtCompilerParsercolumn; \ DtCompilerParsercolumn += DtCompilerParserleng; \ DtCompilerParserByteOffset += DtCompilerParserleng; \ DbgPrint (ASL_PARSE_OUTPUT,\ - "user action occurred. DtCompilerParserlloc.first_line: %u offset: %u\n",\ - DtCompilerParserlloc.first_line, DtCompilerParserlloc.first_byte_offset); + "user action occurred. DtCompilerParserlloc.first_line: %u\n",\ + DtTokenFirstLine); %} %option nounput noinput yylineno @@ -236,7 +238,11 @@ CommentField {LabelName}{WhiteSpace}*:{WhiteSpace}{ int size = strlen (DtCompilerParsertext); s=UtLocalCacheCalloc (size + 1); AcpiUtSafeStrncpy (s, DtCompilerParsertext, size + 1); - DtCompilerParserlval.s = s; + DtCompilerParserlval.u = (DT_TABLE_UNIT *) UtLocalCacheCalloc (sizeof (DT_TABLE_UNIT)); + DtCompilerParserlval.u->Value = s; + DtCompilerParserlval.u->Line = DtCompilerParserlineno; + DtCompilerParserlval.u->Column = DtCompilerParsercolumn; + DtLabelByteOffset = DtCompilerParserByteOffset; DbgPrint (ASL_PARSE_OUTPUT, "Label: %s\n", s); return (DT_PARSEOP_LABEL); } Modified: vendor-sys/acpica/dist/source/compiler/dtcompilerparser.y ============================================================================== --- vendor-sys/acpica/dist/source/compiler/dtcompilerparser.y Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/dtcompilerparser.y Fri Oct 18 18:00:41 2019 (r353735) @@ -169,9 +169,13 @@ void DtCompilerParsererror (cha extern char *DtCompilerParsertext; extern DT_FIELD *AslGbl_CurrentField; +extern int DtLabelByteOffset; extern UINT64 DtCompilerParserResult; /* Expression return value */ extern UINT64 DtCompilerParserlineno; /* Current line number */ +extern UINT32 DtTokenFirstLine; +extern UINT32 DtTokenFirstColumn; + /* Bison/yacc configuration */ #define yytname DtCompilerParsername @@ -186,42 +190,30 @@ extern UINT64 DtCompilerParserlineno; /* %} -%code requires { - typedef struct YYLTYPE { - int first_line; - int last_line; - int first_column; - int last_column; - int first_byte_offset; - } YYLTYPE; - - #define YYLTYPE_IS_DECLARED 1 -} - - %union { char *s; DT_FIELD *f; + DT_TABLE_UNIT *u; } %type Table -%token DT_PARSEOP_DATA -%token DT_PARSEOP_LABEL -%token DT_PARSEOP_STRING_DATA -%token DT_PARSEOP_LINE_CONTINUATION -%type Data -%type Datum -%type MultiLineData -%type MultiLineDataList +%token DT_PARSEOP_DATA +%token DT_PARSEOP_LABEL +%token DT_PARSEOP_STRING_DATA +%token DT_PARSEOP_LINE_CONTINUATION +%type Data +%type Datum +%type MultiLineData +%type MultiLineDataList %% Table : - FieldList { DtCompilerParserResult = 5;} + FieldList { } ; FieldList @@ -230,7 +222,7 @@ FieldList ; Field - : DT_PARSEOP_LABEL ':' Data { DtCreateField ($1, $3, (@3).first_line, (@1).first_byte_offset, (@1).first_column, (@3).first_column); } + : DT_PARSEOP_LABEL ':' Data { DtCreateField ($1, $3, DtLabelByteOffset); } ; Data @@ -240,7 +232,7 @@ Data ; MultiLineDataList - : MultiLineDataList MultiLineData { $$ = AcpiUtStrcat(AcpiUtStrcat($1, " "), $2); } /* combine the strings with strcat */ + : MultiLineDataList MultiLineData { $$ = DtCreateTableUnit (AcpiUtStrcat(AcpiUtStrcat($1->Value, " "), $2->Value), $1->Line, $1->Column); } /* combine the strings with strcat */ | MultiLineData { $$ = $1; } ; @@ -249,8 +241,14 @@ MultiLineData ; Datum - : DT_PARSEOP_DATA { DbgPrint (ASL_PARSE_OUTPUT, "parser data: [%s]\n", DtCompilerParserlval.s); $$ = AcpiUtStrdup(DtCompilerParserlval.s); } - | DT_PARSEOP_STRING_DATA { DbgPrint (ASL_PARSE_OUTPUT, "parser string data: [%s]\n", DtCompilerParserlval.s); $$ = AcpiUtStrdup(DtCompilerParserlval.s); } + : DT_PARSEOP_DATA { + DbgPrint (ASL_PARSE_OUTPUT, "parser data: [%s]\n", DtCompilerParserlval.s); + $$ = DtCreateTableUnit (AcpiUtStrdup(DtCompilerParserlval.s), DtTokenFirstLine, DtTokenFirstColumn); + } + | DT_PARSEOP_STRING_DATA { + DbgPrint (ASL_PARSE_OUTPUT, "parser string data: [%s]\n", DtCompilerParserlval.s); + $$ = DtCreateTableUnit (AcpiUtStrdup(DtCompilerParserlval.s), DtTokenFirstLine, DtTokenFirstColumn); + } ; Modified: vendor-sys/acpica/dist/source/compiler/dtfield.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/dtfield.c Fri Oct 18 17:36:42 2019 (r353734) +++ vendor-sys/acpica/dist/source/compiler/dtfield.c Fri Oct 18 18:00:41 2019 (r353735) @@ -576,6 +576,14 @@ DtCompileBuffer ( StringValue = DtNormalizeBuffer (StringValue, &Count); Substring = StringValue; + if (Count != ByteLength) + { + sprintf(AslGbl_MsgBuffer, + "Found %u values, must match expected count: %u", + Count, ByteLength); + DtError (ASL_ERROR, ASL_MSG_BUFFER_LIST, Field, AslGbl_MsgBuffer); + goto Exit; + } /* Each element of StringValue is now three chars (2 hex + 1 space) */ @@ -720,4 +728,123 @@ DtCompileFlag ( } *Buffer |= (UINT8) (Value << BitPosition); +} + + +/****************************************************************************** + * + * FUNCTION: DtCreateField + * + * PARAMETERS: Name + * Value + * Line + * Offset + * Column + * NameColumn + * + * RETURN: None + * + * DESCRIPTION: Create a field + * + *****************************************************************************/ + +void +DtCreateField ( + DT_TABLE_UNIT *FieldKey, + DT_TABLE_UNIT *FieldValue, + UINT32 Offset) +{ + DT_FIELD *Field = UtFieldCacheCalloc (); + + + Field->StringLength = 0; + if (FieldKey->Value) + { + Field->Name = + strcpy (UtLocalCacheCalloc (strlen (FieldKey->Value) + 1), FieldKey->Value); + } + + if (FieldValue->Value) + { + Field->StringLength = strlen (FieldValue->Value); + Field->Value = + strcpy (UtLocalCacheCalloc (Field->StringLength + 1), FieldValue->Value); + } + + Field->Line = FieldValue->Line; + Field->ByteOffset = Offset; + Field->NameColumn = FieldKey->Column; + Field->Column = FieldValue->Column; + DtLinkField (Field); + + DtDumpFieldList (AslGbl_FieldList); +} + + +/****************************************************************************** + * + * FUNCTION: DtCreateTableUnit + * + * PARAMETERS: Data + * Line + * Column + * + * RETURN: a table unit + * + * DESCRIPTION: Create a table unit + * + *****************************************************************************/ + +DT_TABLE_UNIT * +DtCreateTableUnit ( + char *Data, + UINT32 Line, + UINT32 Column) +{ + DT_TABLE_UNIT *Unit = (DT_TABLE_UNIT *) UtFieldCacheCalloc (); + + + Unit->Value = Data; + Unit->Line = Line; + Unit->Column = Column; + return (Unit); +} + + +/****************************************************************************** + * + * FUNCTION: DtLinkField + * *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Oct 18 18:01:23 2019 Return-Path: Delivered-To: svn-src-all@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 20755157DFD; Fri, 18 Oct 2019 18:01:23 +0000 (UTC) (envelope-from jkim@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 46vv3l03qJz3NM2; Fri, 18 Oct 2019 18:01:23 +0000 (UTC) (envelope-from jkim@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 C02E5CDBA; Fri, 18 Oct 2019 18:01:22 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9II1Mte091694; Fri, 18 Oct 2019 18:01:22 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9II1Mss091693; Fri, 18 Oct 2019 18:01:22 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201910181801.x9II1Mss091693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 18 Oct 2019 18:01:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353736 - vendor-sys/acpica/20191018 X-SVN-Group: vendor-sys X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: vendor-sys/acpica/20191018 X-SVN-Commit-Revision: 353736 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 18:01:23 -0000 Author: jkim Date: Fri Oct 18 18:01:22 2019 New Revision: 353736 URL: https://svnweb.freebsd.org/changeset/base/353736 Log: Tag ACPICA 20191018. Added: vendor-sys/acpica/20191018/ - copied from r353735, vendor-sys/acpica/dist/ From owner-svn-src-all@freebsd.org Fri Oct 18 19:30:14 2019 Return-Path: Delivered-To: svn-src-all@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 01038159070; Fri, 18 Oct 2019 19:30:13 +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 46vx2F668Wz3wYc; Fri, 18 Oct 2019 19:30:13 +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 B4ECDDC49; Fri, 18 Oct 2019 19:30:13 +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 x9IJUDgW042170; Fri, 18 Oct 2019 19:30:13 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9IJUCHU042167; Fri, 18 Oct 2019 19:30:12 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910181930.x9IJUCHU042167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 18 Oct 2019 19:30:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353737 - head/tools/build/options X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/tools/build/options X-SVN-Commit-Revision: 353737 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 19:30:14 -0000 Author: dim Date: Fri Oct 18 19:30:12 2019 New Revision: 353737 URL: https://svnweb.freebsd.org/changeset/base/353737 Log: Provide a src.conf(5) description for the new WITHOUT_CAROOT option, and rename the WITH_LOADER_VERIEXEC_PASS_MANFIEST description to its correct name. Also correct a bunch of spelling errors in that description. MFC after: 3 days Added: head/tools/build/options/WITHOUT_CAROOT (contents, props changed) head/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANIFEST - copied, changed from r353736, head/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANFIEST Deleted: head/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANFIEST Modified: head/tools/build/options/WITH_LOADER_VERIEXEC head/tools/build/options/WITH_VERIEXEC Added: head/tools/build/options/WITHOUT_CAROOT ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITHOUT_CAROOT Fri Oct 18 19:30:12 2019 (r353737) @@ -0,0 +1,3 @@ +.\" $FreeBSD$ +Set to not add the trusted certificates from the Mozilla NSS bundle to +base. Modified: head/tools/build/options/WITH_LOADER_VERIEXEC ============================================================================== --- head/tools/build/options/WITH_LOADER_VERIEXEC Fri Oct 18 18:01:22 2019 (r353736) +++ head/tools/build/options/WITH_LOADER_VERIEXEC Fri Oct 18 19:30:12 2019 (r353737) @@ -1,7 +1,7 @@ .\" $FreeBSD$ Enable building .Xr loader 8 -with support for verifcation similar to Verified Exec. +with support for verification similar to Verified Exec. .Pp -It depends on -.Va WITH_BEARSSL +Depends on +.Va WITH_BEARSSL . Copied and modified: head/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANIFEST (from r353736, head/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANFIEST) ============================================================================== --- head/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANFIEST Fri Oct 18 18:01:22 2019 (r353736, copy source) +++ head/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANIFEST Fri Oct 18 19:30:12 2019 (r353737) @@ -1,8 +1,8 @@ .\" $FreeBSD$ Enable building .Xr loader 8 -with support to pass a verified manifest to kernel. -Kernel has to be build with a module to parse the manfiest. +with support to pass a verified manifest to the kernel. +The kernel has to be built with a module to parse the manifest. .Pp -It depends on -.Va WITH_LOADER_VERIEXEC +Depends on +.Va WITH_LOADER_VERIEXEC . Modified: head/tools/build/options/WITH_VERIEXEC ============================================================================== --- head/tools/build/options/WITH_VERIEXEC Fri Oct 18 18:01:22 2019 (r353736) +++ head/tools/build/options/WITH_VERIEXEC Fri Oct 18 19:30:12 2019 (r353737) @@ -5,5 +5,5 @@ which loads the contents of verified manifests into th for use by .Xr mac_veriexec 4 .Pp -It depends on -.Va WITH_BEARSSL +Depends on +.Va WITH_BEARSSL . From owner-svn-src-all@freebsd.org Fri Oct 18 20:02:46 2019 Return-Path: Delivered-To: svn-src-all@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 C6ECC159961; Fri, 18 Oct 2019 20:02:46 +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 46vxlp4sGLz3y3X; Fri, 18 Oct 2019 20:02:46 +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 8B431E350; Fri, 18 Oct 2019 20:02:46 +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 x9IK2kF0065036; Fri, 18 Oct 2019 20:02:46 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9IK2kem065035; Fri, 18 Oct 2019 20:02:46 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910182002.x9IK2kem065035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 18 Oct 2019 20:02:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353738 - head/contrib/llvm/tools/lld/ELF X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/tools/lld/ELF X-SVN-Commit-Revision: 353738 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 20:02:46 -0000 Author: dim Date: Fri Oct 18 20:02:46 2019 New Revision: 353738 URL: https://svnweb.freebsd.org/changeset/base/353738 Log: Pull in r372651 from upstream lld trunk (by Simon Atanasyan): [mips] Support elf32btsmipn32_fbsd / elf32ltsmipn32_fbsd emulations Patch by Kyle Evans. Requested by: kevans MFC after: 1 month X-MFC-With: r353358 Modified: head/contrib/llvm/tools/lld/ELF/Driver.cpp Modified: head/contrib/llvm/tools/lld/ELF/Driver.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/Driver.cpp Fri Oct 18 19:30:12 2019 (r353737) +++ head/contrib/llvm/tools/lld/ELF/Driver.cpp Fri Oct 18 20:02:46 2019 (r353738) @@ -966,7 +966,8 @@ static void readConfigs(opt::InputArgList &args) { StringRef s = arg->getValue(); std::tie(config->ekind, config->emachine, config->osabi) = parseEmulation(s); - config->mipsN32Abi = (s == "elf32btsmipn32" || s == "elf32ltsmipn32"); + config->mipsN32Abi = + (s.startswith("elf32btsmipn32") || s.startswith("elf32ltsmipn32")); config->emulation = s; } From owner-svn-src-all@freebsd.org Fri Oct 18 20:05:29 2019 Return-Path: Delivered-To: svn-src-all@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 0D8091599FA; Fri, 18 Oct 2019 20:05:29 +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 46vxpw6TQGz3yBy; Fri, 18 Oct 2019 20:05:28 +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 BC708E353; Fri, 18 Oct 2019 20:05:28 +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 x9IK5SMt065206; Fri, 18 Oct 2019 20:05:28 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9IK5RGH065202; Fri, 18 Oct 2019 20:05:27 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910182005.x9IK5RGH065202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 18 Oct 2019 20:05:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353739 - in head/contrib/llvm/tools/clang/lib/Driver/ToolChains: . Arch X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/contrib/llvm/tools/clang/lib/Driver/ToolChains: . Arch X-SVN-Commit-Revision: 353739 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 20:05:29 -0000 Author: dim Date: Fri Oct 18 20:05:27 2019 New Revision: 353739 URL: https://svnweb.freebsd.org/changeset/base/353739 Log: Pull in r374154 from upstream clang trunk (by Simon Atanasyan): [mips] Set default float ABI to "soft" on FreeBSD Initial patch by Kyle Evans. Fix PR43596 Requested by: kevans MFC after: 1 month X-MFC-With: r353358 Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.h head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.cpp Fri Oct 18 20:02:46 2019 (r353738) +++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.cpp Fri Oct 18 20:05:27 2019 (r353739) @@ -149,7 +149,8 @@ StringRef mips::getGnuCompatibleMipsABIName(StringRef // Select the MIPS float ABI as determined by -msoft-float, -mhard-float, // and -mfloat-abi=. -mips::FloatABI mips::getMipsFloatABI(const Driver &D, const ArgList &Args) { +mips::FloatABI mips::getMipsFloatABI(const Driver &D, const ArgList &Args, + const llvm::Triple &Triple) { mips::FloatABI ABI = mips::FloatABI::Invalid; if (Arg *A = Args.getLastArg(options::OPT_msoft_float, options::OPT_mhard_float, @@ -172,10 +173,15 @@ mips::FloatABI mips::getMipsFloatABI(const Driver &D, // If unspecified, choose the default based on the platform. if (ABI == mips::FloatABI::Invalid) { - // Assume "hard", because it's a default value used by gcc. - // When we start to recognize specific target MIPS processors, - // we will be able to select the default more correctly. - ABI = mips::FloatABI::Hard; + if (Triple.isOSFreeBSD()) { + // For FreeBSD, assume "soft" on all flavors of MIPS. + ABI = mips::FloatABI::Soft; + } else { + // Assume "hard", because it's a default value used by gcc. + // When we start to recognize specific target MIPS processors, + // we will be able to select the default more correctly. + ABI = mips::FloatABI::Hard; + } } assert(ABI != mips::FloatABI::Invalid && "must select an ABI"); @@ -267,7 +273,7 @@ void mips::getMIPSTargetFeatures(const Driver &D, cons D.Diag(diag::warn_drv_unsupported_longcalls) << (ABICallsArg ? 0 : 1); } - mips::FloatABI FloatABI = mips::getMipsFloatABI(D, Args); + mips::FloatABI FloatABI = mips::getMipsFloatABI(D, Args, Triple); if (FloatABI == mips::FloatABI::Soft) { // FIXME: Note, this is a hack. We need to pass the selected float // mode to the MipsTargetInfoBase to define appropriate macros there. Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.h ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.h Fri Oct 18 20:02:46 2019 (r353738) +++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.h Fri Oct 18 20:05:27 2019 (r353739) @@ -38,7 +38,8 @@ void getMIPSTargetFeatures(const Driver &D, const llvm const llvm::opt::ArgList &Args, std::vector &Features); StringRef getGnuCompatibleMipsABIName(StringRef ABI); -mips::FloatABI getMipsFloatABI(const Driver &D, const llvm::opt::ArgList &Args); +mips::FloatABI getMipsFloatABI(const Driver &D, const llvm::opt::ArgList &Args, + const llvm::Triple &Triple); std::string getMipsABILibSuffix(const llvm::opt::ArgList &Args, const llvm::Triple &Triple); bool hasMipsAbiArg(const llvm::opt::ArgList &Args, const char *Value); Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp Fri Oct 18 20:02:46 2019 (r353738) +++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp Fri Oct 18 20:05:27 2019 (r353739) @@ -1646,7 +1646,7 @@ void Clang::AddMIPSTargetArgs(const ArgList &Args, CmdArgs.push_back("-target-abi"); CmdArgs.push_back(ABIName.data()); - mips::FloatABI ABI = mips::getMipsFloatABI(D, Args); + mips::FloatABI ABI = mips::getMipsFloatABI(D, Args, Triple); if (ABI == mips::FloatABI::Soft) { // Floating point operations and argument passing are soft. CmdArgs.push_back("-msoft-float"); Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp Fri Oct 18 20:02:46 2019 (r353738) +++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp Fri Oct 18 20:05:27 2019 (r353739) @@ -819,7 +819,8 @@ void tools::gnutools::Assembler::ConstructJob(Compilat A->render(Args, CmdArgs); } else if (mips::shouldUseFPXX( Args, getToolChain().getTriple(), CPUName, ABIName, - mips::getMipsFloatABI(getToolChain().getDriver(), Args))) + mips::getMipsFloatABI(getToolChain().getDriver(), Args, + getToolChain().getTriple()))) CmdArgs.push_back("-mfpxx"); // Pass on -mmips16 or -mno-mips16. However, the assembler equivalent of From owner-svn-src-all@freebsd.org Fri Oct 18 21:32:46 2019 Return-Path: Delivered-To: svn-src-all@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 BDBDC15B0F1; Fri, 18 Oct 2019 21:32: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 46vzlf4THSz42nb; Fri, 18 Oct 2019 21:32: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 62B0EF37C; Fri, 18 Oct 2019 21:32: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 x9ILWk3G018032; Fri, 18 Oct 2019 21:32:46 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ILWj1i018029; Fri, 18 Oct 2019 21:32:45 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910182132.x9ILWj1i018029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 18 Oct 2019 21:32:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353740 - head/sys/dev/nvdimm X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/dev/nvdimm X-SVN-Commit-Revision: 353740 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 21:32:46 -0000 Author: cem Date: Fri Oct 18 21:32:45 2019 New Revision: 353740 URL: https://svnweb.freebsd.org/changeset/base/353740 Log: nvdimm(4): Persist unit numbers in cdev They're formatted into the device name like unit numbers, anyway; store the number in mda_unit => si_drv0 like dev2unit() expects. No functional change intended. Sponsored by: Dell EMC Isilon Modified: head/sys/dev/nvdimm/nvdimm_ns.c head/sys/dev/nvdimm/nvdimm_spa.c head/sys/dev/nvdimm/nvdimm_var.h Modified: head/sys/dev/nvdimm/nvdimm_ns.c ============================================================================== --- head/sys/dev/nvdimm/nvdimm_ns.c Fri Oct 18 20:05:27 2019 (r353739) +++ head/sys/dev/nvdimm/nvdimm_ns.c Fri Oct 18 21:32:45 2019 (r353740) @@ -74,7 +74,7 @@ nvdimm_create_namespaces(struct SPA_mapping *spa, ACPI ns->dev.spa_efi_mem_flags = spa->dev.spa_efi_mem_flags; ns->dev.spa_memattr = spa->dev.spa_memattr; asprintf(&name, M_NVDIMM, "spa%dns%d", spa->spa_nfit_idx, i); - error = nvdimm_spa_dev_init(&ns->dev, name); + error = nvdimm_spa_dev_init(&ns->dev, name, i); free(name, M_NVDIMM); if (error != 0) break; Modified: head/sys/dev/nvdimm/nvdimm_spa.c ============================================================================== --- head/sys/dev/nvdimm/nvdimm_spa.c Fri Oct 18 20:05:27 2019 (r353739) +++ head/sys/dev/nvdimm/nvdimm_spa.c Fri Oct 18 21:32:45 2019 (r353740) @@ -462,13 +462,13 @@ nvdimm_spa_init(struct SPA_mapping *spa, ACPI_NFIT_SYS return (0); asprintf(&name, M_NVDIMM, "spa%d", spa->spa_nfit_idx); - error = nvdimm_spa_dev_init(&spa->dev, name); + error = nvdimm_spa_dev_init(&spa->dev, name, spa->spa_nfit_idx); free(name, M_NVDIMM); return (error); } int -nvdimm_spa_dev_init(struct nvdimm_spa_dev *dev, const char *name) +nvdimm_spa_dev_init(struct nvdimm_spa_dev *dev, const char *name, int unit) { struct make_dev_args mda; struct sglist *spa_sg; @@ -507,6 +507,7 @@ nvdimm_spa_dev_init(struct nvdimm_spa_dev *dev, const mda.mda_gid = GID_OPERATOR; mda.mda_mode = 0660; mda.mda_si_drv1 = dev; + mda.mda_unit = unit; asprintf(&devname, M_NVDIMM, "nvdimm_%s", name); error = make_dev_s(&mda, &dev->spa_dev, "%s", devname); free(devname, M_NVDIMM); Modified: head/sys/dev/nvdimm/nvdimm_var.h ============================================================================== --- head/sys/dev/nvdimm/nvdimm_var.h Fri Oct 18 20:05:27 2019 (r353739) +++ head/sys/dev/nvdimm/nvdimm_var.h Fri Oct 18 21:32:45 2019 (r353740) @@ -170,7 +170,7 @@ struct nvdimm_dev *nvdimm_find_by_handle(nfit_handle_t int nvdimm_spa_init(struct SPA_mapping *spa, ACPI_NFIT_SYSTEM_ADDRESS *nfitaddr, enum SPA_mapping_type spa_type); void nvdimm_spa_fini(struct SPA_mapping *spa); -int nvdimm_spa_dev_init(struct nvdimm_spa_dev *dev, const char *name); +int nvdimm_spa_dev_init(struct nvdimm_spa_dev *dev, const char *name, int unit); void nvdimm_spa_dev_fini(struct nvdimm_spa_dev *dev); int nvdimm_create_namespaces(struct SPA_mapping *spa, ACPI_TABLE_NFIT *nfitbl); void nvdimm_destroy_namespaces(struct SPA_mapping *spa); From owner-svn-src-all@freebsd.org Fri Oct 18 21:53:28 2019 Return-Path: Delivered-To: svn-src-all@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 3E58215BAFC; Fri, 18 Oct 2019 21:53:28 +0000 (UTC) (envelope-from vmaffione@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 46w0CX1Sm6z440b; Fri, 18 Oct 2019 21:53:28 +0000 (UTC) (envelope-from vmaffione@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 1502BF717; Fri, 18 Oct 2019 21:53:28 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9ILrSm7029685; Fri, 18 Oct 2019 21:53:28 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ILrRjP029681; Fri, 18 Oct 2019 21:53:27 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201910182153.x9ILrRjP029681@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Fri, 18 Oct 2019 21:53:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353741 - in head/sys: dev/netmap dev/virtio/network net X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in head/sys: dev/netmap dev/virtio/network net X-SVN-Commit-Revision: 353741 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 21:53:28 -0000 Author: vmaffione Date: Fri Oct 18 21:53:27 2019 New Revision: 353741 URL: https://svnweb.freebsd.org/changeset/base/353741 Log: tap: add support for virtio-net offloads This patch is part of an effort to make bhyve networking (in particular TCP) faster. The key strategy to enhance TCP throughput is to let the whole packet datapath work with TSO/LRO packets (up to 64KB each), so that the per-packet overhead is amortized over a large number of bytes. This capability is supported in the guest by means of the vtnet(4) driver, which is able to handle TSO/LRO packets leveraging the virtio-net header (see struct virtio_net_hdr and struct virtio_net_hdr_mrg_rxbuf). A bhyve VM exchanges packets with the host through a network backend, which can be vale(4) or if_tap(4). While vale(4) supports TSO/LRO packets, if_tap(4) does not. This patch extends if_tap(4) with the ability to understand the virtio-net header, so that a tapX interface can process TSO/LRO packets. A couple of ioctl commands have been added to configure and probe the virtio-net header. Once the virtio-net header is set, the tapX interface acquires all the IFCAP capabilities necessary for TSO/LRO. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D21263 Modified: head/sys/dev/netmap/if_ptnet.c head/sys/dev/virtio/network/virtio_net.h head/sys/net/if_tap.h head/sys/net/if_tuntap.c Modified: head/sys/dev/netmap/if_ptnet.c ============================================================================== --- head/sys/dev/netmap/if_ptnet.c Fri Oct 18 21:32:45 2019 (r353740) +++ head/sys/dev/netmap/if_ptnet.c Fri Oct 18 21:53:27 2019 (r353741) @@ -1335,150 +1335,6 @@ ptnet_rx_intr(void *opaque) ptnet_rx_eof(pq, PTNET_RX_BUDGET, true); } -/* The following offloadings-related functions are taken from the vtnet - * driver, but the same functionality is required for the ptnet driver. - * As a temporary solution, I copied this code from vtnet and I started - * to generalize it (taking away driver-specific statistic accounting), - * making as little modifications as possible. - * In the future we need to share these functions between vtnet and ptnet. - */ -static int -ptnet_tx_offload_ctx(struct mbuf *m, int *etype, int *proto, int *start) -{ - struct ether_vlan_header *evh; - int offset; - - evh = mtod(m, struct ether_vlan_header *); - if (evh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { - /* BMV: We should handle nested VLAN tags too. */ - *etype = ntohs(evh->evl_proto); - offset = sizeof(struct ether_vlan_header); - } else { - *etype = ntohs(evh->evl_encap_proto); - offset = sizeof(struct ether_header); - } - - switch (*etype) { -#if defined(INET) - case ETHERTYPE_IP: { - struct ip *ip, iphdr; - if (__predict_false(m->m_len < offset + sizeof(struct ip))) { - m_copydata(m, offset, sizeof(struct ip), - (caddr_t) &iphdr); - ip = &iphdr; - } else - ip = (struct ip *)(m->m_data + offset); - *proto = ip->ip_p; - *start = offset + (ip->ip_hl << 2); - break; - } -#endif -#if defined(INET6) - case ETHERTYPE_IPV6: - *proto = -1; - *start = ip6_lasthdr(m, offset, IPPROTO_IPV6, proto); - /* Assert the network stack sent us a valid packet. */ - KASSERT(*start > offset, - ("%s: mbuf %p start %d offset %d proto %d", __func__, m, - *start, offset, *proto)); - break; -#endif - default: - /* Here we should increment the tx_csum_bad_ethtype counter. */ - return (EINVAL); - } - - return (0); -} - -static int -ptnet_tx_offload_tso(if_t ifp, struct mbuf *m, int eth_type, - int offset, bool allow_ecn, struct virtio_net_hdr *hdr) -{ - static struct timeval lastecn; - static int curecn; - struct tcphdr *tcp, tcphdr; - - if (__predict_false(m->m_len < offset + sizeof(struct tcphdr))) { - m_copydata(m, offset, sizeof(struct tcphdr), (caddr_t) &tcphdr); - tcp = &tcphdr; - } else - tcp = (struct tcphdr *)(m->m_data + offset); - - hdr->hdr_len = offset + (tcp->th_off << 2); - hdr->gso_size = m->m_pkthdr.tso_segsz; - hdr->gso_type = eth_type == ETHERTYPE_IP ? VIRTIO_NET_HDR_GSO_TCPV4 : - VIRTIO_NET_HDR_GSO_TCPV6; - - if (tcp->th_flags & TH_CWR) { - /* - * Drop if VIRTIO_NET_F_HOST_ECN was not negotiated. In FreeBSD, - * ECN support is not on a per-interface basis, but globally via - * the net.inet.tcp.ecn.enable sysctl knob. The default is off. - */ - if (!allow_ecn) { - if (ppsratecheck(&lastecn, &curecn, 1)) - if_printf(ifp, - "TSO with ECN not negotiated with host\n"); - return (ENOTSUP); - } - hdr->gso_type |= VIRTIO_NET_HDR_GSO_ECN; - } - - /* Here we should increment tx_tso counter. */ - - return (0); -} - -static struct mbuf * -ptnet_tx_offload(if_t ifp, struct mbuf *m, bool allow_ecn, - struct virtio_net_hdr *hdr) -{ - int flags, etype, csum_start, proto, error; - - flags = m->m_pkthdr.csum_flags; - - error = ptnet_tx_offload_ctx(m, &etype, &proto, &csum_start); - if (error) - goto drop; - - if ((etype == ETHERTYPE_IP && flags & PTNET_CSUM_OFFLOAD) || - (etype == ETHERTYPE_IPV6 && flags & PTNET_CSUM_OFFLOAD_IPV6)) { - /* - * We could compare the IP protocol vs the CSUM_ flag too, - * but that really should not be necessary. - */ - hdr->flags |= VIRTIO_NET_HDR_F_NEEDS_CSUM; - hdr->csum_start = csum_start; - hdr->csum_offset = m->m_pkthdr.csum_data; - /* Here we should increment the tx_csum counter. */ - } - - if (flags & CSUM_TSO) { - if (__predict_false(proto != IPPROTO_TCP)) { - /* Likely failed to correctly parse the mbuf. - * Here we should increment the tx_tso_not_tcp - * counter. */ - goto drop; - } - - KASSERT(hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM, - ("%s: mbuf %p TSO without checksum offload %#x", - __func__, m, flags)); - - error = ptnet_tx_offload_tso(ifp, m, etype, csum_start, - allow_ecn, hdr); - if (error) - goto drop; - } - - return (m); - -drop: - m_freem(m); - return (NULL); -} - static void ptnet_vlan_tag_remove(struct mbuf *m) { @@ -1494,157 +1350,6 @@ ptnet_vlan_tag_remove(struct mbuf *m) m_adj(m, ETHER_VLAN_ENCAP_LEN); } -/* - * Use the checksum offset in the VirtIO header to set the - * correct CSUM_* flags. - */ -static int -ptnet_rx_csum_by_offset(struct mbuf *m, uint16_t eth_type, int ip_start, - struct virtio_net_hdr *hdr) -{ -#if defined(INET) || defined(INET6) - int offset = hdr->csum_start + hdr->csum_offset; -#endif - - /* Only do a basic sanity check on the offset. */ - switch (eth_type) { -#if defined(INET) - case ETHERTYPE_IP: - if (__predict_false(offset < ip_start + sizeof(struct ip))) - return (1); - break; -#endif -#if defined(INET6) - case ETHERTYPE_IPV6: - if (__predict_false(offset < ip_start + sizeof(struct ip6_hdr))) - return (1); - break; -#endif - default: - /* Here we should increment the rx_csum_bad_ethtype counter. */ - return (1); - } - - /* - * Use the offset to determine the appropriate CSUM_* flags. This is - * a bit dirty, but we can get by with it since the checksum offsets - * happen to be different. We assume the host host does not do IPv4 - * header checksum offloading. - */ - switch (hdr->csum_offset) { - case offsetof(struct udphdr, uh_sum): - case offsetof(struct tcphdr, th_sum): - m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; - m->m_pkthdr.csum_data = 0xFFFF; - break; - default: - /* Here we should increment the rx_csum_bad_offset counter. */ - return (1); - } - - return (0); -} - -static int -ptnet_rx_csum_by_parse(struct mbuf *m, uint16_t eth_type, int ip_start, - struct virtio_net_hdr *hdr) -{ - int offset, proto; - - switch (eth_type) { -#if defined(INET) - case ETHERTYPE_IP: { - struct ip *ip; - if (__predict_false(m->m_len < ip_start + sizeof(struct ip))) - return (1); - ip = (struct ip *)(m->m_data + ip_start); - proto = ip->ip_p; - offset = ip_start + (ip->ip_hl << 2); - break; - } -#endif -#if defined(INET6) - case ETHERTYPE_IPV6: - if (__predict_false(m->m_len < ip_start + - sizeof(struct ip6_hdr))) - return (1); - offset = ip6_lasthdr(m, ip_start, IPPROTO_IPV6, &proto); - if (__predict_false(offset < 0)) - return (1); - break; -#endif - default: - /* Here we should increment the rx_csum_bad_ethtype counter. */ - return (1); - } - - switch (proto) { - case IPPROTO_TCP: - if (__predict_false(m->m_len < offset + sizeof(struct tcphdr))) - return (1); - m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; - m->m_pkthdr.csum_data = 0xFFFF; - break; - case IPPROTO_UDP: - if (__predict_false(m->m_len < offset + sizeof(struct udphdr))) - return (1); - m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; - m->m_pkthdr.csum_data = 0xFFFF; - break; - default: - /* - * For the remaining protocols, FreeBSD does not support - * checksum offloading, so the checksum will be recomputed. - */ -#if 0 - if_printf(ifp, "cksum offload of unsupported " - "protocol eth_type=%#x proto=%d csum_start=%d " - "csum_offset=%d\n", __func__, eth_type, proto, - hdr->csum_start, hdr->csum_offset); -#endif - break; - } - - return (0); -} - -/* - * Set the appropriate CSUM_* flags. Unfortunately, the information - * provided is not directly useful to us. The VirtIO header gives the - * offset of the checksum, which is all Linux needs, but this is not - * how FreeBSD does things. We are forced to peek inside the packet - * a bit. - * - * It would be nice if VirtIO gave us the L4 protocol or if FreeBSD - * could accept the offsets and let the stack figure it out. - */ -static int -ptnet_rx_csum(struct mbuf *m, struct virtio_net_hdr *hdr) -{ - struct ether_header *eh; - struct ether_vlan_header *evh; - uint16_t eth_type; - int offset, error; - - eh = mtod(m, struct ether_header *); - eth_type = ntohs(eh->ether_type); - if (eth_type == ETHERTYPE_VLAN) { - /* BMV: We should handle nested VLAN tags too. */ - evh = mtod(m, struct ether_vlan_header *); - eth_type = ntohs(evh->evl_proto); - offset = sizeof(struct ether_vlan_header); - } else - offset = sizeof(struct ether_header); - - if (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) - error = ptnet_rx_csum_by_offset(m, eth_type, offset, hdr); - else - error = ptnet_rx_csum_by_parse(m, eth_type, offset, hdr); - - return (error); -} -/* End of offloading-related functions to be shared with vtnet. */ - static void ptnet_ring_update(struct ptnet_queue *pq, struct netmap_kring *kring, unsigned int head, unsigned int sync_flags) @@ -1776,7 +1481,7 @@ ptnet_drain_transmit_queue(struct ptnet_queue *pq, uns * two 8-bytes-wide writes. */ memset(nmbuf, 0, PTNET_HDR_SIZE); if (mhead->m_pkthdr.csum_flags & PTNET_ALL_OFFLOAD) { - mhead = ptnet_tx_offload(ifp, mhead, false, + mhead = virtio_net_tx_offload(ifp, mhead, false, vh); if (unlikely(!mhead)) { /* Packet dropped because errors @@ -2154,14 +1859,11 @@ host_sync: } } - if (have_vnet_hdr && (vh->flags & (VIRTIO_NET_HDR_F_NEEDS_CSUM - | VIRTIO_NET_HDR_F_DATA_VALID))) { - if (unlikely(ptnet_rx_csum(mhead, vh))) { - m_freem(mhead); - nm_prlim(1, "Csum offload error: dropping"); - pq->stats.iqdrops ++; - deliver = 0; - } + if (unlikely(have_vnet_hdr && virtio_net_rx_csum(mhead, vh))) { + m_freem(mhead); + nm_prlim(1, "Csum offload error: dropping"); + pq->stats.iqdrops ++; + deliver = 0; } skip: Modified: head/sys/dev/virtio/network/virtio_net.h ============================================================================== --- head/sys/dev/virtio/network/virtio_net.h Fri Oct 18 21:32:45 2019 (r353740) +++ head/sys/dev/virtio/network/virtio_net.h Fri Oct 18 21:53:27 2019 (r353741) @@ -201,4 +201,297 @@ struct virtio_net_ctrl_mq { #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000 +/* + * Use the checksum offset in the VirtIO header to set the + * correct CSUM_* flags. + */ +static inline int +virtio_net_rx_csum_by_offset(struct mbuf *m, uint16_t eth_type, int ip_start, + struct virtio_net_hdr *hdr) +{ +#if defined(INET) || defined(INET6) + int offset = hdr->csum_start + hdr->csum_offset; +#endif + + /* Only do a basic sanity check on the offset. */ + switch (eth_type) { +#if defined(INET) + case ETHERTYPE_IP: + if (__predict_false(offset < ip_start + sizeof(struct ip))) + return (1); + break; +#endif +#if defined(INET6) + case ETHERTYPE_IPV6: + if (__predict_false(offset < ip_start + sizeof(struct ip6_hdr))) + return (1); + break; +#endif + default: + /* Here we should increment the rx_csum_bad_ethtype counter. */ + return (1); + } + + /* + * Use the offset to determine the appropriate CSUM_* flags. This is + * a bit dirty, but we can get by with it since the checksum offsets + * happen to be different. We assume the host host does not do IPv4 + * header checksum offloading. + */ + switch (hdr->csum_offset) { + case offsetof(struct udphdr, uh_sum): + case offsetof(struct tcphdr, th_sum): + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + m->m_pkthdr.csum_data = 0xFFFF; + break; + default: + /* Here we should increment the rx_csum_bad_offset counter. */ + return (1); + } + + return (0); +} + +static inline int +virtio_net_rx_csum_by_parse(struct mbuf *m, uint16_t eth_type, int ip_start, + struct virtio_net_hdr *hdr) +{ + int offset, proto; + + switch (eth_type) { +#if defined(INET) + case ETHERTYPE_IP: { + struct ip *ip; + if (__predict_false(m->m_len < ip_start + sizeof(struct ip))) + return (1); + ip = (struct ip *)(m->m_data + ip_start); + proto = ip->ip_p; + offset = ip_start + (ip->ip_hl << 2); + break; + } +#endif +#if defined(INET6) + case ETHERTYPE_IPV6: + if (__predict_false(m->m_len < ip_start + + sizeof(struct ip6_hdr))) + return (1); + offset = ip6_lasthdr(m, ip_start, IPPROTO_IPV6, &proto); + if (__predict_false(offset < 0)) + return (1); + break; +#endif + default: + /* Here we should increment the rx_csum_bad_ethtype counter. */ + return (1); + } + + switch (proto) { + case IPPROTO_TCP: + if (__predict_false(m->m_len < offset + sizeof(struct tcphdr))) + return (1); + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + m->m_pkthdr.csum_data = 0xFFFF; + break; + case IPPROTO_UDP: + if (__predict_false(m->m_len < offset + sizeof(struct udphdr))) + return (1); + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + m->m_pkthdr.csum_data = 0xFFFF; + break; + default: + /* + * For the remaining protocols, FreeBSD does not support + * checksum offloading, so the checksum will be recomputed. + */ +#if 0 + if_printf(ifp, "cksum offload of unsupported " + "protocol eth_type=%#x proto=%d csum_start=%d " + "csum_offset=%d\n", __func__, eth_type, proto, + hdr->csum_start, hdr->csum_offset); +#endif + break; + } + + return (0); +} + +/* + * Set the appropriate CSUM_* flags. Unfortunately, the information + * provided is not directly useful to us. The VirtIO header gives the + * offset of the checksum, which is all Linux needs, but this is not + * how FreeBSD does things. We are forced to peek inside the packet + * a bit. + * + * It would be nice if VirtIO gave us the L4 protocol or if FreeBSD + * could accept the offsets and let the stack figure it out. + */ +static inline int +virtio_net_rx_csum(struct mbuf *m, struct virtio_net_hdr *hdr) +{ + struct ether_header *eh; + struct ether_vlan_header *evh; + uint16_t eth_type; + int offset, error; + + if ((hdr->flags & (VIRTIO_NET_HDR_F_NEEDS_CSUM | + VIRTIO_NET_HDR_F_DATA_VALID)) == 0) { + return (0); + } + + eh = mtod(m, struct ether_header *); + eth_type = ntohs(eh->ether_type); + if (eth_type == ETHERTYPE_VLAN) { + /* BMV: We should handle nested VLAN tags too. */ + evh = mtod(m, struct ether_vlan_header *); + eth_type = ntohs(evh->evl_proto); + offset = sizeof(struct ether_vlan_header); + } else + offset = sizeof(struct ether_header); + + if (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) + error = virtio_net_rx_csum_by_offset(m, eth_type, offset, hdr); + else + error = virtio_net_rx_csum_by_parse(m, eth_type, offset, hdr); + + return (error); +} + +static inline int +virtio_net_tx_offload_ctx(struct mbuf *m, int *etype, int *proto, int *start) +{ + struct ether_vlan_header *evh; + int offset; + + evh = mtod(m, struct ether_vlan_header *); + if (evh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { + /* BMV: We should handle nested VLAN tags too. */ + *etype = ntohs(evh->evl_proto); + offset = sizeof(struct ether_vlan_header); + } else { + *etype = ntohs(evh->evl_encap_proto); + offset = sizeof(struct ether_header); + } + + switch (*etype) { +#if defined(INET) + case ETHERTYPE_IP: { + struct ip *ip, iphdr; + if (__predict_false(m->m_len < offset + sizeof(struct ip))) { + m_copydata(m, offset, sizeof(struct ip), + (caddr_t) &iphdr); + ip = &iphdr; + } else + ip = (struct ip *)(m->m_data + offset); + *proto = ip->ip_p; + *start = offset + (ip->ip_hl << 2); + break; + } +#endif +#if defined(INET6) + case ETHERTYPE_IPV6: + *proto = -1; + *start = ip6_lasthdr(m, offset, IPPROTO_IPV6, proto); + /* Assert the network stack sent us a valid packet. */ + KASSERT(*start > offset, + ("%s: mbuf %p start %d offset %d proto %d", __func__, m, + *start, offset, *proto)); + break; +#endif + default: + /* Here we should increment the tx_csum_bad_ethtype counter. */ + return (EINVAL); + } + + return (0); +} + +static inline int +virtio_net_tx_offload_tso(if_t ifp, struct mbuf *m, int eth_type, + int offset, bool allow_ecn, struct virtio_net_hdr *hdr) +{ + static struct timeval lastecn; + static int curecn; + struct tcphdr *tcp, tcphdr; + + if (__predict_false(m->m_len < offset + sizeof(struct tcphdr))) { + m_copydata(m, offset, sizeof(struct tcphdr), (caddr_t) &tcphdr); + tcp = &tcphdr; + } else + tcp = (struct tcphdr *)(m->m_data + offset); + + hdr->hdr_len = offset + (tcp->th_off << 2); + hdr->gso_size = m->m_pkthdr.tso_segsz; + hdr->gso_type = eth_type == ETHERTYPE_IP ? VIRTIO_NET_HDR_GSO_TCPV4 : + VIRTIO_NET_HDR_GSO_TCPV6; + + if (tcp->th_flags & TH_CWR) { + /* + * Drop if VIRTIO_NET_F_HOST_ECN was not negotiated. In FreeBSD, + * ECN support is not on a per-interface basis, but globally via + * the net.inet.tcp.ecn.enable sysctl knob. The default is off. + */ + if (!allow_ecn) { + if (ppsratecheck(&lastecn, &curecn, 1)) + if_printf(ifp, + "TSO with ECN not negotiated with host\n"); + return (ENOTSUP); + } + hdr->gso_type |= VIRTIO_NET_HDR_GSO_ECN; + } + + /* Here we should increment tx_tso counter. */ + + return (0); +} + +static inline struct mbuf * +virtio_net_tx_offload(if_t ifp, struct mbuf *m, bool allow_ecn, + struct virtio_net_hdr *hdr) +{ + int flags, etype, csum_start, proto, error; + + flags = m->m_pkthdr.csum_flags; + + error = virtio_net_tx_offload_ctx(m, &etype, &proto, &csum_start); + if (error) + goto drop; + + if ((etype == ETHERTYPE_IP && (flags & (CSUM_TCP | CSUM_UDP))) || + (etype == ETHERTYPE_IPV6 && + (flags & (CSUM_TCP_IPV6 | CSUM_UDP_IPV6)))) { + /* + * We could compare the IP protocol vs the CSUM_ flag too, + * but that really should not be necessary. + */ + hdr->flags |= VIRTIO_NET_HDR_F_NEEDS_CSUM; + hdr->csum_start = csum_start; + hdr->csum_offset = m->m_pkthdr.csum_data; + /* Here we should increment the tx_csum counter. */ + } + + if (flags & CSUM_TSO) { + if (__predict_false(proto != IPPROTO_TCP)) { + /* Likely failed to correctly parse the mbuf. + * Here we should increment the tx_tso_not_tcp + * counter. */ + goto drop; + } + + KASSERT(hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM, + ("%s: mbuf %p TSO without checksum offload %#x", + __func__, m, flags)); + + error = virtio_net_tx_offload_tso(ifp, m, etype, csum_start, + allow_ecn, hdr); + if (error) + goto drop; + } + + return (m); + +drop: + m_freem(m); + return (NULL); +} + #endif /* _VIRTIO_NET_H */ Modified: head/sys/net/if_tap.h ============================================================================== --- head/sys/net/if_tap.h Fri Oct 18 21:32:45 2019 (r353740) +++ head/sys/net/if_tap.h Fri Oct 18 21:53:27 2019 (r353741) @@ -43,7 +43,7 @@ #include /* maximum receive packet size (hard limit) */ -#define TAPMRU 16384 +#define TAPMRU 65535 #define tapinfo tuninfo @@ -56,6 +56,8 @@ #define TAPSIFINFO TUNSIFINFO #define TAPGIFINFO TUNGIFINFO #define TAPGIFNAME TUNGIFNAME +#define TAPSVNETHDR _IOW('t', 91, int) +#define TAPGVNETHDR _IOR('t', 94, int) /* VMware ioctl's */ #define VMIO_SIOCSIFFLAGS _IOWINT('V', 0) Modified: head/sys/net/if_tuntap.c ============================================================================== --- head/sys/net/if_tuntap.c Fri Oct 18 21:32:45 2019 (r353740) +++ head/sys/net/if_tuntap.c Fri Oct 18 21:53:27 2019 (r353741) @@ -84,16 +84,24 @@ #include #include #include +#include #include #include #include #ifdef INET #include +#include +#include +#include +#include +#include #endif #include #include #include +#include + #include #include #include @@ -134,6 +142,7 @@ struct tuntap_softc { struct cv tun_cv; /* for ref'd dev destroy */ struct ether_addr tun_ether; /* remote address */ int tun_busy; /* busy count */ + int tun_vhdrlen; /* virtio-net header length */ }; #define TUN2IFP(sc) ((sc)->tun_ifp) @@ -146,6 +155,19 @@ struct tuntap_softc { #define TUN_VMIO_FLAG_MASK 0x0fff /* + * Interface capabilities of a tap device that supports the virtio-net + * header. + */ +#define TAP_VNET_HDR_CAPS (IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6 \ + | IFCAP_VLAN_HWCSUM \ + | IFCAP_TSO | IFCAP_LRO \ + | IFCAP_VLAN_HWTSO) + +#define TAP_ALL_OFFLOAD (CSUM_TSO | CSUM_TCP | CSUM_UDP |\ + CSUM_TCP_IPV6 | CSUM_UDP_IPV6) + + +/* * All mutable global variables in if_tun are locked using tunmtx, with * the exception of tundebug, which is used unlocked, and the drivers' *clones, * which are static after setup. @@ -211,6 +233,7 @@ static int tap_clone_match(struct if_clone *ifc, const static int vmnet_clone_match(struct if_clone *ifc, const char *name); static int tun_clone_create(struct if_clone *, char *, size_t, caddr_t); static int tun_clone_destroy(struct if_clone *, struct ifnet *); +static void tun_vnethdr_set(struct ifnet *ifp, int vhdrlen); static d_open_t tunopen; static d_close_t tunclose; @@ -1140,6 +1163,7 @@ out: TUNDEBUG (ifp, "closed\n"); tp->tun_flags &= ~TUN_OPEN; tp->tun_pid = 0; + tun_vnethdr_set(ifp, 0); tun_unbusy_locked(tp); TUN_UNLOCK(tp); @@ -1202,6 +1226,65 @@ tunifinit(void *xtp) } /* + * To be called under TUN_LOCK. Update ifp->if_hwassist according to the + * current value of ifp->if_capenable. + */ +static void +tun_caps_changed(struct ifnet *ifp) +{ + uint64_t hwassist = 0; + + TUN_LOCK_ASSERT((struct tuntap_softc *)ifp->if_softc); + if (ifp->if_capenable & IFCAP_TXCSUM) + hwassist |= CSUM_TCP | CSUM_UDP; + if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) + hwassist |= CSUM_TCP_IPV6 + | CSUM_UDP_IPV6; + if (ifp->if_capenable & IFCAP_TSO4) + hwassist |= CSUM_IP_TSO; + if (ifp->if_capenable & IFCAP_TSO6) + hwassist |= CSUM_IP6_TSO; + ifp->if_hwassist = hwassist; +} + +/* + * To be called under TUN_LOCK. Update tp->tun_vhdrlen and adjust + * if_capabilities and if_capenable as needed. + */ +static void +tun_vnethdr_set(struct ifnet *ifp, int vhdrlen) +{ + struct tuntap_softc *tp = ifp->if_softc; + + TUN_LOCK_ASSERT(tp); + + if (tp->tun_vhdrlen == vhdrlen) + return; + + /* + * Update if_capabilities to reflect the + * functionalities offered by the virtio-net + * header. + */ + if (vhdrlen != 0) + ifp->if_capabilities |= + TAP_VNET_HDR_CAPS; + else + ifp->if_capabilities &= + ~TAP_VNET_HDR_CAPS; + /* + * Disable any capabilities that we don't + * support anymore. + */ + ifp->if_capenable &= ifp->if_capabilities; + tun_caps_changed(ifp); + tp->tun_vhdrlen = vhdrlen; + + TUNDEBUG(ifp, "vnet_hdr_len=%d, if_capabilities=%x\n", + vhdrlen, ifp->if_capabilities); +} + +/* * Process an ioctl request. */ static int @@ -1268,6 +1351,13 @@ tunifioctl(struct ifnet *ifp, u_long cmd, caddr_t data error = copyout(&media, ifmr->ifm_ulist, sizeof(int)); } break; + case SIOCSIFCAP: + TUN_LOCK(tp); + ifp->if_capenable = ifr->ifr_reqcap; + tun_caps_changed(ifp); + TUN_UNLOCK(tp); + VLAN_CAPABILITIES(ifp); + break; default: if (l2tun) { error = ether_ioctl(ifp, cmd, data); @@ -1378,12 +1468,9 @@ tunioctl(struct cdev *dev, u_long cmd, caddr_t data, i { struct ifreq ifr, *ifrp; struct tuntap_softc *tp = dev->si_drv1; + struct ifnet *ifp = TUN2IFP(tp); struct tuninfo *tunp; - int error, iflags; -#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \ - defined(COMPAT_FREEBSD4) - int ival; -#endif + int error, iflags, ival; bool l2tun; l2tun = (tp->tun_flags & TUN_L2) != 0; @@ -1405,8 +1492,8 @@ tunioctl(struct cdev *dev, u_long cmd, caddr_t data, i iflags |= IFF_UP; TUN_LOCK(tp); - TUN2IFP(tp)->if_flags = iflags | - (TUN2IFP(tp)->if_flags & IFF_CANTCHANGE); + ifp->if_flags = iflags | + (ifp->if_flags & IFF_CANTCHANGE); TUN_UNLOCK(tp); return (0); @@ -1424,6 +1511,24 @@ tunioctl(struct cdev *dev, u_long cmd, caddr_t data, i TUN_UNLOCK(tp); return (0); + case TAPSVNETHDR: + ival = *(int *)data; + if (ival != 0 && + ival != sizeof(struct virtio_net_hdr) && + ival != sizeof(struct virtio_net_hdr_mrg_rxbuf)) { + return (EINVAL); + } + TUN_LOCK(tp); + tun_vnethdr_set(ifp, ival); + TUN_UNLOCK(tp); + + return (0); + case TAPGVNETHDR: + TUN_LOCK(tp); + *(int *)data = tp->tun_vhdrlen; + TUN_UNLOCK(tp); + + return (0); } /* Fall through to the common ioctls if unhandled */ @@ -1578,7 +1683,8 @@ tunread(struct cdev *dev, struct uio *uio, int flag) struct tuntap_softc *tp = dev->si_drv1; struct ifnet *ifp = TUN2IFP(tp); struct mbuf *m; - int error=0, len; + size_t len; + int error = 0; TUNDEBUG (ifp, "read\n"); TUN_LOCK(tp); @@ -1611,6 +1717,23 @@ tunread(struct cdev *dev, struct uio *uio, int flag) if ((tp->tun_flags & TUN_L2) != 0) BPF_MTAP(ifp, m); + len = min(tp->tun_vhdrlen, uio->uio_resid); + if (len > 0) { + struct virtio_net_hdr_mrg_rxbuf vhdr; + + bzero(&vhdr, sizeof(vhdr)); + if (m->m_pkthdr.csum_flags & TAP_ALL_OFFLOAD) { + m = virtio_net_tx_offload(ifp, m, false, &vhdr.hdr); + } + + TUNDEBUG(ifp, "txvhdr: f %u, gt %u, hl %u, " + "gs %u, cs %u, co %u\n", vhdr.hdr.flags, + vhdr.hdr.gso_type, vhdr.hdr.hdr_len, + vhdr.hdr.gso_size, vhdr.hdr.csum_start, + vhdr.hdr.csum_offset); + error = uiomove(&vhdr, len, uio); + } + while (m && uio->uio_resid > 0 && error == 0) { len = min(uio->uio_resid, m->m_len); if (len != 0) @@ -1626,7 +1749,8 @@ tunread(struct cdev *dev, struct uio *uio, int flag) } static int -tunwrite_l2(struct tuntap_softc *tp, struct mbuf *m) +tunwrite_l2(struct tuntap_softc *tp, struct mbuf *m, + struct virtio_net_hdr_mrg_rxbuf *vhdr) { struct ether_header *eh; struct ifnet *ifp; @@ -1651,6 +1775,11 @@ tunwrite_l2(struct tuntap_softc *tp, struct mbuf *m) return (0); } + if (vhdr != NULL && virtio_net_rx_csum(m, &vhdr->hdr)) { + m_freem(m); + return (0); + } + /* Pass packet up to parent. */ CURVNET_SET(ifp->if_vnet); (*ifp->if_input)(ifp, m); @@ -1717,11 +1846,12 @@ tunwrite_l3(struct tuntap_softc *tp, struct mbuf *m) static int tunwrite(struct cdev *dev, struct uio *uio, int flag) { + struct virtio_net_hdr_mrg_rxbuf vhdr; struct tuntap_softc *tp; struct ifnet *ifp; struct mbuf *m; uint32_t mru; - int align; + int align, vhdrlen, error; bool l2tun; tp = dev->si_drv1; @@ -1735,17 +1865,30 @@ tunwrite(struct cdev *dev, struct uio *uio, int flag) return (0); l2tun = (tp->tun_flags & TUN_L2) != 0; - align = 0; mru = l2tun ? TAPMRU : TUNMRU; - if (l2tun) + vhdrlen = tp->tun_vhdrlen; + align = 0; + if (l2tun) { align = ETHER_ALIGN; - else if ((tp->tun_flags & TUN_IFHEAD) != 0) + mru += vhdrlen; + } else if ((tp->tun_flags & TUN_IFHEAD) != 0) mru += sizeof(uint32_t); /* family */ if (uio->uio_resid < 0 || uio->uio_resid > mru) { TUNDEBUG(ifp, "len=%zd!\n", uio->uio_resid); return (EIO); } + if (vhdrlen > 0) { + error = uiomove(&vhdr, vhdrlen, uio); + if (error != 0) + return (error); + TUNDEBUG(ifp, "txvhdr: f %u, gt %u, hl %u, " + "gs %u, cs %u, co %u\n", vhdr.hdr.flags, + vhdr.hdr.gso_type, vhdr.hdr.hdr_len, + vhdr.hdr.gso_size, vhdr.hdr.csum_start, + vhdr.hdr.csum_offset); + } + if ((m = m_uiotombuf(uio, M_NOWAIT, 0, align, M_PKTHDR)) == NULL) { if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return (ENOBUFS); @@ -1757,7 +1900,7 @@ tunwrite(struct cdev *dev, struct uio *uio, int flag) #endif if (l2tun) - return (tunwrite_l2(tp, m)); + return (tunwrite_l2(tp, m, vhdrlen > 0 ? &vhdr : NULL)); return (tunwrite_l3(tp, m)); } From owner-svn-src-all@freebsd.org Fri Oct 18 22:03:37 2019 Return-Path: Delivered-To: svn-src-all@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 E421515BCE4; Fri, 18 Oct 2019 22:03:37 +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 46w0RF5XGmz44RK; Fri, 18 Oct 2019 22:03:37 +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 A0781F91B; Fri, 18 Oct 2019 22:03:37 +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 x9IM3bS0035766; Fri, 18 Oct 2019 22:03:37 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9IM3bYD035764; Fri, 18 Oct 2019 22:03:37 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910182203.x9IM3bYD035764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 18 Oct 2019 22:03:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353742 - in head/sys: conf net X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: conf net X-SVN-Commit-Revision: 353742 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 22:03:38 -0000 Author: cem Date: Fri Oct 18 22:03:36 2019 New Revision: 353742 URL: https://svnweb.freebsd.org/changeset/base/353742 Log: Fix debugnet(4) link/build fallout on some configurations Introduced in r353685 (sys/conf/files), r353694 (debugnet.c db_printf). Submitted by: kevans Reported by: cy X-MFC-With: r353685, r353694 Modified: head/sys/conf/files head/sys/net/debugnet.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Oct 18 21:53:27 2019 (r353741) +++ head/sys/conf/files Fri Oct 18 22:03:36 2019 (r353742) @@ -4298,7 +4298,7 @@ netinet/libalias/alias_mod.c optional libalias | netgr netinet/libalias/alias_proxy.c optional libalias inet | netgraph_nat inet netinet/libalias/alias_util.c optional libalias inet | netgraph_nat inet netinet/libalias/alias_sctp.c optional libalias inet | netgraph_nat inet -netinet/netdump/netdump_client.c optional inet netdump +netinet/netdump/netdump_client.c optional inet debugnet netdump netinet6/dest6.c optional inet6 netinet6/frag6.c optional inet6 netinet6/icmp6.c optional inet6 Modified: head/sys/net/debugnet.c ============================================================================== --- head/sys/net/debugnet.c Fri Oct 18 21:53:27 2019 (r353741) +++ head/sys/net/debugnet.c Fri Oct 18 22:03:36 2019 (r353742) @@ -659,7 +659,7 @@ debugnet_connect(const struct debugnet_conn_params *dc CURVNET_RESTORE(); if (dest_rt == NULL) { - db_printf("%s: Could not get route for that server.\n", + printf("%s: Could not get route for that server.\n", __func__); error = ENOENT; goto cleanup; From owner-svn-src-all@freebsd.org Fri Oct 18 22:08:05 2019 Return-Path: Delivered-To: svn-src-all@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 2620D15BE32; Fri, 18 Oct 2019 22:08:05 +0000 (UTC) (envelope-from jkim@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 46w0XP09KCz44gN; Fri, 18 Oct 2019 22:08:05 +0000 (UTC) (envelope-from jkim@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 D8AB9F91C; Fri, 18 Oct 2019 22:08:04 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9IM84Ud036005; Fri, 18 Oct 2019 22:08:04 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9IM848W036004; Fri, 18 Oct 2019 22:08:04 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201910182208.x9IM848W036004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 18 Oct 2019 22:08:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353743 - head X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 353743 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 22:08:05 -0000 Author: jkim Date: Fri Oct 18 22:08:04 2019 New Revision: 353743 URL: https://svnweb.freebsd.org/changeset/base/353743 Log: Do not remove /usr/share/mk/bsd.compat.mk. It was reintroduced by r353659. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Fri Oct 18 22:03:36 2019 (r353742) +++ head/ObsoleteFiles.inc Fri Oct 18 22:08:04 2019 (r353743) @@ -5614,8 +5614,6 @@ OLD_DIRS+=usr/share/man/man1aout OLD_DIRS+=usr/share/man/cat1aout OLD_DIRS+=usr/share/man/en.ISO8859-1/cat1aout OLD_DIRS+=usr/share/man/en.UTF-8/cat1aout -# 20130110: bsd.compat.mk removed -OLD_FILES+=usr/share/mk/bsd.compat.mk # 20130103: gnats-supfile removed OLD_FILES+=usr/share/examples/cvsup/gnats-supfile # 20121230: libdisk removed From owner-svn-src-all@freebsd.org Fri Oct 18 22:16:16 2019 Return-Path: Delivered-To: svn-src-all@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 8BA8B15C034; Fri, 18 Oct 2019 22:16:16 +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 46w0jp6KXcz45Mj; Fri, 18 Oct 2019 22:16:14 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id LaXZieS9eIhW9LaXbiyfB5; Fri, 18 Oct 2019 16:16:12 -0600 X-Authority-Analysis: v=2.3 cv=FcFJO626 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=XobE76Q3jBoA:10 a=YxBL1-UpAAAA:8 a=iaTFZB6CAAAA:8 a=pGLkceISAAAA:8 a=6I5d2MoRAAAA:8 a=G0_B3m8xAAAA:8 a=3R7_y84KU7utUsra6QUA:9 a=jPecpB6AOpLXUzJM:21 a=CjuIK1q_8ugA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=QWXrQ9iV8q7LKaLQ9lfw:22 a=IjZwj45LgO3ly-622nXo:22 a=gBgTPrObzSPeouD7eQ2s:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id B4D6F5DD; Fri, 18 Oct 2019 15:16:08 -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 x9IMG83G032489; Fri, 18 Oct 2019 15:16:08 -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 x9IMG7wO032486; Fri, 18 Oct 2019 15:16:08 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201910182216.x9IMG7wO032486@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: "Hartmann, O." cc: Cy Schubert , svn-src-head@freebsd.org, Gary Jennejohn , src-committers@freebsd.org, svn-src-all@freebsd.org, Conrad Meyer Subject: Re: svn commit: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys In-reply-to: <20191018183718.5e6b3d62@hermann.fritz.box> References: <201910172133.x9HLX1kl071044@repo.freebsd.org> <20191018122104.389ffb7a@hermann.fritz.box> <20191018140045.31d269b0@ernst.home> <20191018160935.7dda61c4@hermann.fritz.box> <201910181424.x9IEOC9q013885@slippy.cwsent.com> <20191018175406.0ff89bbc@hermann.fritz.box> <20191018183718.5e6b3d62@hermann.fritz.box> Comments: In-reply-to "Hartmann, O." message dated "Fri, 18 Oct 2019 18:37:18 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 18 Oct 2019 15:16:07 -0700 X-CMAE-Envelope: MS4wfF9M9CP9Sk+3mhwQWrs1tZyPLhyZAoWYaRbxqaFyoCcvrsYhAI7+4w7Dv6pm+H8HSGuzmMOr4P4nxkhDL4Flv+9KQ9rEq3jml62rBktGHPQ562hPjX9M jgdb+sAntZVO3YFF0DukYhcj55JOBKCrURXCSh9nIQVyRmdoJHo5uzWBI2dkwS4xjWW69yl6WZfCABT1yu4IjUoWL0t/2MyUdY3Etgcae9uqE4A2uASaxKqM vebfNQiY1EUbhiZRHNMFqHR2Y3AncLrl9/OqPDbWXwS7YxUvKO7GAC/lk0rxcMylzn14mg/IzhZ/wcrZvFv5LQ== X-Rspamd-Queue-Id: 46w0jp6KXcz45Mj 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 [-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)[]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; REPLYTO_EQ_FROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[138.136.59.64.list.dnswl.org : 127.0.5.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:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-2.30)[ip: (-5.98), ipnet: 64.59.128.0/20(-3.05), asn: 6327(-2.37), 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 22:16:16 -0000 In message <20191018183718.5e6b3d62@hermann.fritz.box>, "Hartmann, O." writes: > --Sig_/icZw9PmU7w9Aj=UqDZhZj.c > Content-Type: text/plain; charset=US-ASCII > Content-Transfer-Encoding: quoted-printable > > On Fri, 18 Oct 2019 09:26:51 -0700 > Cy Schubert wrote: > > > On October 18, 2019 8:54:06 AM PDT, "Hartmann, O." > > wrote: > > >On Fri, 18 Oct 2019 07:24:12 -0700 > > >Cy Schubert wrote: > > > =20 > > >> In message <20191018160935.7dda61c4@hermann.fritz.box>, "Hartmann, > > >> O." writes: =20 > > >> > --Sig_/QDD9BZgeMM6.TJkOIciNb32 > > >> > Content-Type: text/plain; charset=3DUS-ASCII > > >> > Content-Transfer-Encoding: quoted-printable > > >> > > > >> > On Fri, 18 Oct 2019 14:00:45 +0200 > > >> > Gary Jennejohn wrote: > > >> > =20 > > >> > > On Fri, 18 Oct 2019 12:21:04 +0200 > > >> > > "Hartmann, O." wrote: > > >> > >=3D20 =20 > > >> > > > On Thu, 17 Oct 2019 21:33:01 +0000 (UTC) > > >> > > > Conrad Meyer wrote: > > >> > > > =3D20 =20 > > >> > > > > Author: cem > > >> > > > > Date: Thu Oct 17 21:33:01 2019 > > >> > > > > New Revision: 353700 > > >> > > > > URL: https://svnweb.freebsd.org/changeset/base/353700 > > >> > > > >=3D20 > > >> > > > > Log: > > >> > > > > Implement NetGDB(4) > > >> > > > > =3D20 > > >> > > > > NetGDB(4) is a component of a system using a panic-time > > >> > > > > network stack to remotely debug crashed FreeBSD kernels > > >> > > > > over the network, instead of traditional serial interfaces. > > >> > > > > =3D20 > > >> > > > > There are three pieces in the complete NetGDB system. > > >> > > > > =3D20 > > >> > > > > First, a dedicated proxy server must be running to accept > > >> > > > > connections from both NetGDB and gdb(1), and pass > > >> > > > > bidirectional traffic between the two protocols. > > >> > > > > =3D20 > > >> > > > > Second, the NetGDB client is activated much like ordinary > > >> > > > > 'gdb' and similarly to 'netdump' in ddb(4) after a panic. > > >> > > > > Like other debugnet(4) clients (netdump(4)), the network > > >> > > > > interface on the route to the proxy server must be online > > >> > > > > and support debugnet(4). =3D20 > > >> > > > > Finally, the remote (k)gdb(1) uses 'target remote > > >> > > > > :' (like any other TCP remote) to connect to > > >> > > > > the proxy server.=3D20 > > >> > > > > The NetGDB v1 protocol speaks the literal GDB remote > > >> > > > > serial protocol, and uses a 1:1 relationship between GDB > > >> > > > > packets and sequences of debugnet packets (fragmented by > > >> > > > > MTU). There is no encryption utilized to keep debugging > > >> > > > > sessions private, so this is only appropriate for local > > >> > > > > segments or trusted networks. =3D20 > > >> > > > > Submitted by: John Reimer > > >> > > > > (earlier version) Discussed some with: emaste, markj > > >> > > > > Relnotes: sure > > >> > > > > Differential Revision: > > >> > > > > https://reviews.freebsd.org/D21568 > > >> > > > >=3D20 > > >> > > > > Added: > > >> > > > > head/share/man/man4/netgdb.4 (contents, props changed) > > >> > > > > head/sys/gdb/netgdb.c (contents, props changed) > > >> > > > > head/sys/gdb/netgdb.h (contents, props changed) > > >> > > > > Modified: > > >> > > > > head/share/man/man4/Makefile > > >> > > > > head/share/man/man4/ddb.4 > > >> > > > > head/sys/amd64/conf/GENERIC > > >> > > > > head/sys/conf/NOTES > > >> > > > > head/sys/conf/files > > >> > > > > head/sys/conf/options > > >> > > > > head/sys/gdb/gdb.h > > >> > > > > head/sys/gdb/gdb_int.h > > >> > > > > head/sys/gdb/gdb_main.c > > >> > > > > head/sys/gdb/gdb_packet.c > > >> > > > > head/sys/i386/conf/GENERIC > > >> > > > > head/sys/kern/subr_kdb.c > > >> > > > > head/sys/net/debugnet.c > > >> > > > > head/sys/net/debugnet.h > > >> > > > > head/sys/net/debugnet_inet.c > > >> > > > > head/sys/net/debugnet_int.h > > >> > > > > head/sys/sys/kdb.h > > >> > > > > head/sys/sys/param.h > > >> > > > >=3D20 > > >> > > > > Modified: head/share/man/man4/Makefile > > >> > > > > =20 > > >=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= > =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D > > >=20 > > >> > > > > =20 > > >> > =20 > > >=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= > =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D > > >=20 > > >> > =20 > > >=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= > =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D > > >=20 > > >> > =3D3D=3D3D=3D3D=3D3D=3D3D =20 > > >> > > > > --- head/share/man/man4/Makefile Thu Oct 17 21:25:50 > > >> > > > > 2019 (r353699) +++ head/share/man/man4/Makefile > > >> > > > > Thu Oct 17 21:33:01 2019 (r353700) @@ -307,6 +307,7 > > >> > > > > @@ MAN=3D3D aac.4 \ net80211.4 \ > > >> > > > > netdump.4 \ > > >> > > > > netfpga10g_nf10bmac.4 \ > > >> > > > > + netgdb.4 \ > > >> > > > > netgraph.4 \ > > >> > > > > netintro.4 \ > > >> > > > > netmap.4 \ > > >> > > > > =3D20 =20 > > >> > > > [...] > > >> > > >=3D20 > > >> > > >=3D20 > > >> > > > Having "nooptions NETGDB # netgdb(4) client > > >> > > > support" defined in my kernel config file, buildkernel fails > > >> > > > with the error shown below. > > >> > > >=3D20 > > >> > > > [...] > > >> > > > --- debugnet.o --- > > >> > > > /usr/src/sys/net/debugnet.c:662:4: error: implicit > > >> > > > declaration of function 'db_printf' is invalid in C99 > > >> > > > [-Werror,-Wimplicit-function-declaration] db_printf("%s: > > >> > > > Could not get route for that server.\n", ^ > > >> > > > /usr/src/sys/net/debugnet.c:662:4: note: did you mean > > >> > > > 'if_printf'? /usr/src/sys/net/if_var.h:679:5: note: > > >> > > > 'if_printf' declared here int if_printf(struct ifnet *, > > >> > > > const char *, ...) __printflike(2, 3); ^ 1 error generated. > > >> > > > =3D20 =20 > > >> > >=3D20 > > >> > > And I also had to add "nooptions NETDUMP" to get the kernel to > > >> > > compile and link. > > >> > >=3D20 =20 > > >> > > > >> > I already had "nooptions NETDUMP" defined. =20 > > >>=20 > > >>=20 > > >> This will fix it. > > >>=20 > > >> Index: sys/net/debugnet.c > > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > >> --- sys/net/debugnet.c (revision 353717) > > >> +++ sys/net/debugnet.c (working copy) > > >> @@ -659,8 +659,10 @@ > > >> CURVNET_RESTORE(); > > >> =20 > > >> if (dest_rt =3D=3D NULL) { > > >> +#ifdef DDB > > >> db_printf("%s: Could not get route for > > >> that server.\n", __func__); > > >> +#endif > > >> error =3D ENOENT; > > >> goto cleanup; > > >> } > > >>=20 > > >>=20 > > >> =20 > > > > > >Doesn't work, either. > > >The kernel config in question doesn't have any debugging features > > >enabled, so nooptions DDB is alos part of the configuration. > > >buildkernel still fails. =20 > >=20 > > Hmm. Fixed my firewall build. My non-test firewall kernel config has > > the same nooption. > >=20 > > What other options/nooptions and patches are applied to your tree? > >=20 > >=20 > > I use the vanilla CURRENT tree without any extra pachtes. There are > lots of other nooptions, especially for drivers I do not need and > debugging is completely turned off. > > Having "nooptions DDB" commeted out fixes the build for me. > Anticipating the correct portion of my config file, here are those > nooptions I deem relevant. The nooptions are kept in a file added to > GENERIC afterwards: > > [... sorry for the line wrap] > nooptions DDB_CTF # Kernel ELF linker loads CTF > data nooptions INCLUDE_CONFIG_FILE # Include this file in > kernel #options RACCT # Resource accounting > framework #options RACCT_DEFAULT_TO_DISABLED # Set > kern.racct.enable=3D0 by default #options RCTL > # Resource limits > > # Debugging support. Always need this: > #options KDB # Enable kernel debugger > support. #options KDB_TRACE # Print a stack trace > for a panic. # For full debugger support use (turn off in stable > branch): nooptions BUF_TRACKING # Track buffer history > nooptions DDB # Support DDB. > nooptions FULL_BUF_TRACKING # Track more buffer history > nooptions GDB # Support remote GDB. > nooptions DEADLKRES # Enable the deadlock resolver > nooptions INVARIANTS # Enable calls of extra sanity > checking nooptions INVARIANT_SUPPORT # Extra sanity checks > of internal structures, required by INVARIANTS nooptions WITNESS > # Enable checks to detect deadlocks and cycles nooptions > WITNESS_SKIPSPIN # Don't run witness on spinlocks for > speed nooptions MALLOC_DEBUG_MAXZONES # Separate malloc(9) > zones nooptions VERBOSE_SYSINIT # Support debug.verbose_sysinit, > off by default > > # Kernel Sanitizers > #options COVERAGE # Generic kernel coverage. Used > by KCOV #options KCOV # Kernel Coverage > Sanitizer # Warning: KUBSAN can result in a kernel too large for loader > to load #options KUBSAN # Kernel Undefined > Behavior Sanitizer > > # Kernel dump features. > #options EKCD # Support for encrypted kernel > dumps #options GZIO # gzip-compressed kernel > and user dumps #options ZSTDIO # > zstd-compressed kernel and user dumps nooptions NETDUMP > # netdump(4) client support nooptions NETGDB > # netgdb(4) client support > > # Make an SMP-capable kernel by default > #options SMP # Symmetric MultiProcessor > Kernel #options EARLY_AP_STARTUP > Similar (but not identical to) my non-test firewall config. Is the error with the patch the same? The reason I ask is that if DDB is undefined, line 44, which includes ddb/ddb.h and defines db_printf() in line 216 of that file, would solve your problem. The fact it doesn't suggests one of two things: 1) The error now is not the same any more, OR 2) The patch I provided wasn't applied. Anticipating, can you list the contents of /usr/obj/usr/src/amd64.amd64/sys/ YOUR_KERNEL/opt_ddb.h, please? Don't use the pathname I provide above. Use the actual pathname on your computer to find that file. Use the find command if you have to. -- 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-all@freebsd.org Fri Oct 18 22:18:47 2019 Return-Path: Delivered-To: svn-src-all@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 F386415C130; Fri, 18 Oct 2019 22:18:47 +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 46w0ml3sQ0z45Z9; Fri, 18 Oct 2019 22:18:47 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id Laa4ieToRIhW9Laa5iyfp6; Fri, 18 Oct 2019 16:18:45 -0600 X-Authority-Analysis: v=2.3 cv=FcFJO626 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=XobE76Q3jBoA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=XtL3EJd_C5O2CnR2E_EA: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 38B545E6; Fri, 18 Oct 2019 15:18:44 -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 x9IMIhPm032838; Fri, 18 Oct 2019 15:18:43 -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 x9IMIhDm032835; Fri, 18 Oct 2019 15:18:43 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201910182218.x9IMIhDm032835@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: Conrad Meyer cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353742 - in head/sys: conf net In-reply-to: <201910182203.x9IM3bYD035764@repo.freebsd.org> References: <201910182203.x9IM3bYD035764@repo.freebsd.org> Comments: In-reply-to Conrad Meyer message dated "Fri, 18 Oct 2019 22:03:37 -0000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 18 Oct 2019 15:18:43 -0700 X-CMAE-Envelope: MS4wfL3PLpD0DQKePKhG2w1RxKbQD8H8qhz05ekHGHM47JrHY72TEvKgA4w5iqjqFbDkOk0SjBpP5quq2jLhEnlPfo1Qij0MyJBEMHpNJUca+jEg2V3rXRAK 8NncUVAahF/cC2i4RYHaj5la/rPNgSw0nGAUq8GGbpCAICDEqKRW+JlRH/JiaBZh/kaD3Jq+Cv784ruBYDZU9f1b52ld6BFERQTZkb6met3mwrpTeV0xH3sv ySxTn1FlEf6o9m8bp/dbfU8HjmXj667CU/nfCYaxA1ePLhNXnkSNdgBrr/og3duf X-Rspamd-Queue-Id: 46w0ml3sQ0z45Z9 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 22:18:48 -0000 In message <201910182203.x9IM3bYD035764@repo.freebsd.org>, Conrad Meyer writes: > Author: cem > Date: Fri Oct 18 22:03:36 2019 > New Revision: 353742 > URL: https://svnweb.freebsd.org/changeset/base/353742 > > Log: > Fix debugnet(4) link/build fallout on some configurations > > Introduced in r353685 (sys/conf/files), r353694 (debugnet.c db_printf). > > Submitted by: kevans > Reported by: cy > X-MFC-With: r353685, r353694 > > Modified: > head/sys/conf/files > head/sys/net/debugnet.c > > Modified: head/sys/conf/files > ============================================================================= > = > --- head/sys/conf/files Fri Oct 18 21:53:27 2019 (r353741) > +++ head/sys/conf/files Fri Oct 18 22:03:36 2019 (r353742) > @@ -4298,7 +4298,7 @@ netinet/libalias/alias_mod.c optional libalias | net > gr > netinet/libalias/alias_proxy.c optional libalias inet | netgraph_nat i > net > netinet/libalias/alias_util.c optional libalias inet | netgraph_nat i > net > netinet/libalias/alias_sctp.c optional libalias inet | netgraph_nat i > net > -netinet/netdump/netdump_client.c optional inet netdump > +netinet/netdump/netdump_client.c optional inet debugnet netdump > netinet6/dest6.c optional inet6 > netinet6/frag6.c optional inet6 > netinet6/icmp6.c optional inet6 > > Modified: head/sys/net/debugnet.c > ============================================================================= > = > --- head/sys/net/debugnet.c Fri Oct 18 21:53:27 2019 (r353741) > +++ head/sys/net/debugnet.c Fri Oct 18 22:03:36 2019 (r353742) > @@ -659,7 +659,7 @@ debugnet_connect(const struct debugnet_conn_params *dc > CURVNET_RESTORE(); > > if (dest_rt == NULL) { > - db_printf("%s: Could not get route for that server.\n", > + printf("%s: Could not get route for that server.\n", > __func__); > error = ENOENT; > goto cleanup; > Thank you. -- 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-all@freebsd.org Fri Oct 18 22:20:16 2019 Return-Path: Delivered-To: svn-src-all@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 BA3DD15C1E7; Fri, 18 Oct 2019 22:20:16 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.137]) (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 46w0pR4nBcz45kw; Fri, 18 Oct 2019 22:20:15 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id LabUieUrKIhW9LabViyg7S; Fri, 18 Oct 2019 16:20:14 -0600 X-Authority-Analysis: v=2.3 cv=FcFJO626 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=XobE76Q3jBoA:10 a=VxmjJ2MpAAAA:8 a=YxBL1-UpAAAA:8 a=iaTFZB6CAAAA:8 a=pGLkceISAAAA:8 a=6I5d2MoRAAAA:8 a=G0_B3m8xAAAA:8 a=Zsb42VTSfQbidNrpAy0A:9 a=jPecpB6AOpLXUzJM:21 a=CjuIK1q_8ugA:10 a=QCbNFyMtyp4A:10 a=7gXAzLPJhVmCkEl4_tsf:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=QWXrQ9iV8q7LKaLQ9lfw:22 a=IjZwj45LgO3ly-622nXo:22 a=gBgTPrObzSPeouD7eQ2s:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 32AA455C; Fri, 18 Oct 2019 15:20:12 -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 x9IMKCGg032873; Fri, 18 Oct 2019 15:20:12 -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 x9IMKBVn032870; Fri, 18 Oct 2019 15:20:11 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201910182220.x9IMKBVn032870@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: "Hartmann, O." cc: svn-src-head@freebsd.org, Gary Jennejohn , src-committers@freebsd.org, svn-src-all@freebsd.org, Conrad Meyer Subject: Re: svn commit: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys In-reply-to: <201910182216.x9IMG7wO032486@slippy.cwsent.com> References: <201910172133.x9HLX1kl071044@repo.freebsd.org> <20191018122104.389ffb7a@hermann.fritz.box> <20191018140045.31d269b0@ernst.home> <20191018160935.7dda61c4@hermann.fritz.box> <201910181424.x9IEOC9q013885@slippy.cwsent.com> <20191018175406.0ff89bbc@hermann.fritz.box> <20191018183718.5e6b3d62@hermann.fritz.box> <201910182216.x9IMG7wO032486@slippy.cwsent.com> Comments: In-reply-to Cy Schubert message dated "Fri, 18 Oct 2019 15:16:07 -0700." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 18 Oct 2019 15:20:11 -0700 X-CMAE-Envelope: MS4wfOIUWkAcfuw5mG5HIlyEwa56Fpc5Cw9qByiTg8+0WCfRy500BJToEh0l515vu1jInV8u2WNl5g/CwlgJR3B20OCOH8UxnXmcxsDpMKfnWfXpIj7Y9hPQ yDnc6l4ktkFf2FzdP8mZXc5KBOUKIm7D8Z6hwZcRAUUswUFbe9MCwIkBPZeCzuplOFsGWMTlGAWdO/7jaq8oQ1LftlD4Ls2hHlbbteGs64RemCJSWunUdWwB L8anJItzR+ksWy3GenZ4/s09ZMTuGlKUneuel8r5CycXab3MIfNpEqqpV7uLocg0nL1WHurEju64dVtA5KCucg== X-Rspamd-Queue-Id: 46w0pR4nBcz45kw 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.137) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-3.87 / 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)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[6]; REPLYTO_EQ_FROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[137.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)[]; IP_SCORE(-2.27)[ip: (-5.83), ipnet: 64.59.128.0/20(-3.05), asn: 6327(-2.37), 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2019 22:20:16 -0000 In message <201910182216.x9IMG7wO032486@slippy.cwsent.com>, Cy Schubert writes: > In message <20191018183718.5e6b3d62@hermann.fritz.box>, "Hartmann, O." > writes: > > --Sig_/icZw9PmU7w9Aj=UqDZhZj.c > > Content-Type: text/plain; charset=US-ASCII > > Content-Transfer-Encoding: quoted-printable > > > > On Fri, 18 Oct 2019 09:26:51 -0700 > > Cy Schubert wrote: > > > > > On October 18, 2019 8:54:06 AM PDT, "Hartmann, O." > > > wrote: > > > >On Fri, 18 Oct 2019 07:24:12 -0700 > > > >Cy Schubert wrote: > > > > =20 > > > >> In message <20191018160935.7dda61c4@hermann.fritz.box>, "Hartmann, > > > >> O." writes: =20 > > > >> > --Sig_/QDD9BZgeMM6.TJkOIciNb32 > > > >> > Content-Type: text/plain; charset=3DUS-ASCII > > > >> > Content-Transfer-Encoding: quoted-printable > > > >> > > > > >> > On Fri, 18 Oct 2019 14:00:45 +0200 > > > >> > Gary Jennejohn wrote: > > > >> > =20 > > > >> > > On Fri, 18 Oct 2019 12:21:04 +0200 > > > >> > > "Hartmann, O." wrote: > > > >> > >=3D20 =20 > > > >> > > > On Thu, 17 Oct 2019 21:33:01 +0000 (UTC) > > > >> > > > Conrad Meyer wrote: > > > >> > > > =3D20 =20 > > > >> > > > > Author: cem > > > >> > > > > Date: Thu Oct 17 21:33:01 2019 > > > >> > > > > New Revision: 353700 > > > >> > > > > URL: https://svnweb.freebsd.org/changeset/base/353700 > > > >> > > > >=3D20 > > > >> > > > > Log: > > > >> > > > > Implement NetGDB(4) > > > >> > > > > =3D20 > > > >> > > > > NetGDB(4) is a component of a system using a panic-time > > > >> > > > > network stack to remotely debug crashed FreeBSD kernels > > > >> > > > > over the network, instead of traditional serial interfaces. > > > >> > > > > =3D20 > > > >> > > > > There are three pieces in the complete NetGDB system. > > > >> > > > > =3D20 > > > >> > > > > First, a dedicated proxy server must be running to accept > > > >> > > > > connections from both NetGDB and gdb(1), and pass > > > >> > > > > bidirectional traffic between the two protocols. > > > >> > > > > =3D20 > > > >> > > > > Second, the NetGDB client is activated much like ordinary > > > >> > > > > 'gdb' and similarly to 'netdump' in ddb(4) after a panic. > > > >> > > > > Like other debugnet(4) clients (netdump(4)), the network > > > >> > > > > interface on the route to the proxy server must be online > > > >> > > > > and support debugnet(4). =3D20 > > > >> > > > > Finally, the remote (k)gdb(1) uses 'target remote > > > >> > > > > :' (like any other TCP remote) to connect to > > > >> > > > > the proxy server.=3D20 > > > >> > > > > The NetGDB v1 protocol speaks the literal GDB remote > > > >> > > > > serial protocol, and uses a 1:1 relationship between GDB > > > >> > > > > packets and sequences of debugnet packets (fragmented by > > > >> > > > > MTU). There is no encryption utilized to keep debugging > > > >> > > > > sessions private, so this is only appropriate for local > > > >> > > > > segments or trusted networks. =3D20 > > > >> > > > > Submitted by: John Reimer > > > >> > > > > (earlier version) Discussed some with: emaste, markj > > > >> > > > > Relnotes: sure > > > >> > > > > Differential Revision: > > > >> > > > > https://reviews.freebsd.org/D21568 > > > >> > > > >=3D20 > > > >> > > > > Added: > > > >> > > > > head/share/man/man4/netgdb.4 (contents, props changed) > > > >> > > > > head/sys/gdb/netgdb.c (contents, props changed) > > > >> > > > > head/sys/gdb/netgdb.h (contents, props changed) > > > >> > > > > Modified: > > > >> > > > > head/share/man/man4/Makefile > > > >> > > > > head/share/man/man4/ddb.4 > > > >> > > > > head/sys/amd64/conf/GENERIC > > > >> > > > > head/sys/conf/NOTES > > > >> > > > > head/sys/conf/files > > > >> > > > > head/sys/conf/options > > > >> > > > > head/sys/gdb/gdb.h > > > >> > > > > head/sys/gdb/gdb_int.h > > > >> > > > > head/sys/gdb/gdb_main.c > > > >> > > > > head/sys/gdb/gdb_packet.c > > > >> > > > > head/sys/i386/conf/GENERIC > > > >> > > > > head/sys/kern/subr_kdb.c > > > >> > > > > head/sys/net/debugnet.c > > > >> > > > > head/sys/net/debugnet.h > > > >> > > > > head/sys/net/debugnet_inet.c > > > >> > > > > head/sys/net/debugnet_int.h > > > >> > > > > head/sys/sys/kdb.h > > > >> > > > > head/sys/sys/param.h > > > >> > > > >=3D20 > > > >> > > > > Modified: head/share/man/man4/Makefile > > > >> > > > > =20 > > > >=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= > > =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D > > > >=20 > > > >> > > > > =20 > > > >> > =20 > > > >=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= > > =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D > > > >=20 > > > >> > =20 > > > >=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= > > =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D > > > >=20 > > > >> > =3D3D=3D3D=3D3D=3D3D=3D3D =20 > > > >> > > > > --- head/share/man/man4/Makefile Thu Oct 17 21:25:50 > > > >> > > > > 2019 (r353699) +++ head/share/man/man4/Makefile > > > >> > > > > Thu Oct 17 21:33:01 2019 (r353700) @@ -307,6 +307,7 > > > >> > > > > @@ MAN=3D3D aac.4 \ net80211.4 \ > > > >> > > > > netdump.4 \ > > > >> > > > > netfpga10g_nf10bmac.4 \ > > > >> > > > > + netgdb.4 \ > > > >> > > > > netgraph.4 \ > > > >> > > > > netintro.4 \ > > > >> > > > > netmap.4 \ > > > >> > > > > =3D20 =20 > > > >> > > > [...] > > > >> > > >=3D20 > > > >> > > >=3D20 > > > >> > > > Having "nooptions NETGDB # netgdb(4) client > > > >> > > > support" defined in my kernel config file, buildkernel fails > > > >> > > > with the error shown below. > > > >> > > >=3D20 > > > >> > > > [...] > > > >> > > > --- debugnet.o --- > > > >> > > > /usr/src/sys/net/debugnet.c:662:4: error: implicit > > > >> > > > declaration of function 'db_printf' is invalid in C99 > > > >> > > > [-Werror,-Wimplicit-function-declaration] db_printf("%s: > > > >> > > > Could not get route for that server.\n", ^ > > > >> > > > /usr/src/sys/net/debugnet.c:662:4: note: did you mean > > > >> > > > 'if_printf'? /usr/src/sys/net/if_var.h:679:5: note: > > > >> > > > 'if_printf' declared here int if_printf(struct ifnet *, > > > >> > > > const char *, ...) __printflike(2, 3); ^ 1 error generated. > > > >> > > > =3D20 =20 > > > >> > >=3D20 > > > >> > > And I also had to add "nooptions NETDUMP" to get the kernel to > > > >> > > compile and link. > > > >> > >=3D20 =20 > > > >> > > > > >> > I already had "nooptions NETDUMP" defined. =20 > > > >>=20 > > > >>=20 > > > >> This will fix it. > > > >>=20 > > > >> Index: sys/net/debugnet.c > > > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > = > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > >> --- sys/net/debugnet.c (revision 353717) > > > >> +++ sys/net/debugnet.c (working copy) > > > >> @@ -659,8 +659,10 @@ > > > >> CURVNET_RESTORE(); > > > >> =20 > > > >> if (dest_rt =3D=3D NULL) { > > > >> +#ifdef DDB > > > >> db_printf("%s: Could not get route for > > > >> that server.\n", __func__); > > > >> +#endif > > > >> error =3D ENOENT; > > > >> goto cleanup; > > > >> } > > > >>=20 > > > >>=20 > > > >> =20 > > > > > > > >Doesn't work, either. > > > >The kernel config in question doesn't have any debugging features > > > >enabled, so nooptions DDB is alos part of the configuration. > > > >buildkernel still fails. =20 > > >=20 > > > Hmm. Fixed my firewall build. My non-test firewall kernel config has > > > the same nooption. > > >=20 > > > What other options/nooptions and patches are applied to your tree? > > >=20 > > >=20 > > > > I use the vanilla CURRENT tree without any extra pachtes. There are > > lots of other nooptions, especially for drivers I do not need and > > debugging is completely turned off. > > > > Having "nooptions DDB" commeted out fixes the build for me. > > Anticipating the correct portion of my config file, here are those > > nooptions I deem relevant. The nooptions are kept in a file added to > > GENERIC afterwards: > > > > [... sorry for the line wrap] > > nooptions DDB_CTF # Kernel ELF linker loads CTF > > data nooptions INCLUDE_CONFIG_FILE # Include this file in > > kernel #options RACCT # Resource accounting > > framework #options RACCT_DEFAULT_TO_DISABLED # Set > > kern.racct.enable=3D0 by default #options RCTL > > # Resource limits > > > > # Debugging support. Always need this: > > #options KDB # Enable kernel debugger > > support. #options KDB_TRACE # Print a stack trace > > for a panic. # For full debugger support use (turn off in stable > > branch): nooptions BUF_TRACKING # Track buffer history > > nooptions DDB # Support DDB. > > nooptions FULL_BUF_TRACKING # Track more buffer history > > nooptions GDB # Support remote GDB. > > nooptions DEADLKRES # Enable the deadlock resolver > > nooptions INVARIANTS # Enable calls of extra sanity > > checking nooptions INVARIANT_SUPPORT # Extra sanity checks > > of internal structures, required by INVARIANTS nooptions WITNESS > > # Enable checks to detect deadlocks and cycles nooptions > > WITNESS_SKIPSPIN # Don't run witness on spinlocks for > > speed nooptions MALLOC_DEBUG_MAXZONES # Separate malloc(9) > > zones nooptions VERBOSE_SYSINIT # Support debug.verbose_sysinit, > > off by default > > > > # Kernel Sanitizers > > #options COVERAGE # Generic kernel coverage. Used > > by KCOV #options KCOV # Kernel Coverage > > Sanitizer # Warning: KUBSAN can result in a kernel too large for loader > > to load #options KUBSAN # Kernel Undefined > > Behavior Sanitizer > > > > # Kernel dump features. > > #options EKCD # Support for encrypted kernel > > dumps #options GZIO # gzip-compressed kernel > > and user dumps #options ZSTDIO # > > zstd-compressed kernel and user dumps nooptions NETDUMP > > # netdump(4) client support nooptions NETGDB > > # netgdb(4) client support > > > > # Make an SMP-capable kernel by default > > #options SMP # Symmetric MultiProcessor > > Kernel #options EARLY_AP_STARTUP > > > > Similar (but not identical to) my non-test firewall config. > > Is the error with the patch the same? The reason I ask is that if DDB is > undefined, line 44, which includes ddb/ddb.h and defines db_printf() in > line 216 of that file, would solve your problem. The fact it doesn't > suggests one of two things: 1) The error now is not the same any more, OR > 2) The patch I provided wasn't applied. > > Anticipating, can you list the contents of /usr/obj/usr/src/amd64.amd64/sys/ > YOUR_KERNEL/opt_ddb.h, please? Don't use the pathname I provide above. Use > the actual pathname on your computer to find that file. Use the find > command if you have to. Update to r353742 or later instead. -- 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-all@freebsd.org Sat Oct 19 01:07:36 2019 Return-Path: Delivered-To: svn-src-all@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 C6CD315E93A; Sat, 19 Oct 2019 01:07: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 46w4WX4rkxz4DVm; Sat, 19 Oct 2019 01:07: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 8537919918; Sat, 19 Oct 2019 01:07: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 x9J17aAA040719; Sat, 19 Oct 2019 01:07:36 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9J17aRQ040718; Sat, 19 Oct 2019 01:07:36 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201910190107.x9J17aRQ040718@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 19 Oct 2019 01:07:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353745 - head/sys/powerpc/mpc85xx X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/mpc85xx X-SVN-Commit-Revision: 353745 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 01:07:36 -0000 Author: jhibbits Date: Sat Oct 19 01:07:35 2019 New Revision: 353745 URL: https://svnweb.freebsd.org/changeset/base/353745 Log: powerpc/mpc85xx: Replace global PCI config mutex with per-controller mutex PCI controllers need to enforce exclusive config register access on their own bus, not between all buses. Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx.c Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx.c ============================================================================== --- head/sys/powerpc/mpc85xx/pci_mpc85xx.c Fri Oct 18 22:53:40 2019 (r353744) +++ head/sys/powerpc/mpc85xx/pci_mpc85xx.c Sat Oct 19 01:07:35 2019 (r353745) @@ -126,6 +126,7 @@ __FBSDID("$FreeBSD$"); struct fsl_pcib_softc { struct ofw_pci_softc pci_sc; device_t sc_dev; + struct mtx sc_cfg_mtx; int sc_iomem_target; bus_addr_t sc_iomem_start, sc_iomem_end; @@ -200,10 +201,6 @@ static uint32_t fsl_pcib_read_config(device_t, u_int, static void fsl_pcib_write_config(device_t, u_int, u_int, u_int, u_int, uint32_t, int); -/* Configuration r/w mutex. */ -struct mtx pcicfg_mtx; -static int mtx_initialized = 0; - /* * Bus interface definitions. */ @@ -298,10 +295,7 @@ fsl_pcib_attach(device_t dev) sc->sc_bsh = rman_get_bushandle(sc->sc_res); sc->sc_busnr = 0; - if (!mtx_initialized) { - mtx_init(&pcicfg_mtx, "pcicfg", NULL, MTX_SPIN); - mtx_initialized = 1; - } + mtx_init(&sc->sc_cfg_mtx, "pcicfg", NULL, MTX_SPIN); cfgreg = fsl_pcib_cfgread(sc, 0, 0, 0, PCIR_VENDOR, 2); if (cfgreg != 0x1057 && cfgreg != 0x1957) @@ -413,7 +407,7 @@ fsl_pcib_cfgread(struct fsl_pcib_softc *sc, u_int bus, if (sc->sc_pcie) addr |= (reg & 0xf00) << 16; - mtx_lock_spin(&pcicfg_mtx); + mtx_lock_spin(&sc->sc_cfg_mtx); bus_space_write_4(sc->sc_bst, sc->sc_bsh, REG_CFG_ADDR, addr); switch (bytes) { @@ -433,7 +427,7 @@ fsl_pcib_cfgread(struct fsl_pcib_softc *sc, u_int bus, data = ~0; break; } - mtx_unlock_spin(&pcicfg_mtx); + mtx_unlock_spin(&sc->sc_cfg_mtx); return (data); } @@ -451,7 +445,7 @@ fsl_pcib_cfgwrite(struct fsl_pcib_softc *sc, u_int bus if (sc->sc_pcie) addr |= (reg & 0xf00) << 16; - mtx_lock_spin(&pcicfg_mtx); + mtx_lock_spin(&sc->sc_cfg_mtx); bus_space_write_4(sc->sc_bst, sc->sc_bsh, REG_CFG_ADDR, addr); switch (bytes) { @@ -468,7 +462,7 @@ fsl_pcib_cfgwrite(struct fsl_pcib_softc *sc, u_int bus REG_CFG_DATA, htole32(data)); break; } - mtx_unlock_spin(&pcicfg_mtx); + mtx_unlock_spin(&sc->sc_cfg_mtx); } #if 0 @@ -757,11 +751,12 @@ fsl_pcib_err_init(device_t dev) static int fsl_pcib_detach(device_t dev) { + struct fsl_pcib_softc *sc; - if (mtx_initialized) { - mtx_destroy(&pcicfg_mtx); - mtx_initialized = 0; - } + sc = device_get_softc(dev); + + mtx_destroy(&sc->sc_cfg_mtx); + return (bus_generic_detach(dev)); } From owner-svn-src-all@freebsd.org Sat Oct 19 02:47:32 2019 Return-Path: Delivered-To: svn-src-all@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 F2C2414AB2A; Sat, 19 Oct 2019 02:47:32 +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 46w6kr6BV0z4Xck; Sat, 19 Oct 2019 02:47: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 B73341BD75; Sat, 19 Oct 2019 02:47: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 x9J2lWwu098318; Sat, 19 Oct 2019 02:47:32 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9J2lWQq098317; Sat, 19 Oct 2019 02:47:32 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201910190247.x9J2lWQq098317@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 19 Oct 2019 02:47:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353746 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 353746 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 02:47:33 -0000 Author: jhibbits Date: Sat Oct 19 02:47:32 2019 New Revision: 353746 URL: https://svnweb.freebsd.org/changeset/base/353746 Log: powerpc/aim: Fix comment typo Modified: head/sys/powerpc/aim/trap_subr64.S Modified: head/sys/powerpc/aim/trap_subr64.S ============================================================================== --- head/sys/powerpc/aim/trap_subr64.S Sat Oct 19 01:07:35 2019 (r353745) +++ head/sys/powerpc/aim/trap_subr64.S Sat Oct 19 02:47:32 2019 (r353746) @@ -452,7 +452,7 @@ CNAME(trapcode): blrl /* Branch to generictrap */ CNAME(trapcodeend): -/* Same thing for traps setting HSRR0/HSS1 */ +/* Same thing for traps setting HSRR0/HSRR1 */ .globl CNAME(hypertrapcode),CNAME(hypertrapcodeend) .p2align 3 CNAME(hypertrapcode): From owner-svn-src-all@freebsd.org Sat Oct 19 07:10:15 2019 Return-Path: Delivered-To: svn-src-all@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 C45D415B814; Sat, 19 Oct 2019 07:10:15 +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 46wDYz4mMdz3NPv; Sat, 19 Oct 2019 07:10:15 +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 86DA41ED23; Sat, 19 Oct 2019 07:10:15 +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 x9J7AFMs052853; Sat, 19 Oct 2019 07:10:15 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9J7AFnV052852; Sat, 19 Oct 2019 07:10:15 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910190710.x9J7AFnV052852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 19 Oct 2019 07:10:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353747 - head/sys/amd64/vmm X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/amd64/vmm X-SVN-Commit-Revision: 353747 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 07:10:15 -0000 Author: avg Date: Sat Oct 19 07:10:15 2019 New Revision: 353747 URL: https://svnweb.freebsd.org/changeset/base/353747 Log: vmm: remove a wmb() call After removing wmb(), vm_set_rendezvous_func() became super trivial, so there was no point in keeping it. The wmb (sfence on amd64, lock nop on i386) was not needed. This can be explained from several points of view. First, wmb() is used for store-store ordering (although, the primitive is undocumented). There was no obvious subsequent store that needed the barrier. Second, x86 has a memory model with strong ordering including total store order. An explicit store barrier may be needed only when working with special memory (device, special caching mode) or using special instructions (non-temporal stores). That was not the case for this code. Third, I believe that there is a misconception that sfence "flushes" the store buffer in a sense that it speeds up the propagation of stores from the store buffer to the global visibility. I think that such propagation always happens as fast as possible. sfence only makes subsequent stores wait for that propagation to complete. So, sfence is only useful for ordering of stores and only in the situations described above. Reviewed by: jhb MFC after: 23 days Differential Revision: https://reviews.freebsd.org/D21978 Modified: head/sys/amd64/vmm/vmm.c Modified: head/sys/amd64/vmm/vmm.c ============================================================================== --- head/sys/amd64/vmm/vmm.c Sat Oct 19 02:47:32 2019 (r353746) +++ head/sys/amd64/vmm/vmm.c Sat Oct 19 07:10:15 2019 (r353747) @@ -1235,22 +1235,6 @@ vcpu_require_state_locked(struct vm *vm, int vcpuid, e panic("Error %d setting state to %d", error, newstate); } -static void -vm_set_rendezvous_func(struct vm *vm, vm_rendezvous_func_t func) -{ - - KASSERT(mtx_owned(&vm->rendezvous_mtx), ("rendezvous_mtx not locked")); - - /* - * Update 'rendezvous_func' and execute a write memory barrier to - * ensure that it is visible across all host cpus. This is not needed - * for correctness but it does ensure that all the vcpus will notice - * that the rendezvous is requested immediately. - */ - vm->rendezvous_func = func; - wmb(); -} - #define RENDEZVOUS_CTR0(vm, vcpuid, fmt) \ do { \ if (vcpuid >= 0) \ @@ -1281,7 +1265,7 @@ vm_handle_rendezvous(struct vm *vm, int vcpuid) if (CPU_CMP(&vm->rendezvous_req_cpus, &vm->rendezvous_done_cpus) == 0) { VCPU_CTR0(vm, vcpuid, "Rendezvous completed"); - vm_set_rendezvous_func(vm, NULL); + vm->rendezvous_func = NULL; wakeup(&vm->rendezvous_func); break; } @@ -2535,7 +2519,7 @@ restart: vm->rendezvous_req_cpus = dest; CPU_ZERO(&vm->rendezvous_done_cpus); vm->rendezvous_arg = arg; - vm_set_rendezvous_func(vm, func); + vm->rendezvous_func = func; mtx_unlock(&vm->rendezvous_mtx); /* From owner-svn-src-all@freebsd.org Sat Oct 19 07:13:16 2019 Return-Path: Delivered-To: svn-src-all@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 672F215BA60; Sat, 19 Oct 2019 07:13:16 +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 46wDdS1ydvz3NpQ; Sat, 19 Oct 2019 07:13:16 +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 26AC71EF05; Sat, 19 Oct 2019 07:13:16 +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 x9J7DGEg058625; Sat, 19 Oct 2019 07:13:16 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9J7DGUs058624; Sat, 19 Oct 2019 07:13:16 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910190713.x9J7DGUs058624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 19 Oct 2019 07:13:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353748 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 353748 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 07:13:16 -0000 Author: avg Date: Sat Oct 19 07:13:15 2019 New Revision: 353748 URL: https://svnweb.freebsd.org/changeset/base/353748 Log: remove wmb() call from x86 cpu_reset() The rationale is pretty much the same as in r353747. There is no subsequent dependent store. The store is to the regular (TSO) memory anyway. MFC after: 23 days Modified: head/sys/x86/x86/cpu_machdep.c Modified: head/sys/x86/x86/cpu_machdep.c ============================================================================== --- head/sys/x86/x86/cpu_machdep.c Sat Oct 19 07:10:15 2019 (r353747) +++ head/sys/x86/x86/cpu_machdep.c Sat Oct 19 07:13:15 2019 (r353748) @@ -390,7 +390,6 @@ cpu_reset(void) mb = &pcpu_find(0)->pc_monitorbuf; atomic_store_int(&mb->stop_state, MONITOR_STOPSTATE_RUNNING); - wmb(); cnt = 0; while (cpu_reset_proxy_active == 0 && cnt < 10000000) { From owner-svn-src-all@freebsd.org Sat Oct 19 07:16:21 2019 Return-Path: Delivered-To: svn-src-all@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 921A715BB90; Sat, 19 Oct 2019 07:16:21 +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 46wDj13PT2z3P11; Sat, 19 Oct 2019 07:16:21 +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 53E1A1EF0B; Sat, 19 Oct 2019 07:16:21 +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 x9J7GLOC058825; Sat, 19 Oct 2019 07:16:21 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9J7GL03058824; Sat, 19 Oct 2019 07:16:21 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910190716.x9J7GL03058824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 19 Oct 2019 07:16:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353749 - head X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 353749 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 07:16:21 -0000 Author: avg Date: Sat Oct 19 07:16:20 2019 New Revision: 353749 URL: https://svnweb.freebsd.org/changeset/base/353749 Log: buildkernel: always add standard kernel configuration include path This should change nothing for kernel configurations at the standard locations in the source tree. However, if KERNCONFDIR is used to specify a custom location for a kernel configuration file (e.g., out of tree), then both the custom location and the standard location, in this order, will be used as include paths for config(8). This will allow the kernel configuration to include files from both locations. Reviewed by: bdrewery MFC after: 16 days Differential Revision: https://reviews.freebsd.org/D22057 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sat Oct 19 07:13:15 2019 (r353748) +++ head/Makefile.inc1 Sat Oct 19 07:16:20 2019 (r353749) @@ -1653,7 +1653,8 @@ buildkernel: .MAKE .PHONY cd ${KRNLCONFDIR}; \ PATH=${TMPPATH} \ config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ - -I '${KERNCONFDIR}' '${KERNCONFDIR}/${_kernel}' + -I '${KERNCONFDIR}' -I '${KRNLCONFDIR}' \ + '${KERNCONFDIR}/${_kernel}' .endif .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) @echo From owner-svn-src-all@freebsd.org Sat Oct 19 07:17:34 2019 Return-Path: Delivered-To: svn-src-all@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 BA53B15BC7F; Sat, 19 Oct 2019 07:17:34 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46wDkQ3FHlz3P9G; Sat, 19 Oct 2019 07:17:34 +0000 (UTC) (envelope-from ohartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1571469448; bh=mXPn1zYSMJVLcZr7zTLnjya9gqD7WsIsdR99pHC1t5Q=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=Bbp/KNjiV/0h8XfLoIKx8a4iN11cBorwo1ptSZOgs+7U0HGyQOktxneIjh44iHauf 1qQ2VXWMGk2gyOzZ9ZDRTdPpmH0ZasRS0V6euTqcZYHeU6uoR0uV5MABMHPkPNcPIs 5Sg+KreLkg/uHYK5GI9zPQ8z4paj1JgqKBkzKpz0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermann.fritz.box ([91.65.85.161]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MAONd-1iAPwC08CZ-00Bxaw; Sat, 19 Oct 2019 08:53:27 +0200 Date: Sat, 19 Oct 2019 08:53:19 +0200 From: "Hartmann, O." To: Conrad Meyer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353742 - in head/sys: conf net Message-ID: <20191019085319.546aa30e@hermann.fritz.box> In-Reply-To: <201910182203.x9IM3bYD035764@repo.freebsd.org> References: <201910182203.x9IM3bYD035764@repo.freebsd.org> Organization: walstatt.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/_NehmWlmF5s2FvdPEC0EnwT"; protocol="application/pgp-signature" X-Provags-ID: V03:K1:VxChCqp8IhLu7lDF+N/ku6ptdq1nu48YS5CwHDAuJH0Fm5xGs/e Pxoq3SxHPPFnnHjbI1L3BBn6cQW3X2V8xDvr/dRXZkHnCgArc29SyxisLdfqUbpU1WFX7/t ju2wHSd/tuLrWUGyr7Wpg2+of+MU3VNav2AE+e3K+0EjAd6/GIAyaoC175lDt2m8YOSetZb 2NLEiN9lGp2hipdmnMMQA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:Dvwg4MMNIKQ=:AuIbHoXcDyvkxZiGXhdP54 X6/dUUhH3vQRjPDSS1XyIAKxYQ35ou4jZKDMpascIZrMJuXlTqqp92f2wW0jVbIE4bv76vzrH j66j9NKQIwzSG3C2gkA0K1VlPoQ3LkkBitqOL8X3ySlu1iifwlb2P/T4feQaRy+h79yLIJpwn vQDUhS4s2mSb6/SalstzFG1VGmzYzuLdMTP44zUc/SiTW9cCiI6bBlH5ecduraqh2vdRiq1pM 6p0rTevVCM1zVdKNJLqtoXCeTx1eeeZjt50SGMLLUCE3jj8HluSDMWQGwGM6J7FaHR2LVXU32 XmixcR9G62wfc1auLkOJciK9w7gN7TCRBzdQ88xe3tpZemclXhid3L3i3dDs1fAyKGRLk7AHl LbTEsOUQFHnHaN1YIYvXp7JU88qxMH+rSh4fkj+Udq5IzN0Pr0eRZ29SGRAQHhn5C9GejMtXV p6F5crz/rMuB1GhDSKKC0veCnkgt9ahcsmEhGYUr1dcZ2rI5lWBW9Ozzvv/w3NUHbg6TodERU QyA7DQlvpG0dZ330KxrYspAzVTVLUD/J9qeNMupSW6q9SZEi5yZKMkQjZ6KL4ganUkgZwiN1b eoT7MRbGw+kqeFyR1aO8IQch7qWovtVa5JmQ9zU4DEVi+On0ecMilni2X4E5FN670Y9W7SrX2 qO+3vg8KUWEu3J2ebJ+7BfsCUsRiemSMJ8d1m+rc77DSNVaM3uOaMkK5VXFt5iFhhQv0K8sZL LX4wRKfMjpchWLyBEkNxInsr9W/gnU282IMVm/gjsE64MzyY+/TTO125ym30inku1YBXkX8j1 Sqj237UR4X9GKKkpOw8IGCwyennsu/eY/UNgEeym4n6qjR1bn58YMfxe7ijtU+RDdaduR++g1 ieVJAWXb9OItfOkupZNPRcn/vf7gvZVy9tld7H3Q2YA3tr+bDXzJKJMRAWgdn7rzdDg1Wru2/ XLibKUAVhZgDqiwUU5ClAY108ey6ckGngCxKj/4JP7P2sWid0dWHbetmolgSVPinwYuFZzHPx lI+icxq7jYbG7Z+mYWQfkstC32bJxuymM9bf2I5LIX8W6DwTni7qOtBpnuSf1HdZO20Hgv4XF S0OWXxd2RiNnFWMUGMWrGUA61BH/MvCtIRAkdAylEdKOy7RQOMIYF7eQ9CRoBIVjuddgUE7/T ycqr5oNGSDsRdK9X9ZT31OTyX1vH4JcmkHh87htSSiDZuOnW9NDceigAnaxIHiq3I2MgAB+vU vbzBtto803fi46zCdZVGXU/W6SQ3VlmoPnxLst1BIwRVPhRgPOmVymZUle9o= X-Rspamd-Queue-Id: 46wDkQ3FHlz3P9G X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 07:17:34 -0000 --Sig_/_NehmWlmF5s2FvdPEC0EnwT Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Fri, 18 Oct 2019 22:03:37 +0000 (UTC) Conrad Meyer wrote: > Author: cem > Date: Fri Oct 18 22:03:36 2019 > New Revision: 353742 > URL: https://svnweb.freebsd.org/changeset/base/353742 >=20 > Log: > Fix debugnet(4) link/build fallout on some configurations > =20 > Introduced in r353685 (sys/conf/files), r353694 (debugnet.c > db_printf).=20 > Submitted by: kevans > Reported by: cy > X-MFC-With: r353685, r353694 >=20 > Modified: > head/sys/conf/files > head/sys/net/debugnet.c >=20 > Modified: head/sys/conf/files > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/conf/files Fri Oct 18 21:53:27 2019 > (r353741) +++ head/sys/conf/files Fri Oct 18 22:03:36 > 2019 (r353742) @@ -4298,7 +4298,7 @@ > netinet/libalias/alias_mod.c optional libalias | netgr > netinet/libalias/alias_proxy.c optional libalias inet | > netgraph_nat inet netinet/libalias/alias_util.c optional > libalias inet | netgraph_nat inet > netinet/libalias/alias_sctp.c optional libalias inet | > netgraph_nat inet -netinet/netdump/netdump_client.c optional inet > netdump +netinet/netdump/netdump_client.c optional inet debugnet > netdump netinet6/dest6.c optional inet6 > netinet6/frag6.c optional inet6 > netinet6/icmp6.c optional inet6 >=20 > Modified: head/sys/net/debugnet.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/net/debugnet.c Fri Oct 18 21:53:27 2019 > (r353741) +++ head/sys/net/debugnet.c Fri Oct 18 22:03:36 > 2019 (r353742) @@ -659,7 +659,7 @@ debugnet_connect(const > struct debugnet_conn_params *dc CURVNET_RESTORE(); > =20 > if (dest_rt =3D=3D NULL) { > - db_printf("%s: Could not get route for that > server.\n", > + printf("%s: Could not get route for that > server.\n", __func__); > error =3D ENOENT; > goto cleanup; > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to > "svn-src-head-unsubscribe@freebsd.org" Thank you. oh --Sig_/_NehmWlmF5s2FvdPEC0EnwT Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQSy8IBxAPDkqVBaTJ44N1ZZPba5RwUCXaqy3wAKCRA4N1ZZPba5 R+OpAQCKtGB2fD7L7H6O2u7KZS3fJgOVeCs5jCs+JiUI4pWHTQEAr8SRkDRJfPmu cSjwucDeFQy2QqHt8UQdIwzEAiOneQU= =xa73 -----END PGP SIGNATURE----- --Sig_/_NehmWlmF5s2FvdPEC0EnwT-- From owner-svn-src-all@freebsd.org Sat Oct 19 07:37:19 2019 Return-Path: Delivered-To: svn-src-all@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 1C7DB15C27D; Sat, 19 Oct 2019 07:37:19 +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 46wF9B6vKNz3Q5m; Sat, 19 Oct 2019 07:37:18 +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 CBE021F288; Sat, 19 Oct 2019 07:37:18 +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 x9J7bIVO070652; Sat, 19 Oct 2019 07:37:18 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9J7bIqO070651; Sat, 19 Oct 2019 07:37:18 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910190737.x9J7bIqO070651@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 19 Oct 2019 07:37:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353750 - stable/12/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/cddl/contrib/opensolaris/cmd/zfs X-SVN-Commit-Revision: 353750 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 07:37:19 -0000 Author: avg Date: Sat Oct 19 07:37:18 2019 New Revision: 353750 URL: https://svnweb.freebsd.org/changeset/base/353750 Log: MFC r353649: fix section number in zfs-program.8 Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Sat Oct 19 07:16:20 2019 (r353749) +++ stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Sat Oct 19 07:37:18 2019 (r353750) @@ -12,7 +12,7 @@ .\" Copyright (c) 2018 Datto Inc. .\" .Dd October 02, 2017 -.Dt ZFS-PROGRAM 1M +.Dt ZFS-PROGRAM 8 .Os .Sh NAME .Nm zfs program From owner-svn-src-all@freebsd.org Sat Oct 19 07:38:02 2019 Return-Path: Delivered-To: svn-src-all@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 B7FBA15C2ED; Sat, 19 Oct 2019 07:38:02 +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 46wFB24SkCz3QCp; Sat, 19 Oct 2019 07:38:02 +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 7D75B1F289; Sat, 19 Oct 2019 07:38:02 +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 x9J7c2PM070751; Sat, 19 Oct 2019 07:38:02 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9J7c2kc070750; Sat, 19 Oct 2019 07:38:02 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910190738.x9J7c2kc070750@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 19 Oct 2019 07:38:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353751 - stable/11/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/zfs X-SVN-Commit-Revision: 353751 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 07:38:02 -0000 Author: avg Date: Sat Oct 19 07:38:02 2019 New Revision: 353751 URL: https://svnweb.freebsd.org/changeset/base/353751 Log: MFC r353649: fix section number in zfs-program.8 Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Sat Oct 19 07:37:18 2019 (r353750) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Sat Oct 19 07:38:02 2019 (r353751) @@ -11,7 +11,7 @@ .\" Copyright (c) 2016, 2017 by Delphix. All rights reserved. .\" .Dd October 02, 2017 -.Dt ZFS-PROGRAM 1M +.Dt ZFS-PROGRAM 8 .Os .Sh NAME .Nm zfs program From owner-svn-src-all@freebsd.org Sat Oct 19 07:41:23 2019 Return-Path: Delivered-To: svn-src-all@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 6332A15C39D; Sat, 19 Oct 2019 07:41:23 +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 46wFFv20Pnz3QNj; Sat, 19 Oct 2019 07:41:23 +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 28DB31F2E4; Sat, 19 Oct 2019 07:41:23 +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 x9J7fNjn074165; Sat, 19 Oct 2019 07:41:23 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9J7fNFj074164; Sat, 19 Oct 2019 07:41:23 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910190741.x9J7fNFj074164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 19 Oct 2019 07:41:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353752 - stable/12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/share/man/man4 X-SVN-Commit-Revision: 353752 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 07:41:23 -0000 Author: avg Date: Sat Oct 19 07:41:22 2019 New Revision: 353752 URL: https://svnweb.freebsd.org/changeset/base/353752 Log: MFC r353434: man4/Makefile: fix sorting for some entries starting with 'v' Modified: stable/12/share/man/man4/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/Makefile ============================================================================== --- stable/12/share/man/man4/Makefile Sat Oct 19 07:38:02 2019 (r353751) +++ stable/12/share/man/man4/Makefile Sat Oct 19 07:41:22 2019 (r353752) @@ -826,6 +826,13 @@ _nfsmb.4= nfsmb.4 _nvd.4= nvd.4 _nvme.4= nvme.4 _nvram.4= nvram.4 +_padlock.4= padlock.4 +_rr232x.4= rr232x.4 +_speaker.4= speaker.4 +_spkr.4= spkr.4 +_tpm.4= tpm.4 +_urtw.4= urtw.4 +_viawd.4= viawd.4 _virtio.4= virtio.4 _virtio_balloon.4=virtio_balloon.4 _virtio_blk.4= virtio_blk.4 @@ -834,13 +841,6 @@ _virtio_random.4= virtio_random.4 _virtio_scsi.4= virtio_scsi.4 _vmx.4= vmx.4 _vtnet.4= vtnet.4 -_padlock.4= padlock.4 -_rr232x.4= rr232x.4 -_speaker.4= speaker.4 -_spkr.4= spkr.4 -_tpm.4= tpm.4 -_urtw.4= urtw.4 -_viawd.4= viawd.4 _wbwd.4= wbwd.4 _wpi.4= wpi.4 _xen.4= xen.4 From owner-svn-src-all@freebsd.org Sat Oct 19 07:45:11 2019 Return-Path: Delivered-To: svn-src-all@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 D005C15C5FB; Sat, 19 Oct 2019 07:45:11 +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 46wFLH59Mbz3Qml; Sat, 19 Oct 2019 07:45:11 +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 961AB1F448; Sat, 19 Oct 2019 07:45:11 +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 x9J7jBo7076861; Sat, 19 Oct 2019 07:45:11 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9J7jBY2076860; Sat, 19 Oct 2019 07:45:11 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910190745.x9J7jBY2076860@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 19 Oct 2019 07:45:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353753 - stable/11/share/man/man4 X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/share/man/man4 X-SVN-Commit-Revision: 353753 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 07:45:11 -0000 Author: avg Date: Sat Oct 19 07:45:11 2019 New Revision: 353753 URL: https://svnweb.freebsd.org/changeset/base/353753 Log: MFC r353434: man4/Makefile: fix sorting for some entries starting with 'v' Modified: stable/11/share/man/man4/Makefile Modified: stable/11/share/man/man4/Makefile ============================================================================== --- stable/11/share/man/man4/Makefile Sat Oct 19 07:41:22 2019 (r353752) +++ stable/11/share/man/man4/Makefile Sat Oct 19 07:45:11 2019 (r353753) @@ -845,6 +845,13 @@ _nvd.4= nvd.4 _nvme.4= nvme.4 _nvram.4= nvram.4 _nxge.4= nxge.4 +_padlock.4= padlock.4 +_rr232x.4= rr232x.4 +_speaker.4= speaker.4 +_spkr.4= spkr.4 +_tpm.4= tpm.4 +_urtw.4= urtw.4 +_viawd.4= viawd.4 _virtio.4= virtio.4 _virtio_balloon.4=virtio_balloon.4 _virtio_blk.4= virtio_blk.4 @@ -854,13 +861,6 @@ _virtio_scsi.4= virtio_scsi.4 _vmx.4= vmx.4 _vtnet.4= vtnet.4 _vxge.4= vxge.4 -_padlock.4= padlock.4 -_rr232x.4= rr232x.4 -_speaker.4= speaker.4 -_spkr.4= spkr.4 -_tpm.4= tpm.4 -_urtw.4= urtw.4 -_viawd.4= viawd.4 _wbwd.4= wbwd.4 _wpi.4= wpi.4 _xen.4= xen.4 From owner-svn-src-all@freebsd.org Sat Oct 19 07:47:29 2019 Return-Path: Delivered-To: svn-src-all@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 4C12D15C6E4; Sat, 19 Oct 2019 07:47:29 +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 46wFNx1KzGz3R0Z; Sat, 19 Oct 2019 07:47:29 +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 111AA1F44A; Sat, 19 Oct 2019 07:47:29 +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 x9J7lS7e077166; Sat, 19 Oct 2019 07:47:28 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9J7lSB8077165; Sat, 19 Oct 2019 07:47:28 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910190747.x9J7lSB8077165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 19 Oct 2019 07:47:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353754 - stable/12/cddl/contrib/opensolaris/cmd/zpool X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/cddl/contrib/opensolaris/cmd/zpool X-SVN-Commit-Revision: 353754 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 07:47:29 -0000 Author: avg Date: Sat Oct 19 07:47:28 2019 New Revision: 353754 URL: https://svnweb.freebsd.org/changeset/base/353754 Log: MFC r353341,r353342: zfs: document large_dnode feature Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Sat Oct 19 07:45:11 2019 (r353753) +++ stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Sat Oct 19 07:47:28 2019 (r353754) @@ -527,6 +527,30 @@ Please note that booting from datasets that have recor supported by the .Fx boot loader. +.It Sy large_dnode +.Bl -column "READ\-ONLY COMPATIBLE" "org.zfsonlinux:large_dnode" +.It GUID Ta org.zfsonlinux:large_dnode +.It READ\-ONLY COMPATIBLE Ta no +.It DEPENDENCIES Ta extensible_dataset +.El +.Pp +The +.Sy large_dnode +feature allows the size of dnodes in a dataset to be set larger than 512B. +.Pp +This feature becomes +.Sy active +once a dataset contains an object with a dnode larger than 512B, +which occurs as a result of setting the +.Sy dnodesize +dataset property to a value other than +.Sy legacy . +The feature will return to being +.Sy enabled +once all filesystems that have ever contained a dnode larger than 512B are +destroyed. +Large dnodes allow more data to be stored in the bonus buffer, thus potentially +improving performance by avoiding the use of spill blocks. .It Sy sha512 .Bl -column "READ\-ONLY COMPATIBLE" "org.illumos:sha512" .It GUID Ta org.illumos:sha512 From owner-svn-src-all@freebsd.org Sat Oct 19 07:51:50 2019 Return-Path: Delivered-To: svn-src-all@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 1578915C847; Sat, 19 Oct 2019 07:51:50 +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 46wFTx6sjVz3RHd; Sat, 19 Oct 2019 07:51:49 +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 D064A1F5E3; Sat, 19 Oct 2019 07:51:49 +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 x9J7pntT079750; Sat, 19 Oct 2019 07:51:49 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9J7pnAi079749; Sat, 19 Oct 2019 07:51:49 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910190751.x9J7pnAi079749@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 19 Oct 2019 07:51:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353755 - stable/12/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 353755 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 07:51:50 -0000 Author: avg Date: Sat Oct 19 07:51:49 2019 New Revision: 353755 URL: https://svnweb.freebsd.org/changeset/base/353755 Log: MFC r353343: zfs: remove gratuitous divergence from other openzfs flavours Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Oct 19 07:47:28 2019 (r353754) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Oct 19 07:51:49 2019 (r353755) @@ -1206,7 +1206,6 @@ dump_snapshot(zfs_handle_t *zhp, void *arg) boolean_t isfromsnap, istosnap, fromorigin; boolean_t exclude = B_FALSE; FILE *fout = sdd->std_out ? stdout : stderr; - uint64_t size = 0; err = 0; thissnap = strchr(zhp->zfs_name, '@') + 1; @@ -1282,6 +1281,7 @@ dump_snapshot(zfs_handle_t *zhp, void *arg) (sdd->fromorigin || sdd->replicate); if (sdd->verbose || sdd->progress) { + uint64_t size = 0; char fromds[ZFS_MAX_DATASET_NAME_LEN]; if (sdd->prevsnap[0] != '\0') { From owner-svn-src-all@freebsd.org Sat Oct 19 07:53:21 2019 Return-Path: Delivered-To: svn-src-all@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 73AED15CA0D; Sat, 19 Oct 2019 07:53:21 +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 46wFWj2VJFz3wlM; Sat, 19 Oct 2019 07:53:21 +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 3A39C1F61E; Sat, 19 Oct 2019 07:53:21 +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 x9J7rLDN083030; Sat, 19 Oct 2019 07:53:21 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9J7rLJQ083029; Sat, 19 Oct 2019 07:53:21 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910190753.x9J7rLJQ083029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 19 Oct 2019 07:53:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353756 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 353756 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 07:53:21 -0000 Author: avg Date: Sat Oct 19 07:53:20 2019 New Revision: 353756 URL: https://svnweb.freebsd.org/changeset/base/353756 Log: MFC r353343: zfs: remove gratuitous divergence from other openzfs flavours Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Oct 19 07:51:49 2019 (r353755) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Oct 19 07:53:20 2019 (r353756) @@ -1206,7 +1206,6 @@ dump_snapshot(zfs_handle_t *zhp, void *arg) boolean_t isfromsnap, istosnap, fromorigin; boolean_t exclude = B_FALSE; FILE *fout = sdd->std_out ? stdout : stderr; - uint64_t size = 0; err = 0; thissnap = strchr(zhp->zfs_name, '@') + 1; @@ -1282,6 +1281,7 @@ dump_snapshot(zfs_handle_t *zhp, void *arg) (sdd->fromorigin || sdd->replicate); if (sdd->verbose || sdd->progress) { + uint64_t size = 0; char fromds[ZFS_MAX_DATASET_NAME_LEN]; if (sdd->prevsnap[0] != '\0') { From owner-svn-src-all@freebsd.org Sat Oct 19 08:08:07 2019 Return-Path: Delivered-To: svn-src-all@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 4B16415D0AA; Sat, 19 Oct 2019 08:08:07 +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 46wFrl1FvJz3xK1; Sat, 19 Oct 2019 08:08:07 +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 0B1D81F7FD; Sat, 19 Oct 2019 08:08:07 +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 x9J8863C089304; Sat, 19 Oct 2019 08:08:06 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9J886Jk089303; Sat, 19 Oct 2019 08:08:06 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201910190808.x9J886Jk089303@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sat, 19 Oct 2019 08:08:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353757 - 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: 353757 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 08:08:07 -0000 Author: tsoome Date: Sat Oct 19 08:08:06 2019 New Revision: 353757 URL: https://svnweb.freebsd.org/changeset/base/353757 Log: loader: zfs_fmtdev can crash when pool discovery did fail and we have no spa When zfs probe did fail and no spa was created, but zfs_fmtdev() is called, we will crash while dereferencing spa (NULL pointer dereference). MFC after: 1 week Modified: head/stand/libsa/zfs/zfs.c Modified: head/stand/libsa/zfs/zfs.c ============================================================================== --- head/stand/libsa/zfs/zfs.c Sat Oct 19 07:53:20 2019 (r353756) +++ head/stand/libsa/zfs/zfs.c Sat Oct 19 08:08:06 2019 (r353757) @@ -769,11 +769,16 @@ zfs_fmtdev(void *vdev) if (dev->dd.d_dev->dv_type != DEVT_ZFS) return (buf); - if (dev->pool_guid == 0) { - spa = STAILQ_FIRST(&zfs_pools); + /* Do we have any pools? */ + spa = STAILQ_FIRST(&zfs_pools); + if (spa == NULL) + return (buf); + + if (dev->pool_guid == 0) dev->pool_guid = spa->spa_guid; - } else + else spa = spa_find_by_guid(dev->pool_guid); + if (spa == NULL) { printf("ZFS: can't find pool by guid\n"); return (buf); From owner-svn-src-all@freebsd.org Sat Oct 19 08:19:32 2019 Return-Path: Delivered-To: svn-src-all@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 C5AD215D3CA; Sat, 19 Oct 2019 08:19:32 +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 46wG5w5Lflz3xsp; Sat, 19 Oct 2019 08:19:32 +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 9AB9D1F9BB; Sat, 19 Oct 2019 08:19:32 +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 x9J8JW5S095631; Sat, 19 Oct 2019 08:19:32 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9J8JVah095625; Sat, 19 Oct 2019 08:19:31 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910190819.x9J8JVah095625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 19 Oct 2019 08:19:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353758 - in stable/12: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/commo... X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 353758 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 08:19:32 -0000 Author: avg Date: Sat Oct 19 08:19:31 2019 New Revision: 353758 URL: https://svnweb.freebsd.org/changeset/base/353758 Log: MFC r353037: ZFS: add bookmark renaming Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_bookmark.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sat Oct 19 08:08:06 2019 (r353757) +++ stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sat Oct 19 08:19:31 2019 (r353758) @@ -105,6 +105,9 @@ .Ar snapshot snapshot .Nm .Cm rename +.Ar bookmark bookmark +.Nm +.Cm rename .Fl u .Op Fl p .Ar filesystem filesystem @@ -2090,6 +2093,16 @@ flag. .Pp Recursively rename the snapshots of all descendent datasets. Snapshots are the only dataset that can be renamed recursively. +.It Xo +.Nm +.Cm rename +.Ar bookmark bookmark +.Xc +.Pp +Renames the given bookmark. +Bookmarks can only be renamed within the parent file system or volume. +When renaming a bookmark, the parent file system or volume of the bookmark +does not need to be specified as part of the second argument. .It Xo .Nm .Cm list Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sat Oct 19 08:08:06 2019 (r353757) +++ stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sat Oct 19 08:19:31 2019 (r353758) @@ -284,6 +284,7 @@ get_usage(zfs_help_t idx) "\n" "\trename [-f] -p \n" "\trename -r \n" + "\trename \n" "\trename -u [-p] ")); case HELP_ROLLBACK: return (gettext("\trollback [-rRf] \n")); @@ -3254,6 +3255,7 @@ zfs_do_list(int argc, char **argv) * zfs rename [-f] * zfs rename [-f] -p * zfs rename -r + * zfs rename * zfs rename -u [-p] * * Renames the given dataset to another of the same type. @@ -3270,6 +3272,7 @@ zfs_do_rename(int argc, char **argv) int ret = 0; int types; boolean_t parents = B_FALSE; + boolean_t bookmarks = B_FALSE; char *snapshot = NULL; /* check options */ @@ -3320,7 +3323,7 @@ zfs_do_rename(int argc, char **argv) usage(B_FALSE); } - if (flags.recurse && strchr(argv[0], '@') == 0) { + if (flags.recurse && strchr(argv[0], '@') == NULL) { (void) fprintf(stderr, gettext("source dataset for recursive " "rename must be a snapshot\n")); usage(B_FALSE); @@ -3332,10 +3335,22 @@ zfs_do_rename(int argc, char **argv) usage(B_FALSE); } + if (strchr(argv[0], '#') != NULL) + bookmarks = B_TRUE; + + if (bookmarks && (flags.nounmount || flags.recurse || + flags.forceunmount || parents)) { + (void) fprintf(stderr, gettext("options are not supported " + "for renaming bookmarks\n")); + usage(B_FALSE); + } + if (flags.nounmount) types = ZFS_TYPE_FILESYSTEM; else if (parents) types = ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME; + else if (bookmarks) + types = ZFS_TYPE_BOOKMARK; else types = ZFS_TYPE_DATASET; Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sat Oct 19 08:08:06 2019 (r353757) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sat Oct 19 08:19:31 2019 (r353758) @@ -4291,17 +4291,18 @@ zfs_rename(zfs_handle_t *zhp, const char *source, cons /* * Make sure the target name is valid */ - if (zhp->zfs_type == ZFS_TYPE_SNAPSHOT) { - if ((strchr(target, '@') == NULL) || - *target == '@') { + if (zhp->zfs_type == ZFS_TYPE_SNAPSHOT || + zhp->zfs_type == ZFS_TYPE_BOOKMARK) { + const char sep = zhp->zfs_type == ZFS_TYPE_SNAPSHOT ? '@' : '#'; + + if ((strchr(target, sep) == NULL) || *target == sep) { /* * Snapshot target name is abbreviated, * reconstruct full dataset name */ - (void) strlcpy(parent, zhp->zfs_name, - sizeof (parent)); - delim = strchr(parent, '@'); - if (strchr(target, '@') == NULL) + (void) strlcpy(parent, zhp->zfs_name, sizeof (parent)); + delim = strchr(parent, sep); + if (strchr(target, sep) == NULL) *(++delim) = '\0'; else *delim = '\0'; @@ -4311,12 +4312,13 @@ zfs_rename(zfs_handle_t *zhp, const char *source, cons /* * Make sure we're renaming within the same dataset. */ - delim = strchr(target, '@'); + delim = strchr(target, sep); if (strncmp(zhp->zfs_name, target, delim - target) - != 0 || zhp->zfs_name[delim - target] != '@') { + != 0 || zhp->zfs_name[delim - target] != sep) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, - "snapshots must be part of same " - "dataset")); + "%s must be part of same dataset"), + zhp->zfs_type == ZFS_TYPE_SNAPSHOT ? + "snapshots" : "bookmarks"); return (zfs_error(hdl, EZFS_CROSSTARGET, errbuf)); } @@ -4379,7 +4381,6 @@ zfs_rename(zfs_handle_t *zhp, const char *source, cons flags.nounmount = B_TRUE; } if (flags.recurse) { - parentname = zfs_strdup(zhp->zfs_hdl, zhp->zfs_name); if (parentname == NULL) { ret = -1; @@ -4392,7 +4393,8 @@ zfs_rename(zfs_handle_t *zhp, const char *source, cons ret = -1; goto error; } - } else if (zhp->zfs_type != ZFS_TYPE_SNAPSHOT) { + } else if (zhp->zfs_type != ZFS_TYPE_SNAPSHOT && + zhp->zfs_type != ZFS_TYPE_BOOKMARK) { if ((cl = changelist_gather(zhp, ZFS_PROP_NAME, flags.nounmount ? CL_GATHER_DONT_UNMOUNT : 0, flags.forceunmount ? MS_FORCE : 0)) == NULL) { @@ -4437,6 +4439,8 @@ zfs_rename(zfs_handle_t *zhp, const char *source, cons "a child dataset already has a snapshot " "with the new name")); (void) zfs_error(hdl, EZFS_EXISTS, errbuf); + } else if (errno == EINVAL) { + (void) zfs_error(hdl, EZFS_INVALIDNAME, errbuf); } else { (void) zfs_standard_error(zhp->zfs_hdl, errno, errbuf); } Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c Sat Oct 19 08:08:06 2019 (r353757) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c Sat Oct 19 08:19:31 2019 (r353758) @@ -459,3 +459,108 @@ dsl_bookmark_destroy(nvlist_t *bmarks, nvlist_t *error fnvlist_free(dbda.dbda_success); return (rv); } + +typedef struct dsl_bookmark_rename_arg { + const char *dbra_fsname; + const char *dbra_oldname; + const char *dbra_newname; +} dsl_bookmark_rename_arg_t; + +static int +dsl_bookmark_rename_check(void *arg, dmu_tx_t *tx) +{ + dsl_bookmark_rename_arg_t *dbra = arg; + dsl_pool_t *dp = dmu_tx_pool(tx); + dsl_dataset_t *ds; + zfs_bookmark_phys_t bmark_phys; + int error; + + if (!spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_BOOKMARKS)) + return (SET_ERROR(ENOTSUP)); + + /* Check validity and the full length of the new bookmark name. */ + if (zfs_component_namecheck(dbra->dbra_newname, NULL, NULL)) + return (SET_ERROR(EINVAL)); + if (strlen(dbra->dbra_fsname) + strlen(dbra->dbra_newname) + 1 >= + ZFS_MAX_DATASET_NAME_LEN) + return (SET_ERROR(ENAMETOOLONG)); + + error = dsl_dataset_hold(dp, dbra->dbra_fsname, FTAG, &ds); + if (error != 0) + return (error); + if (ds->ds_is_snapshot) { + dsl_dataset_rele(ds, FTAG); + return (SET_ERROR(EINVAL)); + } + error = dsl_dataset_bmark_lookup(ds, dbra->dbra_oldname, &bmark_phys); + if (error != 0) { + dsl_dataset_rele(ds, FTAG); + return (error); + } + + error = dsl_dataset_bmark_lookup(ds, dbra->dbra_newname, &bmark_phys); + dsl_dataset_rele(ds, FTAG); + if (error == 0) + return (SET_ERROR(EEXIST)); + if (error != ESRCH) + return (error); + return (0); +} + +static void +dsl_bookmark_rename_sync(void *arg, dmu_tx_t *tx) +{ + zfs_bookmark_phys_t bmark_phys; + dsl_bookmark_rename_arg_t *dbra = arg; + dsl_pool_t *dp = dmu_tx_pool(tx); + objset_t *mos; + dsl_dataset_t *ds; + uint64_t bmark_zapobj; + uint64_t int_size, num_ints; + matchtype_t mt = 0; + int error; + + ASSERT(spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_BOOKMARKS)); + VERIFY0(dsl_dataset_hold(dp, dbra->dbra_fsname, FTAG, &ds)); + + mos = ds->ds_dir->dd_pool->dp_meta_objset; + bmark_zapobj = ds->ds_bookmarks; + + if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET) + mt = MT_NORMALIZE; + + VERIFY0(zap_length(mos, bmark_zapobj, dbra->dbra_oldname, + &int_size, &num_ints)); + ASSERT3U(int_size, ==, sizeof (uint64_t)); + VERIFY0(zap_lookup_norm(mos, bmark_zapobj, dbra->dbra_oldname, int_size, + num_ints, &bmark_phys, mt, NULL, 0, NULL)); + VERIFY0(zap_remove_norm(mos, bmark_zapobj, dbra->dbra_oldname, mt, tx)); + + VERIFY0(zap_add(mos, bmark_zapobj, dbra->dbra_newname, int_size, + num_ints, &bmark_phys, tx)); + + spa_history_log_internal_ds(ds, "rename bookmark", tx, + "#%s -> #%s creation_txg=%llu", + dbra->dbra_oldname, dbra->dbra_newname, + (longlong_t)bmark_phys.zbm_creation_txg); + + dsl_dataset_rele(ds, FTAG); +} + +/* + * The bookmarks must all be in the same pool. + */ +int +dsl_bookmark_rename(const char *fsname, const char *oldbmark, + const char *newbmark) +{ + dsl_bookmark_rename_arg_t dbra; + + dbra.dbra_fsname = fsname; + dbra.dbra_oldname = oldbmark; + dbra.dbra_newname = newbmark; + + return (dsl_sync_task(fsname, dsl_bookmark_rename_check, + dsl_bookmark_rename_sync, &dbra, 1, ZFS_SPACE_CHECK_NORMAL)); +} + Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_bookmark.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_bookmark.h Sat Oct 19 08:08:06 2019 (r353757) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_bookmark.h Sat Oct 19 08:19:31 2019 (r353758) @@ -41,6 +41,7 @@ int dsl_bookmark_create(nvlist_t *, nvlist_t *); int dsl_get_bookmarks(const char *, nvlist_t *, nvlist_t *); int dsl_get_bookmarks_impl(dsl_dataset_t *, nvlist_t *, nvlist_t *); int dsl_bookmark_destroy(nvlist_t *, nvlist_t *); +int dsl_bookmark_rename(const char *fs, const char *from, const char *to); int dsl_bookmark_lookup(struct dsl_pool *, const char *, struct dsl_dataset *, zfs_bookmark_phys_t *); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Oct 19 08:08:06 2019 (r353757) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Oct 19 08:19:31 2019 (r353758) @@ -224,7 +224,8 @@ typedef int zfs_secpolicy_func_t(zfs_cmd_t *, nvlist_t typedef enum { NO_NAME, POOL_NAME, - DATASET_NAME + DATASET_NAME, + ENTITY_NAME } zfs_ioc_namecheck_t; typedef enum { @@ -922,8 +923,21 @@ static int zfs_secpolicy_rename(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr) { char *at = NULL; + char *pound; int error; + if ((pound = strchr(zc->zc_name, '#')) != NULL) { + *pound = '\0'; + error = zfs_secpolicy_write_perms(zc->zc_name, + ZFS_DELEG_PERM_RENAME, cr); + if (error == 0) { + error = zfs_secpolicy_write_perms(zc->zc_name, + ZFS_DELEG_PERM_BOOKMARK, cr); + } + *pound = '#'; + return (error); + } + if ((zc->zc_cookie & 1) != 0) { /* * This is recursive rename, so the starting snapshot might @@ -4020,8 +4034,8 @@ recursive_unmount(const char *fsname, void *arg) /* * inputs: - * zc_name old name of dataset - * zc_value new name of dataset + * zc_name old name of dataset or bookmark + * zc_value new name of dataset or bookmark * zc_cookie recursive flag (only valid for snapshots) * * outputs: none @@ -4032,7 +4046,7 @@ zfs_ioc_rename(zfs_cmd_t *zc) objset_t *os; dmu_objset_type_t ost; boolean_t recursive = zc->zc_cookie & 1; - char *at; + char *pos, *pos2; boolean_t allow_mounted = B_TRUE; int err; @@ -4040,9 +4054,34 @@ zfs_ioc_rename(zfs_cmd_t *zc) allow_mounted = (zc->zc_cookie & 2) != 0; #endif - /* "zfs rename" from and to ...%recv datasets should both fail */ zc->zc_name[sizeof (zc->zc_name) - 1] = '\0'; zc->zc_value[sizeof (zc->zc_value) - 1] = '\0'; + + pos = strchr(zc->zc_name, '#'); + if (pos != NULL) { + /* Bookmarks must be in same fs. */ + pos2 = strchr(zc->zc_value, '#'); + if (pos2 == NULL) + return (SET_ERROR(EINVAL)); + + /* Recursive flag is not supported yet. */ + if (recursive) + return (SET_ERROR(ENOTSUP)); + + *pos = '\0'; + *pos2 = '\0'; + if (strcmp(zc->zc_name, zc->zc_value) == 0) { + err = dsl_bookmark_rename(zc->zc_name, + pos + 1, pos2 + 1); + } else { + err = SET_ERROR(EXDEV); + } + *pos = '#'; + *pos2 = '#'; + return (err); + } + + /* "zfs rename" from and to ...%recv datasets should both fail */ if (dataset_namecheck(zc->zc_name, NULL, NULL) != 0 || dataset_namecheck(zc->zc_value, NULL, NULL) != 0 || strchr(zc->zc_name, '%') || strchr(zc->zc_value, '%')) @@ -4054,28 +4093,30 @@ zfs_ioc_rename(zfs_cmd_t *zc) ost = dmu_objset_type(os); dmu_objset_rele(os, FTAG); - at = strchr(zc->zc_name, '@'); - if (at != NULL) { - /* snaps must be in same fs */ - int error; - - if (strncmp(zc->zc_name, zc->zc_value, at - zc->zc_name + 1)) - return (SET_ERROR(EXDEV)); - *at = '\0'; - if (ost == DMU_OST_ZFS && !allow_mounted) { - error = dmu_objset_find(zc->zc_name, - recursive_unmount, at + 1, - recursive ? DS_FIND_CHILDREN : 0); - if (error != 0) { - *at = '@'; - return (error); + pos = strchr(zc->zc_name, '@'); + if (pos != NULL) { + /* Snapshots must be in same fs. */ + pos2 = strchr(zc->zc_value, '@'); + if (pos2 == NULL) + return (SET_ERROR(EINVAL)); + *pos = '\0'; + *pos2 = '\0'; + if (strcmp(zc->zc_name, zc->zc_value) != 0) { + err = SET_ERROR(EXDEV); + } else { + if (ost == DMU_OST_ZFS && !allow_mounted) { + err = dmu_objset_find(zc->zc_name, + recursive_unmount, pos + 1, + recursive ? DS_FIND_CHILDREN : 0); } + if (err == 0) { + err = dsl_dataset_rename_snapshot(zc->zc_name, + pos + 1, pos2 + 1, recursive); + } } - error = dsl_dataset_rename_snapshot(zc->zc_name, - at + 1, strchr(zc->zc_value, '@') + 1, recursive); - *at = '@'; - - return (error); + *pos = '@'; + *pos2 = '@'; + return (err); } else { #ifdef illumos if (ost == DMU_OST_ZVOL) @@ -6352,8 +6393,6 @@ zfs_ioctl_init(void) zfs_secpolicy_none); zfs_ioctl_register_dataset_modify(ZFS_IOC_DESTROY, zfs_ioc_destroy, zfs_secpolicy_destroy); - zfs_ioctl_register_dataset_modify(ZFS_IOC_RENAME, zfs_ioc_rename, - zfs_secpolicy_rename); zfs_ioctl_register_dataset_modify(ZFS_IOC_RECV, zfs_ioc_recv, zfs_secpolicy_recv); zfs_ioctl_register_dataset_modify(ZFS_IOC_PROMOTE, zfs_ioc_promote, @@ -6363,6 +6402,14 @@ zfs_ioctl_init(void) zfs_ioctl_register_dataset_modify(ZFS_IOC_SET_FSACL, zfs_ioc_set_fsacl, zfs_secpolicy_set_fsacl); + /* + * Not using zfs_ioctl_register_dataset_modify as DATASET_NAME check + * won't allow a bookmark name. + */ + zfs_ioctl_register_legacy(ZFS_IOC_RENAME, zfs_ioc_rename, + zfs_secpolicy_rename, ENTITY_NAME, B_TRUE, + POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY); + zfs_ioctl_register_dataset_nolog(ZFS_IOC_SHARE, zfs_ioc_share, zfs_secpolicy_share, POOL_CHECK_NONE); zfs_ioctl_register_dataset_nolog(ZFS_IOC_SMB_ACL, zfs_ioc_smb_acl, @@ -6392,7 +6439,8 @@ pool_status_check(const char *name, zfs_ioc_namecheck_ spa_t *spa; int error; - ASSERT(type == POOL_NAME || type == DATASET_NAME); + ASSERT(type == POOL_NAME || type == DATASET_NAME || + type == ENTITY_NAME); if (check & POOL_CHECK_NONE) return (0); @@ -6723,6 +6771,15 @@ zfsdev_ioctl(struct cdev *dev, u_long zcmd, caddr_t ar else error = pool_status_check(zc->zc_name, vec->zvec_namecheck, vec->zvec_pool_check); + break; + + case ENTITY_NAME: + if (entity_namecheck(zc->zc_name, NULL, NULL) != 0) { + error = SET_ERROR(EINVAL); + } else { + error = pool_status_check(zc->zc_name, + vec->zvec_namecheck, vec->zvec_pool_check); + } break; case NO_NAME: From owner-svn-src-all@freebsd.org Sat Oct 19 08:19:50 2019 Return-Path: Delivered-To: svn-src-all@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 C7FC715D42B; Sat, 19 Oct 2019 08:19:50 +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 46wG6G5hMwz3y0l; Sat, 19 Oct 2019 08:19:50 +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 A7B041F9BC; Sat, 19 Oct 2019 08:19:50 +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 x9J8Jos6095698; Sat, 19 Oct 2019 08:19:50 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9J8JnWB095690; Sat, 19 Oct 2019 08:19:49 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910190819.x9J8JnWB095690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 19 Oct 2019 08:19:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353759 - in stable/11: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/commo... X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/11: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 353759 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 08:19:50 -0000 Author: avg Date: Sat Oct 19 08:19:49 2019 New Revision: 353759 URL: https://svnweb.freebsd.org/changeset/base/353759 Log: MFC r353037: ZFS: add bookmark renaming Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_bookmark.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sat Oct 19 08:19:31 2019 (r353758) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sat Oct 19 08:19:49 2019 (r353759) @@ -104,6 +104,9 @@ .Ar snapshot snapshot .Nm .Cm rename +.Ar bookmark bookmark +.Nm +.Cm rename .Fl u .Op Fl p .Ar filesystem filesystem @@ -2086,6 +2089,16 @@ flag. .Pp Recursively rename the snapshots of all descendent datasets. Snapshots are the only dataset that can be renamed recursively. +.It Xo +.Nm +.Cm rename +.Ar bookmark bookmark +.Xc +.Pp +Renames the given bookmark. +Bookmarks can only be renamed within the parent file system or volume. +When renaming a bookmark, the parent file system or volume of the bookmark +does not need to be specified as part of the second argument. .It Xo .Nm .Cm list Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sat Oct 19 08:19:31 2019 (r353758) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sat Oct 19 08:19:49 2019 (r353759) @@ -283,6 +283,7 @@ get_usage(zfs_help_t idx) "\n" "\trename [-f] -p \n" "\trename -r \n" + "\trename \n" "\trename -u [-p] ")); case HELP_ROLLBACK: return (gettext("\trollback [-rRf] \n")); @@ -3253,6 +3254,7 @@ zfs_do_list(int argc, char **argv) * zfs rename [-f] * zfs rename [-f] -p * zfs rename -r + * zfs rename * zfs rename -u [-p] * * Renames the given dataset to another of the same type. @@ -3269,6 +3271,7 @@ zfs_do_rename(int argc, char **argv) int ret = 0; int types; boolean_t parents = B_FALSE; + boolean_t bookmarks = B_FALSE; char *snapshot = NULL; /* check options */ @@ -3319,7 +3322,7 @@ zfs_do_rename(int argc, char **argv) usage(B_FALSE); } - if (flags.recurse && strchr(argv[0], '@') == 0) { + if (flags.recurse && strchr(argv[0], '@') == NULL) { (void) fprintf(stderr, gettext("source dataset for recursive " "rename must be a snapshot\n")); usage(B_FALSE); @@ -3331,10 +3334,22 @@ zfs_do_rename(int argc, char **argv) usage(B_FALSE); } + if (strchr(argv[0], '#') != NULL) + bookmarks = B_TRUE; + + if (bookmarks && (flags.nounmount || flags.recurse || + flags.forceunmount || parents)) { + (void) fprintf(stderr, gettext("options are not supported " + "for renaming bookmarks\n")); + usage(B_FALSE); + } + if (flags.nounmount) types = ZFS_TYPE_FILESYSTEM; else if (parents) types = ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME; + else if (bookmarks) + types = ZFS_TYPE_BOOKMARK; else types = ZFS_TYPE_DATASET; Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sat Oct 19 08:19:31 2019 (r353758) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sat Oct 19 08:19:49 2019 (r353759) @@ -4286,17 +4286,18 @@ zfs_rename(zfs_handle_t *zhp, const char *source, cons /* * Make sure the target name is valid */ - if (zhp->zfs_type == ZFS_TYPE_SNAPSHOT) { - if ((strchr(target, '@') == NULL) || - *target == '@') { + if (zhp->zfs_type == ZFS_TYPE_SNAPSHOT || + zhp->zfs_type == ZFS_TYPE_BOOKMARK) { + const char sep = zhp->zfs_type == ZFS_TYPE_SNAPSHOT ? '@' : '#'; + + if ((strchr(target, sep) == NULL) || *target == sep) { /* * Snapshot target name is abbreviated, * reconstruct full dataset name */ - (void) strlcpy(parent, zhp->zfs_name, - sizeof (parent)); - delim = strchr(parent, '@'); - if (strchr(target, '@') == NULL) + (void) strlcpy(parent, zhp->zfs_name, sizeof (parent)); + delim = strchr(parent, sep); + if (strchr(target, sep) == NULL) *(++delim) = '\0'; else *delim = '\0'; @@ -4306,12 +4307,13 @@ zfs_rename(zfs_handle_t *zhp, const char *source, cons /* * Make sure we're renaming within the same dataset. */ - delim = strchr(target, '@'); + delim = strchr(target, sep); if (strncmp(zhp->zfs_name, target, delim - target) - != 0 || zhp->zfs_name[delim - target] != '@') { + != 0 || zhp->zfs_name[delim - target] != sep) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, - "snapshots must be part of same " - "dataset")); + "%s must be part of same dataset"), + zhp->zfs_type == ZFS_TYPE_SNAPSHOT ? + "snapshots" : "bookmarks"); return (zfs_error(hdl, EZFS_CROSSTARGET, errbuf)); } @@ -4374,7 +4376,6 @@ zfs_rename(zfs_handle_t *zhp, const char *source, cons flags.nounmount = B_TRUE; } if (flags.recurse) { - parentname = zfs_strdup(zhp->zfs_hdl, zhp->zfs_name); if (parentname == NULL) { ret = -1; @@ -4387,7 +4388,8 @@ zfs_rename(zfs_handle_t *zhp, const char *source, cons ret = -1; goto error; } - } else if (zhp->zfs_type != ZFS_TYPE_SNAPSHOT) { + } else if (zhp->zfs_type != ZFS_TYPE_SNAPSHOT && + zhp->zfs_type != ZFS_TYPE_BOOKMARK) { if ((cl = changelist_gather(zhp, ZFS_PROP_NAME, flags.nounmount ? CL_GATHER_DONT_UNMOUNT : 0, flags.forceunmount ? MS_FORCE : 0)) == NULL) { @@ -4432,6 +4434,8 @@ zfs_rename(zfs_handle_t *zhp, const char *source, cons "a child dataset already has a snapshot " "with the new name")); (void) zfs_error(hdl, EZFS_EXISTS, errbuf); + } else if (errno == EINVAL) { + (void) zfs_error(hdl, EZFS_INVALIDNAME, errbuf); } else { (void) zfs_standard_error(zhp->zfs_hdl, errno, errbuf); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c Sat Oct 19 08:19:31 2019 (r353758) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c Sat Oct 19 08:19:49 2019 (r353759) @@ -459,3 +459,108 @@ dsl_bookmark_destroy(nvlist_t *bmarks, nvlist_t *error fnvlist_free(dbda.dbda_success); return (rv); } + +typedef struct dsl_bookmark_rename_arg { + const char *dbra_fsname; + const char *dbra_oldname; + const char *dbra_newname; +} dsl_bookmark_rename_arg_t; + +static int +dsl_bookmark_rename_check(void *arg, dmu_tx_t *tx) +{ + dsl_bookmark_rename_arg_t *dbra = arg; + dsl_pool_t *dp = dmu_tx_pool(tx); + dsl_dataset_t *ds; + zfs_bookmark_phys_t bmark_phys; + int error; + + if (!spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_BOOKMARKS)) + return (SET_ERROR(ENOTSUP)); + + /* Check validity and the full length of the new bookmark name. */ + if (zfs_component_namecheck(dbra->dbra_newname, NULL, NULL)) + return (SET_ERROR(EINVAL)); + if (strlen(dbra->dbra_fsname) + strlen(dbra->dbra_newname) + 1 >= + ZFS_MAX_DATASET_NAME_LEN) + return (SET_ERROR(ENAMETOOLONG)); + + error = dsl_dataset_hold(dp, dbra->dbra_fsname, FTAG, &ds); + if (error != 0) + return (error); + if (ds->ds_is_snapshot) { + dsl_dataset_rele(ds, FTAG); + return (SET_ERROR(EINVAL)); + } + error = dsl_dataset_bmark_lookup(ds, dbra->dbra_oldname, &bmark_phys); + if (error != 0) { + dsl_dataset_rele(ds, FTAG); + return (error); + } + + error = dsl_dataset_bmark_lookup(ds, dbra->dbra_newname, &bmark_phys); + dsl_dataset_rele(ds, FTAG); + if (error == 0) + return (SET_ERROR(EEXIST)); + if (error != ESRCH) + return (error); + return (0); +} + +static void +dsl_bookmark_rename_sync(void *arg, dmu_tx_t *tx) +{ + zfs_bookmark_phys_t bmark_phys; + dsl_bookmark_rename_arg_t *dbra = arg; + dsl_pool_t *dp = dmu_tx_pool(tx); + objset_t *mos; + dsl_dataset_t *ds; + uint64_t bmark_zapobj; + uint64_t int_size, num_ints; + matchtype_t mt = 0; + int error; + + ASSERT(spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_BOOKMARKS)); + VERIFY0(dsl_dataset_hold(dp, dbra->dbra_fsname, FTAG, &ds)); + + mos = ds->ds_dir->dd_pool->dp_meta_objset; + bmark_zapobj = ds->ds_bookmarks; + + if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET) + mt = MT_NORMALIZE; + + VERIFY0(zap_length(mos, bmark_zapobj, dbra->dbra_oldname, + &int_size, &num_ints)); + ASSERT3U(int_size, ==, sizeof (uint64_t)); + VERIFY0(zap_lookup_norm(mos, bmark_zapobj, dbra->dbra_oldname, int_size, + num_ints, &bmark_phys, mt, NULL, 0, NULL)); + VERIFY0(zap_remove_norm(mos, bmark_zapobj, dbra->dbra_oldname, mt, tx)); + + VERIFY0(zap_add(mos, bmark_zapobj, dbra->dbra_newname, int_size, + num_ints, &bmark_phys, tx)); + + spa_history_log_internal_ds(ds, "rename bookmark", tx, + "#%s -> #%s creation_txg=%llu", + dbra->dbra_oldname, dbra->dbra_newname, + (longlong_t)bmark_phys.zbm_creation_txg); + + dsl_dataset_rele(ds, FTAG); +} + +/* + * The bookmarks must all be in the same pool. + */ +int +dsl_bookmark_rename(const char *fsname, const char *oldbmark, + const char *newbmark) +{ + dsl_bookmark_rename_arg_t dbra; + + dbra.dbra_fsname = fsname; + dbra.dbra_oldname = oldbmark; + dbra.dbra_newname = newbmark; + + return (dsl_sync_task(fsname, dsl_bookmark_rename_check, + dsl_bookmark_rename_sync, &dbra, 1, ZFS_SPACE_CHECK_NORMAL)); +} + Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_bookmark.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_bookmark.h Sat Oct 19 08:19:31 2019 (r353758) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_bookmark.h Sat Oct 19 08:19:49 2019 (r353759) @@ -41,6 +41,7 @@ int dsl_bookmark_create(nvlist_t *, nvlist_t *); int dsl_get_bookmarks(const char *, nvlist_t *, nvlist_t *); int dsl_get_bookmarks_impl(dsl_dataset_t *, nvlist_t *, nvlist_t *); int dsl_bookmark_destroy(nvlist_t *, nvlist_t *); +int dsl_bookmark_rename(const char *fs, const char *from, const char *to); int dsl_bookmark_lookup(struct dsl_pool *, const char *, struct dsl_dataset *, zfs_bookmark_phys_t *); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Oct 19 08:19:31 2019 (r353758) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Oct 19 08:19:49 2019 (r353759) @@ -225,7 +225,8 @@ typedef int zfs_secpolicy_func_t(zfs_cmd_t *, nvlist_t typedef enum { NO_NAME, POOL_NAME, - DATASET_NAME + DATASET_NAME, + ENTITY_NAME } zfs_ioc_namecheck_t; typedef enum { @@ -923,8 +924,21 @@ static int zfs_secpolicy_rename(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr) { char *at = NULL; + char *pound; int error; + if ((pound = strchr(zc->zc_name, '#')) != NULL) { + *pound = '\0'; + error = zfs_secpolicy_write_perms(zc->zc_name, + ZFS_DELEG_PERM_RENAME, cr); + if (error == 0) { + error = zfs_secpolicy_write_perms(zc->zc_name, + ZFS_DELEG_PERM_BOOKMARK, cr); + } + *pound = '#'; + return (error); + } + if ((zc->zc_cookie & 1) != 0) { /* * This is recursive rename, so the starting snapshot might @@ -4021,8 +4035,8 @@ recursive_unmount(const char *fsname, void *arg) /* * inputs: - * zc_name old name of dataset - * zc_value new name of dataset + * zc_name old name of dataset or bookmark + * zc_value new name of dataset or bookmark * zc_cookie recursive flag (only valid for snapshots) * * outputs: none @@ -4033,7 +4047,7 @@ zfs_ioc_rename(zfs_cmd_t *zc) objset_t *os; dmu_objset_type_t ost; boolean_t recursive = zc->zc_cookie & 1; - char *at; + char *pos, *pos2; boolean_t allow_mounted = B_TRUE; int err; @@ -4041,9 +4055,34 @@ zfs_ioc_rename(zfs_cmd_t *zc) allow_mounted = (zc->zc_cookie & 2) != 0; #endif - /* "zfs rename" from and to ...%recv datasets should both fail */ zc->zc_name[sizeof (zc->zc_name) - 1] = '\0'; zc->zc_value[sizeof (zc->zc_value) - 1] = '\0'; + + pos = strchr(zc->zc_name, '#'); + if (pos != NULL) { + /* Bookmarks must be in same fs. */ + pos2 = strchr(zc->zc_value, '#'); + if (pos2 == NULL) + return (SET_ERROR(EINVAL)); + + /* Recursive flag is not supported yet. */ + if (recursive) + return (SET_ERROR(ENOTSUP)); + + *pos = '\0'; + *pos2 = '\0'; + if (strcmp(zc->zc_name, zc->zc_value) == 0) { + err = dsl_bookmark_rename(zc->zc_name, + pos + 1, pos2 + 1); + } else { + err = SET_ERROR(EXDEV); + } + *pos = '#'; + *pos2 = '#'; + return (err); + } + + /* "zfs rename" from and to ...%recv datasets should both fail */ if (dataset_namecheck(zc->zc_name, NULL, NULL) != 0 || dataset_namecheck(zc->zc_value, NULL, NULL) != 0 || strchr(zc->zc_name, '%') || strchr(zc->zc_value, '%')) @@ -4055,28 +4094,30 @@ zfs_ioc_rename(zfs_cmd_t *zc) ost = dmu_objset_type(os); dmu_objset_rele(os, FTAG); - at = strchr(zc->zc_name, '@'); - if (at != NULL) { - /* snaps must be in same fs */ - int error; - - if (strncmp(zc->zc_name, zc->zc_value, at - zc->zc_name + 1)) - return (SET_ERROR(EXDEV)); - *at = '\0'; - if (ost == DMU_OST_ZFS && !allow_mounted) { - error = dmu_objset_find(zc->zc_name, - recursive_unmount, at + 1, - recursive ? DS_FIND_CHILDREN : 0); - if (error != 0) { - *at = '@'; - return (error); + pos = strchr(zc->zc_name, '@'); + if (pos != NULL) { + /* Snapshots must be in same fs. */ + pos2 = strchr(zc->zc_value, '@'); + if (pos2 == NULL) + return (SET_ERROR(EINVAL)); + *pos = '\0'; + *pos2 = '\0'; + if (strcmp(zc->zc_name, zc->zc_value) != 0) { + err = SET_ERROR(EXDEV); + } else { + if (ost == DMU_OST_ZFS && !allow_mounted) { + err = dmu_objset_find(zc->zc_name, + recursive_unmount, pos + 1, + recursive ? DS_FIND_CHILDREN : 0); } + if (err == 0) { + err = dsl_dataset_rename_snapshot(zc->zc_name, + pos + 1, pos2 + 1, recursive); + } } - error = dsl_dataset_rename_snapshot(zc->zc_name, - at + 1, strchr(zc->zc_value, '@') + 1, recursive); - *at = '@'; - - return (error); + *pos = '@'; + *pos2 = '@'; + return (err); } else { #ifdef illumos if (ost == DMU_OST_ZVOL) @@ -6341,8 +6382,6 @@ zfs_ioctl_init(void) zfs_secpolicy_none); zfs_ioctl_register_dataset_modify(ZFS_IOC_DESTROY, zfs_ioc_destroy, zfs_secpolicy_destroy); - zfs_ioctl_register_dataset_modify(ZFS_IOC_RENAME, zfs_ioc_rename, - zfs_secpolicy_rename); zfs_ioctl_register_dataset_modify(ZFS_IOC_RECV, zfs_ioc_recv, zfs_secpolicy_recv); zfs_ioctl_register_dataset_modify(ZFS_IOC_PROMOTE, zfs_ioc_promote, @@ -6352,6 +6391,14 @@ zfs_ioctl_init(void) zfs_ioctl_register_dataset_modify(ZFS_IOC_SET_FSACL, zfs_ioc_set_fsacl, zfs_secpolicy_set_fsacl); + /* + * Not using zfs_ioctl_register_dataset_modify as DATASET_NAME check + * won't allow a bookmark name. + */ + zfs_ioctl_register_legacy(ZFS_IOC_RENAME, zfs_ioc_rename, + zfs_secpolicy_rename, ENTITY_NAME, B_TRUE, + POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY); + zfs_ioctl_register_dataset_nolog(ZFS_IOC_SHARE, zfs_ioc_share, zfs_secpolicy_share, POOL_CHECK_NONE); zfs_ioctl_register_dataset_nolog(ZFS_IOC_SMB_ACL, zfs_ioc_smb_acl, @@ -6381,7 +6428,8 @@ pool_status_check(const char *name, zfs_ioc_namecheck_ spa_t *spa; int error; - ASSERT(type == POOL_NAME || type == DATASET_NAME); + ASSERT(type == POOL_NAME || type == DATASET_NAME || + type == ENTITY_NAME); if (check & POOL_CHECK_NONE) return (0); @@ -6712,6 +6760,15 @@ zfsdev_ioctl(struct cdev *dev, u_long zcmd, caddr_t ar else error = pool_status_check(zc->zc_name, vec->zvec_namecheck, vec->zvec_pool_check); + break; + + case ENTITY_NAME: + if (entity_namecheck(zc->zc_name, NULL, NULL) != 0) { + error = SET_ERROR(EINVAL); + } else { + error = pool_status_check(zc->zc_name, + vec->zvec_namecheck, vec->zvec_pool_check); + } break; case NO_NAME: From owner-svn-src-all@freebsd.org Sat Oct 19 08:22:52 2019 Return-Path: Delivered-To: svn-src-all@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 15DE015D78D; Sat, 19 Oct 2019 08:22:52 +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 46wG9l6t4Pz3yP5; Sat, 19 Oct 2019 08:22:51 +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 D02F31FB88; Sat, 19 Oct 2019 08:22:51 +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 x9J8Mp8m001200; Sat, 19 Oct 2019 08:22:51 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9J8MpSW001199; Sat, 19 Oct 2019 08:22:51 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910190822.x9J8MpSW001199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 19 Oct 2019 08:22:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353760 - stable/12/sys/mips/include X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/mips/include X-SVN-Commit-Revision: 353760 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 08:22:52 -0000 Author: avg Date: Sat Oct 19 08:22:51 2019 New Revision: 353760 URL: https://svnweb.freebsd.org/changeset/base/353760 Log: MFC r353166: add atomic_load_64 for mipsn32 Modified: stable/12/sys/mips/include/atomic.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/mips/include/atomic.h ============================================================================== --- stable/12/sys/mips/include/atomic.h Sat Oct 19 08:19:49 2019 (r353759) +++ stable/12/sys/mips/include/atomic.h Sat Oct 19 08:22:51 2019 (r353760) @@ -343,6 +343,10 @@ ATOMIC_STORE_LOAD(32) ATOMIC_STORE_LOAD(64) #undef ATOMIC_STORE_LOAD +#ifdef __mips_n32 +#define atomic_load_64 atomic_load_acq_64 +#endif + /* * Atomically compare the value stored at *p with cmpval and if the * two values are equal, update the value of *p with newval. Returns From owner-svn-src-all@freebsd.org Sat Oct 19 14:56:51 2019 Return-Path: Delivered-To: svn-src-all@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 145DF16713E; Sat, 19 Oct 2019 14:56:51 +0000 (UTC) (envelope-from jkim@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 46wQwL6y15z4KsT; Sat, 19 Oct 2019 14:56:50 +0000 (UTC) (envelope-from jkim@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 CD21B240EA; Sat, 19 Oct 2019 14:56:50 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9JEuomL035768; Sat, 19 Oct 2019 14:56:50 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9JEuikq035737; Sat, 19 Oct 2019 14:56:44 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201910191456.x9JEuikq035737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Sat, 19 Oct 2019 14:56:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353764 - in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/components/disa... X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/components/disassembler sys/contrib/dev/... X-SVN-Commit-Revision: 353764 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 14:56:51 -0000 Author: jkim Date: Sat Oct 19 14:56:44 2019 New Revision: 353764 URL: https://svnweb.freebsd.org/changeset/base/353764 Log: Merge ACPICA 20191018. Added: head/sys/contrib/dev/acpica/compiler/dtcompilerparser.l - copied, changed from r351127, vendor-sys/acpica/dist/source/compiler/dtcompilerparser.l head/sys/contrib/dev/acpica/compiler/dtcompilerparser.y - copied, changed from r351127, vendor-sys/acpica/dist/source/compiler/dtcompilerparser.y Modified: head/sys/contrib/dev/acpica/acpica_prep.sh head/sys/contrib/dev/acpica/changes.txt head/sys/contrib/dev/acpica/common/acgetline.c head/sys/contrib/dev/acpica/common/adisasm.c head/sys/contrib/dev/acpica/common/adwalk.c head/sys/contrib/dev/acpica/common/dmrestag.c head/sys/contrib/dev/acpica/common/dmtables.c head/sys/contrib/dev/acpica/common/dmtbdump1.c head/sys/contrib/dev/acpica/common/dmtbdump2.c head/sys/contrib/dev/acpica/common/dmtbdump3.c head/sys/contrib/dev/acpica/compiler/aslanalyze.c head/sys/contrib/dev/acpica/compiler/aslbtypes.c head/sys/contrib/dev/acpica/compiler/aslcache.c head/sys/contrib/dev/acpica/compiler/aslcodegen.c head/sys/contrib/dev/acpica/compiler/aslcompile.c head/sys/contrib/dev/acpica/compiler/aslcompiler.h head/sys/contrib/dev/acpica/compiler/asldebug.c head/sys/contrib/dev/acpica/compiler/asldefine.h head/sys/contrib/dev/acpica/compiler/aslglobal.h head/sys/contrib/dev/acpica/compiler/aslhelp.c head/sys/contrib/dev/acpica/compiler/aslkeywords.y head/sys/contrib/dev/acpica/compiler/asllength.c head/sys/contrib/dev/acpica/compiler/asllistsup.c head/sys/contrib/dev/acpica/compiler/aslload.c head/sys/contrib/dev/acpica/compiler/aslmain.c head/sys/contrib/dev/acpica/compiler/aslmessages.c head/sys/contrib/dev/acpica/compiler/aslmessages.h head/sys/contrib/dev/acpica/compiler/aslmethod.c head/sys/contrib/dev/acpica/compiler/aslnamesp.c head/sys/contrib/dev/acpica/compiler/asloptions.c head/sys/contrib/dev/acpica/compiler/aslparseop.c head/sys/contrib/dev/acpica/compiler/aslprepkg.c head/sys/contrib/dev/acpica/compiler/aslresource.c head/sys/contrib/dev/acpica/compiler/aslrestype2.c head/sys/contrib/dev/acpica/compiler/aslrestype2s.c head/sys/contrib/dev/acpica/compiler/aslstartup.c head/sys/contrib/dev/acpica/compiler/asltransform.c head/sys/contrib/dev/acpica/compiler/asltypes.h head/sys/contrib/dev/acpica/compiler/aslutils.c head/sys/contrib/dev/acpica/compiler/aslxrefout.c head/sys/contrib/dev/acpica/compiler/cvdisasm.c head/sys/contrib/dev/acpica/compiler/cvparser.c head/sys/contrib/dev/acpica/compiler/dtcompile.c head/sys/contrib/dev/acpica/compiler/dtcompiler.h head/sys/contrib/dev/acpica/compiler/dtfield.c head/sys/contrib/dev/acpica/compiler/dtio.c head/sys/contrib/dev/acpica/compiler/dtparser.l head/sys/contrib/dev/acpica/compiler/dttable2.c head/sys/contrib/dev/acpica/compiler/dttemplate.c head/sys/contrib/dev/acpica/compiler/prmacros.c head/sys/contrib/dev/acpica/compiler/prscan.c head/sys/contrib/dev/acpica/components/debugger/dbconvert.c head/sys/contrib/dev/acpica/components/debugger/dbdisply.c head/sys/contrib/dev/acpica/components/debugger/dbfileio.c head/sys/contrib/dev/acpica/components/debugger/dbhistry.c head/sys/contrib/dev/acpica/components/debugger/dbinput.c head/sys/contrib/dev/acpica/components/debugger/dbmethod.c head/sys/contrib/dev/acpica/components/debugger/dbnames.c head/sys/contrib/dev/acpica/components/debugger/dbobject.c head/sys/contrib/dev/acpica/components/debugger/dbstats.c head/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c head/sys/contrib/dev/acpica/components/disassembler/dmresrc.c head/sys/contrib/dev/acpica/components/disassembler/dmwalk.c head/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c head/sys/contrib/dev/acpica/components/dispatcher/dsfield.c head/sys/contrib/dev/acpica/components/events/evgpe.c head/sys/contrib/dev/acpica/components/events/evgpeblk.c head/sys/contrib/dev/acpica/components/events/evgpeinit.c head/sys/contrib/dev/acpica/components/events/evmisc.c head/sys/contrib/dev/acpica/components/events/evregion.c head/sys/contrib/dev/acpica/components/events/evrgnini.c head/sys/contrib/dev/acpica/components/events/evxfgpe.c head/sys/contrib/dev/acpica/components/executer/exdump.c head/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c head/sys/contrib/dev/acpica/components/namespace/nsaccess.c head/sys/contrib/dev/acpica/components/namespace/nsalloc.c head/sys/contrib/dev/acpica/components/namespace/nsconvert.c head/sys/contrib/dev/acpica/components/namespace/nsdump.c head/sys/contrib/dev/acpica/components/namespace/nsrepair2.c head/sys/contrib/dev/acpica/components/namespace/nsxfname.c head/sys/contrib/dev/acpica/components/parser/psobject.c head/sys/contrib/dev/acpica/components/resources/rscreate.c head/sys/contrib/dev/acpica/components/tables/tbdata.c head/sys/contrib/dev/acpica/components/tables/tbxfload.c head/sys/contrib/dev/acpica/components/utilities/utbuffer.c head/sys/contrib/dev/acpica/components/utilities/utdebug.c head/sys/contrib/dev/acpica/components/utilities/uterror.c head/sys/contrib/dev/acpica/components/utilities/utosi.c head/sys/contrib/dev/acpica/components/utilities/utownerid.c head/sys/contrib/dev/acpica/components/utilities/uttrack.c head/sys/contrib/dev/acpica/include/acconfig.h head/sys/contrib/dev/acpica/include/acdebug.h head/sys/contrib/dev/acpica/include/aclocal.h head/sys/contrib/dev/acpica/include/acobject.h head/sys/contrib/dev/acpica/include/acpiosxf.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/acstruct.h head/sys/contrib/dev/acpica/include/actypes.h head/sys/contrib/dev/acpica/include/acutils.h head/usr.sbin/acpi/iasl/Makefile Directory Properties: head/sys/contrib/dev/acpica/ (props changed) Modified: head/sys/contrib/dev/acpica/acpica_prep.sh ============================================================================== --- head/sys/contrib/dev/acpica/acpica_prep.sh Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/acpica_prep.sh Sat Oct 19 14:56:44 2019 (r353764) @@ -18,12 +18,13 @@ fulldirs="common compiler components include os_specif # files to remove stripdirs="generate libraries parsers preprocessor tests tools" -stripfiles="Makefile README accygwin.h acdragonfly.h acdragonflyex.h \ - acefi.h acefiex.h achaiku.h acintel.h aclinux.h aclinuxex.h \ - acmacosx.h acmsvc.h acmsvcex.h acnetbsd.h acos2.h acqnx.h \ - acwin.h acwin64.h acwinex.h new_table.txt osbsdtbl.c osefitbl.c \ - osefixf.c osfreebsdtbl.c oslinuxtbl.c osunixdir.c osunixmap.c \ - oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c utprint.c" +stripfiles="Makefile README aslcompiler.y accygwin.h acdragonfly.h \ + acdragonflyex.h acefi.h acefiex.h achaiku.h acintel.h aclinux.h \ + aclinuxex.h acmacosx.h acmsvc.h acmsvcex.h acnetbsd.h acos2.h \ + acqnx.h acwin.h acwin64.h acwinex.h new_table.txt osbsdtbl.c \ + osefitbl.c osefixf.c osfreebsdtbl.c oslinuxtbl.c osunixdir.c \ + osunixmap.c oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c \ + utprint.c" # include files to canonify src_headers="acapps.h acbuffer.h acclib.h accommon.h acconfig.h \ Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/changes.txt Sat Oct 19 14:56:44 2019 (r353764) @@ -1,4 +1,117 @@ ---------------------------------------- +18 October 2019. Summary of changes for version 20191018: + + +1) ACPICA kernel-resident subsystem: + +Debugger: added a new command: ?Fields [address space ID]?. This command +dumps the contents of all field units that are defined within the +namespace with a particular address space ID. + +Modified the external interface AcpiLoadTable() to return a table index. +This table index can be used for unloading a table for debugging. + ACPI_STATUS + AcpiLoadTable ( + ACPI_TABLE_HEADER *Table, + UINT32 *TableIndex)) + +Implemented a new external interface: AcpiUnloadTable() This new function +takes a table index as an argument and unloads the table. Useful for +debugging only. + ACPI_STATUS + AcpiUnloadTable ( + UINT32 TableIndex)) + +Ported the AcpiNames utility to use the new table initialization +sequence. The utility was broken before this change. Also, it was +required to include most of the AML interpreter into the utility in order +to process table initialization (module-level code execution.) + +Update for results from running Clang V8.0.1. This fixes all "dead +assignment" warnings. There are still several "Dereference of NULL +pointer" warnings, but these have been found to be false positive +warnings. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +iASL: numerous table compiler changes to ensure that the usage of +yacc/bison syntax is POSIX-compliant. + +iASL/disassembler: several simple bug fixes in the data table +disassembler. + +Acpiexec: expanded the initialization file (the -fi option) to initialize +strings, buffers, packages, and field units. + + +---------------------------------------- +16 August 2019. Summary of changes for version 20190816: + +This release is available at https://acpica.org/downloads + + +1) ACPICA kernel-resident subsystem: + +Modified the OwnerId mechanism to allow for more Owner Ids. The previous +limit was 256 Ids, now it is 4096 Ids. This prevents OWNER_ID_LIMIT +exceptions on machines with a large number of initialization threads, +many CPU cores and nested initialization control methods. + +Introduced acpi_dispatch_gpe() as a wrapper around AcpiEvDetectGpe() for +checking if the given GPE (as represented by a GPE device handle and a +GPE number) is currently active and dispatching it (if that's the case) +outside of interrupt context. + +Table load: exit the interpreter before initializing objects within the +new table This prevents re-acquiring the interpreter lock when loading +tables + +Added the "Windows 2019" string to the _OSI support (version 1903). Jung- +uk Kim + +Macros: removed pointer math on a null pointer. Causes warnings on some +compilers and/or tools. Changed ACPI_TO_POINTER to use ACPI_CAST_PTR +instead of using arithmetic. + +Fully deployed the ACPI_PRINTF_LIKE macro. This macro was not being used +across all "printf-like" internal functions. Also, cleanup all calls to +such functions (both in 32-bit mode and 64-bit mode) now that they are +analyzed by the gcc compiler via ACPI_PRINTF_LIKE. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +iASL: implemented a new data table compiler flex/bison front-end. This +change is internal and is not intended to result in changes to the +compiled code. This new compiler front-end can be invoked using the -tp +option for now, until the old mechanism is removed. + +ASLTS: Implemented a new data table compiler test suite. This test suite +generates all table templates and compile/disassemble/re-compile/binary- +compare each file. + +iASL: return -1 if AML files were not generated due to compiler errors + +iASL: added a warning on use of the now-legacy ASL Processor () keyword. + +iASL: added an error on _UID object declaration that returns a String +within a Processor () declaration. A _UID for a processor must be an +Integer. + +iASL: added a null terminator to name strings that consist only of +multiple parent prefixes (^) + +iASL: added support to compile both ASL and data table files in a single +command. + +Updated the tool generation project files that were recently migrated to +MSVC 2017 to eliminate all new warnings. The new project files appear in +the directory \acpica\generate\msvc2017. This change effectively +deprecates the older project files in \acpica\generate\msvc9. + + +---------------------------------------- 03 July 2019. Summary of changes for version 20190703: Modified: head/sys/contrib/dev/acpica/common/acgetline.c ============================================================================== --- head/sys/contrib/dev/acpica/common/acgetline.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/common/acgetline.c Sat Oct 19 14:56:44 2019 (r353764) @@ -532,7 +532,7 @@ AcpiOsGetLine ( * Ignore the various keys like insert/delete/home/end, etc. * But we must eat the final character of the ESC sequence. */ - InputChar = getchar (); + (void) getchar (); continue; default: Modified: head/sys/contrib/dev/acpica/common/adisasm.c ============================================================================== --- head/sys/contrib/dev/acpica/common/adisasm.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/common/adisasm.c Sat Oct 19 14:56:44 2019 (r353764) @@ -746,7 +746,6 @@ AdDoExternalFileList ( { ExternalFileList = ExternalFileList->Next; GlobalStatus = AE_TYPE; - Status = AE_OK; continue; } Modified: head/sys/contrib/dev/acpica/common/adwalk.c ============================================================================== --- head/sys/contrib/dev/acpica/common/adwalk.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/common/adwalk.c Sat Oct 19 14:56:44 2019 (r353764) @@ -480,6 +480,7 @@ AcpiDmDumpDescending ( { ACPI_OP_WALK_INFO *Info = Context; char *Path; + ACPI_STATUS Status; if (!Op) @@ -522,10 +523,18 @@ AcpiDmDumpDescending ( if (Op->Common.Value.String) { - AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Common.Value.String, + Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Common.Value.String, NULL, &Path); - AcpiOsPrintf ("%s %p", Path, Op->Common.Node); - ACPI_FREE (Path); + if (ACPI_SUCCESS (Status)) + { + AcpiOsPrintf ("%s %p", Path, Op->Common.Node); + ACPI_FREE (Path); + } + else + { + AcpiOsPrintf ("Could not externalize pathname for node [%4.4s]", + Op->Common.Node->Name.Ascii); + } } else { @@ -592,7 +601,9 @@ AcpiDmFindOrphanDescending ( return (AE_OK); } +#ifdef ACPI_UNDER_DEVELOPMENT OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); +#endif switch (Op->Common.AmlOpcode) { @@ -830,9 +841,9 @@ AcpiDmLoadDescendingOp ( * 2) Not the root node * 3) Not a node created by Scope */ - - if (!PreDefined && Node != AcpiGbl_RootNode && - Op->Common.AmlOpcode != AML_SCOPE_OP) + if (!PreDefined && + (Node != AcpiGbl_RootNode) && + (Op->Common.AmlOpcode != AML_SCOPE_OP)) { Node->OwnerId = WalkState->OwnerId; } @@ -1091,7 +1102,7 @@ AcpiDmCommonDescendingOp ( /* Switch/Case conversion */ Status = AcpiDmProcessSwitch (Op); - return (AE_OK); + return (Status); } Modified: head/sys/contrib/dev/acpica/common/dmrestag.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmrestag.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/common/dmrestag.c Sat Oct 19 14:56:44 2019 (r353764) @@ -833,8 +833,12 @@ AcpiGetTagPathname ( /* Internalize the namepath to AML format */ - AcpiNsInternalizeName (Pathname, &InternalPath); + Status = AcpiNsInternalizeName (Pathname, &InternalPath); ACPI_FREE (Pathname); + if (ACPI_FAILURE (Status)) + { + return (NULL); + } /* Update the Op with the symbol */ Modified: head/sys/contrib/dev/acpica/common/dmtables.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtables.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/common/dmtables.c Sat Oct 19 14:56:44 2019 (r353764) @@ -327,7 +327,7 @@ AdCreateTableHeader ( * makes it easier to rename the disassembled ASL file if needed. */ AcpiOsPrintf ( - "DefinitionBlock (\"\", \"%4.4s\", %hu, \"%.6s\", \"%.8s\", 0x%8.8X)\n", + "DefinitionBlock (\"\", \"%4.4s\", %u, \"%.6s\", \"%.8s\", 0x%8.8X)\n", Table->Signature, Table->Revision, Table->OemId, Table->OemTableId, Table->OemRevision); } @@ -443,8 +443,8 @@ AdGetLocalTables ( /* Get the DSDT via table override */ ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_DSDT); - AcpiOsTableOverride (&TableHeader, &NewTable); - if (!NewTable) + Status = AcpiOsTableOverride (&TableHeader, &NewTable); + if (ACPI_FAILURE (Status) || !NewTable) { fprintf (stderr, "Could not obtain DSDT\n"); return (AE_NO_ACPI_TABLES); @@ -601,7 +601,7 @@ AdParseTable ( fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n"); - Status = AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot); + (void) AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot); fprintf (stderr, "\n"); /* Process Resource Templates */ Modified: head/sys/contrib/dev/acpica/common/dmtbdump1.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtbdump1.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/common/dmtbdump1.c Sat Oct 19 14:56:44 2019 (r353764) @@ -474,7 +474,6 @@ AcpiDmDumpCsrt ( { return; } - SubSubOffset += InfoLength; } /* Point to next sub-subtable */ @@ -1401,7 +1400,6 @@ AcpiDmDumpHmat ( while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - SubtableOffset = 0; /* Dump HMAT structure header */ @@ -1484,6 +1482,11 @@ AcpiDmDumpHmat ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 4, AcpiDmTableInfoHmat1a); + if (ACPI_FAILURE (Status)) + { + return; + } + SubtableOffset += 4; } @@ -1500,6 +1503,11 @@ AcpiDmDumpHmat ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 4, AcpiDmTableInfoHmat1b); + if (ACPI_FAILURE (Status)) + { + return; + } + SubtableOffset += 4; } @@ -1519,6 +1527,11 @@ AcpiDmDumpHmat ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 2, AcpiDmTableInfoHmat1c); + if (ACPI_FAILURE(Status)) + { + return; + } + SubtableOffset += 2; } } @@ -1542,6 +1555,11 @@ AcpiDmDumpHmat ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 2, AcpiDmTableInfoHmat2a); + if (ACPI_FAILURE (Status)) + { + return; + } + SubtableOffset += 2; } break; Modified: head/sys/contrib/dev/acpica/common/dmtbdump2.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtbdump2.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/common/dmtbdump2.c Sat Oct 19 14:56:44 2019 (r353764) @@ -187,6 +187,7 @@ AcpiDmDumpIort ( ACPI_DMTABLE_INFO *InfoTable; char *String; UINT32 i; + UINT32 MappingByteLength; /* Main table */ @@ -314,6 +315,11 @@ AcpiDmDumpIort ( Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 4, AcpiDmTableInfoIort0a); + if (ACPI_FAILURE (Status)) + { + return; + } + NodeOffset += 4; } } @@ -325,8 +331,10 @@ AcpiDmDumpIort ( if (IortNode->Length > NodeOffset) { + MappingByteLength = + IortNode->MappingCount * sizeof (ACPI_IORT_ID_MAPPING); Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, - Table, IortNode->Length - NodeOffset, + Table, IortNode->Length - NodeOffset - MappingByteLength, AcpiDmTableInfoIort1a); if (ACPI_FAILURE (Status)) { @@ -410,7 +418,6 @@ NextSubtable: /* Point to next node subtable */ Offset += IortNode->Length; - IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, IortNode->Length); } } @@ -871,7 +878,7 @@ AcpiDmDumpMcfg ( if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length) { AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n", - sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length)); + (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length)); return; } @@ -1211,7 +1218,6 @@ AcpiDmDumpNfit ( /* Has a variable number of 32-bit values at the end */ InfoTable = AcpiDmTableInfoNfit2; - Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable); FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE); break; @@ -1236,7 +1242,6 @@ AcpiDmDumpNfit ( /* Has a variable number of 64-bit addresses at the end */ InfoTable = AcpiDmTableInfoNfit6; - Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable); FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64); break; @@ -1273,6 +1278,7 @@ AcpiDmDumpNfit ( { case ACPI_NFIT_TYPE_INTERLEAVE: + Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable); for (i = 0; i < Interleave->LineCount; i++) { Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, @@ -1308,6 +1314,7 @@ AcpiDmDumpNfit ( case ACPI_NFIT_TYPE_FLUSH_ADDRESS: + Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable); for (i = 0; i < Hint->HintCount; i++) { Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, @@ -1806,6 +1813,11 @@ AcpiDmDumpPptt ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset), 4, AcpiDmTableInfoPptt0a); + if (ACPI_FAILURE (Status)) + { + return; + } + SubtableOffset += 4; } break; @@ -2063,6 +2075,10 @@ AcpiDmDumpSdev ( Status = AcpiDmDumpTable (Table->Length, 0, ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset), VendorDataLength, AcpiDmTableInfoSdev1b); + if (ACPI_FAILURE (Status)) + { + return; + } } break; Modified: head/sys/contrib/dev/acpica/common/dmtbdump3.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtbdump3.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/common/dmtbdump3.c Sat Oct 19 14:56:44 2019 (r353764) @@ -410,7 +410,7 @@ AcpiDmDumpStao ( Namepath = ACPI_ADD_PTR (char, Table, Offset); StringLength = strlen (Namepath) + 1; - AcpiDmLineHeader (Offset, StringLength, "Namestring"); + AcpiDmLineHeader (Offset, StringLength, "Namepath"); AcpiOsPrintf ("\"%s\"\n", Namepath); /* Point to next namepath */ @@ -526,7 +526,7 @@ AcpiDmDumpTpm2Rev3 ( { case ACPI_TPM23_ACPI_START_METHOD: - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + (void) AcpiDmDumpTable (Table->Length, Offset, Subtable, Table->Length - Offset, AcpiDmTableInfoTpm23a); break; @@ -591,7 +591,7 @@ AcpiDmDumpTpm2 ( Offset += sizeof (ACPI_TPM2_TRAILER); AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, ArmSubtable, + (void) AcpiDmDumpTable (Table->Length, Offset, ArmSubtable, Table->Length - Offset, AcpiDmTableInfoTpm211); break; Modified: head/sys/contrib/dev/acpica/compiler/aslanalyze.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslanalyze.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslanalyze.c Sat Oct 19 14:56:44 2019 (r353764) @@ -569,7 +569,7 @@ ApCheckForGpeNameConflict ( /* Need a null-terminated string version of NameSeg */ - ACPI_MOVE_32_TO_32 (Name, &Op->Asl.NameSeg); + ACPI_MOVE_32_TO_32 (Name, Op->Asl.NameSeg); Name[ACPI_NAMESEG_SIZE] = 0; /* Modified: head/sys/contrib/dev/acpica/compiler/aslbtypes.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslbtypes.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslbtypes.c Sat Oct 19 14:56:44 2019 (r353764) @@ -474,7 +474,6 @@ AnFormatBtype ( strcat (Buffer, "|"); } - First = FALSE; strcat (Buffer, "Resource"); } } Modified: head/sys/contrib/dev/acpica/compiler/aslcache.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcache.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslcache.c Sat Oct 19 14:56:44 2019 (r353764) @@ -421,7 +421,7 @@ UtDeleteLocalCaches ( DbgPrint (ASL_DEBUG_OUTPUT, "%u ParseOps, Buffer size: %u ops (%u bytes), %u Buffers\n", AslGbl_ParseOpCount, ASL_PARSEOP_CACHE_SIZE, - (sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE), BufferCount); + ((UINT32) sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE), BufferCount); /* Reset cache globals */ @@ -445,7 +445,7 @@ UtDeleteLocalCaches ( DbgPrint (ASL_DEBUG_OUTPUT, "%u Fields, Buffer size: %u fields (%u bytes), %u Buffers\n", AslGbl_FieldCount, ASL_FIELD_CACHE_SIZE, - (sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE), BufferCount); + ((UINT32) sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE), BufferCount); /* Reset cache globals */ @@ -468,7 +468,7 @@ UtDeleteLocalCaches ( DbgPrint (ASL_DEBUG_OUTPUT, "%u Subtables, Buffer size: %u subtables (%u bytes), %u Buffers\n", AslGbl_SubtableCount, ASL_SUBTABLE_CACHE_SIZE, - (sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE), BufferCount); + ((UINT32) sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE), BufferCount); /* Reset cache globals */ Modified: head/sys/contrib/dev/acpica/compiler/aslcodegen.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcodegen.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslcodegen.c Sat Oct 19 14:56:44 2019 (r353764) @@ -618,8 +618,8 @@ CgWriteTableHeader ( Op->Asl.AmlSubtreeLength += strlen (AslGbl_ParseTreeRoot->Asl.Filename) + 3; - CvDbgPrint (" Length: %lu\n", - strlen (AslGbl_ParseTreeRoot->Asl.Filename) + 3); + CvDbgPrint (" Length: %u\n", + (UINT32) strlen (AslGbl_ParseTreeRoot->Asl.Filename) + 3); if (Op->Asl.CommentList) { Modified: head/sys/contrib/dev/acpica/compiler/aslcompile.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompile.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslcompile.c Sat Oct 19 14:56:44 2019 (r353764) @@ -853,10 +853,11 @@ CmDumpAllEvents ( * ******************************************************************************/ -void +int CmCleanupAndExit ( void) { + int Status = 0; BOOLEAN DeleteAmlFile = FALSE; ASL_GLOBAL_FILE_NODE *CurrentFileNode = AslGbl_FilesList; @@ -915,20 +916,38 @@ CmCleanupAndExit ( UtDisplaySummary (ASL_FILE_STDOUT); /* - * We will delete the AML file if there are errors and the - * force AML output option has not been used. + * Delete the AML file if there are errors and the force AML output option + * (-f) has not been used. + * + * Return -1 as a status of the compiler if no AML files are generated. If + * the AML file is generated in the presence of errors, return 0. In the + * latter case, the errors were ignored by the user so the compilation is + * considered successful. */ - if (AslGbl_ParserErrorDetected || AslGbl_PreprocessOnly || ((AslGbl_ExceptionCount[ASL_ERROR] > 0) && + if (AslGbl_ParserErrorDetected || AslGbl_PreprocessOnly || + ((AslGbl_ExceptionCount[ASL_ERROR] > 0) && (!AslGbl_IgnoreErrors) && AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle)) { DeleteAmlFile = TRUE; + Status = -1; } /* Close all open files */ while (CurrentFileNode) { + /* + * Set the program return status based on file errors. If there are any + * errors and during compilation, the command is not considered + * successful. + */ + if (Status != -1 && !AslGbl_IgnoreErrors && + CurrentFileNode->ParserErrorDetected) + { + Status = -1; + } + switch (FlSwitchFileSet (CurrentFileNode->Files[ASL_FILE_INPUT].Filename)) { case SWITCH_TO_SAME_FILE: @@ -952,6 +971,8 @@ CmCleanupAndExit ( { UtDeleteLocalCaches (); } + + return (Status); } Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompiler.h Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslcompiler.h Sat Oct 19 14:56:44 2019 (r353764) @@ -266,7 +266,7 @@ void CmDoOutputFiles ( void); -void +int CmCleanupAndExit ( void); @@ -1052,6 +1052,7 @@ void FlCloseFile ( UINT32 FileId); +ACPI_PRINTF_LIKE (2) void FlPrintFile ( UINT32 FileId, @@ -1195,6 +1196,7 @@ OtXrefWalkPart1 ( /* * aslutils - common compiler utilities */ +ACPI_PRINTF_LIKE(2) void DbgPrint ( UINT32 Type, @@ -1288,6 +1290,10 @@ UtInternalizeName ( char *ExternalName, char **ConvertedName); +BOOLEAN +UtNameContainsAllPrefix ( + ACPI_PARSE_OBJECT *Op); + void UtAttachNamepathToOwner ( ACPI_PARSE_OBJECT *Op, @@ -1303,7 +1309,16 @@ UINT64 UtDoConstant ( char *String); +char * +AcpiUtStrdup ( + char *String); +char * +AcpiUtStrcat ( + char *String1, + char *String2); + + /* * asluuid - UUID support */ @@ -1604,6 +1619,7 @@ DtCreateTemplates ( /* * ASL/ASL+ converter debug */ +ACPI_PRINTF_LIKE (1) void CvDbgPrint ( char *Fmt, Modified: head/sys/contrib/dev/acpica/compiler/asldebug.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asldebug.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/asldebug.c Sat Oct 19 14:56:44 2019 (r353764) @@ -239,7 +239,7 @@ UtDumpIntegerOp ( case 8: /* Dword */ DbgPrint (ASL_TREE_OUTPUT, - "%*.*X", IntegerLength, IntegerLength, Op->Asl.Value.Integer); + "%*.*X", IntegerLength, IntegerLength, (UINT32) Op->Asl.Value.Integer); break; case 16: /* Qword and Integer */ Modified: head/sys/contrib/dev/acpica/compiler/asldefine.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asldefine.h Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/asldefine.h Sat Oct 19 14:56:44 2019 (r353764) @@ -290,7 +290,7 @@ #define ASL_PARSE_TREE_DEBUG2 \ " %08X %04X %04X %01X %04X %04X %05X %05X "\ - "%08X %08X %08X %08X %08X %08X %04X %02d %5d %5d %5d %5d" + "%8p %8p %8p %8p %08X %08X %04X %02d %5d %5d %5d %5d" /* * Macros for ASL/ASL+ converter Modified: head/sys/contrib/dev/acpica/compiler/aslglobal.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslglobal.h Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslglobal.h Sat Oct 19 14:56:44 2019 (r353764) @@ -244,7 +244,6 @@ extern const char *AslGbl_SpecialNam #endif - /* * Parser and other externals */ @@ -254,6 +253,7 @@ extern int DtParserdebug; extern int PrParserdebug; extern const ASL_MAPPING_ENTRY AslKeywordMapping[]; extern char *AslCompilertext; +extern char *DtCompilerParsertext; /* * Older versions of Bison won't emit this external in the generated header. Modified: head/sys/contrib/dev/acpica/compiler/aslhelp.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslhelp.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslhelp.c Sat Oct 19 14:56:44 2019 (r353764) @@ -246,6 +246,7 @@ Usage ( ACPI_OPTION ("", " (Original comments are passed through to ASL+ file)"); printf ("\nData Table Compiler:\n"); + ACPI_OPTION ("-tp", "Compile tables with flex/bison prototype"); ACPI_OPTION ("-G", "Compile custom table that contains generic operators"); ACPI_OPTION ("-T |ALL", "Create ACPI table template/example files"); ACPI_OPTION ("-T ", "Emit DSDT and SSDTs to same file"); Modified: head/sys/contrib/dev/acpica/compiler/aslkeywords.y ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslkeywords.y Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslkeywords.y Sat Oct 19 14:56:44 2019 (r353764) @@ -202,7 +202,7 @@ AddressKeyword ; AddressSpaceKeyword - : ByteConst {$$ = UtCheckIntegerRange ($1, 0x0A, 0xFF);} + : ByteConst {$$ = UtCheckIntegerRange ($1, ACPI_NUM_PREDEFINED_REGIONS, 0xFF);} | RegionSpaceKeyword {} ; Modified: head/sys/contrib/dev/acpica/compiler/asllength.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asllength.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/asllength.c Sat Oct 19 14:56:44 2019 (r353764) @@ -479,12 +479,13 @@ CgGenerateAmlLengths ( Op->Asl.AmlLength = strlen (Buffer); /* - * Check for single backslash reference to root, - * make it a null terminated string in the AML + * Check for single backslash reference to root or reference to a name + * consisting of only prefix (^) characters. Make it a null terminated + * string in the AML. */ - if (Op->Asl.AmlLength == 1) + if (Op->Asl.AmlLength == 1 || UtNameContainsAllPrefix(Op)) { - Op->Asl.AmlLength = 2; + Op->Asl.AmlLength++; } break; Modified: head/sys/contrib/dev/acpica/compiler/asllistsup.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asllistsup.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/asllistsup.c Sat Oct 19 14:56:44 2019 (r353764) @@ -241,7 +241,7 @@ LsDumpAsciiInComment ( { /* Insert a space to break the sequence */ - FlPrintFile (FileId, ".", BufChar); + FlPrintFile (FileId, " "); } FlPrintFile (FileId, "%c", BufChar); Modified: head/sys/contrib/dev/acpica/compiler/aslload.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslload.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslload.c Sat Oct 19 14:56:44 2019 (r353764) @@ -275,7 +275,6 @@ LdLoadFieldElements ( ACPI_STATUS Status; - SourceRegion = UtGetArg (Op, 0); if (SourceRegion) { @@ -527,13 +526,12 @@ LdNamespace1Begin ( case AML_INT_CONNECTION_OP: - if (Op->Asl.Child->Asl.AmlOpcode != AML_INT_NAMEPATH_OP) { break; } - Arg = Op->Asl.Child; + Arg = Op->Asl.Child; Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Asl.ExternalName, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &Node); @@ -542,15 +540,6 @@ LdNamespace1Begin ( break; } - if (Node->Type == ACPI_TYPE_BUFFER) - { - Arg->Asl.Node = Node; - - Arg = Node->Op->Asl.Child; /* Get namepath */ - Arg = Arg->Asl.Next; /* Get actual buffer */ - Arg = Arg->Asl.Child; /* Buffer length */ - Arg = Arg->Asl.Next; /* RAW_DATA buffer */ - } break; default: @@ -577,7 +566,6 @@ LdNamespace1Begin ( * These opcodes are guaranteed to have a parent. * Examine the parent opcode. */ - Status = AE_OK; ParentOp = Op->Asl.Parent; OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Asl.AmlOpcode); @@ -1031,7 +1019,8 @@ FinishNode: * DESCRIPTION: Check if certain named objects are declared in the incorrect * scope. Special named objects are listed in * AslGbl_SpecialNamedObjects and can only be declared at the root - * scope. + * scope. _UID inside of a processor declaration must not be a + * string. * ******************************************************************************/ @@ -1051,6 +1040,13 @@ LdCheckSpecialNames ( AslError (ASL_ERROR, ASL_MSG_INVALID_SPECIAL_NAME, Op, Op->Asl.ExternalName); return; } + } + + if (ACPI_COMPARE_NAMESEG (Node->Name.Ascii, "_UID") && + Node->Parent->Type == ACPI_TYPE_PROCESSOR && + Node->Type == ACPI_TYPE_STRING) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_PROCESSOR_UID , Op, "found a string"); } } Modified: head/sys/contrib/dev/acpica/compiler/aslmain.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmain.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslmain.c Sat Oct 19 14:56:44 2019 (r353764) @@ -282,7 +282,6 @@ main ( if (ACPI_FAILURE (Status)) { ReturnStatus = -1; - goto CleanupAndExit; } Index2++; @@ -290,9 +289,10 @@ main ( /* * At this point, compilation of a data table or disassembly is complete. + * However, if there is a parse tree, perform compiler analysis and + * generate AML. */ - if (AslGbl_PreprocessOnly || AcpiGbl_DisasmFlag || - AslGbl_FileType == ASL_INPUT_TYPE_ASCII_DATA) + if (AslGbl_PreprocessOnly || AcpiGbl_DisasmFlag || !AslGbl_ParseTreeRoot) { goto CleanupAndExit; } @@ -338,7 +338,6 @@ main ( } - CleanupAndExit: UtFreeLineBuffers (); @@ -350,7 +349,7 @@ CleanupAndExit: if (!AcpiGbl_DisasmFlag) { - CmCleanupAndExit (); + ReturnStatus = CmCleanupAndExit (); } @@ -400,18 +399,21 @@ AslSignalHandler ( * Close all open files * Note: the .pre file is the same as the input source file */ - AslGbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; - - for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) + if (AslGbl_Files) { - FlCloseFile (i); - } + AslGbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; - /* Delete any output files */ + for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) + { + FlCloseFile (i); + } - for (i = ASL_FILE_AML_OUTPUT; i < ASL_MAX_FILE_TYPE; i++) - { - FlDeleteFile (i); + /* Delete any output files */ + + for (i = ASL_FILE_AML_OUTPUT; i < ASL_MAX_FILE_TYPE; i++) + { + FlDeleteFile (i); + } } printf (ASL_PREFIX "Terminating\n"); Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmessages.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslmessages.c Sat Oct 19 14:56:44 2019 (r353764) @@ -366,7 +366,9 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_TEMPORARY_OBJECT */ "Object is created temporarily in another method and cannot be accessed", /* ASL_MSG_UNDEFINED_EXTERNAL */ "Named object was declared external but the actual definition does not exist", /* ASL_MSG_BUFFER_FIELD_OVERFLOW */ "Buffer field extends beyond end of target buffer", -/* ASL_MSG_INVALID_SPECIAL_NAME */ "declaration of this named object outside root scope is illegal" +/* ASL_MSG_INVALID_SPECIAL_NAME */ "declaration of this named object outside root scope is illegal", +/* ASL_MSG_INVALID_PROCESSOR_UID */ "_UID inside processor declaration must be an integer", +/* ASL_MSG_LEGACY_PROCESSOR_OP */ "Legacy Processor() keyword detected. Use Device() keyword instead." }; /* Table compiler */ @@ -385,7 +387,10 @@ const char *AslTableCompilerMsgs /* ASL_MSG_UNKNOWN_LABEL */ "Label is undefined", /* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type", /* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature", -/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero" +/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero", +/* ASL_MSG_INVALID_LABEL */ "Invalid field label detected", +/* ASL_MSG_BUFFER_LIST */ "Invalid buffer initializer list", +/* ASL_MSG_ENTRY_LIST */ "Invalid entry initializer list" }; /* Preprocessor */ Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmessages.h Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslmessages.h Sat Oct 19 14:56:44 2019 (r353764) @@ -369,6 +369,8 @@ typedef enum ASL_MSG_UNDEFINED_EXTERNAL, ASL_MSG_BUFFER_FIELD_OVERFLOW, ASL_MSG_INVALID_SPECIAL_NAME, + ASL_MSG_INVALID_PROCESSOR_UID, + ASL_MSG_LEGACY_PROCESSOR_OP, /* These messages are used by the Data Table compiler only */ @@ -385,6 +387,9 @@ typedef enum ASL_MSG_UNKNOWN_SUBTABLE, ASL_MSG_UNKNOWN_TABLE, ASL_MSG_ZERO_VALUE, + ASL_MSG_INVALID_LABEL, + ASL_MSG_BUFFER_LIST, + ASL_MSG_ENTRY_LIST, /* These messages are used by the Preprocessor only */ Modified: head/sys/contrib/dev/acpica/compiler/aslmethod.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmethod.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslmethod.c Sat Oct 19 14:56:44 2019 (r353764) @@ -199,6 +199,8 @@ MtMethodAnalysisWalkBegin ( ACPI_PARSE_OBJECT *NextType; ACPI_PARSE_OBJECT *NextParamType; UINT8 ActualArgs = 0; + BOOLEAN HidExists; + BOOLEAN AdrExists; /* Build cross-reference output file if requested */ @@ -535,11 +537,25 @@ MtMethodAnalysisWalkBegin ( case PARSEOP_DEVICE: - if (!ApFindNameInDeviceTree (METHOD_NAME__HID, Op) && - !ApFindNameInDeviceTree (METHOD_NAME__ADR, Op)) + /* Check usage of _HID and _ADR objects */ + + HidExists = ApFindNameInDeviceTree (METHOD_NAME__HID, Op); + AdrExists = ApFindNameInDeviceTree (METHOD_NAME__ADR, Op); + + if (!HidExists && !AdrExists) { AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, "Device object requires a _HID or _ADR in same scope"); + } + else if (HidExists && AdrExists) + { + /* + * According to the ACPI spec, "A device object must contain + * either an _HID object or an _ADR object, but should not contain + * both". + */ + AslError (ASL_WARNING, ASL_MSG_MULTIPLE_TYPES, Op, + "Device object requires either a _HID or _ADR, but not both"); } break; Modified: head/sys/contrib/dev/acpica/compiler/aslnamesp.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslnamesp.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslnamesp.c Sat Oct 19 14:56:44 2019 (r353764) @@ -234,6 +234,10 @@ NsDisplayNamespace ( Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, FALSE, NsDoOneNamespaceObject, NULL, NULL, NULL); + if (ACPI_FAILURE (Status)) + { + return (Status); + } /* Print the full pathname for each namespace node */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Oct 19 15:58:21 2019 Return-Path: Delivered-To: svn-src-all@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 79872167DF3; Sat, 19 Oct 2019 15:58:21 +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 46wSHK2cJYz4Mw5; Sat, 19 Oct 2019 15:58:21 +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 3CBD024BA9; Sat, 19 Oct 2019 15:58:21 +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 x9JFwLjJ070985; Sat, 19 Oct 2019 15:58:21 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9JFwLWH070984; Sat, 19 Oct 2019 15:58:21 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910191558.x9JFwLWH070984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 19 Oct 2019 15:58:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353765 - in stable: 11/usr.bin/clang/lld 12/usr.bin/clang/lld X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/usr.bin/clang/lld 12/usr.bin/clang/lld X-SVN-Commit-Revision: 353765 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 15:58:21 -0000 Author: dim Date: Sat Oct 19 15:58:20 2019 New Revision: 353765 URL: https://svnweb.freebsd.org/changeset/base/353765 Log: MFC r353655: Ensure lld respects the WITH/WITHOUT_SHARED_TOOLCHAIN option Traditionally, toolchain components such as cc, as, and ld have been built as static executables. The WITH_SHARED_TOOLCHAIN option from src.conf(5) is meant to link these as regular executables, e.g. using shared libraries. The build of ld.lld did not yet check this option. Fix the Makefile so it will do so now. Reported by: Mike Cui PR: 241257 Modified: stable/12/usr.bin/clang/lld/Makefile Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.bin/clang/lld/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/12/usr.bin/clang/lld/Makefile ============================================================================== --- stable/12/usr.bin/clang/lld/Makefile Sat Oct 19 14:56:44 2019 (r353764) +++ stable/12/usr.bin/clang/lld/Makefile Sat Oct 19 15:58:20 2019 (r353765) @@ -15,6 +15,10 @@ SYMLINKS= ${PROG_CXX} ${BINDIR}/ld MLINKS= ld.lld.1 ld.1 .endif +.if ${MK_SHARED_TOOLCHAIN} == "no" +NO_SHARED?= yes +.endif + CFLAGS+= -I${LLD_SRCS}/ELF CFLAGS+= -I${LLD_SRCS}/include CFLAGS+= -I${.OBJDIR} From owner-svn-src-all@freebsd.org Sat Oct 19 15:58:21 2019 Return-Path: Delivered-To: svn-src-all@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 C5604167DFF; Sat, 19 Oct 2019 15:58:21 +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 46wSHK4sb4z4Mw6; Sat, 19 Oct 2019 15:58:21 +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 8B42A24BAA; Sat, 19 Oct 2019 15:58:21 +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 x9JFwLZk070991; Sat, 19 Oct 2019 15:58:21 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9JFwLfI070990; Sat, 19 Oct 2019 15:58:21 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910191558.x9JFwLfI070990@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 19 Oct 2019 15:58:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353765 - in stable: 11/usr.bin/clang/lld 12/usr.bin/clang/lld X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/usr.bin/clang/lld 12/usr.bin/clang/lld X-SVN-Commit-Revision: 353765 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 15:58:21 -0000 Author: dim Date: Sat Oct 19 15:58:20 2019 New Revision: 353765 URL: https://svnweb.freebsd.org/changeset/base/353765 Log: MFC r353655: Ensure lld respects the WITH/WITHOUT_SHARED_TOOLCHAIN option Traditionally, toolchain components such as cc, as, and ld have been built as static executables. The WITH_SHARED_TOOLCHAIN option from src.conf(5) is meant to link these as regular executables, e.g. using shared libraries. The build of ld.lld did not yet check this option. Fix the Makefile so it will do so now. Reported by: Mike Cui PR: 241257 Modified: stable/11/usr.bin/clang/lld/Makefile Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/usr.bin/clang/lld/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/11/usr.bin/clang/lld/Makefile ============================================================================== --- stable/11/usr.bin/clang/lld/Makefile Sat Oct 19 14:56:44 2019 (r353764) +++ stable/11/usr.bin/clang/lld/Makefile Sat Oct 19 15:58:20 2019 (r353765) @@ -14,6 +14,10 @@ SYMLINKS= ${PROG_CXX} ${BINDIR}/ld MLINKS= ld.lld.1 ld.1 .endif +.if ${MK_SHARED_TOOLCHAIN} == "no" +NO_SHARED?= yes +.endif + CFLAGS+= -I${LLD_SRCS}/ELF CFLAGS+= -I${LLD_SRCS}/include CFLAGS+= -I${.OBJDIR} From owner-svn-src-all@freebsd.org Sat Oct 19 16:09:07 2019 Return-Path: Delivered-To: svn-src-all@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 1684015013A; Sat, 19 Oct 2019 16:09:07 +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 46wSWk6tBdz4NYV; Sat, 19 Oct 2019 16:09: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 CB1E524D8E; Sat, 19 Oct 2019 16:09: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 x9JG96rv077070; Sat, 19 Oct 2019 16:09:06 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9JG96PZ077069; Sat, 19 Oct 2019 16:09:06 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201910191609.x9JG96PZ077069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 19 Oct 2019 16:09:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353766 - 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: 353766 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 16:09:07 -0000 Author: jhibbits Date: Sat Oct 19 16:09:06 2019 New Revision: 353766 URL: https://svnweb.freebsd.org/changeset/base/353766 Log: powerpc/booke pmap: Fix printf format type warnings Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Sat Oct 19 15:58:20 2019 (r353765) +++ head/sys/powerpc/booke/pmap.c Sat Oct 19 16:09:06 2019 (r353766) @@ -3511,8 +3511,8 @@ mmu_booke_mapdev_attr(mmu_t mmu, vm_paddr_t pa, vm_siz } while (va % sz != 0); } if (bootverbose) - printf("Wiring VA=%lx to PA=%jx (size=%lx)\n", - va, (uintmax_t)pa, sz); + printf("Wiring VA=%p to PA=%jx (size=%lx)\n", + (void *)va, (uintmax_t)pa, (long)sz); if (tlb1_set_entry(va, pa, sz, _TLB_ENTRY_SHARED | tlb_calc_wimg(pa, ma)) < 0) return (NULL); @@ -4298,9 +4298,9 @@ tlb_print_entry(int i, uint32_t mas1, uint32_t mas2, u size = tsize2size(tsize); printf("%3d: (%s) [AS=%d] " - "sz = 0x%08x tsz = %d tid = %d mas1 = 0x%08x " + "sz = 0x%jx tsz = %d tid = %d mas1 = 0x%08x " "mas2(va) = 0x%"PRI0ptrX" mas3(pa) = 0x%08x mas7 = 0x%08x\n", - i, desc, as, size, tsize, tid, mas1, mas2, mas3, mas7); + i, desc, as, (uintmax_t)size, tsize, tid, mas1, mas2, mas3, mas7); } DB_SHOW_COMMAND(tlb0, tlb0_print_tlbentries) From owner-svn-src-all@freebsd.org Sat Oct 19 16:37:50 2019 Return-Path: Delivered-To: svn-src-all@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 860C4151537; Sat, 19 Oct 2019 16:37:50 +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 46wT8t32R0z4Q9X; Sat, 19 Oct 2019 16:37:50 +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 466CA252CB; Sat, 19 Oct 2019 16:37:50 +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 x9JGboAp094401; Sat, 19 Oct 2019 16:37:50 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9JGbon6094400; Sat, 19 Oct 2019 16:37:50 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910191637.x9JGbon6094400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 19 Oct 2019 16:37:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353767 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 353767 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 16:37:50 -0000 Author: cem Date: Sat Oct 19 16:37:49 2019 New Revision: 353767 URL: https://svnweb.freebsd.org/changeset/base/353767 Log: hw.intrbalance: Make sysctl tunable This allows specifying a boot-time preference in loader.conf. Modified: head/sys/x86/x86/intr_machdep.c Modified: head/sys/x86/x86/intr_machdep.c ============================================================================== --- head/sys/x86/x86/intr_machdep.c Sat Oct 19 16:09:06 2019 (r353766) +++ head/sys/x86/x86/intr_machdep.c Sat Oct 19 16:37:49 2019 (r353767) @@ -83,7 +83,7 @@ static struct intsrc **interrupt_sources; #ifdef SMP static struct intsrc **interrupt_sorted; static int intrbalance; -SYSCTL_INT(_hw, OID_AUTO, intrbalance, CTLFLAG_RW, &intrbalance, 0, +SYSCTL_INT(_hw, OID_AUTO, intrbalance, CTLFLAG_RWTUN, &intrbalance, 0, "Interrupt auto-balance interval (seconds). Zero disables."); static struct timeout_task intrbalance_task; #endif From owner-svn-src-all@freebsd.org Sat Oct 19 19:38:53 2019 Return-Path: Delivered-To: svn-src-all@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 C9E9C1549BF; Sat, 19 Oct 2019 19:38:53 +0000 (UTC) (envelope-from jlh@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 46wY9n4tcyz4XXp; Sat, 19 Oct 2019 19:38:53 +0000 (UTC) (envelope-from jlh@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 8C162272B4; Sat, 19 Oct 2019 19:38:53 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9JJcrgg099953; Sat, 19 Oct 2019 19:38:53 GMT (envelope-from jlh@FreeBSD.org) Received: (from jlh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9JJcrV7099952; Sat, 19 Oct 2019 19:38:53 GMT (envelope-from jlh@FreeBSD.org) Message-Id: <201910191938.x9JJcrV7099952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jlh set sender to jlh@FreeBSD.org using -f From: Jeremie Le Hen Date: Sat, 19 Oct 2019 19:38:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353768 - head/usr.bin/procstat X-SVN-Group: head X-SVN-Commit-Author: jlh X-SVN-Commit-Paths: head/usr.bin/procstat X-SVN-Commit-Revision: 353768 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 19:38:53 -0000 Author: jlh Date: Sat Oct 19 19:38:53 2019 New Revision: 353768 URL: https://svnweb.freebsd.org/changeset/base/353768 Log: Remove IS_INADDR_ANY(). Requested by rgrimes@ in https://lists.freebsd.org/pipermail/svn-src-head/2019-October/129784.html Modified: head/usr.bin/procstat/procstat_files.c Modified: head/usr.bin/procstat/procstat_files.c ============================================================================== --- head/usr.bin/procstat/procstat_files.c Sat Oct 19 16:37:49 2019 (r353767) +++ head/usr.bin/procstat/procstat_files.c Sat Oct 19 19:38:53 2019 (r353768) @@ -94,7 +94,6 @@ addr_to_string(struct sockaddr_storage *ss, char *buff struct sockaddr_in6 *sin6; struct sockaddr_in *sin; struct sockaddr_un *sun; -#define IS_INADDR_ANY(x) ((x).s_addr == INADDR_ANY) switch (ss->ss_family) { case AF_LOCAL: @@ -107,7 +106,7 @@ addr_to_string(struct sockaddr_storage *ss, char *buff case AF_INET: sin = (struct sockaddr_in *)ss; - if (IS_INADDR_ANY(sin->sin_addr)) + if (sin->sin_addr.s_addr == INADDR_ANY) snprintf(buffer, buflen, "%s:%d", "*", ntohs(sin->sin_port)); else if (inet_ntop(AF_INET, &sin->sin_addr, buffer2, From owner-svn-src-all@freebsd.org Sat Oct 19 19:39:28 2019 Return-Path: Delivered-To: svn-src-all@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 DA1D9154A4A; Sat, 19 Oct 2019 19:39:28 +0000 (UTC) (envelope-from jlehen@gmail.com) Received: from mail-io1-f68.google.com (mail-io1-f68.google.com [209.85.166.68]) (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 46wYBR2XtGz4XgT; Sat, 19 Oct 2019 19:39:27 +0000 (UTC) (envelope-from jlehen@gmail.com) Received: by mail-io1-f68.google.com with SMTP id n26so11345784ioj.8; Sat, 19 Oct 2019 12:39:27 -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=vgm9DT4Ie/teXeEhZBxTsmqRJg+6bJNhJdGY2M06k/0=; b=X01Qi+ajA5kbzsDAWFgUtin+9VVjBBaFO+v1A+tKetK6B4/uiFakerm90PzjD3lXk+ 8WPmB1cS3bNz1EdIc8Yt736mjkArbcdR0giv+R99oLVgSYXWWSzGhZNVjJzKQ3/fYAtn UyvMlIRj8IZszfaYr+1uFZoMzdo+GHL67tFyl0h6Znzrvqlftiartyc4dNs/bxtSZAou mFeE0LfsNyIoMLEGJGjGIDzI920g1epUVoGAY3GAKZVTdLMMbPV7bsfBjnBHp6bu2GSR Hewym0L77LgjifqU2llGdK+XmMlQsIYz6cEzSkvS3/Z5EZ0haJtNhYR8dN5bgUjuCUrv XdqQ== X-Gm-Message-State: APjAAAXlimMG7aDQQlCfxpqpb5jIxqJZ/5gM8Nieu6qe4f8UHgw+odcI dtHJNEVnofkQlJmfkkSWgi0BnZ8qAs5NHfU9HjmF4ttSlW8= X-Google-Smtp-Source: APXvYqyViNQZ/6cUlkGOuqt/qRzXSk+Saf6EQx5NBTOeS6nwaM5762D7R1flihiMtE+tEh36efX6+8q08TsEslKzDSw= X-Received: by 2002:a5d:848a:: with SMTP id t10mr2645556iom.73.1571513964963; Sat, 19 Oct 2019 12:39:24 -0700 (PDT) MIME-Version: 1.0 References: <201910092005.x99K5EMA006261@repo.freebsd.org> <201910102127.x9ALRU1C087927@gndrsh.dnsmgr.net> In-Reply-To: <201910102127.x9ALRU1C087927@gndrsh.dnsmgr.net> From: Jeremie Le Hen Date: Sat, 19 Oct 2019 21:39:12 +0200 Message-ID: Subject: Re: svn commit: r353365 - head/usr.bin/procstat To: rgrimes@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46wYBR2XtGz4XgT X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jlehen@gmail.com designates 209.85.166.68 as permitted sender) smtp.mailfrom=jlehen@gmail.com X-Spamd-Result: default: False [-3.51 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; RCVD_TLS_ALL(0.00)[]; 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]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; IP_SCORE(-1.51)[ip: (-2.18), ipnet: 209.85.128.0/17(-3.24), asn: 15169(-2.09), country: US(-0.05)]; RCVD_IN_DNSWL_NONE(0.00)[68.166.85.209.list.dnswl.org : 127.0.5.0]; FORGED_SENDER(0.30)[jlh@freebsd.org,jlehen@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[68.166.85.209.rep.mailspike.net : 127.0.0.17]; 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]; FROM_NEQ_ENVFROM(0.00)[jlh@freebsd.org,jlehen@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 19:39:28 -0000 On Thu, Oct 10, 2019 at 11:27 PM Rodney W. Grimes wrote: > > > Author: jlh > > Date: Wed Oct 9 20:05:14 2019 > > New Revision: 353365 > > URL: https://svnweb.freebsd.org/changeset/base/353365 > > > > Log: > > Add a missing macro for the previous commit (IS_INADDR_ANY()). > > Can we write it the same was as it is 100+ other places? > 1022}# find . -type f | xargs grep "== INADDR_ANY" | wc > 131 781 9607 Done in r353768. Thanks! > > > > > Modified: > > head/usr.bin/procstat/procstat_files.c > > > > Modified: head/usr.bin/procstat/procstat_files.c > > ============================================================================== > > --- head/usr.bin/procstat/procstat_files.c Wed Oct 9 20:01:23 2019 (r353364) > > +++ head/usr.bin/procstat/procstat_files.c Wed Oct 9 20:05:14 2019 (r353365) > > @@ -94,6 +94,7 @@ addr_to_string(struct sockaddr_storage *ss, char *buff > > struct sockaddr_in6 *sin6; > > struct sockaddr_in *sin; > > struct sockaddr_un *sun; > > +#define IS_INADDR_ANY(x) ((x).s_addr == INADDR_ANY) > > > > switch (ss->ss_family) { > > case AF_LOCAL: > > > > -- > Rod Grimes rgrimes@freebsd.org -- Jeremie Le Hen jlh@FreeBSD.org From owner-svn-src-all@freebsd.org Sat Oct 19 19:52:20 2019 Return-Path: Delivered-To: svn-src-all@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 DCCC2154F9A; Sat, 19 Oct 2019 19:52:20 +0000 (UTC) (envelope-from jlh@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 46wYTJ5Hdrz4YSG; Sat, 19 Oct 2019 19:52:20 +0000 (UTC) (envelope-from jlh@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 98CB92764E; Sat, 19 Oct 2019 19:52:20 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9JJqKlT011310; Sat, 19 Oct 2019 19:52:20 GMT (envelope-from jlh@FreeBSD.org) Received: (from jlh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9JJqKHk011308; Sat, 19 Oct 2019 19:52:20 GMT (envelope-from jlh@FreeBSD.org) Message-Id: <201910191952.x9JJqKHk011308@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jlh set sender to jlh@FreeBSD.org using -f From: Jeremie Le Hen Date: Sat, 19 Oct 2019 19:52:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353769 - head/usr.bin/fstat X-SVN-Group: head X-SVN-Commit-Author: jlh X-SVN-Commit-Paths: head/usr.bin/fstat X-SVN-Commit-Revision: 353769 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 19:52:20 -0000 Author: jlh Date: Sat Oct 19 19:52:19 2019 New Revision: 353769 URL: https://svnweb.freebsd.org/changeset/base/353769 Log: Add the fstat -s option to display socket information. Reviewed by: jilles MFC after: 1 week Relnotes: yes Differential Revision: https://reviews.freebsd.org/D21880 Modified: head/usr.bin/fstat/fstat.1 head/usr.bin/fstat/fstat.c Modified: head/usr.bin/fstat/fstat.1 ============================================================================== --- head/usr.bin/fstat/fstat.1 Sat Oct 19 19:38:53 2019 (r353768) +++ head/usr.bin/fstat/fstat.1 Sat Oct 19 19:52:19 2019 (r353769) @@ -28,7 +28,7 @@ .\" @(#)fstat.1 8.3 (Berkeley) 2/25/94 .\" $FreeBSD$ .\" -.Dd September 28, 2011 +.Dd October 19, 2019 .Dt FSTAT 1 .Os .Sh NAME @@ -36,7 +36,7 @@ .Nd identify active files .Sh SYNOPSIS .Nm -.Op Fl fmnv +.Op Fl fmnsv .Op Fl M Ar core .Op Fl N Ar system .Op Fl p Ar pid @@ -85,6 +85,8 @@ in and print the mode of the file in octal instead of symbolic form. .It Fl p Report all files open by the specified process. +.It Fl s +Print socket endpoint information. .It Fl u Report all files open by the specified user. .It Fl v @@ -199,9 +201,6 @@ For tcp, it is the address of the tcpcb, and for udp, For unix domain sockets, its the address of the socket pcb and the address of the connected pcb (if connected). Otherwise the protocol number and address of the socket itself are printed. -The attempt is to make enough information available to -permit further analysis without duplicating -.Xr netstat 1 . .Pp For example, the addresses mentioned above are the addresses which the .Dq Li netstat -A @@ -211,6 +210,15 @@ connected unix domain stream socket. A unidirectional unix domain socket indicates the direction of flow with an arrow (``<-'' or ``->''), and a full duplex socket shows a double arrow (``<->''). +.Pp +When the +.Fl s +flag is used, socket endpoint information is shown after the address of the +socket. +For internet sockets the local and remote address are shown, separated with +a double arrow (``<->''). +For unix/local sockets either the local or remote address is shown, depending +on which one is available. .Sh SEE ALSO .Xr netstat 1 , .Xr nfsstat 1 , Modified: head/usr.bin/fstat/fstat.c ============================================================================== --- head/usr.bin/fstat/fstat.c Sat Oct 19 19:38:53 2019 (r353768) +++ head/usr.bin/fstat/fstat.c Sat Oct 19 19:52:19 2019 (r353769) @@ -40,9 +40,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include + #include #include #include @@ -61,6 +64,7 @@ __FBSDID("$FreeBSD$"); static int fsflg, /* show files on same filesystem as file(s) argument */ pflg, /* show files open by a particular pid */ + sflg, /* show socket details */ uflg; /* show files open by a particular (effective) user */ static int checkfile; /* restrict to particular files or filesystems */ static int nflg; /* (numerical) display f.s. and rdev as dev_t */ @@ -108,7 +112,7 @@ do_fstat(int argc, char **argv) arg = 0; what = KERN_PROC_PROC; nlistf = memf = NULL; - while ((ch = getopt(argc, argv, "fmnp:u:vN:M:")) != -1) + while ((ch = getopt(argc, argv, "fmnp:su:vN:M:")) != -1) switch((char)ch) { case 'f': fsflg = 1; @@ -135,6 +139,9 @@ do_fstat(int argc, char **argv) what = KERN_PROC_PID; arg = atoi(optarg); break; + case 's': + sflg = 1; + break; case 'u': if (uflg++) usage(); @@ -314,6 +321,55 @@ print_file_info(struct procstat *procstat, struct file putchar('\n'); } +static char * +addr_to_string(struct sockaddr_storage *ss, char *buffer, int buflen) +{ + char buffer2[INET6_ADDRSTRLEN]; + struct sockaddr_in6 *sin6; + struct sockaddr_in *sin; + struct sockaddr_un *sun; + + switch (ss->ss_family) { + case AF_LOCAL: + sun = (struct sockaddr_un *)ss; + if (strlen(sun->sun_path) == 0) + strlcpy(buffer, "-", buflen); + else + strlcpy(buffer, sun->sun_path, buflen); + break; + + case AF_INET: + sin = (struct sockaddr_in *)ss; + if (sin->sin_addr.s_addr == INADDR_ANY) + snprintf(buffer, buflen, "%s:%d", "*", + ntohs(sin->sin_port)); + else if (inet_ntop(AF_INET, &sin->sin_addr, buffer2, + sizeof(buffer2)) != NULL) + snprintf(buffer, buflen, "%s:%d", buffer2, + ntohs(sin->sin_port)); + break; + + case AF_INET6: + sin6 = (struct sockaddr_in6 *)ss; + if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) + snprintf(buffer, buflen, "%s.%d", "*", + ntohs(sin6->sin6_port)); + else if (inet_ntop(AF_INET6, &sin6->sin6_addr, buffer2, + sizeof(buffer2)) != NULL) + snprintf(buffer, buflen, "%s.%d", buffer2, + ntohs(sin6->sin6_port)); + else + strlcpy(buffer, "-", buflen); + break; + + default: + strlcpy(buffer, "", buflen); + break; + } + return buffer; +} + + static void print_socket_info(struct procstat *procstat, struct filestat *fst) { @@ -329,6 +385,8 @@ print_socket_info(struct procstat *procstat, struct fi struct sockstat sock; struct protoent *pe; char errbuf[_POSIX2_LINE_MAX]; + char src_addr[PATH_MAX], dst_addr[PATH_MAX]; + struct sockaddr_un *sun; int error; static int isopen; @@ -368,6 +426,11 @@ print_socket_info(struct procstat *procstat, struct fi } else if (sock.so_pcb != 0) printf(" %lx", (u_long)sock.so_pcb); + if (!sflg) + break; + printf(" %s <-> %s", + addr_to_string(&sock.sa_local, src_addr, sizeof(src_addr)), + addr_to_string(&sock.sa_peer, dst_addr, sizeof(dst_addr))); break; case AF_UNIX: /* print address of pcb and connected pcb */ @@ -385,8 +448,25 @@ print_socket_info(struct procstat *procstat, struct fi *cp = '\0'; printf(" %s %lx", shoconn, (u_long)sock.unp_conn); - } + } } + if (!sflg) + break; + sun = (struct sockaddr_un *)&sock.sa_local; + /* + * While generally we like to print two addresses, + * local and peer, for sockets, it turns out to be + * more useful to print the first non-null address for + * local sockets, as typically they aren't bound and + * connected, and the path strings can get long. + */ + if (sun->sun_path[0] != 0) + addr_to_string(&sock.sa_local, + src_addr, sizeof(src_addr)); + else + addr_to_string(&sock.sa_peer, + src_addr, sizeof(src_addr)); + printf(" %s", src_addr); break; default: /* print protocol number and socket address */ From owner-svn-src-all@freebsd.org Sat Oct 19 20:48:54 2019 Return-Path: Delivered-To: svn-src-all@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 53F931562BB; Sat, 19 Oct 2019 20:48:54 +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 46wZkZ1Yfpz4cD8; Sat, 19 Oct 2019 20:48:54 +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 1A3B327F6D; Sat, 19 Oct 2019 20:48:54 +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 x9JKmrx3042285; Sat, 19 Oct 2019 20:48:53 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9JKmrwo042283; Sat, 19 Oct 2019 20:48:53 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910192048.x9JKmrwo042283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 19 Oct 2019 20:48:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353770 - in head/sys: net netinet/netdump X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head/sys: net netinet/netdump X-SVN-Commit-Revision: 353770 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 20:48:54 -0000 Author: tuexen Date: Sat Oct 19 20:48:53 2019 New Revision: 353770 URL: https://svnweb.freebsd.org/changeset/base/353770 Log: Fix compile issues when building a kernel without the VIMAGE option. Thanks to cem@ for discussing the issue which resulted in this patch. Reviewed by: cem@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D22089 Modified: head/sys/net/debugnet.c head/sys/netinet/netdump/netdump_client.c Modified: head/sys/net/debugnet.c ============================================================================== --- head/sys/net/debugnet.c Sat Oct 19 19:52:19 2019 (r353769) +++ head/sys/net/debugnet.c Sat Oct 19 20:48:53 2019 (r353770) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: head/sys/netinet/netdump/netdump_client.c ============================================================================== --- head/sys/netinet/netdump/netdump_client.c Sat Oct 19 19:52:19 2019 (r353769) +++ head/sys/netinet/netdump/netdump_client.c Sat Oct 19 20:48:53 2019 (r353770) @@ -409,20 +409,13 @@ static int netdump_configure(struct diocskerneldump_arg *conf, struct thread *td) { struct ifnet *ifp; - struct vnet *vnet; NETDUMP_ASSERT_WLOCKED(); if (conf->kda_iface[0] != 0) { - if (td != NULL) - vnet = TD_TO_VNET(td); - else - vnet = vnet0; - CURVNET_SET(vnet); - if (td != NULL && !IS_DEFAULT_VNET(curvnet)) { - CURVNET_RESTORE(); + if (td != NULL && !IS_DEFAULT_VNET(TD_TO_VNET(td))) return (EINVAL); - } + CURVNET_SET(vnet0); ifp = ifunit_ref(conf->kda_iface); CURVNET_RESTORE(); } else From owner-svn-src-all@freebsd.org Sat Oct 19 21:44:34 2019 Return-Path: Delivered-To: svn-src-all@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 0315C157703; Sat, 19 Oct 2019 21:44:34 +0000 (UTC) (envelope-from bdrewery@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 46wbyn6GZBz4fx4; Sat, 19 Oct 2019 21:44:33 +0000 (UTC) (envelope-from bdrewery@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 BAAC0A8D; Sat, 19 Oct 2019 21:44:33 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9JLiXqO078012; Sat, 19 Oct 2019 21:44:33 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9JLiX2f078011; Sat, 19 Oct 2019 21:44:33 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201910192144.x9JLiX2f078011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 19 Oct 2019 21:44:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353771 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 353771 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2019 21:44:34 -0000 Author: bdrewery Date: Sat Oct 19 21:44:33 2019 New Revision: 353771 URL: https://svnweb.freebsd.org/changeset/base/353771 Log: Fix spelling of DPSRCS. Submitted by: vangyzen Sponsored by: DellEMC MFC after: 2 weeks Modified: head/share/mk/bsd.dep.mk Modified: head/share/mk/bsd.dep.mk ============================================================================== --- head/share/mk/bsd.dep.mk Sat Oct 19 20:48:53 2019 (r353770) +++ head/share/mk/bsd.dep.mk Sat Oct 19 21:44:33 2019 (r353771) @@ -195,7 +195,7 @@ DEPEND_FILTER= C,/,_,g DEPENDOBJS+= ${OBJS} .else DEPENDSRCS+= ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc} -DEPENDSRCS+= ${DPSRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc} +DEPENDSRCS+= ${DPSRCS:M*.[cSC]} ${DPSRCS:M*.cxx} ${DPSRCS:M*.cpp} ${DPSRCS:M*.cc} .if !empty(DEPENDSRCS) DEPENDOBJS+= ${DEPENDSRCS:${OBJS_SRCS_FILTER:ts:}:S,$,.o,} .endif