From owner-svn-src-stable-11@freebsd.org Sun May 19 13:14:26 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE18C15ADED7; Sun, 19 May 2019 13:14:25 +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 2E37D8C37E; Sun, 19 May 2019 13:14:25 +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 x4JDENJk069404; Sun, 19 May 2019 06:14:23 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x4JDENmf069403; Sun, 19 May 2019 06:14:23 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201905191314.x4JDENmf069403@gndrsh.dnsmgr.net> Subject: Re: svn commit: r347962 - in stable/11: share/man/man4 share/man/man4/man4.i386 share/man/man4/man4.powerpc sys/dev/bm sys/dev/cs sys/dev/de sys/dev/ed sys/dev/ep sys/dev/ex sys/dev/fe sys/dev/pcn sys/... In-Reply-To: <201905182043.x4IKhDdD038241@repo.freebsd.org> To: Brooks Davis Date: Sun, 19 May 2019 06:14:23 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@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: 2E37D8C37E X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.93 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.933,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 May 2019 13:14:26 -0000 > Author: brooks > Date: Sat May 18 20:43:13 2019 > New Revision: 347962 > URL: https://svnweb.freebsd.org/changeset/base/347962 > > Log: > MFC r339703, r347365, r347703, r347940 > > r339703: > Deprecate a number of less used 10 and 10/100 Ethernet devices. > > The current deprecated list is: ae, bm, cs, de, dme, ed, ep, ex, fe, > pcn, sf, sn, tl, tx, txp, vx, wb, xe > > The list as refined as part of FCP-0101. Per the FCP, devices may be > removed from the deprecation list if enough users are found or they are > converted to iflib. > > FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md > > r347365: > Update dme(4) to reflect that it will not be removed due to FCP-101. > > dme(4) is the built-in NIC on a couple non-expandable mips platforms and > thus should remain. The FCP has been updated to reflect this fact. > > Discussed with: imp > > r347703: > FCP-101: ae(4) is sufficently popular to be moved to the keep list. > > r347940: > Remove the notice that ae(4) will be removed in FreeBSD 13. > > MFC requested by: rgrimes > Approved by: re (kib) Thank you for following through with gettings this back to stable/11 for the upcoming release. Rod > Modified: > stable/11/share/man/man4/de.4 > stable/11/share/man/man4/ed.4 > stable/11/share/man/man4/man4.i386/cs.4 > stable/11/share/man/man4/man4.i386/ep.4 > stable/11/share/man/man4/man4.i386/ex.4 > stable/11/share/man/man4/man4.i386/fe.4 > stable/11/share/man/man4/man4.i386/vx.4 > stable/11/share/man/man4/man4.powerpc/bm.4 > stable/11/share/man/man4/pcn.4 > stable/11/share/man/man4/sf.4 > stable/11/share/man/man4/sn.4 > stable/11/share/man/man4/tl.4 > stable/11/share/man/man4/tx.4 > stable/11/share/man/man4/txp.4 > stable/11/share/man/man4/wb.4 > stable/11/share/man/man4/xe.4 > stable/11/sys/dev/bm/if_bm.c > stable/11/sys/dev/cs/if_cs.c > stable/11/sys/dev/de/if_de.c > stable/11/sys/dev/ed/if_ed.c > stable/11/sys/dev/ep/if_ep.c > stable/11/sys/dev/ex/if_ex.c > stable/11/sys/dev/fe/if_fe.c > stable/11/sys/dev/pcn/if_pcn.c > stable/11/sys/dev/sf/if_sf.c > stable/11/sys/dev/sn/if_sn.c > stable/11/sys/dev/tl/if_tl.c > stable/11/sys/dev/tx/if_tx.c > stable/11/sys/dev/txp/if_txp.c > stable/11/sys/dev/vx/if_vx.c > stable/11/sys/dev/wb/if_wb.c > stable/11/sys/dev/xe/if_xe.c > stable/11/sys/sys/systm.h > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/share/man/man4/de.4 > ============================================================================== > --- stable/11/share/man/man4/de.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/de.4 Sat May 18 20:43:13 2019 (r347962) > @@ -25,7 +25,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 16, 2005 > +.Dd October 24, 2018 > .Dt DE 4 > .Os > .Sh NAME > @@ -45,6 +45,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_de_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/ed.4 > ============================================================================== > --- stable/11/share/man/man4/ed.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/ed.4 Sat May 18 20:43:13 2019 (r347962) > @@ -30,7 +30,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd February 25, 2012 > +.Dd October 24, 2018 > .Dt ED 4 > .Os > .Sh NAME > @@ -51,6 +51,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_ed_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/man4.i386/cs.4 > ============================================================================== > --- stable/11/share/man/man4/man4.i386/cs.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/man4.i386/cs.4 Sat May 18 20:43:13 2019 (r347962) > @@ -25,7 +25,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 16, 2005 > +.Dd October 24 2018 > .Dt CS 4 i386 > .Os > .Sh NAME > @@ -52,6 +52,14 @@ In > .Cd hint.cs.0.port="0x300" > .Cd hint.cs.0.irq="10" > .Cd hint.cs.0.maddr="0xd000" > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/man4.i386/ep.4 > ============================================================================== > --- stable/11/share/man/man4/man4.i386/ep.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/man4.i386/ep.4 Sat May 18 20:43:13 2019 (r347962) > @@ -29,7 +29,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd April 1, 2011 > +.Dd October 24, 2018 > .Dt EP 4 i386 > .Os > .Sh NAME > @@ -49,6 +49,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_ep_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/man4.i386/ex.4 > ============================================================================== > --- stable/11/share/man/man4/man4.i386/ex.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/man4.i386/ex.4 Sat May 18 20:43:13 2019 (r347962) > @@ -25,7 +25,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 16, 2005 > +.Dd October 24, 2018 > .Dt EX 4 i386 > .Os > .Sh NAME > @@ -45,6 +45,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_ex_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/man4.i386/fe.4 > ============================================================================== > --- stable/11/share/man/man4/man4.i386/fe.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/man4.i386/fe.4 Sat May 18 20:43:13 2019 (r347962) > @@ -22,7 +22,7 @@ > .\" for fe driver. > .\" > .\" $FreeBSD$ > -.Dd July 16, 2005 > +.Dd October 24, 2018 > .Dt FE 4 i386 > .Os > .Sh NAME > @@ -48,6 +48,14 @@ In > .Cd hint.fe.0.at="isa" > .Cd hint.fe.0.port="0x300" > .Cd hint.fe.0.flags="0x0" > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/man4.i386/vx.4 > ============================================================================== > --- stable/11/share/man/man4/man4.i386/vx.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/man4.i386/vx.4 Sat May 18 20:43:13 2019 (r347962) > @@ -30,7 +30,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 16, 2005 > +.Dd October 24, 2018 > .Dt VX 4 i386 > .Os > .Sh NAME > @@ -50,6 +50,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_vx_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/man4.powerpc/bm.4 > ============================================================================== > --- stable/11/share/man/man4/man4.powerpc/bm.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/man4.powerpc/bm.4 Sat May 18 20:43:13 2019 (r347962) > @@ -25,7 +25,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 3, 2008 > +.Dd October 24, 2018 > .Dt BM 4 > .Os > .Sh NAME > @@ -46,6 +46,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_bm_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/pcn.4 > ============================================================================== > --- stable/11/share/man/man4/pcn.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/pcn.4 Sat May 18 20:43:13 2019 (r347962) > @@ -31,7 +31,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd January 31, 2006 > +.Dd October 24, 2018 > .Dt PCN 4 > .Os > .Sh NAME > @@ -52,6 +52,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_pcn_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/sf.4 > ============================================================================== > --- stable/11/share/man/man4/sf.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/sf.4 Sat May 18 20:43:13 2019 (r347962) > @@ -30,7 +30,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd January 21, 2008 > +.Dd October 24, 2018 > .Dt SF 4 > .Os > .Sh NAME > @@ -53,6 +53,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_sf_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/sn.4 > ============================================================================== > --- stable/11/share/man/man4/sn.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/sn.4 Sat May 18 20:43:13 2019 (r347962) > @@ -24,7 +24,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 16, 2005 > +.Dd October 24, 2018 > .Dt SN 4 > .Os > .Sh NAME > @@ -44,6 +44,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_sn_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/tl.4 > ============================================================================== > --- stable/11/share/man/man4/tl.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/tl.4 Sat May 18 20:43:13 2019 (r347962) > @@ -30,7 +30,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 16, 2005 > +.Dd October 24, 2018 > .Dt TL 4 > .Os > .Sh NAME > @@ -51,6 +51,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_tl_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/tx.4 > ============================================================================== > --- stable/11/share/man/man4/tx.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/tx.4 Sat May 18 20:43:13 2019 (r347962) > @@ -25,7 +25,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 16, 2005 > +.Dd October 24, 2018 > .Dt TX 4 > .Os > .Sh NAME > @@ -46,6 +46,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_tx_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/txp.4 > ============================================================================== > --- stable/11/share/man/man4/txp.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/txp.4 Sat May 18 20:43:13 2019 (r347962) > @@ -26,7 +26,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd January 26, 2012 > +.Dd October 24, 2018 > .Dt TXP 4 > .Os > .Sh NAME > @@ -46,6 +46,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_txp_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/wb.4 > ============================================================================== > --- stable/11/share/man/man4/wb.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/wb.4 Sat May 18 20:43:13 2019 (r347962) > @@ -30,7 +30,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 16, 2005 > +.Dd October 24, 2018 > .Dt WB 4 > .Os > .Sh NAME > @@ -51,6 +51,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_wb_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/xe.4 > ============================================================================== > --- stable/11/share/man/man4/xe.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/xe.4 Sat May 18 20:43:13 2019 (r347962) > @@ -25,7 +25,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 16, 2005 > +.Dd October 24 2018 > .Dt XE 4 > .Os > .Sh NAME > @@ -45,6 +45,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_xe_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/sys/dev/bm/if_bm.c > ============================================================================== > --- stable/11/sys/dev/bm/if_bm.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/bm/if_bm.c Sat May 18 20:43:13 2019 (r347962) > @@ -481,6 +481,8 @@ bm_attach(device_t dev) > ether_ifattach(ifp, sc->sc_enaddr); > ifp->if_hwassist = 0; > > + gone_by_fcp101_dev(dev); > + > return (0); > } > > > Modified: stable/11/sys/dev/cs/if_cs.c > ============================================================================== > --- stable/11/sys/dev/cs/if_cs.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/cs/if_cs.c Sat May 18 20:43:13 2019 (r347962) > @@ -572,6 +572,8 @@ cs_attach(device_t dev) > return (error); > } > > + gone_by_fcp101_dev(dev); > + > return (0); > } > > > Modified: stable/11/sys/dev/de/if_de.c > ============================================================================== > --- stable/11/sys/dev/de/if_de.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/de/if_de.c Sat May 18 20:43:13 2019 (r347962) > @@ -4430,6 +4430,8 @@ tulip_attach(tulip_softc_t * const sc) > TULIP_LOCK(sc); > sc->tulip_flags &= ~TULIP_DEVICEPROBE; > TULIP_UNLOCK(sc); > + > + gone_by_fcp101_dev(sc->tulip_dev); > } > > /* Release memory for a single descriptor ring. */ > > Modified: stable/11/sys/dev/ed/if_ed.c > ============================================================================== > --- stable/11/sys/dev/ed/if_ed.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/ed/if_ed.c Sat May 18 20:43:13 2019 (r347962) > @@ -363,6 +363,9 @@ ed_attach(device_t dev) > #endif > printf("\n"); > } > + > + gone_by_fcp101_dev(dev); > + > return (0); > } > > > Modified: stable/11/sys/dev/ep/if_ep.c > ============================================================================== > --- stable/11/sys/dev/ep/if_ep.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/ep/if_ep.c Sat May 18 20:43:13 2019 (r347962) > @@ -348,6 +348,8 @@ ep_attach(struct ep_softc *sc) > epstop(sc); > EP_UNLOCK(sc); > > + gone_by_fcp101_dev(sc->dev); > + > return (0); > } > > > Modified: stable/11/sys/dev/ex/if_ex.c > ============================================================================== > --- stable/11/sys/dev/ex/if_ex.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/ex/if_ex.c Sat May 18 20:43:13 2019 (r347962) > @@ -274,6 +274,8 @@ ex_attach(device_t dev) > return (error); > } > > + gone_by_fcp101_dev(dev); > + > return(0); > } > > > Modified: stable/11/sys/dev/fe/if_fe.c > ============================================================================== > --- stable/11/sys/dev/fe/if_fe.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/fe/if_fe.c Sat May 18 20:43:13 2019 (r347962) > @@ -870,6 +870,8 @@ fe_attach (device_t dev) > if (sc->stability & UNSTABLE_TYPE) > device_printf(dev, "warning: hardware type was not validated\n"); > > + gone_by_fcp101_dev(dev); > + > return 0; > } > > > Modified: stable/11/sys/dev/pcn/if_pcn.c > ============================================================================== > --- stable/11/sys/dev/pcn/if_pcn.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/pcn/if_pcn.c Sat May 18 20:43:13 2019 (r347962) > @@ -680,6 +680,8 @@ fail: > if (error) > pcn_detach(dev); > > + gone_by_fcp101_dev(dev); > + > return(error); > } > > > Modified: stable/11/sys/dev/sf/if_sf.c > ============================================================================== > --- stable/11/sys/dev/sf/if_sf.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/sf/if_sf.c Sat May 18 20:43:13 2019 (r347962) > @@ -914,6 +914,8 @@ sf_attach(device_t dev) > goto fail; > } > > + gone_by_fcp101_dev(dev); > + > fail: > if (error) > sf_detach(dev); > > Modified: stable/11/sys/dev/sn/if_sn.c > ============================================================================== > --- stable/11/sys/dev/sn/if_sn.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/sn/if_sn.c Sat May 18 20:43:13 2019 (r347962) > @@ -225,6 +225,9 @@ sn_attach(device_t dev) > sn_detach(dev); > return err; > } > + > + gone_by_fcp101_dev(dev); > + > return 0; > } > > > Modified: stable/11/sys/dev/tl/if_tl.c > ============================================================================== > --- stable/11/sys/dev/tl/if_tl.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/tl/if_tl.c Sat May 18 20:43:13 2019 (r347962) > @@ -1239,6 +1239,8 @@ tl_attach(dev) > goto fail; > } > > + gone_by_fcp101_dev(dev); > + > fail: > if (error) > tl_detach(dev); > > Modified: stable/11/sys/dev/tx/if_tx.c > ============================================================================== > --- stable/11/sys/dev/tx/if_tx.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/tx/if_tx.c Sat May 18 20:43:13 2019 (r347962) > @@ -426,6 +426,8 @@ epic_attach(device_t dev) > goto fail; > } > > + gone_by_fcp101_dev(dev); > + > return (0); > fail: > epic_release(sc); > > Modified: stable/11/sys/dev/txp/if_txp.c > ============================================================================== > --- stable/11/sys/dev/txp/if_txp.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/txp/if_txp.c Sat May 18 20:43:13 2019 (r347962) > @@ -471,6 +471,8 @@ txp_attach(device_t dev) > goto fail; > } > > + gone_by_fcp101_dev(dev); > + > return (0); > > fail: > > Modified: stable/11/sys/dev/vx/if_vx.c > ============================================================================== > --- stable/11/sys/dev/vx/if_vx.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/vx/if_vx.c Sat May 18 20:43:13 2019 (r347962) > @@ -204,6 +204,8 @@ vx_attach(device_t dev) > vx_stop(sc); > VX_UNLOCK(sc); > > + gone_by_fcp101_dev(dev); > + > return 1; > } > > > Modified: stable/11/sys/dev/wb/if_wb.c > ============================================================================== > --- stable/11/sys/dev/wb/if_wb.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/wb/if_wb.c Sat May 18 20:43:13 2019 (r347962) > @@ -692,6 +692,8 @@ wb_attach(dev) > goto fail; > } > > + gone_by_fcp101_dev(dev); > + > fail: > if (error) > wb_detach(dev); > > Modified: stable/11/sys/dev/xe/if_xe.c > ============================================================================== > --- stable/11/sys/dev/xe/if_xe.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/xe/if_xe.c Sat May 18 20:43:13 2019 (r347962) > @@ -315,6 +315,8 @@ xe_attach(device_t dev) > return (err); > } > > + gone_by_fcp101_dev(dev); > + > /* Done */ > return (0); > } > > Modified: stable/11/sys/sys/systm.h > ============================================================================== > --- stable/11/sys/sys/systm.h Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/sys/systm.h Sat May 18 20:43:13 2019 (r347962) > @@ -482,6 +482,9 @@ void _gone_in_dev(struct device *dev, int major, const > #endif > #define gone_in(major, msg) __gone_ok(major, msg) _gone_in(major, msg) > #define gone_in_dev(dev, major, msg) __gone_ok(major, msg) _gone_in_dev(dev, major, msg) > +#define gone_by_fcp101_dev(dev) \ > + gone_in_dev((dev), 13, \ > + "see https://github.com/freebsd/fcp/blob/master/fcp-0101.md") > > __NULLABILITY_PRAGMA_POP > > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable-11@freebsd.org Sun May 19 18:31:23 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E774F158AEF0; Sun, 19 May 2019 18:31:22 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 832FE6F675; Sun, 19 May 2019 18:31:22 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 59BD6AD92; Sun, 19 May 2019 18:31:22 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4JIVM97026315; Sun, 19 May 2019 18:31:22 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4JIVMc0026314; Sun, 19 May 2019 18:31:22 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201905191831.x4JIVMc0026314@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 19 May 2019 18:31:22 +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: r347977 - stable/11/etc/ntp X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/11/etc/ntp X-SVN-Commit-Revision: 347977 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 832FE6F675 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 May 2019 18:31:23 -0000 Author: delphij Date: Sun May 19 18:31:21 2019 New Revision: 347977 URL: https://svnweb.freebsd.org/changeset/base/347977 Log: MFC r347488,347606: Update leap-seconds to leap-seconds.3676924800. Approved by: re (kib) Modified: stable/11/etc/ntp/leap-seconds Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/ntp/leap-seconds ============================================================================== --- stable/11/etc/ntp/leap-seconds Sun May 19 17:53:36 2019 (r347976) +++ stable/11/etc/ntp/leap-seconds Sun May 19 18:31:21 2019 (r347977) @@ -61,7 +61,12 @@ # or # Terry Quinn, "The BIPM and the Accurate Measurement # of Time," Proc. of the IEEE, Vol. 79, pp. 894-905, -# July, 1991. +# July, 1991. +# reprinted in: +# Christine Hackman and Donald B Sullivan (eds.) +# Time and Frequency Measurement +# American Association of Physics Teachers (1996) +# , pp. 75-86 # # 4. The decision to insert a leap second into UTC is currently # the responsibility of the International Earth Rotation and @@ -199,10 +204,10 @@ # current -- the update time stamp, the data and the name of the file # will not change. # -# Updated through IERS Bulletin C53 -# File expires on: 28 December 2017 +# Updated through IERS Bulletin C57 +# File expires on: 28 December 2019 # -#@ 3723408000 +#@ 3786480000 # 2272060800 10 # 1 Jan 1972 2287785600 11 # 1 Jul 1972 @@ -247,4 +252,4 @@ # the hash line is also ignored in the # computation. # -#h 62cf8c5d 8bbb6dcc c61e3b56 c308343 869bb80d +#h 83c68138 d3650221 07dbbbcd 11fcc859 ced1106a From owner-svn-src-stable-11@freebsd.org Mon May 20 16:31:48 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AD6915B1EB5; Mon, 20 May 2019 16:31: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 CBF0A86150; Mon, 20 May 2019 16:31:47 +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 A5B0020D8C; Mon, 20 May 2019 16:31:47 +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 x4KGVlp1019491; Mon, 20 May 2019 16:31:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4KGVkKp019484; Mon, 20 May 2019 16:31:46 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905201631.x4KGVkKp019484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 20 May 2019 16:31:46 +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: r347995 - in stable/11: sys/sys usr.bin/ipcrm usr.bin/ipcs X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11: sys/sys usr.bin/ipcrm usr.bin/ipcs X-SVN-Commit-Revision: 347995 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CBF0A86150 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 May 2019 16:31:48 -0000 Author: kib Date: Mon May 20 16:31:45 2019 New Revision: 347995 URL: https://svnweb.freebsd.org/changeset/base/347995 Log: MFC r329348 (by brooks): Get rid of the requirement to include SysV IPC headers with _KERNEL defined in ipcrm by introducing _WANT_SYSVxxx_INTERNALS defines. MFC r329390 (by lwhsu): Follow r329348 in ipcs for getting rid of the requirement to include SysV IPC headers with _KERNEL. Sponsored by: Mellanox Technologies Approved by: re (gjb) Modified: stable/11/sys/sys/ipc.h stable/11/sys/sys/msg.h stable/11/sys/sys/sem.h stable/11/sys/sys/shm.h stable/11/usr.bin/ipcrm/ipcrm.c stable/11/usr.bin/ipcs/ipc.c stable/11/usr.bin/ipcs/ipc.h stable/11/usr.bin/ipcs/ipcs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/ipc.h ============================================================================== --- stable/11/sys/sys/ipc.h Mon May 20 16:23:35 2019 (r347994) +++ stable/11/sys/sys/ipc.h Mon May 20 16:31:45 2019 (r347995) @@ -117,12 +117,14 @@ struct ipc_perm { #define IPC_INFO 3 /* get info */ #endif -#ifdef _KERNEL +#if defined(_KERNEL) || defined(_WANT_SYSVIPC_INTERNALS) /* Macros to convert between ipc ids and array indices or sequence ids */ #define IPCID_TO_IX(id) ((id) & 0xffff) #define IPCID_TO_SEQ(id) (((id) >> 16) & 0xffff) #define IXSEQ_TO_IPCID(ix,perm) (((perm.seq) << 16) | (ix & 0xffff)) +#endif +#ifdef _KERNEL struct thread; struct proc; struct vmspace; Modified: stable/11/sys/sys/msg.h ============================================================================== --- stable/11/sys/sys/msg.h Mon May 20 16:23:35 2019 (r347994) +++ stable/11/sys/sys/msg.h Mon May 20 16:31:45 2019 (r347995) @@ -25,6 +25,9 @@ #include #include +#ifdef _WANT_SYSVMSG_INTERNALS +#define _WANT_SYSVIPC_INTERNALS +#endif #include /* @@ -116,7 +119,6 @@ struct mymsg { #endif #ifdef _KERNEL - struct msg { struct msg *msg_next; /* next msg in the chain */ long msg_type; /* type of this message */ @@ -126,7 +128,9 @@ struct msg { short msg_spot; /* location of start of msg in buffer */ struct label *label; /* MAC Framework label */ }; +#endif +#if defined(_KERNEL) || defined(_WANT_SYSVMSG_INTERNALS) /* * Based on the configuration parameters described in an SVR2 (yes, two) * config(1m) man page. @@ -145,7 +149,6 @@ struct msginfo { msgssz, /* size of a message segment (see notes above) */ msgseg; /* number of message segments */ }; -extern struct msginfo msginfo; /* * Kernel wrapper for the user-level structure. @@ -162,10 +165,13 @@ struct msqid_kernel { struct label *label; /* MAC label */ struct ucred *cred; /* creator's credentials */ }; +#endif -#endif /* _KERNEL */ +#ifdef _KERNEL +extern struct msginfo msginfo; -#if !defined(_KERNEL) || defined(_WANT_MSG_PROTOTYPES) +#else /* _KERNEL */ + __BEGIN_DECLS int msgctl(int, int, struct msqid_ds *); int msgget(key_t, int); @@ -176,7 +182,6 @@ int msgsnd(int, const void *, size_t, int); int msgsys(int, ...); #endif __END_DECLS - -#endif /* !_KERNEL || _WANT_MSG_PROTOTYPES */ +#endif /* !_KERNEL */ #endif /* !_SYS_MSG_H_ */ Modified: stable/11/sys/sys/sem.h ============================================================================== --- stable/11/sys/sys/sem.h Mon May 20 16:23:35 2019 (r347994) +++ stable/11/sys/sys/sem.h Mon May 20 16:31:45 2019 (r347995) @@ -10,6 +10,9 @@ #ifndef _SYS_SEM_H_ #define _SYS_SEM_H_ +#ifdef _WANT_SYSVSEM_INTERNALS +#define _WANT_SYSVIPC_INTERNALS +#endif #include #ifndef _PID_T_DECLARED @@ -101,8 +104,7 @@ union semun { #define SEM_A IPC_W /* alter permission */ #define SEM_R IPC_R /* read permission */ -#ifdef _KERNEL - +#if defined(_KERNEL) || defined(_WANT_SYSVSEM_INTERNALS) /* * semaphore info struct */ @@ -117,7 +119,6 @@ struct seminfo { semvmx, /* semaphore maximum value */ semaem; /* adjust on exit max value */ }; -extern struct seminfo seminfo; /* * Kernel wrapper for the user-level structure @@ -131,15 +132,17 @@ struct semid_kernel { /* internal "mode" bits */ #define SEM_ALLOC 01000 /* semaphore is allocated */ #define SEM_DEST 02000 /* semaphore will be destroyed on last detach */ +#endif +#ifdef _KERNEL +extern struct seminfo seminfo; /* * Process sem_undo vectors at proc exit. */ void semexit(struct proc *p); -#endif /* _KERNEL */ +#else /* !_KERNEL */ -#if !defined(_KERNEL) || defined(_WANT_SEM_PROTOTYPES) __BEGIN_DECLS #if __BSD_VISIBLE int semsys(int, ...); @@ -149,6 +152,6 @@ int semget(key_t, int, int); int semop(int, struct sembuf *, size_t); __END_DECLS -#endif /* !_KERNEL || _WANT_SEM_PROTOTYPES */ +#endif /* !_KERNEL */ #endif /* !_SYS_SEM_H_ */ Modified: stable/11/sys/sys/shm.h ============================================================================== --- stable/11/sys/sys/shm.h Mon May 20 16:23:35 2019 (r347994) +++ stable/11/sys/sys/shm.h Mon May 20 16:31:45 2019 (r347995) @@ -40,6 +40,9 @@ #define _SYS_SHM_H_ #include +#ifdef _WANT_SYSVSHM_INTERNALS +#define _WANT_SYSVIPC_INTERNALS +#endif #include #include @@ -104,9 +107,7 @@ struct shmid_ds { time_t shm_ctime; /* time of last change by shmctl() */ }; -#ifdef _KERNEL -#include - +#if defined(_KERNEL) || defined(_WANT_SYSVSHM_INTERNALS) /* * System 5 style catch-all structure for shared memory constants that * might be of interest to user programs. Do we really want/need this? @@ -119,19 +120,20 @@ struct shminfo { u_long shmall; /* max amount of shared memory (pages) */ }; +struct vm_object; + /* * Add a kernel wrapper to the shmid_ds struct so that private info (like the * MAC label) can be added to it, without changing the user interface. */ struct shmid_kernel { struct shmid_ds u; - vm_object_t object; + struct vm_object *object; struct label *label; /* MAC label */ struct ucred *cred; /* creator's credendials */ }; +#endif -extern struct shminfo shminfo; - struct shm_info { int used_ids; unsigned long shm_tot; @@ -141,15 +143,17 @@ struct shm_info { unsigned long swap_successes; }; -struct thread; +#ifdef _KERNEL struct proc; struct vmspace; +extern struct shminfo shminfo; + void shmexit(struct vmspace *); void shmfork(struct proc *, struct proc *); -#endif /* _KERNEL */ -#if !defined(_KERNEL) || defined(_WANT_SHM_PROTOTYPES) +#else /* !_KERNEL */ + #include #ifndef _SIZE_T_DECLARED @@ -167,6 +171,6 @@ int shmctl(int, int, struct shmid_ds *); int shmdt(const void *); __END_DECLS -#endif /* _KERNEL || _WANT_SHM_PROTOTYPES */ +#endif /* _KERNEL */ #endif /* !_SYS_SHM_H_ */ Modified: stable/11/usr.bin/ipcrm/ipcrm.c ============================================================================== --- stable/11/usr.bin/ipcrm/ipcrm.c Mon May 20 16:23:35 2019 (r347994) +++ stable/11/usr.bin/ipcrm/ipcrm.c Mon May 20 16:31:45 2019 (r347995) @@ -36,14 +36,12 @@ __FBSDID("$FreeBSD$"); #include -#define _WANT_MSG_PROTOTYPES -#define _WANT_SEM_PROTOTYPES -#define _WANT_SHM_PROTOTYPES -#define _KERNEL +#define _WANT_SYSVMSG_INTERNALS +#include +#define _WANT_SYSVSEM_INTERNALS #include +#define _WANT_SYSVSHM_INTERNALS #include -#include -#undef _KERNEL #include #include Modified: stable/11/usr.bin/ipcs/ipc.c ============================================================================== --- stable/11/usr.bin/ipcs/ipc.c Mon May 20 16:23:35 2019 (r347994) +++ stable/11/usr.bin/ipcs/ipc.c Mon May 20 16:31:45 2019 (r347995) @@ -35,11 +35,12 @@ __FBSDID("$FreeBSD$"); #include #include -#define _KERNEL +#define _WANT_SYSVMSG_INTERNALS +#include +#define _WANT_SYSVSEM_INTERNALS #include +#define _WANT_SYSVSHM_INTERNALS #include -#include -#undef _KERNEL #include #include Modified: stable/11/usr.bin/ipcs/ipc.h ============================================================================== --- stable/11/usr.bin/ipcs/ipc.h Mon May 20 16:23:35 2019 (r347994) +++ stable/11/usr.bin/ipcs/ipc.h Mon May 20 16:31:45 2019 (r347995) @@ -68,3 +68,6 @@ extern kvm_t *kd; extern struct semid_kernel *sema; extern struct msqid_kernel *msqids; extern struct shmid_kernel *shmsegs; +extern struct seminfo seminfo; +extern struct msginfo msginfo; +extern struct shminfo shminfo; Modified: stable/11/usr.bin/ipcs/ipcs.c ============================================================================== --- stable/11/usr.bin/ipcs/ipcs.c Mon May 20 16:23:35 2019 (r347994) +++ stable/11/usr.bin/ipcs/ipcs.c Mon May 20 16:31:45 2019 (r347995) @@ -32,11 +32,12 @@ __FBSDID("$FreeBSD$"); #include #include -#define _KERNEL +#define _WANT_SYSVMSG_INTERNALS +#include +#define _WANT_SYSVSEM_INTERNALS #include +#define _WANT_SYSVSHM_INTERNALS #include -#include -#undef _KERNEL #include #include From owner-svn-src-stable-11@freebsd.org Wed May 22 19:39:57 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F27B915B5A19; Wed, 22 May 2019 19:39:56 +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 8C4C795271; Wed, 22 May 2019 19:39:56 +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 64C7C21FAB; Wed, 22 May 2019 19:39:56 +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 x4MJdu4H039747; Wed, 22 May 2019 19:39:56 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4MJduJa039745; Wed, 22 May 2019 19:39:56 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201905221939.x4MJduJa039745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 22 May 2019 19:39:56 +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: r348118 - in stable/11: lib/libomp tools/build/mk X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable/11: lib/libomp tools/build/mk X-SVN-Commit-Revision: 348118 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8C4C795271 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 19:39:57 -0000 Author: dim Date: Wed May 22 19:39:55 2019 New Revision: 348118 URL: https://svnweb.freebsd.org/changeset/base/348118 Log: MFC r347978: Fix OptionalObsoleteFiles copy/paste mistake from r345236, which connected libomp to the build. The comparison should not have been against ${MK_OPENSSH}, but against ${MK_OPENMP}, obviously. MFC r347979: To avoid unnecessarily modifying ports, add a -lgomp symlink, since GCC does not ship a -lomp symlink. Also update OptionalObsoleteFiles for this, and add 32-bit variants while here. Approved by: re (gjb) Submitted by: jbeich PR: 237975 Modified: stable/11/lib/libomp/Makefile stable/11/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libomp/Makefile ============================================================================== --- stable/11/lib/libomp/Makefile Wed May 22 18:43:48 2019 (r348117) +++ stable/11/lib/libomp/Makefile Wed May 22 19:39:55 2019 (r348118) @@ -68,4 +68,6 @@ VERSION_MAP= ${OMPSRC}/exports_so.txt LIBADD+= pthread LIBADD+= m +SYMLINKS+= ${SHLIB_NAME} ${LIBDIR}/libgomp.so + .include Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/11/tools/build/mk/OptionalObsoleteFiles.inc Wed May 22 18:43:48 2019 (r348117) +++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc Wed May 22 19:39:55 2019 (r348118) @@ -2434,12 +2434,16 @@ OLD_FILES+=usr/include/omp.h .endif OLD_FILES+=usr/lib/libgcov.a OLD_FILES+=usr/lib/libgomp.a +.if ${MK_OPENMP} == no OLD_FILES+=usr/lib/libgomp.so +.endif OLD_LIBS+=usr/lib/libgomp.so.1 OLD_FILES+=usr/lib/libgomp_p.a OLD_FILES+=usr/lib32/libgcov.a OLD_FILES+=usr/lib32/libgomp.a +.if ${MK_OPENMP} == no OLD_FILES+=usr/lib32/libgomp.so +.endif OLD_LIBS+=usr/lib32/libgomp.so.1 OLD_FILES+=usr/lib32/libgomp_p.a OLD_FILES+=usr/libexec/cc1 @@ -6847,11 +6851,14 @@ OLD_FILES+=usr/share/man/man8/ntpq.8.gz OLD_FILES+=usr/share/man/man8/ntptime.8.gz .endif -.if ${MK_OPENSSH} == no +.if ${MK_OPENMP} == no .if ${MK_GCC} == no OLD_FILES+=usr/include/omp.h +OLD_LIBS+=usr/lib/libgomp.so +OLD_LIBS+=usr/lib32/libgomp.so .endif OLD_LIBS+=usr/lib/libomp.so +OLD_LIBS+=usr/lib32/libomp.so .endif .if ${MK_OPENSSH} == no From owner-svn-src-stable-11@freebsd.org Wed May 22 22:56:06 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6061F15901B9; Wed, 22 May 2019 22:56: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 CE6FA6EE53; Wed, 22 May 2019 22:56: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 A056B24257; Wed, 22 May 2019 22:56: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 x4MMu5bM045836; Wed, 22 May 2019 22:56:05 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4MMu5x5045834; Wed, 22 May 2019 22:56:05 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201905222256.x4MMu5x5045834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 22 May 2019 22:56:05 +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: r348126 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 348126 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CE6FA6EE53 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 22:56:06 -0000 Author: kevans Date: Wed May 22 22:56:05 2019 New Revision: 348126 URL: https://svnweb.freebsd.org/changeset/base/348126 Log: MFC r347578: tun/tap: Defer clearing if_softc until after if_detach (Commit massaged to match stable structure; tun and tap have been merged in head) r346670 added an sx to close a race between the ifioctl handler and interface destruction. Unfortunately, it clears if_softc immediately after the interface is closed, but before if_detach has been invoked. Any time before detachment, an interface that's part of a bridge may still receive traffic that's pushed through tunstart/tunstart_l2 and promptly lead to a panic because if_softc is now NULL. Fix it by deferring the clearing of if_softc until after the interface has detached and thus been removed from the bridge. if_softc still gets cleared in case another thread has already entered the ioctl handler before it's replaced with ifdead_ioctl. Approved by: re (kib) Modified: stable/11/sys/net/if_tap.c stable/11/sys/net/if_tun.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_tap.c ============================================================================== --- stable/11/sys/net/if_tap.c Wed May 22 22:55:27 2019 (r348125) +++ stable/11/sys/net/if_tap.c Wed May 22 22:56:05 2019 (r348126) @@ -223,15 +223,17 @@ tap_destroy(struct tap_softc *tp) struct ifnet *ifp = tp->tap_ifp; CURVNET_SET(ifp->if_vnet); - sx_xlock(&tap_ioctl_sx); - ifp->if_softc = NULL; - sx_xunlock(&tap_ioctl_sx); destroy_dev(tp->tap_dev); seldrain(&tp->tap_rsel); knlist_clear(&tp->tap_rsel.si_note, 0); knlist_destroy(&tp->tap_rsel.si_note); ether_ifdetach(ifp); + + sx_xlock(&tap_ioctl_sx); + ifp->if_softc = NULL; + sx_xunlock(&tap_ioctl_sx); + if_free(ifp); mtx_destroy(&tp->tap_mtx); Modified: stable/11/sys/net/if_tun.c ============================================================================== --- stable/11/sys/net/if_tun.c Wed May 22 22:55:27 2019 (r348125) +++ stable/11/sys/net/if_tun.c Wed May 22 22:56:05 2019 (r348126) @@ -278,13 +278,15 @@ tun_destroy(struct tun_softc *tp) mtx_unlock(&tp->tun_mtx); CURVNET_SET(TUN2IFP(tp)->if_vnet); - sx_xlock(&tun_ioctl_sx); - TUN2IFP(tp)->if_softc = NULL; - sx_xunlock(&tun_ioctl_sx); dev = tp->tun_dev; bpfdetach(TUN2IFP(tp)); if_detach(TUN2IFP(tp)); + + sx_xlock(&tun_ioctl_sx); + TUN2IFP(tp)->if_softc = NULL; + sx_xunlock(&tun_ioctl_sx); + free_unr(tun_unrhdr, TUN2IFP(tp)->if_dunit); if_free(TUN2IFP(tp)); destroy_dev(dev); From owner-svn-src-stable-11@freebsd.org Wed May 22 23:34:42 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 071041591577; Wed, 22 May 2019 23:34:42 +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 A307E70D76; Wed, 22 May 2019 23:34:41 +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 7930F24948; Wed, 22 May 2019 23:34:41 +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 x4MNYfU0067677; Wed, 22 May 2019 23:34:41 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4MNYfdg067676; Wed, 22 May 2019 23:34:41 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201905222334.x4MNYfdg067676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 22 May 2019 23:34:41 +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: r348133 - stable/11/lib/libbe X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/lib/libbe X-SVN-Commit-Revision: 348133 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A307E70D76 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 23:34:42 -0000 Author: kevans Date: Wed May 22 23:34:41 2019 New Revision: 348133 URL: https://svnweb.freebsd.org/changeset/base/348133 Log: MFC r347640: libbe(3): Descend into children of datasets w/ mountpoint=none These datasets will generally be canmount=noauto,mountpoint=none (e.g. zroot/var) but have children that may need to be mounted. Instead of skipping that segment for no good reason, descend. Approved by: re (kib) Modified: stable/11/lib/libbe/be_access.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libbe/be_access.c ============================================================================== --- stable/11/lib/libbe/be_access.c Wed May 22 23:30:51 2019 (r348132) +++ stable/11/lib/libbe/be_access.c Wed May 22 23:34:41 2019 (r348133) @@ -99,13 +99,12 @@ be_mount_iter(zfs_handle_t *zfs_hdl, void *data) if (strcmp("none", zfs_mnt) == 0) { /* * mountpoint=none; we'll mount it at info->mountpoint assuming - * we're at the root. If we're not at the root... that's less - * than stellar and not entirely sure what to do with that. - * For now, we won't treat it as an error condition -- we just - * won't mount it, and we'll continue on. + * we're at the root. If we're not at the root, we're likely + * at some intermediate dataset (e.g. zroot/var) that will have + * children that may need to be mounted. */ if (info->depth > 0) - return (0); + goto skipmount; snprintf(tmp, BE_MAXPATHLEN, "%s", info->mountpoint); } else { @@ -136,6 +135,7 @@ be_mount_iter(zfs_handle_t *zfs_hdl, void *data) if (!info->deepmount) return (0); +skipmount: ++info->depth; err = zfs_iter_filesystems(zfs_hdl, be_mount_iter, info); --info->depth; From owner-svn-src-stable-11@freebsd.org Thu May 23 16:05:49 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BED6F15AEB94; Thu, 23 May 2019 16:05:48 +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 62B4172CCC; Thu, 23 May 2019 16:05:48 +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 38E6D759D; Thu, 23 May 2019 16:05:48 +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 x4NG5mmC089417; Thu, 23 May 2019 16:05:48 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4NG5lRm089414; Thu, 23 May 2019 16:05:47 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905231605.x4NG5lRm089414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 23 May 2019 16:05: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: r348174 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 348174 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 62B4172CCC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.967,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 16:05:49 -0000 Author: tuexen Date: Thu May 23 16:05:47 2019 New Revision: 348174 URL: https://svnweb.freebsd.org/changeset/base/348174 Log: MFC r347975: Improve input validation for the IPPROTO_SCTP level socket options SCTP_CONNECT_X and SCTP_CONNECT_X_DELAYED. MFC r347976: Allow sending on demand SCTP HEARTBEATS only in the ESTABLISHED state. This issue was found by running syzkaller. Approved by: re (gjb@) Modified: stable/11/sys/netinet/sctp_usrreq.c stable/11/sys/netinet/sctputil.c stable/11/sys/netinet/sctputil.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Thu May 23 16:03:30 2019 (r348173) +++ stable/11/sys/netinet/sctp_usrreq.c Thu May 23 16:05:47 2019 (r348174) @@ -1352,13 +1352,12 @@ static int sctp_do_connect_x(struct socket *so, struct sctp_inpcb *inp, void *optval, size_t optsize, void *p, int delay) { - int error = 0; + int error; int creat_lock_on = 0; struct sctp_tcb *stcb = NULL; struct sockaddr *sa; unsigned int num_v6 = 0, num_v4 = 0, *totaddrp, totaddr; uint32_t vrf_id; - int bad_addresses = 0; sctp_assoc_t *a_id; SCTPDBG(SCTP_DEBUG_PCB1, "Connectx called\n"); @@ -1397,17 +1396,12 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb totaddrp = (unsigned int *)optval; totaddr = *totaddrp; sa = (struct sockaddr *)(totaddrp + 1); - stcb = sctp_connectx_helper_find(inp, sa, &totaddr, &num_v4, &num_v6, &error, (unsigned int)(optsize - sizeof(int)), &bad_addresses); - if ((stcb != NULL) || bad_addresses) { + error = sctp_connectx_helper_find(inp, sa, totaddr, &num_v4, &num_v6, (unsigned int)(optsize - sizeof(int))); + if (error != 0) { /* Already have or am bring up an association */ SCTP_ASOC_CREATE_UNLOCK(inp); creat_lock_on = 0; - if (stcb) - SCTP_TCB_UNLOCK(stcb); - if (bad_addresses == 0) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY); - error = EALREADY; - } + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error); goto out_now; } #ifdef INET6 @@ -5338,10 +5332,11 @@ sctp_setopt(struct socket *so, int optname, void *optv net->dest_state &= ~SCTP_ADDR_NOHB; } if (paddrp->spp_flags & SPP_HB_DEMAND) { - /* on demand HB */ - sctp_send_hb(stcb, net, SCTP_SO_LOCKED); - sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SOCKOPT, SCTP_SO_LOCKED); - sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net); + if (SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) { + sctp_send_hb(stcb, net, SCTP_SO_LOCKED); + sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SOCKOPT, SCTP_SO_LOCKED); + sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net); + } } if ((paddrp->spp_flags & SPP_PMTUD_DISABLE) && (paddrp->spp_pathmtu >= SCTP_SMALLEST_PMTU)) { if (SCTP_OS_TIMER_PENDING(&net->pmtu_timer.timer)) { Modified: stable/11/sys/netinet/sctputil.c ============================================================================== --- stable/11/sys/netinet/sctputil.c Thu May 23 16:03:30 2019 (r348173) +++ stable/11/sys/netinet/sctputil.c Thu May 23 16:05:47 2019 (r348174) @@ -6387,30 +6387,33 @@ out_now: return (added); } -struct sctp_tcb * +int sctp_connectx_helper_find(struct sctp_inpcb *inp, struct sockaddr *addr, - unsigned int *totaddr, - unsigned int *num_v4, unsigned int *num_v6, int *error, - unsigned int limit, int *bad_addr) + unsigned int totaddr, + unsigned int *num_v4, unsigned int *num_v6, + unsigned int limit) { struct sockaddr *sa; - struct sctp_tcb *stcb = NULL; + struct sctp_tcb *stcb; unsigned int incr, at, i; at = 0; sa = addr; - *error = *num_v6 = *num_v4 = 0; + *num_v6 = *num_v4 = 0; /* account and validate addresses */ - for (i = 0; i < *totaddr; i++) { + if (totaddr == 0) { + return (EINVAL); + } + for (i = 0; i < totaddr; i++) { + if (at + sizeof(struct sockaddr) > limit) { + return (EINVAL); + } switch (sa->sa_family) { #ifdef INET case AF_INET: incr = (unsigned int)sizeof(struct sockaddr_in); if (sa->sa_len != incr) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); - *error = EINVAL; - *bad_addr = 1; - return (NULL); + return (EINVAL); } (*num_v4) += 1; break; @@ -6423,46 +6426,34 @@ sctp_connectx_helper_find(struct sctp_inpcb *inp, stru sin6 = (struct sockaddr_in6 *)sa; if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { /* Must be non-mapped for connectx */ - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); - *error = EINVAL; - *bad_addr = 1; - return (NULL); + return (EINVAL); } incr = (unsigned int)sizeof(struct sockaddr_in6); if (sa->sa_len != incr) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); - *error = EINVAL; - *bad_addr = 1; - return (NULL); + return (EINVAL); } (*num_v6) += 1; break; } #endif default: - *totaddr = i; - incr = 0; - /* we are done */ - break; + return (EINVAL); } - if (i == *totaddr) { - break; + if ((at + incr) > limit) { + return (EINVAL); } SCTP_INP_INCR_REF(inp); stcb = sctp_findassociation_ep_addr(&inp, sa, NULL, NULL, NULL); if (stcb != NULL) { - /* Already have or am bring up an association */ - return (stcb); + SCTP_TCB_UNLOCK(stcb); + return (EALREADY); } else { SCTP_INP_DECR_REF(inp); } - if ((at + incr) > limit) { - *totaddr = i; - break; - } + at += incr; sa = (struct sockaddr *)((caddr_t)sa + incr); } - return ((struct sctp_tcb *)NULL); + return (0); } /* Modified: stable/11/sys/netinet/sctputil.h ============================================================================== --- stable/11/sys/netinet/sctputil.h Thu May 23 16:03:30 2019 (r348173) +++ stable/11/sys/netinet/sctputil.h Thu May 23 16:05:47 2019 (r348174) @@ -209,10 +209,9 @@ int sctp_connectx_helper_add(struct sctp_tcb *stcb, struct sockaddr *addr, int totaddr, int *error); -struct sctp_tcb * -sctp_connectx_helper_find(struct sctp_inpcb *inp, struct sockaddr *addr, - unsigned int *totaddr, unsigned int *num_v4, unsigned int *num_v6, - int *error, unsigned int limit, int *bad_addr); +int +sctp_connectx_helper_find(struct sctp_inpcb *, struct sockaddr *, + unsigned int, unsigned int *, unsigned int *, unsigned int); int sctp_is_there_an_abort_here(struct mbuf *, int, uint32_t *); #ifdef INET6 From owner-svn-src-stable-11@freebsd.org Thu May 23 18:58:07 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D9D515B2A59; Thu, 23 May 2019 18:58:07 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 13654825B3; Thu, 23 May 2019 18:58:07 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E2395938C; Thu, 23 May 2019 18:58:06 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4NIw6xc079848; Thu, 23 May 2019 18:58:06 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4NIw6fQ079847; Thu, 23 May 2019 18:58:06 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201905231858.x4NIw6fQ079847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Thu, 23 May 2019 18:58: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: r348188 - stable/11/usr.sbin/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: stable/11/usr.sbin/bhyve X-SVN-Commit-Revision: 348188 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 13654825B3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 18:58:07 -0000 Author: rgrimes Date: Thu May 23 18:58:06 2019 New Revision: 348188 URL: https://svnweb.freebsd.org/changeset/base/348188 Log: MFC: r347960: bhyve virtio needs barriers Under certain tight race conditions, we found that the lack of a memory barrier in bhyve's virtio handling causes it to miss a NO_NOTIFY state transition on block devices, resulting in guest stall. The investigation is recorded in OS-7613. As part of the examination into bhyve's use of barriers, one other section was found to be problematic, but only on non-x86 ISAs with less strict memory ordering. That was addressed in this patch as well, although it was not at all a problem on x86. PR: 231117 Submitted by: Patrick Mooney Reviewed by: jhb, kib, rgrimes Approved by: re (gjb), jhb Differential Revision: https://reviews.freebsd.org/D19501 Modified: stable/11/usr.sbin/bhyve/virtio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/virtio.c ============================================================================== --- stable/11/usr.sbin/bhyve/virtio.c Thu May 23 18:55:48 2019 (r348187) +++ stable/11/usr.sbin/bhyve/virtio.c Thu May 23 18:58:06 2019 (r348188) @@ -3,6 +3,7 @@ * * Copyright (c) 2013 Chris Torek * All rights reserved. + * Copyright (c) 2019 Joyent, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,6 +33,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -422,6 +425,12 @@ vq_relchain(struct vqueue_info *vq, uint16_t idx, uint vue = &vuh->vu_ring[uidx++ & mask]; vue->vu_idx = idx; vue->vu_tlen = iolen; + + /* + * Ensure the used descriptor is visible before updating the index. + * This is necessary on ISAs with memory ordering less strict than x86. + */ + atomic_thread_fence_rel(); vuh->vu_idx = uidx; } @@ -459,6 +468,13 @@ vq_endchains(struct vqueue_info *vq, int used_all_avai vs = vq->vq_vs; old_idx = vq->vq_save_used; vq->vq_save_used = new_idx = vq->vq_used->vu_idx; + + /* + * Use full memory barrier between vu_idx store from preceding + * vq_relchain() call and the loads from VQ_USED_EVENT_IDX() or + * va_flags below. + */ + atomic_thread_fence_seq_cst(); if (used_all_avail && (vs->vs_negotiated_caps & VIRTIO_F_NOTIFY_ON_EMPTY)) intr = 1; From owner-svn-src-stable-11@freebsd.org Thu May 23 21:23:22 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F53B15B6395; Thu, 23 May 2019 21:23:22 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AE7D388E46; Thu, 23 May 2019 21:23:21 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 156BBAE0F; Thu, 23 May 2019 21:23:21 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4NLNLok061413; Thu, 23 May 2019 21:23:21 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4NLNJg9061403; Thu, 23 May 2019 21:23:19 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201905232123.x4NLNJg9061403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Thu, 23 May 2019 21:23:19 +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: r348201 - in stable/11: lib/libvmmapi sys/amd64/include sys/amd64/vmm usr.sbin/bhyve usr.sbin/bhyvectl X-SVN-Group: stable-11 X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: in stable/11: lib/libvmmapi sys/amd64/include sys/amd64/vmm usr.sbin/bhyve usr.sbin/bhyvectl X-SVN-Commit-Revision: 348201 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AE7D388E46 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_SHORT(-0.97)[-0.967,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 21:23:22 -0000 Author: rgrimes Date: Thu May 23 21:23:18 2019 New Revision: 348201 URL: https://svnweb.freebsd.org/changeset/base/348201 Log: MFC: r332298,333712,334199,334216,334219 bhyve cpu topology Approved by: re (gjb), bde/phk (mentor, implicit) Modified: stable/11/lib/libvmmapi/vmmapi.c stable/11/lib/libvmmapi/vmmapi.h stable/11/sys/amd64/include/vmm.h stable/11/sys/amd64/include/vmm_dev.h stable/11/sys/amd64/vmm/vmm.c stable/11/sys/amd64/vmm/vmm_dev.c stable/11/sys/amd64/vmm/x86.c stable/11/usr.sbin/bhyve/bhyve.8 stable/11/usr.sbin/bhyve/bhyverun.c stable/11/usr.sbin/bhyvectl/bhyvectl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libvmmapi/vmmapi.c ============================================================================== --- stable/11/lib/libvmmapi/vmmapi.c Thu May 23 21:05:05 2019 (r348200) +++ stable/11/lib/libvmmapi/vmmapi.c Thu May 23 21:23:18 2019 (r348201) @@ -1417,6 +1417,38 @@ vm_restart_instruction(void *arg, int vcpu) } int +vm_set_topology(struct vmctx *ctx, + uint16_t sockets, uint16_t cores, uint16_t threads, uint16_t maxcpus) +{ + struct vm_cpu_topology topology; + + bzero(&topology, sizeof (struct vm_cpu_topology)); + topology.sockets = sockets; + topology.cores = cores; + topology.threads = threads; + topology.maxcpus = maxcpus; + return (ioctl(ctx->fd, VM_SET_TOPOLOGY, &topology)); +} + +int +vm_get_topology(struct vmctx *ctx, + uint16_t *sockets, uint16_t *cores, uint16_t *threads, uint16_t *maxcpus) +{ + struct vm_cpu_topology topology; + int error; + + bzero(&topology, sizeof (struct vm_cpu_topology)); + error = ioctl(ctx->fd, VM_GET_TOPOLOGY, &topology); + if (error == 0) { + *sockets = topology.sockets; + *cores = topology.cores; + *threads = topology.threads; + *maxcpus = topology.maxcpus; + } + return (error); +} + +int vm_get_device_fd(struct vmctx *ctx) { @@ -1443,7 +1475,7 @@ vm_get_ioctls(size_t *len) VM_GET_HPET_CAPABILITIES, VM_GET_GPA_PMAP, VM_GLA2GPA, VM_ACTIVATE_CPU, VM_GET_CPUS, VM_SET_INTINFO, VM_GET_INTINFO, VM_RTC_WRITE, VM_RTC_READ, VM_RTC_SETTIME, VM_RTC_GETTIME, - VM_RESTART_INSTRUCTION }; + VM_RESTART_INSTRUCTION, VM_SET_TOPOLOGY, VM_GET_TOPOLOGY }; if (len == NULL) { cmds = malloc(sizeof(vm_ioctl_cmds)); Modified: stable/11/lib/libvmmapi/vmmapi.h ============================================================================== --- stable/11/lib/libvmmapi/vmmapi.h Thu May 23 21:05:05 2019 (r348200) +++ stable/11/lib/libvmmapi/vmmapi.h Thu May 23 21:23:18 2019 (r348201) @@ -209,6 +209,12 @@ int vm_active_cpus(struct vmctx *ctx, cpuset_t *cpus); int vm_suspended_cpus(struct vmctx *ctx, cpuset_t *cpus); int vm_activate_cpu(struct vmctx *ctx, int vcpu); +/* CPU topology */ +int vm_set_topology(struct vmctx *ctx, uint16_t sockets, uint16_t cores, + uint16_t threads, uint16_t maxcpus); +int vm_get_topology(struct vmctx *ctx, uint16_t *sockets, uint16_t *cores, + uint16_t *threads, uint16_t *maxcpus); + /* * FreeBSD specific APIs */ Modified: stable/11/sys/amd64/include/vmm.h ============================================================================== --- stable/11/sys/amd64/include/vmm.h Thu May 23 21:05:05 2019 (r348200) +++ stable/11/sys/amd64/include/vmm.h Thu May 23 21:23:18 2019 (r348201) @@ -184,6 +184,10 @@ int vm_create(const char *name, struct vm **retvm); void vm_destroy(struct vm *vm); int vm_reinit(struct vm *vm); const char *vm_name(struct vm *vm); +void vm_get_topology(struct vm *vm, uint16_t *sockets, uint16_t *cores, + uint16_t *threads, uint16_t *maxcpus); +int vm_set_topology(struct vm *vm, uint16_t sockets, uint16_t cores, + uint16_t threads, uint16_t maxcpus); /* * APIs that modify the guest memory map require all vcpus to be frozen. Modified: stable/11/sys/amd64/include/vmm_dev.h ============================================================================== --- stable/11/sys/amd64/include/vmm_dev.h Thu May 23 21:05:05 2019 (r348200) +++ stable/11/sys/amd64/include/vmm_dev.h Thu May 23 21:23:18 2019 (r348201) @@ -216,6 +216,13 @@ struct vm_rtc_data { uint8_t value; }; +struct vm_cpu_topology { + uint16_t sockets; + uint16_t cores; + uint16_t threads; + uint16_t maxcpus; +}; + enum { /* general routines */ IOCNUM_ABIVERS = 0, @@ -271,6 +278,10 @@ enum { IOCNUM_GET_X2APIC_STATE = 61, IOCNUM_GET_HPET_CAPABILITIES = 62, + /* CPU Topology */ + IOCNUM_SET_TOPOLOGY = 63, + IOCNUM_GET_TOPOLOGY = 64, + /* legacy interrupt injection */ IOCNUM_ISA_ASSERT_IRQ = 80, IOCNUM_ISA_DEASSERT_IRQ = 81, @@ -360,6 +371,10 @@ enum { _IOWR('v', IOCNUM_GET_X2APIC_STATE, struct vm_x2apic) #define VM_GET_HPET_CAPABILITIES \ _IOR('v', IOCNUM_GET_HPET_CAPABILITIES, struct vm_hpet_cap) +#define VM_SET_TOPOLOGY \ + _IOW('v', IOCNUM_SET_TOPOLOGY, struct vm_cpu_topology) +#define VM_GET_TOPOLOGY \ + _IOR('v', IOCNUM_GET_TOPOLOGY, struct vm_cpu_topology) #define VM_GET_GPA_PMAP \ _IOWR('v', IOCNUM_GET_GPA_PMAP, struct vm_gpa_pte) #define VM_GLA2GPA \ Modified: stable/11/sys/amd64/vmm/vmm.c ============================================================================== --- stable/11/sys/amd64/vmm/vmm.c Thu May 23 21:05:05 2019 (r348200) +++ stable/11/sys/amd64/vmm/vmm.c Thu May 23 21:23:18 2019 (r348201) @@ -163,6 +163,11 @@ struct vm { struct vmspace *vmspace; /* (o) guest's address space */ char name[VM_MAX_NAMELEN]; /* (o) virtual machine name */ struct vcpu vcpu[VM_MAXCPU]; /* (i) guest vcpus */ + /* The following describe the vm cpu topology */ + uint16_t sockets; /* (o) num of sockets */ + uint16_t cores; /* (o) num of cores/socket */ + uint16_t threads; /* (o) num of threads/core */ + uint16_t maxcpus; /* (o) max pluggable cpus */ }; static int vmm_initialized; @@ -423,6 +428,12 @@ vm_init(struct vm *vm, bool create) vcpu_init(vm, i, create); } +/* + * The default CPU topology is a single thread per package. + */ +u_int cores_per_package = 1; +u_int threads_per_core = 1; + int vm_create(const char *name, struct vm **retvm) { @@ -448,10 +459,41 @@ vm_create(const char *name, struct vm **retvm) vm->vmspace = vmspace; mtx_init(&vm->rendezvous_mtx, "vm rendezvous lock", 0, MTX_DEF); + vm->sockets = 1; + vm->cores = cores_per_package; /* XXX backwards compatibility */ + vm->threads = threads_per_core; /* XXX backwards compatibility */ + vm->maxcpus = 0; /* XXX not implemented */ + vm_init(vm, true); *retvm = vm; return (0); +} + +void +vm_get_topology(struct vm *vm, uint16_t *sockets, uint16_t *cores, + uint16_t *threads, uint16_t *maxcpus) +{ + *sockets = vm->sockets; + *cores = vm->cores; + *threads = vm->threads; + *maxcpus = vm->maxcpus; +} + +int +vm_set_topology(struct vm *vm, uint16_t sockets, uint16_t cores, + uint16_t threads, uint16_t maxcpus) +{ + if (maxcpus != 0) + return (EINVAL); /* XXX remove when supported */ + if ((sockets * cores * threads) > VM_MAXCPU) + return (EINVAL); + /* XXX need to check sockets * cores * threads == vCPU, how? */ + vm->sockets = sockets; + vm->cores = cores; + vm->threads = threads; + vm->maxcpus = maxcpus; + return(0); } static void Modified: stable/11/sys/amd64/vmm/vmm_dev.c ============================================================================== --- stable/11/sys/amd64/vmm/vmm_dev.c Thu May 23 21:05:05 2019 (r348200) +++ stable/11/sys/amd64/vmm/vmm_dev.c Thu May 23 21:23:18 2019 (r348201) @@ -314,6 +314,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t da struct vm_rtc_time *rtctime; struct vm_rtc_data *rtcdata; struct vm_memmap *mm; + struct vm_cpu_topology *topology; sc = vmmdev_lookup2(cdev); if (sc == NULL) @@ -640,6 +641,17 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t da break; case VM_RESTART_INSTRUCTION: error = vm_restart_instruction(sc->vm, vcpu); + break; + case VM_SET_TOPOLOGY: + topology = (struct vm_cpu_topology *)data; + error = vm_set_topology(sc->vm, topology->sockets, + topology->cores, topology->threads, topology->maxcpus); + break; + case VM_GET_TOPOLOGY: + topology = (struct vm_cpu_topology *)data; + vm_get_topology(sc->vm, &topology->sockets, &topology->cores, + &topology->threads, &topology->maxcpus); + error = 0; break; default: error = ENOTTY; Modified: stable/11/sys/amd64/vmm/x86.c ============================================================================== --- stable/11/sys/amd64/vmm/x86.c Thu May 23 21:05:05 2019 (r348200) +++ stable/11/sys/amd64/vmm/x86.c Thu May 23 21:23:18 2019 (r348201) @@ -58,16 +58,15 @@ static uint64_t bhyve_xcpuids; SYSCTL_ULONG(_hw_vmm, OID_AUTO, bhyve_xcpuids, CTLFLAG_RW, &bhyve_xcpuids, 0, "Number of times an unknown cpuid leaf was accessed"); -/* - * The default CPU topology is a single thread per package. - */ -static u_int threads_per_core = 1; +#if __FreeBSD_version < 1200060 /* Remove after 11 EOL helps MFCing */ +extern u_int threads_per_core; SYSCTL_UINT(_hw_vmm_topology, OID_AUTO, threads_per_core, CTLFLAG_RDTUN, &threads_per_core, 0, NULL); -static u_int cores_per_package = 1; +extern u_int cores_per_package; SYSCTL_UINT(_hw_vmm_topology, OID_AUTO, cores_per_package, CTLFLAG_RDTUN, &cores_per_package, 0, NULL); +#endif static int cpuid_leaf_b = 1; SYSCTL_INT(_hw_vmm_topology, OID_AUTO, cpuid_leaf_b, CTLFLAG_RDTUN, @@ -93,6 +92,7 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, int error, enable_invpcid, level, width, x2apic_id; unsigned int func, regs[4], logical_cpus; enum x2apic_state x2apic_state; + uint16_t cores, maxcpus, sockets, threads; VCPU_CTR2(vm, vcpu_id, "cpuid %#x,%#x", *eax, *ecx); @@ -140,11 +140,11 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, * * However this matches the logical cpus as * advertised by leaf 0x1 and will work even - * if the 'threads_per_core' tunable is set - * incorrectly on an AMD host. + * if threads is set incorrectly on an AMD host. */ - logical_cpus = threads_per_core * - cores_per_package; + vm_get_topology(vm, &sockets, &cores, &threads, + &maxcpus); + logical_cpus = threads * cores; regs[2] = logical_cpus - 1; } break; @@ -303,7 +303,9 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, */ regs[3] |= (CPUID_MCA | CPUID_MCE | CPUID_MTRR); - logical_cpus = threads_per_core * cores_per_package; + vm_get_topology(vm, &sockets, &cores, &threads, + &maxcpus); + logical_cpus = threads * cores; regs[1] &= ~CPUID_HTT_CORES; regs[1] |= (logical_cpus & 0xff) << 16; regs[3] |= CPUID_HTT; @@ -313,8 +315,10 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, cpuid_count(*eax, *ecx, regs); if (regs[0] || regs[1] || regs[2] || regs[3]) { + vm_get_topology(vm, &sockets, &cores, &threads, + &maxcpus); regs[0] &= 0x3ff; - regs[0] |= (cores_per_package - 1) << 26; + regs[0] |= (cores - 1) << 26; /* * Cache topology: * - L1 and L2 are shared only by the logical @@ -322,10 +326,10 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, * - L3 and above are shared by all logical * processors in the package. */ - logical_cpus = threads_per_core; + logical_cpus = threads; level = (regs[0] >> 5) & 0x7; if (level >= 3) - logical_cpus *= cores_per_package; + logical_cpus *= cores; regs[0] |= (logical_cpus - 1) << 14; } break; @@ -387,16 +391,17 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, /* * Processor topology enumeration */ + vm_get_topology(vm, &sockets, &cores, &threads, + &maxcpus); if (*ecx == 0) { - logical_cpus = threads_per_core; + logical_cpus = threads; width = log2(logical_cpus); level = CPUID_TYPE_SMT; x2apic_id = vcpu_id; } if (*ecx == 1) { - logical_cpus = threads_per_core * - cores_per_package; + logical_cpus = threads * cores; width = log2(logical_cpus); level = CPUID_TYPE_CORE; x2apic_id = vcpu_id; Modified: stable/11/usr.sbin/bhyve/bhyve.8 ============================================================================== --- stable/11/usr.sbin/bhyve/bhyve.8 Thu May 23 21:05:05 2019 (r348200) +++ stable/11/usr.sbin/bhyve/bhyve.8 Thu May 23 21:23:18 2019 (r348201) @@ -33,7 +33,16 @@ .Sh SYNOPSIS .Nm .Op Fl abehuwxACHPSWY -.Op Fl c Ar numcpus +.Oo +.Fl c\~ Ns +.Oo +.Op Ar cpus= Ns +.Ar numcpus Ns +.Oc Ns +.Op Ar ,sockets=n Ns +.Op Ar ,cores=n Ns +.Op Ar ,threads=n +.Oc .Op Fl g Ar gdbport .Op Fl l Ar lpcdev Ns Op , Ns Ar conf .Op Fl m Ar memsize Ns Op Ar K|k|M|m|G|g|T|t @@ -77,9 +86,30 @@ Enable a low-level console device supported by kernels compiled with .Cd "device bvmconsole" . This option will be deprecated in a future version. -.It Fl c Ar numcpus -Number of guest virtual CPUs. -The default is 1 and the maximum is 16. +.It Fl c Op Ar setting ... +Number of guest virtual CPUs +and/or the CPU topology. +The default value for each of +.Ar numcpus , +.Ar sockets , +.Ar cores , +and +.Ar threads +is 1. +The current maximum number of guest virtual CPUs is 16. +If +.Ar numcpus +is not specified then it will be calculated from the other arguments. +The topology must be consistent in that the +.Ar numcpus +must equal the product of +.Ar sockets , +.Ar cores , +and +.Ar threads . +If a +.Ar setting +is specified more than once the last one has precedence. .It Fl C Include guest memory in core file. .It Fl e Modified: stable/11/usr.sbin/bhyve/bhyverun.c ============================================================================== --- stable/11/usr.sbin/bhyve/bhyverun.c Thu May 23 21:05:05 2019 (r348200) +++ stable/11/usr.sbin/bhyve/bhyverun.c Thu May 23 21:23:18 2019 (r348201) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifndef WITHOUT_CAPSICUM #include #include @@ -163,6 +164,8 @@ extern int vmexit_task_switch(struct vmctx *, struct v char *vmname; int guest_ncpus; +uint16_t cores, maxcpus, sockets, threads; + char *guest_uuid_str; static int guest_vmexit_on_hlt, guest_vmexit_on_pause; @@ -207,11 +210,13 @@ usage(int code) { fprintf(stderr, - "Usage: %s [-abehuwxACHPSWY] [-c vcpus] [-g ] [-l ]\n" + "Usage: %s [-abehuwxACHPSWY]\n" + " %*s [-c [[cpus=]numcpus][,sockets=n][,cores=n][,threads=n]]\n" + " %*s [-g ] [-l ]\n" " %*s [-m mem] [-p vcpu:hostcpu] [-s ] [-U uuid] \n" " -a: local apic is in xAPIC mode (deprecated)\n" " -A: create ACPI tables\n" - " -c: # cpus (default 1)\n" + " -c: number of cpus and/or topology specification\n" " -C: include guest memory in core file\n" " -e: exit on unhandled I/O access\n" " -g: gdb port\n" @@ -229,7 +234,8 @@ usage(int code) " -W: force virtio to use single-vector MSI\n" " -x: local apic is in x2APIC mode\n" " -Y: disable MPtable generation\n", - progname, (int)strlen(progname), ""); + progname, (int)strlen(progname), "", (int)strlen(progname), "", + (int)strlen(progname), ""); exit(code); } @@ -271,7 +277,95 @@ bhyve_caph_limit_stdoe(void) #endif +/* + * XXX This parser is known to have the following issues: + * 1. It accepts null key=value tokens ",,". + * 2. It accepts whitespace after = and before value. + * 3. Values out of range of INT are silently wrapped. + * 4. It doesn't check non-final values. + * 5. The apparently bogus limits of UINT16_MAX are for future expansion. + * + * The acceptance of a null specification ('-c ""') is by design to match the + * manual page syntax specification, this results in a topology of 1 vCPU. + */ static int +topology_parse(const char *opt) +{ + uint64_t ncpus; + int c, chk, n, s, t, tmp; + char *cp, *str; + bool ns, scts; + + c = 1, n = 1, s = 1, t = 1; + ns = false, scts = false; + str = strdup(opt); + if (str == NULL) + goto out; + + while ((cp = strsep(&str, ",")) != NULL) { + if (sscanf(cp, "%i%n", &tmp, &chk) == 1) { + n = tmp; + ns = true; + } else if (sscanf(cp, "cpus=%i%n", &tmp, &chk) == 1) { + n = tmp; + ns = true; + } else if (sscanf(cp, "sockets=%i%n", &tmp, &chk) == 1) { + s = tmp; + scts = true; + } else if (sscanf(cp, "cores=%i%n", &tmp, &chk) == 1) { + c = tmp; + scts = true; + } else if (sscanf(cp, "threads=%i%n", &tmp, &chk) == 1) { + t = tmp; + scts = true; +#ifdef notyet /* Do not expose this until vmm.ko implements it */ + } else if (sscanf(cp, "maxcpus=%i%n", &tmp, &chk) == 1) { + m = tmp; +#endif + /* Skip the empty argument case from -c "" */ + } else if (cp[0] == '\0') + continue; + else + goto out; + /* Any trailing garbage causes an error */ + if (cp[chk] != '\0') + goto out; + } + free(str); + str = NULL; + + /* + * Range check 1 <= n <= UINT16_MAX all values + */ + if (n < 1 || s < 1 || c < 1 || t < 1 || + n > UINT16_MAX || s > UINT16_MAX || c > UINT16_MAX || + t > UINT16_MAX) + return (-1); + + /* If only the cpus was specified, use that as sockets */ + if (!scts) + s = n; + /* + * Compute sockets * cores * threads avoiding overflow + * The range check above insures these are 16 bit values + * If n was specified check it against computed ncpus + */ + ncpus = (uint64_t)s * c * t; + if (ncpus > UINT16_MAX || (ns && n != ncpus)) + return (-1); + + guest_ncpus = ncpus; + sockets = s; + cores = c; + threads = t; + return(0); + +out: + free(str); + return (-1); +} + +static int pincpu_parse(const char *opt) { int vcpu, pcpu; @@ -899,6 +993,9 @@ do_open(const char *vmname) exit(4); } } + error = vm_set_topology(ctx, sockets, cores, threads, maxcpus); + if (error) + errx(EX_OSERR, "vm_set_topology"); return (ctx); } @@ -917,6 +1014,8 @@ main(int argc, char *argv[]) progname = basename(argv[0]); gdb_port = 0; guest_ncpus = 1; + sockets = cores = threads = 1; + maxcpus = 0; memsize = 256 * MB; mptgen = 1; rtc_localtime = 1; @@ -941,7 +1040,10 @@ main(int argc, char *argv[]) } break; case 'c': - guest_ncpus = atoi(optarg); + if (topology_parse(optarg) != 0) { + errx(EX_USAGE, "invalid cpu topology " + "'%s'", optarg); + } break; case 'C': memflags |= VM_MEM_F_INCORE; @@ -1018,11 +1120,6 @@ main(int argc, char *argv[]) vmname = argv[0]; ctx = do_open(vmname); - - if (guest_ncpus < 1) { - fprintf(stderr, "Invalid guest vCPUs (%d)\n", guest_ncpus); - exit(1); - } max_vcpus = num_vcpus_allowed(ctx); if (guest_ncpus > max_vcpus) { Modified: stable/11/usr.sbin/bhyvectl/bhyvectl.c ============================================================================== --- stable/11/usr.sbin/bhyvectl/bhyvectl.c Thu May 23 21:05:05 2019 (r348200) +++ stable/11/usr.sbin/bhyvectl/bhyvectl.c Thu May 23 21:23:18 2019 (r348201) @@ -191,7 +191,8 @@ usage(bool cpu_intel) " [--get-msr-bitmap]\n" " [--get-msr-bitmap-address]\n" " [--get-guest-sysenter]\n" - " [--get-exit-reason]\n", + " [--get-exit-reason]\n" + " [--get-cpu-topology]\n", progname); if (cpu_intel) { @@ -285,6 +286,7 @@ static int set_x2apic_state, get_x2apic_state; enum x2apic_state x2apic_state; static int unassign_pptdev, bus, slot, func; static int run; +static int get_cpu_topology; /* * VMCB specific. @@ -1456,6 +1458,7 @@ setup_options(bool cpu_intel) { "get-active-cpus", NO_ARG, &get_active_cpus, 1 }, { "get-suspended-cpus", NO_ARG, &get_suspended_cpus, 1 }, { "get-intinfo", NO_ARG, &get_intinfo, 1 }, + { "get-cpu-topology", NO_ARG, &get_cpu_topology, 1 }, }; const struct option intel_opts[] = { @@ -2310,6 +2313,14 @@ main(int argc, char *argv[]) printf("%-40s\t%ld\n", desc, stats[i]); } } + } + + if (!error && (get_cpu_topology || get_all)) { + uint16_t sockets, cores, threads, maxcpus; + + vm_get_topology(ctx, &sockets, &cores, &threads, &maxcpus); + printf("cpu_topology:\tsockets=%hu, cores=%hu, threads=%hu, " + "maxcpus=%hu\n", sockets, cores, threads, maxcpus); } if (!error && run) { From owner-svn-src-stable-11@freebsd.org Fri May 24 00:00:30 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BFDF15B9BAA; Fri, 24 May 2019 00:00:30 +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 D0DBC69A86; Fri, 24 May 2019 00:00:29 +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 AA0F9CA58; Fri, 24 May 2019 00:00:29 +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 x4O00TDv046334; Fri, 24 May 2019 00:00:29 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4O00T9h046333; Fri, 24 May 2019 00:00:29 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201905240000.x4O00T9h046333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 24 May 2019 00:00:29 +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: r348211 - stable/11/sys/conf X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/sys/conf X-SVN-Commit-Revision: 348211 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D0DBC69A86 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 00:00:30 -0000 Author: gjb Date: Fri May 24 00:00:29 2019 New Revision: 348211 URL: https://svnweb.freebsd.org/changeset/base/348211 Log: Update stable/11 to BETA1 as part of the 11.3-RELEASE cycle. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/conf/newvers.sh Modified: stable/11/sys/conf/newvers.sh ============================================================================== --- stable/11/sys/conf/newvers.sh Thu May 23 23:37:11 2019 (r348210) +++ stable/11/sys/conf/newvers.sh Fri May 24 00:00:29 2019 (r348211) @@ -44,7 +44,7 @@ TYPE="FreeBSD" REVISION="11.3" -BRANCH="PRERELEASE" +BRANCH="BETA1" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-stable-11@freebsd.org Sat May 25 00:22:08 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FA5215B8C5D; Sat, 25 May 2019 00:22:08 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2AF7586080; Sat, 25 May 2019 00:22:08 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 04489246E1; Sat, 25 May 2019 00:22:08 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4P0M7i2027599; Sat, 25 May 2019 00:22:07 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4P0M77A027598; Sat, 25 May 2019 00:22:07 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201905250022.x4P0M77A027598@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Sat, 25 May 2019 00:22: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: r348260 - stable/11/sbin/fsck_ffs X-SVN-Group: stable-11 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/11/sbin/fsck_ffs X-SVN-Commit-Revision: 348260 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2AF7586080 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 May 2019 00:22:08 -0000 Author: mckusick Date: Sat May 25 00:22:07 2019 New Revision: 348260 URL: https://svnweb.freebsd.org/changeset/base/348260 Log: MFC of 348074 Rewrite fsck_readdir() and dircheck() for clarity and correctness. Approved by: re (gjb) Modified: stable/11/sbin/fsck_ffs/dir.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/fsck_ffs/dir.c ============================================================================== --- stable/11/sbin/fsck_ffs/dir.c Sat May 25 00:07:49 2019 (r348259) +++ stable/11/sbin/fsck_ffs/dir.c Sat May 25 00:22:07 2019 (r348260) @@ -59,7 +59,7 @@ static struct dirtemplate dirhead = { }; static int chgino(struct inodesc *); -static int dircheck(struct inodesc *, struct direct *); +static int dircheck(struct inodesc *, struct bufarea *, struct direct *); static int expanddir(union dinode *dp, char *name); static void freedir(ino_t ino, ino_t parent); static struct direct *fsck_readdir(struct inodesc *); @@ -137,78 +137,70 @@ dirscan(struct inodesc *idesc) } /* - * get next entry in a directory. + * Get and verify the next entry in a directory. + * We also verify that if there is another entry in the block that it is + * valid, so if it is not valid it can be subsumed into the current entry. */ static struct direct * fsck_readdir(struct inodesc *idesc) { struct direct *dp, *ndp; struct bufarea *bp; - long size, blksiz, fix, dploc; - int dc; + long size, blksiz, subsume_ndp; + subsume_ndp = 0; blksiz = idesc->id_numfrags * sblock.fs_fsize; + if (idesc->id_filesize <= 0 || idesc->id_loc >= blksiz) + return (NULL); bp = getdirblk(idesc->id_blkno, blksiz); - if (idesc->id_loc % DIRBLKSIZ == 0 && idesc->id_filesize > 0 && - idesc->id_loc < blksiz) { - dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); - if ((dc = dircheck(idesc, dp)) > 0) { - if (dc == 2) { - /* - * dircheck() cleared unused directory space. - * Mark the buffer as dirty to write it out. - */ - dirty(bp); - } - goto dpok; - } - if (idesc->id_fix == IGNORE) - return (0); - fix = dofix(idesc, "DIRECTORY CORRUPTED"); - bp = getdirblk(idesc->id_blkno, blksiz); - dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); - dp->d_reclen = DIRBLKSIZ; - dp->d_ino = 0; - dp->d_type = 0; - dp->d_namlen = 0; - dp->d_name[0] = '\0'; - if (fix) - dirty(bp); - idesc->id_loc += DIRBLKSIZ; - idesc->id_filesize -= DIRBLKSIZ; - return (dp); + dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); + /* + * Only need to check current entry if it is the first in the + * the block, as later entries will have been checked in the + * previous call to this function. + */ + if (idesc->id_loc % DIRBLKSIZ != 0 || dircheck(idesc, bp, dp) != 0) { + /* + * Current entry is good, update to point at next. + */ + idesc->id_loc += dp->d_reclen; + idesc->id_filesize -= dp->d_reclen; + /* + * If at end of directory block, just return this entry. + */ + if (idesc->id_filesize <= 0 || idesc->id_loc >= blksiz || + idesc->id_loc % DIRBLKSIZ == 0) + return (dp); + /* + * If the next entry good, return this entry. + */ + ndp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); + if (dircheck(idesc, bp, ndp) != 0) + return (dp); + /* + * The next entry is bad, so subsume it and the remainder + * of this directory block into this entry. + */ + subsume_ndp = 1; } -dpok: - if (idesc->id_filesize <= 0 || idesc->id_loc >= blksiz) - return NULL; - dploc = idesc->id_loc; - dp = (struct direct *)(bp->b_un.b_buf + dploc); - idesc->id_loc += dp->d_reclen; - idesc->id_filesize -= dp->d_reclen; - if ((idesc->id_loc % DIRBLKSIZ) == 0) - return (dp); - ndp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); - if (idesc->id_loc < blksiz && idesc->id_filesize > 0) { - if ((dc = dircheck(idesc, ndp)) == 0) { - size = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ); - idesc->id_loc += size; - idesc->id_filesize -= size; - if (idesc->id_fix == IGNORE) - return (0); - fix = dofix(idesc, "DIRECTORY CORRUPTED"); - bp = getdirblk(idesc->id_blkno, blksiz); - dp = (struct direct *)(bp->b_un.b_buf + dploc); - dp->d_reclen += size; - if (fix) - dirty(bp); - } else if (dc == 2) { - /* - * dircheck() cleared unused directory space. - * Mark the buffer as dirty to write it out. - */ - dirty(bp); - } + /* + * Current or next entry is bad. Zap current entry or + * subsume next entry into current entry as appropriate. + */ + size = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ); + idesc->id_loc += size; + idesc->id_filesize -= size; + if (idesc->id_fix == IGNORE) + return (NULL); + if (subsume_ndp) { + memset(ndp, 0, size); + dp->d_reclen += size; + } else { + memset(dp, 0, size); + dp->d_reclen = size; } + if (dofix(idesc, "DIRECTORY CORRUPTED")) + dirty(bp); return (dp); } @@ -217,65 +209,80 @@ dpok: * This is a superset of the checks made in the kernel. * Also optionally clears padding and unused directory space. * - * Returns 0 if the entry is bad, 1 if the entry is good and no changes - * were made, and 2 if the entry is good but modified to clear out padding - * and unused space and needs to be written back to disk. + * Returns 0 if the entry is bad, 1 if the entry is good. */ static int -dircheck(struct inodesc *idesc, struct direct *dp) +dircheck(struct inodesc *idesc, struct bufarea *bp, struct direct *dp) { size_t size; char *cp; - u_char type; u_int8_t namlen; int spaceleft, modified, unused; - modified = 0; spaceleft = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ); + size = DIRSIZ(0, dp); if (dp->d_reclen == 0 || dp->d_reclen > spaceleft || + dp->d_reclen < size || + idesc->id_filesize < size || (dp->d_reclen & (DIR_ROUNDUP - 1)) != 0) goto bad; + modified = 0; if (dp->d_ino == 0) { + if (!zflag || fswritefd < 0) + return (1); /* - * Special case of an unused directory entry. Normally - * the kernel would coalesce unused space with the previous - * entry by extending its d_reclen, but there are situations - * (e.g. fsck) where that doesn't occur. - * If we're clearing out directory cruft (-z flag), then make - * sure this entry gets fully cleared as well. + * Special case of an unused directory entry. Normally only + * occurs at the beginning of a directory block when the block + * contains no entries. Other than the first entry in a + * directory block, the kernel coalesces unused space with + * the previous entry by extending its d_reclen. However, + * when cleaning up a directory, fsck may set d_ino to zero + * in the middle of a directory block. If we're clearing out + * directory cruft (-z flag), then make sure that all directory + * space in entries with d_ino == 0 gets fully cleared. */ - if (zflag && fswritefd >= 0) { - if (dp->d_type != 0) { - dp->d_type = 0; + if (dp->d_type != 0) { + dp->d_type = 0; + modified = 1; + } + if (dp->d_namlen != 0) { + dp->d_namlen = 0; + modified = 1; + } + unused = dp->d_reclen - __offsetof(struct direct, d_name); + for (cp = dp->d_name; unused > 0; unused--, cp++) { + if (*cp != '\0') { + *cp = '\0'; modified = 1; } - if (dp->d_namlen != 0) { - dp->d_namlen = 0; - modified = 1; - } - if (dp->d_name[0] != '\0') { - dp->d_name[0] = '\0'; - modified = 1; - } } - goto good; + if (modified) + dirty(bp); + return (1); } - size = DIRSIZ(0, dp); + /* + * The d_type field should not be tested here. A bad type is an error + * in the entry itself but is not a corruption of the directory + * structure itself. So blowing away all the remaining entries in the + * directory block is inappropriate. Rather the type error should be + * checked in pass1 and fixed there. + * + * The name validation should also be done in pass1 although the + * check to see if the name is longer than fits in the space + * allocated for it (i.e., the *cp != '\0' fails after exiting the + * loop below) then it really is a structural error that requires + * the stronger action taken here. + */ namlen = dp->d_namlen; - type = dp->d_type; - if (dp->d_reclen < size || - idesc->id_filesize < size || - namlen == 0 || - type > 15) + if (namlen == 0 || dp->d_type > 15) goto bad; - for (cp = dp->d_name, size = 0; size < namlen; size++) - if (*cp == '\0' || (*cp++ == '/')) + for (cp = dp->d_name, size = 0; size < namlen; size++) { + if (*cp == '\0' || *cp++ == '/') goto bad; + } if (*cp != '\0') goto bad; - -good: if (zflag && fswritefd >= 0) { /* * Clear unused directory entry space, including the d_name @@ -298,11 +305,9 @@ good: } } - if (modified) { - return 2; - } + if (modified) + dirty(bp); } - return (1); bad: From owner-svn-src-stable-11@freebsd.org Sat May 25 01:58:02 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0CC315BA64E; Sat, 25 May 2019 01:58:01 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9347988CAB; Sat, 25 May 2019 01:58:01 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 547D82562A; Sat, 25 May 2019 01:58:01 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4P1w1Es077029; Sat, 25 May 2019 01:58:01 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4P1w0L6077023; Sat, 25 May 2019 01:58:00 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201905250158.x4P1w0L6077023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 25 May 2019 01:58:00 +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: r348261 - in stable/11: contrib/zlib lib/libz stand/libsa usr.bin/minigzip X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/11: contrib/zlib lib/libz stand/libsa usr.bin/minigzip X-SVN-Commit-Revision: 348261 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9347988CAB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.984,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 May 2019 01:58:02 -0000 Author: delphij Date: Sat May 25 01:58:00 2019 New Revision: 348261 URL: https://svnweb.freebsd.org/changeset/base/348261 Log: MFC r347244: Move contrib/zlib to sys/contrib/zlib so that we can use it in kernel. This is a prerequisite of unifying kernel zlib instances. Submitted by: Yoshihiro Ota Approved by: re (kib) Added: - copied from r347244, head/sys/contrib/zlib/ Directory Properties: stable/11/sys/contrib/zlib/ (props changed) Deleted: stable/11/contrib/zlib/ Modified: stable/11/lib/libz/FREEBSD-upgrade stable/11/lib/libz/Makefile stable/11/stand/libsa/Makefile stable/11/usr.bin/minigzip/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libz/FREEBSD-upgrade ============================================================================== --- stable/11/lib/libz/FREEBSD-upgrade Sat May 25 00:22:07 2019 (r348260) +++ stable/11/lib/libz/FREEBSD-upgrade Sat May 25 01:58:00 2019 (r348261) @@ -8,7 +8,7 @@ benefit other consumers. To Update: 1) Unpack vendor sources into a clean directory. 2) Import onto the vendor area. - 3) Merge the vendor tree to contrib/zlib, which contains a stripped down + 3) Merge the vendor tree to sys/contrib/zlib, which contains a stripped down version of upstream source, resolve any conflicts. 4) Double check zconf.h, zlib.pc, and Symbol.map to make sure that we have the required changes. Test universe and commit them. Modified: stable/11/lib/libz/Makefile ============================================================================== --- stable/11/lib/libz/Makefile Sat May 25 00:22:07 2019 (r348260) +++ stable/11/lib/libz/Makefile Sat May 25 01:58:00 2019 (r348261) @@ -8,7 +8,7 @@ SHLIBDIR?= /lib SHLIB_MAJOR= 6 MAN= zlib.3 zopen.3 -ZLIBSRC= ${SRCTOP}/contrib/zlib +ZLIBSRC= ${SRCTOP}/sys/contrib/zlib .PATH: ${ZLIBSRC} Modified: stable/11/stand/libsa/Makefile ============================================================================== --- stable/11/stand/libsa/Makefile Sat May 25 00:22:07 2019 (r348260) +++ stable/11/stand/libsa/Makefile Sat May 25 01:58:00 2019 (r348261) @@ -99,8 +99,8 @@ CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS SRCS+=bzlib.c crctable.c decompress.c huffman.c randtable.c # decompression functionality from zlib -.PATH: ${SRCTOP}/contrib/zlib -CFLAGS+=-DHAVE_MEMCPY -I${SRCTOP}/contrib/zlib +.PATH: ${SRCTOP}/sys/contrib/zlib +CFLAGS+=-DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib SRCS+= adler32.c crc32.c SRCS+= infback.c inffast.c inflate.c inftrees.c zutil.c Modified: stable/11/usr.bin/minigzip/Makefile ============================================================================== --- stable/11/usr.bin/minigzip/Makefile Sat May 25 00:22:07 2019 (r348260) +++ stable/11/usr.bin/minigzip/Makefile Sat May 25 01:58:00 2019 (r348261) @@ -1,6 +1,6 @@ # $FreeBSD$ -SRCDIR= ${SRCTOP}/contrib/zlib/test +SRCDIR= ${SRCTOP}/sys/contrib/zlib/test .PATH: ${SRCDIR} PROG= minigzip From owner-svn-src-stable-11@freebsd.org Sat May 25 10:17:05 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E662015A8855; Sat, 25 May 2019 10:17:04 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7DE7C6AD8B; Sat, 25 May 2019 10:17:04 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53D622BF8; Sat, 25 May 2019 10:17:04 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4PAH4sb045315; Sat, 25 May 2019 10:17:04 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4PAH3dR045312; Sat, 25 May 2019 10:17:03 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201905251017.x4PAH3dR045312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Sat, 25 May 2019 10:17:03 +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: r348269 - stable/11/usr.sbin/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: stable/11/usr.sbin/bhyve X-SVN-Commit-Revision: 348269 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7DE7C6AD8B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 May 2019 10:17:05 -0000 Author: rgrimes Date: Sat May 25 10:17:03 2019 New Revision: 348269 URL: https://svnweb.freebsd.org/changeset/base/348269 Log: MFC: r346717: Make bhyve SMBIOS table topology aware When the CPU Topology was added to bhyve in r332298 the SMBIOS table was missed, this table passes topology information to the system and was still using the old concept of each vCPU is a socket with 1 core and 1 thread. This code did not even try to use the old sysctl information to adjust this data. Correct that by building a proper SMBios table, mapping the > 254 cases to 0 per the SMBios 2.6 specification that is claimed by the structure. Approved by: re (kib) Modified: stable/11/usr.sbin/bhyve/bhyverun.h stable/11/usr.sbin/bhyve/smbiostbl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/bhyverun.h ============================================================================== --- stable/11/usr.sbin/bhyve/bhyverun.h Sat May 25 07:26:30 2019 (r348268) +++ stable/11/usr.sbin/bhyve/bhyverun.h Sat May 25 10:17:03 2019 (r348269) @@ -36,6 +36,7 @@ struct vmctx; extern int guest_ncpus; +extern uint16_t cores, sockets, threads; extern char *guest_uuid_str; extern char *vmname; Modified: stable/11/usr.sbin/bhyve/smbiostbl.c ============================================================================== --- stable/11/usr.sbin/bhyve/smbiostbl.c Sat May 25 07:26:30 2019 (r348268) +++ stable/11/usr.sbin/bhyve/smbiostbl.c Sat May 25 10:17:03 2019 (r348269) @@ -636,7 +636,7 @@ smbios_type4_initializer(struct smbios_structure *temp { int i; - for (i = 0; i < guest_ncpus; i++) { + for (i = 0; i < sockets; i++) { struct smbios_table_type4 *type4; char *p; int nstrings, len; @@ -655,6 +655,16 @@ smbios_type4_initializer(struct smbios_structure *temp *(*endaddr) = '\0'; (*endaddr)++; type4->socket = nstrings + 1; + /* Revise cores and threads after update to smbios 3.0 */ + if (cores > 254) + type4->cores = 0; + else + type4->cores = cores; + /* This threads is total threads in a socket */ + if ((cores * threads) > 254) + type4->threads = 0; + else + type4->threads = (cores * threads); curaddr = *endaddr; } From owner-svn-src-stable-11@freebsd.org Sat May 25 11:27:58 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9444C15AA1A2; Sat, 25 May 2019 11:27:58 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 393506D371; Sat, 25 May 2019 11:27:58 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1914539A7; Sat, 25 May 2019 11:27:58 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4PBRvad082945; Sat, 25 May 2019 11:27:57 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4PBRuYu082936; Sat, 25 May 2019 11:27:56 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201905251127.x4PBRuYu082936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Sat, 25 May 2019 11:27:56 +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: r348271 - in stable/11/sys/amd64: include vmm vmm/amd vmm/intel vmm/io X-SVN-Group: stable-11 X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: in stable/11/sys/amd64: include vmm vmm/amd vmm/intel vmm/io X-SVN-Commit-Revision: 348271 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 393506D371 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.948,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 May 2019 11:27:58 -0000 Author: rgrimes Date: Sat May 25 11:27:56 2019 New Revision: 348271 URL: https://svnweb.freebsd.org/changeset/base/348271 Log: MFC: r346714: Add accessor function for vm->maxcpus Replace most VM_MAXCPU constant useses with an accessor function to vm->maxcpus which for now is initialized and kept at the value of VM_MAXCPUS. This is a rework of Fabian Freyer (fabian.freyer_physik.tu-berlin.de) work from D10070 to adjust it for the cpu topology changes that occured in r332298 Approved by: re (kib) Modified: stable/11/sys/amd64/include/vmm.h stable/11/sys/amd64/vmm/amd/svm.c stable/11/sys/amd64/vmm/intel/vmx.c stable/11/sys/amd64/vmm/io/vlapic.c stable/11/sys/amd64/vmm/vmm.c stable/11/sys/amd64/vmm/vmm_dev.c stable/11/sys/amd64/vmm/vmm_lapic.c stable/11/sys/amd64/vmm/vmm_stat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/include/vmm.h ============================================================================== --- stable/11/sys/amd64/include/vmm.h Sat May 25 11:22:49 2019 (r348270) +++ stable/11/sys/amd64/include/vmm.h Sat May 25 11:27:56 2019 (r348271) @@ -184,6 +184,7 @@ int vm_create(const char *name, struct vm **retvm); void vm_destroy(struct vm *vm); int vm_reinit(struct vm *vm); const char *vm_name(struct vm *vm); +uint16_t vm_get_maxcpus(struct vm *vm); void vm_get_topology(struct vm *vm, uint16_t *sockets, uint16_t *cores, uint16_t *threads, uint16_t *maxcpus); int vm_set_topology(struct vm *vm, uint16_t sockets, uint16_t cores, Modified: stable/11/sys/amd64/vmm/amd/svm.c ============================================================================== --- stable/11/sys/amd64/vmm/amd/svm.c Sat May 25 11:22:49 2019 (r348270) +++ stable/11/sys/amd64/vmm/amd/svm.c Sat May 25 11:27:56 2019 (r348271) @@ -524,6 +524,7 @@ svm_vminit(struct vm *vm, pmap_t pmap) struct svm_vcpu *vcpu; vm_paddr_t msrpm_pa, iopm_pa, pml4_pa; int i; + uint16_t maxcpus; svm_sc = malloc(sizeof (*svm_sc), M_SVM, M_WAITOK | M_ZERO); if (((uintptr_t)svm_sc & PAGE_MASK) != 0) @@ -577,7 +578,8 @@ svm_vminit(struct vm *vm, pmap_t pmap) iopm_pa = vtophys(svm_sc->iopm_bitmap); msrpm_pa = vtophys(svm_sc->msr_bitmap); pml4_pa = svm_sc->nptp; - for (i = 0; i < VM_MAXCPU; i++) { + maxcpus = vm_get_maxcpus(svm_sc->vm); + for (i = 0; i < maxcpus; i++) { vcpu = svm_get_vcpu(svm_sc, i); vcpu->nextrip = ~0; vcpu->lastcpu = NOCPU; Modified: stable/11/sys/amd64/vmm/intel/vmx.c ============================================================================== --- stable/11/sys/amd64/vmm/intel/vmx.c Sat May 25 11:22:49 2019 (r348270) +++ stable/11/sys/amd64/vmm/intel/vmx.c Sat May 25 11:27:56 2019 (r348271) @@ -941,6 +941,7 @@ vmx_vminit(struct vm *vm, pmap_t pmap) struct vmx *vmx; struct vmcs *vmcs; uint32_t exc_bitmap; + uint16_t maxcpus; vmx = malloc(sizeof(struct vmx), M_VMX, M_WAITOK | M_ZERO); if ((uintptr_t)vmx & PAGE_MASK) { @@ -1002,7 +1003,8 @@ vmx_vminit(struct vm *vm, pmap_t pmap) KASSERT(error == 0, ("vm_map_mmio(apicbase) error %d", error)); } - for (i = 0; i < VM_MAXCPU; i++) { + maxcpus = vm_get_maxcpus(vm); + for (i = 0; i < maxcpus; i++) { vmcs = &vmx->vmcs[i]; vmcs->identifier = vmx_revision(); error = vmclear(vmcs); @@ -2994,11 +2996,13 @@ vmx_vmcleanup(void *arg) { int i; struct vmx *vmx = arg; + uint16_t maxcpus; if (apic_access_virtualization(vmx, 0)) vm_unmap_mmio(vmx->vm, DEFAULT_APIC_BASE, PAGE_SIZE); - for (i = 0; i < VM_MAXCPU; i++) + maxcpus = vm_get_maxcpus(vmx->vm); + for (i = 0; i < maxcpus; i++) vpid_free(vmx->state[i].vpid); free(vmx, M_VMX); Modified: stable/11/sys/amd64/vmm/io/vlapic.c ============================================================================== --- stable/11/sys/amd64/vmm/io/vlapic.c Sat May 25 11:22:49 2019 (r348270) +++ stable/11/sys/amd64/vmm/io/vlapic.c Sat May 25 11:27:56 2019 (r348271) @@ -836,7 +836,7 @@ vlapic_calcdest(struct vm *vm, cpuset_t *dmask, uint32 */ CPU_ZERO(dmask); vcpuid = vm_apicid2vcpuid(vm, dest); - if (vcpuid < VM_MAXCPU) + if (vcpuid < vm_get_maxcpus(vm)) CPU_SET(vcpuid, dmask); } else { /* @@ -963,6 +963,7 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool struct vlapic *vlapic2; struct vm_exit *vmexit; struct LAPIC *lapic; + uint16_t maxcpus; lapic = vlapic->apic_page; lapic->icr_lo &= ~APIC_DELSTAT_PEND; @@ -1024,11 +1025,12 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool return (0); /* handled completely in the kernel */ } + maxcpus = vm_get_maxcpus(vlapic->vm); if (mode == APIC_DELMODE_INIT) { if ((icrval & APIC_LEVEL_MASK) == APIC_LEVEL_DEASSERT) return (0); - if (vlapic->vcpuid == 0 && dest != 0 && dest < VM_MAXCPU) { + if (vlapic->vcpuid == 0 && dest != 0 && dest < maxcpus) { vlapic2 = vm_lapic(vlapic->vm, dest); /* move from INIT to waiting-for-SIPI state */ @@ -1041,7 +1043,7 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool } if (mode == APIC_DELMODE_STARTUP) { - if (vlapic->vcpuid == 0 && dest != 0 && dest < VM_MAXCPU) { + if (vlapic->vcpuid == 0 && dest != 0 && dest < maxcpus) { vlapic2 = vm_lapic(vlapic->vm, dest); /* @@ -1445,7 +1447,8 @@ void vlapic_init(struct vlapic *vlapic) { KASSERT(vlapic->vm != NULL, ("vlapic_init: vm is not initialized")); - KASSERT(vlapic->vcpuid >= 0 && vlapic->vcpuid < VM_MAXCPU, + KASSERT(vlapic->vcpuid >= 0 && + vlapic->vcpuid < vm_get_maxcpus(vlapic->vm), ("vlapic_init: vcpuid is not initialized")); KASSERT(vlapic->apic_page != NULL, ("vlapic_init: apic_page is not " "initialized")); Modified: stable/11/sys/amd64/vmm/vmm.c ============================================================================== --- stable/11/sys/amd64/vmm/vmm.c Sat May 25 11:22:49 2019 (r348270) +++ stable/11/sys/amd64/vmm/vmm.c Sat May 25 11:27:56 2019 (r348271) @@ -273,7 +273,7 @@ vcpu_init(struct vm *vm, int vcpu_id, bool create) { struct vcpu *vcpu; - KASSERT(vcpu_id >= 0 && vcpu_id < VM_MAXCPU, + KASSERT(vcpu_id >= 0 && vcpu_id < vm->maxcpus, ("vcpu_init: invalid vcpu %d", vcpu_id)); vcpu = &vm->vcpu[vcpu_id]; @@ -312,7 +312,7 @@ vm_exitinfo(struct vm *vm, int cpuid) { struct vcpu *vcpu; - if (cpuid < 0 || cpuid >= VM_MAXCPU) + if (cpuid < 0 || cpuid >= vm->maxcpus) panic("vm_exitinfo: invalid cpuid %d", cpuid); vcpu = &vm->vcpu[cpuid]; @@ -424,7 +424,7 @@ vm_init(struct vm *vm, bool create) vm->suspend = 0; CPU_ZERO(&vm->suspended_cpus); - for (i = 0; i < VM_MAXCPU; i++) + for (i = 0; i < vm->maxcpus; i++) vcpu_init(vm, i, create); } @@ -462,7 +462,7 @@ vm_create(const char *name, struct vm **retvm) vm->sockets = 1; vm->cores = cores_per_package; /* XXX backwards compatibility */ vm->threads = threads_per_core; /* XXX backwards compatibility */ - vm->maxcpus = 0; /* XXX not implemented */ + vm->maxcpus = VM_MAXCPU; /* XXX temp to keep code working */ vm_init(vm, true); @@ -480,19 +480,25 @@ vm_get_topology(struct vm *vm, uint16_t *sockets, uint *maxcpus = vm->maxcpus; } +uint16_t +vm_get_maxcpus(struct vm *vm) +{ + return (vm->maxcpus); +} + int vm_set_topology(struct vm *vm, uint16_t sockets, uint16_t cores, uint16_t threads, uint16_t maxcpus) { if (maxcpus != 0) return (EINVAL); /* XXX remove when supported */ - if ((sockets * cores * threads) > VM_MAXCPU) + if ((sockets * cores * threads) > vm->maxcpus) return (EINVAL); /* XXX need to check sockets * cores * threads == vCPU, how? */ vm->sockets = sockets; vm->cores = cores; vm->threads = threads; - vm->maxcpus = maxcpus; + vm->maxcpus = VM_MAXCPU; /* XXX temp to keep code working */ return(0); } @@ -517,7 +523,7 @@ vm_cleanup(struct vm *vm, bool destroy) vatpic_cleanup(vm->vatpic); vioapic_cleanup(vm->vioapic); - for (i = 0; i < VM_MAXCPU; i++) + for (i = 0; i < vm->maxcpus; i++) vcpu_cleanup(vm, i, destroy); VMCLEANUP(vm->cookie); @@ -952,9 +958,9 @@ vm_gpa_hold(struct vm *vm, int vcpuid, vm_paddr_t gpa, * guaranteed if at least one vcpu is in the VCPU_FROZEN state. */ int state; - KASSERT(vcpuid >= -1 && vcpuid < VM_MAXCPU, ("%s: invalid vcpuid %d", + KASSERT(vcpuid >= -1 && vcpuid < vm->maxcpus, ("%s: invalid vcpuid %d", __func__, vcpuid)); - for (i = 0; i < VM_MAXCPU; i++) { + for (i = 0; i < vm->maxcpus; i++) { if (vcpuid != -1 && vcpuid != i) continue; state = vcpu_get_state(vm, i, NULL); @@ -1000,7 +1006,7 @@ int vm_get_register(struct vm *vm, int vcpu, int reg, uint64_t *retval) { - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm->maxcpus) return (EINVAL); if (reg >= VM_REG_LAST) @@ -1015,7 +1021,7 @@ vm_set_register(struct vm *vm, int vcpuid, int reg, ui struct vcpu *vcpu; int error; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); if (reg >= VM_REG_LAST) @@ -1069,7 +1075,7 @@ vm_get_seg_desc(struct vm *vm, int vcpu, int reg, struct seg_desc *desc) { - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm->maxcpus) return (EINVAL); if (!is_segment_register(reg) && !is_descriptor_table(reg)) @@ -1082,7 +1088,7 @@ int vm_set_seg_desc(struct vm *vm, int vcpu, int reg, struct seg_desc *desc) { - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm->maxcpus) return (EINVAL); if (!is_segment_register(reg) && !is_descriptor_table(reg)) @@ -1254,7 +1260,7 @@ static void vm_handle_rendezvous(struct vm *vm, int vcpuid) { - KASSERT(vcpuid == -1 || (vcpuid >= 0 && vcpuid < VM_MAXCPU), + KASSERT(vcpuid == -1 || (vcpuid >= 0 && vcpuid < vm->maxcpus), ("vm_handle_rendezvous: invalid vcpuid %d", vcpuid)); mtx_lock(&vm->rendezvous_mtx); @@ -1530,7 +1536,7 @@ vm_handle_suspend(struct vm *vm, int vcpuid, bool *ret /* * Wakeup the other sleeping vcpus and return to userspace. */ - for (i = 0; i < VM_MAXCPU; i++) { + for (i = 0; i < vm->maxcpus; i++) { if (CPU_ISSET(i, &vm->suspended_cpus)) { vcpu_notify_event(vm, i, false); } @@ -1572,7 +1578,7 @@ vm_suspend(struct vm *vm, enum vm_suspend_how how) /* * Notify all active vcpus that they are now suspended. */ - for (i = 0; i < VM_MAXCPU; i++) { + for (i = 0; i < vm->maxcpus; i++) { if (CPU_ISSET(i, &vm->active_cpus)) vcpu_notify_event(vm, i, false); } @@ -1647,7 +1653,7 @@ vm_run(struct vm *vm, struct vm_run *vmrun) vcpuid = vmrun->cpuid; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); if (!CPU_ISSET(vcpuid, &vm->active_cpus)) @@ -1748,7 +1754,7 @@ vm_restart_instruction(void *arg, int vcpuid) int error; vm = arg; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); vcpu = &vm->vcpu[vcpuid]; @@ -1787,7 +1793,7 @@ vm_exit_intinfo(struct vm *vm, int vcpuid, uint64_t in struct vcpu *vcpu; int type, vector; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); vcpu = &vm->vcpu[vcpuid]; @@ -1928,7 +1934,8 @@ vm_entry_intinfo(struct vm *vm, int vcpuid, uint64_t * uint64_t info1, info2; int valid; - KASSERT(vcpuid >= 0 && vcpuid < VM_MAXCPU, ("invalid vcpu %d", vcpuid)); + KASSERT(vcpuid >= 0 && + vcpuid < vm->maxcpus, ("invalid vcpu %d", vcpuid)); vcpu = &vm->vcpu[vcpuid]; @@ -1968,7 +1975,7 @@ vm_get_intinfo(struct vm *vm, int vcpuid, uint64_t *in { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); vcpu = &vm->vcpu[vcpuid]; @@ -1985,7 +1992,7 @@ vm_inject_exception(struct vm *vm, int vcpuid, int vec uint64_t regval; int error; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); if (vector < 0 || vector >= 32) @@ -2076,7 +2083,7 @@ vm_inject_nmi(struct vm *vm, int vcpuid) { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); vcpu = &vm->vcpu[vcpuid]; @@ -2091,7 +2098,7 @@ vm_nmi_pending(struct vm *vm, int vcpuid) { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) panic("vm_nmi_pending: invalid vcpuid %d", vcpuid); vcpu = &vm->vcpu[vcpuid]; @@ -2104,7 +2111,7 @@ vm_nmi_clear(struct vm *vm, int vcpuid) { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) panic("vm_nmi_pending: invalid vcpuid %d", vcpuid); vcpu = &vm->vcpu[vcpuid]; @@ -2123,7 +2130,7 @@ vm_inject_extint(struct vm *vm, int vcpuid) { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); vcpu = &vm->vcpu[vcpuid]; @@ -2138,7 +2145,7 @@ vm_extint_pending(struct vm *vm, int vcpuid) { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) panic("vm_extint_pending: invalid vcpuid %d", vcpuid); vcpu = &vm->vcpu[vcpuid]; @@ -2151,7 +2158,7 @@ vm_extint_clear(struct vm *vm, int vcpuid) { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) panic("vm_extint_pending: invalid vcpuid %d", vcpuid); vcpu = &vm->vcpu[vcpuid]; @@ -2166,7 +2173,7 @@ vm_extint_clear(struct vm *vm, int vcpuid) int vm_get_capability(struct vm *vm, int vcpu, int type, int *retval) { - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm->maxcpus) return (EINVAL); if (type < 0 || type >= VM_CAP_MAX) @@ -2178,7 +2185,7 @@ vm_get_capability(struct vm *vm, int vcpu, int type, i int vm_set_capability(struct vm *vm, int vcpu, int type, int val) { - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm->maxcpus) return (EINVAL); if (type < 0 || type >= VM_CAP_MAX) @@ -2263,7 +2270,7 @@ vcpu_set_state(struct vm *vm, int vcpuid, enum vcpu_st int error; struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) panic("vm_set_run_state: invalid vcpuid %d", vcpuid); vcpu = &vm->vcpu[vcpuid]; @@ -2281,7 +2288,7 @@ vcpu_get_state(struct vm *vm, int vcpuid, int *hostcpu struct vcpu *vcpu; enum vcpu_state state; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) panic("vm_get_run_state: invalid vcpuid %d", vcpuid); vcpu = &vm->vcpu[vcpuid]; @@ -2299,7 +2306,7 @@ int vm_activate_cpu(struct vm *vm, int vcpuid) { - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); if (CPU_ISSET(vcpuid, &vm->active_cpus)) @@ -2334,7 +2341,7 @@ vcpu_stats(struct vm *vm, int vcpuid) int vm_get_x2apic_state(struct vm *vm, int vcpuid, enum x2apic_state *state) { - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); *state = vm->vcpu[vcpuid].x2apic_state; @@ -2345,7 +2352,7 @@ vm_get_x2apic_state(struct vm *vm, int vcpuid, enum x2 int vm_set_x2apic_state(struct vm *vm, int vcpuid, enum x2apic_state state) { - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); if (state >= X2APIC_STATE_LAST) @@ -2432,7 +2439,7 @@ vm_smp_rendezvous(struct vm *vm, int vcpuid, cpuset_t * Enforce that this function is called without any locks */ WITNESS_WARN(WARN_PANIC, NULL, "vm_smp_rendezvous"); - KASSERT(vcpuid == -1 || (vcpuid >= 0 && vcpuid < VM_MAXCPU), + KASSERT(vcpuid == -1 || (vcpuid >= 0 && vcpuid < vm->maxcpus), ("vm_smp_rendezvous: invalid vcpuid %d", vcpuid)); restart: @@ -2462,7 +2469,7 @@ restart: * Wake up any sleeping vcpus and trigger a VM-exit in any running * vcpus so they handle the rendezvous as soon as possible. */ - for (i = 0; i < VM_MAXCPU; i++) { + for (i = 0; i < vm->maxcpus; i++) { if (CPU_ISSET(i, &dest)) vcpu_notify_event(vm, i, false); } Modified: stable/11/sys/amd64/vmm/vmm_dev.c ============================================================================== --- stable/11/sys/amd64/vmm/vmm_dev.c Sat May 25 11:22:49 2019 (r348270) +++ stable/11/sys/amd64/vmm/vmm_dev.c Sat May 25 11:27:56 2019 (r348271) @@ -94,7 +94,7 @@ vcpu_lock_one(struct vmmdev_softc *sc, int vcpu) { int error; - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm_get_maxcpus(sc->vm)) return (EINVAL); error = vcpu_set_state(sc->vm, vcpu, VCPU_FROZEN, true); @@ -119,8 +119,10 @@ static int vcpu_lock_all(struct vmmdev_softc *sc) { int error, vcpu; + uint16_t maxcpus; - for (vcpu = 0; vcpu < VM_MAXCPU; vcpu++) { + maxcpus = vm_get_maxcpus(sc->vm); + for (vcpu = 0; vcpu < maxcpus; vcpu++) { error = vcpu_lock_one(sc, vcpu); if (error) break; @@ -138,8 +140,10 @@ static void vcpu_unlock_all(struct vmmdev_softc *sc) { int vcpu; + uint16_t maxcpus; - for (vcpu = 0; vcpu < VM_MAXCPU; vcpu++) + maxcpus = vm_get_maxcpus(sc->vm); + for (vcpu = 0; vcpu < maxcpus; vcpu++) vcpu_unlock_one(sc, vcpu); } @@ -174,6 +178,7 @@ vmmdev_rw(struct cdev *cdev, struct uio *uio, int flag vm_paddr_t gpa, maxaddr; void *hpa, *cookie; struct vmmdev_softc *sc; + uint16_t lastcpu; sc = vmmdev_lookup2(cdev); if (sc == NULL) @@ -182,7 +187,8 @@ vmmdev_rw(struct cdev *cdev, struct uio *uio, int flag /* * Get a read lock on the guest memory map by freezing any vcpu. */ - error = vcpu_lock_one(sc, VM_MAXCPU - 1); + lastcpu = vm_get_maxcpus(sc->vm) - 1; + error = vcpu_lock_one(sc, lastcpu); if (error) return (error); @@ -201,7 +207,8 @@ vmmdev_rw(struct cdev *cdev, struct uio *uio, int flag * Since this device does not support lseek(2), dd(1) will * read(2) blocks of data to simulate the lseek(2). */ - hpa = vm_gpa_hold(sc->vm, VM_MAXCPU - 1, gpa, c, prot, &cookie); + hpa = vm_gpa_hold(sc->vm, lastcpu, gpa, c, + prot, &cookie); if (hpa == NULL) { if (uio->uio_rw == UIO_READ && gpa < maxaddr) error = uiomove(__DECONST(void *, zero_region), @@ -213,7 +220,7 @@ vmmdev_rw(struct cdev *cdev, struct uio *uio, int flag vm_gpa_release(cookie); } } - vcpu_unlock_one(sc, VM_MAXCPU - 1); + vcpu_unlock_one(sc, lastcpu); return (error); } @@ -377,7 +384,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t da * Lock a vcpu to make sure that the memory map cannot be * modified while it is being inspected. */ - vcpu = VM_MAXCPU - 1; + vcpu = vm_get_maxcpus(sc->vm) - 1; error = vcpu_lock_one(sc, vcpu); if (error) goto done; @@ -678,6 +685,7 @@ vmmdev_mmap_single(struct cdev *cdev, vm_ooffset_t *of size_t len; vm_ooffset_t segoff, first, last; int error, found, segid; + uint16_t lastcpu; bool sysmem; first = *offset; @@ -694,7 +702,8 @@ vmmdev_mmap_single(struct cdev *cdev, vm_ooffset_t *of /* * Get a read lock on the guest memory map by freezing any vcpu. */ - error = vcpu_lock_one(sc, VM_MAXCPU - 1); + lastcpu = vm_get_maxcpus(sc->vm) - 1; + error = vcpu_lock_one(sc, lastcpu); if (error) return (error); @@ -723,7 +732,7 @@ vmmdev_mmap_single(struct cdev *cdev, vm_ooffset_t *of error = EINVAL; } } - vcpu_unlock_one(sc, VM_MAXCPU - 1); + vcpu_unlock_one(sc, lastcpu); return (error); } @@ -910,6 +919,7 @@ devmem_mmap_single(struct cdev *cdev, vm_ooffset_t *of vm_ooffset_t first, last; size_t seglen; int error; + uint16_t lastcpu; bool sysmem; dsc = cdev->si_drv1; @@ -923,7 +933,8 @@ devmem_mmap_single(struct cdev *cdev, vm_ooffset_t *of if ((nprot & PROT_EXEC) || first < 0 || first >= last) return (EINVAL); - error = vcpu_lock_one(dsc->sc, VM_MAXCPU - 1); + lastcpu = vm_get_maxcpus(dsc->sc->vm) - 1; + error = vcpu_lock_one(dsc->sc, lastcpu); if (error) return (error); @@ -931,7 +942,7 @@ devmem_mmap_single(struct cdev *cdev, vm_ooffset_t *of KASSERT(error == 0 && !sysmem && *objp != NULL, ("%s: invalid devmem segment %d", __func__, dsc->segid)); - vcpu_unlock_one(dsc->sc, VM_MAXCPU - 1); + vcpu_unlock_one(dsc->sc, lastcpu); if (seglen >= last) { vm_object_reference(*objp); Modified: stable/11/sys/amd64/vmm/vmm_lapic.c ============================================================================== --- stable/11/sys/amd64/vmm/vmm_lapic.c Sat May 25 11:22:49 2019 (r348270) +++ stable/11/sys/amd64/vmm/vmm_lapic.c Sat May 25 11:27:56 2019 (r348271) @@ -54,7 +54,7 @@ lapic_set_intr(struct vm *vm, int cpu, int vector, boo { struct vlapic *vlapic; - if (cpu < 0 || cpu >= VM_MAXCPU) + if (cpu < 0 || cpu >= vm_get_maxcpus(vm)) return (EINVAL); /* @@ -77,7 +77,7 @@ lapic_set_local_intr(struct vm *vm, int cpu, int vecto cpuset_t dmask; int error; - if (cpu < -1 || cpu >= VM_MAXCPU) + if (cpu < -1 || cpu >= vm_get_maxcpus(vm)) return (EINVAL); if (cpu == -1) Modified: stable/11/sys/amd64/vmm/vmm_stat.c ============================================================================== --- stable/11/sys/amd64/vmm/vmm_stat.c Sat May 25 11:22:49 2019 (r348270) +++ stable/11/sys/amd64/vmm/vmm_stat.c Sat May 25 11:27:56 2019 (r348271) @@ -86,7 +86,7 @@ vmm_stat_copy(struct vm *vm, int vcpu, int *num_stats, uint64_t *stats; int i; - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm_get_maxcpus(vm)) return (EINVAL); /* Let stats functions update their counters */