From owner-svn-src-head@freebsd.org Sun May 27 06:09:18 2018 Return-Path: Delivered-To: svn-src-head@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 2463EF7CA0A; Sun, 27 May 2018 06:09:18 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CAC8F710C8; Sun, 27 May 2018 06:09:17 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id A37791DC6E; Sun, 27 May 2018 06:09:17 +0000 (UTC) Date: Sun, 27 May 2018 06:09:17 +0000 From: Alexey Dokuchaev To: Mark Felder Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334221 - head/etc Message-ID: <20180527060917.GA3179@FreeBSD.org> References: <201805251936.w4PJaQIf093393@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201805251936.w4PJaQIf093393@repo.freebsd.org> User-Agent: Mutt/1.9.5 (2018-04-13) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2018 06:09:18 -0000 On Fri, May 25, 2018 at 07:36:26PM +0000, Mark Felder wrote: > New Revision: 334221 > URL: https://svnweb.freebsd.org/changeset/base/334221 > > Log: > rc.subr: Support loading environmental variables from a file > > + if [ -n "$_env_file" ] && [ -r "${_env_file}" ]; then Style bug: "$_env_file" vs. "${_env_file}". Also, isn't the -n check redundant? > + set -a > + . $_env_file Shouldn't it be quoted here as well (. "$_env_file")? ./danfe From owner-svn-src-head@freebsd.org Sun May 27 06:47:11 2018 Return-Path: Delivered-To: svn-src-head@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 35954EEA0CA; Sun, 27 May 2018 06:47:11 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A6F67240B; Sun, 27 May 2018 06:47:10 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2BB4B1B0A6; Sun, 27 May 2018 06:47:10 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4R6lAA1006829; Sun, 27 May 2018 06:47:10 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4R6lADe006828; Sun, 27 May 2018 06:47:10 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805270647.w4R6lADe006828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Sun, 27 May 2018 06:47:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334253 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 334253 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2018 06:47:11 -0000 Author: mmacy Date: Sun May 27 06:47:09 2018 New Revision: 334253 URL: https://svnweb.freebsd.org/changeset/base/334253 Log: in_pcbladdr: remove debug code that snuck in with ifa epoch conversion r334118 Modified: head/sys/netinet/in_pcb.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Sat May 26 23:02:15 2018 (r334252) +++ head/sys/netinet/in_pcb.c Sun May 27 06:47:09 2018 (r334253) @@ -839,7 +839,6 @@ in_pcbladdr(struct inpcb *inp, struct in_addr *faddr, } if (ia == NULL) { - printf("ifa_ifwithnet failed\n"); error = ENETUNREACH; goto done; } From owner-svn-src-head@freebsd.org Sun May 27 10:48:22 2018 Return-Path: Delivered-To: svn-src-head@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 9E030EFE6C5; Sun, 27 May 2018 10:48:22 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 413AF7B5AE; Sun, 27 May 2018 10:48:22 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D6CB1D76B; Sun, 27 May 2018 10:48:22 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4RAmL14028267; Sun, 27 May 2018 10:48:21 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4RAmLcQ028266; Sun, 27 May 2018 10:48:21 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201805271048.w4RAmLcQ028266@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 27 May 2018 10:48:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334254 - head/etc/rc.d X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/etc/rc.d X-SVN-Commit-Revision: 334254 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2018 10:48:22 -0000 Author: trasz Date: Sun May 27 10:48:21 2018 New Revision: 334254 URL: https://svnweb.freebsd.org/changeset/base/334254 Log: Make the cfumass rc script support USB template 10. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/etc/rc.d/cfumass Modified: head/etc/rc.d/cfumass ============================================================================== --- head/etc/rc.d/cfumass Sun May 27 06:47:09 2018 (r334253) +++ head/etc/rc.d/cfumass Sun May 27 10:48:21 2018 (r334254) @@ -45,7 +45,7 @@ remove_luns() cfumass_start() { - local err _files _template + local err _files _template _new_template if [ ! -d "${cfumass_dir}" ]; then warn "${cfumass_dir} does not exist" @@ -90,36 +90,59 @@ cfumass_start() fi fi + # Set the template number based on the current one. _template=`sysctl -n hw.usb.template` - if [ "${_template}" -lt 0 ]; then - sysctl hw.usb.template=0 > /dev/null + case "${_template}" in + -1) + _new_template="0" + ;; + 8) + _new_template="10" + ;; + *) + warn "hw.usb.template sysctl set to neither -1 nor 8; not changing" + _new_template="" + ;; + esac + + if [ -n "${_new_template}" ]; then + sysctl hw.usb.template="${_new_template}" > /dev/null err=$? if [ "${err}" -ne 0 ]; then - warn "unable to set hw.usb.template sysctl" + warn "unable to set hw.usb.template sysctl to ${_new_template}" return "${err}" fi - else - # Otherwise don't touch the sysctl - we could lock the user - # out of the machine otherwise. - warn "hw.usb.template sysctl set to neither -1 nor 0" fi } cfumass_stop() { - local err _template + local err _template _new_template + remove_luns + _template=`sysctl -n hw.usb.template` - if [ "${_template}" -eq 0 ]; then - sysctl hw.usb.template=-1 > /dev/null + case "${_template}" in + 0) + _new_template="-1" + ;; + 10) + _new_template="8" + ;; + *) + warn "hw.usb.template sysctl set to neither 0 nor 10; not changing" + _new_template="" + ;; + esac + + if [ -n "${_new_template}" ]; then + sysctl hw.usb.template="${_new_template}" > /dev/null err=$? if [ "${err}" -ne 0 ]; then - warn "unable to set hw.usb.template sysctl" + warn "unable to set hw.usb.template sysctl to ${_new_template}" return "${err}" fi fi - - remove_luns } load_rc_config $name From owner-svn-src-head@freebsd.org Sun May 27 13:56:13 2018 Return-Path: Delivered-To: svn-src-head@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 D0EC1F74CC5; Sun, 27 May 2018 13:56:13 +0000 (UTC) (envelope-from kp@krion.cc) Received: from krion.cc (krion.cc [148.251.235.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4049280F00; Sun, 27 May 2018 13:56:13 +0000 (UTC) (envelope-from kp@krion.cc) Received: from jo (90-152-149-189.static.highway.a1.net [90.152.149.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by krion.cc (Postfix) with ESMTPSA id 46A73B40EB; Sun, 27 May 2018 15:56:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=krion.cc; s=dkim; t=1527429362; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IYd83zASh2xuhKD0MXMSCoCuVjcLFPfwqFfoCoB9N/U=; b=pue/bPEFpc4wSSNfozsBTuyzDMoehKebmLWNUSrDPFhUqX1SO56+48Wr02oJsfoVl/mdnO X5Ale5KCmEj/0lceNmMLaVm5RNT2qYGzS57s4kKxTA9eLoNut3AAAhSsT9rNfmNPnxNP/k lSxeprVPNggmJG46uFe1+XuhZJAqy1w5IHTNOPymmFUxGrGOyMBRhWDm2fSZfbWfGGVBBN stezFqielhATsAu3cc3wBDtHsZN5O6KxAGp7uZIXUtaCwtw0cjmHCOH+DnkbSejWdiUTXG VcsglX8hRQGXxqML5TEOXgHzeYLbcHPFI0RKfnTYjIR3J/muMog8ckxiyUdP3w== Date: Sun, 27 May 2018 15:56:00 +0200 From: Kirill Ponomarev To: Jan Beich Cc: Fabien Thomas , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r334054 - in head: sys/kern sys/netipsec tools/tools/crypto usr.bin/netstat Message-ID: <20180527135559.l5rhocgsoprsxrat@jo> References: <201805221554.w4MFsPQA083334@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="slijglmxft5wmues" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180512 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2018 13:56:14 -0000 --slijglmxft5wmues Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 05/25, Jan Beich wrote: > Fabien Thomas writes: >=20 > > + IPSECSTAT_INC(ips_spdcache_hits); > > + > > + SPDCACHE_UNLOCK(hashv); > > + goto out; > > + } > > + > > + IPSECSTAT_INC(ips_spdcache_misses); >=20 > Breaks kernel build with "nooption IPSEC": >=20 > ld: error: undefined symbol: vnet_entry_ipsec4stat > >>> referenced by key.c:933 (/usr/src/sys/netipsec/key.c:933) > >>> key.o:(key_allocsp) >=20 > ld: error: undefined symbol: vnet_entry_ipsec4stat > >>> referenced by key.c:939 (/usr/src/sys/netipsec/key.c:939) > >>> key.o:(key_allocsp) Breaks kernel with "options IPSEC" as well, please back out. --slijglmxft5wmues Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFdBAABCABHFiEEJCHRFhEAQujKni1pDyI9/LMCykUFAlsKuO8pFIAAAAAAFQAL cGthLWFkZHJlc3NAZ251cGcub3Jna3BAa3Jpb24uY2MACgkQDyI9/LMCykUqNAf/ YnhHLR9ERe7JlIISXkiulBO8zNPn6F504ErANd6E6/ZHHAdloVAkdwbSGN4KLKTL TkRnEDO6G+4dtSUkMGegKJcJ1jhWpk/XR68/eJ9vDtMqBpcZFBPELqs711Ng1eZ6 KEE8wagJ6uT1jiLpATVk49EWghWnuWZql8m+5anejNZjTcQWV0HPSCagnUrPu+yw EgkuVbBBmhY+fnRIGKRWjJOq4B/KaSiU2iZP5lEaqATEFo28qA3mDXt8r+1UTcie tzrKky45vMk0Kd7w+RcESMjmfqLvGc0KZj2af61G+/WQH2f84rJ8JFvcp3UiHpgl 8CtS/l8mU5swgPGzQpTCJQ== =RZ+A -----END PGP SIGNATURE----- --slijglmxft5wmues-- From owner-svn-src-head@freebsd.org Sun May 27 14:12:53 2018 Return-Path: Delivered-To: svn-src-head@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 15DF3F7546F; Sun, 27 May 2018 14:12:53 +0000 (UTC) (envelope-from kp@krion.cc) Received: from krion.cc (krion.cc [148.251.235.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A404816A3; Sun, 27 May 2018 14:12:52 +0000 (UTC) (envelope-from kp@krion.cc) Received: from jo (90-152-149-189.static.highway.a1.net [90.152.149.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by krion.cc (Postfix) with ESMTPSA id 92543B9A09; Sun, 27 May 2018 16:12:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=krion.cc; s=dkim; t=1527430366; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YBRMrZfM0iFnlU2kZ3yd+/OvdPzOnSVGkBH0PF14bXo=; b=a415aFNGSFgNMfsTF5nauPe3kPa9PrZZUjuhnWZAWY/qZcOs0+MeOTJSc6El2WyturgyvP H8FCxnUnPuGmTvMd5xwkQdYNyW6P190lZwwQRROZHUBYKwkCCDEx/SVaeaoIzHGBZHVQnc jpm1iNw5wRCyKIYdbGJS1JCt4VImY25tfPcbjgRRIw1xUBtWAWqnsikQ/6jPSlcMFi/GhR uzYHdJMiHAmne9oe3gIzHLv/IUDFBPvTLUYHaQTvSSwRdxVo9SpOQ4TFJBJcnh//hOvZaw 75p63xcmuJzianb+ibBMONoHXbsFDKHkoN3YZzY8CTbxa6eBuhgqrwbNGXFogQ== Date: Sun, 27 May 2018 16:12:45 +0200 From: Kirill Ponomarev To: Jan Beich Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Fabien Thomas Subject: Re: svn commit: r334054 - in head: sys/kern sys/netipsec tools/tools/crypto usr.bin/netstat Message-ID: <20180527141245.yrayyp2jtjtac2tr@jo> References: <201805221554.w4MFsPQA083334@repo.freebsd.org> <20180527135559.l5rhocgsoprsxrat@jo> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3fqdqvy5mtzpxby3" Content-Disposition: inline In-Reply-To: <20180527135559.l5rhocgsoprsxrat@jo> User-Agent: NeoMutt/20180512 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2018 14:12:53 -0000 --3fqdqvy5mtzpxby3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 05/27, Kirill Ponomarev wrote: > > Breaks kernel build with "nooption IPSEC": > >=20 > > ld: error: undefined symbol: vnet_entry_ipsec4stat > > >>> referenced by key.c:933 (/usr/src/sys/netipsec/key.c:933) > > >>> key.o:(key_allocsp) > >=20 > > ld: error: undefined symbol: vnet_entry_ipsec4stat > > >>> referenced by key.c:939 (/usr/src/sys/netipsec/key.c:939) > > >>> key.o:(key_allocsp) >=20 > Breaks kernel with "options IPSEC" as well, please back out. Sorry, it's with "nooption IPSEC" on my side as well. --3fqdqvy5mtzpxby3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFdBAABCABHFiEEJCHRFhEAQujKni1pDyI9/LMCykUFAlsKvN0pFIAAAAAAFQAL cGthLWFkZHJlc3NAZ251cGcub3Jna3BAa3Jpb24uY2MACgkQDyI9/LMCykW9egf/ bTIuDY933DnrV9OgXdbmPZ8ECw2E8hxNMBk/Z4MB0N5rnWkuyfNlc6FGYeR0XtkC U47WCmiOWLvyzbro/xwU/KZ6Ikhlwz6sO/sKIBOwSKznm0ZxcybGe8XG+0Ktgc6v LAUzA9y4lLMja8aT9b4s5d1N6fQlznupIsQYn7SFZ1WKTqdQAYgL7bRBO7Ym/VpZ fG2PMtLJ7SRbIunWby9fX+Wl44mtHs06VHb9lRjZKNm6x0N73C+LDtb+4EITvzxT 8cNceyko88AMiomnV0gVSMoO8UL20r1ZL+nj5008ovGWLYTfrozpSbpcp8ym0pJt dhrRP52tAdK4qYYtZ9yXoQ== =NrB5 -----END PGP SIGNATURE----- --3fqdqvy5mtzpxby3-- From owner-svn-src-head@freebsd.org Sun May 27 17:49:28 2018 Return-Path: Delivered-To: svn-src-head@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 58137F7BA2F; Sun, 27 May 2018 17:49:28 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B89F87B17; Sun, 27 May 2018 17:49:28 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E13D421B89; Sun, 27 May 2018 17:49:27 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4RHnRTH037412; Sun, 27 May 2018 17:49:27 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4RHnRRh037411; Sun, 27 May 2018 17:49:27 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805271749.w4RHnRRh037411@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Sun, 27 May 2018 17:49:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334256 - head/usr.sbin/pmcstat X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/usr.sbin/pmcstat X-SVN-Commit-Revision: 334256 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2018 17:49:28 -0000 Author: mmacy Date: Sun May 27 17:49:27 2018 New Revision: 334256 URL: https://svnweb.freebsd.org/changeset/base/334256 Log: pmcstat: suppress uninitialized warning of event Modified: head/usr.sbin/pmcstat/pmcstat.c Modified: head/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- head/usr.sbin/pmcstat/pmcstat.c Sun May 27 12:06:03 2018 (r334255) +++ head/usr.sbin/pmcstat/pmcstat.c Sun May 27 17:49:27 2018 (r334256) @@ -487,6 +487,7 @@ main(int argc, char **argv) bzero(&ds_start, sizeof(ds_start)); bzero(&ds_end, sizeof(ds_end)); ev = NULL; + event = NULL; CPU_ZERO(&cpumask); /* Default to using the running system kernel. */ From owner-svn-src-head@freebsd.org Sun May 27 18:43:16 2018 Return-Path: Delivered-To: svn-src-head@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 D656AF7CE2C; Sun, 27 May 2018 18:43:15 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 880D6694A7; Sun, 27 May 2018 18:43:15 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6923922523; Sun, 27 May 2018 18:43:15 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4RIhFvK066964; Sun, 27 May 2018 18:43:15 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4RIhFXQ066963; Sun, 27 May 2018 18:43:15 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201805271843.w4RIhFXQ066963@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Sun, 27 May 2018 18:43:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334257 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: dteske X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 334257 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2018 18:43:16 -0000 Author: dteske Date: Sun May 27 18:43:14 2018 New Revision: 334257 URL: https://svnweb.freebsd.org/changeset/base/334257 Log: Add manual page for the sctp DTrace provider. Sponsored by: Smule, Inc. Added: head/share/man/man4/dtrace_sctp.4 (contents, props changed) Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Sun May 27 17:49:27 2018 (r334256) +++ head/share/man/man4/Makefile Sun May 27 18:43:14 2018 (r334257) @@ -910,6 +910,7 @@ _dtrace_provs= dtrace_io.4 \ dtrace_lockstat.4 \ dtrace_proc.4 \ dtrace_sched.4 \ + dtrace_sctp.4 \ dtrace_tcp.4 \ dtrace_udp.4 .endif Added: head/share/man/man4/dtrace_sctp.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/dtrace_sctp.4 Sun May 27 18:43:14 2018 (r334257) @@ -0,0 +1,131 @@ +.\" Copyright (c) 2018 Devin Teske +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 22, 2018 +.Dt DTRACE_SCTP 4 +.Os +.Sh NAME +.Nm dtrace_sctp +.Nd a DTrace provider for tracing events related to the +.Xr sctp 4 +protocol +.Sh SYNOPSIS +.Fn sctp:cwnd::init uint32_t uint32_t uintptr_t int int +.Fn sctp:cwnd::ack uint32_t uint32_t uintptr_t int int +.Fn sctp:cwnd::rttvar uint64_t uint64_t uint64_t uint64_t uint64_t +.Fn sctp:cwnd::rttstep uint64_t uint64_t uint64_t uint64_t uint64_t +.Fn sctp:cwnd::fr uint32_t uint32_t uintptr_t int int +.Fn sctp:cwnd::to uint32_t uint32_t uintptr_t int int +.Fn sctp:cwnd::bl uint32_t uint32_t uintptr_t int int +.Fn sctp:cwnd::ecn uint32_t uint32_t uintptr_t int int +.Fn sctp:cwnd::pd uint32_t uint32_t uintptr_t int int +.Fn sctp:rwnd:assoc:val uint32_t uint32_t int int +.Fn sctp:flightsize:net:val uint32_t uint32_t uintptr_t int int +.Fn sctp:flightsize:assoc:val uint32_t uint32_t int int +.Sh DESCRIPTION +The DTrace +.Nm sctp +provider allows users to trace events in the +.Xr sctp 4 +protocol implementation. +This provider is similar to the +.Xr dtrace_ip 4 +and +.Xr dtrace_udp 4 +providers, +but additionally contains probes corresponding to protocol events at a level +higher than packet reception and transmission. +.Pp +The +.Fn sctp:cwnd:: +probes track changes in the congestion window on a netp. +The +.Fn sctp:rwnd:: +probes track changes in the receiver window for an assoc. +The +.Fn sctp:flightsize:net:val +probe tracks changes in the flight size on a net or assoc and the +.Fn sctp:flightsize:assoc:val +probe provides the total flight version. +.Pp +The arguments of all +.Nm sctp +probes except for +.Fn sctp:cwnd::rtt* +and +.Fn sctp::assoc:val +are the Vtag for this end, +the port number of the local side, +the pointer to +.Dv struct sctp_nets *changing , +the old value of the cwnd, +and the new value of the cwnd. +.Pp +The arguments of +.Fn sctp:::val +are similar to the above except the fourth argument is the up/down amount. +.Pp +The +.Fn sctp:cwnd::rtt* +probe arguments are a bitmap of +.Dv Vtag << 32 | localport << 16 | remoteport , +a bitmap of +.Dv obw | nbw , +a bitmap of +.Dv bwrtt | newrtt , +.Dv flight , +and a bitmap of +.Dv (cwnd << 32) | point << 16 | retval(0/1) . +.Pp +The +.Fn sctp:cwnd::init +probe fires when a remotely-initiated active SCTP open succeeds. +At this point the new connection is in the ESTABLISHED state, and the probe +arguments expose the headers associated with the final ACK of the four-way +handshake. +.\" .Sh ARGUMENTS +.\" .Sh FILES +.\" .Sh EXAMPLES +.\" .Sh COMPATIBILITY +.\" This provider has not been tested for compatiblity with the +.\" .Nm sctp +.\" provider in Solaris +.\" .Pq if one exists . +.Sh SEE ALSO +.Xr dtrace 1 , +.Xr dtrace_ip 4 , +.Xr dtrace_udp 4 , +.Xr sctp 4 , +.Xr SDT 9 +.\" .Sh HISTORY +.\" The +.\" .Nm sctp +.\" provider first appeared in +.\" .Fx +.\" UNKNOWN. +.Sh AUTHORS +This manual page was written by +.An Devin Teske Aq Mt dteske@FreeBSD.org . From owner-svn-src-head@freebsd.org Sun May 27 19:27:35 2018 Return-Path: Delivered-To: svn-src-head@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 9EAB4F7DB88; Sun, 27 May 2018 19:27:35 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 36E666A849; Sun, 27 May 2018 19:27:35 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 181DA22BAD; Sun, 27 May 2018 19:27:35 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4RJRYFm087361; Sun, 27 May 2018 19:27:34 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4RJRYJF087360; Sun, 27 May 2018 19:27:34 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201805271927.w4RJRYJF087360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Sun, 27 May 2018 19:27:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334258 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: dteske X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 334258 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2018 19:27:35 -0000 Author: dteske Date: Sun May 27 19:27:34 2018 New Revision: 334258 URL: https://svnweb.freebsd.org/changeset/base/334258 Log: Remove "All rights reserved" from dtrace_sctp(4) comments Copied from dtrace_tcp(4) Reviewed by: rgrimes Sponsored by: Smule, Inc. Modified: head/share/man/man4/dtrace_sctp.4 Modified: head/share/man/man4/dtrace_sctp.4 ============================================================================== --- head/share/man/man4/dtrace_sctp.4 Sun May 27 18:43:14 2018 (r334257) +++ head/share/man/man4/dtrace_sctp.4 Sun May 27 19:27:34 2018 (r334258) @@ -1,5 +1,4 @@ .\" Copyright (c) 2018 Devin Teske -.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions From owner-svn-src-head@freebsd.org Sun May 27 19:46:46 2018 Return-Path: Delivered-To: svn-src-head@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 65423F7E451; Sun, 27 May 2018 19:46:46 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id B36426B3E5; Sun, 27 May 2018 19:46:45 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id N1aHfctk3vB5RN1aJf8dbZ; Sun, 27 May 2018 13:44:08 -0600 X-Authority-Analysis: v=2.3 cv=PvS9kTE3 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=VUJBJC2UJ8kA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=p6JV3GM5CRdl_jC9ALQA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id B3F32354; Sun, 27 May 2018 12:44:05 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w4RJi5ET002572; Sun, 27 May 2018 12:44:05 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w4RJi58l002569; Sun, 27 May 2018 12:44:05 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201805271944.w4RJi58l002569@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Devin Teske cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334257 - head/share/man/man4 In-Reply-To: Message from Devin Teske of "Sun, 27 May 2018 18:43:15 -0000." <201805271843.w4RIhFXQ066963@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 27 May 2018 12:44:05 -0700 X-CMAE-Envelope: MS4wfH8G8lx+vqRCdurqM+mYywax0EmIj93AD4BUmlV/A4MreHhUeYmZ6mH9qqgy0qZLm5xhp4Zc1cJkULSI0VbSmKNWeTCKVlgZNX9DBWQwgiIuSVY0Pox7 i02sL4mm3OK69aQKXwZYrWy46qmI7kO7AVwXHbezDoPUAPOVQswkpPGT02BgVvxtW7EjqImy90TFgHpOPc/tKYMOp3aoIyFzb6hOJq8h7P4Sybiw7OArHLGY agEyJ+4VOZ785zI3Cx+dNIiTn8RBUXWRfmYmYdeoF/CW63hYxBQoo8aID1HwF2KK X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2018 19:46:46 -0000 In message <201805271843.w4RIhFXQ066963@repo.freebsd.org>, Devin Teske writes: > Author: dteske > Date: Sun May 27 18:43:14 2018 > New Revision: 334257 > URL: https://svnweb.freebsd.org/changeset/base/334257 > > Log: > Add manual page for the sctp DTrace provider. > > Sponsored by: Smule, Inc. > > Added: > head/share/man/man4/dtrace_sctp.4 (contents, props changed) > Modified: > head/share/man/man4/Makefile Thanks. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Sun May 27 20:24:25 2018 Return-Path: Delivered-To: svn-src-head@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 993D0F7F169; Sun, 27 May 2018 20:24:25 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BCCB6CEE7; Sun, 27 May 2018 20:24:25 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CF4F23552; Sun, 27 May 2018 20:24:25 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4RKOPEZ090040; Sun, 27 May 2018 20:24:25 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4RKOORO090038; Sun, 27 May 2018 20:24:24 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201805272024.w4RKOORO090038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 27 May 2018 20:24:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334259 - in head/sys/powerpc: include powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys/powerpc: include powerpc X-SVN-Commit-Revision: 334259 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2018 20:24:25 -0000 Author: jhibbits Date: Sun May 27 20:24:24 2018 New Revision: 334259 URL: https://svnweb.freebsd.org/changeset/base/334259 Log: Stop idle threads on power9 in the idle task until an interrupt. This reduces the CPU cycle wastage on power9, which is SMT4. Any idle thread that's spinning is simply starving working threads on the same core of valuable resources. This can be reduced further by taking more advantage of the PSSCR supported states, as well as permitting state loss, as is currently done for power8. The currently implemented stop state is the lowest latency, which may still consume resources. Modified: head/sys/powerpc/include/spr.h head/sys/powerpc/powerpc/cpu.c Modified: head/sys/powerpc/include/spr.h ============================================================================== --- head/sys/powerpc/include/spr.h Sun May 27 19:27:34 2018 (r334258) +++ head/sys/powerpc/include/spr.h Sun May 27 20:24:24 2018 (r334259) @@ -383,6 +383,7 @@ #define SPR_MD_CAM 0x338 /* ..8 IMMU CAM entry read */ #define SPR_MD_RAM0 0x339 /* ..8 IMMU RAM entry read reg 0 */ #define SPR_MD_RAM1 0x33a /* ..8 IMMU RAM entry read reg 1 */ +#define SPR_PSSCR 0x357 /* Processor Stop Status and Control Register (ISA 3.0) */ #define SPR_UMMCR2 0x3a0 /* .6. User Monitor Mode Control Register 2 */ #define SPR_UMMCR0 0x3a8 /* .6. User Monitor Mode Control Register 0 */ #define SPR_USIA 0x3ab /* .6. User Sampled Instruction Address */ Modified: head/sys/powerpc/powerpc/cpu.c ============================================================================== --- head/sys/powerpc/powerpc/cpu.c Sun May 27 19:27:34 2018 (r334258) +++ head/sys/powerpc/powerpc/cpu.c Sun May 27 20:24:24 2018 (r334259) @@ -91,6 +91,7 @@ static void cpu_idle_60x(sbintime_t); static void cpu_idle_booke(sbintime_t); #if defined(__powerpc64__) && defined(AIM) static void cpu_idle_powerx(sbintime_t); +static void cpu_idle_power9(sbintime_t sbt); #endif struct cputab { @@ -181,7 +182,7 @@ static const struct cputab models[] = { PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HTM | PPC_FEATURE2_DSCR | PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | PPC_FEATURE2_HAS_VEC_CRYPTO | PPC_FEATURE2_ARCH_3_00 | PPC_FEATURE2_HAS_IEEE128 | - PPC_FEATURE2_DARN, NULL }, + PPC_FEATURE2_DARN, cpu_powerx_setup }, { "Motorola PowerPC 7400", MPC7400, REVFMT_MAJMIN, PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 7410", MPC7410, REVFMT_MAJMIN, @@ -660,7 +661,12 @@ cpu_powerx_setup(int cpuid, uint16_t vers) switch (vers) { case IBMPOWER8: case IBMPOWER8E: + cpu_idle_hook = cpu_idle_powerx; + mtspr(SPR_LPCR, mfspr(SPR_LPCR) | LPCR_PECE_WAKESET); + isync(); + break; case IBMPOWER9: + cpu_idle_hook = cpu_idle_power9; mtspr(SPR_LPCR, mfspr(SPR_LPCR) | LPCR_PECE_WAKESET); isync(); break; @@ -668,7 +674,6 @@ cpu_powerx_setup(int cpuid, uint16_t vers) return; } - cpu_idle_hook = cpu_idle_powerx; #endif } @@ -797,6 +802,27 @@ cpu_idle_powerx(sbintime_t sbt) enter_idle_powerx(); spinlock_exit(); +} + +static void +cpu_idle_power9(sbintime_t sbt) +{ + register_t msr; + + msr = mfmsr(); + + /* Suspend external interrupts until stop instruction completes. */ + mtmsr(msr & ~PSL_EE); + /* Set the stop state to lowest latency, wake up to next instruction */ + mtspr(SPR_PSSCR, 0); + /* "stop" instruction (PowerISA 3.0) */ + __asm __volatile (".long 0x4c0002e4"); + /* + * Re-enable external interrupts to capture the interrupt that caused + * the wake up. + */ + mtmsr(msr); + } #endif From owner-svn-src-head@freebsd.org Sun May 27 20:31:15 2018 Return-Path: Delivered-To: svn-src-head@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 8F3E7F7F502; Sun, 27 May 2018 20:31:15 +0000 (UTC) (envelope-from devin@shxd.cx) Received: from shxd.cx (mail.shxd.cx [64.201.244.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 33E3A6D49A; Sun, 27 May 2018 20:31:15 +0000 (UTC) (envelope-from devin@shxd.cx) Received: from [64.201.244.132] (port=57484 helo=[10.0.0.104]) by shxd.cx with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1fMu0R-000KH6-BE; Sun, 27 May 2018 11:38:35 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r334257 - head/share/man/man4 From: Devin Teske In-Reply-To: <201805271944.w4RJi58l002569@slippy.cwsent.com> Date: Sun, 27 May 2018 13:31:11 -0700 Cc: Devin Teske , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201805271944.w4RJi58l002569@slippy.cwsent.com> To: Cy Schubert X-Mailer: Apple Mail (2.3273) Sender: devin@shxd.cx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2018 20:31:15 -0000 > On May 27, 2018, at 12:44 PM, Cy Schubert = wrote: >=20 > In message <201805271843.w4RIhFXQ066963@repo.freebsd.org>, Devin Teske=20= > writes: >> Author: dteske >> Date: Sun May 27 18:43:14 2018 >> New Revision: 334257 >> URL: https://svnweb.freebsd.org/changeset/base/334257 >>=20 >> Log: >> Add manual page for the sctp DTrace provider. >>=20 >> Sponsored by: Smule, Inc. >>=20 >> Added: >> head/share/man/man4/dtrace_sctp.4 (contents, props changed) >> Modified: >> head/share/man/man4/Makefile >=20 > Thanks. >=20 >=20 You're very welcome. Just doing my part to improve things as I can. --=20 Cheers, Devin From owner-svn-src-head@freebsd.org Sun May 27 20:36:45 2018 Return-Path: Delivered-To: svn-src-head@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 EF228F7F938; Sun, 27 May 2018 20:36:44 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8A6496D8DD; Sun, 27 May 2018 20:36:44 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 65BA0236EB; Sun, 27 May 2018 20:36:44 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4RKai6Z095034; Sun, 27 May 2018 20:36:44 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4RKaip8095033; Sun, 27 May 2018 20:36:44 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201805272036.w4RKaip8095033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 27 May 2018 20:36:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334260 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 334260 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2018 20:36:45 -0000 Author: jhibbits Date: Sun May 27 20:36:43 2018 New Revision: 334260 URL: https://svnweb.freebsd.org/changeset/base/334260 Log: Match style of the other prototypes, and don't name the argument. Modified: head/sys/powerpc/powerpc/cpu.c Modified: head/sys/powerpc/powerpc/cpu.c ============================================================================== --- head/sys/powerpc/powerpc/cpu.c Sun May 27 20:24:24 2018 (r334259) +++ head/sys/powerpc/powerpc/cpu.c Sun May 27 20:36:43 2018 (r334260) @@ -91,7 +91,7 @@ static void cpu_idle_60x(sbintime_t); static void cpu_idle_booke(sbintime_t); #if defined(__powerpc64__) && defined(AIM) static void cpu_idle_powerx(sbintime_t); -static void cpu_idle_power9(sbintime_t sbt); +static void cpu_idle_power9(sbintime_t); #endif struct cputab { From owner-svn-src-head@freebsd.org Sun May 27 22:27:48 2018 Return-Path: Delivered-To: svn-src-head@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 229E8EEEDBE; Sun, 27 May 2018 22:27:48 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C4ADB715CC; Sun, 27 May 2018 22:27:47 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A71F6248A9; Sun, 27 May 2018 22:27:47 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4RMRlDY050483; Sun, 27 May 2018 22:27:47 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4RMRlGX050482; Sun, 27 May 2018 22:27:47 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201805272227.w4RMRlGX050482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Sun, 27 May 2018 22:27:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334261 - head/cddl/usr.sbin/dwatch X-SVN-Group: head X-SVN-Commit-Author: dteske X-SVN-Commit-Paths: head/cddl/usr.sbin/dwatch X-SVN-Commit-Revision: 334261 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2018 22:27:48 -0000 Author: dteske Date: Sun May 27 22:27:47 2018 New Revision: 334261 URL: https://svnweb.freebsd.org/changeset/base/334261 Log: dwatch(1): Guard against error when given -t "*..." dwatch allows you to customnize the predicate (condition) for when information is displayed. The DTrace syntax for this is: probe[, ...] /predicate/ { [actions] } But if predicate is something like "*args[1]!=NULL" to test that the first pointer in an array is non-NULL, the syntax produced is: probe[, ...] /*arg1!=NULL/ { [actions] } The issue being that "/*" is the beginning of a comment and thus the following error is emitted: dtrace: failed to compile script /dev/stdin: line 535: /* encountered inside a comment This patch adds whitespace around the argument given to -t, producing: probe[, ...] / *arg1!=NULL / { [actions] } Sponsored by: Smule, Inc. Modified: head/cddl/usr.sbin/dwatch/dwatch Modified: head/cddl/usr.sbin/dwatch/dwatch ============================================================================== --- head/cddl/usr.sbin/dwatch/dwatch Sun May 27 20:36:43 2018 (r334260) +++ head/cddl/usr.sbin/dwatch/dwatch Sun May 27 22:27:47 2018 (r334261) @@ -47,7 +47,7 @@ DTRACE_PRAGMA=" ############################################################ GLOBALS -VERSION='$Version: 1.2 $' # -V +VERSION='$Version: 1.3 $' # -V pgm="${0##*/}" # Program basename @@ -1353,7 +1353,7 @@ $ACTIONS } /*********************************************************/ -$PROBE${EVENT_TEST:+ /$EVENT_TEST/} /* probe ID $ID */ +$PROBE${EVENT_TEST:+ / $EVENT_TEST /} /* probe ID $ID */ {${TRACE:+ printf("<$ID>"); } From owner-svn-src-head@freebsd.org Sun May 27 22:32:46 2018 Return-Path: Delivered-To: svn-src-head@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 54AC9EEF134; Sun, 27 May 2018 22:32:46 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EF9CA71A44; Sun, 27 May 2018 22:32:45 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE02A24A3A; Sun, 27 May 2018 22:32:45 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4RMWjrI055264; Sun, 27 May 2018 22:32:45 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4RMWj6I055263; Sun, 27 May 2018 22:32:45 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201805272232.w4RMWj6I055263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Sun, 27 May 2018 22:32:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334262 - head/cddl/usr.sbin/dwatch X-SVN-Group: head X-SVN-Commit-Author: dteske X-SVN-Commit-Paths: head/cddl/usr.sbin/dwatch X-SVN-Commit-Revision: 334262 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2018 22:32:46 -0000 Author: dteske Date: Sun May 27 22:32:45 2018 New Revision: 334262 URL: https://svnweb.freebsd.org/changeset/base/334262 Log: dwatch(1): Eliminate ANSI dimming in developer mode "Developer mode" (passing of "-dev" options), which enables debugging features on compilation error, used to dim lines unrelated to error. That proved distracting and feedback from testers also confirmed that simply highlighting the line the compiler complains about is enough. Sponsored by: Smule, Inc. Modified: head/cddl/usr.sbin/dwatch/dwatch Modified: head/cddl/usr.sbin/dwatch/dwatch ============================================================================== --- head/cddl/usr.sbin/dwatch/dwatch Sun May 27 22:27:47 2018 (r334261) +++ head/cddl/usr.sbin/dwatch/dwatch Sun May 27 22:32:45 2018 (r334262) @@ -1057,10 +1057,6 @@ PSARGS_ACTION=$( cat <&9 ) slen = length(sprintf("%u", start)) elen = length(sprintf("%u", end)) N = elen > slen ? elen : slen - for (i = start; i <= end; i++) { - ti[i] = "\033[2m" - te[i] = "\033[22m" - } ti[line] = "\033[31m" te[line] = "\033[39m" fmt = "%s%*u %s%s\n" From owner-svn-src-head@freebsd.org Mon May 28 00:19:09 2018 Return-Path: Delivered-To: svn-src-head@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 9AEE5EF1C04; Mon, 28 May 2018 00:19:09 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 440CB742AA; Mon, 28 May 2018 00:19:09 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20BD525A60; Mon, 28 May 2018 00:19:09 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4S0J8i4005191; Mon, 28 May 2018 00:19:08 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4S0J83Q005190; Mon, 28 May 2018 00:19:08 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201805280019.w4S0J83Q005190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Mon, 28 May 2018 00:19:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334264 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 334264 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 00:19:09 -0000 Author: jhibbits Date: Mon May 28 00:19:08 2018 New Revision: 334264 URL: https://svnweb.freebsd.org/changeset/base/334264 Log: Print the full-width pointer values in hex. PRI0ptrX is used to print a zero-padded hex value of the architecture's bitness, so on 64-bit architectures it'll print the full 64 bit address. Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Sun May 27 23:52:41 2018 (r334263) +++ head/sys/powerpc/booke/pmap.c Mon May 28 00:19:08 2018 (r334264) @@ -1824,9 +1824,9 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o virtual_avail += PAGE_SIZE; copy_page_dst_va = virtual_avail; virtual_avail += PAGE_SIZE; - debugf("zero_page_va = 0x%08x\n", zero_page_va); - debugf("copy_page_src_va = 0x%08x\n", copy_page_src_va); - debugf("copy_page_dst_va = 0x%08x\n", copy_page_dst_va); + debugf("zero_page_va = 0x%"PRI0ptrX"\n", zero_page_va); + debugf("copy_page_src_va = 0x"PRI0ptrX"\n", copy_page_src_va); + debugf("copy_page_dst_va = 0x"PRI0ptrX"\n", copy_page_dst_va); /* Initialize page zero/copy mutexes. */ mtx_init(&zero_page_mutex, "mmu_booke_zero_page", NULL, MTX_DEF); @@ -1835,15 +1835,15 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o /* Allocate KVA space for ptbl bufs. */ ptbl_buf_pool_vabase = virtual_avail; virtual_avail += PTBL_BUFS * PTBL_PAGES * PAGE_SIZE; - debugf("ptbl_buf_pool_vabase = 0x%08x end = 0x%08x\n", + debugf("ptbl_buf_pool_vabase = 0x"PRI0ptrX" end = 0x"PRI0ptrX"\n", ptbl_buf_pool_vabase, virtual_avail); /* Calculate corresponding physical addresses for the kernel region. */ phys_kernelend = kernload + kernsize; debugf("kernel image and allocated data:\n"); debugf(" kernload = 0x%09llx\n", (uint64_t)kernload); - debugf(" kernstart = 0x%08x\n", kernstart); - debugf(" kernsize = 0x%08x\n", kernsize); + debugf(" kernstart = 0x"PRI0ptrX"\n", kernstart); + debugf(" kernsize = 0x"PRI0ptrX"\n", kernsize); if (sizeof(phys_avail) / sizeof(phys_avail[0]) < availmem_regions_sz) panic("mmu_booke_bootstrap: phys_avail too small"); @@ -2263,7 +2263,7 @@ mmu_booke_kremove(mmu_t mmu, vm_offset_t va) { pte_t *pte; - CTR2(KTR_PMAP,"%s: s (va = 0x%08x)\n", __func__, va); + CTR2(KTR_PMAP,"%s: s (va = 0x"PRI0ptrX")\n", __func__, va); KASSERT(((va >= VM_MIN_KERNEL_ADDRESS) && (va <= VM_MAX_KERNEL_ADDRESS)), @@ -2720,7 +2720,7 @@ mmu_booke_activate(mmu_t mmu, struct thread *td) pmap = &td->td_proc->p_vmspace->vm_pmap; - CTR5(KTR_PMAP, "%s: s (td = %p, proc = '%s', id = %d, pmap = 0x%08x)", + CTR5(KTR_PMAP, "%s: s (td = %p, proc = '%s', id = %d, pmap = 0x"PRI0ptrX")", __func__, td, td->td_proc->p_comm, td->td_proc->p_pid, pmap); KASSERT((pmap != kernel_pmap), ("mmu_booke_activate: kernel_pmap!")); @@ -2756,7 +2756,7 @@ mmu_booke_deactivate(mmu_t mmu, struct thread *td) pmap = &td->td_proc->p_vmspace->vm_pmap; - CTR5(KTR_PMAP, "%s: td=%p, proc = '%s', id = %d, pmap = 0x%08x", + CTR5(KTR_PMAP, "%s: td=%p, proc = '%s', id = %d, pmap = 0x"PRI0ptrX, __func__, td, td->td_proc->p_comm, td->td_proc->p_pid, pmap); td->td_pcb->pcb_cpu.booke.dbcr0 = mfspr(SPR_DBCR0); From owner-svn-src-head@freebsd.org Mon May 28 01:58:51 2018 Return-Path: Delivered-To: svn-src-head@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 E278CEF3DA1; Mon, 28 May 2018 01:58:50 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 81902766C7; Mon, 28 May 2018 01:58:50 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D16E26A88; Mon, 28 May 2018 01:58:50 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4S1woEd055163; Mon, 28 May 2018 01:58:50 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4S1woJB055162; Mon, 28 May 2018 01:58:50 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201805280158.w4S1woJB055162@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Mon, 28 May 2018 01:58:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334265 - head/usr.sbin/tcpdrop X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/usr.sbin/tcpdrop X-SVN-Commit-Revision: 334265 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 01:58:51 -0000 Author: vangyzen Date: Mon May 28 01:58:49 2018 New Revision: 334265 URL: https://svnweb.freebsd.org/changeset/base/334265 Log: tcpdrop: ensure NUL termination of a string strncpy did not guarantee NUL termination of the "stack" string. Use strlcpy instead. While I'm here, avoid unnecessary memset and strnlen calls. Reported by: Coverity CID: 1381035 Sponsored by: Dell EMC Modified: head/usr.sbin/tcpdrop/tcpdrop.c Modified: head/usr.sbin/tcpdrop/tcpdrop.c ============================================================================== --- head/usr.sbin/tcpdrop/tcpdrop.c Mon May 28 00:19:08 2018 (r334264) +++ head/usr.sbin/tcpdrop/tcpdrop.c Mon May 28 01:58:49 2018 (r334265) @@ -73,7 +73,7 @@ main(int argc, char *argv[]) dropall = false; dropallstack = false; - memset(stack, 0, TCP_FUNCTION_NAME_LEN_MAX); + stack[0] = '\0'; state = -1; while ((ch = getopt(argc, argv, "alS:s:")) != -1) { @@ -86,7 +86,7 @@ main(int argc, char *argv[]) break; case 'S': dropallstack = true; - strncpy(stack, optarg, TCP_FUNCTION_NAME_LEN_MAX); + strlcpy(stack, optarg, sizeof(stack)); break; case 's': dropallstack = true; @@ -260,7 +260,7 @@ tcpdropall(const char *stack, int state) continue; /* If requested, skip sockets not having the requested stack. */ - if (strnlen(stack, TCP_FUNCTION_NAME_LEN_MAX) > 0 && + if (stack[0] != '\0' && strncmp(xtp->xt_stack, stack, TCP_FUNCTION_NAME_LEN_MAX)) continue; From owner-svn-src-head@freebsd.org Mon May 28 01:59:49 2018 Return-Path: Delivered-To: svn-src-head@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 9841EEF3E13; Mon, 28 May 2018 01:59:49 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4E95A767F3; Mon, 28 May 2018 01:59:49 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3110326A89; Mon, 28 May 2018 01:59:49 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4S1xnnA055242; Mon, 28 May 2018 01:59:49 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4S1xnkG055241; Mon, 28 May 2018 01:59:49 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201805280159.w4S1xnkG055241@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Mon, 28 May 2018 01:59:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334266 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 334266 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 01:59:49 -0000 Author: jhibbits Date: Mon May 28 01:59:48 2018 New Revision: 334266 URL: https://svnweb.freebsd.org/changeset/base/334266 Log: Make ALT_BREAK_TO_DEBUGGER work with OPAL console Match other consoles by using the higher level cngetc() in the interrupt handler, so that kdb_alt_break() can check for console break. Modified: head/sys/powerpc/powernv/opal_console.c Modified: head/sys/powerpc/powernv/opal_console.c ============================================================================== --- head/sys/powerpc/powernv/opal_console.c Mon May 28 01:58:49 2018 (r334265) +++ head/sys/powerpc/powernv/opal_console.c Mon May 28 01:59:48 2018 (r334266) @@ -475,11 +475,10 @@ uart_opal_intr(void *v) { struct uart_opal_softc *sc = v; struct tty *tp = sc->tp; - unsigned char c; - int len; + int c; tty_lock(tp); - while ((len = uart_opal_get(sc, &c, 1)) > 0) + while ((c = uart_opal_cngetc(NULL)) > 0) ttydisc_rint(tp, c, 0); ttydisc_rint_done(tp); tty_unlock(tp); From owner-svn-src-head@freebsd.org Mon May 28 02:10:36 2018 Return-Path: Delivered-To: svn-src-head@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 51520EF41FB; Mon, 28 May 2018 02:10:36 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0274B76D82; Mon, 28 May 2018 02:10:36 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5ABC26C26; Mon, 28 May 2018 02:10:35 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4S2AZ8Y060384; Mon, 28 May 2018 02:10:35 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4S2AZaQ060383; Mon, 28 May 2018 02:10:35 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201805280210.w4S2AZaQ060383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Mon, 28 May 2018 02:10:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334267 - head/lib/libprocstat X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/lib/libprocstat X-SVN-Commit-Revision: 334267 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 02:10:36 -0000 Author: vangyzen Date: Mon May 28 02:10:35 2018 New Revision: 334267 URL: https://svnweb.freebsd.org/changeset/base/334267 Log: libprocstat: fix memory leak Free the rlimits array on the happy path in procstat_getrlimit_core(). Reported by: Coverity CID: 1373328 Sponsored by: Dell EMC Modified: head/lib/libprocstat/libprocstat.c Modified: head/lib/libprocstat/libprocstat.c ============================================================================== --- head/lib/libprocstat/libprocstat.c Mon May 28 01:59:48 2018 (r334266) +++ head/lib/libprocstat/libprocstat.c Mon May 28 02:10:35 2018 (r334267) @@ -2192,6 +2192,7 @@ procstat_getrlimit_core(struct procstat_core *core, in return (-1); } *rlimit = rlimits[which]; + free(rlimits); return (0); } From owner-svn-src-head@freebsd.org Sun May 27 22:15:24 2018 Return-Path: Delivered-To: svn-src-head@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 48CDCEEE8F8 for ; Sun, 27 May 2018 22:15:24 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: from mail-oi0-f53.google.com (mail-oi0-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C810170E2F for ; Sun, 27 May 2018 22:15:23 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: by mail-oi0-f53.google.com with SMTP id d5-v6so5858708oib.5 for ; Sun, 27 May 2018 15:15:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=P94peu1TwgJwWM6/IMIRw2vPOfeqhvkuaBPg6iprsHg=; b=Veztt/8/R3Ehg34iHaolKBTZuQ9bAMrQzYuJWQsfQxSaWbecAV9uwuH/0CTaC7fpbM 7gqMKC/KS4/aUAf1Iok66JC2uPQGH8V6KC2AB1v6oBqxSWv8t/XK2z4y2WuuKefpffk1 s641nQGWT1pgAFFSrI+kUpMKqNhdLYVf6Tu2Sphmvfu7aIb+knApw50gokpx+8lpzzrY PyONsdk/2sj3Idz3IKU0fcRAQHp2t1LHwqWGckDF+cZZg4egOhxUAuxpF/dQsJKtf8pg cpALK93HbeUQyHw5BWS+HVM8JeoChNhxhRskJMz0UfbK4PzzF6nrFEMHCjfNq8In73Gu gcNA== X-Gm-Message-State: ALKqPwdxKbkUDGg+grwH43Yc8WGtWQZeP3huxjIa6mz30aS2SZE1E6x7 qevEnvTfn6mO/Nu1ZnZLQ9vfKsYM8kqNvbH18ypatg== X-Google-Smtp-Source: AB8JxZpHRik0d6HnMlYweLp2SZyjqx3twaImGSTk8p+nhvEWWg7KhHd5RksfjytJ0p7H1L2WURDTafJJa0nX0xTCAfU= X-Received: by 2002:aca:cdd2:: with SMTP id d201-v6mr6473562oig.230.1527459317505; Sun, 27 May 2018 15:15:17 -0700 (PDT) MIME-Version: 1.0 References: <201805232218.w4NMIxMA067892@slippy.cwsent.com> <18a87d6d-14af-ef9d-80ff-403039e36692@cs.duke.edu> <20180525003949.GA710@lonesome.com> <05C5BD86-70D0-4B02-AC29-36E68B3602AE@FreeBSD.org> <1A6567CD-5BE8-4E80-A262-00ADB75CF35A@FreeBSD.org> In-Reply-To: <1A6567CD-5BE8-4E80-A262-00ADB75CF35A@FreeBSD.org> From: Maxim Sobolev Date: Sun, 27 May 2018 15:15:05 -0700 Message-ID: Subject: Re: Deorbiting i386 To: David Chisnall Cc: Mark Linimon , Matthew Macy , Andrew Gallatin , Pedro Giffuni , Cy Schubert , Brooks Davis , Eugene Grosbein , Stefan Esser , "rgrimes@freebsd.org" , Gleb Smirnoff , Sean Bruno , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-Mailman-Approved-At: Mon, 28 May 2018 02:12:39 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2018 22:15:24 -0000 Well, strip extra 32 bits, use slower memory and busses (extra decoding logic etc). Voila, you suddenly have platform that can run 99% of code in wild today with just few hundred mW of power. Try that with arm32, you would be surprised how many software is technically compiling and all that, but has some weird runtime issues with either byte order or unaligned memory accesses. Not even mention performance issues due to the lack of hand-crafted JITs. Throwing away all that wealth is like shooting yourself in a foot...with a bazooka. -Max On Sat, May 26, 2018, 12:58 AM David Chisnall wrote: > On 26 May 2018, at 00:41, Maxim Sobolev wrote: > > > > If you've seen any of the atom bay trail systems in action you may > understand what I mean. You get full blown x64 system with four cores and > it takes only 2W of power. > > Which is pretty much my point - if you want a low-power x86 system for > embedded use, it=E2=80=99s going to be x86-64, not x86-32 (though hopeful= ly you=E2=80=99re > using a 32-bit ABI with it). > > David > > From owner-svn-src-head@freebsd.org Sun May 27 22:39:17 2018 Return-Path: Delivered-To: svn-src-head@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 9EF41EEF280 for ; Sun, 27 May 2018 22:39:17 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: from mail-ot0-x231.google.com (mail-ot0-x231.google.com [IPv6:2607:f8b0:4003:c0f::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1C3E971C06 for ; Sun, 27 May 2018 22:39:17 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: by mail-ot0-x231.google.com with SMTP id l12-v6so11641940oth.6 for ; Sun, 27 May 2018 15:39:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sippysoft-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cca2LnFEdcfhb084kwodKW+DfCOQ00zUsKjvCVhyaoI=; b=0Edp3Pia2EH3KFzXedUW3Rra46JTRfsfn2lfU78vpadtbgM2gPkjQwKGwV8PqBH4YK h9IFML9v8eUGxl4f8KXt+iv/6jclxHu7ve4n0rKxe6ow4hDw4IA+de215VzkAkbtGWNw 5pDTTXIt+esPqn1lGjTIzqy+rG0DOCO90f0HS3VuKKdp2Ir447uHI+Y848fSCMJkCvMs HeXRbRbgvwzMHydrUFRqMdFsQctLv7WijBeq3/uqzN+7VqhttSGmFXfdzQRDlObP8TMi pQWKCUG1uFWXxaIZdFx7JvqaNXXpome/+1ExY7aBN0CkBIAVuKPV0GlM1VC/29cTmfx6 4LLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cca2LnFEdcfhb084kwodKW+DfCOQ00zUsKjvCVhyaoI=; b=QWgm3PHcX+AWW3TqaAiMXdWGlugBb5HVgFnIpKsiw5iUP7j2/uORd4vcYxjQRS5EMm GHVy/QY6o7KnRoZslV0gcf2IIy3xOZAKeDJ/a0m2qV5o9x2OygEJjnmEOnu3ksO4CBBf 5tUEXfiRZuY+T9Z5Zo+FgJeSGeGEqptAcyPwbsK3+BSFtc4p9XYPJo7270BdF1bjyw/s TFBlRED4MQ79nMHY3IOl93+8jZuoJp8rYebGR7ZgsCTNi++jRGQzfccgt8zx8CoQEje8 t76NbVgbOipTEP1qDyXcaiWThGUhrngbt/1BHJR3eBB0OVCoscY3WTgPvacLn4qk22mw NG9Q== X-Gm-Message-State: ALKqPwfF6cCXUy+iFLQv4hNaMn779XpIP2dDt1iE4BAmw0/Z3IgsDf6K eXVFmGtIBIrP/Ij/SM94zTvYQmW2pQUhPJHIibEnaw== X-Google-Smtp-Source: ADUXVKIcwnKMBXg0i8xm8yY+iZYe8Tw7oKZlYO1CP1lYqAKQjEwn/ju8MERKP9eVk8GpauJ2A/+u87gXVRscpkw9VFM= X-Received: by 2002:a9d:4343:: with SMTP id y3-v6mr5001035oti.362.1527460756211; Sun, 27 May 2018 15:39:16 -0700 (PDT) MIME-Version: 1.0 References: <201805232218.w4NMIxMA067892@slippy.cwsent.com> <18a87d6d-14af-ef9d-80ff-403039e36692@cs.duke.edu> <20180525003949.GA710@lonesome.com> <05C5BD86-70D0-4B02-AC29-36E68B3602AE@FreeBSD.org> <1A6567CD-5BE8-4E80-A262-00ADB75CF35A@FreeBSD.org> In-Reply-To: From: Maxim Sobolev Date: Sun, 27 May 2018 15:39:04 -0700 Message-ID: Subject: Re: Deorbiting i386 To: David Chisnall Cc: Mark Linimon , Matthew Macy , Andrew Gallatin , Pedro Giffuni , Cy Schubert , Brooks Davis , Eugene Grosbein , Stefan Esser , "rgrimes@freebsd.org" , Gleb Smirnoff , Sean Bruno , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-Mailman-Approved-At: Mon, 28 May 2018 02:12:39 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2018 22:39:17 -0000 P.S.. Another interesting thing to consider is that original Intel patents on i386 are going to expire sooner or later. Give it some time and we might see completely open source i386 IPs one day, free for anyone to grab and use. By today's standards i386 is rather trivial platform with many independent commercial implementations already done by compact well focused teams (cyrix, transmeta etc). -Max On Sun, May 27, 2018, 3:15 PM Maxim Sobolev wrote: > Well, strip extra 32 bits, use slower memory and busses (extra decoding > logic etc). Voila, you suddenly have platform that can run 99% of code in > wild today with just few hundred mW of power. Try that with arm32, you > would be surprised how many software is technically compiling and all tha= t, > but has some weird runtime issues with either byte order or unaligned > memory accesses. Not even mention performance issues due to the lack of > hand-crafted JITs. > > Throwing away all that wealth is like shooting yourself in a foot...with = a > bazooka. > > -Max > > On Sat, May 26, 2018, 12:58 AM David Chisnall > wrote: > >> On 26 May 2018, at 00:41, Maxim Sobolev wrote: >> > >> > If you've seen any of the atom bay trail systems in action you may >> understand what I mean. You get full blown x64 system with four cores an= d >> it takes only 2W of power. >> >> Which is pretty much my point - if you want a low-power x86 system for >> embedded use, it=E2=80=99s going to be x86-64, not x86-32 (though hopefu= lly you=E2=80=99re >> using a 32-bit ABI with it). >> >> David >> >> From owner-svn-src-head@freebsd.org Mon May 28 02:31:50 2018 Return-Path: Delivered-To: svn-src-head@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 AE7D8EF4DF1; Mon, 28 May 2018 02:31:50 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 61E98779C7; Mon, 28 May 2018 02:31:50 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4360C270C5; Mon, 28 May 2018 02:31:50 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4S2VoJK074546; Mon, 28 May 2018 02:31:50 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4S2VoDm074545; Mon, 28 May 2018 02:31:50 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201805280231.w4S2VoDm074545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Mon, 28 May 2018 02:31:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334268 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 334268 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 02:31:50 -0000 Author: vangyzen Date: Mon May 28 02:31:49 2018 New Revision: 334268 URL: https://svnweb.freebsd.org/changeset/base/334268 Log: fts_stat: fix buffer overrun on error path Reported by: Coverity CID: 1375582 MFC after: 1 week Sponsored by: Dell EMC Modified: head/lib/libc/gen/fts-compat.c Modified: head/lib/libc/gen/fts-compat.c ============================================================================== --- head/lib/libc/gen/fts-compat.c Mon May 28 02:10:35 2018 (r334267) +++ head/lib/libc/gen/fts-compat.c Mon May 28 02:31:49 2018 (r334268) @@ -934,7 +934,7 @@ fts_stat(FTS *sp, FTSENT *p, int follow) } } else if (freebsd11_lstat(p->fts_accpath, sbp)) { p->fts_errno = errno; -err: memset(sbp, 0, sizeof(struct stat)); +err: memset(sbp, 0, sizeof(*sbp)); return (FTS_NS); } From owner-svn-src-head@freebsd.org Mon May 28 02:34:39 2018 Return-Path: Delivered-To: svn-src-head@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 0E623EF4F37; Mon, 28 May 2018 02:34:39 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A474277CCA; Mon, 28 May 2018 02:34:38 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 80096270F5; Mon, 28 May 2018 02:34:38 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4S2Ycit075482; Mon, 28 May 2018 02:34:38 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4S2YcF2075481; Mon, 28 May 2018 02:34:38 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201805280234.w4S2YcF2075481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Mon, 28 May 2018 02:34:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334269 - head/sys/dev/drm X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/sys/dev/drm X-SVN-Commit-Revision: 334269 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 02:34:39 -0000 Author: vangyzen Date: Mon May 28 02:34:38 2018 New Revision: 334269 URL: https://svnweb.freebsd.org/changeset/base/334269 Log: drm: fix memory leak on error path Reported by: Coverity CID: 1368753 MFC after: 3 days Sponsored by: Dell EMC Modified: head/sys/dev/drm/drm_ioctl.c Modified: head/sys/dev/drm/drm_ioctl.c ============================================================================== --- head/sys/dev/drm/drm_ioctl.c Mon May 28 02:31:49 2018 (r334268) +++ head/sys/dev/drm/drm_ioctl.c Mon May 28 02:34:38 2018 (r334269) @@ -105,6 +105,7 @@ int drm_setunique(struct drm_device *dev, void *data, DRM_LOCK(); if (dev->unique_len || dev->unique) { DRM_UNLOCK(); + free(busid, DRM_MEM_DRIVER); return EBUSY; } From owner-svn-src-head@freebsd.org Mon May 28 02:40:06 2018 Return-Path: Delivered-To: svn-src-head@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 DD8D0EF522A; Mon, 28 May 2018 02:40:06 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 918DE77EDF; Mon, 28 May 2018 02:40:06 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 740F9270FC; Mon, 28 May 2018 02:40:06 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4S2e6oZ075733; Mon, 28 May 2018 02:40:06 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4S2e6kV075732; Mon, 28 May 2018 02:40:06 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201805280240.w4S2e6kV075732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Mon, 28 May 2018 02:40:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334270 - head/usr.bin/logger X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/usr.bin/logger X-SVN-Commit-Revision: 334270 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 02:40:07 -0000 Author: vangyzen Date: Mon May 28 02:40:06 2018 New Revision: 334270 URL: https://svnweb.freebsd.org/changeset/base/334270 Log: logger: fix memory leak and use-after-free This one call to getaddrinfo() did not adhere to the common idiom of storing the result into a second res0 variable, which is later freed. Reported by: Coverity CID: 1368069 1368071 Sponsored by: Dell EMC Modified: head/usr.bin/logger/logger.c Modified: head/usr.bin/logger/logger.c ============================================================================== --- head/usr.bin/logger/logger.c Mon May 28 02:34:38 2018 (r334269) +++ head/usr.bin/logger/logger.c Mon May 28 02:40:06 2018 (r334270) @@ -298,7 +298,7 @@ socksetup(const char *src, const char *dst, const char error = getaddrinfo(dst, svcname, &hints, &res0); if (error == EAI_SERVICE) { warnx("%s/udp: unknown service", svcname); - error = getaddrinfo(dst, "514", &hints, &res); + error = getaddrinfo(dst, "514", &hints, &res0); } if (error) errx(1, "%s: %s", gai_strerror(error), dst); From owner-svn-src-head@freebsd.org Mon May 28 03:05:02 2018 Return-Path: Delivered-To: svn-src-head@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 A4903EF5CB6; Mon, 28 May 2018 03:05:02 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 50DE6789B1; Mon, 28 May 2018 03:05:02 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2FA45275D3; Mon, 28 May 2018 03:05:02 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4S352sB091305; Mon, 28 May 2018 03:05:02 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4S352Mp091304; Mon, 28 May 2018 03:05:02 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201805280305.w4S352Mp091304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Mon, 28 May 2018 03:05:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334271 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 334271 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 03:05:02 -0000 Author: vangyzen Date: Mon May 28 03:05:01 2018 New Revision: 334271 URL: https://svnweb.freebsd.org/changeset/base/334271 Log: bhyve: fix small memory leak in virtio console Reported by: Coverity CID: 1363284 Sponsored by: Dell EMC Modified: head/usr.sbin/bhyve/pci_virtio_console.c Modified: head/usr.sbin/bhyve/pci_virtio_console.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_console.c Mon May 28 02:40:06 2018 (r334270) +++ head/usr.sbin/bhyve/pci_virtio_console.c Mon May 28 03:05:01 2018 (r334271) @@ -651,7 +651,7 @@ pci_vtcon_init(struct vmctx *ctx, struct pci_devinst * while ((opt = strsep(&opts, ",")) != NULL) { portname = strsep(&opt, "="); - portpath = strdup(opt); + portpath = opt; /* create port */ if (pci_vtcon_sock_add(sc, portname, portpath) < 0) { From owner-svn-src-head@freebsd.org Mon May 28 03:09:10 2018 Return-Path: Delivered-To: svn-src-head@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 EB30DEF5E23; Mon, 28 May 2018 03:09:09 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9890D78C20; Mon, 28 May 2018 03:09:09 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79963275E2; Mon, 28 May 2018 03:09:09 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4S3993O091556; Mon, 28 May 2018 03:09:09 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4S399cS091555; Mon, 28 May 2018 03:09:09 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201805280309.w4S399cS091555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Mon, 28 May 2018 03:09:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334272 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 334272 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 03:09:10 -0000 Author: vangyzen Date: Mon May 28 03:09:09 2018 New Revision: 334272 URL: https://svnweb.freebsd.org/changeset/base/334272 Log: bhyve: guarantee NUL termination Use strlcpy to guarantee NUL termination of the path to a virtio console socket. Reported by: Coverity CID: 1362874 Sponsored by: Dell EMC Modified: head/usr.sbin/bhyve/pci_virtio_console.c Modified: head/usr.sbin/bhyve/pci_virtio_console.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_console.c Mon May 28 03:05:01 2018 (r334271) +++ head/usr.sbin/bhyve/pci_virtio_console.c Mon May 28 03:09:09 2018 (r334272) @@ -306,7 +306,7 @@ pci_vtcon_sock_add(struct pci_vtcon_softc *sc, const c sun.sun_family = AF_UNIX; sun.sun_len = sizeof(struct sockaddr_un); strcpy(pathcopy, path); - strncpy(sun.sun_path, basename(pathcopy), sizeof(sun.sun_path)); + strlcpy(sun.sun_path, basename(pathcopy), sizeof(sun.sun_path)); free(pathcopy); if (bindat(fd, s, (struct sockaddr *)&sun, sun.sun_len) < 0) { From owner-svn-src-head@freebsd.org Mon May 28 03:14:37 2018 Return-Path: Delivered-To: svn-src-head@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 72F3CEF6181; Mon, 28 May 2018 03:14:37 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 14C2B7912E; Mon, 28 May 2018 03:14:37 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA06927798; Mon, 28 May 2018 03:14:36 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4S3Ea2t096277; Mon, 28 May 2018 03:14:36 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4S3EaxA096276; Mon, 28 May 2018 03:14:36 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201805280314.w4S3EaxA096276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Mon, 28 May 2018 03:14:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334273 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 334273 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 03:14:37 -0000 Author: vangyzen Date: Mon May 28 03:14:36 2018 New Revision: 334273 URL: https://svnweb.freebsd.org/changeset/base/334273 Log: cam nvme: fix array overrun Fix a classic array overrun where the index could be one past the end. Reported by: Coverity CID: 1356596 MFC after: 3 days Sponsored by: Dell EMC Modified: head/sys/cam/nvme/nvme_all.c Modified: head/sys/cam/nvme/nvme_all.c ============================================================================== --- head/sys/cam/nvme/nvme_all.c Mon May 28 03:09:09 2018 (r334272) +++ head/sys/cam/nvme/nvme_all.c Mon May 28 03:14:36 2018 (r334273) @@ -120,7 +120,7 @@ nvme_op_string(const struct nvme_command *cmd) uint8_t opc; opc = (cmd->opc_fuse >> NVME_CMD_OPC_SHIFT) & NVME_CMD_OPC_MASK; - if (opc > nitems(nvme_opc2str)) + if (opc >= nitems(nvme_opc2str)) return "UNKNOWN"; return nvme_opc2str[opc]; From owner-svn-src-head@freebsd.org Mon May 28 03:26:06 2018 Return-Path: Delivered-To: svn-src-head@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 DA642EF651F for ; Mon, 28 May 2018 03:26:06 +0000 (UTC) (envelope-from thor@irk.ru) Received: from mail.irk.ru (mail.irk.ru [195.206.40.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E425796CB for ; Mon, 28 May 2018 03:26:06 +0000 (UTC) (envelope-from thor@irk.ru) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=irk.ru; s=dkim; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version: Date:Message-ID:From:References:To:Subject:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=cmb/j2mUtnfsTZd67RRDNoOKq9R6YFEyH/DAG7suiRo=; b=DweXANlXEcX3qOrT1c/MwnB5dn rWsoR0nTJnxqwruDRQwwfa5npxDij9K+28mQRKghOrovVKyzL+qiaHk5ELiIHSBH9ZjXIsk99u+Ds n6fZr7cFsZB1E9r50lk3z/s7w5qVSYESRuYHFr2fOmNRqoV/EKwmJD6PJgJumqw7Xmmo=; Received: from [194.176.114.54] (helo=[192.168.1.130]) by mail.irk.ru with esmtpa (Exim 4.89 (FreeBSD)) (envelope-from ) id 1fN8R6-0002L2-0A for svn-src-head@freebsd.org; Mon, 28 May 2018 11:03:04 +0800 Subject: Re: Deorbiting i386 To: svn-src-head@freebsd.org References: <201805232218.w4NMIxMA067892@slippy.cwsent.com> <18a87d6d-14af-ef9d-80ff-403039e36692@cs.duke.edu> <20180525003949.GA710@lonesome.com> <05C5BD86-70D0-4B02-AC29-36E68B3602AE@FreeBSD.org> <1A6567CD-5BE8-4E80-A262-00ADB75CF35A@FreeBSD.org> From: thor Message-ID: <79a6d744-9fb2-86ae-7f2d-3b6bff328221@irk.ru> Date: Mon, 28 May 2018 11:10:04 +0800 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 03:26:07 -0000 On 05/28/18 06:15, Maxim Sobolev wrote: > be surprised how many software is technically compiling and all that, > but has some weird runtime issues with either byte order or unaligned > memory accesses. Every single processor migration allows you to get rid of: 1) The software that is technically... 2) The proprietary software that would not compile 3) The processors that must support the binary compatibility with outdated software. Yes, it's painful and expensive to replace all these program but you have no other way except either keep the source and recompile when needed or use Win.. Pardon my French, I should not write such words here. From owner-svn-src-head@freebsd.org Mon May 28 04:38:11 2018 Return-Path: Delivered-To: svn-src-head@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 E5080EF7F83; Mon, 28 May 2018 04:38:10 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 921807B4D2; Mon, 28 May 2018 04:38:10 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 70C1A58C; Mon, 28 May 2018 04:38:10 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4S4cAqH036391; Mon, 28 May 2018 04:38:10 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4S4cAvc036390; Mon, 28 May 2018 04:38:10 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201805280438.w4S4cAvc036390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Mon, 28 May 2018 04:38:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334274 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 334274 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 04:38:11 -0000 Author: alc Date: Mon May 28 04:38:10 2018 New Revision: 334274 URL: https://svnweb.freebsd.org/changeset/base/334274 Log: Eliminate duplicate assertions. We assert at the start of vm_fault_hold() that the map entry is wired if the caller passes the flag VM_FAULT_WIRE. Eliminate the same assertion, but spelled differently, at the end of vm_fault_hold() and vm_fault_populate(). Repeat the assertion only if the map is unlocked and the map lookup must be repeated. Reviewed by: kib MFC after: 10 days Differential Revision: https://reviews.freebsd.org/D15582 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Mon May 28 03:14:36 2018 (r334273) +++ head/sys/vm/vm_fault.c Mon May 28 04:38:10 2018 (r334274) @@ -482,10 +482,9 @@ vm_fault_populate(struct faultstate *fs, vm_prot_t pro m_mtx = NULL; for (i = 0; i < npages; i++) { vm_page_change_lock(&m[i], &m_mtx); - if ((fault_flags & VM_FAULT_WIRE) != 0) { - KASSERT(wired, ("VM_FAULT_WIRE && !wired")); + if ((fault_flags & VM_FAULT_WIRE) != 0) vm_page_wire(&m[i]); - } else + else vm_page_activate(&m[i]); if (m_hold != NULL && m[i].pindex == fs->first_pindex) { *m_hold = &m[i]; @@ -1247,6 +1246,10 @@ readrest: unlock_and_deallocate(&fs); goto RetryFault; } + + /* Reassert because wired may have changed. */ + KASSERT(wired || (fault_flags & VM_FAULT_WIRE) == 0, + ("!wired && VM_FAULT_WIRE")); } } @@ -1290,10 +1293,9 @@ readrest: * If the page is not wired down, then put it where the pageout daemon * can find it. */ - if ((fault_flags & VM_FAULT_WIRE) != 0) { - KASSERT(wired, ("VM_FAULT_WIRE && !wired")); + if ((fault_flags & VM_FAULT_WIRE) != 0) vm_page_wire(fs.m); - } else + else vm_page_activate(fs.m); if (m_hold != NULL) { *m_hold = fs.m; From owner-svn-src-head@freebsd.org Mon May 28 05:01:43 2018 Return-Path: Delivered-To: svn-src-head@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 CD18BEF8737; Mon, 28 May 2018 05:01:43 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 800E67BF42; Mon, 28 May 2018 05:01:43 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6174F941; Mon, 28 May 2018 05:01:43 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4S51hQX046600; Mon, 28 May 2018 05:01:43 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4S51hbH046599; Mon, 28 May 2018 05:01:43 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201805280501.w4S51hbH046599@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Mon, 28 May 2018 05:01:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334275 - head/lib/libc/string X-SVN-Group: head X-SVN-Commit-Author: araujo X-SVN-Commit-Paths: head/lib/libc/string X-SVN-Commit-Revision: 334275 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 05:01:44 -0000 Author: araujo Date: Mon May 28 05:01:42 2018 New Revision: 334275 URL: https://svnweb.freebsd.org/changeset/base/334275 Log: Update strsep(3) EXAMPLE section regards the usage of assert(3). As many people has pointed out, using assert(3) shall be not the best approach to verify if strdup(3) has allocated memory to string. Reviewed by: imp MFC after: 4 weeks. Sponsored by: iXsystems Inc. Differential Revision: https://reviews.freebsd.org/D15594 Modified: head/lib/libc/string/strsep.3 Modified: head/lib/libc/string/strsep.3 ============================================================================== --- head/lib/libc/string/strsep.3 Mon May 28 04:38:10 2018 (r334274) +++ head/lib/libc/string/strsep.3 Mon May 28 05:01:42 2018 (r334275) @@ -31,7 +31,7 @@ .\" @(#)strsep.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd December 5, 2008 +.Dd May 28, 2018 .Dt STRSEP 3 .Os .Sh NAME @@ -86,12 +86,12 @@ to parse a string, and prints each token in separate l char *token, *string, *tofree; tofree = string = strdup("abc,def,ghi"); -assert(string != NULL); +if (string != NULL) + while ((token = strsep(&string, ",")) != NULL) + printf("%s\en", token); -while ((token = strsep(&string, ",")) != NULL) - printf("%s\en", token); - free(tofree); +free(string); .Ed .Pp The following uses From owner-svn-src-head@freebsd.org Mon May 28 06:01:03 2018 Return-Path: Delivered-To: svn-src-head@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 ACDE5EFAE62; Mon, 28 May 2018 06:01:03 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 638137DC72; Mon, 28 May 2018 06:01:03 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44B9E1325; Mon, 28 May 2018 06:01:03 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4S613Dk077583; Mon, 28 May 2018 06:01:03 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4S613YU077582; Mon, 28 May 2018 06:01:03 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201805280601.w4S613YU077582@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Mon, 28 May 2018 06:01:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334276 - head/lib/libc/string X-SVN-Group: head X-SVN-Commit-Author: araujo X-SVN-Commit-Paths: head/lib/libc/string X-SVN-Commit-Revision: 334276 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 06:01:03 -0000 Author: araujo Date: Mon May 28 06:01:02 2018 New Revision: 334276 URL: https://svnweb.freebsd.org/changeset/base/334276 Log: Remove unnecessary free(string) from EXAMPLES. Reported by: se Modified: head/lib/libc/string/strsep.3 Modified: head/lib/libc/string/strsep.3 ============================================================================== --- head/lib/libc/string/strsep.3 Mon May 28 05:01:42 2018 (r334275) +++ head/lib/libc/string/strsep.3 Mon May 28 06:01:02 2018 (r334276) @@ -91,7 +91,6 @@ if (string != NULL) printf("%s\en", token); free(tofree); -free(string); .Ed .Pp The following uses From owner-svn-src-head@freebsd.org Mon May 28 08:12:20 2018 Return-Path: Delivered-To: svn-src-head@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 8AD00F71F78; Mon, 28 May 2018 08:12:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C0E8826B8; Mon, 28 May 2018 08:12:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E2582962; Mon, 28 May 2018 08:12:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4S8CKK4046950; Mon, 28 May 2018 08:12:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4S8CI56046943; Mon, 28 May 2018 08:12:18 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805280812.w4S8CI56046943@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 28 May 2018 08:12:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool X-SVN-Commit-Revision: 334277 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 08:12:20 -0000 Author: hselasky Date: Mon May 28 08:12:18 2018 New Revision: 334277 URL: https://svnweb.freebsd.org/changeset/base/334277 Log: MFV r333789: libpcap 1.9.0 (pre-release) MFC after: 1 month Sponsored by: Mellanox Technologies Replaced: head/contrib/libpcap/ - copied from r333789, vendor/libpcap/dist/ Deleted: head/lib/libpcap/pcap-netmap.c Modified: head/contrib/ofed/usr.lib/3/Makefile head/contrib/pf/pflogd/pflogd.c head/contrib/wpa/src/l2_packet/l2_packet_freebsd.c head/lib/Makefile head/lib/libpcap/Makefile head/lib/libpcap/config.h head/share/mk/src.libnames.mk head/usr.sbin/cxgbetool/cxgbetool.c Modified: head/contrib/ofed/usr.lib/3/Makefile ============================================================================== --- head/contrib/ofed/usr.lib/3/Makefile Mon May 28 06:01:02 2018 (r334276) +++ head/contrib/ofed/usr.lib/3/Makefile Mon May 28 08:12:18 2018 (r334277) @@ -2,7 +2,8 @@ SUBDIR= \ ../../libibnetdisc \ -../../opensm/libopensm +../../opensm/libopensm \ +../../../../lib/libpcap SUBDIR_PARALLEL= Modified: head/contrib/pf/pflogd/pflogd.c ============================================================================== --- head/contrib/pf/pflogd/pflogd.c Mon May 28 06:01:02 2018 (r334276) +++ head/contrib/pf/pflogd/pflogd.c Mon May 28 08:12:18 2018 (r334277) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: head/contrib/wpa/src/l2_packet/l2_packet_freebsd.c ============================================================================== --- head/contrib/wpa/src/l2_packet/l2_packet_freebsd.c Mon May 28 06:01:02 2018 (r334276) +++ head/contrib/wpa/src/l2_packet/l2_packet_freebsd.c Mon May 28 08:12:18 2018 (r334277) @@ -8,7 +8,7 @@ */ #include "includes.h" -#if defined(__APPLE__) || defined(__GLIBC__) +#if defined(__APPLE__) || defined(__GLIBC__) || defined(__FreeBSD__) #include #endif /* __APPLE__ */ #include Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Mon May 28 06:01:02 2018 (r334276) +++ head/lib/Makefile Mon May 28 08:12:18 2018 (r334277) @@ -67,7 +67,7 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \ libopie \ libpam \ libpathconv \ - libpcap \ + ${_libpcap} \ libpjdlog \ ${_libproc} \ libprocstat \ @@ -182,6 +182,14 @@ SUBDIR.${MK_PMC}+= libopencsd .if ${MACHINE_CPUARCH} == "amd64" SUBDIR.${MK_PMC}+= libipt SUBDIR.${MK_BHYVE}+= libvmmapi +.endif + +.if ${MK_OFED} == "no" +# +# When OFED is enabled libpcap is built as part of +# OFED due to library dependencies +# +_libpcap= libpcap .endif .if ${MACHINE_CPUARCH} != "sparc64" Modified: head/lib/libpcap/Makefile ============================================================================== --- head/lib/libpcap/Makefile Mon May 28 06:01:02 2018 (r334276) +++ head/lib/libpcap/Makefile Mon May 28 08:12:18 2018 (r334277) @@ -7,16 +7,51 @@ SHLIBDIR?= /lib PACKAGE=lib${LIB} LIB= pcap -SRCS= grammar.y tokdefs.h pcap_version.h pcap-bpf.c \ - pcap-netmap.c fad-helpers.c \ - pcap.c pcap-common.c inet.c fad-getad.c gencode.c optimize.c nametoaddr.c \ - etherent.c savefile.c bpf_filter.c bpf_image.c bpf_dump.c \ - scanner.l sf-pcap.c sf-pcap-ng.c version.c +SRCS= bpf_dump.c \ + bpf_filter.c \ + bpf_image.c \ + etherent.c \ + fad-getad.c \ + fmtutils.c \ + gencode.c \ + grammar.y \ + nametoaddr.c \ + optimize.c \ + pcap-bpf.c \ + pcap-common.c \ + pcap-netmap.c \ + pcap-netmap.h \ + pcap.c \ + savefile.c \ + scanner.l \ + sf-pcap.c \ + sf-pcapng.c \ + tokdefs.h + # Old compatibility headers -INCS= pcap.h pcap-namedb.h pcap-bpf.h +INCS= fmtutils.h \ + pcap-bpf.h \ + pcap-namedb.h \ + pcap-netmap.h \ + pcap.h -PCAPINCS= pcap/pcap.h pcap/namedb.h pcap/bpf.h pcap/dlt.h pcap/export-defs.h +PCAPINCS= \ + pcap/bluetooth.h \ + pcap/bpf.h \ + pcap/can_socketcan.h \ + pcap/compiler-tests.h \ + pcap/dlt.h \ + pcap/funcattrs.h \ + pcap/ipnet.h \ + pcap/namedb.h \ + pcap/nflog.h \ + pcap/pcap-inttypes.h \ + pcap/pcap.h \ + pcap/sll.h \ + pcap/usb.h \ + pcap/vlan.h + PCAPINCSDIR= ${INCLUDEDIR}/pcap INCSGROUPS= INCS PCAPINCS @@ -40,6 +75,7 @@ MAN= pcap.3 \ pcap_fileno.3 \ pcap_findalldevs.3 \ pcap_freecode.3 \ + pcap_get_required_select_timeout.3 \ pcap_get_selectable_fd.3 \ pcap_get_tstamp_precision.3 \ pcap_geterr.3 \ @@ -61,6 +97,7 @@ MAN= pcap.3 \ pcap_set_datalink.3 \ pcap_set_immediate_mode.3 \ pcap_set_promisc.3 \ + pcap_set_protocol.3 \ pcap_set_rfmon.3 \ pcap_set_snaplen.3 \ pcap_set_timeout.3 \ @@ -73,12 +110,11 @@ MAN= pcap.3 \ pcap_stats.3 \ pcap_statustostr.3 \ pcap_strerror.3 \ - pcap-savefile.5 \ pcap_tstamp_type_name_to_val.3 \ - pcap_tstamp_type_val_to_name.3 \ - pcap-filter.7 \ - pcap-linktype.7 -MLINKS= pcap_datalink_val_to_name.3 pcap_datalink_val_to_description.3 \ + pcap_tstamp_type_val_to_name.3 + +MLINKS= \ + pcap_datalink_val_to_name.3 pcap_datalink_val_to_description.3 \ pcap_dump_open.3 pcap_dump_fopen.3 \ pcap_findalldevs.3 pcap_freealldevs.3 \ pcap_geterr.3 pcap_perror.3 \ @@ -93,7 +129,7 @@ MLINKS= pcap_datalink_val_to_name.3 pcap_datalink_val_ # Our man pages are a special copy from the distdir. See below. CLEANFILES+=${MAN} -CLEANFILES+=tokdefs.h scanner.h pcap_version.h version.c +CLEANFILES+=tokdefs.h scanner.h YFLAGS+=-p pcap_ LFLAGS+=-Ppcap_ --header-file=${.OBJDIR}/scanner.h --nounput @@ -108,6 +144,15 @@ CFLAGS+=-DINET6 CFLAGS+=-DHAVE_NET_PFVAR_H .endif +CFLAGS+= -DPCAP_SUPPORT_NETMAP + +.if ${MK_OFED} != "no" +SRCS+= pcap-rdmasniff.c +LIBADD+= ibverbs +LIBADD+= mlx5 +CFLAGS+= -DPCAP_SUPPORT_RDMASNIFF +.endif + WARNS?= 0 SHLIB_MAJOR= 8 @@ -120,14 +165,6 @@ CFLAGS+=-I${PCAP_DISTDIR} .PATH: ${PCAP_DISTDIR} .PATH: ${PCAP_DISTDIR}/bpf/net -version.c: ${PCAP_DISTDIR}/VERSION - @rm -f $@ - sed 's/.*/char pcap_version[] = "&";/' ${PCAP_DISTDIR}/VERSION > $@ - -pcap_version.h: ${PCAP_DISTDIR}/VERSION - @rm -f $@ - sed 's/.*/char pcap_version_string[] = "libpcap version &";/' ${PCAP_DISTDIR}/VERSION > $@ - tokdefs.h: grammar.h .NOMETA ln -sf ${.ALLSRC} ${.TARGET} @@ -138,10 +175,14 @@ tokdefs.h: grammar.h .NOMETA ${_page}: if [ -f ${PCAP_DISTDIR}/${_page:S/3$/3pcap/} ]; then \ F=${_page:S/3$/3pcap/}; \ + elif [ -f ${PCAP_DISTDIR}/${_page:S/3$/3pcap.in/} ]; then \ + F=${_page:S/3$/3pcap.in/}; \ + elif [ -f ${PCAP_DISTDIR}/${_page:S/5$/manfile.in/} ]; then \ + F=${_page:S/5$/manfile.in/}; \ elif [ -f ${PCAP_DISTDIR}/${_page:S/5$/manfile/} ]; then \ F=${_page:S/5$/manfile/}; \ else \ - F=${_page:S/7$/manmisc/}; \ + F=${_page:S/7$/manmisc.in/}; \ fi; \ sed -e 's/3PCAP/3/g' ${PCAP_DISTDIR}/$$F > ${_page} .endfor Modified: head/lib/libpcap/config.h ============================================================================== --- head/lib/libpcap/config.h Mon May 28 06:01:02 2018 (r334276) +++ head/lib/libpcap/config.h Mon May 28 08:12:18 2018 (r334277) @@ -4,40 +4,12 @@ /* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ -/* Enable optimizer debugging */ -/* #undef BDEBUG */ - -/* define if you have a cloning BPF device */ -#define HAVE_CLONING_BPF 1 - -/* define if you have the DAG API */ -/* #undef HAVE_DAG_API */ - -/* define if you have dag_get_erf_types() */ -/* #undef HAVE_DAG_GET_ERF_TYPES */ - -/* define if you have dag_get_stream_erf_types() */ -/* #undef HAVE_DAG_GET_STREAM_ERF_TYPES */ - -/* define if you have streams capable DAG API */ -/* #undef HAVE_DAG_STREAMS_API */ - -/* define if you have vdag_set_device_info() */ -/* #undef HAVE_DAG_VDAG */ - -/* Define to 1 if you have the declaration of `ether_hostton', and to 0 if you - don't. */ -#define HAVE_DECL_ETHER_HOSTTON 1 - -/* define if you have a /dev/dlpi */ -/* #undef HAVE_DEV_DLPI */ - -/* if passive_req_t primitive exists */ -/* #undef HAVE_DLPI_PASSIVE */ - /* Define to 1 if you have the `ether_hostton' function. */ #define HAVE_ETHER_HOSTTON 1 +/* Define to 1 if you have the `ffs' function. */ +#define HAVE_FFS 1 + /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #define HAVE_FSEEKO 1 @@ -47,9 +19,6 @@ /* on HP-UX 9.x */ /* #undef HAVE_HPUX9 */ -/* if ppa_info_t_dl_module_id exists */ -/* #undef HAVE_HP_PPA_INFO_T_DL_MODULE_ID_1 */ - /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 @@ -80,45 +49,15 @@ /* Define to 1 if you have the header file. */ /* #undef HAVE_LINUX_ETHTOOL_H */ -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_IF_BONDING_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_IF_PACKET_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_NET_TSTAMP_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_SOCKIOS_H */ - -/* if tp_vlan_tci exists */ -/* #undef HAVE_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_TYPES_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_USBDEVICE_FS_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_WIRELESS_H */ - /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NETINET_ETHER_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_NETINET_IF_ETHER_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NETPACKET_IF_PACKET_H */ - /* Define to 1 if you have the header file. */ /* #undef HAVE_NETPACKET_PACKET_H */ +/* Define to 1 if you have the header file. */ +#define HAVE_NET_BPF_H 1 + /* Define to 1 if you have the header file. */ #define HAVE_NET_IF_MEDIA_H 1 @@ -141,18 +80,9 @@ /* Define to 1 if you have the `snprintf' function. */ #define HAVE_SNPRINTF 1 -/* if struct sockaddr has the sa_len member */ -#define HAVE_SOCKADDR_SA_LEN 1 - -/* if struct sockaddr_storage exists */ -#define HAVE_SOCKADDR_STORAGE 1 - -/* define if socklen_t is defined */ +/* Define to 1 if the system has the type `socklen_t'. */ #define HAVE_SOCKLEN_T 1 -/* On solaris */ -/* #undef HAVE_SOLARIS */ - /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 @@ -162,12 +92,21 @@ /* Define to 1 if you have the `strerror' function. */ #define HAVE_STRERROR 1 +/* Define to 1 if you have the `strerror_r' function. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the `strerror_s' function. */ +/* #undef HAVE_STRERROR_S */ + /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 +/* Define to 1 if you have the `strlcat' function. */ +#define HAVE_STRLCAT 1 + /* Define to 1 if you have the `strlcpy' function. */ #define HAVE_STRLCPY 1 @@ -180,9 +119,12 @@ /* Define to 1 if the system has the type `struct ether_addr'. */ /* #undef HAVE_STRUCT_ETHER_ADDR */ -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_BITYPES_H */ +/* Define to 1 if `sa_len' is a member of `struct sockaddr'. */ +#define HAVE_STRUCT_SOCKADDR_SA_LEN 1 +/* Define to 1 if the system has the type `struct sockaddr_storage'. */ +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 + /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_BUFMOD_H */ @@ -207,24 +149,12 @@ /* define if you have the TurboCap API */ /* #undef HAVE_TC_API */ -/* if if_packet.h has tpacket_stats defined */ -/* #undef HAVE_TPACKET_STATS */ - /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 -/* if struct usbdevfs_ctrltransfer has bRequestType */ -/* #undef HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE */ - /* Define to 1 if you have the `vsnprintf' function. */ #define HAVE_VSNPRINTF 1 -/* define if the system supports zerocopy BPF */ -#define HAVE_ZEROCOPY_BPF 1 - -/* define if your compiler has __attribute__ */ -#define HAVE___ATTRIBUTE__ 1 - /* IPv6 */ /* See Makefile */ /* #undef INET6 */ @@ -248,53 +178,32 @@ #define PACKAGE_BUGREPORT "" /* Define to the full name of this package. */ -#define PACKAGE_NAME "" +#define PACKAGE_NAME "pcap" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "" +#define PACKAGE_STRING "pcap 1.9.0" /* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "" +#define PACKAGE_TARNAME "pcap" /* Define to the home page for this package. */ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "" +#define PACKAGE_VERSION "1.9.0" -/* /dev/dlpi directory */ -/* #undef PCAP_DEV_PREFIX */ - -/* target host supports Bluetooth sniffing */ -/* #undef PCAP_SUPPORT_BT */ - -/* target host supports Bluetooth Monitor */ -/* #undef PCAP_SUPPORT_BT_MONITOR */ - -/* support D-Bus sniffing */ -/* #undef PCAP_SUPPORT_DBUS */ - -/* target host supports netfilter sniffing */ -/* #undef PCAP_SUPPORT_NETFILTER */ - -/* use Linux packet ring capture if available */ -#define PCAP_SUPPORT_PACKET_RING 1 - -/* target host supports USB sniffing */ -/* #undef PCAP_SUPPORT_USB */ - /* target host supports netmap */ #define PCAP_SUPPORT_NETMAP 1 -/* include ACN support */ -/* #undef SITA */ +/* use packet ring capture support on Linux if available */ +#define PCAP_SUPPORT_PACKET_RING 1 -/* if struct sockaddr_hci has hci_channel member */ -/* #undef SOCKADDR_HCI_HAS_HCI_CHANNEL */ - /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 +/* Define to 1 if strings.h declares `ffs' */ +#define STRINGS_H_DECLARES_FFS /**/ + /* Enable parser debugging */ /* #undef YYDEBUG */ @@ -307,50 +216,5 @@ # define _DARWIN_USE_64_BIT_INODE 1 #endif -/* Number of bits in a file offset, on hosts where this is settable. */ -/* #undef _FILE_OFFSET_BITS */ - -/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ -/* #undef _LARGEFILE_SOURCE */ - -/* Define for large files, on AIX-style hosts. */ -/* #undef _LARGE_FILES */ - -/* define on AIX to get certain functions */ -/* #undef _SUN */ - -/* define if your compiler allows __attribute__((format)) without a warning */ -#define __ATTRIBUTE___FORMAT_OK 1 - -/* to handle Ultrix compilers that don't support const in prototypes */ -/* #undef const */ - /* Define as token for inline if inlining supported */ #define inline inline - -/* Define to `short' if int16_t not defined. */ -/* #undef int16_t */ - -/* Define to `int' if int32_t not defined. */ -/* #undef int32_t */ - -/* Define to `long long' if int64_t not defined. */ -/* #undef int64_t */ - -/* Define to `signed char' if int8_t not defined. */ -/* #undef int8_t */ - -/* on sinix */ -/* #undef sinix */ - -/* Define to `unsigned short' if u_int16_t not defined. */ -/* #undef u_int16_t */ - -/* Define to `unsigned int' if u_int32_t not defined. */ -/* #undef u_int32_t */ - -/* Define to `unsigned long long' if u_int64_t not defined. */ -/* #undef u_int64_t */ - -/* Define to `unsigned char' if u_int8_t not defined. */ -/* #undef u_int8_t */ Modified: head/share/mk/src.libnames.mk ============================================================================== --- head/share/mk/src.libnames.mk Mon May 28 06:01:02 2018 (r334276) +++ head/share/mk/src.libnames.mk Mon May 28 08:12:18 2018 (r334277) @@ -241,6 +241,9 @@ _DP_cap_pwd= nv _DP_cap_random= nv _DP_cap_sysctl= nv _DP_cap_syslog= nv +.if ${MK_OFED} != "no" +_DP_pcap= ibverbs mlx5 +.endif _DP_pjdlog= util _DP_opie= md _DP_usb= pthread Modified: head/usr.sbin/cxgbetool/cxgbetool.c ============================================================================== --- head/usr.sbin/cxgbetool/cxgbetool.c Mon May 28 06:01:02 2018 (r334276) +++ head/usr.sbin/cxgbetool/cxgbetool.c Mon May 28 08:12:18 2018 (r334277) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include From owner-svn-src-head@freebsd.org Mon May 28 08:38:04 2018 Return-Path: Delivered-To: svn-src-head@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 628E9F73EA7; Mon, 28 May 2018 08:38:04 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id D64A6834DB; Mon, 28 May 2018 08:38:03 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 4357A1027B2; Mon, 28 May 2018 18:37:55 +1000 (AEST) Date: Mon, 28 May 2018 18:37:54 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Marcelo Araujo cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334275 - head/lib/libc/string In-Reply-To: <201805280501.w4S51hbH046599@repo.freebsd.org> Message-ID: <20180528155019.W2534@besplex.bde.org> References: <201805280501.w4S51hbH046599@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=cI8g69VjL0PoBxxjEq8A:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 08:38:04 -0000 On Mon, 28 May 2018, Marcelo Araujo wrote: > Log: > Update strsep(3) EXAMPLE section regards the usage of assert(3). > > As many people has pointed out, using assert(3) shall be not the best approach > to verify if strdup(3) has allocated memory to string. > > Reviewed by: imp > Modified: head/lib/libc/string/strsep.3 > ============================================================================== > --- head/lib/libc/string/strsep.3 Mon May 28 04:38:10 2018 (r334274) > +++ head/lib/libc/string/strsep.3 Mon May 28 05:01:42 2018 (r334275) > @@ -31,7 +31,7 @@ > .\" @(#)strsep.3 8.1 (Berkeley) 6/9/93 > .\" $FreeBSD$ > .\" > -.Dd December 5, 2008 > +.Dd May 28, 2018 > .Dt STRSEP 3 > .Os > .Sh NAME > @@ -86,12 +86,12 @@ to parse a string, and prints each token in separate l > char *token, *string, *tofree; > > tofree = string = strdup("abc,def,ghi"); > -assert(string != NULL); > +if (string != NULL) > + while ((token = strsep(&string, ",")) != NULL) > + printf("%s\en", token); > > -while ((token = strsep(&string, ",")) != NULL) > - printf("%s\en", token); > - > free(tofree); > +free(string); > .Ed > .Pp > The following uses This is even worse than before. Errors are now mishandled in all cases by silently ignoring them. On most arches, null pointers are handled better than with assert() by the default error handling of sending a SIGSEGV to the process; this normally terminates it and dumps core. All assert() does is give a message that is only slightly better than nothing when it work, and then sends a SIGABRT to the process after breaking restartability by doing this in the non-returning functions abort(). That is without NDEBUG. NDEBUG gives the better default error handling. Note that assert() can't be used in signal handlers since it is required to print to stderr due to C not having any output methods except stdio. Even printing to stderr is fragile, especially after malloc() failures, since stderr might be buffered and delayed allocation of its buffer might fail. The FreeBSD implementation falls back to unbuffered then (or fails in setvbuf()), but the C standard doesn't require this. malloc() failures "can't happen" anyway, especially for strdup(). I used to test them using rlimits. IIRC, ulimit -d and ulimit -m used to work to restrict malloc() when malloc() used sbrk(). But now malloc() uses mmap() and limits don't work for it. Also, malloc() on at least amd64 now takes more than 2MB before doing anything (2MB for __je_extents_rtree and a mere few hundred KB for other parts of malloc()). malloc() might fail, but hundreds if not thousands of small strdup()s can probably be done in just the slop required to fit malloc()'s overhead. Bruce From owner-svn-src-head@freebsd.org Mon May 28 09:07:12 2018 Return-Path: Delivered-To: svn-src-head@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 53D83F76421; Mon, 28 May 2018 09:07:12 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id E299E84954; Mon, 28 May 2018 09:07:11 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id C7E7C14891; Mon, 28 May 2018 09:07:04 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id w4S974vj016532 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 28 May 2018 09:07:04 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w4S973LM016531; Mon, 28 May 2018 09:07:03 GMT (envelope-from phk) To: Bruce Evans cc: Marcelo Araujo , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334275 - head/lib/libc/string In-reply-to: <20180528155019.W2534@besplex.bde.org> From: "Poul-Henning Kamp" References: <201805280501.w4S51hbH046599@repo.freebsd.org> <20180528155019.W2534@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <16529.1527498423.1@critter.freebsd.dk> Date: Mon, 28 May 2018 09:07:03 +0000 Message-ID: <16530.1527498423@critter.freebsd.dk> X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 09:07:12 -0000 -------- In message <20180528155019.W2534@besplex.bde.org>, Bruce Evans writes: >Note that assert() can't be used in signal handlers since it is required >to print to stderr due to C not having any output methods except stdio. That is precisly why I added abort2(2) more than 10 years ago. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-svn-src-head@freebsd.org Mon May 28 09:23:29 2018 Return-Path: Delivered-To: svn-src-head@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 B2EAFF775B7; Mon, 28 May 2018 09:23:29 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 53A8C85323; Mon, 28 May 2018 09:23:29 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 308EE34A7; Mon, 28 May 2018 09:23:29 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4S9NTMv082207; Mon, 28 May 2018 09:23:29 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4S9NTVM082206; Mon, 28 May 2018 09:23:29 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201805280923.w4S9NTVM082206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 28 May 2018 09:23:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334278 - head/sys/netipsec X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netipsec X-SVN-Commit-Revision: 334278 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 09:23:29 -0000 Author: ae Date: Mon May 28 09:23:28 2018 New Revision: 334278 URL: https://svnweb.freebsd.org/changeset/base/334278 Log: Temporary disable SPDCACHE statistic accounting until proper fix will be committed. This fixes the kernel build without option IPSEC. Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Mon May 28 08:12:18 2018 (r334277) +++ head/sys/netipsec/key.c Mon May 28 09:23:28 2018 (r334278) @@ -930,13 +930,13 @@ key_allocsp(struct secpolicyindex *spidx, u_int dir) if (entry->sp != NULL) SP_ADDREF(sp); - IPSECSTAT_INC(ips_spdcache_hits); + /* IPSECSTAT_INC(ips_spdcache_hits); */ SPDCACHE_UNLOCK(hashv); goto out; } - IPSECSTAT_INC(ips_spdcache_misses); + /* IPSECSTAT_INC(ips_spdcache_misses); */ sp = key_do_allocsp(spidx, dir); entry = spdcache_entry_alloc(spidx, sp); From owner-svn-src-head@freebsd.org Mon May 28 09:41:45 2018 Return-Path: Delivered-To: svn-src-head@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 394B9F789F0; Mon, 28 May 2018 09:41:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DAA148605E; Mon, 28 May 2018 09:41:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BBCEE3BC3; Mon, 28 May 2018 09:41:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4S9fiv0092097; Mon, 28 May 2018 09:41:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4S9fix8092096; Mon, 28 May 2018 09:41:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805280941.w4S9fix8092096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 28 May 2018 09:41:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334279 - head/usr.sbin/ipfwpcap X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/usr.sbin/ipfwpcap X-SVN-Commit-Revision: 334279 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 09:41:45 -0000 Author: hselasky Date: Mon May 28 09:41:44 2018 New Revision: 334279 URL: https://svnweb.freebsd.org/changeset/base/334279 Log: Buildfix for GCC after r334277. MFC after: 1 month Sponsored by: Mellanox Technologies Modified: head/usr.sbin/ipfwpcap/ipfwpcap.c Modified: head/usr.sbin/ipfwpcap/ipfwpcap.c ============================================================================== --- head/usr.sbin/ipfwpcap/ipfwpcap.c Mon May 28 09:23:28 2018 (r334278) +++ head/usr.sbin/ipfwpcap/ipfwpcap.c Mon May 28 09:41:44 2018 (r334279) @@ -41,6 +41,8 @@ #include /* for IP_MAXPACKET */ #include /* for IP_MAXPACKET */ +#include + /* XXX normally defined in config.h */ #define HAVE_STRLCPY 1 #define HAVE_SNPRINTF 1 From owner-svn-src-head@freebsd.org Mon May 28 10:51:40 2018 Return-Path: Delivered-To: svn-src-head@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 65D40F7D613; Mon, 28 May 2018 10:51:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1744369360; Mon, 28 May 2018 10:51:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ECABF4645; Mon, 28 May 2018 10:51:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SApdFO026712; Mon, 28 May 2018 10:51:39 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SApdCn026711; Mon, 28 May 2018 10:51:39 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805281051.w4SApdCn026711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 28 May 2018 10:51:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334280 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 334280 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 10:51:40 -0000 Author: hselasky Date: Mon May 28 10:51:39 2018 New Revision: 334280 URL: https://svnweb.freebsd.org/changeset/base/334280 Log: Allow TASK_PARKED bit being set when going to sleep in the LinuxKPI. Found by: Johannes Lundberg MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_schedule.c Modified: head/sys/compat/linuxkpi/common/src/linux_schedule.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_schedule.c Mon May 28 09:41:44 2018 (r334279) +++ head/sys/compat/linuxkpi/common/src/linux_schedule.c Mon May 28 10:51:39 2018 (r334280) @@ -47,7 +47,7 @@ linux_add_to_sleepqueue(void *wchan, struct task_struc { int flags, ret; - MPASS((state & ~TASK_NORMAL) == 0); + MPASS((state & ~(TASK_PARKED | TASK_NORMAL)) == 0); flags = SLEEPQ_SLEEP | ((state & TASK_INTERRUPTIBLE) != 0 ? SLEEPQ_INTERRUPTIBLE : 0); From owner-svn-src-head@freebsd.org Mon May 28 10:54:25 2018 Return-Path: Delivered-To: svn-src-head@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 C462DF7D9EB; Mon, 28 May 2018 10:54:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 75B1069603; Mon, 28 May 2018 10:54:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56BD84789; Mon, 28 May 2018 10:54:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SAsPT1027539; Mon, 28 May 2018 10:54:25 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SAsPjD027538; Mon, 28 May 2018 10:54:25 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805281054.w4SAsPjD027538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 28 May 2018 10:54:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334281 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 334281 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 10:54:25 -0000 Author: hselasky Date: Mon May 28 10:54:24 2018 New Revision: 334281 URL: https://svnweb.freebsd.org/changeset/base/334281 Log: Implement wait_event_killable() in the LinuxKPI. Requested by: Johannes Lundberg MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/wait.h Modified: head/sys/compat/linuxkpi/common/include/linux/wait.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/wait.h Mon May 28 10:51:39 2018 (r334280) +++ head/sys/compat/linuxkpi/common/include/linux/wait.h Mon May 28 10:54:24 2018 (r334281) @@ -170,6 +170,11 @@ int linux_wait_event_common(wait_queue_head_t *, wait_ NULL); \ }) +#define wait_event_killable(wqh, cond) ({ \ + __wait_event_common(wqh, cond, MAX_SCHEDULE_TIMEOUT, \ + TASK_INTERRUPTIBLE, NULL); \ +}) + #define wait_event_interruptible(wqh, cond) ({ \ __wait_event_common(wqh, cond, MAX_SCHEDULE_TIMEOUT, \ TASK_INTERRUPTIBLE, NULL); \ From owner-svn-src-head@freebsd.org Mon May 28 11:26:41 2018 Return-Path: Delivered-To: svn-src-head@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 A8CC7F7FC19; Mon, 28 May 2018 11:26:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 58B276ABAE; Mon, 28 May 2018 11:26:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 39D8F4C3B; Mon, 28 May 2018 11:26:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SBQfg4042767; Mon, 28 May 2018 11:26:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SBQfFN042766; Mon, 28 May 2018 11:26:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805281126.w4SBQfFN042766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 28 May 2018 11:26:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334283 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 334283 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 11:26:41 -0000 Author: hselasky Date: Mon May 28 11:26:40 2018 New Revision: 334283 URL: https://svnweb.freebsd.org/changeset/base/334283 Log: The schedule_timeout_killable() function should listen for signals in the LinuxKPI. Found by: Johannes Lundberg MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/sched.h Modified: head/sys/compat/linuxkpi/common/include/linux/sched.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/sched.h Mon May 28 10:55:09 2018 (r334282) +++ head/sys/compat/linuxkpi/common/include/linux/sched.h Mon May 28 11:26:40 2018 (r334283) @@ -153,7 +153,7 @@ linux_schedule_get_interrupt_value(struct task_struct #define schedule_timeout(timeout) \ linux_schedule_timeout(timeout) #define schedule_timeout_killable(timeout) \ - schedule_timeout_uninterruptible(timeout) + schedule_timeout_interruptible(timeout) #define schedule_timeout_interruptible(timeout) ({ \ set_current_state(TASK_INTERRUPTIBLE); \ schedule_timeout(timeout); \ From owner-svn-src-head@freebsd.org Mon May 28 12:50:37 2018 Return-Path: Delivered-To: svn-src-head@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 95381EF539F; Mon, 28 May 2018 12:50:37 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B8F76E498; Mon, 28 May 2018 12:50:37 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D53B593F; Mon, 28 May 2018 12:50:37 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SCobaU085250; Mon, 28 May 2018 12:50:37 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SCobnl085249; Mon, 28 May 2018 12:50:37 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201805281250.w4SCobnl085249@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 28 May 2018 12:50:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334284 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 334284 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 12:50:37 -0000 Author: eadler Date: Mon May 28 12:50:36 2018 New Revision: 334284 URL: https://svnweb.freebsd.org/changeset/base/334284 Log: bktr: remove references to removed things Neither the examples nor the misc/alevt exist anymore. Modified: head/share/man/man4/bktr.4 Modified: head/share/man/man4/bktr.4 ============================================================================== --- head/share/man/man4/bktr.4 Mon May 28 11:26:40 2018 (r334283) +++ head/share/man/man4/bktr.4 Mon May 28 12:50:36 2018 (r334284) @@ -221,16 +221,8 @@ VideoLogic Captivator PCI .El .Sh FILES .Bl -tag -width /usr/share/examples/meteor -compact -.It Pa /usr/share/examples/meteor -Examples of what you can do with the (similarly designed) Meteor driver. .It Pa /usr/ports/multimedia/fxtv A TV and Camera display program utilizing the bktr driver - requires that -.Em The X Window System -and -.Em The Ports Collection -also be installed. -.It Pa /usr/ports/misc/alevt -A program to capture and display Teletext (VideoText) pages - requires that .Em The X Window System and .Em The Ports Collection From owner-svn-src-head@freebsd.org Mon May 28 13:12:36 2018 Return-Path: Delivered-To: svn-src-head@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 46C38EF6B14; Mon, 28 May 2018 13:12:36 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EE1766F35D; Mon, 28 May 2018 13:12:35 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF5955E11; Mon, 28 May 2018 13:12:35 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SDCZ2n098052; Mon, 28 May 2018 13:12:35 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SDCZW9098049; Mon, 28 May 2018 13:12:35 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201805281312.w4SDCZW9098049@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 28 May 2018 13:12:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334285 - head/sys/dev/bktr X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/sys/dev/bktr X-SVN-Commit-Revision: 334285 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 13:12:36 -0000 Author: eadler Date: Mon May 28 13:12:34 2018 New Revision: 334285 URL: https://svnweb.freebsd.org/changeset/base/334285 Log: bktr: Support WinFast Tv2000 & PHILIPS FI1216 - Add support for Leadtek WinFast Tv2000 XP bktr card - Add support for PHILIPS FI1216 PR: 94369 Submitted by: Angelescu Ovidiu Submitted on: 2006-03-11 19:30 UTC Modified: head/sys/dev/bktr/bktr_card.c head/sys/dev/bktr/bktr_card.h head/sys/dev/bktr/bktr_tuner.c head/sys/dev/bktr/bktr_tuner.h Modified: head/sys/dev/bktr/bktr_card.c ============================================================================== --- head/sys/dev/bktr/bktr_card.c Mon May 28 12:50:36 2018 (r334284) +++ head/sys/dev/bktr/bktr_card.c Mon May 28 13:12:34 2018 (r334285) @@ -417,6 +417,18 @@ static const struct CARDTYPE cards[] = { 0, /* EEProm size */ { 0x01, 0x04, 0x01, 0x03, 1 }, /* audio MUX values */ 0x00ffffff }, + { CARD_LEADTEK_WINFAST_2000_XP, /* the card id */ + "Leadtek Winfast 2000 XP", /* the 'name' */ + NULL, /* the tuner */ + 0, /* the tuner i2c address */ + 0, /* dbx is optional */ + 0, + 0, + 0, /* EEProm unknown */ + 0, /* size unknown */ + { 0x122000, 0x1000, 0x620000, 0x0000, 1 }, /* audio MUX values */ + 0xb33000 }, /* GPIO mask */ + }; struct bt848_card_sig bt848_card_signature[1]= { Modified: head/sys/dev/bktr/bktr_card.h ============================================================================== --- head/sys/dev/bktr/bktr_card.h Mon May 28 12:50:36 2018 (r334284) +++ head/sys/dev/bktr/bktr_card.h Mon May 28 13:12:34 2018 (r334285) @@ -84,7 +84,8 @@ #define CARD_PIXELVIEW_PLAYTV_PAK 20 #define CARD_TERRATVALUE 21 #define CARD_PIXELVIEW_PLAYTV_PRO_REV_4C 22 -#define Bt848_MAX_CARD 23 +#define CARD_LEADTEK_WINFAST_2000_XP 23 +#define Bt848_MAX_CARD 24 #define CARD_IO_GV CARD_IO_BCTV2 Modified: head/sys/dev/bktr/bktr_tuner.c ============================================================================== --- head/sys/dev/bktr/bktr_tuner.c Mon May 28 12:50:36 2018 (r334284) +++ head/sys/dev/bktr/bktr_tuner.c Mon May 28 13:12:34 2018 (r334285) @@ -301,6 +301,16 @@ static const struct TUNER tuners[] = { 0x00 }, { 0x00, 0x00 }, /* band-switch crosspoints */ { 0xa0, 0x90, 0x30, 0x8e } }, /* the band-switch values */ + + /* PHILIPS FI1216 */ + { "PHILIPS_FI1216", /* the 'name' */ + TTYPE_PAL, /* input type */ + { TSBH1_FCONTROL, /* control byte for Tuner PLL */ + TSBH1_FCONTROL, + TSBH1_FCONTROL, + 0x00 }, + { 0x00, 0x00 }, /* band-switch crosspoints */ + { 0x01, 0x02, 0x04, 0x00 } }, /* the band-switch values */ }; Modified: head/sys/dev/bktr/bktr_tuner.h ============================================================================== --- head/sys/dev/bktr/bktr_tuner.h Mon May 28 12:50:36 2018 (r334284) +++ head/sys/dev/bktr/bktr_tuner.h Mon May 28 13:12:34 2018 (r334285) @@ -63,7 +63,8 @@ #define ALPS_TSBH1 13 #define TUNER_MT2032 14 #define LG_TPI8PSB12P_PAL 15 -#define Bt848_MAX_TUNER 16 +#define PHILIPS_FI1216 16 +#define Bt848_MAX_TUNER 17 /* experimental code for Automatic Frequency Control */ #define TUNER_AFC From owner-svn-src-head@freebsd.org Mon May 28 13:22:01 2018 Return-Path: Delivered-To: svn-src-head@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 04FA2EF7394; Mon, 28 May 2018 13:22:01 +0000 (UTC) (envelope-from oshogbo.vx@gmail.com) Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6FEA56F808; Mon, 28 May 2018 13:22:00 +0000 (UTC) (envelope-from oshogbo.vx@gmail.com) Received: by mail-wr0-x241.google.com with SMTP id y15-v6so20274617wrg.11; Mon, 28 May 2018 06:22:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=FQ+EHn0yJomLcRk+MWSzalsSSBmXcAVewUnZhx2Iof0=; b=X1UDwn1tGEln30I7lzEUTRXNDjo7RLmDsqrhaWn6//M/y94BMn/b0+kxTc/DDwHv6F 4CUz5LAFSTeRpKIdl3Fo2p2ubgmfPSeDg6Fi7jxQLpdnkHcza0QgMqt2YhzjCZ321iqc 5s0VmEXIvgncNuiT+x5Gjl4kPrIdAR3lrlXwv9lxfrfbtVokLp4nI0ewNIN7RKWkwBI7 Ixu+ReuxZ9uzPpKl43+x7UATAfossQZQ664BbrRKktNX4aqjOsYz8lwcDSCNRyCOvG6Q tdzkigUoohbGbAlnCkNFyu70zPOAVDkIUTrTiCzyKPMLOtzA0o0gqRgQBbMd4ULxQPtn PQ5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=FQ+EHn0yJomLcRk+MWSzalsSSBmXcAVewUnZhx2Iof0=; b=Z2ICdmGD66uPcZ25e+mBAGm+wEY66Cau4ZL2rZwCClzL7Qr9LGbolTElpgcC5eYhl0 C1DrebrF5kXdItWKp1RhgZ/jQdpLIEQFu5TS+MZsHrG95xVl787yPqV8kcr6N7euL6PY QyDSHrFLM1m+sUbhbGG+BhElFIQthKmFNGMcTyRodxmZ89AOplBejhVpjo84erzKunVE uO5vDUMlRmar+XTIarEoHuoSBZTxdvw2606zwLE9AZHDudYyUho40umyVYuPk5Ks26tJ QmLaGYrqBCwyRxf0N+yVvPuziLwpwGa+UelYTzG6Bi6DZ7qYnq5DiAR9GmHTPsdhpNIp nc/A== X-Gm-Message-State: ALKqPwfn9c2qgLe+pkOXp/b6DyS1S5rpoT3/rqYndtPX0otSkWxXpV4Q CvlVmBRJgA4Tq6lbOjBd2Rf4990v X-Google-Smtp-Source: ADUXVKIA+3/dvOh/D3XMglzbq6g8nzCzbdfiepdokBWAKxjmtMACWQaAowCZ7Zt43aLG+r5CneUf2Q== X-Received: by 2002:a19:f719:: with SMTP id z25-v6mr6942392lfe.137.1527513718946; Mon, 28 May 2018 06:21:58 -0700 (PDT) Received: from jarvis ([77.79.224.226]) by smtp.gmail.com with ESMTPSA id p17-v6sm5850734ljc.72.2018.05.28.06.21.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 06:21:57 -0700 (PDT) Sender: Mariusz Zaborski Date: Mon, 28 May 2018 15:21:06 +0200 From: Mariusz Zaborski To: Marcelo Araujo Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334275 - head/lib/libc/string Message-ID: <20180528132106.GA55425@jarvis> References: <201805280501.w4S51hbH046599@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ZPt4rx8FFjLCG7dd" Content-Disposition: inline In-Reply-To: <201805280501.w4S51hbH046599@repo.freebsd.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 13:22:01 -0000 --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Marcelo, Thanks for working on that :) > =20 > tofree =3D string =3D strdup("abc,def,ghi"); > -assert(string !=3D NULL); > +if (string !=3D NULL) > + while ((token =3D strsep(&string, ",")) !=3D NULL) > + printf("%s\en", token); Please notice: ``` If *stringp is initially NULL, strsep() returns NULL. ``` So I even not sure if you need to check strdup() at this point. > =20 > -while ((token =3D strsep(&string, ",")) !=3D NULL) > - printf("%s\en", token); > - > free(tofree); > +free(string); Here you introduced potential double free. At the end of loop the 'string' will be equals to NULL so there is no point= to free it. If somebody would use this code as example and he from any other r= eason would stop at any other point the string will be pointing to the middle of 'tofree' variable which you already freed. Thanks, --=20 Mariusz Zaborski oshogbo//vx | http://oshogbo.vexillium.org FreeBSD commiter | https://freebsd.org Software developer | http://wheelsystems.com If it's not broken, let's fix it till it is!!1 --ZPt4rx8FFjLCG7dd Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEkD1x0xkJXVVY1Gwf38KEGuLGxWQFAlsMAkEACgkQ38KEGuLG xWSLdQ//cUMf/K0NqR/GMCZd5hkGuguhSLcIkCeF3VtroMlULwxNuhRwKU4oTKRp 76wrKxW9Es6UwQ/aztYKQvGd0MRGdvIvx78oHCMa3yYZP3brCQRjMeMCWH5JdSpT wET29HJec1tqtAssTD8M0FKZap/pD1nHJKiybd9tzBXe8/il/MgwgVfPTNIGvF/d i/GYdKX0HZ+job4FoREqm4yarH5DFGBQBWSq1aQ3r5BvFO6I/NXQQXU6MSIlkzlu IFX52jtX3vVubUw/cbYMgtl+ySa7bdYIb2GBOMfDTlxTA/62tAJJELZDhpW07BZw zZwZS2zQGewA5m4S7KpL2gHLAvOycbMuASbZEl6a1DpD9f3k6yiPjKwhDNeDujYS Xzdi3YQhwrarN8ilF7Sh63MF53j3UNrm6A8pzEeRG6SZIw6PsNdUpc3xzzG88Ys2 jyAxZnatWvqHUbBpMbdY+sqU/qwnxHJ14Jwuqe8zC3XZK88scE77IDku/Faff03x FHp49mTuQoTUD1husvsQhvzhfXW+fSdRG3h2Ic3oQKeh2qARd/orvVtxniW9DKY3 T2zllylsMUcBa8hVUY3cJstjqDTytZJqZTl7sGaERvNKcmWe1Mwi8Yo5nHnYFxEf uiDE0PTPJEdpq/LDOKE0/TG2ScvMa+zBsZJvBecm32xMontqP1Y= =SIPo -----END PGP SIGNATURE----- --ZPt4rx8FFjLCG7dd-- From owner-svn-src-head@freebsd.org Mon May 28 13:31:48 2018 Return-Path: Delivered-To: svn-src-head@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 B0CDAEF7E12; Mon, 28 May 2018 13:31: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5EE1F70128; Mon, 28 May 2018 13:31: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 4002B60D7; Mon, 28 May 2018 13:31: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 w4SDVmQe007335; Mon, 28 May 2018 13:31:48 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SDVmrl007334; Mon, 28 May 2018 13:31:48 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201805281331.w4SDVmrl007334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 28 May 2018 13:31:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334286 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 334286 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 13:31:48 -0000 Author: tuexen Date: Mon May 28 13:31:47 2018 New Revision: 334286 URL: https://svnweb.freebsd.org/changeset/base/334286 Log: Use correct mask. Introduced in https://svnweb.freebsd.org/changeset/base/333603. Thanks to Irene Ruengler for testing and reporting the issue. MFC after: 1 week X-MFC-with: 333603 Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Mon May 28 13:12:34 2018 (r334285) +++ head/sys/netinet/sctputil.c Mon May 28 13:31:47 2018 (r334286) @@ -831,7 +831,7 @@ sctp_get_prev_mtu(uint32_t val) { uint32_t i; - val &= 0x00000003; + val &= 0xfffffffc; if (val <= sctp_mtu_sizes[0]) { return (val); } @@ -857,7 +857,7 @@ sctp_get_next_mtu(uint32_t val) /* select another MTU that is just bigger than this one */ uint32_t i; - val &= 0x00000003; + val &= 0xfffffffc; for (i = 0; i < (sizeof(sctp_mtu_sizes) / sizeof(uint32_t)); i++) { if (val < sctp_mtu_sizes[i]) { KASSERT((sctp_mtu_sizes[i] & 0x00000003) == 0, From owner-svn-src-head@freebsd.org Mon May 28 16:23:40 2018 Return-Path: Delivered-To: svn-src-head@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 0BC42F6EBFC; Mon, 28 May 2018 16:23:40 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A620A763F9; Mon, 28 May 2018 16:23:39 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 866AA7C6B; Mon, 28 May 2018 16:23:39 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SGNdfa093941; Mon, 28 May 2018 16:23:39 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SGNdbu093940; Mon, 28 May 2018 16:23:39 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201805281623.w4SGNdbu093940@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Mon, 28 May 2018 16:23:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334287 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 334287 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 16:23:40 -0000 Author: alc Date: Mon May 28 16:23:39 2018 New Revision: 334287 URL: https://svnweb.freebsd.org/changeset/base/334287 Log: Addendum to r334233. In vm_fault_populate(), since the page lock is held, we must use vm_page_xunbusy_maybelocked() rather than vm_page_xunbusy() to unbusy the page. Reviewed by: kib X-MFC with: r334233 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Mon May 28 13:31:47 2018 (r334286) +++ head/sys/vm/vm_fault.c Mon May 28 16:23:39 2018 (r334287) @@ -490,7 +490,7 @@ vm_fault_populate(struct faultstate *fs, vm_prot_t pro *m_hold = &m[i]; vm_page_hold(&m[i]); } - vm_page_xunbusy(&m[i]); + vm_page_xunbusy_maybelocked(&m[i]); } if (m_mtx != NULL) mtx_unlock(m_mtx); From owner-svn-src-head@freebsd.org Mon May 28 16:59:03 2018 Return-Path: Delivered-To: svn-src-head@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 68FD3F70CF7; Mon, 28 May 2018 16:59:03 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 08F9B7739C; Mon, 28 May 2018 16:59:02 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from [IPv6:2a02:c7f:1e13:cf00:da3:9e10:9f00:cd45] (unknown [IPv6:2a02:c7f:1e13:cf00:da3:9e10:9f00:cd45]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 228F24E774; Mon, 28 May 2018 16:58:54 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: Deorbiting i386 From: Andrew Turner In-Reply-To: Date: Mon, 28 May 2018 17:58:52 +0100 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <201805232218.w4NMIxMA067892@slippy.cwsent.com> <18a87d6d-14af-ef9d-80ff-403039e36692@cs.duke.edu> <20180525003949.GA710@lonesome.com> <05C5BD86-70D0-4B02-AC29-36E68B3602AE@FreeBSD.org> <1A6567CD-5BE8-4E80-A262-00ADB75CF35A@FreeBSD.org> To: Maxim Sobolev X-Mailer: Apple Mail (2.3445.6.18) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 16:59:03 -0000 > On 27 May 2018, at 23:15, Maxim Sobolev wrote: >=20 > Well, strip extra 32 bits, use slower memory and busses (extra = decoding logic etc). Voila, you suddenly have platform that can run 99% = of code in wild today with just few hundred mW of power. Try that with = arm32, you would be surprised how many software is technically compiling = and all that, but has some weird runtime issues with either byte order = or unaligned memory accesses. Not even mention performance issues due to = the lack of hand-crafted JITs. If you=E2=80=99re having byte order issues on arm you will have them on = x86 as they are both little endian, and modern arm (last ~10 years) = handles unaligned access. You=E2=80=99ll also find there is a lot of code designed for use on = battery powered Arm CPUs, they are used in almost all mobile phones, = meaning many popular JITs have been ported. Andrew= From owner-svn-src-head@freebsd.org Mon May 28 17:08:38 2018 Return-Path: Delivered-To: svn-src-head@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 385B9F716D2; Mon, 28 May 2018 17:08:38 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D1E8677B7D; Mon, 28 May 2018 17:08:37 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3279102DE; Mon, 28 May 2018 17:08:37 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SH8b9h015056; Mon, 28 May 2018 17:08:37 GMT (envelope-from zeising@FreeBSD.org) Received: (from zeising@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SH8b0f015055; Mon, 28 May 2018 17:08:37 GMT (envelope-from zeising@FreeBSD.org) Message-Id: <201805281708.w4SH8b0f015055@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zeising set sender to zeising@FreeBSD.org using -f From: Niclas Zeising Date: Mon, 28 May 2018 17:08:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334288 - head/etc/mtree X-SVN-Group: head X-SVN-Commit-Author: zeising X-SVN-Commit-Paths: head/etc/mtree X-SVN-Commit-Revision: 334288 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 17:08:38 -0000 Author: zeising (doc,ports committer) Date: Mon May 28 17:08:37 2018 New Revision: 334288 URL: https://svnweb.freebsd.org/changeset/base/334288 Log: Complete removal of lmc(4) The lmc(4) driver was removed in r333144 and relevant files added to ObsoleteFiles.inc, however, include/sys/dev/lmc was not removed from mtree and is recreated on every install. Remove it from mtree. Reviewed by: imp, emaste Approved by: emaste Differential Revision: https://reviews.freebsd.org/D15590 Modified: head/etc/mtree/BSD.include.dist Modified: head/etc/mtree/BSD.include.dist ============================================================================== --- head/etc/mtree/BSD.include.dist Mon May 28 16:23:39 2018 (r334287) +++ head/etc/mtree/BSD.include.dist Mon May 28 17:08:37 2018 (r334288) @@ -128,8 +128,6 @@ .. io .. - lmc - .. mfi .. mlx5 From owner-svn-src-head@freebsd.org Mon May 28 17:09:30 2018 Return-Path: Delivered-To: svn-src-head@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 5E59CF717E9; Mon, 28 May 2018 17:09:30 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0CD4977DD3; Mon, 28 May 2018 17:09:30 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9969102EE; Mon, 28 May 2018 17:09:29 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SH9Tfq015128; Mon, 28 May 2018 17:09:29 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SH9Ttc015127; Mon, 28 May 2018 17:09:29 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201805281709.w4SH9Ttc015127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 28 May 2018 17:09:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334289 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 334289 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 17:09:30 -0000 Author: andrew Date: Mon May 28 17:09:29 2018 New Revision: 334289 URL: https://svnweb.freebsd.org/changeset/base/334289 Log: Create a new function to walk the EFI memory table & run a callback for each entry. We can then use this to ensure the RunTime data is mapped in the DMAP, but not in phys_avail. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/machdep.c Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Mon May 28 17:08:37 2018 (r334288) +++ head/sys/arm64/arm64/machdep.c Mon May 28 17:09:29 2018 (r334289) @@ -720,8 +720,10 @@ typedef struct { uint64_t attr; } EFI_MEMORY_DESCRIPTOR; +typedef void (*efi_map_entry_cb)(struct efi_md *); + static void -add_efi_map_entries(struct efi_map_header *efihdr) +foreach_efi_map_entry(struct efi_map_header *efihdr, efi_map_entry_cb cb) { struct efi_md *map, *p; const char *type; @@ -797,25 +799,69 @@ add_efi_map_entries(struct efi_map_header *efihdr) printf("\n"); } - switch (p->md_type) { - case EFI_MD_TYPE_CODE: - case EFI_MD_TYPE_DATA: - case EFI_MD_TYPE_BS_CODE: - case EFI_MD_TYPE_BS_DATA: - case EFI_MD_TYPE_FREE: - /* - * We're allowed to use any entry with these types. - */ - break; - default: - continue; - } + cb(p); + } +} +static void +exclude_efi_map_entry(struct efi_md *p) +{ + + switch (p->md_type) { + case EFI_MD_TYPE_CODE: + case EFI_MD_TYPE_DATA: + case EFI_MD_TYPE_BS_CODE: + case EFI_MD_TYPE_BS_DATA: + case EFI_MD_TYPE_FREE: + /* + * We're allowed to use any entry with these types. + */ + break; + default: + arm_physmem_exclude_region(p->md_phys, p->md_pages * PAGE_SIZE, + EXFLAG_NOALLOC); + } +} + +static void +exclude_efi_map_entries(struct efi_map_header *efihdr) +{ + + foreach_efi_map_entry(efihdr, exclude_efi_map_entry); +} + +static void +add_efi_map_entry(struct efi_md *p) +{ + + switch (p->md_type) { + case EFI_MD_TYPE_RT_DATA: + /* + * Runtime data will be excluded after the DMAP + * region is created to stop it from being added + * to phys_avail. + */ + case EFI_MD_TYPE_CODE: + case EFI_MD_TYPE_DATA: + case EFI_MD_TYPE_BS_CODE: + case EFI_MD_TYPE_BS_DATA: + case EFI_MD_TYPE_FREE: + /* + * We're allowed to use any entry with these types. + */ arm_physmem_hardware_region(p->md_phys, p->md_pages * PAGE_SIZE); + break; } } +static void +add_efi_map_entries(struct efi_map_header *efihdr) +{ + + foreach_efi_map_entry(efihdr, add_efi_map_entry); +} + #ifdef FDT static void try_load_dtb(caddr_t kmdp) @@ -1001,6 +1047,9 @@ initarm(struct arm64_bootparams *abp) /* Bootstrap enough of pmap to enter the kernel proper */ pmap_bootstrap(abp->kern_l0pt, abp->kern_l1pt, KERNBASE - abp->kern_delta, lastaddr - KERNBASE); + /* Exclude entries neexed in teh DMAP region, but not phys_avail */ + if (efihdr != NULL) + exclude_efi_map_entries(efihdr); arm_physmem_init_kernel_globals(); devmap_bootstrap(0, NULL); From owner-svn-src-head@freebsd.org Mon May 28 17:47:33 2018 Return-Path: Delivered-To: svn-src-head@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 38A3AF73C96; Mon, 28 May 2018 17:47:33 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DF2B67924E; Mon, 28 May 2018 17:47:32 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BDB7310959; Mon, 28 May 2018 17:47:32 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SHlWrs034959; Mon, 28 May 2018 17:47:32 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SHlWG7034958; Mon, 28 May 2018 17:47:32 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201805281747.w4SHlWG7034958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Mon, 28 May 2018 17:47:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334290 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: dteske X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 334290 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 17:47:33 -0000 Author: dteske Date: Mon May 28 17:47:32 2018 New Revision: 334290 URL: https://svnweb.freebsd.org/changeset/base/334290 Log: Bump FreeBSD_version after r333517 Sponsored by: Smule, Inc. Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon May 28 17:09:29 2018 (r334289) +++ head/sys/sys/param.h Mon May 28 17:47:32 2018 (r334290) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200064 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200065 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Mon May 28 18:29:16 2018 Return-Path: Delivered-To: svn-src-head@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 930B0F75CE4; Mon, 28 May 2018 18:29:16 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 468D87A744; Mon, 28 May 2018 18:29:16 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2304910FCE; Mon, 28 May 2018 18:29:16 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SITFN1055011; Mon, 28 May 2018 18:29:15 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SITFQB055010; Mon, 28 May 2018 18:29:15 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201805281829.w4SITFQB055010@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 28 May 2018 18:29:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334291 - head/lib/libc/string X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/lib/libc/string X-SVN-Commit-Revision: 334291 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 18:29:16 -0000 Author: emaste Date: Mon May 28 18:29:15 2018 New Revision: 334291 URL: https://svnweb.freebsd.org/changeset/base/334291 Log: strsep.3: don't silently ignore errors Reported by: bde MFC with: r334275 Modified: head/lib/libc/string/strsep.3 Modified: head/lib/libc/string/strsep.3 ============================================================================== --- head/lib/libc/string/strsep.3 Mon May 28 17:47:32 2018 (r334290) +++ head/lib/libc/string/strsep.3 Mon May 28 18:29:15 2018 (r334291) @@ -86,9 +86,10 @@ to parse a string, and prints each token in separate l char *token, *string, *tofree; tofree = string = strdup("abc,def,ghi"); -if (string != NULL) - while ((token = strsep(&string, ",")) != NULL) - printf("%s\en", token); +if (string == NULL) + err(1, "strdup"); +while ((token = strsep(&string, ",")) != NULL) + printf("%s\en", token); free(tofree); .Ed From owner-svn-src-head@freebsd.org Mon May 28 18:34:17 2018 Return-Path: Delivered-To: svn-src-head@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 03106F76205; Mon, 28 May 2018 18:34:17 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A58107ACD5; Mon, 28 May 2018 18:34:16 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8848011192; Mon, 28 May 2018 18:34:16 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SIYGYB060293; Mon, 28 May 2018 18:34:16 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SIYG77060292; Mon, 28 May 2018 18:34:16 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201805281834.w4SIYG77060292@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 28 May 2018 18:34:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334292 - head/sys/dev/usb X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/dev/usb X-SVN-Commit-Revision: 334292 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 18:34:17 -0000 Author: trasz Date: Mon May 28 18:34:16 2018 New Revision: 334292 URL: https://svnweb.freebsd.org/changeset/base/334292 Log: Change the default USB template from the current 0 to -1. The reason is that current one (mass storage device) doesn't work as it is - it needs to be set to 0 after the LUN is configured, which is what the cfumass rc script does. In other words: the current default does not work, and to actually make it work it had to be set to -1 in /boot/loader.conf. Reviewed by: hselasky@ MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/usb/usb_device.c Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Mon May 28 18:29:15 2018 (r334291) +++ head/sys/dev/usb/usb_device.c Mon May 28 18:34:16 2018 (r334292) @@ -118,7 +118,7 @@ static void usb_cdev_free(struct usb_device *); #ifdef USB_TEMPLATE int usb_template = USB_TEMPLATE; #else -int usb_template; +int usb_template = -1; #endif SYSCTL_PROC(_hw_usb, OID_AUTO, template, From owner-svn-src-head@freebsd.org Mon May 28 19:55:52 2018 Return-Path: Delivered-To: svn-src-head@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 840B8F7E2A4; Mon, 28 May 2018 19:55:52 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B5CB7FF66; Mon, 28 May 2018 19:55:52 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 099B011E62; Mon, 28 May 2018 19:55:52 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SJtp2V001552; Mon, 28 May 2018 19:55:51 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SJtpDV001551; Mon, 28 May 2018 19:55:51 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201805281955.w4SJtpDV001551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Mon, 28 May 2018 19:55:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334293 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 334293 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 19:55:52 -0000 Author: marius Date: Mon May 28 19:55:51 2018 New Revision: 334293 URL: https://svnweb.freebsd.org/changeset/base/334293 Log: Describe Fresco Logic FL1100 USB 3.0 controllers. Modified: head/sys/dev/usb/controller/xhci_pci.c Modified: head/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/xhci_pci.c Mon May 28 18:34:16 2018 (r334292) +++ head/sys/dev/usb/controller/xhci_pci.c Mon May 28 19:55:51 2018 (r334293) @@ -113,6 +113,8 @@ xhci_pci_match(device_t self) case 0x10001b73: return ("Fresco Logic FL1000G USB 3.0 controller"); + case 0x11001b73: + return ("Fresco Logic FL1100 USB 3.0 controller"); case 0x10421b21: return ("ASMedia ASM1042 USB 3.0 controller"); From owner-svn-src-head@freebsd.org Mon May 28 20:06:41 2018 Return-Path: Delivered-To: svn-src-head@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 3BE9FF7F485; Mon, 28 May 2018 20:06:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DF13981144; Mon, 28 May 2018 20:06:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BBBBE11FF2; Mon, 28 May 2018 20:06:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SK6ePw006716; Mon, 28 May 2018 20:06:40 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SK6eDX006715; Mon, 28 May 2018 20:06:40 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201805282006.w4SK6eDX006715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 28 May 2018 20:06:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334294 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 334294 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 20:06:41 -0000 Author: emaste Date: Mon May 28 20:06:40 2018 New Revision: 334294 URL: https://svnweb.freebsd.org/changeset/base/334294 Log: if_muge: Add GMII enable (vs RGMII) bit The GMII control bit ETH_MAC_CR_GMII_EN_ is not documented in LAN78xx datasheets, but from the permissively licensed header provided by Microchip it is: #define ETH_MAC_CR_GMII_EN (0x00080000UL ) // GMII/RGMII Selection Modified: head/sys/dev/usb/net/if_mugereg.h Modified: head/sys/dev/usb/net/if_mugereg.h ============================================================================== --- head/sys/dev/usb/net/if_mugereg.h Mon May 28 19:55:51 2018 (r334293) +++ head/sys/dev/usb/net/if_mugereg.h Mon May 28 20:06:40 2018 (r334294) @@ -207,6 +207,7 @@ /* MAC Control Register */ #define ETH_MAC_CR 0x100 +#define ETH_MAC_CR_GMII_EN_ (0x1U << 19) /* GMII Enable */ #define ETH_MAC_CR_AUTO_DUPLEX_ (0x1U << 12) #define ETH_MAC_CR_AUTO_SPEED_ (0x1U << 11) From owner-svn-src-head@freebsd.org Mon May 28 20:29:04 2018 Return-Path: Delivered-To: svn-src-head@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 840AEF94D1C; Mon, 28 May 2018 20:29:04 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3619383593; Mon, 28 May 2018 20:29:04 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1810812328; Mon, 28 May 2018 20:29:04 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SKT3mO016872; Mon, 28 May 2018 20:29:03 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SKT3io016871; Mon, 28 May 2018 20:29:03 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201805282029.w4SKT3io016871@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 28 May 2018 20:29:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334295 - head/sys/arm64/include X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm64/include X-SVN-Commit-Revision: 334295 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 20:29:04 -0000 Author: manu Date: Mon May 28 20:29:03 2018 New Revision: 334295 URL: https://svnweb.freebsd.org/changeset/base/334295 Log: arm64: Add atomic_fcmpset_8 and atomic_fcmpset_16 Reviewed by: cognet Modified: head/sys/arm64/include/atomic.h Modified: head/sys/arm64/include/atomic.h ============================================================================== --- head/sys/arm64/include/atomic.h Mon May 28 20:06:40 2018 (r334294) +++ head/sys/arm64/include/atomic.h Mon May 28 20:29:03 2018 (r334295) @@ -102,6 +102,54 @@ ATOMIC(subtract, sub) #define ATOMIC_FCMPSET(bar, a, l) \ static __inline int \ +atomic_fcmpset_##bar##8(volatile uint8_t *p, uint8_t *cmpval, \ + uint8_t newval) \ +{ \ + uint8_t tmp; \ + uint8_t _cmpval = *cmpval; \ + int res; \ + \ + __asm __volatile( \ + "1: mov %w1, #1 \n" \ + " ld"#a"xrb %w0, [%2] \n" \ + " cmp %w0, %w3 \n" \ + " b.ne 2f \n" \ + " st"#l"xrb %w1, %w4, [%2]\n" \ + "2:" \ + : "=&r"(tmp), "=&r"(res) \ + : "r" (p), "r" (_cmpval), "r" (newval) \ + : "cc", "memory" \ + ); \ + *cmpval = tmp; \ + \ + return (!res); \ +} \ + \ +static __inline int \ +atomic_fcmpset_##bar##16(volatile uint16_t *p, uint16_t *cmpval, \ + uint8_t newval) \ +{ \ + uint16_t tmp; \ + uint16_t _cmpval = *cmpval; \ + int res; \ + \ + __asm __volatile( \ + "1: mov %w1, #1 \n" \ + " ld"#a"xh %w0, [%2] \n" \ + " cmp %w0, %w3 \n" \ + " b.ne 2f \n" \ + " st"#l"xh %w1, %w4, [%2] \n" \ + "2:" \ + : "=&r"(tmp), "=&r"(res) \ + : "r" (p), "r" (_cmpval), "r" (newval) \ + : "cc", "memory" \ + ); \ + *cmpval = tmp; \ + \ + return (!res); \ +} \ + \ +static __inline int \ atomic_fcmpset_##bar##32(volatile uint32_t *p, uint32_t *cmpval, \ uint32_t newval) \ { \ From owner-svn-src-head@freebsd.org Mon May 28 20:47:40 2018 Return-Path: Delivered-To: svn-src-head@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 B5EBFEEE0BE; Mon, 28 May 2018 20:47:40 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6BF9B85491; Mon, 28 May 2018 20:47:40 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 490E412661; Mon, 28 May 2018 20:47:40 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SKleBQ026757; Mon, 28 May 2018 20:47:40 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SKlesF026756; Mon, 28 May 2018 20:47:40 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201805282047.w4SKlesF026756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 28 May 2018 20:47:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334296 - head/sys/security/audit X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sys/security/audit X-SVN-Commit-Revision: 334296 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 20:47:40 -0000 Author: asomers Date: Mon May 28 20:47:39 2018 New Revision: 334296 URL: https://svnweb.freebsd.org/changeset/base/334296 Log: Fix "Bad tailq" panic when auditing auditon(A_SETCLASS, ...) Due to an oversight in r195280, auditon(A_SETCLASS, ...) would cause a tailq element to get added to the tailq twice, resulting in a circular tailq. This panics when INVARIANTS are on. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D15381 Modified: head/sys/security/audit/audit_bsm.c Modified: head/sys/security/audit/audit_bsm.c ============================================================================== --- head/sys/security/audit/audit_bsm.c Mon May 28 20:29:03 2018 (r334295) +++ head/sys/security/audit/audit_bsm.c Mon May 28 20:47:39 2018 (r334296) @@ -427,7 +427,6 @@ audit_sys_auditon(struct audit_record *ar, struct au_r break; case A_SETCLASS: - kau_write(rec, tok); tok = au_to_arg32(2, "setclass:ec_event", ar->ar_arg_auditon.au_evclass.ec_number); kau_write(rec, tok); From owner-svn-src-head@freebsd.org Mon May 28 21:00:18 2018 Return-Path: Delivered-To: svn-src-head@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 6581BEEF8F8; Mon, 28 May 2018 21:00:18 +0000 (UTC) (envelope-from ronald-lists@klop.ws) Received: from smarthost1.greenhost.nl (smarthost1.greenhost.nl [195.190.28.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B756486A25; Mon, 28 May 2018 21:00:17 +0000 (UTC) (envelope-from ronald-lists@klop.ws) Received: from smtp.greenhost.nl ([213.108.110.112]) by smarthost1.greenhost.nl with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1fNPFV-0000d1-It; Mon, 28 May 2018 23:00:16 +0200 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, "Ed Maste" Subject: Re: svn commit: r333713 - in head/sys: dev/usb/net modules/usb/muge References: <201805171405.w4HE50pg052669@repo.freebsd.org> Date: Mon, 28 May 2018 23:00:17 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Ronald Klop" Message-ID: In-Reply-To: <201805171405.w4HE50pg052669@repo.freebsd.org> User-Agent: Opera Mail/12.16 (FreeBSD) X-Authenticated-As-Hash: 398f5522cb258ce43cb679602f8cfe8b62a256d1 X-Virus-Scanned: by clamav at smarthost1.samage.net X-Spam-Level: ++ X-Spam-Score: 2.5 X-Spam-Status: No, score=2.5 required=5.0 tests=ALL_TRUSTED, BAYES_99 autolearn=disabled version=3.4.0 X-Scan-Signature: 14ebef1324bd6128eaf48fef81dc9d3b X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 21:00:18 -0000 The addition of this driver made me finally buy a RPI3B+. Thanks a lot! Regards, Ronald. On Thu, 17 May 2018 16:05:00 +0200, Ed Maste wrote: > Author: emaste > Date: Thu May 17 14:04:59 2018 > New Revision: 333713 > URL: https://svnweb.freebsd.org/changeset/base/333713 > > Log: > Add driver for Microchip LAN78xx USB3-GigE controller > This driver supports two Microchip USB-Ethernet controllers: > LAN7800 USB 3.1 to 10/100/1000 Mbps Ethernet > LAN7515 USB 2 to 10/100/1000 Mbps Ethernet with built-in USB hub > The LAN7515 is the Ethernet controller on the Raspberry Pi 3B+. > At present there is no datasheet for the LAN7515, but it is effectively > a USB 2 hub combined with a LAN7800 controller. A comprehensive > LAN7800 > datasheet is at http://www.microchip.com/wwwproducts/en/LAN7800. > This driver is based on the structure of the smsc(4) driver which > supports Microchip/SMSC's LAN95xx family. (Microchip acquired SMSC > in May 2012.) The Linux lan78xx driver served as a reference for some > functionality and registers. > The 'muge' driver name comes from "Microchip USB Gigabit Ethernet". > I made some style adjustments and minor edits to Arshan's submission. > It will be connected to the build after additional review and testing. > Thanks to Microchip for providing a number of Evaluation Boards (EVBs) > for development and testing. > Submitted by: Arshan Khanifar > Reviewed by: hselasky (earlier) > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D15168 > > Added: > head/sys/dev/usb/net/if_muge.c (contents, props changed) > head/sys/dev/usb/net/if_mugereg.h (contents, props changed) > head/sys/modules/usb/muge/ > head/sys/modules/usb/muge/Makefile (contents, props changed) > > Added: head/sys/dev/usb/net/if_muge.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/usb/net/if_muge.c Thu May 17 14:04:59 2018 (r333713) > @@ -0,0 +1,2199 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > + * Copyright (C) 2012 Ben Gray . > + * Copyright (C) 2018 The FreeBSD Foundation. > + * > + * This software was developed by Arshan Khanifar > > + * under sponsorship from the FreeBSD Foundation. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in > the > + * documentation and/or other materials provided with the > distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' > AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR > PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE > LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE > GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, > STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN > ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY > OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +/* > + * USB-To-Ethernet adapter driver for Microchip's LAN78XX and related > families. > + * > + * USB 3.1 to 10/100/1000 Mbps Ethernet > + * LAN7800 http://www.microchip.com/wwwproducts/en/LAN7800 > + * > + * USB 2 to 10/100/1000 Mbps Ethernet with built-in USB hub > + * LAN7515 (no datasheet available, but probes and functions as LAN7800) > + * > + * This driver is based on the if_smsc driver, with lan78xx-specific > + * functionality modelled on Microchip's Linux lan78xx driver. > + * > + * UNIMPLEMENTED FEATURES > + * ------------------ > + * A number of features supported by the lan78xx are not yet > implemented in > + * this driver: > + * > + * 1. RX/TX checksum offloading: Nothing has been implemented yet for > + * TX checksumming. RX checksumming works with ICMP messages, but is > broken > + * for TCP/UDP packets. > + * 2. Direct address translation filtering: Implemented but untested. > + * 3. VLAN tag removal. > + * 4. Reading MAC address from the device tree: Specific to the RPi 3B+. > + * Currently, the driver assigns a random MAC address itself. > + * 5. Support for USB interrupt endpoints. > + * 6. Latency Tolerance Messaging (LTM) support. > + * 7. TCP LSO support. > + * > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +#include > +#include > + > +#include "opt_platform.h" > + > +#include > +#include > +#include > +#include "usbdevs.h" > + > +#define USB_DEBUG_VAR lan78xx_debug > +#include > +#include > + > +#include > + > +#include > + > +#ifdef USB_DEBUG > +static int muge_debug = 0; > + > +SYSCTL_NODE(_hw_usb, OID_AUTO, muge, CTLFLAG_RW, 0, > + "Microchip LAN78xx USB-GigE"); > +SYSCTL_INT(_hw_usb_muge, OID_AUTO, debug, CTLFLAG_RWTUN, &muge_debug, 0, > + "Debug level"); > +#endif > + > +#define MUGE_DEFAULT_RX_CSUM_ENABLE (false) > +#define MUGE_DEFAULT_TX_CSUM_ENABLE (false) > +#define MUGE_DEFAULT_TSO_CSUM_ENABLE (false) > + > +/* Supported Vendor and Product IDs. */ > +static const struct usb_device_id lan78xx_devs[] = { > +#define MUGE_DEV(p,i) { USB_VPI(USB_VENDOR_SMC2, USB_PRODUCT_SMC2_##p, > i) } > + MUGE_DEV(LAN7800_ETH, 0), > +#undef MUGE_DEV > +}; > + > +#ifdef USB_DEBUG > +#define lan78xx_dbg_printf(sc, fmt, args...) \ > +do { \ > + if (muge_debug > 0) \ > + device_printf((sc)->sc_ue.ue_dev, "debug: " fmt, ##args); \ > +} while(0) > +#else > +#define muge_dbg_printf(sc, fmt, args...) do { } while (0) > +#endif > + > +#define muge_warn_printf(sc, fmt, args...) \ > + device_printf((sc)->sc_ue.ue_dev, "warning: " fmt, ##args) > + > +#define muge_err_printf(sc, fmt, args...) \ > + device_printf((sc)->sc_ue.ue_dev, "error: " fmt, ##args) > + > +#define ETHER_IS_ZERO(addr) \ > + (!(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5])) > + > +#define ETHER_IS_VALID(addr) \ > + (!ETHER_IS_MULTICAST(addr) && !ETHER_IS_ZERO(addr)) > + > +/* USB endpoints. */ > + > +enum { > + MUGE_BULK_DT_RD, > + MUGE_BULK_DT_WR, > + /* > + * the device does support interrupt endpoints, > + * but they're not needed as we poll on MII status. > + * MUGE_INTR_DT_WR, > + * MUGE_INTR_DT_RD, > + */ > + MUGE_N_TRANSFER, > +}; > + > +struct muge_softc { > + struct usb_ether sc_ue; > + struct mtx sc_mtx; > + struct usb_xfer *sc_xfer[MUGE_N_TRANSFER]; > + int sc_phyno; > + > + /* Settings for the mac control (MAC_CSR) register. */ > + uint32_t sc_rfe_ctl; > + uint32_t sc_mdix_ctl; > + uint32_t sc_rev_id; > + uint32_t sc_mchash_table[DP_SEL_VHF_HASH_LEN]; > + uint32_t sc_pfilter_table[MUGE_NUM_PFILTER_ADDRS_][2]; > + > + uint32_t sc_flags; > +#define MUGE_FLAG_LINK 0x0001 > +}; > + > +#define MUGE_IFACE_IDX 0 > + > +#define MUGE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) > +#define MUGE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) > +#define MUGE_LOCK_ASSERT(_sc, t) mtx_assert(&(_sc)->sc_mtx, t) > + > + > +static device_probe_t muge_probe; > +static device_attach_t muge_attach; > +static device_detach_t muge_detach; > + > +static usb_callback_t muge_bulk_read_callback; > +static usb_callback_t muge_bulk_write_callback; > + > +static miibus_readreg_t lan78xx_miibus_readreg; > +static miibus_writereg_t lan78xx_miibus_writereg; > +static miibus_statchg_t lan78xx_miibus_statchg; > + > +static int muge_attach_post_sub(struct usb_ether *ue); > +static uether_fn_t muge_attach_post; > +static uether_fn_t muge_init; > +static uether_fn_t muge_stop; > +static uether_fn_t muge_start; > +static uether_fn_t muge_tick; > +static uether_fn_t muge_setmulti; > +static uether_fn_t muge_setpromisc; > + > +static int muge_ifmedia_upd(struct ifnet *); > +static void muge_ifmedia_sts(struct ifnet *, struct ifmediareq *); > + > +static int lan78xx_chip_init(struct muge_softc *sc); > +static int muge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); > + > +static const struct usb_config muge_config[MUGE_N_TRANSFER] = { > + > + [MUGE_BULK_DT_WR] = { > + .type = UE_BULK, > + .endpoint = UE_ADDR_ANY, > + .direction = UE_DIR_OUT, > + .frames = 16, > + .bufsize = 16 * (MCLBYTES + 16), > + .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, > + .callback = muge_bulk_write_callback, > + .timeout = 10000, /* 10 seconds */ > + }, > + > + [MUGE_BULK_DT_RD] = { > + .type = UE_BULK, > + .endpoint = UE_ADDR_ANY, > + .direction = UE_DIR_IN, > + .bufsize = 20480, /* bytes */ > + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, > + .callback = muge_bulk_read_callback, > + .timeout = 0, /* no timeout */ > + }, > + /* > + * The chip supports interrupt endpoints, however they aren't > + * needed as we poll on the MII status. > + */ > +}; > + > +static const struct usb_ether_methods muge_ue_methods = { > + .ue_attach_post = muge_attach_post, > + .ue_attach_post_sub = muge_attach_post_sub, > + .ue_start = muge_start, > + .ue_ioctl = muge_ioctl, > + .ue_init = muge_init, > + .ue_stop = muge_stop, > + .ue_tick = muge_tick, > + .ue_setmulti = muge_setmulti, > + .ue_setpromisc = muge_setpromisc, > + .ue_mii_upd = muge_ifmedia_upd, > + .ue_mii_sts = muge_ifmedia_sts, > +}; > + > +/** > + * lan78xx_read_reg - Read a 32-bit register on the device > + * @sc: driver soft context > + * @off: offset of the register > + * @data: pointer a value that will be populated with the register value > + * > + * LOCKING: > + * The device lock must be held before calling this function. > + * > + * RETURNS: > + * 0 on success, a USB_ERR_?? error code on failure. > + */ > +static int > +lan78xx_read_reg(struct muge_softc *sc, uint32_t off, uint32_t *data) > +{ > + struct usb_device_request req; > + uint32_t buf; > + usb_error_t err; > + > + MUGE_LOCK_ASSERT(sc, MA_OWNED); > + > + req.bmRequestType = UT_READ_VENDOR_DEVICE; > + req.bRequest = UVR_READ_REG; > + USETW(req.wValue, 0); > + USETW(req.wIndex, off); > + USETW(req.wLength, 4); > + > + err = uether_do_request(&sc->sc_ue, &req, &buf, 1000); > + if (err != 0) > + muge_warn_printf(sc, "Failed to read register 0x%0x\n", off); > + *data = le32toh(buf); > + return (err); > +} > + > +/** > + * lan78xx_write_reg - Write a 32-bit register on the device > + * @sc: driver soft context > + * @off: offset of the register > + * @data: the 32-bit value to write into the register > + * > + * LOCKING: > + * The device lock must be held before calling this function. > + * > + * RETURNS: > + * 0 on success, a USB_ERR_?? error code on failure. > + */ > +static int > +lan78xx_write_reg(struct muge_softc *sc, uint32_t off, uint32_t data) > +{ > + struct usb_device_request req; > + uint32_t buf; > + usb_error_t err; > + > + MUGE_LOCK_ASSERT(sc, MA_OWNED); > + > + buf = htole32(data); > + > + req.bmRequestType = UT_WRITE_VENDOR_DEVICE; > + req.bRequest = UVR_WRITE_REG; > + USETW(req.wValue, 0); > + USETW(req.wIndex, off); > + USETW(req.wLength, 4); > + > + err = uether_do_request(&sc->sc_ue, &req, &buf, 1000); > + if (err != 0) > + muge_warn_printf(sc, "Failed to write register 0x%0x\n", off); > + return (err); > +} > + > +/** > + * lan78xx_wait_for_bits - Poll on a register value until bits are > cleared > + * @sc: soft context > + * @reg: offset of the register > + * @bits: if the bits are clear the function returns > + * > + * LOCKING: > + * The device lock must be held before calling this function. > + * > + * RETURNS: > + * 0 on success, or a USB_ERR_?? error code on failure. > + */ > +static int > +lan78xx_wait_for_bits(struct muge_softc *sc, uint32_t reg, uint32_t > bits) > +{ > + usb_ticks_t start_ticks; > + const usb_ticks_t max_ticks = USB_MS_TO_TICKS(1000); > + uint32_t val; > + int err; > + > + MUGE_LOCK_ASSERT(sc, MA_OWNED); > + > + start_ticks = (usb_ticks_t)ticks; > + do { > + if ((err = lan78xx_read_reg(sc, reg, &val)) != 0) > + return (err); > + if (!(val & bits)) > + return (0); > + uether_pause(&sc->sc_ue, hz / 100); > + } while (((usb_ticks_t)(ticks - start_ticks)) < max_ticks); > + > + return (USB_ERR_TIMEOUT); > +} > + > +/** > + * lan78xx_eeprom_read_raw - Read the attached EEPROM > + * @sc: soft context > + * @off: the eeprom address offset > + * @buf: stores the bytes > + * @buflen: the number of bytes to read > + * > + * Simply reads bytes from an attached eeprom. > + * > + * LOCKING: > + * The function takes and releases the device lock if not already held. > + * > + * RETURNS: > + * 0 on success, or a USB_ERR_?? error code on failure. > + */ > +static int > +lan78xx_eeprom_read_raw(struct muge_softc *sc, uint16_t off, uint8_t > *buf, > + uint16_t buflen) > +{ > + usb_ticks_t start_ticks; > + const usb_ticks_t max_ticks = USB_MS_TO_TICKS(1000); > + int err, locked; > + uint32_t val, saved; > + uint16_t i; > + > + locked = mtx_owned(&sc->sc_mtx); /* XXX */ > + if (!locked) > + MUGE_LOCK(sc); > + > + err = lan78xx_read_reg(sc, HW_CFG, &val); > + saved = val; > + > + val &= ~(HW_CFG_LEDO_EN_ | HW_CFG_LED1_EN_); > + err = lan78xx_write_reg(sc, HW_CFG, val); > + > + err = lan78xx_wait_for_bits(sc, E2P_CMD, E2P_CMD_BUSY_); > + if (err != 0) { > + muge_warn_printf(sc, "eeprom busy, failed to read data\n"); > + goto done; > + } > + > + /* Start reading the bytes, one at a time. */ > + for (i = 0; i < buflen; i++) { > + val = E2P_CMD_BUSY_ | E2P_CMD_READ_; > + val |= (E2P_CMD_ADDR_MASK_ & (off + i)); > + if ((err = lan78xx_write_reg(sc, E2P_CMD, val)) != 0) > + goto done; > + > + start_ticks = (usb_ticks_t)ticks; > + do { > + if ((err = lan78xx_read_reg(sc, E2P_CMD, &val)) != 0) > + goto done; > + if (!(val & E2P_CMD_BUSY_) || (val & E2P_CMD_TIMEOUT_)) > + break; > + > + uether_pause(&sc->sc_ue, hz / 100); > + } while (((usb_ticks_t)(ticks - start_ticks)) < max_ticks); > + > + if (val & (E2P_CMD_BUSY_ | E2P_CMD_TIMEOUT_)) { > + muge_warn_printf(sc, "eeprom command failed\n"); > + err = USB_ERR_IOERROR; > + break; > + } > + > + if ((err = lan78xx_read_reg(sc, E2P_DATA, &val)) != 0) > + goto done; > + > + buf[i] = (val & 0xff); > + } > + > +done: > + if (!locked) > + MUGE_UNLOCK(sc); > + lan78xx_write_reg(sc, HW_CFG, saved); > + return (err); > +} > + > +/** > + * lan78xx_eeprom_read - Read EEPROM and confirm it is programmed > + * @sc: soft context > + * @off: the eeprom address offset > + * @buf: stores the bytes > + * @buflen: the number of bytes to read > + * > + * RETURNS: > + * 0 on success, or a USB_ERR_?? error code on failure. > + */ > +static int > +lan78xx_eeprom_read(struct muge_softc *sc, uint16_t off, uint8_t *buf, > + uint16_t buflen) > +{ > + uint8_t sig; > + int ret; > + > + ret = lan78xx_eeprom_read_raw(sc, E2P_INDICATOR_OFFSET, &sig, 1); > + if ((ret == 0) && (sig == E2P_INDICATOR)) { > + ret = lan78xx_eeprom_read_raw(sc, off, buf, buflen); > + muge_dbg_printf(sc, "EEPROM present\n"); > + } else { > + ret = -EINVAL; > + muge_dbg_printf(sc, "EEPROM not present\n"); > + } > + return ret; > +} > + > +/** > + * lan78xx_otp_read_raw > + * @sc: soft context > + * @off: the otp address offset > + * @buf: stores the bytes > + * @buflen: the number of bytes to read > + * > + * Simply reads bytes from the OTP. > + * > + * LOCKING: > + * The function takes and releases the device lock if not already held. > + * > + * RETURNS: > + * 0 on success, or a USB_ERR_?? error code on failure. > + * > + */ > +static int > +lan78xx_otp_read_raw(struct muge_softc *sc, uint16_t off, uint8_t *buf, > + uint16_t buflen) > +{ > + int locked, err; > + uint32_t val; > + uint16_t i; > + locked = mtx_owned(&sc->sc_mtx); > + if (!locked) > + MUGE_LOCK(sc); > + > + err = lan78xx_read_reg(sc, OTP_PWR_DN, &val); > + > + /* checking if bit is set */ > + if (val & OTP_PWR_DN_PWRDN_N) { > + /* clearing it, then waiting for it to be cleared */ > + lan78xx_write_reg(sc, OTP_PWR_DN, 0); > + err = lan78xx_wait_for_bits(sc, OTP_PWR_DN, OTP_PWR_DN_PWRDN_N); > + if (err != 0) { > + muge_warn_printf(sc, "OTP off? failed to read data\n"); > + goto done; > + } > + } > + /* start reading the bytes, one at a time */ > + for (i = 0; i < buflen; i++) { > + err = lan78xx_write_reg(sc, OTP_ADDR1, > + ((off + i) >> 8) & OTP_ADDR1_15_11); > + err = lan78xx_write_reg(sc, OTP_ADDR2, > + ((off + i) & OTP_ADDR2_10_3)); > + err = lan78xx_write_reg(sc, OTP_FUNC_CMD, OTP_FUNC_CMD_READ_); > + err = lan78xx_write_reg(sc, OTP_CMD_GO, OTP_CMD_GO_GO_); > + > + err = lan78xx_wait_for_bits(sc, OTP_STATUS, OTP_STATUS_BUSY_); > + if (err != 0) { > + muge_warn_printf(sc, "OTP busy failed to read data\n"); > + goto done; > + } > + > + if ((err = lan78xx_read_reg(sc, OTP_RD_DATA, &val)) != 0) > + goto done; > + > + buf[i] = (uint8_t)(val & 0xff); > + } > + > +done: > + if (!locked) > + MUGE_UNLOCK(sc); > + return (err); > +} > + > +/** > + * lan78xx_otp_read > + * @sc: soft context > + * @off: the otp address offset > + * @buf: stores the bytes > + * @buflen: the number of bytes to read > + * > + * Simply reads bytes from the otp. > + * > + * LOCKING: > + * The function takes and releases device lock if it is not already > held. > + * > + * RETURNS: > + * 0 on success, or a USB_ERR_?? error code on failure. > + */ > +static int > +lan78xx_otp_read(struct muge_softc *sc, uint16_t off, uint8_t *buf, > + uint16_t buflen) > +{ > + uint8_t sig; > + int err; > + > + err = lan78xx_otp_read_raw(sc, OTP_INDICATOR_OFFSET, &sig, 1); > + if (err == 0) { > + if (sig == OTP_INDICATOR_1) { > + } else if (sig == OTP_INDICATOR_2) { > + off += 0x100; > + } else { > + err = -EINVAL; > + } > + if(!err) > + err = lan78xx_otp_read_raw(sc, off, buf, buflen); > + } > + return err; > +} > + > +/** > + * lan78xx_setmacaddress - Set the mac address in the device > + * @sc: driver soft context > + * @addr: pointer to array contain at least 6 bytes of the mac > + * > + * LOCKING: > + * Should be called with the MUGE lock held. > + * > + * RETURNS: > + * Returns 0 on success or a negative error code. > + */ > +static int > +lan78xx_setmacaddress(struct muge_softc *sc, const uint8_t *addr) > +{ > + int err; > + uint32_t val; > + > + muge_dbg_printf(sc, > + "setting mac address to %02x:%02x:%02x:%02x:%02x:%02x\n", > + addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); > + > + MUGE_LOCK_ASSERT(sc, MA_OWNED); > + > + val = (addr[3] << 24) | (addr[2] << 16) | (addr[1] << 8) | addr[0]; > + if ((err = lan78xx_write_reg(sc, RX_ADDRL, val)) != 0) > + goto done; > + > + val = (addr[5] << 8) | addr[4]; > + err = lan78xx_write_reg(sc, RX_ADDRH, val); > + > +done: > + return (err); > +} > + > +/** > + * lan78xx_set_rx_max_frame_length > + * @sc: driver soft context > + * @size: pointer to array contain at least 6 bytes of the mac > + * > + * Sets the maximum frame length to be received. Frames bigger than > + * this size are aborted. > + * > + * RETURNS: > + * Returns 0 on success or a negative error code. > + */ > +static int > +lan78xx_set_rx_max_frame_length(struct muge_softc *sc, int size) > +{ > + int err = 0; > + uint32_t buf; > + bool rxenabled; > + > + /* first we have to disable rx before changing the length */ > + > + err = lan78xx_read_reg(sc, MAC_RX, &buf); > + rxenabled = ((buf & MAC_RX_EN_) != 0); > + > + if (rxenabled) { > + buf &= ~MAC_RX_EN_; > + err = lan78xx_write_reg(sc, MAC_RX, buf); > + } > + > + /* setting max frame length */ > + > + buf &= ~MAC_RX_MAX_FR_SIZE_MASK_; > + buf |= (((size + 4) << MAC_RX_MAX_FR_SIZE_SHIFT_) & > + MAC_RX_MAX_FR_SIZE_MASK_); > + err = lan78xx_write_reg(sc, MAC_RX, buf); > + > + /* If it were enabled before, we enable it back. */ > + > + if (rxenabled) { > + buf |= MAC_RX_EN_; > + err = lan78xx_write_reg(sc, MAC_RX, buf); > + } > + > + return 0; > +} > + > +/** > + * lan78xx_miibus_readreg - Read a MII/MDIO register > + * @dev: usb ether device > + * @phy: the number of phy reading from > + * @reg: the register address > + * > + * LOCKING: > + * Takes and releases the device mutex lock if not already held. > + * > + * RETURNS: > + * Returns the 16-bits read from the MII register, if this function > fails > + * 0 is returned. > + */ > +static int > +lan78xx_miibus_readreg(device_t dev, int phy, int reg) { > + > + struct muge_softc *sc = device_get_softc(dev); > + int locked; > + uint32_t addr, val; > + > + val = 0; > + locked = mtx_owned(&sc->sc_mtx); > + if (!locked) > + MUGE_LOCK(sc); > + > + if (lan78xx_wait_for_bits(sc, MII_ACCESS, MII_BUSY_) != 0) { > + muge_warn_printf(sc, "MII is busy\n"); > + goto done; > + } > + > + addr = (phy << 11) | (reg << 6) | MII_READ_ | MII_BUSY_; > + lan78xx_write_reg(sc, MII_ACCESS, addr); > + > + if (lan78xx_wait_for_bits(sc, MII_ACCESS, MII_BUSY_) != 0) { > + muge_warn_printf(sc, "MII read timeout\n"); > + goto done; > + } > + > + lan78xx_read_reg(sc, MII_DATA, &val); > + val = le32toh(val); > + > +done: > + if (!locked) > + MUGE_UNLOCK(sc); > + > + return (val & 0xFFFF); > +} > + > +/** > + * lan78xx_miibus_writereg - Writes a MII/MDIO register > + * @dev: usb ether device > + * @phy: the number of phy writing to > + * @reg: the register address > + * @val: the value to write > + * > + * Attempts to write a PHY register through the usb controller > registers. > + * > + * LOCKING: > + * Takes and releases the device mutex lock if not already held. > + * > + * RETURNS: > + * Always returns 0 regardless of success or failure. > + */ > +static int > +lan78xx_miibus_writereg(device_t dev, int phy, int reg, int val) > +{ > + struct muge_softc *sc = device_get_softc(dev); > + int locked; > + uint32_t addr; > + > + if (sc->sc_phyno != phy) > + return (0); > + > + locked = mtx_owned(&sc->sc_mtx); > + if (!locked) > + MUGE_LOCK(sc); > + > + if (lan78xx_wait_for_bits(sc, MII_ACCESS, MII_BUSY_) != 0) { > + muge_warn_printf(sc, "MII is busy\n"); > + goto done; > + } > + > + val = htole32(val); > + lan78xx_write_reg(sc, MII_DATA, val); > + > + addr = (phy << 11) | (reg << 6) | MII_WRITE_ | MII_BUSY_; > + lan78xx_write_reg(sc, MII_ACCESS, addr); > + > + if (lan78xx_wait_for_bits(sc, MII_ACCESS, MII_BUSY_) != 0) > + muge_warn_printf(sc, "MII write timeout\n"); > + > +done: > + if (!locked) > + MUGE_UNLOCK(sc); > + return (0); > +} > + > +/* > + * lan78xx_miibus_statchg - Called to detect phy status change > + * @dev: usb ether device > + * > + * This function is called periodically by the system to poll for status > + * changes of the link. > + * > + * LOCKING: > + * Takes and releases the device mutex lock if not already held. > + */ > +static void > +lan78xx_miibus_statchg(device_t dev) > +{ > + struct muge_softc *sc = device_get_softc(dev); > + struct mii_data *mii = uether_getmii(&sc->sc_ue); > + struct ifnet *ifp; > + int locked; > + int err; > + uint32_t flow = 0; > + uint32_t fct_flow = 0; > + > + locked = mtx_owned(&sc->sc_mtx); > + if (!locked) > + MUGE_LOCK(sc); > + > + ifp = uether_getifp(&sc->sc_ue); > + if (mii == NULL || ifp == NULL || > + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) > + goto done; > + > + /* Use the MII status to determine link status */ > + sc->sc_flags &= ~MUGE_FLAG_LINK; > + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == > + (IFM_ACTIVE | IFM_AVALID)) { > + muge_dbg_printf(sc, "media is active\n"); > + switch (IFM_SUBTYPE(mii->mii_media_active)) { > + case IFM_10_T: > + case IFM_100_TX: > + sc->sc_flags |= MUGE_FLAG_LINK; > + muge_dbg_printf(sc, "10/100 ethernet\n"); > + break; > + case IFM_1000_T: > + sc->sc_flags |= MUGE_FLAG_LINK; > + muge_dbg_printf(sc, "Gigabit ethernet\n"); > + break; > + default: > + break; > + } > + } > + /* Lost link, do nothing. */ > + if ((sc->sc_flags & MUGE_FLAG_LINK) == 0) { > + muge_dbg_printf(sc, "link flag not set\n"); > + goto done; > + } > + > + err = lan78xx_read_reg(sc, FCT_FLOW, &fct_flow); > + if (err) { > + muge_warn_printf(sc, > + "failed to read initial flow control thresholds, error %d\n", > + err); > + goto done; > + } > + > + /* Enable/disable full duplex operation and TX/RX pause */ > + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) { > + muge_dbg_printf(sc, "full duplex operation\n"); > + > + /* enable transmit MAC flow control function */ > + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) != 0) > + flow |= FLOW_CR_TX_FCEN_ | 0xFFFF; > + > + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) != 0) > + flow |= FLOW_CR_RX_FCEN_; > + } > + > + switch(usbd_get_speed(sc->sc_ue.ue_udev)) { > + case USB_SPEED_SUPER: > + fct_flow = 0x817; /* XXX */ > + break; > + case USB_SPEED_HIGH: > + fct_flow = 0x211; /* XXX */ > + break; > + default: > + break; > + } > + > + err += lan78xx_write_reg(sc, FLOW, flow); > + err += lan78xx_write_reg(sc, FCT_FLOW, fct_flow); > + if (err) > + muge_warn_printf(sc, "media change failed, error %d\n", err); > + > +done: > + if (!locked) > + MUGE_UNLOCK(sc); > +} > + > +/* > + * lan78xx_set_mdix_auto - Configure the device to enable automatic > + * crossover and polarity detection. LAN7800 provides HP Auto-MDIX > + * functionality for seamless crossover and polarity detection. > + * > + * @sc: driver soft context > + * > + * LOCKING: > + * Takes and releases the device mutex lock if not already held. > + */ > +static void > +lan78xx_set_mdix_auto(struct muge_softc *sc) > +{ > + uint32_t buf, err; > + > + err = lan78xx_miibus_writereg(sc->sc_ue.ue_dev, sc->sc_phyno, > + MUGE_EXT_PAGE_ACCESS, MUGE_EXT_PAGE_SPACE_1); > + > + buf = lan78xx_miibus_readreg(sc->sc_ue.ue_dev, sc->sc_phyno, > + MUGE_EXT_MODE_CTRL); > + buf &= ~MUGE_EXT_MODE_CTRL_MDIX_MASK_; > + buf |= MUGE_EXT_MODE_CTRL_AUTO_MDIX_; > + > + lan78xx_miibus_readreg(sc->sc_ue.ue_dev, sc->sc_phyno, MII_BMCR); > + err += lan78xx_miibus_writereg(sc->sc_ue.ue_dev, sc->sc_phyno, > + MUGE_EXT_MODE_CTRL, buf); > + > + err += lan78xx_miibus_writereg(sc->sc_ue.ue_dev, sc->sc_phyno, > + MUGE_EXT_PAGE_ACCESS, MUGE_EXT_PAGE_SPACE_0); > + > + if (err != 0) > + muge_warn_printf(sc, "error setting PHY's MDIX status\n"); > + > + sc->sc_mdix_ctl = buf; > +} > + > +/** > + * lan78xx_phy_init - Initialises the in-built MUGE phy > + * @sc: driver soft context > + * > + * Resets the PHY part of the chip and then initialises it to default > + * values. The 'link down' and 'auto-negotiation complete' interrupts > + * from the PHY are also enabled, however we don't monitor the interrupt > + * endpoints for the moment. > + * > + * RETURNS: > + * Returns 0 on success or EIO if failed to reset the PHY. > + */ > +static int > +lan78xx_phy_init(struct muge_softc *sc) > +{ > + muge_dbg_printf(sc, "Initializing PHY.\n"); > + uint16_t bmcr; > + usb_ticks_t start_ticks; > + const usb_ticks_t max_ticks = USB_MS_TO_TICKS(1000); > + > + MUGE_LOCK_ASSERT(sc, MA_OWNED); > + > + /* Reset phy and wait for reset to complete */ > + lan78xx_miibus_writereg(sc->sc_ue.ue_dev, sc->sc_phyno, MII_BMCR, > + BMCR_RESET); > + > + start_ticks = ticks; > + do { > + uether_pause(&sc->sc_ue, hz / 100); > + bmcr = lan78xx_miibus_readreg(sc->sc_ue.ue_dev, sc->sc_phyno, > + MII_BMCR); > + } while ((bmcr & BMCR_RESET) && ((ticks - start_ticks) < max_ticks)); > + > + if (((usb_ticks_t)(ticks - start_ticks)) >= max_ticks) { > + muge_err_printf(sc, "PHY reset timed-out\n"); > + return (EIO); > + } > + > + /* Setup phy to interrupt upon link down or autoneg completion. */ > + lan78xx_miibus_readreg(sc->sc_ue.ue_dev, sc->sc_phyno, > + MUGE_PHY_INTR_STAT); > + lan78xx_miibus_writereg(sc->sc_ue.ue_dev, sc->sc_phyno, > + MUGE_PHY_INTR_MASK, > + (MUGE_PHY_INTR_ANEG_COMP | MUGE_PHY_INTR_LINK_CHANGE)); > + > + /* Enable Auto-MDIX for crossover and polarity detection. */ > + lan78xx_set_mdix_auto(sc); > + > + /* Enable all modes. */ > + lan78xx_miibus_writereg(sc->sc_ue.ue_dev, sc->sc_phyno, MII_ANAR, > + ANAR_10 | ANAR_10_FD | ANAR_TX | ANAR_TX_FD | > + ANAR_CSMA | ANAR_FC | ANAR_PAUSE_ASYM); > + > + /* Restart auto-negotation */ > + bmcr |= BMCR_STARTNEG; > + bmcr |= BMCR_AUTOEN; > + lan78xx_miibus_writereg(sc->sc_ue.ue_dev, sc->sc_phyno, MII_BMCR, > bmcr); > + bmcr = lan78xx_miibus_readreg(sc->sc_ue.ue_dev, sc->sc_phyno, > MII_BMCR); > + return (0); > +} > + > +/** > + * lan78xx_chip_init - Initialises the chip after power on > + * @sc: driver soft context > + * > + * This initialisation sequence is modelled on the procedure in the > Linux > + * driver. > + * > + * RETURNS: > + * Returns 0 on success or an error code on failure. > + */ > +static int > +lan78xx_chip_init(struct muge_softc *sc) > +{ > + int err; > + int locked; > + uint32_t buf; > + uint32_t burst_cap; > + > + locked = mtx_owned(&sc->sc_mtx); > + if (!locked) > + MUGE_LOCK(sc); > + > + /* Enter H/W config mode */ > + lan78xx_write_reg(sc, HW_CFG, HW_CFG_LRST_); > + > + if ((err = lan78xx_wait_for_bits(sc, HW_CFG, HW_CFG_LRST_)) != 0) { > + muge_warn_printf(sc, > + "timed-out waiting for lite reset to complete\n"); > + goto init_failed; > + } > + > + /* Set the mac address */ > + if ((err = lan78xx_setmacaddress(sc, sc->sc_ue.ue_eaddr)) != 0) { > + muge_warn_printf(sc, "failed to set the MAC address\n"); > + goto init_failed; > + } > + > + /* Read and display the revision register */ > + if ((err = lan78xx_read_reg(sc, ID_REV, &sc->sc_rev_id)) < 0) { > + muge_warn_printf(sc, "failed to read ID_REV (err = %d)\n", err); > + goto init_failed; > + } > + > + device_printf(sc->sc_ue.ue_dev, "chip 0x%04lx, rev. %04lx\n", > + (sc->sc_rev_id & ID_REV_CHIP_ID_MASK_) >> 16, > + (sc->sc_rev_id & ID_REV_CHIP_REV_MASK_)); > + > + /* Respond to BULK-IN tokens with a NAK when RX FIFO is empty. */ > + if ((err = lan78xx_read_reg(sc, USB_CFG0, &buf)) != 0) { > + muge_warn_printf(sc, "failed to read USB_CFG0: %d\n", err); > + goto init_failed; > + } > + buf |= USB_CFG_BIR_; > + lan78xx_write_reg(sc, USB_CFG0, buf); > + > + /* > + * LTM support will go here. > + */ > + > + /* Configuring the burst cap. */ > + switch (usbd_get_speed(sc->sc_ue.ue_udev)) { > + case USB_SPEED_SUPER: > + burst_cap = MUGE_DEFAULT_BURST_CAP_SIZE/MUGE_SS_USB_PKT_SIZE; > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-svn-src-head@freebsd.org Mon May 28 21:05:01 2018 Return-Path: Delivered-To: svn-src-head@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 D6E3AEF0480; Mon, 28 May 2018 21:05:01 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 72D3D873CD; Mon, 28 May 2018 21:05:01 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 511DC12998; Mon, 28 May 2018 21:05:01 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SL51VT036524; Mon, 28 May 2018 21:05:01 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SL51MW036523; Mon, 28 May 2018 21:05:01 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201805282105.w4SL51MW036523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 28 May 2018 21:05:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334297 - head/sys/arm64/include X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm64/include X-SVN-Commit-Revision: 334297 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 21:05:02 -0000 Author: manu Date: Mon May 28 21:05:00 2018 New Revision: 334297 URL: https://svnweb.freebsd.org/changeset/base/334297 Log: arm64: fix atomic_fcmpset_16 newval needs to be uint16_t Reported by: andrew Modified: head/sys/arm64/include/atomic.h Modified: head/sys/arm64/include/atomic.h ============================================================================== --- head/sys/arm64/include/atomic.h Mon May 28 20:47:39 2018 (r334296) +++ head/sys/arm64/include/atomic.h Mon May 28 21:05:00 2018 (r334297) @@ -127,7 +127,7 @@ atomic_fcmpset_##bar##8(volatile uint8_t *p, uint8_t * \ static __inline int \ atomic_fcmpset_##bar##16(volatile uint16_t *p, uint16_t *cmpval, \ - uint8_t newval) \ + uint16_t newval) \ { \ uint16_t tmp; \ uint16_t _cmpval = *cmpval; \ From owner-svn-src-head@freebsd.org Mon May 28 23:12:27 2018 Return-Path: Delivered-To: svn-src-head@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 77A20EFD8D2; Mon, 28 May 2018 23:12:27 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 296F669337; Mon, 28 May 2018 23:12:27 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BFB013E16; Mon, 28 May 2018 23:12:27 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SNCQIk001160; Mon, 28 May 2018 23:12:26 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SNCQEe001158; Mon, 28 May 2018 23:12:26 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805282312.w4SNCQEe001158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Mon, 28 May 2018 23:12:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334298 - head/sys/dev/hwpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/dev/hwpmc X-SVN-Commit-Revision: 334298 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 23:12:27 -0000 Author: mmacy Date: Mon May 28 23:12:26 2018 New Revision: 334298 URL: https://svnweb.freebsd.org/changeset/base/334298 Log: hwpmc_logging.c: don't call wakeup_one with thread lock held, don't malloc(M_WAITOK) in an epoch section Modified: head/sys/dev/hwpmc/hwpmc_logging.c head/sys/dev/hwpmc/hwpmc_mod.c Modified: head/sys/dev/hwpmc/hwpmc_logging.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_logging.c Mon May 28 21:05:00 2018 (r334297) +++ head/sys/dev/hwpmc/hwpmc_logging.c Mon May 28 23:12:26 2018 (r334298) @@ -166,13 +166,17 @@ static struct mtx pmc_kthread_mtx; /* sleep lock */ pmclog_release((PO)); \ } while (0) +#define PMCLOG_DESPATCH_SCHED_LOCK(PO) \ + pmclog_release_flags((PO), 0); \ + } while (0) + #define PMCLOG_DESPATCH(PO) \ pmclog_release((PO)); \ spinlock_exit(); \ } while (0) #define PMCLOG_DESPATCH_SYNC(PO) \ - pmclog_schedule_io((PO)); \ + pmclog_schedule_io((PO), 1); \ spinlock_exit(); \ } while (0) @@ -224,7 +228,7 @@ static int pmclog_get_buffer(struct pmc_owner *po); static void pmclog_loop(void *arg); static void pmclog_release(struct pmc_owner *po); static uint32_t *pmclog_reserve(struct pmc_owner *po, int length); -static void pmclog_schedule_io(struct pmc_owner *po); +static void pmclog_schedule_io(struct pmc_owner *po, int wakeup); static void pmclog_schedule_all(struct pmc_owner *po); static void pmclog_stop_kthread(struct pmc_owner *po); @@ -422,7 +426,7 @@ pmclog_loop(void *arg) break; (void) msleep(po, &pmc_kthread_mtx, PWAIT, - "pmcloop", 0); + "pmcloop", 250); continue; } @@ -504,7 +508,7 @@ pmclog_loop(void *arg) */ static void -pmclog_release(struct pmc_owner *po) +pmclog_release_flags(struct pmc_owner *po, int wakeup) { struct pmclog_buffer *plb; @@ -518,12 +522,19 @@ pmclog_release(struct pmc_owner *po) /* schedule an I/O if we've filled a buffer */ if (plb->plb_ptr >= plb->plb_fence) - pmclog_schedule_io(po); + pmclog_schedule_io(po, wakeup); PMCDBG1(LOG,REL,1, "po=%p", po); } +static void +pmclog_release(struct pmc_owner *po) +{ + pmclog_release_flags(po, 1); +} + + /* * Attempt to reserve 'length' bytes of space in an owner's log * buffer. The function returns a pointer to 'length' bytes of space @@ -583,7 +594,7 @@ pmclog_reserve(struct pmc_owner *po, int length) * Otherwise, schedule the current buffer for output and get a * fresh buffer. */ - pmclog_schedule_io(po); + pmclog_schedule_io(po, 0); if (pmclog_get_buffer(po) != 0) goto fail; @@ -621,7 +632,7 @@ pmclog_reserve(struct pmc_owner *po, int length) */ static void -pmclog_schedule_io(struct pmc_owner *po) +pmclog_schedule_io(struct pmc_owner *po, int wakeup) { struct pmclog_buffer *plb; @@ -645,7 +656,8 @@ pmclog_schedule_io(struct pmc_owner *po) mtx_lock_spin(&po->po_mtx); TAILQ_INSERT_TAIL(&po->po_logbuffers, plb, plb_next); mtx_unlock_spin(&po->po_mtx); - wakeup_one(po); + if (wakeup) + wakeup_one(po); } /* @@ -841,7 +853,7 @@ pmclog_schedule_one_cond(void *arg) PMC_CALL_HOOK_UNLOCKED(curthread, PMC_FN_DO_SAMPLES, NULL); plb = po->po_curbuf[curcpu]; if (plb && plb->plb_ptr != plb->plb_base) - pmclog_schedule_io(po); + pmclog_schedule_io(po, 1); spinlock_exit(); } @@ -1048,12 +1060,12 @@ pmclog_process_proccsw(struct pmc *pm, struct pmc_proc po = pm->pm_owner; - PMCLOG_RESERVE(po, PROCCSW, sizeof(struct pmclog_proccsw)); + PMCLOG_RESERVE_SAFE(po, PROCCSW, sizeof(struct pmclog_proccsw)); PMCLOG_EMIT32(pm->pm_id); PMCLOG_EMIT64(v); PMCLOG_EMIT32(pp->pp_proc->p_pid); PMCLOG_EMIT32(td->td_tid); - PMCLOG_DESPATCH(po); + PMCLOG_DESPATCH_SCHED_LOCK(po); } void Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Mon May 28 21:05:00 2018 (r334297) +++ head/sys/dev/hwpmc/hwpmc_mod.c Mon May 28 23:12:26 2018 (r334298) @@ -2406,8 +2406,10 @@ pmc_find_thread_descriptor(struct pmc_process *pp, str */ if (mode & PMC_FLAG_ALLOCATE) { if ((ptnew = pmc_thread_descriptor_pool_alloc()) == NULL) { - wait_flag = (mode & PMC_FLAG_NOWAIT) ? M_NOWAIT : - M_WAITOK; + wait_flag = M_WAITOK; + if ((mode & PMC_FLAG_NOWAIT) || in_epoch()) + wait_flag = M_NOWAIT; + ptnew = malloc(THREADENTRY_SIZE, M_PMC, wait_flag|M_ZERO); } From owner-svn-src-head@freebsd.org Mon May 28 23:14:39 2018 Return-Path: Delivered-To: svn-src-head@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 3020CEFDA9C; Mon, 28 May 2018 23:14:39 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DA1EA694E3; Mon, 28 May 2018 23:14:38 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B84B913E20; Mon, 28 May 2018 23:14:38 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SNEcCn001291; Mon, 28 May 2018 23:14:38 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SNEcol001290; Mon, 28 May 2018 23:14:38 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805282314.w4SNEcol001290@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Mon, 28 May 2018 23:14:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334299 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 334299 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 23:14:39 -0000 Author: mmacy Date: Mon May 28 23:14:38 2018 New Revision: 334299 URL: https://svnweb.freebsd.org/changeset/base/334299 Log: witness/hwpmc: fix locking order for pmc locks Modified: head/sys/kern/subr_witness.c Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Mon May 28 23:12:26 2018 (r334298) +++ head/sys/kern/subr_witness.c Mon May 28 23:14:38 2018 (r334299) @@ -499,12 +499,12 @@ static struct witness_order_list_entry order_lists[] = { "pipe mutex", &lock_class_mtx_sleep }, { "sigio lock", &lock_class_mtx_sleep }, { "process group", &lock_class_mtx_sleep }, - { "process lock", &lock_class_mtx_sleep }, - { "session", &lock_class_mtx_sleep }, - { "uidinfo hash", &lock_class_rw }, #ifdef HWPMC_HOOKS { "pmc-sleep", &lock_class_mtx_sleep }, #endif + { "process lock", &lock_class_mtx_sleep }, + { "session", &lock_class_mtx_sleep }, + { "uidinfo hash", &lock_class_rw }, { "time lock", &lock_class_mtx_sleep }, { NULL, NULL }, /* @@ -671,9 +671,6 @@ static struct witness_order_list_entry order_lists[] = { "uart_hwmtx", &lock_class_mtx_spin }, { "fast_taskqueue", &lock_class_mtx_spin }, { "intr table", &lock_class_mtx_spin }, -#ifdef HWPMC_HOOKS - { "pmc-per-proc", &lock_class_mtx_spin }, -#endif { "process slock", &lock_class_mtx_spin }, { "syscons video lock", &lock_class_mtx_spin }, { "sleepq chain", &lock_class_mtx_spin }, @@ -690,6 +687,12 @@ static struct witness_order_list_entry order_lists[] = #ifdef __powerpc__ { "tlb0", &lock_class_mtx_spin }, #endif + { NULL, NULL }, + { "sched lock", &lock_class_mtx_spin }, +#ifdef HWPMC_HOOKS + { "pmc-per-proc", &lock_class_mtx_spin }, +#endif + { NULL, NULL }, /* * leaf locks */ From owner-svn-src-head@freebsd.org Mon May 28 23:16:40 2018 Return-Path: Delivered-To: svn-src-head@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 AF546EFDD18; Mon, 28 May 2018 23:16:40 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 61A8D696DC; Mon, 28 May 2018 23:16:40 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42EB413E22; Mon, 28 May 2018 23:16:40 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SNGeZG001411; Mon, 28 May 2018 23:16:40 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SNGetx001410; Mon, 28 May 2018 23:16:40 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805282316.w4SNGetx001410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Mon, 28 May 2018 23:16:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334300 - head/sys/dev/hwpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/dev/hwpmc X-SVN-Commit-Revision: 334300 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 23:16:40 -0000 Author: mmacy Date: Mon May 28 23:16:39 2018 New Revision: 334300 URL: https://svnweb.freebsd.org/changeset/base/334300 Log: hwmpc: fix brain-damaged handling of thread descriptor freeing Modified: head/sys/dev/hwpmc/hwpmc_mod.c Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Mon May 28 23:14:38 2018 (r334299) +++ head/sys/dev/hwpmc/hwpmc_mod.c Mon May 28 23:16:39 2018 (r334300) @@ -2351,9 +2351,9 @@ pmc_thread_descriptor_pool_free_task(void *arg __unuse /* Determine what changes, if any, we need to make. */ mtx_lock_spin(&pmc_threadfreelist_mtx); delta = pmc_threadfreelist_entries - pmc_threadfreelist_max; - while (delta > 0) { - pt = LIST_FIRST(&pmc_threadfreelist); - MPASS(pt); + while (delta > 0 && + (pt = LIST_FIRST(&pmc_threadfreelist)) != NULL) { + delta--; LIST_REMOVE(pt, pt_next); LIST_INSERT_HEAD(&tmplist, pt, pt_next); } @@ -2361,7 +2361,7 @@ pmc_thread_descriptor_pool_free_task(void *arg __unuse /* If there are entries to free, free them. */ while (!LIST_EMPTY(&tmplist)) { - pt = LIST_FIRST(&pmc_threadfreelist); + pt = LIST_FIRST(&tmplist); LIST_REMOVE(pt, pt_next); free(pt, M_PMC); } From owner-svn-src-head@freebsd.org Mon May 28 23:17:59 2018 Return-Path: Delivered-To: svn-src-head@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 CAB55EFDE6D; Mon, 28 May 2018 23:17:58 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7C13D6985A; Mon, 28 May 2018 23:17:58 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D51413E23; Mon, 28 May 2018 23:17:58 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SNHwb7001499; Mon, 28 May 2018 23:17:58 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SNHw1l001498; Mon, 28 May 2018 23:17:58 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805282317.w4SNHw1l001498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Mon, 28 May 2018 23:17:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334301 - head/sys/dev/hwpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/dev/hwpmc X-SVN-Commit-Revision: 334301 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 23:17:59 -0000 Author: mmacy Date: Mon May 28 23:17:57 2018 New Revision: 334301 URL: https://svnweb.freebsd.org/changeset/base/334301 Log: hwpmc: make pmc class specification work to enable fixed function counters Modified: head/sys/dev/hwpmc/hwpmc_mod.c Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Mon May 28 23:16:39 2018 (r334300) +++ head/sys/dev/hwpmc/hwpmc_mod.c Mon May 28 23:17:57 2018 (r334301) @@ -3253,7 +3253,17 @@ pmc_stop(struct pmc *pm) return (error); } +static struct pmc_classdep * +pmc_class_to_classdep(enum pmc_class class) +{ + int n; + for (n = 0; n < md->pmd_nclass; n++) + if (md->pmd_classdep[n].pcd_class == class) + return (&md->pmd_classdep[n]); + return (NULL); +} + #ifdef HWPMC_DEBUG static const char *pmc_op_to_name[] = { #undef __PMC_OP @@ -3816,16 +3826,14 @@ pmc_syscall_handler(struct thread *td, void *syscall_a caps |= PMC_CAP_INTERRUPT; /* A valid class specifier should have been passed in. */ - for (n = 0; n < md->pmd_nclass; n++) - if (md->pmd_classdep[n].pcd_class == pa.pm_class) - break; - if (n == md->pmd_nclass) { + pcd = pmc_class_to_classdep(pa.pm_class); + if (pcd == NULL) { error = EINVAL; break; } /* The requested PMC capabilities should be feasible. */ - if ((md->pmd_classdep[n].pcd_caps & caps) != caps) { + if ((pcd->pcd_caps & caps) != caps) { error = EOPNOTSUPP; break; } @@ -3852,7 +3860,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_a if (PMC_IS_SYSTEM_MODE(mode)) { pmc_select_cpu(cpu); - for (n = 0; n < (int) md->pmd_npmc; n++) { + for (n = pcd->pcd_ri; n < (int) md->pmd_npmc; n++) { pcd = pmc_ri_to_classdep(md, n, &adjri); if (pmc_can_allocate_row(n, mode) == 0 && pmc_can_allocate_rowindex( @@ -3865,7 +3873,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_a } } else { /* Process virtual mode */ - for (n = 0; n < (int) md->pmd_npmc; n++) { + for (n = pcd->pcd_ri; n < (int) md->pmd_npmc; n++) { pcd = pmc_ri_to_classdep(md, n, &adjri); if (pmc_can_allocate_row(n, mode) == 0 && pmc_can_allocate_rowindex( @@ -3929,6 +3937,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_a } pmc->pm_state = PMC_STATE_ALLOCATED; + pmc->pm_class = pa.pm_class; /* * mark row disposition From owner-svn-src-head@freebsd.org Mon May 28 23:20:09 2018 Return-Path: Delivered-To: svn-src-head@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 4751AEFE01A; Mon, 28 May 2018 23:20:09 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D8E8969A32; Mon, 28 May 2018 23:20:08 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C13E13E27; Mon, 28 May 2018 23:20:08 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SNK8Oe001651; Mon, 28 May 2018 23:20:08 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SNK8Gw001650; Mon, 28 May 2018 23:20:08 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201805282320.w4SNK8Gw001650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= Date: Mon, 28 May 2018 23:20:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334302 - head/sys/teken X-SVN-Group: head X-SVN-Commit-Author: dumbbell X-SVN-Commit-Paths: head/sys/teken X-SVN-Commit-Revision: 334302 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 23:20:09 -0000 Author: dumbbell Date: Mon May 28 23:20:08 2018 New Revision: 334302 URL: https://svnweb.freebsd.org/changeset/base/334302 Log: teken: Sort DECSCUSR alphabetically While here, align columns again. Reported by: bde Modified: head/sys/teken/sequences Modified: head/sys/teken/sequences ============================================================================== --- head/sys/teken/sequences Mon May 28 23:17:57 2018 (r334301) +++ head/sys/teken/sequences Mon May 28 23:20:08 2018 (r334302) @@ -34,83 +34,83 @@ # - `r' regular numeric argument # - `v' means a variable number of arguments -# Abbr Name Sequence Arguments -CBT Cursor Backward Tabulation ^[ [ Z n -CHT Cursor Forward Tabulation ^[ [ I n -CNL Cursor Next Line ^[ [ E n -CPL Cursor Previous Line ^[ [ F n -CPR Cursor Position Report ^[ [ n r -CUB Cursor Backward ^[ [ D n -CUD Cursor Down ^[ [ B n -CUD Cursor Down ^[ [ e n -CUF Cursor Forward ^[ [ C n -CUF Cursor Forward ^[ [ a n -CUP Cursor Position ^[ [ H n n -CUP Cursor Position ^[ [ f n n -CUU Cursor Up ^[ [ A n -DECSCUSR Set Cursor Style ^[ [ SP q r -DA1 Primary Device Attributes ^[ [ c r -DA2 Secondary Device Attributes ^[ [ > c r -DC Delete character ^[ [ P n -DCS Device Control String ^[ P -DECALN Alignment test ^[ # 8 -DECDHL Double Height Double Width Line Top ^[ # 3 -DECDHL Double Height Double Width Line Bottom ^[ # 4 -DECDWL Single Height Double Width Line ^[ # 6 -DECKPAM Keypad application mode ^[ = -DECKPNM Keypad numeric mode ^[ > -DECRC Restore cursor ^[ 8 -DECRC Restore cursor ^[ [ u -DECRM Reset DEC mode ^[ [ ? l r -DECSC Save cursor ^[ 7 -DECSC Save cursor ^[ [ s -DECSM Set DEC mode ^[ [ ? h r -DECSTBM Set top and bottom margins ^[ [ r r r -DECSWL Single Height Single Width Line ^[ # 5 -DL Delete line ^[ [ M n -DSR Device Status Report ^[ [ ? n r -ECH Erase character ^[ [ X n -ED Erase display ^[ [ J r -EL Erase line ^[ [ K r -G0SCS0 G0 SCS Special Graphics ^[ ( 0 -G0SCS1 G0 SCS US ASCII ^[ ( 1 -G0SCS2 G0 SCS Special Graphics ^[ ( 2 -G0SCSA G0 SCS UK National ^[ ( A -G0SCSB G0 SCS US ASCII ^[ ( B -G1SCS0 G1 SCS Special Graphics ^[ ) 0 -G1SCS1 G1 SCS US ASCII ^[ ) 1 -G1SCS2 G1 SCS Special Graphics ^[ ) 2 -G1SCSA G1 SCS UK National ^[ ) A -G1SCSB G1 SCS US ASCII ^[ ) B -HPA Horizontal Position Absolute ^[ [ G n -HPA Horizontal Position Absolute ^[ [ ` n -HTS Horizontal Tab Set ^[ H -ICH Insert character ^[ [ @ n -IL Insert line ^[ [ L n -IND Index ^[ D -NEL Next line ^[ E -OSC Operating System Command ^[ ] -RI Reverse index ^[ M -RIS Reset to Initial State ^[ c -RM Reset Mode ^[ [ l r -SD Pan Up ^[ [ T n -SGR Set Graphic Rendition ^[ [ m v -SM Set Mode ^[ [ h r -ST String Terminator ^[ \\ -SU Pan Down ^[ [ S n -TBC Tab Clear ^[ [ g r -VPA Vertical Position Absolute ^[ [ d n +# Abbr Name Sequence Arguments +CBT Cursor Backward Tabulation ^[ [ Z n +CHT Cursor Forward Tabulation ^[ [ I n +CNL Cursor Next Line ^[ [ E n +CPL Cursor Previous Line ^[ [ F n +CPR Cursor Position Report ^[ [ n r +CUB Cursor Backward ^[ [ D n +CUD Cursor Down ^[ [ B n +CUD Cursor Down ^[ [ e n +CUF Cursor Forward ^[ [ C n +CUF Cursor Forward ^[ [ a n +CUP Cursor Position ^[ [ H n n +CUP Cursor Position ^[ [ f n n +CUU Cursor Up ^[ [ A n +DA1 Primary Device Attributes ^[ [ c r +DA2 Secondary Device Attributes ^[ [ > c r +DC Delete character ^[ [ P n +DCS Device Control String ^[ P +DECALN Alignment test ^[ # 8 +DECDHL Double Height Double Width Line Top ^[ # 3 +DECDHL Double Height Double Width Line Bottom ^[ # 4 +DECDWL Single Height Double Width Line ^[ # 6 +DECKPAM Keypad application mode ^[ = +DECKPNM Keypad numeric mode ^[ > +DECRC Restore cursor ^[ 8 +DECRC Restore cursor ^[ [ u +DECRM Reset DEC mode ^[ [ ? l r +DECSC Save cursor ^[ 7 +DECSC Save cursor ^[ [ s +DECSCUSR Set Cursor Style ^[ [ SP q r +DECSM Set DEC mode ^[ [ ? h r +DECSTBM Set top and bottom margins ^[ [ r r r +DECSWL Single Height Single Width Line ^[ # 5 +DL Delete line ^[ [ M n +DSR Device Status Report ^[ [ ? n r +ECH Erase character ^[ [ X n +ED Erase display ^[ [ J r +EL Erase line ^[ [ K r +G0SCS0 G0 SCS Special Graphics ^[ ( 0 +G0SCS1 G0 SCS US ASCII ^[ ( 1 +G0SCS2 G0 SCS Special Graphics ^[ ( 2 +G0SCSA G0 SCS UK National ^[ ( A +G0SCSB G0 SCS US ASCII ^[ ( B +G1SCS0 G1 SCS Special Graphics ^[ ) 0 +G1SCS1 G1 SCS US ASCII ^[ ) 1 +G1SCS2 G1 SCS Special Graphics ^[ ) 2 +G1SCSA G1 SCS UK National ^[ ) A +G1SCSB G1 SCS US ASCII ^[ ) B +HPA Horizontal Position Absolute ^[ [ G n +HPA Horizontal Position Absolute ^[ [ ` n +HTS Horizontal Tab Set ^[ H +ICH Insert character ^[ [ @ n +IL Insert line ^[ [ L n +IND Index ^[ D +NEL Next line ^[ E +OSC Operating System Command ^[ ] +RI Reverse index ^[ M +RIS Reset to Initial State ^[ c +RM Reset Mode ^[ [ l r +SD Pan Up ^[ [ T n +SGR Set Graphic Rendition ^[ [ m v +SM Set Mode ^[ [ h r +ST String Terminator ^[ \\ +SU Pan Down ^[ [ S n +TBC Tab Clear ^[ [ g r +VPA Vertical Position Absolute ^[ [ d n # Cons25 compatibility sequences -C25BLPD Cons25 set bell pitch duration ^[ [ = B r r -C25BORD Cons25 set border ^[ [ = A r -C25DBG Cons25 set default background ^[ [ = G r -C25DFG Cons25 set default foreground ^[ [ = F r -C25GCS Cons25 set global cursor shape ^[ [ = C v -C25LCT Cons25 set local cursor type ^[ [ = S r -C25MODE Cons25 set terminal mode ^[ [ = T r -C25SGR Cons25 set graphic rendition ^[ [ x r r -C25VTSW Cons25 switch virtual terminal ^[ [ z r +C25BLPD Cons25 set bell pitch duration ^[ [ = B r r +C25BORD Cons25 set border ^[ [ = A r +C25DBG Cons25 set default background ^[ [ = G r +C25DFG Cons25 set default foreground ^[ [ = F r +C25GCS Cons25 set global cursor shape ^[ [ = C v +C25LCT Cons25 set local cursor type ^[ [ = S r +C25MODE Cons25 set terminal mode ^[ [ = T r +C25SGR Cons25 set graphic rendition ^[ [ x r r +C25VTSW Cons25 switch virtual terminal ^[ [ z r # VT52 compatibility #DECID VT52 DECID ^[ Z From owner-svn-src-head@freebsd.org Mon May 28 23:34:24 2018 Return-Path: Delivered-To: svn-src-head@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 44572EFEF62; Mon, 28 May 2018 23:34:24 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DC96B6A4D0; Mon, 28 May 2018 23:34:23 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA61F14158; Mon, 28 May 2018 23:34:23 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SNYNJZ011689; Mon, 28 May 2018 23:34:23 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SNYNId011688; Mon, 28 May 2018 23:34:23 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201805282334.w4SNYNId011688@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Mon, 28 May 2018 23:34:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334303 - head/usr.sbin/sysrc X-SVN-Group: head X-SVN-Commit-Author: dteske X-SVN-Commit-Paths: head/usr.sbin/sysrc X-SVN-Commit-Revision: 334303 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 23:34:24 -0000 Author: dteske Date: Mon May 28 23:34:23 2018 New Revision: 334303 URL: https://svnweb.freebsd.org/changeset/base/334303 Log: sysrc(8): Test variable names for invalid characters PR: bin/187461 Reported by: ebay@looksharp.net MFC after: 4 weeks X-MFC-to: stable/11 (after 11.2-R) Sponsored by: Smule, Inc. Modified: head/usr.sbin/sysrc/sysrc Modified: head/usr.sbin/sysrc/sysrc ============================================================================== --- head/usr.sbin/sysrc/sysrc Mon May 28 23:20:08 2018 (r334302) +++ head/usr.sbin/sysrc/sysrc Mon May 28 23:34:23 2018 (r334303) @@ -370,6 +370,18 @@ if [ "$LIST_SERVICE_CONFS" ]; then fi # +# Validate arguments +# +for name in "$@"; do + # NB: shell expansion syntax removed first + name="${name%%:[+=-]*}" + name="${name%%[%#+=-]*}" + [ "$name" = "${name#*[!$VALID_VARNAME_CHARS]}" ] || die \ + "%s: %s: name contains characters not allowed in shell" \ + "$pgm" "$name" +done + +# # Process `-s name' argument # if [ "$SERVICE" -a ! "${RC_CONFS+set}" ]; then From owner-svn-src-head@freebsd.org Tue May 29 00:19:24 2018 Return-Path: Delivered-To: svn-src-head@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 A3784F6FA33; Tue, 29 May 2018 00:19:24 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 457CE6BBC5; Tue, 29 May 2018 00:19:24 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2285D147D4; Tue, 29 May 2018 00:19:24 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4T0JNP4032463; Tue, 29 May 2018 00:19:23 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4T0JN8V032462; Tue, 29 May 2018 00:19:23 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805290019.w4T0JN8V032462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Tue, 29 May 2018 00:19:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334304 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 334304 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 00:19:24 -0000 Author: mmacy Date: Tue May 29 00:19:23 2018 New Revision: 334304 URL: https://svnweb.freebsd.org/changeset/base/334304 Log: hwpmc: add class field to identify which class a pmc came frome Modified: head/sys/sys/pmc.h Modified: head/sys/sys/pmc.h ============================================================================== --- head/sys/sys/pmc.h Mon May 28 23:34:23 2018 (r334303) +++ head/sys/sys/pmc.h Tue May 29 00:19:23 2018 (r334304) @@ -775,6 +775,7 @@ struct pmc { */ pmc_id_t pm_id; /* allocated PMC id */ + enum pmc_class pm_class; /* md extensions */ union pmc_md_pmc pm_md; From owner-svn-src-head@freebsd.org Tue May 29 00:53:55 2018 Return-Path: Delivered-To: svn-src-head@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 3A5B6F71C9C; Tue, 29 May 2018 00:53:55 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CFDCC6CD2A; Tue, 29 May 2018 00:53:54 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AAB6914E23; Tue, 29 May 2018 00:53:54 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4T0rs4V052003; Tue, 29 May 2018 00:53:54 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4T0rspX052002; Tue, 29 May 2018 00:53:54 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805290053.w4T0rspX052002@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Tue, 29 May 2018 00:53:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334305 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 334305 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 00:53:55 -0000 Author: mmacy Date: Tue May 29 00:53:53 2018 New Revision: 334305 URL: https://svnweb.freebsd.org/changeset/base/334305 Log: route: fix missed ref adds - ensure that we bump the ifa ref whenever we add a reference - defer freeing epoch protected references until after the if_purgaddrs loop Modified: head/sys/net/if.c head/sys/net/route.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue May 29 00:19:23 2018 (r334304) +++ head/sys/net/if.c Tue May 29 00:53:53 2018 (r334305) @@ -967,7 +967,7 @@ if_purgeaddrs(struct ifnet *ifp) { struct ifaddr *ifa, *next; - /* XXX cannot hold IF_ADDR_WLOCK over called functions. */ + NET_EPOCH_ENTER(); CK_STAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) { if (ifa->ifa_addr->sa_family == AF_LINK) continue; @@ -997,6 +997,7 @@ if_purgeaddrs(struct ifnet *ifp) IF_ADDR_WUNLOCK(ifp); ifa_free(ifa); } + NET_EPOCH_EXIT(); } /* @@ -2196,6 +2197,10 @@ link_rtrequest(int cmd, struct rtentry *rt, struct rt_ ifa = ifaof_ifpforaddr(dst, ifp); if (ifa) { oifa = rt->rt_ifa; + if (oifa != ifa) { + ifa_free(oifa); + ifa_ref(ifa); + } rt->rt_ifa = ifa; if (ifa->ifa_rtrequest && ifa->ifa_rtrequest != link_rtrequest) ifa->ifa_rtrequest(cmd, rt, info); @@ -3675,10 +3680,8 @@ if_delmulti_ifma_flags(struct ifmultiaddr *ifma, int f CK_STAILQ_FOREACH(oifp, &V_ifnet, if_link) if (ifp == oifp) break; - if (ifp != oifp) { - printf("%s: ifnet %p disappeared\n", __func__, ifp); + if (ifp != oifp) ifp = NULL; - } IFNET_RUNLOCK_NOSLEEP(); } #endif Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Tue May 29 00:19:23 2018 (r334304) +++ head/sys/net/route.c Tue May 29 00:53:53 2018 (r334305) @@ -653,6 +653,7 @@ rtredirect_fib(struct sockaddr *dst, info.rti_info[RTAX_DST] = dst; info.rti_info[RTAX_GATEWAY] = gateway; info.rti_info[RTAX_NETMASK] = netmask; + ifa_ref(ifa); info.rti_ifa = ifa; info.rti_flags = flags; error = rtrequest1_fib(RTM_ADD, &info, &rt, fibnum); @@ -899,7 +900,7 @@ rt_exportinfo(struct rtentry *rt, struct rt_addrinfo * info->rti_flags = rt->rt_flags; info->rti_ifp = rt->rt_ifp; info->rti_ifa = rt->rt_ifa; - + ifa_ref(info->rti_ifa); if (flags & NHR_REF) { /* Do 'traditional' refcouting */ if_ref(info->rti_ifp); @@ -1275,12 +1276,14 @@ int rt_getifa_fib(struct rt_addrinfo *info, u_int fibnum) { struct ifaddr *ifa; - int error = 0; + int needref, error; /* * ifp may be specified by sockaddr_dl * when protocol address is ambiguous. */ + error = 0; + needref = (info->rti_ifa == NULL); NET_EPOCH_ENTER(); if (info->rti_ifp == NULL && ifpaddr != NULL && ifpaddr->sa_family == AF_LINK && @@ -1303,7 +1306,7 @@ rt_getifa_fib(struct rt_addrinfo *info, u_int fibnum) info->rti_ifa = ifa_ifwithroute(flags, sa, sa, fibnum); } - if ((ifa = info->rti_ifa) != NULL) { + if (needref && info->rti_ifa != NULL) { if (info->rti_ifp == NULL) info->rti_ifp = ifa->ifa_ifp; ifa_ref(info->rti_ifa); @@ -1785,6 +1788,7 @@ rtrequest1_fib_change(struct rib_head *rnh, struct rt_ if (rt->rt_ifa->ifa_rtrequest != NULL) rt->rt_ifa->ifa_rtrequest(RTM_DELETE, rt, info); ifa_free(rt->rt_ifa); + rt->rt_ifa = NULL; } /* Update gateway address */ if (info->rti_info[RTAX_GATEWAY] != NULL) { @@ -1836,8 +1840,10 @@ rtrequest1_fib_change(struct rib_head *rnh, struct rt_ } bad: RT_UNLOCK(rt); - if (free_ifa != 0) + if (free_ifa != 0) { ifa_free(info->rti_ifa); + info->rti_ifa = NULL; + } return (error); } @@ -2052,6 +2058,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int flags, int fi * Do the actual request */ bzero((caddr_t)&info, sizeof(info)); + ifa_ref(ifa); info.rti_ifa = ifa; info.rti_flags = flags | (ifa->ifa_flags & ~IFA_RTSELF) | RTF_PINNED; From owner-svn-src-head@freebsd.org Tue May 29 01:16:01 2018 Return-Path: Delivered-To: svn-src-head@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 A24C6F73559; Tue, 29 May 2018 01:16:01 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 526A66DB89; Tue, 29 May 2018 01:16:01 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3309F15190; Tue, 29 May 2018 01:16:01 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4T1G1JM062274; Tue, 29 May 2018 01:16:01 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4T1G0CQ062271; Tue, 29 May 2018 01:16:00 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201805290116.w4T1G0CQ062271@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Tue, 29 May 2018 01:16:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334306 - in head: lib/libc/stdlib share/man/man3 X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: in head: lib/libc/stdlib share/man/man3 X-SVN-Commit-Revision: 334306 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 01:16:01 -0000 Author: vangyzen Date: Tue May 29 01:16:00 2018 New Revision: 334306 URL: https://svnweb.freebsd.org/changeset/base/334306 Log: Cross-reference abort2(2) from a few man pages I didn't know abort2 existed until it was mentioned on a mailing list. Mention it in related pages so others can find it easily. MFC after: 3 days Sponsored by: Dell EMC Modified: head/lib/libc/stdlib/abort.3 head/lib/libc/stdlib/exit.3 head/share/man/man3/assert.3 Modified: head/lib/libc/stdlib/abort.3 ============================================================================== --- head/lib/libc/stdlib/abort.3 Tue May 29 00:53:53 2018 (r334305) +++ head/lib/libc/stdlib/abort.3 Tue May 29 01:16:00 2018 (r334306) @@ -64,6 +64,7 @@ The function never returns. .Sh SEE ALSO +.Xr abort2 2 , .Xr sigaction 2 , .Xr exit 3 .Sh STANDARDS Modified: head/lib/libc/stdlib/exit.3 ============================================================================== --- head/lib/libc/stdlib/exit.3 Tue May 29 00:53:53 2018 (r334305) +++ head/lib/libc/stdlib/exit.3 Tue May 29 01:16:00 2018 (r334306) @@ -116,6 +116,7 @@ functions never return. .Sh SEE ALSO .Xr _exit 2 , +.Xr abort2 2 , .Xr wait 2 , .Xr at_quick_exit 3 , .Xr atexit 3 , Modified: head/share/man/man3/assert.3 ============================================================================== --- head/share/man/man3/assert.3 Tue May 29 00:53:53 2018 (r334305) +++ head/share/man/man3/assert.3 Tue May 29 01:16:00 2018 (r334306) @@ -85,6 +85,7 @@ generates a diagnostic message similar to the followin .Pp .Dl "Assertion failed: (1 == 0), function main, file assertion.c, line 100." .Sh SEE ALSO +.Xr abort2 2 , .Xr abort 3 .Sh STANDARDS The From owner-svn-src-head@freebsd.org Tue May 29 01:46:01 2018 Return-Path: Delivered-To: svn-src-head@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 70241F7655A; Tue, 29 May 2018 01:46:01 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 227E66F31C; Tue, 29 May 2018 01:46:01 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0302115706; Tue, 29 May 2018 01:46:01 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4T1k0Sa077088; Tue, 29 May 2018 01:46:00 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4T1k0lx077087; Tue, 29 May 2018 01:46:00 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201805290146.w4T1k0lx077087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Tue, 29 May 2018 01:46:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334307 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: araujo X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 334307 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 01:46:01 -0000 Author: araujo Date: Tue May 29 01:46:00 2018 New Revision: 334307 URL: https://svnweb.freebsd.org/changeset/base/334307 Log: Simplify macros EFPRINTF and EFFLUSH. [0] Also stdarg(3) says that each invocation of va_start() must be paired with a corresponding invocation of va_end() in the same function. [1] Reported by: Coverity CID: 1194318[0] and 1194332[1] Discussed with: jhb MFC after: 4 weeks. Sponsored by: iXsystems Inc. Differential Revision: https://reviews.freebsd.org/D15548 Modified: head/usr.sbin/bhyve/acpi.c Modified: head/usr.sbin/bhyve/acpi.c ============================================================================== --- head/usr.sbin/bhyve/acpi.c Tue May 29 01:16:00 2018 (r334306) +++ head/usr.sbin/bhyve/acpi.c Tue May 29 01:46:00 2018 (r334307) @@ -118,18 +118,14 @@ struct basl_fio { }; #define EFPRINTF(...) \ - err = fprintf(__VA_ARGS__); if (err < 0) goto err_exit; + if (fprintf(__VA_ARGS__) < 0) goto err_exit; #define EFFLUSH(x) \ - err = fflush(x); if (err != 0) goto err_exit; + if (fflush(x) != 0) goto err_exit; static int basl_fwrite_rsdp(FILE *fp) { - int err; - - err = 0; - EFPRINTF(fp, "/*\n"); EFPRINTF(fp, " * bhyve RSDP template\n"); EFPRINTF(fp, " */\n"); @@ -156,10 +152,6 @@ err_exit: static int basl_fwrite_rsdt(FILE *fp) { - int err; - - err = 0; - EFPRINTF(fp, "/*\n"); EFPRINTF(fp, " * bhyve RSDT template\n"); EFPRINTF(fp, " */\n"); @@ -196,10 +188,6 @@ err_exit: static int basl_fwrite_xsdt(FILE *fp) { - int err; - - err = 0; - EFPRINTF(fp, "/*\n"); EFPRINTF(fp, " * bhyve XSDT template\n"); EFPRINTF(fp, " */\n"); @@ -236,11 +224,8 @@ err_exit: static int basl_fwrite_madt(FILE *fp) { - int err; int i; - err = 0; - EFPRINTF(fp, "/*\n"); EFPRINTF(fp, " * bhyve MADT template\n"); EFPRINTF(fp, " */\n"); @@ -326,10 +311,6 @@ err_exit: static int basl_fwrite_fadt(FILE *fp) { - int err; - - err = 0; - EFPRINTF(fp, "/*\n"); EFPRINTF(fp, " * bhyve FADT template\n"); EFPRINTF(fp, " */\n"); @@ -547,10 +528,6 @@ err_exit: static int basl_fwrite_hpet(FILE *fp) { - int err; - - err = 0; - EFPRINTF(fp, "/*\n"); EFPRINTF(fp, " * bhyve HPET template\n"); EFPRINTF(fp, " */\n"); @@ -596,8 +573,6 @@ err_exit: static int basl_fwrite_mcfg(FILE *fp) { - int err = 0; - EFPRINTF(fp, "/*\n"); EFPRINTF(fp, " * bhyve MCFG template\n"); EFPRINTF(fp, " */\n"); @@ -629,10 +604,6 @@ err_exit: static int basl_fwrite_facs(FILE *fp) { - int err; - - err = 0; - EFPRINTF(fp, "/*\n"); EFPRINTF(fp, " * bhyve FACS template\n"); EFPRINTF(fp, " */\n"); @@ -666,7 +637,6 @@ void dsdt_line(const char *fmt, ...) { va_list ap; - int err; if (dsdt_error != 0) return; @@ -675,8 +645,10 @@ dsdt_line(const char *fmt, ...) if (dsdt_indent_level != 0) EFPRINTF(dsdt_fp, "%*c", dsdt_indent_level * 2, ' '); va_start(ap, fmt); - if (vfprintf(dsdt_fp, fmt, ap) < 0) + if (vfprintf(dsdt_fp, fmt, ap) < 0) { + va_end(ap); goto err_exit; + } va_end(ap); } EFPRINTF(dsdt_fp, "\n"); @@ -735,9 +707,6 @@ dsdt_fixed_mem32(uint32_t base, uint32_t length) static int basl_fwrite_dsdt(FILE *fp) { - int err; - - err = 0; dsdt_fp = fp; dsdt_error = 0; dsdt_indent_level = 0; From owner-svn-src-head@freebsd.org Tue May 29 02:16:10 2018 Return-Path: Delivered-To: svn-src-head@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 37596F78927; Tue, 29 May 2018 02:16:10 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id AB80370500; Tue, 29 May 2018 02:16:08 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id 4BACFD69643; Tue, 29 May 2018 12:16:00 +1000 (AEST) Date: Tue, 29 May 2018 12:16:00 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Maste cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334291 - head/lib/libc/string In-Reply-To: <201805281829.w4SITFQB055010@repo.freebsd.org> Message-ID: <20180529113434.J1472@besplex.bde.org> References: <201805281829.w4SITFQB055010@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=cIaQihWN c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=tu7e0SMpR-IVpYf90UQA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 02:16:10 -0000 On Mon, 28 May 2018, Ed Maste wrote: > Log: > strsep.3: don't silently ignore errors > > Reported by: bde > MFC with: r334275 Thanks. > Modified: head/lib/libc/string/strsep.3 > ============================================================================== > --- head/lib/libc/string/strsep.3 Mon May 28 17:47:32 2018 (r334290) > +++ head/lib/libc/string/strsep.3 Mon May 28 18:29:15 2018 (r334291) > @@ -86,9 +86,10 @@ to parse a string, and prints each token in separate l > char *token, *string, *tofree; > > tofree = string = strdup("abc,def,ghi"); > -if (string != NULL) > - while ((token = strsep(&string, ",")) != NULL) > - printf("%s\en", token); > +if (string == NULL) > + err(1, "strdup"); > +while ((token = strsep(&string, ",")) != NULL) > + printf("%s\en", token); > > free(tofree); > .Ed This error handling is now good enough for small utilities. (I would normally use xstrdup() and not repeat the comparison and err() in all callers. Callers could print a more specific error message, but this is too much for errors that "can't happen".) But this example shouldn't be complicated by showing correct style and/or technique for error handling. It should only try to show correct style and technique for using strsep(). It only uses strdup() because it is a contrived example with a fixed input string. String literals are const, so strsep() can't be used directly on them, except in bad examples for compilers that don't warn about this error. It uses strdup() to avoid this problem. Then it has to worry about error checking, error handling, and freeing for strdup(). The example ends up with more code for strdup() than for strsep(). The example still has a technical error. It says that the string is parsed and its tokens are printed. Actually, this only happens if strdup() didn't fail. The description doesn't mention the error handling in any way. Oops, there are many more technical errors. printf() can also fail. It is more likely than strdup() to fail with ENOMEM. As usual, errors in it are silenty ignored by not checking its return value. Most programs don't check ferr() on any stdio stream before exit(). This example is followed by another one that is missing all of these bugs, but has 3 related ones. Its string is named inputstring and must be produced elsewhere, but it is declared in the example so it is literally just uninitialized. The example doesn't preserve the string, but writes NULs into it and points argv[] to the resulting substrings. The description only gives a hint that the string will be overwritten and and must live as long as the pointers. The problem with not checking for errors from printf() is replaced by silently ignoring the error of having more tokens than fit in argv[]. argv[] has a fixed size of 10 elements to avoid complications. Old versions of the man page have only the second example. Bruce From owner-svn-src-head@freebsd.org Tue May 29 02:25:44 2018 Return-Path: Delivered-To: svn-src-head@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 B7E5CF793CA; Tue, 29 May 2018 02:25:44 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 293BF70B39; Tue, 29 May 2018 02:25:44 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 99AAA104EA37; Tue, 29 May 2018 12:25:30 +1000 (AEST) Date: Tue, 29 May 2018 12:25:29 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334302 - head/sys/teken In-Reply-To: <201805282320.w4SNK8Gw001650@repo.freebsd.org> Message-ID: <20180529121605.X1472@besplex.bde.org> References: <201805282320.w4SNK8Gw001650@repo.freebsd.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=nlC_4_pT8q9DhB4Ho9EA:9 a=87agubpw1GQBrC0HKgQA:9 a=45ClL6m2LaAA:10 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 02:25:44 -0000 On Mon, 28 May 2018, [UTF-8] Jean-S=C3=A9bastien P=C3=A9dron wrote: > Log: > teken: Sort DECSCUSR alphabetically > > While here, align columns again. > > Reported by:=09bde This unimproves the formatting of 73 lines to improve it for 1. The number of lines with msialigned columns remains unchanged at 1, since the #DECID line still has the old formatting. Marching to the right reduces the space available for the last field from 15-16 columns to 7-8. This field is for "Arguments". No sequences have too many args to fit in 7-8 columns. However, the header for this field takes 9 columns, so no longer fits. The full header now takes 81 columns, so is misformatted on terminals with less than 81 or 82 columns. Bruce From owner-svn-src-head@freebsd.org Tue May 29 02:41:33 2018 Return-Path: Delivered-To: svn-src-head@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 8A044F7A913; Tue, 29 May 2018 02:41:33 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3F0F0718D1; Tue, 29 May 2018 02:41:33 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2034D15FDC; Tue, 29 May 2018 02:41:33 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4T2fW8T004632; Tue, 29 May 2018 02:41:32 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4T2fWe7004629; Tue, 29 May 2018 02:41:32 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201805290241.w4T2fWe7004629@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Tue, 29 May 2018 02:41:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334308 - in head: lib/libc/stdlib share/man/man3 X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: in head: lib/libc/stdlib share/man/man3 X-SVN-Commit-Revision: 334308 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 02:41:33 -0000 Author: vangyzen Date: Tue May 29 02:41:32 2018 New Revision: 334308 URL: https://svnweb.freebsd.org/changeset/base/334308 Log: Bump the date on man pages in r334306 It seems a shame to ruin the patina of the June 4, 1993 date on abort.3, especially since it still matched the date of the SCCS ID, but those are the rules. Reported by: araujo MFC after: 3 days Sponsored by: Dell EMC Modified: head/lib/libc/stdlib/abort.3 head/lib/libc/stdlib/exit.3 head/share/man/man3/assert.3 Modified: head/lib/libc/stdlib/abort.3 ============================================================================== --- head/lib/libc/stdlib/abort.3 Tue May 29 01:46:00 2018 (r334307) +++ head/lib/libc/stdlib/abort.3 Tue May 29 02:41:32 2018 (r334308) @@ -32,7 +32,7 @@ .\" @(#)abort.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd May 28, 2018 .Dt ABORT 3 .Os .Sh NAME Modified: head/lib/libc/stdlib/exit.3 ============================================================================== --- head/lib/libc/stdlib/exit.3 Tue May 29 01:46:00 2018 (r334307) +++ head/lib/libc/stdlib/exit.3 Tue May 29 02:41:32 2018 (r334308) @@ -32,7 +32,7 @@ .\" @(#)exit.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 9, 2002 +.Dd May 28, 2018 .Dt EXIT 3 .Os .Sh NAME Modified: head/share/man/man3/assert.3 ============================================================================== --- head/share/man/man3/assert.3 Tue May 29 01:46:00 2018 (r334307) +++ head/share/man/man3/assert.3 Tue May 29 02:41:32 2018 (r334308) @@ -28,7 +28,7 @@ .\" @(#)assert.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd January 1, 2018 +.Dd May 28, 2018 .Dt ASSERT 3 .Os .Sh NAME From owner-svn-src-head@freebsd.org Tue May 29 03:48:46 2018 Return-Path: Delivered-To: svn-src-head@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 856A2F7EB1D; Tue, 29 May 2018 03:48:46 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id EE5FB74035; Tue, 29 May 2018 03:48:45 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 558B6428293; Tue, 29 May 2018 13:48:34 +1000 (AEST) Date: Tue, 29 May 2018 13:48:32 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Eric van Gyzen cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334306 - in head: lib/libc/stdlib share/man/man3 In-Reply-To: <201805290116.w4T1G0CQ062271@repo.freebsd.org> Message-ID: <20180529123026.U1818@besplex.bde.org> References: <201805290116.w4T1G0CQ062271@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=I9sVfJog c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=psdBHkAUT0qlx9XLF2kA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 03:48:46 -0000 On Tue, 29 May 2018, Eric van Gyzen wrote: > Log: > Cross-reference abort2(2) from a few man pages > > I didn't know abort2 existed until it was mentioned on a mailing list. > Mention it in related pages so others can find it easily. > > MFC after: 3 days > Sponsored by: Dell EMC > > Modified: > head/lib/libc/stdlib/abort.3 > head/lib/libc/stdlib/exit.3 > head/share/man/man3/assert.3 exit(3) is negatively related. abort2() exists mainly because it is invalid to call non-signal-safe functions like exit() from signal handlers. exit(3) correctly doesn't reference abort(3) or any of the many other functions that call it, e.g., perror(3) or err(3), or many functions that it calls. The references correctly go only towards exit() from its callers, This is especially interesting for abort() -- since abort() calls exit(), it is broken as specified and cannot be called from signal handlers. Its man page doesn't actually say that it calls exit(), but says that - it flushes and closes any open streams - it is thread-safe - it is unknown if it is async-signal state Its reference to exit(3) is the usual nodescript one in the SEE ALSO section with no hint about why the other man pages might be relevant. Readers must read and understand the closure of the tree of cross references to determine the relevances. I just remembered that abort() flushing and closing open streams and possibly calling exit() is not a design error, but just a bug in some OS's and some versions of POSIX. In C99, flushing and closing of open streams in abort() is implementation-defined. Only systems with primitive signal handling can hope to flush or close open streams in async-signal handlers (mostly by not supporting any such handlers). POSIX might have been such a system, and it required closing open streams in at least its 1990 and 2001 versions. These versions also didn't require abort() to be async-signal-safe. This is fixed in POSIX in at least its 2007 version. This version requires abort() to be async-signal-safe and permits but doesn't require abort() to fclose() open streams. [Free]BSD has never been such a system. Its abort() was async-signal safe before 1996 when it was broken to POSIX spec at the time. It hasn't caught up with 2007 POSIX yet: its implementation still calls stdio and says in a comment that POSIX requires this, and its man page still claims to not know what the implementation does. (The man page is trying to echo the fuzziness of the C standard for abort(), FreeBSD should document the non-fuzzy although sometimes broken POSIX behaviour, and the full C standard requires implementations to document their choices for implementation details.) Bruce From owner-svn-src-head@freebsd.org Tue May 29 03:58:30 2018 Return-Path: Delivered-To: svn-src-head@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 A2908F7F3C8; Tue, 29 May 2018 03:58:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 54D5E74937; Tue, 29 May 2018 03:58:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3636F16D17; Tue, 29 May 2018 03:58:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4T3wTt4044215; Tue, 29 May 2018 03:58:29 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4T3wTOt044213; Tue, 29 May 2018 03:58:29 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201805290358.w4T3wTOt044213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 29 May 2018 03:58:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334310 - head/stand/efi/boot1 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/efi/boot1 X-SVN-Commit-Revision: 334310 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 03:58:30 -0000 Author: imp Date: Tue May 29 03:58:29 2018 New Revision: 334310 URL: https://svnweb.freebsd.org/changeset/base/334310 Log: Teach ufs_module.c about bsd labels and probe 'a' partition. If the check for a UFS partition at offset 0 on the disk fails, check to see if there's a BSD disklabel at block 1 (standard) or at offset 512 (install images assume 512 sector size). If found, probe for UFS on the 'a' partition. This fixes UEFI booting images from a BSD labeled MBR slice when the 'a' partiton isn't at offset 0. This is a stop-gap fix since we plan on removing boot1.efi in FreeBSD 12. We can't easily do that for 11.2, however, hence the short MFC window. Tested by: emaste@ MFC After: 3 days Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D15598 Modified: head/stand/efi/boot1/boot_module.h head/stand/efi/boot1/ufs_module.c Modified: head/stand/efi/boot1/boot_module.h ============================================================================== --- head/stand/efi/boot1/boot_module.h Tue May 29 03:19:56 2018 (r334309) +++ head/stand/efi/boot1/boot_module.h Tue May 29 03:58:29 2018 (r334310) @@ -50,6 +50,7 @@ typedef struct dev_info EFI_DEVICE_PATH *devpath; EFI_HANDLE *devhandle; void *devdata; + uint64_t partoff; BOOLEAN preferred; struct dev_info *next; } dev_info_t; Modified: head/stand/efi/boot1/ufs_module.c ============================================================================== --- head/stand/efi/boot1/ufs_module.c Tue May 29 03:19:56 2018 (r334309) +++ head/stand/efi/boot1/ufs_module.c Tue May 29 03:58:29 2018 (r334310) @@ -36,10 +36,14 @@ #include #include #include +#include #include #include "boot_module.h" +#define BSD_LABEL_BUFFER 8192 +#define BSD_LABEL_OFFSET DEV_BSIZE + static dev_info_t *devinfo; static dev_info_t *devices; @@ -49,6 +53,7 @@ dskread(void *buf, uint64_t lba, int nblk) int size; EFI_STATUS status; + lba += devinfo->partoff; lba = lba / (devinfo->dev->Media->BlockSize / DEV_BSIZE); size = nblk * DEV_BSIZE; @@ -73,11 +78,50 @@ static struct dmadat __dmadat; static int init_dev(dev_info_t* dev) { + char buffer[BSD_LABEL_BUFFER]; + struct disklabel *dl; + uint64_t bs; + int ok; devinfo = dev; dmadat = &__dmadat; - return fsread(0, NULL, 0); + /* + * First try offset 0. This is the typical GPT case where we have no + * further partitioning (as well as the degenerate MBR case where + * the bsdlabel has a 0 offset). + */ + devinfo->partoff = 0; + ok = fsread(0, NULL, 0); + if (ok >= 0) + return (ok); + + /* + * Next, we look for a bsdlabel. This is technically located in sector + * 1. For 4k sectors, this offset is 4096, for 512b sectors it's + * 512. However, we have to fall back to 512 here because we create + * images that assume 512 byte blocks, but these can be put on devices + * who have 4k (or other) block sizes. If there's a crazy block size, we + * skip the 'at one sector' and go stright to checking at 512 bytes. + * There are other offsets that are historic, but we don't probe those + * since they were never used for MBR disks on FreeBSD on systems that + * could boot UEFI. UEFI is little endian only, as are BSD labels. We + * will retry fsread(0) only if there's a label found with a non-zero + * offset. + */ + if (dskread(buffer, 0, BSD_LABEL_BUFFER / DEV_BSIZE) != 0) + return (-1); + dl = NULL; + bs = devinfo->dev->Media->BlockSize; + if (bs != 0 && bs <= BSD_LABEL_BUFFER / 2) + dl = (struct disklabel *)&buffer[bs]; + if (dl == NULL || dl->d_magic != BSD_MAGIC || dl->d_magic2 != BSD_MAGIC) + dl = (struct disklabel *)&buffer[BSD_LABEL_OFFSET]; + if (dl->d_magic != BSD_MAGIC || dl->d_magic2 != BSD_MAGIC || + dl->d_partitions[0].p_offset == 0) + return (-1); + devinfo->partoff = dl->d_partitions[0].p_offset; + return (fsread(0, NULL, 0)); } static EFI_STATUS From owner-svn-src-head@freebsd.org Tue May 29 04:04:07 2018 Return-Path: Delivered-To: svn-src-head@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 22986F7F9F5; Tue, 29 May 2018 04:04:07 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C567D74F24; Tue, 29 May 2018 04:04:06 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A541116ED3; Tue, 29 May 2018 04:04:06 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4T446UR048894; Tue, 29 May 2018 04:04:06 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4T446AX048893; Tue, 29 May 2018 04:04:06 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805290404.w4T446AX048893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Tue, 29 May 2018 04:04:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334311 - head/sys/dev/hwpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/dev/hwpmc X-SVN-Commit-Revision: 334311 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 04:04:07 -0000 Author: mmacy Date: Tue May 29 04:04:06 2018 New Revision: 334311 URL: https://svnweb.freebsd.org/changeset/base/334311 Log: hwpmc: don't incrorrectly strip the ANY flag Modified: head/sys/dev/hwpmc/hwpmc_core.c Modified: head/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_core.c Tue May 29 03:58:29 2018 (r334310) +++ head/sys/dev/hwpmc/hwpmc_core.c Tue May 29 04:04:06 2018 (r334311) @@ -256,13 +256,6 @@ iaf_allocate_pmc(int cpu, int ri, struct pmc *pm, validflags = IAF_MASK; - if (core_cputype != PMC_CPU_INTEL_ATOM && - core_cputype != PMC_CPU_INTEL_ATOM_SILVERMONT) - validflags &= ~IAF_ANY; - - if ((flags & ~validflags) != 0) - return (EINVAL); - if (caps & PMC_CAP_INTERRUPT) flags |= IAF_PMI; if (caps & PMC_CAP_SYSTEM) @@ -445,10 +438,6 @@ iaf_stop_pmc(int cpu, int ri) ("[core,%d] illegal row-index %d", __LINE__, ri)); fc = (IAF_MASK << (ri * 4)); - - if (core_cputype != PMC_CPU_INTEL_ATOM && - core_cputype != PMC_CPU_INTEL_ATOM_SILVERMONT) - fc &= ~IAF_ANY; iafc->pc_iafctrl &= ~fc; From owner-svn-src-head@freebsd.org Tue May 29 04:23:17 2018 Return-Path: Delivered-To: svn-src-head@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 6E38FF9BACD; Tue, 29 May 2018 04:23:17 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 21A0D75979; Tue, 29 May 2018 04:23:17 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 043C9171F7; Tue, 29 May 2018 04:23:17 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4T4NGLu059018; Tue, 29 May 2018 04:23:16 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4T4NGLw059016; Tue, 29 May 2018 04:23:16 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805290423.w4T4NGLw059016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Tue, 29 May 2018 04:23:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334312 - head/lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/lib/libpmc X-SVN-Commit-Revision: 334312 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 04:23:17 -0000 Author: mmacy Date: Tue May 29 04:23:16 2018 New Revision: 334312 URL: https://svnweb.freebsd.org/changeset/base/334312 Log: libpmc: export names of counters for stat mode, make get_by_idx name consistent with others Modified: head/lib/libpmc/libpmc_pmu_util.c (contents, props changed) head/lib/libpmc/pmc.h head/lib/libpmc/pmclog.c Modified: head/lib/libpmc/libpmc_pmu_util.c ============================================================================== --- head/lib/libpmc/libpmc_pmu_util.c Tue May 29 04:04:06 2018 (r334311) +++ head/lib/libpmc/libpmc_pmu_util.c Tue May 29 04:23:16 2018 (r334312) @@ -131,7 +131,7 @@ pmu_event_get(const char *event_name, int *idx) } const char * -pmu_event_get_by_idx(int idx) +pmc_pmu_event_get_by_idx(int idx) { const struct pmu_events_map *pme; const struct pmu_event *pe; @@ -321,6 +321,27 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc return (0); } +/* + * Ultimately rely on AMD calling theirs the same + */ +static const char *stat_mode_cntrs[] = { + "inst_retired.any", + "cpu_clk_unhalted.thread_p_any", + "br_inst_retired.all_branches", + "br_misp_retired.all_branches", + "cpu_clk_unhalted.thread_p_any" +}; + +int +pmc_pmu_stat_mode(const char ***cntrs) +{ + if (pmc_pmu_enabled()) { + *cntrs = stat_mode_cntrs; + return (0); + } + return (EOPNOTSUPP); +} + #else uint64_t pmc_pmu_sample_rate_get(const char *event_name __unused) { return (DEFAULT_SAMPLE_COUNT); } void pmc_pmu_print_counters(void) {} @@ -328,6 +349,7 @@ void pmc_pmu_print_counter_desc(const char *e __unused void pmc_pmu_print_counter_desc_long(const char *e __unused) {} int pmc_pmu_enabled(void) { return (0); } int pmc_pmu_pmcallocate(const char *e __unused, struct pmc_op_pmcallocate *p __unused) { return (EOPNOTSUPP); } -const char *pmu_event_get_by_idx(int idx __unused) { return (NULL); } +const char *pmc_pmu_event_get_by_idx(int idx __unused) { return (NULL); } +int pmc_pmu_stat_mode(const char ***a __unused) { return (EOPNOTSUPP); } #endif Modified: head/lib/libpmc/pmc.h ============================================================================== --- head/lib/libpmc/pmc.h Tue May 29 04:04:06 2018 (r334311) +++ head/lib/libpmc/pmc.h Tue May 29 04:23:16 2018 (r334312) @@ -119,7 +119,8 @@ void pmc_pmu_print_counter_desc(const char *); void pmc_pmu_print_counter_desc_long(const char *); uint64_t pmc_pmu_sample_rate_get(const char *); int pmc_pmu_pmcallocate(const char *, struct pmc_op_pmcallocate *); -const char *pmu_event_get_by_idx(int idx); +const char *pmc_pmu_event_get_by_idx(int idx); +int pmc_pmu_stat_mode(const char ***); __END_DECLS #endif Modified: head/lib/libpmc/pmclog.c ============================================================================== --- head/lib/libpmc/pmclog.c Tue May 29 04:04:06 2018 (r334311) +++ head/lib/libpmc/pmclog.c Tue May 29 04:23:16 2018 (r334312) @@ -368,7 +368,7 @@ pmclog_get_event(void *cookie, char **data, ssize_t *l PMCLOG_READ32(le,ev->pl_u.pl_a.pl_event); PMCLOG_READ32(le,ev->pl_u.pl_a.pl_flags); PMCLOG_READ32(le,noop); - ev->pl_u.pl_a.pl_evname = pmu_event_get_by_idx(ev->pl_u.pl_a.pl_event); + ev->pl_u.pl_a.pl_evname = pmc_pmu_event_get_by_idx(ev->pl_u.pl_a.pl_event); if (ev->pl_u.pl_a.pl_evname != NULL) break; else if ((ev->pl_u.pl_a.pl_evname = From owner-svn-src-head@freebsd.org Tue May 29 04:23:24 2018 Return-Path: Delivered-To: svn-src-head@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 1AE83F9BB11; Tue, 29 May 2018 04:23:24 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5C20975A0D; Tue, 29 May 2018 04:23:22 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6EF9B171F8; Tue, 29 May 2018 04:23:22 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4T4NMhR059072; Tue, 29 May 2018 04:23:22 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4T4NMip059071; Tue, 29 May 2018 04:23:22 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805290423.w4T4NMip059071@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Tue, 29 May 2018 04:23:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334313 - head/lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/lib/libpmc X-SVN-Commit-Revision: 334313 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 04:23:24 -0000 Author: mmacy Date: Tue May 29 04:23:21 2018 New Revision: 334313 URL: https://svnweb.freebsd.org/changeset/base/334313 Log: libpmc: add support for using fixed function counters Modified: head/lib/libpmc/libpmc_pmu_util.c (contents, props changed) Modified: head/lib/libpmc/libpmc_pmu_util.c ============================================================================== --- head/lib/libpmc/libpmc_pmu_util.c Tue May 29 04:23:16 2018 (r334312) +++ head/lib/libpmc/libpmc_pmu_util.c Tue May 29 04:23:21 2018 (r334313) @@ -63,6 +63,14 @@ static struct pmu_alias pmu_alias_table[] = { { NULL, NULL }, }; +static const char *fixed_mode_cntrs[] = { + "inst_retired.any", + "cpu_clk_unhalted.thread", + "cpu_clk_unhalted.thread_any", + "cpu_clk_unhalted.ref_tsc", + NULL +}; + static const char * pmu_alias_get(const char *name) { @@ -288,11 +296,15 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc const struct pmu_event *pe; struct pmu_event_desc ped; struct pmc_md_iap_op_pmcallocate *iap; - int idx; + struct pmc_md_iaf_op_pmcallocate *iaf; + int idx, isfixed; iap = &pm->pm_md.pm_iap; + iaf = &pm->pm_md.pm_iaf; + isfixed = 0; bzero(iap, sizeof(*iap)); event_name = pmu_alias_get(event_name); + pm->pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE); if ((pe = pmu_event_get(event_name, &idx)) == NULL) return (ENOENT); if (pe->alias && (pe = pmu_event_get(pe->alias, &idx)) == NULL) @@ -302,6 +314,29 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc if (pmu_parse_event(&ped, pe->event)) return (ENOENT); + for (idx = 0; fixed_mode_cntrs[idx] != NULL; idx++) + if (strcmp(fixed_mode_cntrs[idx], event_name) == 0) { + isfixed = 1; + printf("%s is fixed\n", event_name); + } + + if (isfixed) { + if (strcasestr(pe->desc, "retired") != NULL) + pm->pm_ev = PMC_EV_IAF_INSTR_RETIRED_ANY; + else if (strcasestr(pe->desc, "core") != NULL || + strcasestr(pe->desc, "unhalted")) + pm->pm_ev = PMC_EV_IAF_CPU_CLK_UNHALTED_CORE; + else if (strcasestr(pe->desc, "ref") != NULL) + pm->pm_ev = PMC_EV_IAF_CPU_CLK_UNHALTED_REF; + iaf->pm_iaf_flags |= (IAF_USR | IAF_OS); + if (ped.ped_any) + iaf->pm_iaf_flags |= IAF_ANY; + if (pm->pm_caps & PMC_CAP_INTERRUPT) + iaf->pm_iaf_flags |= IAF_PMI; + pm->pm_class = PMC_CLASS_IAF; + return (0); + } + pm->pm_caps |= PMC_CAP_QUALIFIER; pm->pm_class = PMC_CLASS_IAP; pm->pm_ev = idx; iap->pm_iap_config |= IAP_EVSEL(ped.ped_event); @@ -325,11 +360,12 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc * Ultimately rely on AMD calling theirs the same */ static const char *stat_mode_cntrs[] = { + "cpu_clk_unhalted.thread_any", "inst_retired.any", - "cpu_clk_unhalted.thread_p_any", "br_inst_retired.all_branches", "br_misp_retired.all_branches", - "cpu_clk_unhalted.thread_p_any" + "longest_lat_cache.reference", + "longest_lat_cache.miss", }; int From owner-svn-src-head@freebsd.org Tue May 29 05:00:15 2018 Return-Path: Delivered-To: svn-src-head@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 46518FBABA3; Tue, 29 May 2018 05:00:15 +0000 (UTC) (envelope-from pho@holm.cc) Received: from relay01.pair.com (relay01.pair.com [209.68.5.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D7FDF76B3C; Tue, 29 May 2018 05:00:14 +0000 (UTC) (envelope-from pho@holm.cc) Received: from x2.osted.lan (87-58-223-204-dynamic.dk.customer.tdc.net [87.58.223.204]) by relay01.pair.com (Postfix) with ESMTP id 00B36D00B24; Tue, 29 May 2018 01:00:12 -0400 (EDT) Received: from x2.osted.lan (localhost [127.0.0.1]) by x2.osted.lan (8.14.9/8.14.9) with ESMTP id w4T50AtN011317 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 29 May 2018 07:00:10 +0200 (CEST) (envelope-from pho@x2.osted.lan) Received: (from pho@localhost) by x2.osted.lan (8.14.9/8.14.9/Submit) id w4T50ApZ011316; Tue, 29 May 2018 07:00:10 +0200 (CEST) (envelope-from pho) Date: Tue, 29 May 2018 07:00:09 +0200 From: Peter Holm To: Matt Macy Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334305 - head/sys/net Message-ID: <20180529050009.GA11230@x2.osted.lan> References: <201805290053.w4T0rspX052002@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201805290053.w4T0rspX052002@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 05:00:15 -0000 On Tue, May 29, 2018 at 12:53:54AM +0000, Matt Macy wrote: > Author: mmacy > Date: Tue May 29 00:53:53 2018 > New Revision: 334305 > URL: https://svnweb.freebsd.org/changeset/base/334305 > > Log: > route: fix missed ref adds > - ensure that we bump the ifa ref whenever we add a reference > - defer freeing epoch protected references until after the if_purgaddrs > loop > > Modified: > head/sys/net/if.c > head/sys/net/route.c > > Modified: head/sys/net/if.c > ============================================================================== > --- head/sys/net/if.c Tue May 29 00:19:23 2018 (r334304) Writing entropy file:. Setting hostname: flix1a.netperf.freebsd.org. lo0: link state changed to UP Kernel page fault with the following non-sleepable locks held: exclusive sleep mutex nd6 onlink (nd6 onlink) r = 0 (0xfffffe00e4fa7a98) locked @ netinet6/nd6_rtr.c:1145 stack backtrace: #0 0xffffffff80be2923 at witness_debugger+0x73 #1 0xffffffff80be3d01 at witness_warn+0x461 #2 0xffffffff8104c753 at trap_pfault+0x53 #3 0xffffffff8104bdd7 at trap+0x2c7 #4 0xffffffff810277cc at calltrap+0x8 #5 0xffffffff80ca7276 at rtrequest1_fib+0x496 #6 0xffffffff80ca7de0 at rtrequest_fib+0x70 #7 0xffffffff80de628b at nd6_prefix_onlink+0x40b #8 0xffffffff80de5daf at nd6_prelist_add+0x22f #9 0xffffffff80dc17a4 at in6_ifattach+0x6e4 #10 0xffffffff80c7cd7a at if_up+0x6a #11 0xffffffff80c7ebec at ifioctl+0x1a9c #12 0xffffffff80be8009 at kern_ioctl+0x2b9 #13 0xffffffff80be7cdc at sys_ioctl+0x15c #14 0xffffffff8104d067 at amd64_syscall+0x2a7 #15 0xffffffff810280ad at fast_syscall_common+0x101 Fatal trap 12: page fault while in kernel mode cpuid = 31; apic id = 25 fault virtual address = 0x18 fault code = supervisor read data, page not present instruction pointer = 0x20:0xffffffff80ca873b stack pointer = 0x28:0xfffffe00edce4ad0 frame pointer = 0x28:0xfffffe00edce4b00 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 321 (ifconfig) [ thread pid 321 tid 100799 ] Stopped at rt_getifa_fib+0x12b: movq 0x18(%r13),%rax db> bt Tracing pid 321 tid 100799 td 0xfffff8017a2af000 rt_getifa_fib() at rt_getifa_fib+0x12b/frame 0xfffffe00edce4b00 rtrequest1_fib() at rtrequest1_fib+0x496/frame 0xfffffe00edce4c00 rtrequest_fib() at rtrequest_fib+0x70/frame 0xfffffe00edce4cc0 nd6_prefix_onlink() at nd6_prefix_onlink+0x40b/frame 0xfffffe00edce4e10 nd6_prelist_add() at nd6_prelist_add+0x22f/frame 0xfffffe00edce4e90 in6_ifattach() at in6_ifattach+0x6e4/frame 0xfffffe00edce4fd0 if_up() at if_up+0x6a/frame 0xfffffe00edce5000 ifioctl() at ifioctl+0x1a9c/frame 0xfffffe00edce50d0 kern_ioctl() at kern_ioctl+0x2b9/frame 0xfffffe00edce5130 sys_ioctl() at sys_ioctl+0x15c/frame 0xfffffe00edce5200 amd64_syscall() at amd64_syscall+0x2a7/frame 0xfffffe00edce5330 fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe00edce5330 --- syscall (54, FreeBSD ELF64, sys_ioctl), rip = 0x80047e83a, rsp = 0x7fffffffe428, rbp = 0x7fffffffe480 --- db> x/s version version: FreeBSD 12.0-CURRENT #0 r334313: Tue May 29 06:47:31 CEST 2018\012 pho@flix1a.netperf.freebsd.org:/usr/src/sys/amd64/compile/PHO\012 db> - Peter From owner-svn-src-head@freebsd.org Tue May 29 07:14:58 2018 Return-Path: Delivered-To: svn-src-head@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 A01AFEF5BAF; Tue, 29 May 2018 07:14:58 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 563417AC25; Tue, 29 May 2018 07:14:58 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 374CE18D0D; Tue, 29 May 2018 07:14:58 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4T7EwQN044327; Tue, 29 May 2018 07:14:58 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4T7EwCI044326; Tue, 29 May 2018 07:14:58 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805290714.w4T7EwCI044326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Tue, 29 May 2018 07:14:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334314 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 334314 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 07:14:58 -0000 Author: mmacy Date: Tue May 29 07:14:57 2018 New Revision: 334314 URL: https://svnweb.freebsd.org/changeset/base/334314 Log: rt_getifa_fib: don't use ifa but info->rti_ifa Reported by: kp Modified: head/sys/net/route.c Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Tue May 29 04:23:21 2018 (r334313) +++ head/sys/net/route.c Tue May 29 07:14:57 2018 (r334314) @@ -1308,7 +1308,7 @@ rt_getifa_fib(struct rt_addrinfo *info, u_int fibnum) } if (needref && info->rti_ifa != NULL) { if (info->rti_ifp == NULL) - info->rti_ifp = ifa->ifa_ifp; + info->rti_ifp = info->rti_ifa->ifa_ifp; ifa_ref(info->rti_ifa); } else error = ENETUNREACH; From owner-svn-src-head@freebsd.org Tue May 29 07:39:20 2018 Return-Path: Delivered-To: svn-src-head@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 00BF0EF71C6; Tue, 29 May 2018 07:39:20 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 941BE7B825; Tue, 29 May 2018 07:39:19 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id F1F9C260474; Tue, 29 May 2018 09:39:16 +0200 (CEST) Subject: Re: svn commit: r334314 - head/sys/net To: Matt Macy , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805290714.w4T7EwCI044326@repo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Tue, 29 May 2018 09:39:04 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <201805290714.w4T7EwCI044326@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 07:39:20 -0000 On 05/29/18 09:14, Matt Macy wrote: > Author: mmacy > Date: Tue May 29 07:14:57 2018 > New Revision: 334314 > URL: https://svnweb.freebsd.org/changeset/base/334314 > > Log: > rt_getifa_fib: don't use ifa but info->rti_ifa > > Reported by: kp > > Modified: > head/sys/net/route.c > > Modified: head/sys/net/route.c > ============================================================================== > --- head/sys/net/route.c Tue May 29 04:23:21 2018 (r334313) > +++ head/sys/net/route.c Tue May 29 07:14:57 2018 (r334314) > @@ -1308,7 +1308,7 @@ rt_getifa_fib(struct rt_addrinfo *info, u_int fibnum) > } > if (needref && info->rti_ifa != NULL) { > if (info->rti_ifp == NULL) > - info->rti_ifp = ifa->ifa_ifp; > + info->rti_ifp = info->rti_ifa->ifa_ifp; > ifa_ref(info->rti_ifa); > } else > error = ENETUNREACH; > > Hi, This and the previous commit solves the panics I see. --HPS From owner-svn-src-head@freebsd.org Tue May 29 08:41:45 2018 Return-Path: Delivered-To: svn-src-head@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 F024AEFACC6; Tue, 29 May 2018 08:41:44 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A39A67DC54; Tue, 29 May 2018 08:41:44 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 865E919B53; Tue, 29 May 2018 08:41:44 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4T8fiVr088488; Tue, 29 May 2018 08:41:44 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4T8fiUg088487; Tue, 29 May 2018 08:41:44 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201805290841.w4T8fiUg088487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= Date: Tue, 29 May 2018 08:41:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334316 - head/sys/teken X-SVN-Group: head X-SVN-Commit-Author: dumbbell X-SVN-Commit-Paths: head/sys/teken X-SVN-Commit-Revision: 334316 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 08:41:45 -0000 Author: dumbbell Date: Tue May 29 08:41:44 2018 New Revision: 334316 URL: https://svnweb.freebsd.org/changeset/base/334316 Log: teken: Fix `sequences` header which was crossing the 80-col boundary Also, the commented line's columns for `DECID` were not re-aligned in r334302. Reported by: bde Modified: head/sys/teken/sequences Modified: head/sys/teken/sequences ============================================================================== --- head/sys/teken/sequences Tue May 29 07:51:24 2018 (r334315) +++ head/sys/teken/sequences Tue May 29 08:41:44 2018 (r334316) @@ -29,12 +29,12 @@ # Abbr Abbreviation of sequence name # Name Sequence name (will be converted to C function name) # Sequence Bytes that form the sequence -# Arguments Standard value of arguments passed to this sequence +# Args Standard value of arguments passed to this sequence # - `n' non-zero number (0 gets converted to 1) # - `r' regular numeric argument # - `v' means a variable number of arguments -# Abbr Name Sequence Arguments +# Abbr Name Sequence Args CBT Cursor Backward Tabulation ^[ [ Z n CHT Cursor Forward Tabulation ^[ [ I n CNL Cursor Next Line ^[ [ E n @@ -113,4 +113,4 @@ C25SGR Cons25 set graphic rendition ^[ [ x r r C25VTSW Cons25 switch virtual terminal ^[ [ z r # VT52 compatibility -#DECID VT52 DECID ^[ Z +#DECID VT52 DECID ^[ Z From owner-svn-src-head@freebsd.org Tue May 29 10:28:22 2018 Return-Path: Delivered-To: svn-src-head@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 EF33CF70294; Tue, 29 May 2018 10:28:21 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9B57E823C3; Tue, 29 May 2018 10:28:21 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C8C11ABA2; Tue, 29 May 2018 10:28:21 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TASLFD040098; Tue, 29 May 2018 10:28:21 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TASKSM040094; Tue, 29 May 2018 10:28:20 GMT (envelope-from des@FreeBSD.org) Message-Id: <201805291028.w4TASKSM040094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Tue, 29 May 2018 10:28:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334317 - head/lib/libfetch X-SVN-Group: head X-SVN-Commit-Author: des X-SVN-Commit-Paths: head/lib/libfetch X-SVN-Commit-Revision: 334317 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 10:28:22 -0000 Author: des Date: Tue May 29 10:28:20 2018 New Revision: 334317 URL: https://svnweb.freebsd.org/changeset/base/334317 Log: Use __VA_ARGS__ to simplify the DEBUG macro. MFC after: 3 weeks Modified: head/lib/libfetch/common.c head/lib/libfetch/common.h head/lib/libfetch/fetch.c head/lib/libfetch/ftp.c head/lib/libfetch/http.c Modified: head/lib/libfetch/common.c ============================================================================== --- head/lib/libfetch/common.c Tue May 29 08:41:44 2018 (r334316) +++ head/lib/libfetch/common.c Tue May 29 10:28:20 2018 (r334317) @@ -347,7 +347,7 @@ fetch_connect(const char *host, int port, int af, int conn_t *conn = NULL; int err = 0, sd = -1; - DEBUG(fprintf(stderr, "---> %s:%d\n", host, port)); + DEBUGF("---> %s:%d\n", host, port); /* resolve server address */ if (verbose) @@ -1158,7 +1158,7 @@ fetch_getln(conn_t *conn) } while (c != '\n'); conn->buf[conn->buflen] = '\0'; - DEBUG(fprintf(stderr, "<<< %s", conn->buf)); + DEBUGF("<<< %s", conn->buf); return (0); } @@ -1263,7 +1263,7 @@ fetch_putln(conn_t *conn, const char *str, size_t len) struct iovec iov[2]; int ret; - DEBUG(fprintf(stderr, ">>> %s\n", str)); + DEBUGF(">>> %s\n", str); iov[0].iov_base = __DECONST(char *, str); iov[0].iov_len = len; iov[1].iov_base = __DECONST(char *, ENDL); @@ -1403,13 +1403,13 @@ fetch_netrc_auth(struct url *url) rewind(f); while ((word = fetch_read_word(f)) != NULL) { if (strcmp(word, "default") == 0) { - DEBUG(fetch_info("Using default .netrc settings")); + DEBUGF("Using default .netrc settings"); break; } if (strcmp(word, "machine") == 0 && (word = fetch_read_word(f)) != NULL && strcasecmp(word, url->host) == 0) { - DEBUG(fetch_info("Using .netrc settings for %s", word)); + DEBUGF("Using .netrc settings for %s", word); break; } } Modified: head/lib/libfetch/common.h ============================================================================== --- head/lib/libfetch/common.h Tue May 29 08:41:44 2018 (r334316) +++ head/lib/libfetch/common.h Tue May 29 10:28:20 2018 (r334317) @@ -104,9 +104,16 @@ int fetch_no_proxy_match(const char *); #define url_seterr(n) fetch_seterr(url_errlist, n) #ifndef NDEBUG -#define DEBUG(x) do { if (fetchDebug) { x; } } while (0) +#define DEBUGF(...) \ + do { \ + if (fetchDebug) \ + fprintf(stderr, __VA_ARGS__); \ + } while (0) #else -#define DEBUG(x) do { } while (0) +#define DEBUGF(...) \ + do { \ + /* nothing */ \ + } while (0) #endif /* Modified: head/lib/libfetch/fetch.c ============================================================================== --- head/lib/libfetch/fetch.c Tue May 29 08:41:44 2018 (r334316) +++ head/lib/libfetch/fetch.c Tue May 29 10:28:20 2018 (r334317) @@ -444,15 +444,14 @@ nohost: goto ouch; } - DEBUG(fprintf(stderr, - "scheme: \"%s\"\n" - "user: \"%s\"\n" - "password: \"%s\"\n" - "host: \"%s\"\n" - "port: \"%d\"\n" - "document: \"%s\"\n", - u->scheme, u->user, u->pwd, - u->host, u->port, u->doc)); + DEBUGF("scheme: \"%s\"\n" + "user: \"%s\"\n" + "password: \"%s\"\n" + "host: \"%s\"\n" + "port: \"%d\"\n" + "document: \"%s\"\n", + u->scheme, u->user, u->pwd, + u->host, u->port, u->doc); return (u); Modified: head/lib/libfetch/ftp.c ============================================================================== --- head/lib/libfetch/ftp.c Tue May 29 08:41:44 2018 (r334316) +++ head/lib/libfetch/ftp.c Tue May 29 10:28:20 2018 (r334317) @@ -259,7 +259,7 @@ ftp_pwd(conn_t *conn, char *pwd, size_t pwdlen) return (FTP_PROTOCOL_ERROR); *dst = '\0'; #if 0 - DEBUG(fprintf(stderr, "pwd: [%s]\n", pwd)); + DEBUGF("pwd: [%s]\n", pwd); #endif return (FTP_OK); } @@ -291,8 +291,8 @@ ftp_cwd(conn_t *conn, const char *file) if (pwd[i] != file[i]) break; #if 0 - DEBUG(fprintf(stderr, "have: [%.*s|%s]\n", i, pwd, pwd + i)); - DEBUG(fprintf(stderr, "want: [%.*s|%s]\n", i, file, file + i)); + DEBUGF("have: [%.*s|%s]\n", i, pwd, pwd + i); + DEBUGF("want: [%.*s|%s]\n", i, file, file + i); #endif /* Keep going up a dir until we have a matching prefix. */ if (pwd[i] == '\0' && (file[i - 1] == '/' || file[i] == '/')) @@ -433,7 +433,7 @@ ftp_stat(conn_t *conn, const char *file, struct url_st } if (us->size == 0) us->size = -1; - DEBUG(fprintf(stderr, "size: [%lld]\n", (long long)us->size)); + DEBUGF("size: [%lld]\n", (long long)us->size); e = ftp_cmd(conn, "MDTM %.*s", filenamelen, filename); if (e != FTP_FILE_STATUS) { @@ -468,10 +468,9 @@ ftp_stat(conn_t *conn, const char *file, struct url_st t = time(NULL); us->mtime = t; us->atime = t; - DEBUG(fprintf(stderr, - "last modified: [%04d-%02d-%02d %02d:%02d:%02d]\n", + DEBUGF("last modified: [%04d-%02d-%02d %02d:%02d:%02d]\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, - tm.tm_hour, tm.tm_min, tm.tm_sec)); + tm.tm_hour, tm.tm_min, tm.tm_sec); return (0); } @@ -585,7 +584,7 @@ ftp_closefn(void *v) fetch_close(io->dconn); io->dir = -1; io->dconn = NULL; - DEBUG(fprintf(stderr, "Waiting for final status\n")); + DEBUGF("Waiting for final status\n"); r = ftp_chkerr(io->cconn); if (io->cconn == cached_connection && io->cconn->ref == 1) cached_connection = NULL; Modified: head/lib/libfetch/http.c ============================================================================== --- head/lib/libfetch/http.c Tue May 29 08:41:44 2018 (r334316) +++ head/lib/libfetch/http.c Tue May 29 10:28:20 2018 (r334317) @@ -891,10 +891,9 @@ http_parse_mtime(const char *p, time_t *mtime) setlocale(LC_TIME, locale); if (r == NULL) return (-1); - DEBUG(fprintf(stderr, "last modified: [%04d-%02d-%02d " - "%02d:%02d:%02d]\n", - tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, - tm.tm_hour, tm.tm_min, tm.tm_sec)); + DEBUGF("last modified: [%04d-%02d-%02d %02d:%02d:%02d]\n", + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec); *mtime = timegm(&tm); return (0); } @@ -911,8 +910,7 @@ http_parse_length(const char *p, off_t *length) len = len * 10 + (*p - '0'); if (*p) return (-1); - DEBUG(fprintf(stderr, "content length: [%lld]\n", - (long long)len)); + DEBUGF("content length: [%lld]\n", (long long)len); *length = len; return (0); } @@ -946,12 +944,11 @@ http_parse_range(const char *p, off_t *offset, off_t * if (*p || len < last - first + 1) return (-1); if (first == -1) { - DEBUG(fprintf(stderr, "content range: [*/%lld]\n", - (long long)len)); + DEBUGF("content range: [*/%lld]\n", (long long)len); *length = 0; } else { - DEBUG(fprintf(stderr, "content range: [%lld-%lld/%lld]\n", - (long long)first, (long long)last, (long long)len)); + DEBUGF("content range: [%lld-%lld/%lld]\n", + (long long)first, (long long)last, (long long)len); *length = last - first + 1; } *offset = first; @@ -1187,9 +1184,10 @@ DigestCalcResponse( OUT HASHHEX Response /* request-digest or response-digest */ ) { -/* DEBUG(fprintf(stderr, - "Calc: HA1[%s] Nonce[%s] qop[%s] method[%s] URI[%s]\n", - HA1, pszNonce, pszQop, pszMethod, pszDigestUri));*/ +#if 0 + DEBUGF("Calc: HA1[%s] Nonce[%s] qop[%s] method[%s] URI[%s]\n", + HA1, pszNonce, pszQop, pszMethod, pszDigestUri); +#endif MD5_CTX Md5Ctx; HASH HA2; HASH RespHash; @@ -1257,7 +1255,7 @@ http_digest_auth(conn_t *conn, const char *hdr, http_a char *options = NULL; if (!c->realm || !c->nonce) { - DEBUG(fprintf(stderr, "realm/nonce not set in challenge\n")); + DEBUGF("realm/nonce not set in challenge\n"); return(-1); } if (!c->algo) @@ -1282,7 +1280,7 @@ http_digest_auth(conn_t *conn, const char *hdr, http_a HASHHEX HA1; DigestCalcHA1(c->algo, parms->user, c->realm, parms->password, c->nonce, cnonce, HA1); - DEBUG(fprintf(stderr, "HA1: [%s]\n", HA1)); + DEBUGF("HA1: [%s]\n", HA1); HASHHEX digest; DigestCalcResponse(HA1, c->nonce, noncecount, cnonce, c->qop, "GET", url->doc, "", digest); @@ -1314,8 +1312,8 @@ http_basic_auth(conn_t *conn, const char *hdr, const c char *upw, *auth; int r; - DEBUG(fprintf(stderr, "basic: usr: [%s]\n", usr)); - DEBUG(fprintf(stderr, "basic: pwd: [%s]\n", pwd)); + DEBUGF("basic: usr: [%s]\n", usr); + DEBUGF("basic: pwd: [%s]\n", pwd); if (asprintf(&upw, "%s:%s", usr, pwd) == -1) return (-1); auth = http_base64(upw); @@ -1340,7 +1338,7 @@ http_authorize(conn_t *conn, const char *hdr, http_aut /* If user or pass are null we're not happy */ if (!parms->user || !parms->password) { - DEBUG(fprintf(stderr, "NULL usr or pass\n")); + DEBUGF("NULL usr or pass\n"); return (-1); } @@ -1353,8 +1351,7 @@ http_authorize(conn_t *conn, const char *hdr, http_aut /* Error if "Digest" was specified and there is no Digest challenge */ if (!digest && (parms->scheme && !strcasecmp(parms->scheme, "digest"))) { - DEBUG(fprintf(stderr, - "Digest auth in env, not supported by peer\n")); + DEBUGF("Digest auth in env, not supported by peer\n"); return (-1); } /* @@ -1863,7 +1860,7 @@ http_request_body(struct url *URL, const char *op, str new = fetchParseURL(p); if (new == NULL) { /* XXX should set an error code */ - DEBUG(fprintf(stderr, "failed to parse new URL\n")); + DEBUGF("failed to parse new URL\n"); goto ouch; } @@ -1909,7 +1906,7 @@ http_request_body(struct url *URL, const char *op, str (conn->err == HTTP_NEED_PROXY_AUTH && !proxy_challenges.valid)) { /* 401/7 but no www/proxy-authenticate ?? */ - DEBUG(fprintf(stderr, "401/7 and no auth header\n")); + DEBUGF("%03d without auth header\n", conn->err); goto ouch; } fetch_close(conn); @@ -1944,7 +1941,7 @@ http_request_body(struct url *URL, const char *op, str fetch_close(conn); conn = NULL; if (!new) { - DEBUG(fprintf(stderr, "redirect with no new location\n")); + DEBUGF("redirect with no new location\n"); break; } if (url != URL) @@ -1958,10 +1955,9 @@ http_request_body(struct url *URL, const char *op, str goto ouch; } - DEBUG(fprintf(stderr, "offset %lld, length %lld," - " size %lld, clength %lld\n", - (long long)offset, (long long)length, - (long long)size, (long long)clength)); + DEBUGF("offset %lld, length %lld, size %lld, clength %lld\n", + (long long)offset, (long long)length, + (long long)size, (long long)clength); if (conn->err == HTTP_NOT_MODIFIED) { http_seterr(HTTP_NOT_MODIFIED); From owner-svn-src-head@freebsd.org Tue May 29 10:29:05 2018 Return-Path: Delivered-To: svn-src-head@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 7FFDDF70367; Tue, 29 May 2018 10:29:05 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2AA5982508; Tue, 29 May 2018 10:29:05 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B9771ABA4; Tue, 29 May 2018 10:29:05 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TAT4Uf040169; Tue, 29 May 2018 10:29:04 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TAT4JC040168; Tue, 29 May 2018 10:29:04 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201805291029.w4TAT4JC040168@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Tue, 29 May 2018 10:29:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334318 - head/contrib/tcpdump X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/contrib/tcpdump X-SVN-Commit-Revision: 334318 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 10:29:05 -0000 Author: slavash Date: Tue May 29 10:29:04 2018 New Revision: 334318 URL: https://svnweb.freebsd.org/changeset/base/334318 Log: MFV r333668: Vendor import two upstream commits: c1bb8784abd3ca978e376b0d10e324db0491237b 9c4af7213cc2543a1f5586d8f2c19f86aa0cbe72 When using tcpdump -I -i wlanN and wlanN is not a monitor mode VAP, tcpdump will print an error message saying rfmon is not supported. Give a concise explanation as to how one might solve this problem by creating a monitor mode VAP. MFC after: 1 month Approved by: hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies Modified: head/contrib/tcpdump/tcpdump.c Directory Properties: head/contrib/tcpdump/ (props changed) Modified: head/contrib/tcpdump/tcpdump.c ============================================================================== --- head/contrib/tcpdump/tcpdump.c Tue May 29 10:28:20 2018 (r334317) +++ head/contrib/tcpdump/tcpdump.c Tue May 29 10:29:04 2018 (r334318) @@ -77,7 +77,6 @@ The Regents of the University of California. All righ */ #ifdef HAVE_CAPSICUM #include -#include #include #include #include @@ -114,6 +113,10 @@ The Regents of the University of California. All righ #endif /* HAVE_CAP_NG_H */ #endif /* HAVE_LIBCAP_NG */ +#ifdef __FreeBSD__ +#include +#endif /* __FreeBSD__ */ + #include "netdissect.h" #include "interface.h" #include "addrtoname.h" @@ -1095,6 +1098,10 @@ open_interface(const char *device, netdissect_options sysctlbyname(sysctl, parent, &s, NULL, 0); strlcpy(newdev, device, sizeof(newdev)); /* Suggest a new wlan device. */ + /* FIXME: incrementing the index this way is not going to work well + * when the index is 9 or greater but the only consequence in this + * specific case would be an error message that looks a bit odd. + */ newdev[strlen(newdev)-1]++; error("%s is not a monitor mode VAP\n" "To create a new monitor mode VAP use:\n" From owner-svn-src-head@freebsd.org Tue May 29 10:29:44 2018 Return-Path: Delivered-To: svn-src-head@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 EDB21F70418; Tue, 29 May 2018 10:29:43 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9F82C82672; Tue, 29 May 2018 10:29:43 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 672C51ABA5; Tue, 29 May 2018 10:29:43 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TAThdd040237; Tue, 29 May 2018 10:29:43 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TAThKj040236; Tue, 29 May 2018 10:29:43 GMT (envelope-from des@FreeBSD.org) Message-Id: <201805291029.w4TAThKj040236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Tue, 29 May 2018 10:29:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334319 - head/lib/libfetch X-SVN-Group: head X-SVN-Commit-Author: des X-SVN-Commit-Paths: head/lib/libfetch X-SVN-Commit-Revision: 334319 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 10:29:44 -0000 Author: des Date: Tue May 29 10:29:43 2018 New Revision: 334319 URL: https://svnweb.freebsd.org/changeset/base/334319 Log: Fix a few (but far from all) style issues. MFC after: 3 weeks Modified: head/lib/libfetch/http.c Modified: head/lib/libfetch/http.c ============================================================================== --- head/lib/libfetch/http.c Tue May 29 10:29:04 2018 (r334318) +++ head/lib/libfetch/http.c Tue May 29 10:29:43 2018 (r334319) @@ -780,9 +780,9 @@ http_parse_authenticate(const char *cp, http_auth_chal goto out; } init_http_auth_challenge(cs->challenges[cs->count]); - if (!strcasecmp(key, "basic")) { + if (strcasecmp(key, "basic") == 0) { cs->challenges[cs->count]->scheme = HTTPAS_BASIC; - } else if (!strcasecmp(key, "digest")) { + } else if (strcasecmp(key, "digest") == 0) { cs->challenges[cs->count]->scheme = HTTPAS_DIGEST; } else { cs->challenges[cs->count]->scheme = HTTPAS_UNKNOWN; @@ -811,25 +811,27 @@ http_parse_authenticate(const char *cp, http_auth_chal if (lex != HTTPHL_WORD && lex != HTTPHL_STRING) goto out; - if (!strcasecmp(key, "realm")) + if (strcasecmp(key, "realm") == 0) { cs->challenges[cs->count]->realm = - strdup(value); - else if (!strcasecmp(key, "qop")) + strdup(value); + } else if (strcasecmp(key, "qop") == 0) { cs->challenges[cs->count]->qop = - strdup(value); - else if (!strcasecmp(key, "nonce")) + strdup(value); + } else if (strcasecmp(key, "nonce") == 0) { cs->challenges[cs->count]->nonce = - strdup(value); - else if (!strcasecmp(key, "opaque")) + strdup(value); + } else if (strcasecmp(key, "opaque") == 0) { cs->challenges[cs->count]->opaque = - strdup(value); - else if (!strcasecmp(key, "algorithm")) + strdup(value); + } else if (strcasecmp(key, "algorithm") == 0) { cs->challenges[cs->count]->algo = - strdup(value); - else if (!strcasecmp(key, "stale")) + strdup(value); + } else if (strcasecmp(key, "stale") == 0) { cs->challenges[cs->count]->stale = - strcasecmp(value, "no"); - /* Else ignore unknown attributes */ + strcasecmp(value, "no"); + } else { + /* ignore unknown attributes */ + } /* Comma or Next challenge or End */ lex = http_header_lex(&cp, key); @@ -1262,8 +1264,8 @@ http_digest_auth(conn_t *conn, const char *hdr, http_a c->algo = strdup(""); if (asprintf(&options, "%s%s%s%s", - *c->algo? ",algorithm=" : "", c->algo, - c->opaque? ",opaque=" : "", c->opaque?c->opaque:"")== -1) + *c->algo? ",algorithm=" : "", c->algo, + c->opaque? ",opaque=" : "", c->opaque?c->opaque:"") < 0) return (-1); if (!c->qop) { @@ -1349,8 +1351,8 @@ http_authorize(conn_t *conn, const char *hdr, http_aut } /* Error if "Digest" was specified and there is no Digest challenge */ - if (!digest && (parms->scheme && - !strcasecmp(parms->scheme, "digest"))) { + if (!digest && + (parms->scheme && strcasecmp(parms->scheme, "digest") == 0)) { DEBUGF("Digest auth in env, not supported by peer\n"); return (-1); } @@ -1359,7 +1361,8 @@ http_authorize(conn_t *conn, const char *hdr, http_aut * challenge, do the basic thing. Don't need a challenge for this, * so no need to check basic!=NULL */ - if (!digest || (parms->scheme && !strcasecmp(parms->scheme,"basic"))) + if (!digest || + (parms->scheme && strcasecmp(parms->scheme, "basic") == 0)) return (http_basic_auth(conn,hdr,parms->user,parms->password)); /* Else, prefer digest. We just checked that it's not NULL */ @@ -1851,11 +1854,12 @@ http_request_body(struct url *URL, const char *op, str if (new) free(new); if (verbose) - fetch_info("%d redirect to %s", conn->err, p); + fetch_info("%d redirect to %s", + conn->err, p); if (*p == '/') /* absolute path */ - new = fetchMakeURL(url->scheme, url->host, url->port, p, - url->user, url->pwd); + new = fetchMakeURL(url->scheme, url->host, + url->port, p, url->user, url->pwd); else new = fetchParseURL(p); if (new == NULL) { @@ -1865,7 +1869,8 @@ http_request_body(struct url *URL, const char *op, str } /* Only copy credentials if the host matches */ - if (!strcmp(new->host, url->host) && !*new->user && !*new->pwd) { + if (strcmp(new->host, url->host) == 0 && + !*new->user && !*new->pwd) { strcpy(new->user, url->user); strcpy(new->pwd, url->pwd); } From owner-svn-src-head@freebsd.org Tue May 29 11:59:04 2018 Return-Path: Delivered-To: svn-src-head@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 247BDF75E55; Tue, 29 May 2018 11:59:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B85DE85B51; Tue, 29 May 2018 11:59:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 945B71BA32; Tue, 29 May 2018 11:59:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TBx30G085838; Tue, 29 May 2018 11:59:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TBx3e5085835; Tue, 29 May 2018 11:59:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805291159.w4TBx3e5085835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 29 May 2018 11:59:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334320 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys i386/include X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys i386/include X-SVN-Commit-Revision: 334320 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 11:59:04 -0000 Author: hselasky Date: Tue May 29 11:59:02 2018 New Revision: 334320 URL: https://svnweb.freebsd.org/changeset/base/334320 Log: Implement atomic_add_64() and atomic_subtract_64() for the i386 target. While at it add missing _acq_ and _rel_ variants for 64-bit atomic operations under i386. Reviewed by: kib @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c head/sys/cddl/compat/opensolaris/sys/atomic.h head/sys/i386/include/atomic.h Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Tue May 29 10:29:43 2018 (r334319) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Tue May 29 11:59:02 2018 (r334320) @@ -52,7 +52,8 @@ atomic_init(void) } #endif -#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64) +#if !defined(__LP64__) && !defined(__mips_n32) && \ + !defined(ARM_HAVE_ATOMIC64) && !defined(__i386__) void atomic_add_64(volatile uint64_t *target, int64_t delta) { Modified: head/sys/cddl/compat/opensolaris/sys/atomic.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/atomic.h Tue May 29 10:29:43 2018 (r334319) +++ head/sys/cddl/compat/opensolaris/sys/atomic.h Tue May 29 11:59:02 2018 (r334320) @@ -36,7 +36,8 @@ atomic_cmpset_ptr((volatile uintptr_t *)(_a), (uintptr_t)(_b), (uintptr_t) (_c)) #define cas32 atomic_cmpset_32 -#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64) +#if !defined(__LP64__) && !defined(__mips_n32) && \ + !defined(ARM_HAVE_ATOMIC64) && !defined(__i386__) extern void atomic_add_64(volatile uint64_t *target, int64_t delta); extern void atomic_dec_64(volatile uint64_t *target); #endif @@ -85,7 +86,8 @@ atomic_dec_32_nv(volatile uint32_t *target) return (atomic_fetchadd_32(target, -1) - 1); } -#if defined(__LP64__) || defined(__mips_n32) || defined(ARM_HAVE_ATOMIC64) +#if defined(__LP64__) || defined(__mips_n32) || \ + defined(ARM_HAVE_ATOMIC64) || defined(__i386__) static __inline void atomic_dec_64(volatile uint64_t *target) { Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Tue May 29 10:29:43 2018 (r334319) +++ head/sys/i386/include/atomic.h Tue May 29 11:59:02 2018 (r334320) @@ -134,6 +134,8 @@ uint64_t atomic_load_acq_64(volatile uint64_t *); void atomic_store_rel_64(volatile uint64_t *, uint64_t); uint64_t atomic_swap_64(volatile uint64_t *, uint64_t); uint64_t atomic_fetchadd_64(volatile uint64_t *, uint64_t); +void atomic_add_64(volatile uint64_t *, uint64_t); +void atomic_subtract_64(volatile uint64_t *, uint64_t); #else /* !KLD_MODULE && __GNUCLIKE_ASM */ @@ -581,6 +583,30 @@ atomic_fetchadd_64(volatile uint64_t *p, uint64_t v) } } +static __inline void +atomic_add_64(volatile uint64_t *p, uint64_t v) +{ + uint64_t t; + + for (;;) { + t = *p; + if (atomic_cmpset_64(p, t, t + v)) + break; + } +} + +static __inline void +atomic_subtract_64(volatile uint64_t *p, uint64_t v) +{ + uint64_t t; + + for (;;) { + t = *p; + if (atomic_cmpset_64(p, t, t - v)) + break; + } +} + #endif /* _KERNEL */ #endif /* KLD_MODULE || !__GNUCLIKE_ASM */ @@ -804,6 +830,16 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_fetchadd_32 atomic_fetchadd_int #define atomic_testandset_32 atomic_testandset_int #define atomic_testandclear_32 atomic_testandclear_int + +/* Operations on 64-bit quad words. */ +#define atomic_cmpset_acq_64 atomic_cmpset_64 +#define atomic_cmpset_rel_64 atomic_cmpset_64 +#define atomic_fetchadd_acq_64 atomic_fetchadd_64 +#define atomic_fetchadd_rel_64 atomic_fetchadd_64 +#define atomic_add_acq_64 atomic_add_64 +#define atomic_add_rel_64 atomic_add_64 +#define atomic_subtract_acq_64 atomic_subtract_64 +#define atomic_subtract_rel_64 atomic_subtract_64 /* Operations on pointers. */ #define atomic_set_ptr(p, v) \ From owner-svn-src-head@freebsd.org Tue May 29 12:32:10 2018 Return-Path: Delivered-To: svn-src-head@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 2F578F78BB0; Tue, 29 May 2018 12:32:10 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D869E877D1; Tue, 29 May 2018 12:32:09 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8C811C085; Tue, 29 May 2018 12:32:09 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TCW9rQ005154; Tue, 29 May 2018 12:32:09 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TCW8xw005149; Tue, 29 May 2018 12:32:08 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201805291232.w4TCW8xw005149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 29 May 2018 12:32:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334324 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 334324 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 12:32:10 -0000 Author: ae Date: Tue May 29 12:32:08 2018 New Revision: 334324 URL: https://svnweb.freebsd.org/changeset/base/334324 Log: Remove empty encap_init() function. MFC after: 2 weeks Modified: head/sys/netinet/in_proto.c head/sys/netinet/ip_encap.c head/sys/netinet/ip_encap.h head/sys/netinet6/in6_proto.c Modified: head/sys/netinet/in_proto.c ============================================================================== --- head/sys/netinet/in_proto.c Tue May 29 12:30:41 2018 (r334323) +++ head/sys/netinet/in_proto.c Tue May 29 12:32:08 2018 (r334324) @@ -227,7 +227,6 @@ struct protosw inetsw[] = { .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, .pr_input = encap4_input, .pr_ctloutput = rip_ctloutput, - .pr_init = encap_init, .pr_usrreqs = &rip_usrreqs }, { @@ -237,7 +236,6 @@ struct protosw inetsw[] = { .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, .pr_input = encap4_input, .pr_ctloutput = rip_ctloutput, - .pr_init = encap_init, .pr_usrreqs = &rip_usrreqs }, { @@ -247,7 +245,6 @@ struct protosw inetsw[] = { .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, .pr_input = encap4_input, .pr_ctloutput = rip_ctloutput, - .pr_init = encap_init, .pr_usrreqs = &rip_usrreqs }, { @@ -257,7 +254,6 @@ struct protosw inetsw[] = { .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, .pr_input = encap4_input, .pr_ctloutput = rip_ctloutput, - .pr_init = encap_init, .pr_usrreqs = &rip_usrreqs }, # ifdef INET6 @@ -268,7 +264,6 @@ struct protosw inetsw[] = { .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, .pr_input = encap4_input, .pr_ctloutput = rip_ctloutput, - .pr_init = encap_init, .pr_usrreqs = &rip_usrreqs }, #endif Modified: head/sys/netinet/ip_encap.c ============================================================================== --- head/sys/netinet/ip_encap.c Tue May 29 12:30:41 2018 (r334323) +++ head/sys/netinet/ip_encap.c Tue May 29 12:32:08 2018 (r334324) @@ -108,15 +108,6 @@ static struct mtx encapmtx; MTX_SYSINIT(encapmtx, &encapmtx, "encapmtx", MTX_DEF); static LIST_HEAD(, encaptab) encaptab = LIST_HEAD_INITIALIZER(encaptab); -/* - * We currently keey encap_init() for source code compatibility reasons -- - * it's referenced by KAME pieces in netinet6. - */ -void -encap_init(void) -{ -} - #ifdef INET int encap4_input(struct mbuf **mp, int *offp, int proto) Modified: head/sys/netinet/ip_encap.h ============================================================================== --- head/sys/netinet/ip_encap.h Tue May 29 12:30:41 2018 (r334323) +++ head/sys/netinet/ip_encap.h Tue May 29 12:32:08 2018 (r334324) @@ -50,7 +50,6 @@ struct encaptab { void *arg; /* passed via m->m_pkthdr.aux */ }; -void encap_init(void); int encap4_input(struct mbuf **, int *, int); int encap6_input(struct mbuf **, int *, int); const struct encaptab *encap_attach(int, int, const struct sockaddr *, Modified: head/sys/netinet6/in6_proto.c ============================================================================== --- head/sys/netinet6/in6_proto.c Tue May 29 12:30:41 2018 (r334323) +++ head/sys/netinet6/in6_proto.c Tue May 29 12:32:08 2018 (r334324) @@ -282,7 +282,6 @@ struct protosw inet6sw[] = { .pr_input = encap6_input, .pr_output = rip6_output, .pr_ctloutput = rip6_ctloutput, - .pr_init = encap_init, .pr_usrreqs = &rip6_usrreqs }, #endif /* INET */ @@ -294,7 +293,6 @@ struct protosw inet6sw[] = { .pr_input = encap6_input, .pr_output = rip6_output, .pr_ctloutput = rip6_ctloutput, - .pr_init = encap_init, .pr_usrreqs = &rip6_usrreqs }, { @@ -305,7 +303,6 @@ struct protosw inet6sw[] = { .pr_input = encap6_input, .pr_output = rip6_output, .pr_ctloutput = rip6_ctloutput, - .pr_init = encap_init, .pr_usrreqs = &rip6_usrreqs }, { From owner-svn-src-head@freebsd.org Tue May 29 13:02:45 2018 Return-Path: Delivered-To: svn-src-head@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 ADC99F7B03D; Tue, 29 May 2018 13:02:45 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 0CFBB692BA; Tue, 29 May 2018 13:02:44 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id NeGtfpQsUuYopNeGvf2tiN; Tue, 29 May 2018 07:02:42 -0600 X-Authority-Analysis: v=2.3 cv=GopsBH9C c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=VUJBJC2UJ8kA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=XgJsEXYadUAYOezqnGwA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id A0D0772E; Tue, 29 May 2018 06:02:39 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w4TD2bOR059887; Tue, 29 May 2018 06:02:37 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w4TD2bR5059884; Tue, 29 May 2018 06:02:37 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201805291302.w4TD2bR5059884@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Hans Petter Selasky cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334320 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys i386/include In-Reply-To: Message from Hans Petter Selasky of "Tue, 29 May 2018 11:59:02 -0000." <201805291159.w4TBx3e5085835@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 29 May 2018 06:02:37 -0700 X-CMAE-Envelope: MS4wfAMnvk9TnQSuKWFW6kG5eFSYCaGe+HHYbeDNmK43HD9ZQHe2MVfoR4JDkxdHk4zKHPfbTiB4c1SOczsYdmQTyddl3OUintUA2bWYDNUJyWYwl6rV/DUm u/h76Ss78gnmfvjEnSAW5nLFuUDaOxeFvS0nJcsZGRX2lAuN6p7DmDEAvAIdjDaOfIc7uewu467WJtO61oY0i0i7EBV3ADkT+3LZO3gLNjUMLt249pCHWfOL uYvXa7sH2b8Y3J4T+8+gdqt6Bk8wf3DswC/NoAtAiYfdzTW//TZTjZchEIhK7ZL+ X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 13:02:46 -0000 In message <201805291159.w4TBx3e5085835@repo.freebsd.org>, Hans Petter Selasky writes: > Author: hselasky > Date: Tue May 29 11:59:02 2018 > New Revision: 334320 > URL: https://svnweb.freebsd.org/changeset/base/334320 > > Log: > Implement atomic_add_64() and atomic_subtract_64() for the i386 target. > > While at it add missing _acq_ and _rel_ variants for 64-bit atomic > operations under i386. > > Reviewed by: kib @ > MFC after: 1 week > Sponsored by: Mellanox Technologies > > Modified: > head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c > head/sys/cddl/compat/opensolaris/sys/atomic.h > head/sys/i386/include/atomic.h > > Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c > ============================================================================= > = > --- head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Tue May > 29 10:29:43 2018 (r334319) > +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Tue May > 29 11:59:02 2018 (r334320) > @@ -52,7 +52,8 @@ atomic_init(void) > } > #endif > > -#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64 > ) > +#if !defined(__LP64__) && !defined(__mips_n32) && \ > + !defined(ARM_HAVE_ATOMIC64) && !defined(__i386__) > void > atomic_add_64(volatile uint64_t *target, int64_t delta) > { > > Modified: head/sys/cddl/compat/opensolaris/sys/atomic.h > ============================================================================= > = > --- head/sys/cddl/compat/opensolaris/sys/atomic.h Tue May 29 10:29:43 201 > 8 (r334319) > +++ head/sys/cddl/compat/opensolaris/sys/atomic.h Tue May 29 11:59:02 201 > 8 (r334320) > @@ -36,7 +36,8 @@ > atomic_cmpset_ptr((volatile uintptr_t *)(_a), (uintptr_t)(_b), (uintptr > _t) (_c)) > #define cas32 atomic_cmpset_32 > > -#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64 > ) > +#if !defined(__LP64__) && !defined(__mips_n32) && \ > + !defined(ARM_HAVE_ATOMIC64) && !defined(__i386__) > extern void atomic_add_64(volatile uint64_t *target, int64_t delta); > extern void atomic_dec_64(volatile uint64_t *target); > #endif > @@ -85,7 +86,8 @@ atomic_dec_32_nv(volatile uint32_t *target) > return (atomic_fetchadd_32(target, -1) - 1); > } > > -#if defined(__LP64__) || defined(__mips_n32) || defined(ARM_HAVE_ATOMIC64) > +#if defined(__LP64__) || defined(__mips_n32) || \ > + defined(ARM_HAVE_ATOMIC64) || defined(__i386__) > static __inline void > atomic_dec_64(volatile uint64_t *target) > { > > Modified: head/sys/i386/include/atomic.h > ============================================================================= > = > --- head/sys/i386/include/atomic.h Tue May 29 10:29:43 2018 (r33431 > 9) > +++ head/sys/i386/include/atomic.h Tue May 29 11:59:02 2018 (r33432 > 0) > @@ -134,6 +134,8 @@ uint64_t atomic_load_acq_64(volatile uint64_t *); > void atomic_store_rel_64(volatile uint64_t *, uint64_t); > uint64_t atomic_swap_64(volatile uint64_t *, uint64_t); > uint64_t atomic_fetchadd_64(volatile uint64_t *, uint64_t); > +void atomic_add_64(volatile uint64_t *, uint64_t); > +void atomic_subtract_64(volatile uint64_t *, uint64_t); > > #else /* !KLD_MODULE && __GNUCLIKE_ASM */ > > @@ -581,6 +583,30 @@ atomic_fetchadd_64(volatile uint64_t *p, uint64_t v) > } > } > > +static __inline void > +atomic_add_64(volatile uint64_t *p, uint64_t v) > +{ > + uint64_t t; > + > + for (;;) { > + t = *p; > + if (atomic_cmpset_64(p, t, t + v)) > + break; > + } > +} > + > +static __inline void > +atomic_subtract_64(volatile uint64_t *p, uint64_t v) > +{ > + uint64_t t; > + > + for (;;) { > + t = *p; > + if (atomic_cmpset_64(p, t, t - v)) > + break; > + } > +} > + > #endif /* _KERNEL */ > > #endif /* KLD_MODULE || !__GNUCLIKE_ASM */ > @@ -804,6 +830,16 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); > #define atomic_fetchadd_32 atomic_fetchadd_int > #define atomic_testandset_32 atomic_testandset_int > #define atomic_testandclear_32 atomic_testandclear_int > + > +/* Operations on 64-bit quad words. */ > +#define atomic_cmpset_acq_64 atomic_cmpset_64 > +#define atomic_cmpset_rel_64 atomic_cmpset_64 > +#define atomic_fetchadd_acq_64 atomic_fetchadd_64 > +#define atomic_fetchadd_rel_64 atomic_fetchadd_64 > +#define atomic_add_acq_64 atomic_add_64 > +#define atomic_add_rel_64 atomic_add_64 > +#define atomic_subtract_acq_64 atomic_subtract_64 > +#define atomic_subtract_rel_64 atomic_subtract_64 > > /* Operations on pointers. */ > #define atomic_set_ptr(p, v) \ > Hi Hans, This broke in lib32 on an amd64 system. --- cddl/lib/libnvpair__L --- In file included from /opt/src/svn-current/sys/cddl/contrib/opensolaris/ common/nvpair/opensolaris_fnvpair.c:29: In file included from /opt/src/svn-current/cddl/contrib/opensolaris/lib/ libzpool/common/sys/zfs_context.h:74: /opt/src/svn-current/sys/cddl/compat/opensolaris/sys/atomic.h:94:2: error: implicit declaration of function 'atomic_subtract_64' is invalid in C99 [-Werror,-Wimplicit-function-declaration] atomic_subtract_64(target, 1); ^ -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Tue May 29 13:07:38 2018 Return-Path: Delivered-To: svn-src-head@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 0788EF7B57C; Tue, 29 May 2018 13:07:38 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B160469728; Tue, 29 May 2018 13:07:37 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 921531C578; Tue, 29 May 2018 13:07:37 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TD7bX5021302; Tue, 29 May 2018 13:07:37 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TD7a9H021300; Tue, 29 May 2018 13:07:36 GMT (envelope-from des@FreeBSD.org) Message-Id: <201805291307.w4TD7a9H021300@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Tue, 29 May 2018 13:07:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334326 - head/lib/libfetch X-SVN-Group: head X-SVN-Commit-Author: des X-SVN-Commit-Paths: head/lib/libfetch X-SVN-Commit-Revision: 334326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 13:07:38 -0000 Author: des Date: Tue May 29 13:07:36 2018 New Revision: 334326 URL: https://svnweb.freebsd.org/changeset/base/334326 Log: Fix an inverted conditional in the netrc code, which would ignore the value of $HOME and always use the home directory from the passwd database, unless $HOME was unset, in which case it would use (null). While there, clean up handling of netrcfd and add debugging aids. MFC after: 3 weeks Modified: head/lib/libfetch/common.c head/lib/libfetch/fetch.c head/lib/libfetch/ftp.c Modified: head/lib/libfetch/common.c ============================================================================== --- head/lib/libfetch/common.c Tue May 29 12:43:03 2018 (r334325) +++ head/lib/libfetch/common.c Tue May 29 13:07:36 2018 (r334326) @@ -1361,19 +1361,20 @@ fetch_read_word(FILE *f) static int fetch_netrc_open(void) { - const char *p; + struct passwd *pwd; char fn[PATH_MAX]; + const char *p; + int fd, serrno; if ((p = getenv("NETRC")) != NULL) { + DEBUGF("NETRC=%s\n", p); if (snprintf(fn, sizeof(fn), "%s", p) >= (int)sizeof(fn)) { fetch_info("$NETRC specifies a file name " "longer than PATH_MAX"); return (-1); } } else { - if ((p = getenv("HOME")) != NULL) { - struct passwd *pwd; - + if ((p = getenv("HOME")) == NULL) { if ((pwd = getpwuid(getuid())) == NULL || (p = pwd->pw_dir) == NULL) return (-1); @@ -1382,7 +1383,12 @@ fetch_netrc_open(void) return (-1); } - return (open(fn, O_RDONLY)); + if ((fd = open(fn, O_RDONLY)) < 0) { + serrno = errno; + DEBUGF("%s: %s\n", fn, strerror(serrno)); + errno = serrno; + } + return (fd); } /* @@ -1392,24 +1398,32 @@ int fetch_netrc_auth(struct url *url) { const char *word; + int serrno; FILE *f; - if (url->netrcfd == -2) + if (url->netrcfd < 0) url->netrcfd = fetch_netrc_open(); if (url->netrcfd < 0) return (-1); - if ((f = fdopen(url->netrcfd, "r")) == NULL) + if ((f = fdopen(url->netrcfd, "r")) == NULL) { + serrno = errno; + DEBUGF("fdopen(netrcfd): %s", strerror(errno)); + close(url->netrcfd); + url->netrcfd = -1; + errno = serrno; return (-1); + } rewind(f); + DEBUGF("searching netrc for %s\n", url->host); while ((word = fetch_read_word(f)) != NULL) { if (strcmp(word, "default") == 0) { - DEBUGF("Using default .netrc settings"); + DEBUGF("using default netrc settings\n"); break; } if (strcmp(word, "machine") == 0 && (word = fetch_read_word(f)) != NULL && strcasecmp(word, url->host) == 0) { - DEBUGF("Using .netrc settings for %s", word); + DEBUGF("using netrc settings for %s\n", word); break; } } @@ -1441,9 +1455,13 @@ fetch_netrc_auth(struct url *url) } } fclose(f); + url->netrcfd = -1; return (0); - ferr: +ferr: + serrno = errno; fclose(f); + url->netrcfd = -1; + errno = serrno; return (-1); } Modified: head/lib/libfetch/fetch.c ============================================================================== --- head/lib/libfetch/fetch.c Tue May 29 12:43:03 2018 (r334325) +++ head/lib/libfetch/fetch.c Tue May 29 13:07:36 2018 (r334326) @@ -272,6 +272,7 @@ fetchMakeURL(const char *scheme, const char *host, int fetch_syserr(); return (NULL); } + u->netrcfd = -1; if ((u->doc = strdup(doc ? doc : "/")) == NULL) { fetch_syserr(); @@ -286,7 +287,6 @@ fetchMakeURL(const char *scheme, const char *host, int seturl(pwd); #undef seturl u->port = port; - u->netrcfd = -2; return (u); } @@ -352,7 +352,7 @@ fetchParseURL(const char *URL) fetch_syserr(); return (NULL); } - u->netrcfd = -2; + u->netrcfd = -1; /* scheme name */ if ((p = strstr(URL, ":/"))) { Modified: head/lib/libfetch/ftp.c ============================================================================== --- head/lib/libfetch/ftp.c Tue May 29 12:43:03 2018 (r334325) +++ head/lib/libfetch/ftp.c Tue May 29 13:07:36 2018 (r334326) @@ -914,7 +914,8 @@ ftp_authenticate(conn_t *conn, struct url *url, struct fetch_netrc_auth(url); user = url->user; if (*user == '\0') - user = getenv("FTP_LOGIN"); + if ((user = getenv("FTP_LOGIN")) != NULL) + DEBUGF("FTP_LOGIN=%s\n", user); if (user == NULL || *user == '\0') user = FTP_ANONYMOUS_USER; if (purl && url->port == fetch_default_port(url->scheme)) @@ -928,7 +929,8 @@ ftp_authenticate(conn_t *conn, struct url *url, struct if (e == FTP_NEED_PASSWORD) { pwd = url->pwd; if (*pwd == '\0') - pwd = getenv("FTP_PASSWORD"); + if ((pwd = getenv("FTP_PASSWORD")) != NULL) + DEBUGF("FTP_PASSWORD=%s\n", pwd); if (pwd == NULL || *pwd == '\0') { if ((logname = getlogin()) == NULL) logname = FTP_ANONYMOUS_USER; From owner-svn-src-head@freebsd.org Tue May 29 13:10:50 2018 Return-Path: Delivered-To: svn-src-head@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 0B2E7F7B8AD; Tue, 29 May 2018 13:10:50 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9663D699D9; Tue, 29 May 2018 13:10:49 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id E78DF2603AE; Tue, 29 May 2018 15:10:47 +0200 (CEST) Subject: Re: svn commit: r334320 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys i386/include To: Cy Schubert Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805291302.w4TD2bR5059884@slippy.cwsent.com> From: Hans Petter Selasky Message-ID: <168f4cd3-07d2-15cb-9cf4-a2d02f6dc260@selasky.org> Date: Tue, 29 May 2018 15:10:34 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <201805291302.w4TD2bR5059884@slippy.cwsent.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 13:10:50 -0000 On 05/29/18 15:02, Cy Schubert wrote: > In message <201805291159.w4TBx3e5085835@repo.freebsd.org>, Hans Petter > Selasky > writes: >> Author: hselasky >> Date: Tue May 29 11:59:02 2018 >> New Revision: 334320 >> URL: https://svnweb.freebsd.org/changeset/base/334320 >> >> Log: >> Implement atomic_add_64() and atomic_subtract_64() for the i386 target. >> >> While at it add missing _acq_ and _rel_ variants for 64-bit atomic >> operations under i386. >> >> Reviewed by: kib @ >> MFC after: 1 week >> Sponsored by: Mellanox Technologies >> >> Modified: >> head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c >> head/sys/cddl/compat/opensolaris/sys/atomic.h >> head/sys/i386/include/atomic.h >> >> Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c >> ============================================================================= >> = >> --- head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Tue May >> 29 10:29:43 2018 (r334319) >> +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Tue May >> 29 11:59:02 2018 (r334320) >> @@ -52,7 +52,8 @@ atomic_init(void) >> } >> #endif >> >> -#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64 >> ) >> +#if !defined(__LP64__) && !defined(__mips_n32) && \ >> + !defined(ARM_HAVE_ATOMIC64) && !defined(__i386__) >> void >> atomic_add_64(volatile uint64_t *target, int64_t delta) >> { >> >> Modified: head/sys/cddl/compat/opensolaris/sys/atomic.h >> ============================================================================= >> = >> --- head/sys/cddl/compat/opensolaris/sys/atomic.h Tue May 29 10:29:43 201 >> 8 (r334319) >> +++ head/sys/cddl/compat/opensolaris/sys/atomic.h Tue May 29 11:59:02 201 >> 8 (r334320) >> @@ -36,7 +36,8 @@ >> atomic_cmpset_ptr((volatile uintptr_t *)(_a), (uintptr_t)(_b), (uintptr >> _t) (_c)) >> #define cas32 atomic_cmpset_32 >> >> -#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64 >> ) >> +#if !defined(__LP64__) && !defined(__mips_n32) && \ >> + !defined(ARM_HAVE_ATOMIC64) && !defined(__i386__) >> extern void atomic_add_64(volatile uint64_t *target, int64_t delta); >> extern void atomic_dec_64(volatile uint64_t *target); >> #endif >> @@ -85,7 +86,8 @@ atomic_dec_32_nv(volatile uint32_t *target) >> return (atomic_fetchadd_32(target, -1) - 1); >> } >> >> -#if defined(__LP64__) || defined(__mips_n32) || defined(ARM_HAVE_ATOMIC64) >> +#if defined(__LP64__) || defined(__mips_n32) || \ >> + defined(ARM_HAVE_ATOMIC64) || defined(__i386__) >> static __inline void >> atomic_dec_64(volatile uint64_t *target) >> { >> >> Modified: head/sys/i386/include/atomic.h >> ============================================================================= >> = >> --- head/sys/i386/include/atomic.h Tue May 29 10:29:43 2018 (r33431 >> 9) >> +++ head/sys/i386/include/atomic.h Tue May 29 11:59:02 2018 (r33432 >> 0) >> @@ -134,6 +134,8 @@ uint64_t atomic_load_acq_64(volatile uint64_t *); >> void atomic_store_rel_64(volatile uint64_t *, uint64_t); >> uint64_t atomic_swap_64(volatile uint64_t *, uint64_t); >> uint64_t atomic_fetchadd_64(volatile uint64_t *, uint64_t); >> +void atomic_add_64(volatile uint64_t *, uint64_t); >> +void atomic_subtract_64(volatile uint64_t *, uint64_t); >> >> #else /* !KLD_MODULE && __GNUCLIKE_ASM */ >> >> @@ -581,6 +583,30 @@ atomic_fetchadd_64(volatile uint64_t *p, uint64_t v) >> } >> } >> >> +static __inline void >> +atomic_add_64(volatile uint64_t *p, uint64_t v) >> +{ >> + uint64_t t; >> + >> + for (;;) { >> + t = *p; >> + if (atomic_cmpset_64(p, t, t + v)) >> + break; >> + } >> +} >> + >> +static __inline void >> +atomic_subtract_64(volatile uint64_t *p, uint64_t v) >> +{ >> + uint64_t t; >> + >> + for (;;) { >> + t = *p; >> + if (atomic_cmpset_64(p, t, t - v)) >> + break; >> + } >> +} >> + >> #endif /* _KERNEL */ >> >> #endif /* KLD_MODULE || !__GNUCLIKE_ASM */ >> @@ -804,6 +830,16 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); >> #define atomic_fetchadd_32 atomic_fetchadd_int >> #define atomic_testandset_32 atomic_testandset_int >> #define atomic_testandclear_32 atomic_testandclear_int >> + >> +/* Operations on 64-bit quad words. */ >> +#define atomic_cmpset_acq_64 atomic_cmpset_64 >> +#define atomic_cmpset_rel_64 atomic_cmpset_64 >> +#define atomic_fetchadd_acq_64 atomic_fetchadd_64 >> +#define atomic_fetchadd_rel_64 atomic_fetchadd_64 >> +#define atomic_add_acq_64 atomic_add_64 >> +#define atomic_add_rel_64 atomic_add_64 >> +#define atomic_subtract_acq_64 atomic_subtract_64 >> +#define atomic_subtract_rel_64 atomic_subtract_64 >> >> /* Operations on pointers. */ >> #define atomic_set_ptr(p, v) \ >> > > Hi Hans, > > This broke in lib32 on an amd64 system. > > --- cddl/lib/libnvpair__L --- > In file included from /opt/src/svn-current/sys/cddl/contrib/opensolaris/ > common/nvpair/opensolaris_fnvpair.c:29: > In file included from /opt/src/svn-current/cddl/contrib/opensolaris/lib/ > libzpool/common/sys/zfs_context.h:74: > /opt/src/svn-current/sys/cddl/compat/opensolaris/sys/atomic.h:94:2: > error: implicit declaration of function 'atomic_subtract_64' is invalid > in C99 [-Werror,-Wimplicit-function-declaration] > atomic_subtract_64(target, 1); > ^ I only tested buildkernel i386 LINT + GENERIC with this change. I will have a look ASAP. --HPS From owner-svn-src-head@freebsd.org Tue May 29 13:43:18 2018 Return-Path: Delivered-To: svn-src-head@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 D1FB2F7DB51; Tue, 29 May 2018 13:43:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 83F376B073; Tue, 29 May 2018 13:43:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 651F41CBDC; Tue, 29 May 2018 13:43:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TDhHJC041063; Tue, 29 May 2018 13:43:17 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TDhHTr041061; Tue, 29 May 2018 13:43:17 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805291343.w4TDhHTr041061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 29 May 2018 13:43:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334328 - in head/sys/cddl/compat/opensolaris: kern sys X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/cddl/compat/opensolaris: kern sys X-SVN-Commit-Revision: 334328 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 13:43:18 -0000 Author: hselasky Date: Tue May 29 13:43:16 2018 New Revision: 334328 URL: https://svnweb.freebsd.org/changeset/base/334328 Log: Fix 32-bit buildworld for i386 after r334320. The 64-bit atomics defined for i386 are currently only available in the kernel space. Found by: cy@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c head/sys/cddl/compat/opensolaris/sys/atomic.h Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Tue May 29 13:24:42 2018 (r334327) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Tue May 29 13:43:16 2018 (r334328) @@ -53,7 +53,7 @@ atomic_init(void) #endif #if !defined(__LP64__) && !defined(__mips_n32) && \ - !defined(ARM_HAVE_ATOMIC64) && !defined(__i386__) + !defined(ARM_HAVE_ATOMIC64) && !defined(I386_HAVE_ATOMIC64) void atomic_add_64(volatile uint64_t *target, int64_t delta) { Modified: head/sys/cddl/compat/opensolaris/sys/atomic.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/atomic.h Tue May 29 13:24:42 2018 (r334327) +++ head/sys/cddl/compat/opensolaris/sys/atomic.h Tue May 29 13:43:16 2018 (r334328) @@ -36,8 +36,12 @@ atomic_cmpset_ptr((volatile uintptr_t *)(_a), (uintptr_t)(_b), (uintptr_t) (_c)) #define cas32 atomic_cmpset_32 +#if defined(__i386__) && (defined(_KERNEL) || defined(KLD_MODULE)) +#define I386_HAVE_ATOMIC64 +#endif + #if !defined(__LP64__) && !defined(__mips_n32) && \ - !defined(ARM_HAVE_ATOMIC64) && !defined(__i386__) + !defined(ARM_HAVE_ATOMIC64) && !defined(I386_HAVE_ATOMIC64) extern void atomic_add_64(volatile uint64_t *target, int64_t delta); extern void atomic_dec_64(volatile uint64_t *target); #endif @@ -87,7 +91,7 @@ atomic_dec_32_nv(volatile uint32_t *target) } #if defined(__LP64__) || defined(__mips_n32) || \ - defined(ARM_HAVE_ATOMIC64) || defined(__i386__) + defined(ARM_HAVE_ATOMIC64) || defined(I386_HAVE_ATOMIC64) static __inline void atomic_dec_64(volatile uint64_t *target) { From owner-svn-src-head@freebsd.org Tue May 29 13:45:33 2018 Return-Path: Delivered-To: svn-src-head@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 9C7D6F7DCED; Tue, 29 May 2018 13:45:33 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B79E6B255; Tue, 29 May 2018 13:45:33 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 8B8582603AE; Tue, 29 May 2018 15:45:31 +0200 (CEST) Subject: Re: svn commit: r334320 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys i386/include From: Hans Petter Selasky To: Cy Schubert Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805291302.w4TD2bR5059884@slippy.cwsent.com> <168f4cd3-07d2-15cb-9cf4-a2d02f6dc260@selasky.org> Message-ID: Date: Tue, 29 May 2018 15:45:18 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <168f4cd3-07d2-15cb-9cf4-a2d02f6dc260@selasky.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 13:45:33 -0000 On 05/29/18 15:10, Hans Petter Selasky wrote: >> Hi Hans, >> >> This broke in lib32 on an amd64 system. >> >> --- cddl/lib/libnvpair__L --- >> In file included from /opt/src/svn-current/sys/cddl/contrib/opensolaris/ >> common/nvpair/opensolaris_fnvpair.c:29: >> In file included from /opt/src/svn-current/cddl/contrib/opensolaris/lib/ >> libzpool/common/sys/zfs_context.h:74: >> /opt/src/svn-current/sys/cddl/compat/opensolaris/sys/atomic.h:94:2: >> error: implicit declaration of function 'atomic_subtract_64' is invalid >> in C99 [-Werror,-Wimplicit-function-declaration] >>          atomic_subtract_64(target, 1); >>          ^ > > I only tested buildkernel i386 LINT + GENERIC with this change. I will > have a look ASAP. > > --HPS See r334328 . --HPS From owner-svn-src-head@freebsd.org Tue May 29 13:52:26 2018 Return-Path: Delivered-To: svn-src-head@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 E7E9AF7E420; Tue, 29 May 2018 13:52:25 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9DD326B81F; Tue, 29 May 2018 13:52:25 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F0DE1CD66; Tue, 29 May 2018 13:52:25 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TDqP2H045849; Tue, 29 May 2018 13:52:25 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TDqPur045848; Tue, 29 May 2018 13:52:25 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201805291352.w4TDqPur045848@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 29 May 2018 13:52:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334329 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 334329 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 13:52:26 -0000 Author: andrew Date: Tue May 29 13:52:25 2018 New Revision: 334329 URL: https://svnweb.freebsd.org/changeset/base/334329 Log: On ThunderX2 we need to be careful to only map the memory the firmware lists in the EFI memory map. As such we need to reduce the mappings to restrict them to not be the full 1G block. For now reduce this to a 2M block, however this may be further restricted to be 4k page aligned as other SoCs may require. This allows ThunderX2 to boot reliably to userspace without performing any speculative memory accesses to invalid physical memory. This is a recommit of r334035 now that we can access the EFI Runtime data through the DMAP region. Tested by: tuexen Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Tue May 29 13:43:16 2018 (r334328) +++ head/sys/arm64/arm64/pmap.c Tue May 29 13:52:25 2018 (r334329) @@ -590,33 +590,100 @@ pmap_early_vtophys(vm_offset_t l1pt, vm_offset_t va) return ((l2[l2_slot] & ~ATTR_MASK) + (va & L2_OFFSET)); } -static void -pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t min_pa, vm_paddr_t max_pa) +static vm_offset_t +pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t min_pa, + vm_offset_t freemempos) { + pt_entry_t *l2; vm_offset_t va; - vm_paddr_t pa; - u_int l1_slot; + vm_paddr_t l2_pa, pa; + u_int l1_slot, l2_slot, prev_l1_slot; int i; dmap_phys_base = min_pa & ~L1_OFFSET; dmap_phys_max = 0; dmap_max_addr = 0; + l2 = NULL; + prev_l1_slot = -1; +#define DMAP_TABLES ((DMAP_MAX_ADDRESS - DMAP_MIN_ADDRESS) >> L0_SHIFT) + memset(pagetable_dmap, 0, PAGE_SIZE * DMAP_TABLES); + for (i = 0; i < (physmap_idx * 2); i += 2) { - pa = physmap[i] & ~L1_OFFSET; + pa = physmap[i] & ~L2_OFFSET; va = pa - dmap_phys_base + DMAP_MIN_ADDRESS; - for (; va < DMAP_MAX_ADDRESS && pa < physmap[i + 1]; + /* Create L2 mappings at the start of the region */ + if ((pa & L1_OFFSET) != 0) { + l1_slot = ((va - DMAP_MIN_ADDRESS) >> L1_SHIFT); + if (l1_slot != prev_l1_slot) { + prev_l1_slot = l1_slot; + l2 = (pt_entry_t *)freemempos; + l2_pa = pmap_early_vtophys(kern_l1, + (vm_offset_t)l2); + freemempos += PAGE_SIZE; + + pmap_load_store(&pagetable_dmap[l1_slot], + (l2_pa & ~Ln_TABLE_MASK) | L1_TABLE); + + memset(l2, 0, PAGE_SIZE); + } + KASSERT(l2 != NULL, + ("pmap_bootstrap_dmap: NULL l2 map")); + for (; va < DMAP_MAX_ADDRESS && pa < physmap[i + 1]; + pa += L2_SIZE, va += L2_SIZE) { + /* + * We are on a boundary, stop to + * create a level 1 block + */ + if ((pa & L1_OFFSET) == 0) + break; + + l2_slot = pmap_l2_index(va); + KASSERT(l2_slot != 0, ("...")); + pmap_load_store(&l2[l2_slot], + (pa & ~L2_OFFSET) | ATTR_DEFAULT | ATTR_XN | + ATTR_IDX(CACHED_MEMORY) | L2_BLOCK); + } + KASSERT(va == (pa - dmap_phys_base + DMAP_MIN_ADDRESS), + ("...")); + } + + for (; va < DMAP_MAX_ADDRESS && pa < physmap[i + 1] && + (physmap[i + 1] - pa) >= L1_SIZE; pa += L1_SIZE, va += L1_SIZE) { l1_slot = ((va - DMAP_MIN_ADDRESS) >> L1_SHIFT); - /* We already have an entry */ - if (pagetable_dmap[l1_slot] != 0) - continue; pmap_load_store(&pagetable_dmap[l1_slot], (pa & ~L1_OFFSET) | ATTR_DEFAULT | ATTR_XN | ATTR_IDX(CACHED_MEMORY) | L1_BLOCK); } + /* Create L2 mappings at the end of the region */ + if (pa < physmap[i + 1]) { + l1_slot = ((va - DMAP_MIN_ADDRESS) >> L1_SHIFT); + if (l1_slot != prev_l1_slot) { + prev_l1_slot = l1_slot; + l2 = (pt_entry_t *)freemempos; + l2_pa = pmap_early_vtophys(kern_l1, + (vm_offset_t)l2); + freemempos += PAGE_SIZE; + + pmap_load_store(&pagetable_dmap[l1_slot], + (l2_pa & ~Ln_TABLE_MASK) | L1_TABLE); + + memset(l2, 0, PAGE_SIZE); + } + KASSERT(l2 != NULL, + ("pmap_bootstrap_dmap: NULL l2 map")); + for (; va < DMAP_MAX_ADDRESS && pa < physmap[i + 1]; + pa += L2_SIZE, va += L2_SIZE) { + l2_slot = pmap_l2_index(va); + pmap_load_store(&l2[l2_slot], + (pa & ~L2_OFFSET) | ATTR_DEFAULT | ATTR_XN | + ATTR_IDX(CACHED_MEMORY) | L2_BLOCK); + } + } + if (pa > dmap_phys_max) { dmap_phys_max = pa; dmap_max_addr = va; @@ -624,6 +691,8 @@ pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t mi } cpu_tlb_flushID(); + + return (freemempos); } static vm_offset_t @@ -729,8 +798,11 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_ max_pa = physmap[i + 1]; } + freemempos = KERNBASE + kernlen; + freemempos = roundup2(freemempos, PAGE_SIZE); + /* Create a direct map region early so we can use it for pa -> va */ - pmap_bootstrap_dmap(l1pt, min_pa, max_pa); + freemempos = pmap_bootstrap_dmap(l1pt, min_pa, freemempos); va = KERNBASE; start_pa = pa = KERNBASE - kern_delta; @@ -762,8 +834,6 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_ va = roundup2(va, L1_SIZE); - freemempos = KERNBASE + kernlen; - freemempos = roundup2(freemempos, PAGE_SIZE); /* Create the l2 tables up to VM_MAX_KERNEL_ADDRESS */ freemempos = pmap_bootstrap_l2(l1pt, va, freemempos); /* And the l3 tables for the early devmap */ From owner-svn-src-head@freebsd.org Tue May 29 13:57:42 2018 Return-Path: Delivered-To: svn-src-head@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 9CA31F7EA80; Tue, 29 May 2018 13:57:42 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 0032C6BDB6; Tue, 29 May 2018 13:57:41 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id Nf86frnjySzNNNf87fEV8w; Tue, 29 May 2018 07:57:40 -0600 X-Authority-Analysis: v=2.3 cv=KuxjJ1eN c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=8nJEP1OIZ-IA:10 a=VUJBJC2UJ8kA:10 a=ndaoGXS1AAAA:8 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=5qHmQeo1rNjm-hv6de8A:9 a=wPNLvfGTeEIA:10 a=mFeOnlTyF09QQMGr2mMI:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 3939C838; Tue, 29 May 2018 06:57:38 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w4TDvb49074606; Tue, 29 May 2018 06:57:37 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w4TDvbkS074594; Tue, 29 May 2018 06:57:37 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201805291357.w4TDvbkS074594@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Hans Petter Selasky cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334320 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys i386/include In-Reply-To: Message from Hans Petter Selasky of "Tue, 29 May 2018 15:45:18 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: Tue, 29 May 2018 06:57:37 -0700 X-CMAE-Envelope: MS4wfCebwJWedOZC20qguS5tE2iunhrUlntNHBfcjeXLFoKvYNsZeGEMk0q1Z0xMQq0+j1jeokm1q3Pb50os7puL/zQnx+mWSPfv2lwLB8oH5k+4IsapWfrR Rb19y1nwUIHuSR6IDz7OzxF+ieB25T2dFqGwlOZcX5I2rHnFfBCAYbd0kA3CUWtwyeLZPnSG/f2P2Xc69doX8L0FiipC1PANSFd+ouMKRvYsnaJlmebnxCKw 44iQKZarlDAsRdWtw4ylwg== X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 13:57:42 -0000 In message , Hans Petter Sela sky writes: > On 05/29/18 15:10, Hans Petter Selasky wrote: > >> Hi Hans, > >> > >> This broke in lib32 on an amd64 system. > >> > >> --- cddl/lib/libnvpair__L --- > >> In file included from /opt/src/svn-current/sys/cddl/contrib/opensolaris/ > >> common/nvpair/opensolaris_fnvpair.c:29: > >> In file included from /opt/src/svn-current/cddl/contrib/opensolaris/lib/ > >> libzpool/common/sys/zfs_context.h:74: > >> /opt/src/svn-current/sys/cddl/compat/opensolaris/sys/atomic.h:94:2: > >> error: implicit declaration of function 'atomic_subtract_64' is invalid > >> in C99 [-Werror,-Wimplicit-function-declaration] > >>          atomic_subtract_64(target, 1); > >>          ^ > > > > I only tested buildkernel i386 LINT + GENERIC with this change. I will > > have a look ASAP. > > > > --HPS > > See r334328 . Thanks. I'll let it build while I'm at $JOB and check it at noon. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Tue May 29 14:00:42 2018 Return-Path: Delivered-To: svn-src-head@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 D5D39F7EDF4; Tue, 29 May 2018 14:00:41 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x22d.google.com (mail-it0-x22d.google.com [IPv6:2607:f8b0:4001:c0b::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C6EC6C081; Tue, 29 May 2018 14:00:41 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x22d.google.com with SMTP id q4-v6so18641622ite.3; Tue, 29 May 2018 07:00:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=3/KdypskOHYrwtSxA/dakIoOSSBvG5U6RQ50GMt3Yz0=; b=K6J600qZbJrz+Hb87E+r5ZdJkbZf2jOpyKT2aLEdXrDJT3LoC/FLCKNvpdUYg0iCRm ksWkt3vcd57VSOzrxY6KOVF0sDBxrZM7SEulYznj3nVvk9tYxZ0g22URkJ5NKyDRsEcX /t2UhcDkSe6JuYUYqQgIlTkJsXmavH2tzPHblvQoh3FjSIfkIuYXokVG+bjE2sFpfp+s YHlP2ZpejbxyEans2d7RtYBELmQgCTag/FPjCDPwYf3ZRZmmtLeEZEhnDthwMWwXdfCo ZWToht47/3V5fkEpIypOLlO1yBLRSBAy1kH5d9fr22UILtZHXMvtBEuvjiIOVhdzdTHn IcFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=3/KdypskOHYrwtSxA/dakIoOSSBvG5U6RQ50GMt3Yz0=; b=gp27WEd6YaV3Pi9mC3tRNCqkOMSBZPobFeQX3pBEQOGAkt4RLqjiPGbPScqielM1ea 1s1n79hWOmQU62Mptl2FMwxeFouGzMd6PbEztKtNTT/Oxl6waAOauVslgD5Sp+yfljRv VxCSMJyNCqZJRlIMH1aWvnQa75INB0pNU/BEyTmB+AkHkXFHLfclXMQ6atXdV4atbiEp xN38WtoLeZAHHq5TCBCG9B03bQ4KrwwlQvHEhQz6IVLCUzKljKoyHzH59XxIs/h7zY0r +KPfPDjGXzpc0yiwK8F3cL8qoeOkIfT4JWJBthTX41Lj+lM1tPA70xhJVGJKz0VgeJIo LyTw== X-Gm-Message-State: ALKqPwdEOZ1PouNhD44sbAYGSU0wps43gmQw277FnUC3aJ7GgafXTVRl FWhyq3+ssC5oQOYcI/qVw8sVApzs/JMIRsblv+Z0Eg== X-Google-Smtp-Source: ADUXVKIzljzyWeUMy+LWVVC+98rclGRdAetGSEKCPfnEW5S/dWkLhswy82yz4C58imu0l7nLXSrnfuRdRtcODedmQyg= X-Received: by 2002:a24:19c9:: with SMTP id b192-v6mr15543880itb.78.1527602440873; Tue, 29 May 2018 07:00:40 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 2002:a6b:87c4:0:0:0:0:0 with HTTP; Tue, 29 May 2018 07:00:20 -0700 (PDT) In-Reply-To: <168f4cd3-07d2-15cb-9cf4-a2d02f6dc260@selasky.org> References: <201805291302.w4TD2bR5059884@slippy.cwsent.com> <168f4cd3-07d2-15cb-9cf4-a2d02f6dc260@selasky.org> From: Ed Maste Date: Tue, 29 May 2018 10:00:20 -0400 X-Google-Sender-Auth: QSXSY__FW0t4lHFmTvaoZgRIrOM Message-ID: Subject: Re: svn commit: r334320 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys i386/include To: Hans Petter Selasky Cc: Cy Schubert , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 14:00:42 -0000 On 29 May 2018 at 09:10, Hans Petter Selasky wrote: > > I only tested buildkernel i386 LINT + GENERIC with this change. I will have > a look ASAP. On IRC the suggestion was made to run buildworld for any header change, and I think this seems like a reasonable standard. Our full buildworld times are admittedly quite long, so if you have a suitably up-to-date toolchain on the build host you can skip building toolchain components with something like: make -DWITHOUT_TOOLCHAIN -DWITHOUT_CLANG_BOOTSTRAP -DWITHOUT_LLD_BOOTSTRAP buildworld That should give much of the build coverage benefit without taking so long. On my little NUC desktop (with -j8) this took about 30 minutes. In addition many folks have put a lot of effort into making non-clean builds work - both meta-mode and conventional. I've generally been building with -DNO_CLEAN for a few years now. The same build with -DNO_CLEAN added and after `touch atomic.h` (again on the NUC) took about 3 minutes. From owner-svn-src-head@freebsd.org Tue May 29 14:04:51 2018 Return-Path: Delivered-To: svn-src-head@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 D98EAF7F2B8; Tue, 29 May 2018 14:04:51 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 86C476C5DD; Tue, 29 May 2018 14:04:51 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63D151CF21; Tue, 29 May 2018 14:04:51 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TE4pQo051370; Tue, 29 May 2018 14:04:51 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TE4pNS051369; Tue, 29 May 2018 14:04:51 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201805291404.w4TE4pNS051369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Tue, 29 May 2018 14:04:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334331 - head/sys/dev/usb X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/sys/dev/usb X-SVN-Commit-Revision: 334331 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 14:04:52 -0000 Author: eadler Date: Tue May 29 14:04:50 2018 New Revision: 334331 URL: https://svnweb.freebsd.org/changeset/base/334331 Log: [usbdevs] Add USB product ID for Philips SPC N900 CCD Webcam PR: 228488 Submitted by: "Harald Schmalzbauer" Modified: head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue May 29 13:54:34 2018 (r334330) +++ head/sys/dev/usb/usbdevs Tue May 29 14:04:50 2018 (r334331) @@ -3592,6 +3592,7 @@ product PHILIPS DSS 0x0104 DSS XXX Digital Speaker Sy product PHILIPS HUB 0x0201 hub product PHILIPS PCA646VC 0x0303 PCA646VC PC Camera product PHILIPS PCVC680K 0x0308 PCVC680K Vesta Pro PC Camera +product PHILIPS SPC900NC 0x0329 SPC 900NC CCD PC Camera product PHILIPS DSS150 0x0471 DSS 150 Digital Speaker System product PHILIPS ACE1001 0x066a AKTAKOM ACE-1001 cable product PHILIPS SPE3030CC 0x083a USB 2.0 External Disk From owner-svn-src-head@freebsd.org Tue May 29 14:04:59 2018 Return-Path: Delivered-To: svn-src-head@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 B5108F7F2E9; Tue, 29 May 2018 14:04:59 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 68A3F6C6C1; Tue, 29 May 2018 14:04:59 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 482BF1CF23; Tue, 29 May 2018 14:04:59 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TE4xjx051473; Tue, 29 May 2018 14:04:59 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TE4xgb051472; Tue, 29 May 2018 14:04:59 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201805291404.w4TE4xgb051472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Tue, 29 May 2018 14:04:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334333 - head/sys/dev/usb X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/sys/dev/usb X-SVN-Commit-Revision: 334333 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 14:04:59 -0000 Author: eadler Date: Tue May 29 14:04:58 2018 New Revision: 334333 URL: https://svnweb.freebsd.org/changeset/base/334333 Log: [usbdevs] add several intel product identifiers Modified: head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue May 29 14:04:57 2018 (r334332) +++ head/sys/dev/usb/usbdevs Tue May 29 14:04:58 2018 (r334333) @@ -2521,6 +2521,10 @@ product INTEL2 IRMH 0x0020 Integrated Rate Mat product INTEL2 IRMH2 0x0024 Integrated Rate Matching Hub product INTEL2 IRMH3 0x8000 Integrated Rate Matching Hub product INTEL2 IRMH4 0x8008 Integrated Rate Matching Hub +product INTEL2 SFP 0x0aa7 Sandy Peak (3168) Bluetooth Module +product INTEL2 JFP 0x0aaa Jefferson Peak (9460/9560) Bluetooth Module +product INTEL2 THP 0x0025 Thunder Peak (9160/9260) Bluetooth Module +product INTEL2 HSP 0x0026 Harrison Peak (22560) Bluetooth Modu /* Interbiometric products */ product INTERBIOMETRICS IOBOARD 0x1002 FTDI compatible adapter From owner-svn-src-head@freebsd.org Tue May 29 14:05:00 2018 Return-Path: Delivered-To: svn-src-head@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 043A7F7F2ED; Tue, 29 May 2018 14:05:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8C5466C6C3; Tue, 29 May 2018 14:04:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69ED41CF24; Tue, 29 May 2018 14:04:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TE4x2i051484; Tue, 29 May 2018 14:04:59 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TE4vmO051429; Tue, 29 May 2018 14:04:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805291404.w4TE4vmO051429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 29 May 2018 14:04:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334332 - in head: share/man/man4 sys/conf sys/dev/mlx5 sys/dev/mlx5/mlx5_core sys/dev/mlx5/mlx5_en sys/modules/mlx5 sys/modules/mlx5en sys/modules/mlx5ib X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head: share/man/man4 sys/conf sys/dev/mlx5 sys/dev/mlx5/mlx5_core sys/dev/mlx5/mlx5_en sys/modules/mlx5 sys/modules/mlx5en sys/modules/mlx5ib X-SVN-Commit-Revision: 334332 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 14:05:00 -0000 Author: hselasky Date: Tue May 29 14:04:57 2018 New Revision: 334332 URL: https://svnweb.freebsd.org/changeset/base/334332 Log: Add support for hardware rate limiting to mlx5en(4). The hardware rate limiting feature is enabled by the RATELIMIT kernel option. Please refer to ifconfig(8) and the txrtlmt option and the SO_MAX_PACING_RATE set socket option for more information. This feature is compatible with hardware transmit send offload, TSO. A set of sysctl(8) knobs under dev.mce..rate_limit are provided to setup the ratelimit table and also to fine tune various rate limit related parameters. Sponsored by: Mellanox Technologies Added: head/sys/dev/mlx5/mlx5_core/mlx5_rl.c (contents, props changed) head/sys/dev/mlx5/mlx5_en/en_rl.h (contents, props changed) head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c (contents, props changed) Modified: head/share/man/man4/mlx5en.4 head/sys/conf/files head/sys/conf/options head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c head/sys/modules/mlx5/Makefile head/sys/modules/mlx5en/Makefile head/sys/modules/mlx5ib/Makefile Modified: head/share/man/man4/mlx5en.4 ============================================================================== --- head/share/man/man4/mlx5en.4 Tue May 29 14:04:50 2018 (r334331) +++ head/share/man/man4/mlx5en.4 Tue May 29 14:04:57 2018 (r334332) @@ -24,18 +24,19 @@ .\" .\" $FreeBSD$ .\" -.Dd December 3, 2015 +.Dd May 29, 2018 .Dt MLX5EN 4 .Os .Sh NAME .Nm mlx5en -.Nd "Mellanox ConnectX-4 and ConnectX-4 LX based 100Gb, 50Gb, 40Gb, 25Gb and 10Gb Ethernet adapter driver" +.Nd "Mellanox ConnectX-4, ConnectX-4 LX and ConnectX-5 based 100Gb, 50Gb, 40Gb, 25Gb and 10Gb Ethernet adapter driver" .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "options COMPAT_LINUXKPI" +.Cd "options RATELIMIT" .Cd "device mlx5" .Cd "device mlx5en" .Ed @@ -56,11 +57,12 @@ mlx5en_load="YES" The .Nm driver provides support for PCI Express Ethernet adapters based on -ConnectX-4 and ConnectX-4 LX. +ConnectX-4, ConnectX-4 LX and ConnectX-5. The driver supports Jumbo Frames, Transmit/Receive checksum offload, TCP segmentation offload (TSO), Large Receive Offload (LRO), HW Large Receive Offload (HW LRO), VLAN tag insertion/extraction, -VLAN checksum offload, VLAN TSO, and Receive Side Steering (RSS). +VLAN checksum offload, VLAN TSO, hardware rate limiting (TXRTLMT) +and Receive Side Steering (RSS). .br The network interface is named mce. .br @@ -74,6 +76,7 @@ For more information on configuring this device, see The .Nm driver supports 100Gb, 50Gb, 40Gb, 25Gb and 10Gb Ethernet adapters. +ConnectX-5 supports:10/20/25/40/50/56/100Gb/s speeds. ConnectX-4 supports:10/20/25/40/50/56/100Gb/s speeds. ConnectX-4 LX supports:10/25/40/50Gb/s speeds (and reduced power consumption) : .Pp Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue May 29 14:04:50 2018 (r334331) +++ head/sys/conf/files Tue May 29 14:04:57 2018 (r334332) @@ -4775,6 +4775,8 @@ dev/mlx5/mlx5_core/mlx5_port.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_qp.c optional mlx5 pci \ compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_rl.c optional mlx5 pci \ + compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_srq.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_transobj.c optional mlx5 pci \ @@ -4797,6 +4799,8 @@ dev/mlx5/mlx5_en/mlx5_en_tx.c optional mlx5en pci in dev/mlx5/mlx5_en/mlx5_en_flow_table.c optional mlx5en pci inet inet6 \ compile-with "${OFED_C}" dev/mlx5/mlx5_en/mlx5_en_rx.c optional mlx5en pci inet inet6 \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_en/mlx5_en_rl.c optional mlx5en pci inet inet6 \ compile-with "${OFED_C}" dev/mlx5/mlx5_en/mlx5_en_txrx.c optional mlx5en pci inet inet6 \ compile-with "${OFED_C}" Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Tue May 29 14:04:50 2018 (r334331) +++ head/sys/conf/options Tue May 29 14:04:57 2018 (r334332) @@ -420,6 +420,7 @@ BOOTP_WIRED_TO opt_bootp.h DEVICE_POLLING DUMMYNET opt_ipdn.h RATELIMIT opt_ratelimit.h +RATELIMIT_DEBUG opt_ratelimit.h INET opt_inet.h INET6 opt_inet6.h IPDIVERT Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Tue May 29 14:04:50 2018 (r334331) +++ head/sys/dev/mlx5/driver.h Tue May 29 14:04:57 2018 (r334332) @@ -28,6 +28,8 @@ #ifndef MLX5_DRIVER_H #define MLX5_DRIVER_H +#include "opt_ratelimit.h" + #include #include #include @@ -500,7 +502,11 @@ struct mlx5_core_health { struct delayed_work recover_work; }; +#ifdef RATELIMIT +#define MLX5_CQ_LINEAR_ARRAY_SIZE (128 * 1024) +#else #define MLX5_CQ_LINEAR_ARRAY_SIZE 1024 +#endif struct mlx5_cq_linear_array_entry { spinlock_t lock; @@ -540,6 +546,23 @@ struct mlx5_irq_info { char name[MLX5_MAX_IRQ_NAME]; }; +#ifdef RATELIMIT +struct mlx5_rl_entry { + u32 rate; + u16 burst; + u16 index; + u32 refcount; +}; + +struct mlx5_rl_table { + struct mutex rl_lock; + u16 max_size; + u32 max_rate; + u32 min_rate; + struct mlx5_rl_entry *rl_entry; +}; +#endif + struct mlx5_priv { char name[MLX5_MAX_NAME_LEN]; struct mlx5_eq_table eq_table; @@ -592,6 +615,9 @@ struct mlx5_priv { struct list_head ctx_list; spinlock_t ctx_lock; unsigned long pci_dev_data; +#ifdef RATELIMIT + struct mlx5_rl_table rl_table; +#endif }; enum mlx5_device_state { @@ -1084,5 +1110,17 @@ static inline int mlx5_core_is_pf(struct mlx5_core_dev { return !(dev->priv.pci_dev_data & MLX5_PCI_DEV_IS_VF); } +#ifdef RATELIMIT +int mlx5_init_rl_table(struct mlx5_core_dev *dev); +void mlx5_cleanup_rl_table(struct mlx5_core_dev *dev); +int mlx5_rl_add_rate(struct mlx5_core_dev *dev, u32 rate, u32 burst, u16 *index); +void mlx5_rl_remove_rate(struct mlx5_core_dev *dev, u32 rate, u32 burst); +bool mlx5_rl_is_in_range(const struct mlx5_core_dev *dev, u32 rate, u32 burst); + +static inline bool mlx5_rl_is_supported(struct mlx5_core_dev *dev) +{ + return !!(dev->priv.rl_table.max_size); +} +#endif #endif /* MLX5_DRIVER_H */ Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Tue May 29 14:04:50 2018 (r334331) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Tue May 29 14:04:57 2018 (r334332) @@ -905,8 +905,23 @@ static int mlx5_init_once(struct mlx5_core_dev *dev, s mlx5_init_srq_table(dev); mlx5_init_mr_table(dev); +#ifdef RATELIMIT + err = mlx5_init_rl_table(dev); + if (err) { + dev_err(&pdev->dev, "Failed to init rate limiting\n"); + goto err_tables_cleanup; + } +#endif return 0; +#ifdef RATELIMIT +err_tables_cleanup: + mlx5_cleanup_mr_table(dev); + mlx5_cleanup_srq_table(dev); + mlx5_cleanup_qp_table(dev); + mlx5_cleanup_cq_table(dev); +#endif + err_eq_cleanup: mlx5_eq_cleanup(dev); @@ -916,6 +931,9 @@ out: static void mlx5_cleanup_once(struct mlx5_core_dev *dev) { +#ifdef RATELIMIT + mlx5_cleanup_rl_table(dev); +#endif mlx5_cleanup_mr_table(dev); mlx5_cleanup_srq_table(dev); mlx5_cleanup_qp_table(dev); Added: head/sys/dev/mlx5/mlx5_core/mlx5_rl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_core/mlx5_rl.c Tue May 29 14:04:57 2018 (r334332) @@ -0,0 +1,206 @@ +/*- + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include "mlx5_core.h" + +#ifdef RATELIMIT + +/* Finds an entry where we can register the given rate + * If the rate already exists, return the entry where it is registered, + * otherwise return the first available entry. + * If the table is full, return NULL + */ +static struct mlx5_rl_entry *find_rl_entry(struct mlx5_rl_table *table, + u32 rate, u16 burst) +{ + struct mlx5_rl_entry *ret_entry = NULL; + struct mlx5_rl_entry *entry; + u16 i; + + for (i = 0; i < table->max_size; i++) { + entry = table->rl_entry + i; + if (entry->rate == rate && entry->burst == burst) + return entry; + if (ret_entry == NULL && entry->rate == 0) + ret_entry = entry; + } + + return ret_entry; +} + +static int mlx5_set_rate_limit_cmd(struct mlx5_core_dev *dev, + u32 rate, u32 burst, u16 index) +{ + u32 in[MLX5_ST_SZ_DW(set_rate_limit_in)] = {0}; + u32 out[MLX5_ST_SZ_DW(set_rate_limit_out)] = {0}; + + MLX5_SET(set_rate_limit_in, in, opcode, + MLX5_CMD_OP_SET_RATE_LIMIT); + MLX5_SET(set_rate_limit_in, in, rate_limit_index, index); + MLX5_SET(set_rate_limit_in, in, rate_limit, rate); + + if (MLX5_CAP_QOS(dev, packet_pacing_burst_bound)) + MLX5_SET(set_rate_limit_in, in, burst_upper_bound, burst); + + return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); +} + +bool mlx5_rl_is_in_range(const struct mlx5_core_dev *dev, u32 rate, u32 burst) +{ + const struct mlx5_rl_table *table = &dev->priv.rl_table; + + return (rate <= table->max_rate && rate >= table->min_rate && + burst <= 65535); +} +EXPORT_SYMBOL(mlx5_rl_is_in_range); + +int mlx5_rl_add_rate(struct mlx5_core_dev *dev, u32 rate, u32 burst, u16 *index) +{ + struct mlx5_rl_table *table = &dev->priv.rl_table; + struct mlx5_rl_entry *entry; + int err = 0; + + mutex_lock(&table->rl_lock); + + if (!rate || !mlx5_rl_is_in_range(dev, rate, burst)) { + mlx5_core_err(dev, "Invalid rate: %u, should be %u to %u\n", + rate, table->min_rate, table->max_rate); + err = -ERANGE; + goto out; + } + + entry = find_rl_entry(table, rate, burst); + if (!entry) { + mlx5_core_err(dev, "Max number of %u rates reached\n", + table->max_size); + err = -ENOSPC; + goto out; + } + if (entry->refcount == 0xFFFFFFFFU) { + /* out of refcounts */ + err = -ENOMEM; + goto out; + } else if (entry->refcount != 0) { + /* rate already configured */ + entry->refcount++; + } else { + /* new rate limit */ + err = mlx5_set_rate_limit_cmd(dev, rate, burst, entry->index); + if (err) { + mlx5_core_err(dev, "Failed configuring rate: %u (%d)\n", + rate, err); + goto out; + } + entry->rate = rate; + entry->burst = burst; + entry->refcount = 1; + } + *index = entry->index; + +out: + mutex_unlock(&table->rl_lock); + return err; +} +EXPORT_SYMBOL(mlx5_rl_add_rate); + +void mlx5_rl_remove_rate(struct mlx5_core_dev *dev, u32 rate, u32 burst) +{ + struct mlx5_rl_table *table = &dev->priv.rl_table; + struct mlx5_rl_entry *entry = NULL; + + /* 0 is a reserved value for unlimited rate */ + if (rate == 0) + return; + + mutex_lock(&table->rl_lock); + entry = find_rl_entry(table, rate, burst); + if (!entry || !entry->refcount) { + mlx5_core_warn(dev, "Rate %u is not configured\n", rate); + goto out; + } + + entry->refcount--; + if (!entry->refcount) { + /* need to remove rate */ + mlx5_set_rate_limit_cmd(dev, 0, 0, entry->index); + entry->rate = 0; + entry->burst = 0; + } + +out: + mutex_unlock(&table->rl_lock); +} +EXPORT_SYMBOL(mlx5_rl_remove_rate); + +int mlx5_init_rl_table(struct mlx5_core_dev *dev) +{ + struct mlx5_rl_table *table = &dev->priv.rl_table; + int i; + + mutex_init(&table->rl_lock); + if (!MLX5_CAP_GEN(dev, qos) || !MLX5_CAP_QOS(dev, packet_pacing)) { + table->max_size = 0; + return 0; + } + + /* First entry is reserved for unlimited rate */ + table->max_size = MLX5_CAP_QOS(dev, packet_pacing_rate_table_size) - 1; + table->max_rate = MLX5_CAP_QOS(dev, packet_pacing_max_rate); + table->min_rate = MLX5_CAP_QOS(dev, packet_pacing_min_rate); + + table->rl_entry = kcalloc(table->max_size, sizeof(struct mlx5_rl_entry), + GFP_KERNEL); + if (!table->rl_entry) + return -ENOMEM; + + /* The index represents the index in HW rate limit table + * Index 0 is reserved for unlimited rate + */ + for (i = 0; i < table->max_size; i++) + table->rl_entry[i].index = i + 1; + + return 0; +} + +void mlx5_cleanup_rl_table(struct mlx5_core_dev *dev) +{ + struct mlx5_rl_table *table = &dev->priv.rl_table; + int i; + + /* Clear all configured rates */ + for (i = 0; i < table->max_size; i++) + if (table->rl_entry[i].rate) + mlx5_set_rate_limit_cmd(dev, 0, 0, + table->rl_entry[i].index); + + kfree(dev->priv.rl_table.rl_entry); +} + +#endif Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Tue May 29 14:04:50 2018 (r334331) +++ head/sys/dev/mlx5/mlx5_en/en.h Tue May 29 14:04:57 2018 (r334332) @@ -49,6 +49,7 @@ #include #include #include +#include #include "opt_rss.h" @@ -711,6 +712,10 @@ struct mlx5e_flow_tables { struct mlx5e_flow_table inner_rss; }; +#ifdef RATELIMIT +#include "en_rl.h" +#endif + #define MLX5E_TSTMP_PREC 10 struct mlx5e_clbr_point { @@ -778,6 +783,9 @@ struct mlx5e_priv { int media_active_last; struct callout watchdog; +#ifdef RATELIMIT + struct mlx5e_rl_priv_data rl; +#endif struct callout tstmp_clbr; int clbr_done; Added: head/sys/dev/mlx5/mlx5_en/en_rl.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_en/en_rl.h Tue May 29 14:04:57 2018 (r334332) @@ -0,0 +1,174 @@ +/*- + * Copyright (c) 2016 Mellanox Technologies. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __MLX5_EN_RL_H__ +#define __MLX5_EN_RL_H__ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define MLX5E_RL_MAX_WORKERS 128 /* limited by Toeplitz hash */ +#define MLX5E_RL_MAX_TX_RATES (64 * 1024) /* software limit */ +#define MLX5E_RL_DEF_SQ_PER_WORKER (12 * 1024) /* software limit */ +#define MLX5E_RL_MAX_SQS (120 * 1024) /* software limit */ + +#define MLX5E_RL_TX_COAL_USEC_DEFAULT 32 +#define MLX5E_RL_TX_COAL_PKTS_DEFAULT 4 +#define MLX5E_RL_TX_COAL_MODE_DEFAULT 0 +#define MLX5E_RL_TX_COMP_FACT_DEFAULT 1 + +#define MLX5E_RL_WORKER_LOCK(rlw) mtx_lock(&(rlw)->mtx) +#define MLX5E_RL_WORKER_UNLOCK(rlw) mtx_unlock(&(rlw)->mtx) + +#define MLX5E_RL_RLOCK(rl) sx_slock(&(rl)->rl_sxlock) +#define MLX5E_RL_RUNLOCK(rl) sx_sunlock(&(rl)->rl_sxlock) + +#define MLX5E_RL_WLOCK(rl) sx_xlock(&(rl)->rl_sxlock) +#define MLX5E_RL_WUNLOCK(rl) sx_xunlock(&(rl)->rl_sxlock) + +#define MLX5E_RL_PARAMS(m) \ + m(+1, u64 tx_queue_size, "tx_queue_size", "Default send queue size") \ + m(+1, u64 tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining TX packets") \ + m(+1, u64 tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of TX packets to join") \ + m(+1, u64 tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \ + m(+1, u64 tx_completion_fact, "tx_completion_fact", "1..MAX: Completion event ratio") \ + m(+1, u64 tx_completion_fact_max, "tx_completion_fact_max", "Maximum completion event ratio") \ + m(+1, u64 tx_worker_threads_max, "tx_worker_threads_max", "Max number of TX worker threads") \ + m(+1, u64 tx_worker_threads_def, "tx_worker_threads_def", "Default number of TX worker threads") \ + m(+1, u64 tx_channels_per_worker_max, "tx_channels_per_worker_max", "Max number of TX channels per worker") \ + m(+1, u64 tx_channels_per_worker_def, "tx_channels_per_worker_def", "Default number of TX channels per worker") \ + m(+1, u64 tx_rates_max, "tx_rates_max", "Max number of TX rates") \ + m(+1, u64 tx_rates_def, "tx_rates_def", "Default number of TX rates") \ + m(+1, u64 tx_limit_min, "tx_limit_min", "Minimum TX rate in bits/s") \ + m(+1, u64 tx_limit_max, "tx_limit_max", "Maximum TX rate in bits/s") \ + m(+1, u64 tx_burst_size, "tx_burst_size", "Current burst size in number of packets. A value of zero means use firmware default.") \ + m(+1, u64 tx_burst_size_max, "tx_burst_size_max", "Maximum burst size in number of packets") \ + m(+1, u64 tx_burst_size_min, "tx_burst_size_min", "Minimum burst size in number of packets") + +#define MLX5E_RL_PARAMS_NUM (0 MLX5E_RL_PARAMS(MLX5E_STATS_COUNT)) + +#define MLX5E_RL_STATS(m) \ + m(+1, u64 tx_allocate_resource_failure, "tx_allocate_resource_failure", "Number of times firmware resource allocation failed") \ + m(+1, u64 tx_add_new_rate_failure, "tx_add_new_rate_failure", "Number of times adding a new firmware rate failed") \ + m(+1, u64 tx_modify_rate_failure, "tx_modify_rate_failure", "Number of times modifying a firmware rate failed") \ + m(+1, u64 tx_active_connections, "tx_active_connections", "Number of active connections") \ + m(+1, u64 tx_open_queues, "tx_open_queues", "Number of open TX queues") \ + m(+1, u64 tx_available_resource_failure, "tx_available_resource_failure", "Number of times TX resources were not available") + +#define MLX5E_RL_STATS_NUM (0 MLX5E_RL_STATS(MLX5E_STATS_COUNT)) + +#define MLX5E_RL_TABLE_PARAMS(m) \ + m(+1, u64 tx_limit_add, "tx_limit_add", "Add TX rate limit in bits/s to empty slot") \ + m(+1, u64 tx_limit_clr, "tx_limit_clr", "Clear all TX rates in table") \ + m(+1, u64 tx_allowed_deviation, "tx_allowed_deviation", "Relative rate deviation allowed in 1/1000") \ + m(+1, u64 tx_allowed_deviation_min, "tx_allowed_deviation_min", "Minimum allowed rate deviation in 1/1000") \ + m(+1, u64 tx_allowed_deviation_max, "tx_allowed_deviation_max", "Maximum allowed rate deviation in 1/1000") + +#define MLX5E_RL_TABLE_PARAMS_NUM (0 MLX5E_RL_TABLE_PARAMS(MLX5E_STATS_COUNT)) + +#define MLX5E_RL_PARAMS_INDEX(n) \ + (__offsetof(struct mlx5e_rl_params, n) / sizeof(uint64_t)) + +struct mlx5e_priv; + +/* Indicates channel's state */ +enum { + MLX5E_RL_ST_FREE, + MLX5E_RL_ST_USED, + MLX5E_RL_ST_MODIFY, + MLX5E_RL_ST_DESTROY, +}; + +struct mlx5e_rl_stats { + u64 arg [0]; + MLX5E_RL_STATS(MLX5E_STATS_VAR) +}; + +struct mlx5e_rl_params { + u64 arg [0]; + MLX5E_RL_PARAMS(MLX5E_STATS_VAR) + u64 table_arg [0]; + MLX5E_RL_TABLE_PARAMS(MLX5E_STATS_VAR) +}; + +struct mlx5e_rl_channel_param { + struct mlx5e_sq_param sq; + struct mlx5e_cq_param cq; +}; + +struct mlx5e_rl_channel { + struct m_snd_tag m_snd_tag; + STAILQ_ENTRY(mlx5e_rl_channel) entry; + struct mlx5e_sq * volatile sq; + struct mlx5e_rl_worker *worker; + uint64_t new_rate; + uint64_t init_rate; + uint64_t last_rate; + uint16_t last_burst; + uint16_t state; +}; + +struct mlx5e_rl_worker { + struct mtx mtx; + struct cv cv; + STAILQ_HEAD(, mlx5e_rl_channel) index_list_head; + STAILQ_HEAD(, mlx5e_rl_channel) process_head; + struct mlx5e_priv *priv; + struct mlx5e_rl_channel *channels; + unsigned worker_done; +}; + +struct mlx5e_rl_priv_data { + struct sx rl_sxlock; + struct sysctl_ctx_list ctx; + struct mlx5e_rl_channel_param chan_param; + struct mlx5e_rl_params param; + struct mlx5e_rl_stats stats; + struct mlx5_uar sq_uar; + struct mlx5e_rl_worker *workers; + struct mlx5e_priv *priv; + uint64_t *rate_limit_table; + unsigned opened; + uint32_t tisn; +}; + +int mlx5e_rl_init(struct mlx5e_priv *priv); +void mlx5e_rl_cleanup(struct mlx5e_priv *priv); +if_snd_tag_alloc_t mlx5e_rl_snd_tag_alloc; +if_snd_tag_modify_t mlx5e_rl_snd_tag_modify; +if_snd_tag_query_t mlx5e_rl_snd_tag_query; +if_snd_tag_free_t mlx5e_rl_snd_tag_free; + +#endif /* __MLX5_EN_RL_H__ */ Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue May 29 14:04:50 2018 (r334331) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue May 29 14:04:57 2018 (r334332) @@ -3507,6 +3507,13 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) ifp->if_capabilities |= IFCAP_LRO; ifp->if_capabilities |= IFCAP_TSO | IFCAP_VLAN_HWTSO; ifp->if_capabilities |= IFCAP_HWSTATS | IFCAP_HWRXTSTMP; +#ifdef RATELIMIT + ifp->if_capabilities |= IFCAP_TXRTLMT; + ifp->if_snd_tag_alloc = mlx5e_rl_snd_tag_alloc; + ifp->if_snd_tag_free = mlx5e_rl_snd_tag_free; + ifp->if_snd_tag_modify = mlx5e_rl_snd_tag_modify; + ifp->if_snd_tag_query = mlx5e_rl_snd_tag_query; +#endif /* set TSO limits so that we don't have to drop TX packets */ ifp->if_hw_tsomax = MLX5E_MAX_TX_PAYLOAD_SIZE - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); @@ -3588,6 +3595,14 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) random_ether_addr(dev_addr); if_printf(ifp, "Assigned random MAC address\n"); } +#ifdef RATELIMIT + err = mlx5e_rl_init(priv); + if (err) { + if_printf(ifp, "%s: mlx5e_rl_init failed, %d\n", + __func__, err); + goto err_create_mkey; + } +#endif /* set default MTU */ mlx5e_set_dev_port_mtu(ifp, ifp->if_mtu); @@ -3673,6 +3688,10 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) return (priv); +#ifdef RATELIMIT +err_create_mkey: + mlx5_core_destroy_mkey(priv->mdev, &priv->mr); +#endif err_dealloc_transport_domain: mlx5_dealloc_transport_domain(mdev, priv->tdn); @@ -3715,6 +3734,18 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp /* XXX wait a bit to allow IOCTL handlers to complete */ pause("W", hz); +#ifdef RATELIMIT + /* + * The kernel can have reference(s) via the m_snd_tag's into + * the ratelimit channels, and these must go away before + * detaching: + */ + while (READ_ONCE(priv->rl.stats.tx_active_connections) != 0) { + if_printf(priv->ifp, "Waiting for all ratelimit connections " + "to terminate\n"); + pause("W", hz); + } +#endif /* stop watchdog timer */ callout_drain(&priv->watchdog); @@ -3735,6 +3766,9 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp ether_ifdetach(ifp); if_free(ifp); +#ifdef RATELIMIT + mlx5e_rl_cleanup(priv); +#endif /* destroy all remaining sysctl nodes */ if (priv->sysctl_debug) sysctl_ctx_free(&priv->stats.port_stats_debug.ctx); Added: head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Tue May 29 14:04:57 2018 (r334332) @@ -0,0 +1,1539 @@ +/*- + * Copyright (c) 2016 Mellanox Technologies. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include "en.h" + +#ifdef RATELIMIT + +static int mlx5e_rl_open_workers(struct mlx5e_priv *); +static void mlx5e_rl_close_workers(struct mlx5e_priv *); +static int mlx5e_rl_sysctl_show_rate_table(SYSCTL_HANDLER_ARGS); +static void mlx5e_rl_sysctl_add_u64_oid(struct mlx5e_rl_priv_data *, unsigned x, + struct sysctl_oid *, const char *name, const char *desc); +static void mlx5e_rl_sysctl_add_stats_u64_oid(struct mlx5e_rl_priv_data *rl, unsigned x, + struct sysctl_oid *node, const char *name, const char *desc); +static int mlx5e_rl_tx_limit_add(struct mlx5e_rl_priv_data *, uint64_t value); +static int mlx5e_rl_tx_limit_clr(struct mlx5e_rl_priv_data *, uint64_t value); + +static void +mlx5e_rl_build_sq_param(struct mlx5e_rl_priv_data *rl, + struct mlx5e_sq_param *param) +{ + void *sqc = param->sqc; + void *wq = MLX5_ADDR_OF(sqc, sqc, wq); + uint8_t log_sq_size = order_base_2(rl->param.tx_queue_size); + + MLX5_SET(wq, wq, log_wq_sz, log_sq_size); + MLX5_SET(wq, wq, log_wq_stride, ilog2(MLX5_SEND_WQE_BB)); + MLX5_SET(wq, wq, pd, rl->priv->pdn); + + param->wq.buf_numa_node = 0; + param->wq.db_numa_node = 0; + param->wq.linear = 1; +} + +static void +mlx5e_rl_build_cq_param(struct mlx5e_rl_priv_data *rl, + struct mlx5e_cq_param *param) +{ + void *cqc = param->cqc; + uint8_t log_sq_size = order_base_2(rl->param.tx_queue_size); + + MLX5_SET(cqc, cqc, log_cq_size, log_sq_size); + MLX5_SET(cqc, cqc, cq_period, rl->param.tx_coalesce_usecs); + MLX5_SET(cqc, cqc, cq_max_count, rl->param.tx_coalesce_pkts); + + switch (rl->param.tx_coalesce_mode) { + case 0: + MLX5_SET(cqc, cqc, cq_period_mode, MLX5_CQ_PERIOD_MODE_START_FROM_EQE); + break; + default: + if (MLX5_CAP_GEN(rl->priv->mdev, cq_period_start_from_cqe)) + MLX5_SET(cqc, cqc, cq_period_mode, MLX5_CQ_PERIOD_MODE_START_FROM_CQE); + else + MLX5_SET(cqc, cqc, cq_period_mode, MLX5_CQ_PERIOD_MODE_START_FROM_EQE); + break; + } +} + +static void +mlx5e_rl_build_channel_param(struct mlx5e_rl_priv_data *rl, + struct mlx5e_rl_channel_param *cparam) +{ + memset(cparam, 0, sizeof(*cparam)); + + mlx5e_rl_build_sq_param(rl, &cparam->sq); + mlx5e_rl_build_cq_param(rl, &cparam->cq); +} + +static int +mlx5e_rl_create_sq(struct mlx5e_priv *priv, struct mlx5e_sq *sq, + struct mlx5e_sq_param *param, int ix) +{ + struct mlx5_core_dev *mdev = priv->mdev; + void *sqc = param->sqc; + void *sqc_wq = MLX5_ADDR_OF(sqc, sqc, wq); + int err; + + /* Create DMA descriptor TAG */ + if ((err = -bus_dma_tag_create( + bus_get_dma_tag(mdev->pdev->dev.bsddev), + 1, /* any alignment */ + 0, /* no boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MLX5E_MAX_TX_PAYLOAD_SIZE, /* maxsize */ + MLX5E_MAX_TX_MBUF_FRAGS, /* nsegments */ + MLX5E_MAX_TX_MBUF_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockfuncarg */ + &sq->dma_tag))) + goto done; + + /* use shared UAR */ + sq->uar = priv->rl.sq_uar; + + err = mlx5_wq_cyc_create(mdev, ¶m->wq, sqc_wq, &sq->wq, + &sq->wq_ctrl); + if (err) + goto err_free_dma_tag; + + sq->wq.db = &sq->wq.db[MLX5_SND_DBR]; + /* + * The sq->bf_buf_size variable is intentionally left zero so + * that the doorbell writes will occur at the same memory + * location. + */ + + err = mlx5e_alloc_sq_db(sq); + if (err) + goto err_sq_wq_destroy; + + sq->mkey_be = cpu_to_be32(priv->mr.key); + sq->ifp = priv->ifp; + sq->priv = priv; + + return (0); + +err_sq_wq_destroy: + mlx5_wq_destroy(&sq->wq_ctrl); +err_free_dma_tag: + bus_dma_tag_destroy(sq->dma_tag); +done: + return (err); +} + +static void +mlx5e_rl_destroy_sq(struct mlx5e_sq *sq) +{ + + mlx5e_free_sq_db(sq); + mlx5_wq_destroy(&sq->wq_ctrl); +} + +static int +mlx5e_rl_open_sq(struct mlx5e_priv *priv, struct mlx5e_sq *sq, + struct mlx5e_sq_param *param, int ix) +{ + int err; + + err = mlx5e_rl_create_sq(priv, sq, param, ix); + if (err) + return (err); + + err = mlx5e_enable_sq(sq, param, priv->rl.tisn); + if (err) + goto err_destroy_sq; + + err = mlx5e_modify_sq(sq, MLX5_SQC_STATE_RST, MLX5_SQC_STATE_RDY); + if (err) + goto err_disable_sq; + + return (0); + +err_disable_sq: + mlx5e_disable_sq(sq); +err_destroy_sq: + mlx5e_rl_destroy_sq(sq); + + return (err); +} + +static void +mlx5e_rl_chan_mtx_init(struct mlx5e_priv *priv, struct mlx5e_sq *sq) +{ + mtx_init(&sq->lock, "mlx5tx-rl", NULL, MTX_DEF); + mtx_init(&sq->comp_lock, "mlx5comp-rl", NULL, MTX_DEF); + + callout_init_mtx(&sq->cev_callout, &sq->lock, 0); + + sq->cev_factor = priv->rl.param.tx_completion_fact; + + /* ensure the TX completion event factor is not zero */ + if (sq->cev_factor == 0) + sq->cev_factor = 1; +} + +static int +mlx5e_rl_open_channel(struct mlx5e_rl_worker *rlw, int eq_ix, + struct mlx5e_rl_channel_param *cparam, + struct mlx5e_sq *volatile *ppsq) +{ + struct mlx5e_priv *priv = rlw->priv; + struct mlx5e_sq *sq; + int err; + + sq = malloc(sizeof(*sq), M_MLX5EN, M_WAITOK | M_ZERO); + + /* init mutexes */ + mlx5e_rl_chan_mtx_init(priv, sq); + + /* open TX completion queue */ + err = mlx5e_open_cq(priv, &cparam->cq, &sq->cq, + &mlx5e_tx_cq_comp, eq_ix); + if (err) + goto err_free; + + err = mlx5e_rl_open_sq(priv, sq, &cparam->sq, eq_ix); + if (err) + goto err_close_tx_cq; + + /* store TX channel pointer */ + *ppsq = sq; + + /* poll TX queue initially */ + sq->cq.mcq.comp(&sq->cq.mcq); + + return (0); + +err_close_tx_cq: + mlx5e_close_cq(&sq->cq); + +err_free: + /* destroy mutexes */ + mtx_destroy(&sq->lock); + mtx_destroy(&sq->comp_lock); + free(sq, M_MLX5EN); + atomic_add_64(&priv->rl.stats.tx_allocate_resource_failure, 1ULL); + return (err); +} + +static void +mlx5e_rl_close_channel(struct mlx5e_sq *volatile *ppsq) +{ + struct mlx5e_sq *sq = *ppsq; + + /* check if channel is already closed */ + if (sq == NULL) + return; + /* ensure channel pointer is no longer used */ + *ppsq = NULL; + + /* teardown and destroy SQ */ + mlx5e_drain_sq(sq); + mlx5e_disable_sq(sq); + mlx5e_rl_destroy_sq(sq); + + /* close CQ */ + mlx5e_close_cq(&sq->cq); + + /* destroy mutexes */ + mtx_destroy(&sq->lock); + mtx_destroy(&sq->comp_lock); + + free(sq, M_MLX5EN); +} + +static void +mlx5e_rl_sync_tx_completion_fact(struct mlx5e_rl_priv_data *rl) +{ + /* + * Limit the maximum distance between completion events to + * half of the currently set TX queue size. + * + * The maximum number of queue entries a single IP packet can + * consume is given by MLX5_SEND_WQE_MAX_WQEBBS. + * + * The worst case max value is then given as below: + */ + uint64_t max = rl->param.tx_queue_size / + (2 * MLX5_SEND_WQE_MAX_WQEBBS); + + /* + * Update the maximum completion factor value in case the + * tx_queue_size field changed. Ensure we don't overflow + * 16-bits. + */ + if (max < 1) + max = 1; + else if (max > 65535) + max = 65535; + rl->param.tx_completion_fact_max = max; + + /* + * Verify that the current TX completion factor is within the + * given limits: + */ + if (rl->param.tx_completion_fact < 1) + rl->param.tx_completion_fact = 1; + else if (rl->param.tx_completion_fact > max) + rl->param.tx_completion_fact = max; +} + +static int +mlx5e_rl_modify_sq(struct mlx5e_sq *sq, uint16_t rl_index) +{ + struct mlx5e_priv *priv = sq->priv; + struct mlx5_core_dev *mdev = priv->mdev; + + void *in; + void *sqc; + int inlen; + int err; + + inlen = MLX5_ST_SZ_BYTES(modify_sq_in); + in = mlx5_vzalloc(inlen); + if (in == NULL) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue May 29 14:08:07 2018 Return-Path: Delivered-To: svn-src-head@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 110E4F7F6A9; Tue, 29 May 2018 14:08:07 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B10596CB2C; Tue, 29 May 2018 14:08:06 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E7A81CF27; Tue, 29 May 2018 14:08:06 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TE86Zx051640; Tue, 29 May 2018 14:08:06 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TE86Vt051639; Tue, 29 May 2018 14:08:06 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201805291408.w4TE86Vt051639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Tue, 29 May 2018 14:08:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334334 - head/sys/dev/usb X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/sys/dev/usb X-SVN-Commit-Revision: 334334 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 14:08:07 -0000 Author: eadler Date: Tue May 29 14:08:06 2018 New Revision: 334334 URL: https://svnweb.freebsd.org/changeset/base/334334 Log: [usbdevs] add misig letters Modified: head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue May 29 14:04:58 2018 (r334333) +++ head/sys/dev/usb/usbdevs Tue May 29 14:08:06 2018 (r334334) @@ -2524,7 +2524,7 @@ product INTEL2 IRMH4 0x8008 Integrated Rate Ma product INTEL2 SFP 0x0aa7 Sandy Peak (3168) Bluetooth Module product INTEL2 JFP 0x0aaa Jefferson Peak (9460/9560) Bluetooth Module product INTEL2 THP 0x0025 Thunder Peak (9160/9260) Bluetooth Module -product INTEL2 HSP 0x0026 Harrison Peak (22560) Bluetooth Modu +product INTEL2 HSP 0x0026 Harrison Peak (22560) Bluetooth Module /* Interbiometric products */ product INTERBIOMETRICS IOBOARD 0x1002 FTDI compatible adapter From owner-svn-src-head@freebsd.org Tue May 29 14:17:04 2018 Return-Path: Delivered-To: svn-src-head@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 390F3F7FD52; Tue, 29 May 2018 14:17:04 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CCAFC6D096; Tue, 29 May 2018 14:17:03 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 32AD12603AE; Tue, 29 May 2018 16:17:01 +0200 (CEST) Subject: Re: svn commit: r334320 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys i386/include To: Ed Maste Cc: Cy Schubert , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805291302.w4TD2bR5059884@slippy.cwsent.com> <168f4cd3-07d2-15cb-9cf4-a2d02f6dc260@selasky.org> From: Hans Petter Selasky Message-ID: Date: Tue, 29 May 2018 16:16:48 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 14:17:04 -0000 On 05/29/18 16:00, Ed Maste wrote: > On IRC the suggestion was made to run buildworld for any header > change, and I think this seems like a reasonable standard. > > Our full buildworld times are admittedly quite long, so if you have a > suitably up-to-date toolchain on the build host you can skip building > toolchain components with something like: > > make -DWITHOUT_TOOLCHAIN -DWITHOUT_CLANG_BOOTSTRAP > -DWITHOUT_LLD_BOOTSTRAP buildworld Hi, Thanks for the tip w.r.t. getting clang out of the buildworld. Maybe this can be written down on some Wikipage . freebsd . org ? The title could be "Who are my dependencies when changing code?", and it should answer the following questions like some kind of flow graph: - Shortcuts for kernel builds. - Shortcuts for user-space builds. - Shortcuts for ports interactions. - When do I only need to build a kernel module. - When do I only need to build a single utility. - When do I do a full kernel build. - When do I do a full user-space build. - When do I do a universe build. - When do I ask ports guys for help. --HPS From owner-svn-src-head@freebsd.org Tue May 29 14:37:49 2018 Return-Path: Delivered-To: svn-src-head@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 BE511FC340E; Tue, 29 May 2018 14:37:49 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 749206E19F; Tue, 29 May 2018 14:37:49 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 516461D3F0; Tue, 29 May 2018 14:37:49 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TEbnAr066807; Tue, 29 May 2018 14:37:49 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TEbnae066806; Tue, 29 May 2018 14:37:49 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201805291437.w4TEbnae066806@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Tue, 29 May 2018 14:37:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334335 - head/sys/dev/usb X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/sys/dev/usb X-SVN-Commit-Revision: 334335 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 14:37:49 -0000 Author: eadler Date: Tue May 29 14:37:48 2018 New Revision: 334335 URL: https://svnweb.freebsd.org/changeset/base/334335 Log: [usbdevs] add AMD vendor ids - also more fully spell the name of ATI for ATI2 Modified: head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue May 29 14:08:06 2018 (r334334) +++ head/sys/dev/usb/usbdevs Tue May 29 14:37:48 2018 (r334335) @@ -507,7 +507,7 @@ vendor HAL 0x0b41 HAL Corporation vendor EMS 0x0b43 EMS Production vendor NEC2 0x0b62 NEC vendor ADLINK 0x0b63 ADLINK Technoligy, Inc. -vendor ATI2 0x0b6f ATI +vendor ATI2 0x0b6f ATI Technologies vendor ZEEVO 0x0b7a Zeevo, Inc. vendor KURUSUGAWA 0x0b7e Kurusugawa Electronics, Inc. vendor SMART 0x0b8c Smart Technologies @@ -579,6 +579,7 @@ vendor MOTOROLA4 0x100d Motorola vendor HP3 0x103c Hewlett Packard vendor AIRPLUS 0x1011 Airplus vendor DESKNOTE 0x1019 Desknote +vendor AMD2 0x1022 Advanced Micro Devices vendor NEC3 0x1033 NEC vendor TTI 0x103e Thurlby Thandar Instruments vendor GIGABYTE 0x1044 GIGABYTE From owner-svn-src-head@freebsd.org Tue May 29 14:40:51 2018 Return-Path: Delivered-To: svn-src-head@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 6A45BFC3742; Tue, 29 May 2018 14:40:51 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1C2636E44F; Tue, 29 May 2018 14:40:51 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F220A1D513; Tue, 29 May 2018 14:40:50 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TEeok5069192; Tue, 29 May 2018 14:40:50 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TEeomO069191; Tue, 29 May 2018 14:40:50 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201805291440.w4TEeomO069191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Tue, 29 May 2018 14:40:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334336 - head/sys/dev/usb X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/sys/dev/usb X-SVN-Commit-Revision: 334336 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 14:40:51 -0000 Author: eadler Date: Tue May 29 14:40:50 2018 New Revision: 334336 URL: https://svnweb.freebsd.org/changeset/base/334336 Log: [usbdevs] add several GENESYS product ids Add USB product ID for two GENESYS LOGIC ICs, found in DELOCK In-Desk-Hub 61991 PR: 228489 Submitted by: "Harald Schmalzbauer" MFC After: 3 weeks Modified: head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue May 29 14:37:48 2018 (r334335) +++ head/sys/dev/usb/usbdevs Tue May 29 14:40:50 2018 (r334336) @@ -2201,9 +2201,12 @@ product GENESYS GL620USB 0x0501 GL620USB Host-Host int product GENESYS GL650 0x0604 GL650 HUB product GENESYS GL606 0x0606 GL606 USB 2.0 HUB product GENESYS GL850G 0x0608 GL850G USB 2.0 HUB +product GENESYS GL3520_2 0x0610 GL3520 4-Port USB 2.0 DataPath +product GENESYS GL3520_SS 0x0616 GL3520 4-Port USB 3.0 DataPath product GENESYS GL641USB 0x0700 GL641USB CompactFlash Card Reader product GENESYS GL641USB2IDE_2 0x0701 GL641USB USB-IDE Bridge No 2 product GENESYS GL641USB2IDE 0x0702 GL641USB USB-IDE Bridge +product GENESYS GL3233 0x0743 GL3233 USB 3.0 AiO Card Reader product GENESYS GL641USB_2 0x0760 GL641USB 6-in-1 Card Reader /* GIGABYTE products */ From owner-svn-src-head@freebsd.org Tue May 29 15:06:14 2018 Return-Path: Delivered-To: svn-src-head@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 3219AEEE902; Tue, 29 May 2018 15:06:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D23EC6F935; Tue, 29 May 2018 15:06:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B06921D8D4; Tue, 29 May 2018 15:06:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TF6DFg082200; Tue, 29 May 2018 15:06:13 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TF6DSK082199; Tue, 29 May 2018 15:06:13 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201805291506.w4TF6DSK082199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 29 May 2018 15:06:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334337 - head/release/amd64 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/release/amd64 X-SVN-Commit-Revision: 334337 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 15:06:14 -0000 Author: emaste Date: Tue May 29 15:06:13 2018 New Revision: 334337 URL: https://svnweb.freebsd.org/changeset/base/334337 Log: switch amd64 memstick installer images to MBR A good number of BIOSes have trouble booting from GPT in non-UEFI mode. This is commonly reported with Lenovo desktops and laptops (including X220, X230, T430, and E31) and Dell systems. Although UEFI is the preferred amd64 boot method on recent hardware, older hardware does not support UEFI, a user may wish to boot via BIOS/CSM, and some systems that support UEFI fail to boot FreeBSD via UEFI (such as an old AMD FX-6100 that I have). With this change amd64 memsticks remain dual-mode (booting from either UEFI or CSM); the partitioning type is just switched from GPT to MBR. The "vestigial swap partition" in the GPT scheme was added in r265017 to work around some issue with loader's GPT support, so we should not need it when using MBR. There is some concern that future UEFI systems may not boot from MBR, but I am not aware of any today. In any case the likely path forward for our installers is to migrate to CD/USB combo images, and if it becomes necessary introduce a separate memstick specifically for the MBR BIOS/CSM case. PR: 227954 Reviewed by: gjb, imp, tsoome MFC after: 3 days Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D15599 Modified: head/release/amd64/make-memstick.sh Modified: head/release/amd64/make-memstick.sh ============================================================================== --- head/release/amd64/make-memstick.sh Tue May 29 14:40:50 2018 (r334336) +++ head/release/amd64/make-memstick.sh Tue May 29 15:06:13 2018 (r334337) @@ -36,12 +36,11 @@ makefs -B little -o label=FreeBSD_Install -o version=2 rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local -mkimg -s gpt \ - -b ${1}/boot/pmbr \ +mkimg -s mbr \ + -b ${1}/boot/mbr \ -p efi:=${1}/boot/boot1.efifat \ - -p freebsd-boot:=${1}/boot/gptboot \ - -p freebsd-ufs:=${2}.part \ - -p freebsd-swap::1M \ + -p freebsd:-"mkimg -s bsd -b ${1}/boot/boot -p freebsd-ufs:=${2}.part" \ + -a 2 \ -o ${2} rm ${2}.part From owner-svn-src-head@freebsd.org Tue May 29 15:29:11 2018 Return-Path: Delivered-To: svn-src-head@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 916D3EEFF34 for ; Tue, 29 May 2018 15:29:11 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x231.google.com (mail-io0-x231.google.com [IPv6:2607:f8b0:4001:c06::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 23C557070F for ; Tue, 29 May 2018 15:29:11 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x231.google.com with SMTP id d73-v6so18065473iog.3 for ; Tue, 29 May 2018 08:29:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=pABj3kJ6EPs7bw0XB4Kn52hs4RLv+NMGPRhZn+pDLaw=; b=wXzSXjEwhXP5EzX3QkTnv9A4QDE1tbW35nazQXGic3TD3EpON87mvCl/ywfviNMCt3 JcCy/V7p4Dk3JKEnpBLUGzSlzO9eMETRB48wY2j6yQ9o1nfs+Tmx6amjJ/ywLMhNOf1O 6DG+NsOGHr27XcTY/pNdLA9S5IohEQ7Gz+LQAn8oVKszGQlyBoW4arspOnwXGMqhZFJs +1cohwiLv29NEX8vU1an2PnadzK+iXTZqJ+Ph2MK2GD6YKdHyYiUTFucfqgwIUBupM82 xev/bSl4A4i1cUuOMOYNGMTgSWMJqWZZGsID10o+2j/Iau6ZZ2QhZ5w5MWbScwEJgJSR U4IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=pABj3kJ6EPs7bw0XB4Kn52hs4RLv+NMGPRhZn+pDLaw=; b=GJCx/do5a1LZfs1AtvxOUdMOU8o0ZaIB6ITe1U50G0qkJelCflKLmcRxtznKVYrwt6 7FuzegjI4C+DOeJlMAdpkiAutaCAR3m6E8CHGcMfqFu9VFrjSPDTpV4z+Y77bInt8Ru8 FAs4VWx8EboKBIQl/CHcD31FBjiAZIBP9ajpmxEqr+vixctWkQl963vhtTsErEdhfYMk 6TcX+h29zdeMLkvs0r/+D4yyAvOqvdS/e3Xd1z0EbjvN6Y8RDOoMecb4JpSrqRIgxmsx MdN+QTWY/ei/+bYjUrzb5a0vrRnmw5mbmRh9XVSr74/RjjCGP0aAPsVLOe5gUT2GSxt/ Yt6g== X-Gm-Message-State: ALKqPwcvyyhbHc1f3epEzaqZ9LEDpJy0NTrt6mjP/ZXqCjau7tQbHuCG vsrIApoWddJ2GzJGwBTkrUlmDs7CwahA5dRkiXPpgA== X-Google-Smtp-Source: ADUXVKJGgkqk5TK3b8NtKvCnpaQnKomXpaPu0kYohXVqqIw04mqJycZRNDMuMy7LRGyJRjsyLOtjTBp/vn0ujjhT6qQ= X-Received: by 2002:a6b:284b:: with SMTP id o72-v6mr6742456ioo.168.1527607750410; Tue, 29 May 2018 08:29:10 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 2002:a4f:d028:0:0:0:0:0 with HTTP; Tue, 29 May 2018 08:29:09 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: References: <201805291302.w4TD2bR5059884@slippy.cwsent.com> <168f4cd3-07d2-15cb-9cf4-a2d02f6dc260@selasky.org> From: Warner Losh Date: Tue, 29 May 2018 09:29:09 -0600 X-Google-Sender-Auth: SgrPwvk-ztLzoyzSm7YW1ISS1Qc Message-ID: Subject: Re: svn commit: r334320 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys i386/include To: Hans Petter Selasky Cc: Ed Maste , Cy Schubert , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 15:29:11 -0000 On Tue, May 29, 2018 at 8:16 AM, Hans Petter Selasky wrote: > On 05/29/18 16:00, Ed Maste wrote: > >> On IRC the suggestion was made to run buildworld for any header >> change, and I think this seems like a reasonable standard. >> >> Our full buildworld times are admittedly quite long, so if you have a >> suitably up-to-date toolchain on the build host you can skip building >> toolchain components with something like: >> >> make -DWITHOUT_TOOLCHAIN -DWITHOUT_CLANG_BOOTSTRAP >> -DWITHOUT_LLD_BOOTSTRAP buildworld >> > > Hi, > > Thanks for the tip w.r.t. getting clang out of the buildworld. > > Maybe this can be written down on some Wikipage . freebsd . org ? > > The title could be "Who are my dependencies when changing code?", and it > should answer the following questions like some kind of flow graph: > > - Shortcuts for kernel builds. > -DNO_CLEAN is the safest. KERNFAST=config will skip some steps when doing iterative development (like config and depend), so it's more dangerous, but often suffices. > - Shortcuts for user-space builds. > For non-major stuff, I do a -DNO_CLEAN build as a sanity check. I hesitate to enshrine too many shortcuts here because we want the buildworld path well tested because that's the path users take. Anything beyond -DNO_CLEAN likely is too risky. > - Shortcuts for ports interactions. > There are no shortcuts here. Only driving fast and taking chances. > - When do I only need to build a kernel module. > When you only changed .c or .s files that are used by the module. Even then, there are some build failure that can happen in the kernel and not the module and vice-versa. > - When do I only need to build a single utility. > Only changed .c files and those .c files aren't used elsewhere in the tree. > - When do I do a full kernel build. > Changing config and/or any .h file. > - When do I do a full user-space build. > Changing any .h file, or altering anything in a library. > - When do I do a universe build. > Any change to any printf :). Any time you change the MI/MD interface in the kernel. Any time you have code that might be architecturally different (this is hard to know) > - When do I ask ports guys for help. Anytime you change the userland API :). The advice in the developer's handbook has grown stale. We should update that. But machines are fast these days, and too many short-cuts has historically caused problems. There's rarely a need to rush things in so fast you can't build the system. I amortize the build times over several changes at once using git svn to curate / manage the changes until they are good. Also, you really should be running the changes you make. Ideally, you'd test boot the whole system, but that's overkill if you fixed a smelling error in ls. Warner From owner-svn-src-head@freebsd.org Tue May 29 15:51:12 2018 Return-Path: Delivered-To: svn-src-head@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 3EB37EF3873; Tue, 29 May 2018 15:51:12 +0000 (UTC) (envelope-from kp@krion.cc) Received: from krion.cc (krion.cc [148.251.235.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF3CE71850; Tue, 29 May 2018 15:51:11 +0000 (UTC) (envelope-from kp@krion.cc) Date: Tue, 29 May 2018 17:51:09 +0200 From: Kirill Ponomarev To: Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334337 - head/release/amd64 Message-ID: <20180529155109.GC43279@krion.cc> References: <201805291506.w4TF6DSK082199@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="z6Eq5LdranGa6ru8" Content-Disposition: inline In-Reply-To: <201805291506.w4TF6DSK082199@repo.freebsd.org> User-Agent: Mutt/1.10.0 (2018-05-17) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 15:51:12 -0000 --z6Eq5LdranGa6ru8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 05/29, Ed Maste wrote: > Author: emaste > Date: Tue May 29 15:06:13 2018 > New Revision: 334337 > URL: https://svnweb.freebsd.org/changeset/base/334337 >=20 > Log: > switch amd64 memstick installer images to MBR > =20 > A good number of BIOSes have trouble booting from GPT in non-UEFI mode. > This is commonly reported with Lenovo desktops and laptops (including > X220, X230, T430, and E31) and Dell systems. Including X1 Carbon 6th Gen. as well. --z6Eq5LdranGa6ru8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEJCHRFhEAQujKni1pDyI9/LMCykUFAlsNdu0ACgkQDyI9/LMC ykUwGQgAj3Np9jShmJy+YJtbZnBtee/cSB6ii2JRp4wVwrvZIx56NraZFotccCiV J7VD1PMUbCjqRzLnIkSZ3qSNKezU3+sl4S+cShWsOkvSEn//uYV/s1MEHFrOdOWb eYUE9SFIEWgcE4qC+obSXrwkXefG0556Y1lqikuyeRTEUnK9acPVE1mFeYYyKxJO X2N9JtxoGerRNfPOHmt3b8XH46q6Bg1WsNmGg2IQuYmaK/g3CprHNDlwL652YQIL JUgBwv7Q/w3EjT69GJR7I8ZBo4yxiMqLdrxWVOa0+kJbCC6WUM0TpDHzBflxVYzB H1hhkR1DUobydIlXLNT0uggk8KLevw== =dZFm -----END PGP SIGNATURE----- --z6Eq5LdranGa6ru8-- From owner-svn-src-head@freebsd.org Tue May 29 16:03:54 2018 Return-Path: Delivered-To: svn-src-head@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 A6D5DEF4D44; Tue, 29 May 2018 16:03:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A0F8723B9; Tue, 29 May 2018 16:03:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B5811E295; Tue, 29 May 2018 16:03:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TG3sfq012425; Tue, 29 May 2018 16:03:54 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TG3s94012424; Tue, 29 May 2018 16:03:54 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201805291603.w4TG3s94012424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 29 May 2018 16:03:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334338 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 334338 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 16:03:54 -0000 Author: avg Date: Tue May 29 16:03:53 2018 New Revision: 334338 URL: https://svnweb.freebsd.org/changeset/base/334338 Log: fix x86 UP build broken by r334204, TSC resynchronization Reported by: bde MFC after: 1 week X-MFC with: r334204 Modified: head/sys/x86/x86/tsc.c Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Tue May 29 15:06:13 2018 (r334337) +++ head/sys/x86/x86/tsc.c Tue May 29 16:03:53 2018 (r334338) @@ -505,19 +505,6 @@ retry: #undef N -#else - -/* - * The function is not called, it is provided to avoid linking failure - * on uniprocessor kernel. - */ -static int -test_tsc(int adj_max_count __unused) -{ - - return (0); -} - #endif /* SMP */ static void @@ -578,9 +565,12 @@ init_TSC_tc(void) * non-zero value. The TSC seems unreliable in virtualized SMP * environments, so it is set to a negative quality in those cases. */ +#ifdef SMP if (mp_ncpus > 1) tsc_timecounter.tc_quality = test_tsc(smp_tsc_adjust); - else if (tsc_is_invariant) + else +#endif /* SMP */ + if (tsc_is_invariant) tsc_timecounter.tc_quality = 1000; max_freq >>= tsc_shift; @@ -618,6 +608,7 @@ SYSINIT(tsc_tc, SI_SUB_SMP, SI_ORDER_ANY, init_TSC_tc, void resume_TSC(void) { +#ifdef SMP int quality; /* If TSC was not good on boot, it is unlikely to become good now. */ @@ -637,6 +628,7 @@ resume_TSC(void) tsc_timecounter.tc_quality, quality); tsc_timecounter.tc_quality = quality; } +#endif /* SMP */ } /* From owner-svn-src-head@freebsd.org Tue May 29 16:04:54 2018 Return-Path: Delivered-To: svn-src-head@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 56ECDEF4EC2; Tue, 29 May 2018 16:04:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0527C7258E; Tue, 29 May 2018 16:04:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA6EA1E297; Tue, 29 May 2018 16:04:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TG4rmQ012510; Tue, 29 May 2018 16:04:53 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TG4rmV012509; Tue, 29 May 2018 16:04:53 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201805291604.w4TG4rmV012509@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 29 May 2018 16:04:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334339 - head/sbin/savecore X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sbin/savecore X-SVN-Commit-Revision: 334339 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 16:04:54 -0000 Author: markj Date: Tue May 29 16:04:53 2018 New Revision: 334339 URL: https://svnweb.freebsd.org/changeset/base/334339 Log: The extension for zstd-compressed files is ".zst". Reported by: manu Modified: head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.c ============================================================================== --- head/sbin/savecore/savecore.c Tue May 29 16:03:53 2018 (r334338) +++ head/sbin/savecore/savecore.c Tue May 29 16:04:53 2018 (r334339) @@ -305,7 +305,7 @@ symlinks_remove(void) (void)unlink("key.last"); (void)unlink("vmcore.last"); (void)unlink("vmcore.last.gz"); - (void)unlink("vmcore.last.zstd"); + (void)unlink("vmcore.last.zst"); (void)unlink("vmcore_encrypted.last"); (void)unlink("vmcore_encrypted.last.gz"); (void)unlink("textdump.tar.last"); From owner-svn-src-head@freebsd.org Tue May 29 16:16:25 2018 Return-Path: Delivered-To: svn-src-head@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 A8EF2EF5C7C; Tue, 29 May 2018 16:16:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 55A0B72DB6; Tue, 29 May 2018 16:16:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 346A11E42A; Tue, 29 May 2018 16:16:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TGGOon017362; Tue, 29 May 2018 16:16:24 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TGGOsa017358; Tue, 29 May 2018 16:16:24 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201805291616.w4TGGOsa017358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 29 May 2018 16:16:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334340 - in head/sys: dev/uart kern sys x86/acpica X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys: dev/uart kern sys x86/acpica X-SVN-Commit-Revision: 334340 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 16:16:25 -0000 Author: avg Date: Tue May 29 16:16:24 2018 New Revision: 334340 URL: https://svnweb.freebsd.org/changeset/base/334340 Log: add support for console resuming, implement it for uart, use on x86 This change adds a new optional console method cn_resume and a kernel console interface cnresume. Consoles that may need to re-initialize their hardware after suspend (e.g., because firmware does not care to do it) will implement cn_resume. Note that it is called in rather early environment not unlike early boot, so the same restrictions apply. Platform specific code, for platforms that support hardware suspend, should call cnresume early after resume, before any console output is expected. This change fixes a problem with a system of mine failing to resume when a serial console is used. I found that the serial port was in a strange configuration and an attempt to write to it likely resulted in an infinite loop. To avoid adding cn_resume method to every console driver, CONSOLE_DRIVER macro has been extended to support optional methods. Reviewed by: imp, mav MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D15552 Modified: head/sys/dev/uart/uart_tty.c head/sys/kern/kern_cons.c head/sys/sys/cons.h head/sys/x86/acpica/acpi_wakeup.c Modified: head/sys/dev/uart/uart_tty.c ============================================================================== --- head/sys/dev/uart/uart_tty.c Tue May 29 16:04:53 2018 (r334339) +++ head/sys/dev/uart/uart_tty.c Tue May 29 16:16:24 2018 (r334340) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); static cn_probe_t uart_cnprobe; static cn_init_t uart_cninit; +static cn_init_t uart_cnresume; static cn_term_t uart_cnterm; static cn_getc_t uart_cngetc; static cn_putc_t uart_cnputc; @@ -69,7 +70,10 @@ static tsw_modem_t uart_tty_modem; static tsw_free_t uart_tty_free; static tsw_busy_t uart_tty_busy; -CONSOLE_DRIVER(uart); +CONSOLE_DRIVER( + uart, + .cn_resume = uart_cnresume, +); static struct uart_devinfo uart_console; @@ -112,6 +116,13 @@ uart_cninit(struct consdev *cp) di->type = UART_DEV_CONSOLE; uart_add_sysdev(di); uart_init(di); +} + +static void +uart_cnresume(struct consdev *cp) +{ + + uart_init(cp->cn_arg); } static void Modified: head/sys/kern/kern_cons.c ============================================================================== --- head/sys/kern/kern_cons.c Tue May 29 16:04:53 2018 (r334339) +++ head/sys/kern/kern_cons.c Tue May 29 16:16:24 2018 (r334340) @@ -384,6 +384,19 @@ cnungrab() } } +void +cnresume() +{ + struct cn_device *cnd; + struct consdev *cn; + + STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) { + cn = cnd->cnd_cn; + if (cn->cn_ops->cn_resume != NULL) + cn->cn_ops->cn_resume(cn); + } +} + /* * Low level console routines. */ Modified: head/sys/sys/cons.h ============================================================================== --- head/sys/sys/cons.h Tue May 29 16:04:53 2018 (r334339) +++ head/sys/sys/cons.h Tue May 29 16:16:24 2018 (r334340) @@ -66,6 +66,8 @@ struct consdev_ops { /* grab console for exclusive kernel use */ cn_ungrab_t *cn_ungrab; /* ungrab console */ + cn_init_t *cn_resume; + /* set up console after sleep, optional */ }; struct consdev { @@ -105,8 +107,9 @@ extern struct tty *constty; /* Temporary virtual conso }; \ DATA_SET(cons_set, name) -#define CONSOLE_DRIVER(name) \ +#define CONSOLE_DRIVER(name, ...) \ static const struct consdev_ops name##_consdev_ops = { \ + /* Mandatory methods. */ \ .cn_probe = name##_cnprobe, \ .cn_init = name##_cninit, \ .cn_term = name##_cnterm, \ @@ -114,6 +117,8 @@ extern struct tty *constty; /* Temporary virtual conso .cn_putc = name##_cnputc, \ .cn_grab = name##_cngrab, \ .cn_ungrab = name##_cnungrab, \ + /* Optional fields. */ \ + __VA_ARGS__ \ }; \ CONSOLE_DEVICE(name##_consdev, name##_consdev_ops, NULL) @@ -126,6 +131,7 @@ void cnremove(struct consdev *); void cnselect(struct consdev *); void cngrab(void); void cnungrab(void); +void cnresume(void); int cncheckc(void); int cngetc(void); void cngets(char *, size_t, int); Modified: head/sys/x86/acpica/acpi_wakeup.c ============================================================================== --- head/sys/x86/acpica/acpi_wakeup.c Tue May 29 16:04:53 2018 (r334339) +++ head/sys/x86/acpica/acpi_wakeup.c Tue May 29 16:16:24 2018 (r334340) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -296,6 +297,12 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) for (;;) ia32_pause(); } else { + /* + * Re-initialize console hardware as soon as possibe. + * No console output (e.g. printf) is allowed before + * this point. + */ + cnresume(); #ifdef __amd64__ fpuresume(susppcbs[0]->sp_fpususpend); #else From owner-svn-src-head@freebsd.org Tue May 29 17:44:41 2018 Return-Path: Delivered-To: svn-src-head@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 6E492EFB266; Tue, 29 May 2018 17:44:41 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 21CDE763C6; Tue, 29 May 2018 17:44:41 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 030031F326; Tue, 29 May 2018 17:44:41 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4THieMY063143; Tue, 29 May 2018 17:44:40 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4THieav063142; Tue, 29 May 2018 17:44:40 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201805291744.w4THieav063142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 29 May 2018 17:44:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334341 - head/sys/dev/fdt X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/fdt X-SVN-Commit-Revision: 334341 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 17:44:41 -0000 Author: andrew Date: Tue May 29 17:44:40 2018 New Revision: 334341 URL: https://svnweb.freebsd.org/changeset/base/334341 Log: Increase the number of fdt memory regions we support to 16. Some SoCs have many excluded regions causing a buffer overflow in the early boot code if this value is too small. Obtained from: ABT Systems Ltd Sponsored by: Turing Robotic Industries Modified: head/sys/dev/fdt/fdt_common.h Modified: head/sys/dev/fdt/fdt_common.h ============================================================================== --- head/sys/dev/fdt/fdt_common.h Tue May 29 16:16:24 2018 (r334340) +++ head/sys/dev/fdt/fdt_common.h Tue May 29 17:44:40 2018 (r334341) @@ -39,7 +39,7 @@ #include #include -#define FDT_MEM_REGIONS 8 +#define FDT_MEM_REGIONS 16 #define DI_MAX_INTR_NUM 32 From owner-svn-src-head@freebsd.org Tue May 29 17:49:04 2018 Return-Path: Delivered-To: svn-src-head@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 EE11CEFB60D; Tue, 29 May 2018 17:49:03 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9B5F77664E; Tue, 29 May 2018 17:49:03 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7AE4A1F328; Tue, 29 May 2018 17:49:03 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4THn34v063351; Tue, 29 May 2018 17:49:03 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4THn3v5063350; Tue, 29 May 2018 17:49:03 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201805291749.w4THn3v5063350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 29 May 2018 17:49:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334342 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 334342 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 17:49:04 -0000 Author: brooks Date: Tue May 29 17:49:03 2018 New Revision: 334342 URL: https://svnweb.freebsd.org/changeset/base/334342 Log: Correct pointer subtraction in KASSERT(). The assertion would never fire without truly spectacular future programming errors. Reported by: Coverity CID: 1391367, 1391368 Sponsored by: DARPA, AFRL Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Tue May 29 17:44:40 2018 (r334341) +++ head/sys/kern/imgact_elf.c Tue May 29 17:49:03 2018 (r334342) @@ -1145,8 +1145,7 @@ __elfN(freebsd_fixup)(register_t **stack_base, struct free(imgp->auxargs, M_TEMP); imgp->auxargs = NULL; - KASSERT((pos - argarray) / sizeof(*pos) <= AT_COUNT, - ("Too many auxargs")); + KASSERT(pos - argarray <= AT_COUNT, ("Too many auxargs")); error = copyout(argarray, auxbase, sizeof(*argarray) * AT_COUNT); free(argarray, M_TEMP); From owner-svn-src-head@freebsd.org Tue May 29 18:03:44 2018 Return-Path: Delivered-To: svn-src-head@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 47857EFC260; Tue, 29 May 2018 18:03:44 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F12347712A; Tue, 29 May 2018 18:03:43 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D293D1F665; Tue, 29 May 2018 18:03:43 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TI3hI9073133; Tue, 29 May 2018 18:03:43 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TI3h6i073132; Tue, 29 May 2018 18:03:43 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805291803.w4TI3h6i073132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Tue, 29 May 2018 18:03:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334343 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 334343 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 18:03:44 -0000 Author: mmacy Date: Tue May 29 18:03:43 2018 New Revision: 334343 URL: https://svnweb.freebsd.org/changeset/base/334343 Log: iflib: hold context lock across detach for drivers that need it Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Tue May 29 17:49:03 2018 (r334342) +++ head/sys/net/iflib.c Tue May 29 18:03:43 2018 (r334343) @@ -4815,8 +4815,6 @@ iflib_device_deregister(if_ctx_t ctx) iflib_netmap_detach(ifp); ether_ifdetach(ifp); - /* ether_ifdetach calls if_qflush - lock must be destroy afterwards*/ - CTX_LOCK_DESTROY(ctx); if (ctx->ifc_led_dev != NULL) led_destroy(ctx->ifc_led_dev); /* XXX drain any dependent tasks */ @@ -4839,8 +4837,12 @@ iflib_device_deregister(if_ctx_t ctx) taskqgroup_detach(tqg, &ctx->ifc_admin_task); if (ctx->ifc_vflr_task.gt_uniq != NULL) taskqgroup_detach(tqg, &ctx->ifc_vflr_task); - + CTX_LOCK(ctx); IFDI_DETACH(ctx); + CTX_UNLOCK(ctx); + + /* ether_ifdetach calls if_qflush - lock must be destroy afterwards*/ + CTX_LOCK_DESTROY(ctx); device_set_softc(ctx->ifc_dev, NULL); if (ctx->ifc_softc_ctx.isc_intr != IFLIB_INTR_LEGACY) { pci_release_msi(dev); From owner-svn-src-head@freebsd.org Tue May 29 18:03:52 2018 Return-Path: Delivered-To: svn-src-head@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 108EBEFC298; Tue, 29 May 2018 18:03:52 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AD58177201; Tue, 29 May 2018 18:03:51 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B91251F666; Tue, 29 May 2018 18:03:49 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TI3n2j073196; Tue, 29 May 2018 18:03:49 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TI3mXd073194; Tue, 29 May 2018 18:03:48 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805291803.w4TI3mXd073194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Tue, 29 May 2018 18:03:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334344 - in head/sys: dev/hwpmc kern sys X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: in head/sys: dev/hwpmc kern sys X-SVN-Commit-Revision: 334344 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 18:03:52 -0000 Author: mmacy Date: Tue May 29 18:03:48 2018 New Revision: 334344 URL: https://svnweb.freebsd.org/changeset/base/334344 Log: hwpmc: don't enter epoch section across mmap hook Modified: head/sys/dev/hwpmc/hwpmc_mod.c head/sys/kern/vfs_vnops.c head/sys/sys/pmckern.h Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Tue May 29 18:03:43 2018 (r334343) +++ head/sys/dev/hwpmc/hwpmc_mod.c Tue May 29 18:03:48 2018 (r334344) @@ -1717,7 +1717,7 @@ pmc_process_mmap(struct thread *td, struct pmckern_map const struct pmc_process *pp; freepath = fullpath = NULL; - epoch_exit_preempt(global_epoch_preempt); + MPASS(!in_epoch()); pmc_getfilename((struct vnode *) pkm->pm_file, &fullpath, &freepath); pid = td->td_proc->p_pid; @@ -1743,6 +1743,7 @@ pmc_process_mmap(struct thread *td, struct pmckern_map done: if (freepath) free(freepath, M_TEMP); + epoch_exit_preempt(global_epoch_preempt); } Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Tue May 29 18:03:43 2018 (r334343) +++ head/sys/kern/vfs_vnops.c Tue May 29 18:03:48 2018 (r334344) @@ -2494,7 +2494,7 @@ vn_mmap(struct file *fp, vm_map_t map, vm_offset_t *ad if ((prot & VM_PROT_EXECUTE) != 0 && error == 0) { pkm.pm_file = vp; pkm.pm_address = (uintptr_t) *addr; - PMC_CALL_HOOK(td, PMC_FN_MMAP, (void *) &pkm); + PMC_CALL_HOOK_UNLOCKED(td, PMC_FN_MMAP, (void *) &pkm); } } #endif Modified: head/sys/sys/pmckern.h ============================================================================== --- head/sys/sys/pmckern.h Tue May 29 18:03:43 2018 (r334343) +++ head/sys/sys/pmckern.h Tue May 29 18:03:48 2018 (r334344) @@ -217,7 +217,8 @@ do { \ */ #define PMC_CALL_HOOK_UNLOCKED(t, cmd, arg) \ do { \ - if (pmc_hook != NULL) \ + MPASS(!in_epoch()); \ + if (pmc_hook != NULL) \ (pmc_hook)((t), (cmd), (arg)); \ } while (0) From owner-svn-src-head@freebsd.org Tue May 29 18:26:13 2018 Return-Path: Delivered-To: svn-src-head@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 A3186EFDB71; Tue, 29 May 2018 18:26:13 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 51B7378630; Tue, 29 May 2018 18:26:13 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33EAA1F9C9; Tue, 29 May 2018 18:26:13 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TIQDbp084159; Tue, 29 May 2018 18:26:13 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TIQD9e084158; Tue, 29 May 2018 18:26:13 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805291826.w4TIQD9e084158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Tue, 29 May 2018 18:26:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334345 - head/lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/lib/libpmc X-SVN-Commit-Revision: 334345 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 18:26:13 -0000 Author: mmacy Date: Tue May 29 18:26:12 2018 New Revision: 334345 URL: https://svnweb.freebsd.org/changeset/base/334345 Log: libpmc: free allocated string on return from pmc_allocate Reported by: Coverity CID: 1391359 Modified: head/lib/libpmc/libpmc.c Modified: head/lib/libpmc/libpmc.c ============================================================================== --- head/lib/libpmc/libpmc.c Tue May 29 18:03:48 2018 (r334344) +++ head/lib/libpmc/libpmc.c Tue May 29 18:26:12 2018 (r334345) @@ -2797,6 +2797,7 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) { if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0) return (errno); + free(spec_copy); *pmcid = pmc_config.pm_pmcid; return (0); } else { From owner-svn-src-head@freebsd.org Tue May 29 18:30:38 2018 Return-Path: Delivered-To: svn-src-head@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 2A20BEFDF7F; Tue, 29 May 2018 18:30:38 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CBD107896B; Tue, 29 May 2018 18:30:37 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACFB01F9D9; Tue, 29 May 2018 18:30:37 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TIUbWi084391; Tue, 29 May 2018 18:30:37 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TIUbDR084390; Tue, 29 May 2018 18:30:37 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805291830.w4TIUbDR084390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Tue, 29 May 2018 18:30:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334346 - head/lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/lib/libpmc X-SVN-Commit-Revision: 334346 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 18:30:38 -0000 Author: mmacy Date: Tue May 29 18:30:37 2018 New Revision: 334346 URL: https://svnweb.freebsd.org/changeset/base/334346 Log: libpmc: remove fixed counter diagnostic Modified: head/lib/libpmc/libpmc_pmu_util.c (contents, props changed) Modified: head/lib/libpmc/libpmc_pmu_util.c ============================================================================== --- head/lib/libpmc/libpmc_pmu_util.c Tue May 29 18:26:12 2018 (r334345) +++ head/lib/libpmc/libpmc_pmu_util.c Tue May 29 18:30:37 2018 (r334346) @@ -315,10 +315,8 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc return (ENOENT); for (idx = 0; fixed_mode_cntrs[idx] != NULL; idx++) - if (strcmp(fixed_mode_cntrs[idx], event_name) == 0) { + if (strcmp(fixed_mode_cntrs[idx], event_name) == 0) isfixed = 1; - printf("%s is fixed\n", event_name); - } if (isfixed) { if (strcasestr(pe->desc, "retired") != NULL) From owner-svn-src-head@freebsd.org Tue May 29 18:36:38 2018 Return-Path: Delivered-To: svn-src-head@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 5D172EFE6DA; Tue, 29 May 2018 18:36:38 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [199.48.133.146]) by mx1.freebsd.org (Postfix) with ESMTP id 0D98078FE4; Tue, 29 May 2018 18:36:37 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from sweettea.beer.town (unknown [76.164.8.130]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 8EA485646B; Tue, 29 May 2018 13:36:36 -0500 (CDT) Subject: Re: svn commit: r334345 - head/lib/libpmc To: Matt Macy , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805291826.w4TIQD9e084158@repo.freebsd.org> From: Eric van Gyzen Openpgp: preference=signencrypt Message-ID: <54dcd815-c6ea-cc8b-df8c-0486b70bfce7@vangyzen.net> Date: Tue, 29 May 2018 13:36:32 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <201805291826.w4TIQD9e084158@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 18:36:38 -0000 On 05/29/2018 13:26, Matt Macy wrote: > if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) { > if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0) > return (errno); ^^^^^^ spec_copy is still leaked here. > + free(spec_copy); > *pmcid = pmc_config.pm_pmcid; > return (0); > } else { > From owner-svn-src-head@freebsd.org Tue May 29 19:07:01 2018 Return-Path: Delivered-To: svn-src-head@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 62F43F6E28C; Tue, 29 May 2018 19:07:01 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 14E5C7A192; Tue, 29 May 2018 19:07:01 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA7D420041; Tue, 29 May 2018 19:07:00 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TJ70pn004417; Tue, 29 May 2018 19:07:00 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TJ70L9004416; Tue, 29 May 2018 19:07:00 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805291907.w4TJ70L9004416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Tue, 29 May 2018 19:07:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334347 - head/lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/lib/libpmc X-SVN-Commit-Revision: 334347 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 19:07:01 -0000 Author: mmacy Date: Tue May 29 19:07:00 2018 New Revision: 334347 URL: https://svnweb.freebsd.org/changeset/base/334347 Log: libpmc: don't leak string in error case either Reported by: vangyzen@ Modified: head/lib/libpmc/libpmc.c Modified: head/lib/libpmc/libpmc.c ============================================================================== --- head/lib/libpmc/libpmc.c Tue May 29 18:30:37 2018 (r334346) +++ head/lib/libpmc/libpmc.c Tue May 29 19:07:00 2018 (r334347) @@ -2795,11 +2795,12 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, r = spec_copy = strdup(ctrspec); ctrname = strsep(&r, ","); if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) { - if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0) - return (errno); - free(spec_copy); + if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0) { + retval = errno; + goto out; + } *pmcid = pmc_config.pm_pmcid; - return (0); + goto out; } else { free(spec_copy); spec_copy = NULL; From owner-svn-src-head@freebsd.org Tue May 29 19:39:14 2018 Return-Path: Delivered-To: svn-src-head@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 71C2FF7062A; Tue, 29 May 2018 19:39:14 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [199.48.133.146]) by mx1.freebsd.org (Postfix) with ESMTP id 1F1FC7B50A; Tue, 29 May 2018 19:39:13 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from sweettea.beer.town (unknown [76.164.8.130]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 3545F5646B; Tue, 29 May 2018 14:39:12 -0500 (CDT) Subject: Re: svn commit: r334347 - head/lib/libpmc To: Matt Macy , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805291907.w4TJ70L9004416@repo.freebsd.org> From: Eric van Gyzen Openpgp: preference=signencrypt Message-ID: <57a10ac9-f190-3bb7-0fec-8d43a8827455@vangyzen.net> Date: Tue, 29 May 2018 14:39:08 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <201805291907.w4TJ70L9004416@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 19:39:14 -0000 On 05/29/2018 14:07, Matt Macy wrote: > if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) { > - if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0) > - return (errno); > - free(spec_copy); > + if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0) { > + retval = errno; > + goto out; > + } > *pmcid = pmc_config.pm_pmcid; > - return (0); > + goto out; This now returns -1 on the successful path. Feel free to start throwing things at me now. ;) Eric From owner-svn-src-head@freebsd.org Tue May 29 20:03:25 2018 Return-Path: Delivered-To: svn-src-head@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 8FED5F71E98; Tue, 29 May 2018 20:03:25 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 44E837C4D9; Tue, 29 May 2018 20:03:25 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25E6D20A16; Tue, 29 May 2018 20:03:25 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TK3PJD034467; Tue, 29 May 2018 20:03:25 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TK3OVv034464; Tue, 29 May 2018 20:03:24 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201805292003.w4TK3OVv034464@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 29 May 2018 20:03:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334348 - in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Commit-Revision: 334348 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 20:03:25 -0000 Author: brooks Date: Tue May 29 20:03:24 2018 New Revision: 334348 URL: https://svnweb.freebsd.org/changeset/base/334348 Log: Correct pointer subtraction in KASSERT(). The assertion would never fire without truly spectacular future programming errors. Reported by: Coverity CID: 1391370 Sponsored by: DARPA, AFRL Modified: head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Tue May 29 19:07:00 2018 (r334347) +++ head/sys/amd64/linux/linux_sysvec.c Tue May 29 20:03:24 2018 (r334348) @@ -283,8 +283,7 @@ linux_fixup_elf(register_t **stack_base, struct image_ AUXARGS_ENTRY(pos, AT_NULL, 0); free(imgp->auxargs, M_TEMP); imgp->auxargs = NULL; - KASSERT((pos - argarray) / sizeof(*pos) <= LINUX_AT_COUNT, - ("Too many auxargs")); + KASSERT(pos - argarray <= LINUX_AT_COUNT, ("Too many auxargs")); error = copyout(argarray, auxbase, sizeof(*argarray) * LINUX_AT_COUNT); free(argarray, M_TEMP); Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Tue May 29 19:07:00 2018 (r334347) +++ head/sys/amd64/linux32/linux32_sysvec.c Tue May 29 20:03:24 2018 (r334348) @@ -249,8 +249,7 @@ linux_fixup_elf(register_t **stack_base, struct image_ free(imgp->auxargs, M_TEMP); imgp->auxargs = NULL; - KASSERT((pos - argarray) / sizeof(*pos) <= AT_COUNT, - ("Too many auxargs")); + KASSERT(pos - argarray <= AT_COUNT, ("Too many auxargs")); error = copyout(&argarray[0], auxbase, sizeof(*argarray) * AT_COUNT); free(argarray, M_TEMP); Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Tue May 29 19:07:00 2018 (r334347) +++ head/sys/i386/linux/linux_sysvec.c Tue May 29 20:03:24 2018 (r334348) @@ -261,8 +261,7 @@ linux_fixup_elf(register_t **stack_base, struct image_ free(imgp->auxargs, M_TEMP); imgp->auxargs = NULL; - KASSERT((pos - argarray) / sizeof(*pos) <= LINUX_AT_COUNT, - ("Too many auxargs")); + KASSERT(pos - argarray <= LINUX_AT_COUNT, ("Too many auxargs")); error = copyout(argarray, auxbase, sizeof(*argarray) * LINUX_AT_COUNT); free(argarray, M_TEMP); From owner-svn-src-head@freebsd.org Tue May 29 20:09:36 2018 Return-Path: Delivered-To: svn-src-head@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 5109DF72484; Tue, 29 May 2018 20:09:36 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 052B57C781; Tue, 29 May 2018 20:09:36 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBBF420A20; Tue, 29 May 2018 20:09:35 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TK9ZMI034723; Tue, 29 May 2018 20:09:35 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TK9Zft034722; Tue, 29 May 2018 20:09:35 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805292009.w4TK9Zft034722@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Tue, 29 May 2018 20:09:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334349 - head/lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/lib/libpmc X-SVN-Commit-Revision: 334349 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 20:09:36 -0000 Author: mmacy Date: Tue May 29 20:09:35 2018 New Revision: 334349 URL: https://svnweb.freebsd.org/changeset/base/334349 Log: libpmc: don't return -1 on success in pmc_allocate Modified: head/lib/libpmc/libpmc.c Modified: head/lib/libpmc/libpmc.c ============================================================================== --- head/lib/libpmc/libpmc.c Tue May 29 20:03:24 2018 (r334348) +++ head/lib/libpmc/libpmc.c Tue May 29 20:09:35 2018 (r334349) @@ -2796,9 +2796,9 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, ctrname = strsep(&r, ","); if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) { if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0) { - retval = errno; goto out; } + retval = 0; *pmcid = pmc_config.pm_pmcid; goto out; } else { From owner-svn-src-head@freebsd.org Tue May 29 20:28:36 2018 Return-Path: Delivered-To: svn-src-head@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 42D76F73791; Tue, 29 May 2018 20:28:36 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E19D27D2E0; Tue, 29 May 2018 20:28:35 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C1A4420D6A; Tue, 29 May 2018 20:28:35 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TKSZAt044624; Tue, 29 May 2018 20:28:35 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TKSYiN044618; Tue, 29 May 2018 20:28:34 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805292028.w4TKSYiN044618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Tue, 29 May 2018 20:28:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334350 - in head/usr.sbin: . pmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: in head/usr.sbin: . pmc X-SVN-Commit-Revision: 334350 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 20:28:36 -0000 Author: mmacy Date: Tue May 29 20:28:34 2018 New Revision: 334350 URL: https://svnweb.freebsd.org/changeset/base/334350 Log: pmc: Add new sub-command structured "pmc" utility This will manage pmc functionality with a more manageable structure of subcommands rather than the gradually accreted spaghetti logic of overlapping flags that exists in pmcstat. This is intended to ultimately have all the same functionality as pmcannotate+pmccontrol+pmcstat. Currently it just has "stat" and "system-stat" - counters for the process itself and counters for the system as a whole respectively (i.e. system-stat includes kernel threads). Note that the rusage results (page faults/context switches/ user/sys) for stat-system will not account for the system as a whole - only for the child process specified on the command line. Implementing stat was suggested by mjg@ and the output is based on that from Linux's "perf stat". % pmc stat -- make -j32 buildkernel -DNO_MODULES -ss > /dev/null 9598393 page faults # 0.674 M/sec 387085 voluntary csw # 0.027 M/sec 106989 involuntary csw # 0.008 M/sec 2763965982317 cycles 2542953049760 instructions # 0.920 inst/cycle 511562750157 branches 12917006881 branch-misses # 2.525% 17944429878 cache-references # 0.007 refs/inst 2205119560 cache-misses # 12.289% 43.74 real # 2019.72% cpu 795.09 user # 1817.72% cpu 88.35 sys # 202.00% cpu % make -j32 buildkernel -DNO_MODULES -ss > /dev/null & % sudo pmc stat-system cat ^C 103 page faults # 0.811 M/sec 4 voluntary csw # 0.031 M/sec 0 involuntary csw # 0.000 M/sec 2843639070514 cycles 2606171217438 instructions # 0.916 inst/cycle 522450422783 branches 13092862839 branch-misses # 2.506% 18592101113 cache-references # 0.007 refs/inst 2562878667 cache-misses # 13.785% 44.85 real # 0.00% cpu 0.00 user # 0.00% cpu 0.00 sys # 0.00% cpu Added: head/usr.sbin/pmc/ head/usr.sbin/pmc/Makefile (contents, props changed) head/usr.sbin/pmc/cmd_pmc.h (contents, props changed) head/usr.sbin/pmc/cmd_pmc_stat.c (contents, props changed) head/usr.sbin/pmc/pmc.c (contents, props changed) head/usr.sbin/pmc/pmc_util.c (contents, props changed) Modified: head/usr.sbin/Makefile Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Tue May 29 20:09:35 2018 (r334349) +++ head/usr.sbin/Makefile Tue May 29 20:28:34 2018 (r334350) @@ -179,6 +179,7 @@ SUBDIR.${MK_OPENSSL}+= keyserv SUBDIR.${MK_PC_SYSINSTALL}+= pc-sysinstall SUBDIR.${MK_PF}+= ftp-proxy SUBDIR.${MK_PKGBOOTSTRAP}+= pkg +SUBDIR.${MK_PMC}+= pmc SUBDIR.${MK_PMC}+= pmcannotate SUBDIR.${MK_PMC}+= pmccontrol SUBDIR.${MK_PMC}+= pmcstat Added: head/usr.sbin/pmc/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pmc/Makefile Tue May 29 20:28:34 2018 (r334350) @@ -0,0 +1,12 @@ +# +# $FreeBSD$ +# + +PROG= pmc +MAN= + +LIBADD= kvm pmc m ncursesw pmcstat elf + +SRCS= pmc.c pmc_util.c cmd_pmc_stat.c + +.include Added: head/usr.sbin/pmc/cmd_pmc.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pmc/cmd_pmc.h Tue May 29 20:28:34 2018 (r334350) @@ -0,0 +1,52 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018, Matthew Macy + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + * + */ +#ifndef _CMD_PMC_H_ +#define _CMD_PMC_H_ + +#define DEFAULT_DISPLAY_HEIGHT 256 /* file virtual height */ +#define DEFAULT_DISPLAY_WIDTH 1024 /* file virtual width */ + +extern int pmc_displayheight; +extern int pmc_displaywidth; +extern int pmc_kq; +extern struct pmcstat_args pmc_args; + +typedef int (*cmd_disp_t)(int, char **); + +int cmd_pmc_stat(int, char **); +int cmd_pmc_stat_system(int, char **); + +int pmc_util_get_pid(struct pmcstat_args *); +void pmc_util_start_pmcs(struct pmcstat_args *); +void pmc_util_cleanup(struct pmcstat_args *); +void pmc_util_shutdown_logging(struct pmcstat_args *args); +void pmc_util_kill_process(struct pmcstat_args *args); + +#endif Added: head/usr.sbin/pmc/cmd_pmc_stat.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pmc/cmd_pmc_stat.c Tue May 29 20:28:34 2018 (r334350) @@ -0,0 +1,478 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018, Matthew Macy + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "cmd_pmc.h" + +/* + * Return the frequency of the kernel's statistics clock. + */ +static int +getstathz(void) +{ + int mib[2]; + size_t size; + struct clockinfo clockrate; + + mib[0] = CTL_KERN; + mib[1] = KERN_CLOCKRATE; + size = sizeof clockrate; + if (sysctl(mib, 2, &clockrate, &size, NULL, 0) == -1) + err(1, "sysctl kern.clockrate"); + return clockrate.stathz; +} + +#define STAT_MODE_NPMCS 6 +static struct timespec before_ts; +#define CYCLES 0 +#define INST 1 +#define BR 2 +#define IAP_START BR +#define BR_MISS 3 +#define CACHE 4 +#define CACHE_MISS 5 +static const char *pmc_stat_mode_names[] = { + "cycles", + "instructions", + "branches", + "branch-misses", + "cache-references", + "cache-misses", +}; + +static int pmcstat_sockpair[NSOCKPAIRFD]; + +static void +usage(void) +{ + errx(EX_USAGE, + "\t get basic stats from command line program\n" + "\t -j , --events comma-delimited list of event specifiers\n" + ); +} + +static void +showtime(FILE *out, struct timespec *before, struct timespec *after, + struct rusage *ru) +{ + char decimal_point; + uint64_t real, user, sys; + + (void)setlocale(LC_NUMERIC, ""); + decimal_point = localeconv()->decimal_point[0]; + + after->tv_sec -= before->tv_sec; + after->tv_nsec -= before->tv_nsec; + if (after->tv_nsec < 0) + after->tv_sec--, after->tv_nsec += 1000000000; + + real = (after->tv_sec * 1000000000 + after->tv_nsec) / 1000; + user = ru->ru_utime.tv_sec * 1000000 + ru->ru_utime.tv_usec; + sys = ru->ru_stime.tv_sec * 1000000 + ru->ru_stime.tv_usec; + fprintf(out, "%13jd%c%02ld real\t\t\t#\t%2.02f%% cpu\n", + (intmax_t)after->tv_sec, decimal_point, + after->tv_nsec / 10000000, 100 * (double)(sys + user + 1) / (double)(real + 1)); + fprintf(out, "%13jd%c%02ld user\t\t\t#\t%2.2f%% cpu\n", + (intmax_t)ru->ru_utime.tv_sec, decimal_point, + ru->ru_utime.tv_usec / 10000, 100 * (double)(user + 1) / (double)(real + 1)); + fprintf(out, "%13jd%c%02ld sys\t\t\t#\t%2.02f%% cpu\n", + (intmax_t)ru->ru_stime.tv_sec, decimal_point, + ru->ru_stime.tv_usec / 10000, 100 * (double)(sys + 1) / (double)(real + 1)); +} + +static const char *stat_mode_cntrs[STAT_MODE_NPMCS]; +static const char *stat_mode_names[STAT_MODE_NPMCS]; + +static void +pmc_stat_setup_stat(int system_mode, const char *arg) +{ + const char *new_cntrs[STAT_MODE_NPMCS]; + static const char **pmc_stat_mode_cntrs; + struct pmcstat_ev *ev; + char *counters, *counter; + int i, c, start, newcnt; + cpuset_t cpumask, rootmask; + + if (cpuset_getaffinity(CPU_LEVEL_ROOT, CPU_WHICH_PID, -1, + sizeof(rootmask), &rootmask) == -1) + err(EX_OSERR, "ERROR: Cannot determine the root set of CPUs"); + CPU_COPY(&rootmask, &cpumask); + + if (pmc_pmu_stat_mode(&pmc_stat_mode_cntrs) != 0) + errx(EX_USAGE, "ERROR: hwmpc.ko not loaded or stat not supported on host."); + if (system_mode && geteuid() != 0) + errx(EX_USAGE, "ERROR: system mode counters can only be used as root"); + counters = NULL; + for (i = 0; i < STAT_MODE_NPMCS; i++) { + stat_mode_cntrs[i] = pmc_stat_mode_cntrs[i]; + stat_mode_names[i] = pmc_stat_mode_names[i]; + } + if (arg) { + counters = strdup(arg); + newcnt = 0; + while ((counter = strsep(&counters, ",")) != NULL && + newcnt < STAT_MODE_NPMCS - IAP_START) { + new_cntrs[newcnt++] = counter; + if (pmc_pmu_sample_rate_get(counter) == DEFAULT_SAMPLE_COUNT) + errx(EX_USAGE, "ERROR: %s not recognized on host", counter); + } + start = IAP_START + STAT_MODE_NPMCS - newcnt; + for (i = 0; i < newcnt; i++) { + stat_mode_cntrs[start + i] = new_cntrs[i]; + stat_mode_names[start + i] = new_cntrs[i]; + } + } + if (system_mode) + pmc_args.pa_flags |= FLAG_HAS_SYSTEM_PMCS; + else + pmc_args.pa_flags |= FLAG_HAS_PROCESS_PMCS; + pmc_args.pa_flags |= FLAG_HAS_COUNTING_PMCS; + pmc_args.pa_flags |= FLAG_HAS_COMMANDLINE | FLAG_HAS_TARGET; + pmc_args.pa_flags |= FLAG_HAS_PIPE; + pmc_args.pa_required |= FLAG_HAS_COMMANDLINE | FLAG_HAS_TARGET | FLAG_HAS_OUTPUT_LOGFILE; + pmc_args.pa_outputpath = strdup("/dev/null"); + pmc_args.pa_logfd = pmcstat_open_log(pmc_args.pa_outputpath, + PMCSTAT_OPEN_FOR_WRITE); + for (i = 0; i < STAT_MODE_NPMCS; i++) { + if ((ev = malloc(sizeof(*ev))) == NULL) + errx(EX_SOFTWARE, "ERROR: Out of memory."); + if (system_mode) + ev->ev_mode = PMC_MODE_SC; + else + ev->ev_mode = PMC_MODE_TC; + ev->ev_spec = strdup(stat_mode_cntrs[i]); + if (ev->ev_spec == NULL) + errx(EX_SOFTWARE, "ERROR: Out of memory."); + c = strcspn(strdup(stat_mode_cntrs[i]), ", \t"); + ev->ev_name = malloc(c + 1); + if (ev->ev_name == NULL) + errx(EX_SOFTWARE, "ERROR: Out of memory."); + (void)strncpy(ev->ev_name, stat_mode_cntrs[i], c); + *(ev->ev_name + c) = '\0'; + + ev->ev_count = -1; + ev->ev_flags = 0; + ev->ev_flags |= PMC_F_DESCENDANTS; + ev->ev_cumulative = 1; + + ev->ev_saved = 0LL; + ev->ev_pmcid = PMC_ID_INVALID; + STAILQ_INSERT_TAIL(&pmc_args.pa_events, ev, ev_next); + if (system_mode) { + ev->ev_cpu = CPU_FFS(&cpumask) - 1; + CPU_CLR(ev->ev_cpu, &cpumask); + pmcstat_clone_event_descriptor(ev, &cpumask, &pmc_args); + CPU_SET(ev->ev_cpu, &cpumask); + } else + ev->ev_cpu = PMC_CPU_ANY; + + } + if (clock_gettime(CLOCK_MONOTONIC, &before_ts)) + err(1, "clock_gettime"); +} + +static void +pmc_stat_print_stat(struct rusage *ru) +{ + struct pmcstat_ev *ev; + struct timespec after; + uint64_t cvals[STAT_MODE_NPMCS]; + uint64_t ticks, value; + int hz, i; + + hz = getstathz(); + ticks = hz * (ru->ru_utime.tv_sec + ru->ru_stime.tv_sec) + + hz * (ru->ru_utime.tv_usec + ru->ru_stime.tv_usec) / 1000000; + if (clock_gettime(CLOCK_MONOTONIC, &after)) + err(1, "clock_gettime"); + bzero(&cvals, sizeof(cvals)); + STAILQ_FOREACH(ev, &pmc_args.pa_events, ev_next) { + if (pmc_read(ev->ev_pmcid, &value) < 0) + err(EX_OSERR, "ERROR: Cannot read pmc \"%s\"", + ev->ev_name); + for (i = 0; i < STAT_MODE_NPMCS; i++) + if (strcmp(ev->ev_name, stat_mode_cntrs[i]) == 0) + cvals[i] += value; + } + + /* + * If our round-off on the tick calculation still puts us at 0, + * then always assume at least one tick. + */ + if (ticks == 0) + ticks = 1; + fprintf(pmc_args.pa_printfile, "%16ld %s\t\t#\t%02.03f M/sec\n", + ru->ru_minflt, "page faults", ((double)ru->ru_minflt / (double)ticks) / hz); + fprintf(pmc_args.pa_printfile, "%16ld %s\t\t#\t%02.03f M/sec\n", + ru->ru_nvcsw, "voluntary csw", ((double)ru->ru_nvcsw / (double)ticks) / hz); + fprintf(pmc_args.pa_printfile, "%16ld %s\t#\t%02.03f M/sec\n", + ru->ru_nivcsw, "involuntary csw", ((double)ru->ru_nivcsw / (double)ticks) / hz); + + fprintf(pmc_args.pa_printfile, "%16ld %s\n", cvals[CYCLES], stat_mode_names[CYCLES]); + fprintf(pmc_args.pa_printfile, "%16ld %s\t\t#\t%01.03f inst/cycle\n", cvals[INST], stat_mode_names[INST], + (double)cvals[INST] / cvals[CYCLES]); + fprintf(pmc_args.pa_printfile, "%16ld %s\n", cvals[BR], stat_mode_names[BR]); + if (stat_mode_names[BR_MISS] == pmc_stat_mode_names[BR_MISS]) + fprintf(pmc_args.pa_printfile, "%16ld %s\t\t#\t%.03f%%\n", + cvals[BR_MISS], stat_mode_names[BR_MISS], + 100 * ((double)cvals[BR_MISS] / cvals[BR])); + else + fprintf(pmc_args.pa_printfile, "%16ld %s\n", + cvals[BR_MISS], stat_mode_names[BR_MISS]); + fprintf(pmc_args.pa_printfile, "%16ld %s%s", cvals[CACHE], stat_mode_names[CACHE], + stat_mode_names[CACHE] != pmc_stat_mode_names[CACHE] ? "\n" : ""); + if (stat_mode_names[CACHE] == pmc_stat_mode_names[CACHE]) + fprintf(pmc_args.pa_printfile, "\t#\t%.03f refs/inst\n", + ((double)cvals[CACHE] / cvals[INST])); + fprintf(pmc_args.pa_printfile, "%16ld %s%s", cvals[CACHE_MISS], stat_mode_names[CACHE_MISS], + stat_mode_names[CACHE_MISS] != pmc_stat_mode_names[CACHE_MISS] ? "\n" : ""); + if (stat_mode_names[CACHE_MISS] == pmc_stat_mode_names[CACHE_MISS]) + fprintf(pmc_args.pa_printfile, "\t\t#\t%.03f%%\n", + 100 * ((double)cvals[CACHE_MISS] / cvals[CACHE])); + + + showtime(pmc_args.pa_printfile, &before_ts, &after, ru); +} + + +static struct option longopts[] = { + {"events", required_argument, NULL, 'j'}, + {NULL, 0, NULL, 0} +}; + +static int +pmc_stat_internal(int argc, char **argv, int system_mode) +{ + const char *event; + struct sigaction sa; + struct kevent kev; + struct rusage ru; + struct winsize ws; + struct pmcstat_ev *ev; + int c, option, runstate, do_print, do_read; + int waitstatus, ru_valid; + + ru_valid = do_print = do_read = 0; + event = NULL; + while ((option = getopt_long(argc, argv, "j:", longopts, NULL)) != -1) { + switch (option) { + case 'j': + event = strdup(optarg); + break; + case '?': + default: + usage(); + } + } + pmc_args.pa_argc = (argc -= optind); + pmc_args.pa_argv = (argv += optind); + if (argc == 0) + usage(); + pmc_args.pa_flags |= FLAG_HAS_COMMANDLINE; + pmc_stat_setup_stat(system_mode, event); + + EV_SET(&kev, SIGINT, EVFILT_SIGNAL, EV_ADD, 0, 0, NULL); + if (kevent(pmc_kq, &kev, 1, NULL, 0, NULL) < 0) + err(EX_OSERR, "ERROR: Cannot register kevent for SIGINT"); + + EV_SET(&kev, SIGIO, EVFILT_SIGNAL, EV_ADD, 0, 0, NULL); + if (kevent(pmc_kq, &kev, 1, NULL, 0, NULL) < 0) + err(EX_OSERR, "ERROR: Cannot register kevent for SIGIO"); + + STAILQ_FOREACH(ev, &pmc_args.pa_events, ev_next) { + if (pmc_allocate(ev->ev_spec, ev->ev_mode, + ev->ev_flags, ev->ev_cpu, &ev->ev_pmcid) < 0) + err(EX_OSERR, + "ERROR: Cannot allocate %s-mode pmc with specification \"%s\"", + PMC_IS_SYSTEM_MODE(ev->ev_mode) ? + "system" : "process", ev->ev_spec); + + if (PMC_IS_SAMPLING_MODE(ev->ev_mode) && + pmc_set(ev->ev_pmcid, ev->ev_count) < 0) + err(EX_OSERR, + "ERROR: Cannot set sampling count for PMC \"%s\"", + ev->ev_name); + } + + /* + * An exec() failure of a forked child is signalled by the + * child sending the parent a SIGCHLD. We don't register an + * actual signal handler for SIGCHLD, but instead use our + * kqueue to pick up the signal. + */ + EV_SET(&kev, SIGCHLD, EVFILT_SIGNAL, EV_ADD, 0, 0, NULL); + if (kevent(pmc_kq, &kev, 1, NULL, 0, NULL) < 0) + err(EX_OSERR, "ERROR: Cannot register kevent for SIGCHLD"); + + pmcstat_create_process(pmcstat_sockpair, &pmc_args, pmc_kq); + + if (SLIST_EMPTY(&pmc_args.pa_targets)) + errx(EX_DATAERR, + "ERROR: No matching target processes."); + if (pmc_args.pa_flags & FLAG_HAS_PROCESS_PMCS) + pmcstat_attach_pmcs(&pmc_args); + + /* start the pmcs */ + pmc_util_start_pmcs(&pmc_args); + + /* start the (commandline) process if needed */ + pmcstat_start_process(pmcstat_sockpair); + + /* Handle SIGINT using the kqueue loop */ + sa.sa_handler = SIG_IGN; + sa.sa_flags = 0; + (void)sigemptyset(&sa.sa_mask); + + if (sigaction(SIGINT, &sa, NULL) < 0) + err(EX_OSERR, "ERROR: Cannot install signal handler"); + + /* + * loop till either the target process (if any) exits, or we + * are killed by a SIGINT or we reached the time duration. + */ + runstate = PMCSTAT_RUNNING; + do_print = do_read = 0; + do { + if ((c = kevent(pmc_kq, NULL, 0, &kev, 1, NULL)) <= 0) { + if (errno != EINTR) + err(EX_OSERR, "ERROR: kevent failed"); + else + continue; + } + if (kev.flags & EV_ERROR) + errc(EX_OSERR, kev.data, "ERROR: kevent failed"); + + switch (kev.filter) { + case EVFILT_PROC: /* target has exited */ + if (wait4(pmc_util_get_pid(&pmc_args), &waitstatus, 0, &ru) > 0) { + getrusage(RUSAGE_CHILDREN, &ru); + ru_valid = 1; + } + do_print = 1; + break; + + case EVFILT_READ: /* log file data is present */ + do_read = 0; + break; + + case EVFILT_SIGNAL: + if (kev.ident == SIGCHLD) { + /* + * The child process sends us a + * SIGCHLD if its exec() failed. We + * wait for it to exit and then exit + * ourselves. + */ + (void)wait(&c); + runstate = PMCSTAT_FINISHED; + } else if (kev.ident == SIGIO) { + /* + * We get a SIGIO if a PMC loses all + * of its targets, or if logfile + * writes encounter an error. + */ + if (wait4(pmc_util_get_pid(&pmc_args), &waitstatus, 0, &ru) > 0) { + getrusage(RUSAGE_CHILDREN, &ru); + ru_valid = 1; + } + runstate = pmcstat_close_log(&pmc_args); + do_print = 1; /* print PMCs at exit */ + } else if (kev.ident == SIGINT) { + /* Kill the child process if we started it */ + if (pmc_args.pa_flags & FLAG_HAS_COMMANDLINE) + pmc_util_kill_process(&pmc_args); + runstate = pmcstat_close_log(&pmc_args); + } else if (kev.ident == SIGWINCH) { + if (ioctl(fileno(pmc_args.pa_printfile), + TIOCGWINSZ, &ws) < 0) + err(EX_OSERR, + "ERROR: Cannot determine window size"); + pmc_displayheight = ws.ws_row - 1; + pmc_displaywidth = ws.ws_col - 1; + } else + assert(0); + + break; + } + } while (runstate != PMCSTAT_FINISHED); + if (!ru_valid) + warnx("couldn't get rusage"); + pmc_stat_print_stat(&ru); + pmc_util_cleanup(&pmc_args); + return (0); +} + +int +cmd_pmc_stat(int argc, char **argv) +{ + return (pmc_stat_internal(argc, argv, 0)); +} + +int +cmd_pmc_stat_system(int argc, char **argv) +{ + return (pmc_stat_internal(argc, argv, 1)); +} Added: head/usr.sbin/pmc/pmc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pmc/pmc.c Tue May 29 20:28:34 2018 (r334350) @@ -0,0 +1,114 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018, Matthew Macy + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "cmd_pmc.h" + +int pmc_displayheight = DEFAULT_DISPLAY_HEIGHT; +int pmc_displaywidth = DEFAULT_DISPLAY_WIDTH; +int pmc_kq; +struct pmcstat_args pmc_args; + +struct pmcstat_pmcs pmcstat_pmcs = LIST_HEAD_INITIALIZER(pmcstat_pmcs); + +struct pmcstat_image_hash_list pmcstat_image_hash[PMCSTAT_NHASH]; + +struct pmcstat_process_hash_list pmcstat_process_hash[PMCSTAT_NHASH]; + +struct cmd_handler { + const char *ch_name; + cmd_disp_t ch_fn; +}; + +static struct cmd_handler disp_table[] = { + {"stat", cmd_pmc_stat}, + {"stat-system", cmd_pmc_stat_system}, + {NULL, NULL} +}; + +static void +usage(void) +{ + errx(EX_USAGE, + "\t pmc management utility\n" + "\t stat run program and print stats\n" + "\t stat-system run program and print system wide stats for duration of execution\n" + ); +} + +static cmd_disp_t +disp_lookup(char *name) +{ + struct cmd_handler *hnd; + + for (hnd = disp_table; hnd->ch_name != NULL; hnd++) + if (strcmp(hnd->ch_name, name) == 0) + return (hnd->ch_fn); + return (NULL); +} + +int +main(int argc, char **argv) +{ + cmd_disp_t disp; + + pmc_args.pa_printfile = stderr; + STAILQ_INIT(&pmc_args.pa_events); + SLIST_INIT(&pmc_args.pa_targets); + if (argc == 1) + usage(); + if ((disp = disp_lookup(argv[1])) == NULL) + usage(); + argc--; + argv++; + + /* Allocate a kqueue */ + if ((pmc_kq = kqueue()) < 0) + err(EX_OSERR, "ERROR: Cannot allocate kqueue"); + if (pmc_init() < 0) + err(EX_UNAVAILABLE, + "ERROR: Initialization of the pmc(3) library failed" + ); + return (disp(argc, argv)); +} Added: head/usr.sbin/pmc/pmc_util.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pmc/pmc_util.c Tue May 29 20:28:34 2018 (r334350) @@ -0,0 +1,169 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2003-2008, Joseph Koshy + * Copyright (c) 2007 The FreeBSD Foundation + * All rights reserved. + * Copyright (c) 2018, Matthew Macy + * + * Portions of this software were developed by A. Joseph Koshy under + * sponsorship from the FreeBSD Foundation and Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "cmd_pmc.h" + +static struct pmcstat_stats pmcstat_stats; /* statistics */ + +static struct pmc_plugins plugins[] = { + { + .pl_name = "none", + }, + { + .pl_name = NULL + } +}; + +int +pmc_util_get_pid(struct pmcstat_args *args) +{ + struct pmcstat_target *pt; + + assert(args->pa_flags & FLAG_HAS_COMMANDLINE); + + /* + * If a command line was specified, it would be the very first + * in the list, before any other processes specified by -t. + */ + pt = SLIST_FIRST(&args->pa_targets); + return (pt->pt_pid); +} + +void +pmc_util_kill_process(struct pmcstat_args *args) +{ + struct pmcstat_target *pt; + + assert(args->pa_flags & FLAG_HAS_COMMANDLINE); + + /* + * If a command line was specified, it would be the very first + * in the list, before any other processes specified by -t. + */ + pt = SLIST_FIRST(&args->pa_targets); + assert(pt != NULL); + + if (kill(pt->pt_pid, SIGINT) != 0) + err(EX_OSERR, "ERROR: cannot signal child process"); +} + +void +pmc_util_shutdown_logging(struct pmcstat_args *args) +{ + pmcstat_shutdown_logging(args, plugins, &pmcstat_stats); +} + +void +pmc_util_cleanup(struct pmcstat_args *args) +{ + struct pmcstat_ev *ev; + + /* release allocated PMCs. */ + STAILQ_FOREACH(ev, &args->pa_events, ev_next) + if (ev->ev_pmcid != PMC_ID_INVALID) { + if (pmc_stop(ev->ev_pmcid) < 0) + err(EX_OSERR, + "ERROR: cannot stop pmc 0x%x \"%s\"", + ev->ev_pmcid, ev->ev_name); + if (pmc_release(ev->ev_pmcid) < 0) + err(EX_OSERR, + "ERROR: cannot release pmc 0x%x \"%s\"", + ev->ev_pmcid, ev->ev_name); + } + /* de-configure the log file if present. */ + if (args->pa_flags & (FLAG_HAS_PIPE | FLAG_HAS_OUTPUT_LOGFILE)) + (void)pmc_configure_logfile(-1); + + if (args->pa_logparser) { + pmclog_close(args->pa_logparser); + args->pa_logparser = NULL; + } + pmc_util_shutdown_logging(args); +} + +void +pmc_util_start_pmcs(struct pmcstat_args *args) +{ + struct pmcstat_ev *ev; + + STAILQ_FOREACH(ev, &args->pa_events, ev_next) { + + assert(ev->ev_pmcid != PMC_ID_INVALID); + + if (pmc_start(ev->ev_pmcid) < 0) { + warn("ERROR: Cannot start pmc 0x%x \"%s\"", + ev->ev_pmcid, ev->ev_name); + pmc_util_cleanup(args); + exit(EX_OSERR); + } + } +} From owner-svn-src-head@freebsd.org Tue May 29 20:30:47 2018 Return-Path: Delivered-To: svn-src-head@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 6A920F73A64; Tue, 29 May 2018 20:30:47 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 17F147D4A2; Tue, 29 May 2018 20:30:47 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED2D920D7F; Tue, 29 May 2018 20:30:46 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TKUkLw047173; Tue, 29 May 2018 20:30:46 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TKUkBw047172; Tue, 29 May 2018 20:30:46 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201805292030.w4TKUkBw047172@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Tue, 29 May 2018 20:30:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334351 - head/lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/lib/libpmc X-SVN-Commit-Revision: 334351 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 20:30:47 -0000 Author: vangyzen Date: Tue May 29 20:30:46 2018 New Revision: 334351 URL: https://svnweb.freebsd.org/changeset/base/334351 Log: pmc_annotate: adhere to the API If the 'mode' parameter was invalid, pmc_annotate() would return EINVAL instead of setting errno and returning -1. Sponsored by: Dell EMC Modified: head/lib/libpmc/libpmc.c Modified: head/lib/libpmc/libpmc.c ============================================================================== --- head/lib/libpmc/libpmc.c Tue May 29 20:28:34 2018 (r334350) +++ head/lib/libpmc/libpmc.c Tue May 29 20:30:46 2018 (r334351) @@ -2781,7 +2781,8 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, if (mode != PMC_MODE_SS && mode != PMC_MODE_TS && mode != PMC_MODE_SC && mode != PMC_MODE_TC) { - return (EINVAL); + errno = EINVAL; + goto out; } bzero(&pmc_config, sizeof(pmc_config)); pmc_config.pm_cpu = cpu; From owner-svn-src-head@freebsd.org Tue May 29 21:02:09 2018 Return-Path: Delivered-To: svn-src-head@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 61325F75C4C; Tue, 29 May 2018 21:02:09 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0DDA57ECF0; Tue, 29 May 2018 21:02:09 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E2E60213E0; Tue, 29 May 2018 21:02:08 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TL28b9063946; Tue, 29 May 2018 21:02:08 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TL28se063945; Tue, 29 May 2018 21:02:08 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805292102.w4TL28se063945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Tue, 29 May 2018 21:02:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334353 - head/usr.sbin/pmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/usr.sbin/pmc X-SVN-Commit-Revision: 334353 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 21:02:09 -0000 Author: mmacy Date: Tue May 29 21:02:08 2018 New Revision: 334353 URL: https://svnweb.freebsd.org/changeset/base/334353 Log: pmc: silence scan-build warnings Modified: head/usr.sbin/pmc/cmd_pmc_stat.c (contents, props changed) Modified: head/usr.sbin/pmc/cmd_pmc_stat.c ============================================================================== --- head/usr.sbin/pmc/cmd_pmc_stat.c Tue May 29 20:39:54 2018 (r334352) +++ head/usr.sbin/pmc/cmd_pmc_stat.c Tue May 29 21:02:08 2018 (r334353) @@ -306,21 +306,21 @@ static struct option longopts[] = { static int pmc_stat_internal(int argc, char **argv, int system_mode) { - const char *event; + char *event, *r; struct sigaction sa; struct kevent kev; struct rusage ru; struct winsize ws; struct pmcstat_ev *ev; - int c, option, runstate, do_print, do_read; + int c, option, runstate; int waitstatus, ru_valid; - ru_valid = do_print = do_read = 0; - event = NULL; + ru_valid = 0; + r = event = NULL; while ((option = getopt_long(argc, argv, "j:", longopts, NULL)) != -1) { switch (option) { case 'j': - event = strdup(optarg); + r = event = strdup(optarg); break; case '?': default: @@ -333,7 +333,8 @@ pmc_stat_internal(int argc, char **argv, int system_mo usage(); pmc_args.pa_flags |= FLAG_HAS_COMMANDLINE; pmc_stat_setup_stat(system_mode, event); - + free(r); + bzero(&ru, sizeof(ru)); EV_SET(&kev, SIGINT, EVFILT_SIGNAL, EV_ADD, 0, 0, NULL); if (kevent(pmc_kq, &kev, 1, NULL, 0, NULL) < 0) err(EX_OSERR, "ERROR: Cannot register kevent for SIGINT"); @@ -394,7 +395,6 @@ pmc_stat_internal(int argc, char **argv, int system_mo * are killed by a SIGINT or we reached the time duration. */ runstate = PMCSTAT_RUNNING; - do_print = do_read = 0; do { if ((c = kevent(pmc_kq, NULL, 0, &kev, 1, NULL)) <= 0) { if (errno != EINTR) @@ -411,11 +411,9 @@ pmc_stat_internal(int argc, char **argv, int system_mo getrusage(RUSAGE_CHILDREN, &ru); ru_valid = 1; } - do_print = 1; break; case EVFILT_READ: /* log file data is present */ - do_read = 0; break; case EVFILT_SIGNAL: @@ -439,7 +437,6 @@ pmc_stat_internal(int argc, char **argv, int system_mo ru_valid = 1; } runstate = pmcstat_close_log(&pmc_args); - do_print = 1; /* print PMCs at exit */ } else if (kev.ident == SIGINT) { /* Kill the child process if we started it */ if (pmc_args.pa_flags & FLAG_HAS_COMMANDLINE) From owner-svn-src-head@freebsd.org Tue May 29 21:02:16 2018 Return-Path: Delivered-To: svn-src-head@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 A5653F75C83; Tue, 29 May 2018 21:02:16 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BC0EA7EDA0; Tue, 29 May 2018 21:02:15 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74C26213E9; Tue, 29 May 2018 21:02:14 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TL2ETI064001; Tue, 29 May 2018 21:02:14 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TL2Dpr063999; Tue, 29 May 2018 21:02:13 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805292102.w4TL2Dpr063999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Tue, 29 May 2018 21:02:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334354 - head/lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/lib/libpmc X-SVN-Commit-Revision: 334354 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 21:02:16 -0000 Author: mmacy Date: Tue May 29 21:02:13 2018 New Revision: 334354 URL: https://svnweb.freebsd.org/changeset/base/334354 Log: libpmc: silence scan-build warnings Modified: head/lib/libpmc/libpmc_pmu_util.c (contents, props changed) head/lib/libpmc/pmclog.c Modified: head/lib/libpmc/libpmc_pmu_util.c ============================================================================== --- head/lib/libpmc/libpmc_pmu_util.c Tue May 29 21:02:08 2018 (r334353) +++ head/lib/libpmc/libpmc_pmu_util.c Tue May 29 21:02:13 2018 (r334354) @@ -156,11 +156,12 @@ static int pmu_parse_event(struct pmu_event_desc *ped, const char *eventin) { char *event; - char *kvp, *key, *value; + char *kvp, *key, *value, *r; char *debug; if ((event = strdup(eventin)) == NULL) return (ENOMEM); + r = event; bzero(ped, sizeof(*ped)); while ((kvp = strsep(&event, ",")) != NULL) { key = strsep(&kvp, "="); @@ -199,7 +200,7 @@ pmu_parse_event(struct pmu_event_desc *ped, const char printf("unrecognized kvpair: %s:%s\n", key, value); } } - free(event); + free(r); return (0); } Modified: head/lib/libpmc/pmclog.c ============================================================================== --- head/lib/libpmc/pmclog.c Tue May 29 21:02:08 2018 (r334353) +++ head/lib/libpmc/pmclog.c Tue May 29 21:02:13 2018 (r334354) @@ -136,7 +136,7 @@ pmclog_get_record(struct pmclog_parse_state *ps, char return (ps->ps_state = PL_STATE_ERROR); src = *data; - h = used = 0; + used = 0; if (ps->ps_state == PL_STATE_NEW_RECORD) ps->ps_svcount = 0; From owner-svn-src-head@freebsd.org Tue May 29 21:45:16 2018 Return-Path: Delivered-To: svn-src-head@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 AE182F787FE; Tue, 29 May 2018 21:45:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 59C2A809D2; Tue, 29 May 2018 21:45:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A0BF21AD5; Tue, 29 May 2018 21:45:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TLjGmY085165; Tue, 29 May 2018 21:45:16 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TLjGi6085164; Tue, 29 May 2018 21:45:16 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201805292145.w4TLjGi6085164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 29 May 2018 21:45:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334356 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 334356 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 21:45:16 -0000 Author: glebius Date: Tue May 29 21:45:15 2018 New Revision: 334356 URL: https://svnweb.freebsd.org/changeset/base/334356 Log: Revert second chunk of r333860. The warning from gcc is false positive. The npages won't be ever used in no space case. Modified: head/sys/kern/kern_sendfile.c Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Tue May 29 21:37:02 2018 (r334355) +++ head/sys/kern/kern_sendfile.c Tue May 29 21:45:15 2018 (r334356) @@ -688,7 +688,6 @@ retry_space: if (space == 0) { sfio = NULL; nios = 0; - npages = 0; goto prepend_header; } hdr_uio = NULL; From owner-svn-src-head@freebsd.org Tue May 29 21:52:14 2018 Return-Path: Delivered-To: svn-src-head@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 B7954F79062; Tue, 29 May 2018 21:52:14 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6D39D80F3A; Tue, 29 May 2018 21:52:14 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F13A21C57; Tue, 29 May 2018 21:52:14 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TLqEfl087661; Tue, 29 May 2018 21:52:14 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TLqEAu087660; Tue, 29 May 2018 21:52:14 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201805292152.w4TLqEAu087660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 29 May 2018 21:52:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334357 - head/sbin/dumpon X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sbin/dumpon X-SVN-Commit-Revision: 334357 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 21:52:14 -0000 Author: sbruno Date: Tue May 29 21:52:13 2018 New Revision: 334357 URL: https://svnweb.freebsd.org/changeset/base/334357 Log: dumpon(8) - fix the WITHOUT_CRYPTO buildworld case. Its rare, but some of us do build this way. Sponsored by: Limelight Networks Modified: head/sbin/dumpon/dumpon.c Modified: head/sbin/dumpon/dumpon.c ============================================================================== --- head/sbin/dumpon/dumpon.c Tue May 29 21:45:15 2018 (r334356) +++ head/sbin/dumpon/dumpon.c Tue May 29 21:52:13 2018 (r334357) @@ -393,7 +393,8 @@ main(int argc, char *argv[]) #ifndef HAVE_CRYPTO if (pubkeyfile != NULL) - errx("Unable to use the public key. Recompile dumpon with OpenSSL support."); + errx(EX_UNAVAILABLE,"Unable to use the public key." + " Recompile dumpon with OpenSSL support."); #endif if (server != NULL && client != NULL) { From owner-svn-src-head@freebsd.org Tue May 29 21:56:41 2018 Return-Path: Delivered-To: svn-src-head@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 05458F7957E; Tue, 29 May 2018 21:56:41 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A4FBD8129D; Tue, 29 May 2018 21:56:40 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84D2921C7A; Tue, 29 May 2018 21:56:40 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TLuekk090098; Tue, 29 May 2018 21:56:40 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TLudQg090092; Tue, 29 May 2018 21:56:39 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201805292156.w4TLudQg090092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Tue, 29 May 2018 21:56:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334358 - in head/sys: kern net sys X-SVN-Group: head X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: in head/sys: kern net sys X-SVN-Commit-Revision: 334358 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 21:56:41 -0000 Author: shurd Date: Tue May 29 21:56:39 2018 New Revision: 334358 URL: https://svnweb.freebsd.org/changeset/base/334358 Log: iflib: mark irq allocation name parameter as constant The *name parameter passed to iflib_irq_alloc_generic and iflib_softirq_alloc_generic is never modified. Many places in code pass string literals and thus should not be modified. Mark the *name parameter as a const char * instead, so that we enforce that the name is not modified before passing to bus_describe_intr() Submitted by: Jacob Keller Reviewed by: kmacy Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D15343 Modified: head/sys/kern/subr_gtaskqueue.c head/sys/net/iflib.c head/sys/net/iflib.h head/sys/sys/gtaskqueue.h Modified: head/sys/kern/subr_gtaskqueue.c ============================================================================== --- head/sys/kern/subr_gtaskqueue.c Tue May 29 21:52:13 2018 (r334357) +++ head/sys/kern/subr_gtaskqueue.c Tue May 29 21:56:39 2018 (r334358) @@ -561,7 +561,7 @@ struct taskqgroup_cpu { struct taskqgroup { struct taskqgroup_cpu tqg_queue[MAXCPU]; struct mtx tqg_lock; - char * tqg_name; + const char * tqg_name; int tqg_adjusting; int tqg_stride; int tqg_cnt; @@ -720,7 +720,7 @@ taskqgroup_attach_deferred(struct taskqgroup *qgroup, int taskqgroup_attach_cpu(struct taskqgroup *qgroup, struct grouptask *gtask, - void *uniq, int cpu, int irq, char *name) + void *uniq, int cpu, int irq, const char *name) { cpuset_t mask; int i, qid, error; @@ -961,7 +961,7 @@ taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, } struct taskqgroup * -taskqgroup_create(char *name) +taskqgroup_create(const char *name) { struct taskqgroup *qgroup; Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Tue May 29 21:52:13 2018 (r334357) +++ head/sys/net/iflib.c Tue May 29 21:56:39 2018 (r334358) @@ -733,7 +733,7 @@ static int iflib_tx_credits_update(if_ctx_t ctx, iflib static int iflib_rxd_avail(if_ctx_t ctx, iflib_rxq_t rxq, qidx_t cidx, qidx_t budget); static int iflib_qset_structures_setup(if_ctx_t ctx); static int iflib_msix_init(if_ctx_t ctx); -static int iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filter, void *filterarg, int *rid, char *str); +static int iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filter, void *filterarg, int *rid, const char *str); static void iflib_txq_check_drain(iflib_txq_t txq, int budget); static uint32_t iflib_txq_can_drain(struct ifmp_ring *); static int iflib_register(if_ctx_t); @@ -1523,8 +1523,8 @@ iflib_fast_intr_ctx(void *arg) static int _iflib_irq_alloc(if_ctx_t ctx, if_irq_t irq, int rid, - driver_filter_t filter, driver_intr_t handler, void *arg, - char *name) + driver_filter_t filter, driver_intr_t handler, void *arg, + const char *name) { int rc, flags; struct resource *res; @@ -5395,7 +5395,7 @@ iflib_qset_structures_setup(if_ctx_t ctx) int iflib_irq_alloc(if_ctx_t ctx, if_irq_t irq, int rid, - driver_filter_t filter, void *filter_arg, driver_intr_t handler, void *arg, char *name) + driver_filter_t filter, void *filter_arg, driver_intr_t handler, void *arg, const char *name) { return (_iflib_irq_alloc(ctx, irq, rid, filter, handler, arg, name)); @@ -5526,7 +5526,7 @@ get_core_offset(if_ctx_t ctx, iflib_intr_type_t type, /* Just to avoid copy/paste */ static inline int iflib_irq_set_affinity(if_ctx_t ctx, int irq, iflib_intr_type_t type, int qid, - struct grouptask *gtask, struct taskqgroup *tqg, void *uniq, char *name) + struct grouptask *gtask, struct taskqgroup *tqg, void *uniq, const char *name) { int cpuid; int err, tid; @@ -5549,8 +5549,8 @@ iflib_irq_set_affinity(if_ctx_t ctx, int irq, iflib_in int iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, int rid, - iflib_intr_type_t type, driver_filter_t *filter, - void *filter_arg, int qid, char *name) + iflib_intr_type_t type, driver_filter_t *filter, + void *filter_arg, int qid, const char *name) { struct grouptask *gtask; struct taskqgroup *tqg; @@ -5631,7 +5631,7 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, in } void -iflib_softirq_alloc_generic(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t type, void *arg, int qid, char *name) +iflib_softirq_alloc_generic(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t type, void *arg, int qid, const char *name) { struct grouptask *gtask; struct taskqgroup *tqg; @@ -5688,7 +5688,7 @@ iflib_irq_free(if_ctx_t ctx, if_irq_t irq) } static int -iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filter, void *filter_arg, int *rid, char *name) +iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filter, void *filter_arg, int *rid, const char *name) { iflib_txq_t txq = ctx->ifc_txqs; iflib_rxq_t rxq = ctx->ifc_rxqs; Modified: head/sys/net/iflib.h ============================================================================== --- head/sys/net/iflib.h Tue May 29 21:52:13 2018 (r334357) +++ head/sys/net/iflib.h Tue May 29 21:56:39 2018 (r334358) @@ -404,11 +404,11 @@ int iflib_device_deregister(if_ctx_t); -int iflib_irq_alloc(if_ctx_t, if_irq_t, int, driver_filter_t, void *filter_arg, driver_intr_t, void *arg, char *name); +int iflib_irq_alloc(if_ctx_t, if_irq_t, int, driver_filter_t, void *filter_arg, driver_intr_t, void *arg, const char *name); int iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, int rid, - iflib_intr_type_t type, driver_filter_t *filter, - void *filter_arg, int qid, char *name); -void iflib_softirq_alloc_generic(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t type, void *arg, int qid, char *name); + iflib_intr_type_t type, driver_filter_t *filter, + void *filter_arg, int qid, const char *name); +void iflib_softirq_alloc_generic(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t type, void *arg, int qid, const char *name); void iflib_irq_free(if_ctx_t ctx, if_irq_t irq); Modified: head/sys/sys/gtaskqueue.h ============================================================================== --- head/sys/sys/gtaskqueue.h Tue May 29 21:52:13 2018 (r334357) +++ head/sys/sys/gtaskqueue.h Tue May 29 21:56:39 2018 (r334358) @@ -56,9 +56,9 @@ int grouptaskqueue_enqueue(struct gtaskqueue *queue, s void taskqgroup_attach(struct taskqgroup *qgroup, struct grouptask *grptask, void *uniq, int irq, const char *name); int taskqgroup_attach_cpu(struct taskqgroup *qgroup, struct grouptask *grptask, - void *uniq, int cpu, int irq, char *name); + void *uniq, int cpu, int irq, const char *name); void taskqgroup_detach(struct taskqgroup *qgroup, struct grouptask *gtask); -struct taskqgroup *taskqgroup_create(char *name); +struct taskqgroup *taskqgroup_create(const char *name); void taskqgroup_destroy(struct taskqgroup *qgroup); int taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, int stride); void taskqgroup_config_gtask_init(void *ctx, struct grouptask *gtask, gtask_fn_t *fn, From owner-svn-src-head@freebsd.org Tue May 29 22:36:38 2018 Return-Path: Delivered-To: svn-src-head@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 66784F7B84A; Tue, 29 May 2018 22:36:38 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 14F328275D; Tue, 29 May 2018 22:36:38 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E6D732230D; Tue, 29 May 2018 22:36:37 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TMabh3010058; Tue, 29 May 2018 22:36:37 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TMabMn010057; Tue, 29 May 2018 22:36:37 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201805292236.w4TMabMn010057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Tue, 29 May 2018 22:36:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334359 - head/cddl/usr.sbin/dwatch X-SVN-Group: head X-SVN-Commit-Author: dteske X-SVN-Commit-Paths: head/cddl/usr.sbin/dwatch X-SVN-Commit-Revision: 334359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 22:36:38 -0000 Author: dteske Date: Tue May 29 22:36:37 2018 New Revision: 334359 URL: https://svnweb.freebsd.org/changeset/base/334359 Log: dwatch(1): Fix "-t test" for post-processing profiles Profiles that perform post-processing of the DTrace output were dropping the "-t test" option on the floor. Fix handling of this option for said profiles. X-MFC-to: stable/11 X-MFC-with: r334261-334262 Sponsored by: Smule, Inc. Modified: head/cddl/usr.sbin/dwatch/dwatch Modified: head/cddl/usr.sbin/dwatch/dwatch ============================================================================== --- head/cddl/usr.sbin/dwatch/dwatch Tue May 29 21:56:39 2018 (r334358) +++ head/cddl/usr.sbin/dwatch/dwatch Tue May 29 22:36:37 2018 (r334359) @@ -47,7 +47,7 @@ DTRACE_PRAGMA=" ############################################################ GLOBALS -VERSION='$Version: 1.3 $' # -V +VERSION='$Version: 1.4 $' # -V pgm="${0##*/}" # Program basename @@ -576,8 +576,8 @@ load_profile() ARGV="$ARGV -z '$( shell_escape "$EXECREGEX" )'" [ "$CUSTOM_DETAILS" ] && ARGV="$ARGV -E '$( shell_escape "$EVENT_DETAILS" )'" - [ "$EVENT_TEST" ] && - ARGV="$ARGV -t '$( shell_escape "$EVENT_TEST" )'" + [ "$CUSTOM_TEST" ] && + ARGV="$ARGV -t '$( shell_escape "$CUSTOM_TEST" )'" [ "$OUTPUT" ] && ARGV="$ARGV -o '$( shell_escape "$OUTPUT" )'" [ "$OUTPUT_CMD" ] && From owner-svn-src-head@freebsd.org Tue May 29 23:08:35 2018 Return-Path: Delivered-To: svn-src-head@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 05CB9F7D503; Tue, 29 May 2018 23:08:35 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AF54F83788; Tue, 29 May 2018 23:08:34 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 761C4227D7; Tue, 29 May 2018 23:08:34 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4TN8YaK025427; Tue, 29 May 2018 23:08:34 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TN8XsD025422; Tue, 29 May 2018 23:08:33 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201805292308.w4TN8XsD025422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 29 May 2018 23:08:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334360 - in head: etc/mtree tests/sys tests/sys/audit X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: etc/mtree tests/sys tests/sys/audit X-SVN-Commit-Revision: 334360 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 23:08:35 -0000 Author: asomers Date: Tue May 29 23:08:33 2018 New Revision: 334360 URL: https://svnweb.freebsd.org/changeset/base/334360 Log: Add initial set of tests for audit(4) This change includes the framework for testing the auditability of various syscalls, and includes changes for the first 12. The tests will start auditd(8) if needed, though they'll be much faster if it's already running. The syscalls tested in this commit include mkdir(2), mkdirat(2), mknod(2), mknodat(2), mkfifo(2), mkfifoat(2), link(2), linkat(2), symlink(2), symlinkat(2), rename(2), and renameat(2). Submitted by: aniketp MFC after: 2 weeks Sponsored by: Google, Inc (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15286 Added: head/tests/sys/audit/ head/tests/sys/audit/Makefile (contents, props changed) head/tests/sys/audit/file-create.c (contents, props changed) head/tests/sys/audit/utils.c (contents, props changed) head/tests/sys/audit/utils.h (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/tests/sys/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Tue May 29 22:36:37 2018 (r334359) +++ head/etc/mtree/BSD.tests.dist Tue May 29 23:08:33 2018 (r334360) @@ -430,6 +430,8 @@ .. aio .. + audit + .. capsicum .. cddl Modified: head/tests/sys/Makefile ============================================================================== --- head/tests/sys/Makefile Tue May 29 22:36:37 2018 (r334359) +++ head/tests/sys/Makefile Tue May 29 23:08:33 2018 (r334360) @@ -6,6 +6,7 @@ TESTSDIR= ${TESTSBASE}/sys TESTS_SUBDIRS+= acl TESTS_SUBDIRS+= aio +TESTS_SUBDIRS+= audit TESTS_SUBDIRS+= capsicum TESTS_SUBDIRS+= ${_cddl} TESTS_SUBDIRS+= fifo Added: head/tests/sys/audit/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/audit/Makefile Tue May 29 23:08:33 2018 (r334360) @@ -0,0 +1,17 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/sys/audit + +ATF_TESTS_C= file-create + +SRCS.file-create+= file-create.c +SRCS.file-create+= utils.c + +TEST_METADATA+= timeout="30" +TEST_METADATA+= required_user="root" + +WARNS?= 6 + +LDFLAGS+= -lbsm + +.include Added: head/tests/sys/audit/file-create.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/audit/file-create.c Tue May 29 23:08:33 2018 (r334360) @@ -0,0 +1,585 @@ +/*- + * Copyright 2018 Aniket Pandey + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + +#include +#include +#include +#include + +#include "utils.h" + +static struct pollfd fds[1]; +static mode_t mode = 0777; +static dev_t dev = 0; +static const char *auclass = "fc"; +static const char *path = "fileforaudit"; +static const char *successreg = "fileforaudit.*return,success"; +static const char *failurereg = "fileforaudit.*return,failure"; + + +ATF_TC_WITH_CLEANUP(mkdir_success); +ATF_TC_HEAD(mkdir_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "mkdir(2) call"); +} + +ATF_TC_BODY(mkdir_success, tc) +{ + FILE *pipefd = setup(fds, auclass); + ATF_REQUIRE_EQ(0, mkdir(path, mode)); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(mkdir_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(mkdir_failure); +ATF_TC_HEAD(mkdir_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "mkdir(2) call"); +} + +ATF_TC_BODY(mkdir_failure, tc) +{ + ATF_REQUIRE_EQ(0, mkdir(path, mode)); + FILE *pipefd = setup(fds, auclass); + /* Failure reason: directory already exists */ + ATF_REQUIRE_EQ(-1, mkdir(path, mode)); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(mkdir_failure, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(mkdirat_success); +ATF_TC_HEAD(mkdirat_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "mkdirat(2) call"); +} + +ATF_TC_BODY(mkdirat_success, tc) +{ + FILE *pipefd = setup(fds, auclass); + ATF_REQUIRE_EQ(0, mkdirat(AT_FDCWD, path, mode)); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(mkdirat_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(mkdirat_failure); +ATF_TC_HEAD(mkdirat_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "mkdirat(2) call"); +} + +ATF_TC_BODY(mkdirat_failure, tc) +{ + ATF_REQUIRE_EQ(0, mkdirat(AT_FDCWD, path, mode)); + FILE *pipefd = setup(fds, auclass); + /* Failure reason: directory already exists */ + ATF_REQUIRE_EQ(-1, mkdirat(AT_FDCWD, path, mode)); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(mkdirat_failure, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(mkfifo_success); +ATF_TC_HEAD(mkfifo_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "mkfifo(2) call"); +} + +ATF_TC_BODY(mkfifo_success, tc) +{ + FILE *pipefd = setup(fds, auclass); + ATF_REQUIRE_EQ(0, mkfifo(path, mode)); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(mkfifo_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(mkfifo_failure); +ATF_TC_HEAD(mkfifo_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "mkfifo(2) call"); +} + +ATF_TC_BODY(mkfifo_failure, tc) +{ + ATF_REQUIRE_EQ(0, mkfifo(path, mode)); + FILE *pipefd = setup(fds, auclass); + /* Failure reason: FIFO already exists */ + ATF_REQUIRE_EQ(-1, mkfifo(path, mode)); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(mkfifo_failure, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(mkfifoat_success); +ATF_TC_HEAD(mkfifoat_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "mkfifoat(2) call"); +} + +ATF_TC_BODY(mkfifoat_success, tc) +{ + FILE *pipefd = setup(fds, auclass); + ATF_REQUIRE_EQ(0, mkfifoat(AT_FDCWD, path, mode)); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(mkfifoat_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(mkfifoat_failure); +ATF_TC_HEAD(mkfifoat_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "mkfifoat(2) call"); +} + +ATF_TC_BODY(mkfifoat_failure, tc) +{ + ATF_REQUIRE_EQ(0, mkfifoat(AT_FDCWD, path, mode)); + FILE *pipefd = setup(fds, auclass); + /* Failure reason: FIFO already exists */ + ATF_REQUIRE_EQ(-1, mkfifoat(AT_FDCWD, path, mode)); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(mkfifoat_failure, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(mknod_success); +ATF_TC_HEAD(mknod_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "mknod(2) call"); +} + +ATF_TC_BODY(mknod_success, tc) +{ + FILE *pipefd = setup(fds, auclass); + ATF_REQUIRE_EQ(0, mknod(path, S_IFIFO | S_IRWXO, dev)); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(mknod_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(mknod_failure); +ATF_TC_HEAD(mknod_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "mknod(2) call"); +} + +ATF_TC_BODY(mknod_failure, tc) +{ + ATF_REQUIRE_EQ(0, mknod(path, S_IFIFO | S_IRWXO, dev)); + FILE *pipefd = setup(fds, auclass); + /* Failure reason: FIFO node already exists */ + ATF_REQUIRE_EQ(-1, mknod(path, S_IFIFO | S_IRWXO, dev)); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(mknod_failure, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(mknodat_success); +ATF_TC_HEAD(mknodat_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "mknodat(2) call"); +} + +ATF_TC_BODY(mknodat_success, tc) +{ + FILE *pipefd = setup(fds, auclass); + ATF_REQUIRE_EQ(0, mknodat(AT_FDCWD, path, S_IFIFO | S_IRWXO, dev)); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(mknodat_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(mknodat_failure); +ATF_TC_HEAD(mknodat_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "mknodat(2) call"); +} + +ATF_TC_BODY(mknodat_failure, tc) +{ + ATF_REQUIRE_EQ(0, mknodat(AT_FDCWD, path, S_IFIFO | S_IRWXO, dev)); + FILE *pipefd = setup(fds, auclass); + /* Failure reason: FIFO node already exists */ + ATF_REQUIRE_EQ(-1, mknodat(AT_FDCWD, path, S_IFIFO | S_IRWXO, dev)); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(mknodat_failure, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(rename_success); +ATF_TC_HEAD(rename_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "rename(2) call"); +} + +ATF_TC_BODY(rename_success, tc) +{ + ATF_REQUIRE(open(path, O_CREAT, mode) != -1); + FILE *pipefd = setup(fds, auclass); + ATF_REQUIRE_EQ(0, rename(path, "renamed")); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(rename_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(rename_failure); +ATF_TC_HEAD(rename_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "rename(2) call"); +} + +ATF_TC_BODY(rename_failure, tc) +{ + FILE *pipefd = setup(fds, auclass); + /* Failure reason: file does not exist */ + ATF_REQUIRE_EQ(-1, rename(path, "renamed")); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(rename_failure, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(renameat_success); +ATF_TC_HEAD(renameat_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "renameat(2) call"); +} + +ATF_TC_BODY(renameat_success, tc) +{ + ATF_REQUIRE(open(path, O_CREAT, mode) != -1); + FILE *pipefd = setup(fds, auclass); + ATF_REQUIRE_EQ(0, renameat(AT_FDCWD, path, AT_FDCWD, "renamed")); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(renameat_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(renameat_failure); +ATF_TC_HEAD(renameat_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "renameat(2) call"); +} + +ATF_TC_BODY(renameat_failure, tc) +{ + FILE *pipefd = setup(fds, auclass); + /* Failure reason: file does not exist */ + ATF_REQUIRE_EQ(-1, renameat(AT_FDCWD, path, AT_FDCWD, "renamed")); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(renameat_failure, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(link_success); +ATF_TC_HEAD(link_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "link(2) call"); +} + +ATF_TC_BODY(link_success, tc) +{ + ATF_REQUIRE(open(path, O_CREAT, mode) != -1); + FILE *pipefd = setup(fds, auclass); + ATF_REQUIRE_EQ(0, link(path, "hardlink")); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(link_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(link_failure); +ATF_TC_HEAD(link_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "link(2) call"); +} + +ATF_TC_BODY(link_failure, tc) +{ + FILE *pipefd = setup(fds, auclass); + /* Failure reason: file does not exist */ + ATF_REQUIRE_EQ(-1, link(path, "hardlink")); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(link_failure, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(linkat_success); +ATF_TC_HEAD(linkat_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "linkat(2) call"); +} + +ATF_TC_BODY(linkat_success, tc) +{ + ATF_REQUIRE(open(path, O_CREAT, mode) != -1); + FILE *pipefd = setup(fds, auclass); + ATF_REQUIRE_EQ(0, linkat(AT_FDCWD, path, AT_FDCWD, "hardlink", 0)); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(linkat_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(linkat_failure); +ATF_TC_HEAD(linkat_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "linkat(2) call"); +} + +ATF_TC_BODY(linkat_failure, tc) +{ + FILE *pipefd = setup(fds, auclass); + /* Failure reason: file does not exist */ + ATF_REQUIRE_EQ(-1, linkat(AT_FDCWD, path, AT_FDCWD, "hardlink", 0)); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(linkat_failure, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(symlink_success); +ATF_TC_HEAD(symlink_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "symlink(2) call"); +} + +ATF_TC_BODY(symlink_success, tc) +{ + FILE *pipefd = setup(fds, auclass); + ATF_REQUIRE_EQ(0, symlink(path, "symlink")); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(symlink_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(symlink_failure); +ATF_TC_HEAD(symlink_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "symlink(2) call"); +} + +ATF_TC_BODY(symlink_failure, tc) +{ + ATF_REQUIRE_EQ(0, symlink(path, "symlink")); + FILE *pipefd = setup(fds, auclass); + /* Failure reason: symbolic link already exists */ + ATF_REQUIRE_EQ(-1, symlink(path, "symlink")); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(symlink_failure, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(symlinkat_success); +ATF_TC_HEAD(symlinkat_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "symlinkat(2) call"); +} + +ATF_TC_BODY(symlinkat_success, tc) +{ + FILE *pipefd = setup(fds, auclass); + ATF_REQUIRE_EQ(0, symlinkat(path, AT_FDCWD, "symlink")); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(symlinkat_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(symlinkat_failure); +ATF_TC_HEAD(symlinkat_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "symlinkat(2) call"); +} + +ATF_TC_BODY(symlinkat_failure, tc) +{ + ATF_REQUIRE_EQ(0, symlinkat(path, AT_FDCWD, "symlink")); + FILE *pipefd = setup(fds, auclass); + /* Failure reason: symbolic link already exists */ + ATF_REQUIRE_EQ(-1, symlinkat(path, AT_FDCWD, "symlink")); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(symlinkat_failure, tc) +{ + cleanup(); +} + + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, mkdir_success); + ATF_TP_ADD_TC(tp, mkdir_failure); + ATF_TP_ADD_TC(tp, mkdirat_success); + ATF_TP_ADD_TC(tp, mkdirat_failure); + + ATF_TP_ADD_TC(tp, mkfifo_success); + ATF_TP_ADD_TC(tp, mkfifo_failure); + ATF_TP_ADD_TC(tp, mkfifoat_success); + ATF_TP_ADD_TC(tp, mkfifoat_failure); + + ATF_TP_ADD_TC(tp, mknod_success); + ATF_TP_ADD_TC(tp, mknod_failure); + ATF_TP_ADD_TC(tp, mknodat_success); + ATF_TP_ADD_TC(tp, mknodat_failure); + + ATF_TP_ADD_TC(tp, rename_success); + ATF_TP_ADD_TC(tp, rename_failure); + ATF_TP_ADD_TC(tp, renameat_success); + ATF_TP_ADD_TC(tp, renameat_failure); + + ATF_TP_ADD_TC(tp, link_success); + ATF_TP_ADD_TC(tp, link_failure); + ATF_TP_ADD_TC(tp, linkat_success); + ATF_TP_ADD_TC(tp, linkat_failure); + + ATF_TP_ADD_TC(tp, symlink_success); + ATF_TP_ADD_TC(tp, symlink_failure); + ATF_TP_ADD_TC(tp, symlinkat_success); + ATF_TP_ADD_TC(tp, symlinkat_failure); + + return (atf_no_error()); +} Added: head/tests/sys/audit/utils.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/audit/utils.c Tue May 29 23:08:33 2018 (r334360) @@ -0,0 +1,234 @@ +/*- + * Copyright 2018 Aniket Pandey + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "utils.h" + +/* + * Checks the presence of "auditregex" in auditpipe(4) after the + * corresponding system call has been triggered. + */ +static bool +get_records(const char *auditregex, FILE *pipestream) +{ + uint8_t *buff; + tokenstr_t token; + ssize_t size = 1024; + char membuff[size]; + char del[] = ","; + int reclen, bytes = 0; + FILE *memstream; + + /* + * Open a stream on 'membuff' (address to memory buffer) for storing + * the audit records in the default mode.'reclen' is the length of the + * available records from auditpipe which is passed to the functions + * au_fetch_tok(3) and au_print_flags_tok(3) for further use. + */ + ATF_REQUIRE((memstream = fmemopen(membuff, size, "w")) != NULL); + ATF_REQUIRE((reclen = au_read_rec(pipestream, &buff)) != -1); + + /* + * Iterate through each BSM token, extracting the bits that are + * required to start processing the token sequences. + */ + while (bytes < reclen) { + if (au_fetch_tok(&token, buff + bytes, reclen - bytes) == -1) { + perror("au_read_rec"); + atf_tc_fail("Incomplete Audit Record"); + } + + /* Print the tokens as they are obtained, in the default form */ + au_print_flags_tok(memstream, &token, del, AU_OFLAG_NONE); + bytes += token.len; + } + + free(buff); + fclose(memstream); + return (atf_utils_grep_string("%s", membuff, auditregex)); +} + +/* + * Override the system-wide audit mask settings in /etc/security/audit_control + * and set the auditpipe's maximum allowed queue length limit + */ +static void +set_preselect_mode(int filedesc, au_mask_t *fmask) +{ + int qlimit_max; + int fmode = AUDITPIPE_PRESELECT_MODE_LOCAL; + + /* Set local preselection mode for auditing */ + if (ioctl(filedesc, AUDITPIPE_SET_PRESELECT_MODE, &fmode) < 0) + atf_tc_fail("Preselection mode: %s", strerror(errno)); + + /* Set local preselection flag corresponding to the audit_event */ + if (ioctl(filedesc, AUDITPIPE_SET_PRESELECT_FLAGS, fmask) < 0) + atf_tc_fail("Preselection flag: %s", strerror(errno)); + + /* Set local preselection flag for non-attributable audit_events */ + if (ioctl(filedesc, AUDITPIPE_SET_PRESELECT_NAFLAGS, fmask) < 0) + atf_tc_fail("Preselection naflag: %s", strerror(errno)); + + /* Query the maximum possible queue length limit for auditpipe */ + if (ioctl(filedesc, AUDITPIPE_GET_QLIMIT_MAX, &qlimit_max) < 0) + atf_tc_fail("Query max-limit: %s", strerror(errno)); + + /* Set the queue length limit as obtained from previous step */ + if (ioctl(filedesc, AUDITPIPE_SET_QLIMIT, &qlimit_max) < 0) + atf_tc_fail("Set max-qlimit: %s", strerror(errno)); + + /* This removes any outstanding record on the auditpipe */ + if (ioctl(filedesc, AUDITPIPE_FLUSH) < 0) + atf_tc_fail("Auditpipe flush: %s", strerror(errno)); +} + +/* + * Get the corresponding audit_mask for class-name "name" then set the + * success and failure bits for fmask to be used as the ioctl argument + */ +static au_mask_t +get_audit_mask(const char *name) +{ + au_mask_t fmask; + au_class_ent_t *class; + + ATF_REQUIRE((class = getauclassnam(name)) != NULL); + fmask.am_success = class->ac_class; + fmask.am_failure = class->ac_class; + return (fmask); +} + +/* + * Loop until the auditpipe returns something, check if it is what + * we want, else repeat the procedure until ppoll(2) times out. + */ +static void +check_auditpipe(struct pollfd fd[], const char *auditregex, FILE *pipestream) +{ + struct timespec currtime, endtime, timeout; + + /* Set the expire time for poll(2) while waiting for syscall audit */ + ATF_REQUIRE_EQ(0, clock_gettime(CLOCK_MONOTONIC, &endtime)); + endtime.tv_sec += 10; + timeout.tv_nsec = endtime.tv_nsec; + + for (;;) { + /* Update the time left for auditpipe to return any event */ + ATF_REQUIRE_EQ(0, clock_gettime(CLOCK_MONOTONIC, &currtime)); + timeout.tv_sec = endtime.tv_sec - currtime.tv_sec; + + switch (ppoll(fd, 1, &timeout, NULL)) { + /* ppoll(2) returns, check if it's what we want */ + case 1: + if (fd[0].revents & POLLIN) { + if (get_records(auditregex, pipestream)) + return; + } else { + atf_tc_fail("Auditpipe returned an " + "unknown event %#x", fd[0].revents); + } + break; + + /* poll(2) timed out */ + case 0: + atf_tc_fail("%s not found in auditpipe within the " + "time limit", auditregex); + break; + + /* poll(2) standard error */ + case -1: + atf_tc_fail("Poll: %s", strerror(errno)); + break; + + default: + atf_tc_fail("Poll returned too many file descriptors"); + } + } +} + +/* + * Wrapper functions around static "check_auditpipe" + */ +static void +check_audit_startup(struct pollfd fd[], const char *auditrgx, FILE *pipestream){ + check_auditpipe(fd, auditrgx, pipestream); +} + +void +check_audit(struct pollfd fd[], const char *auditrgx, FILE *pipestream) { + check_auditpipe(fd, auditrgx, pipestream); + + /* Cleanup */ + fclose(pipestream); + close(fd[0].fd); +} + +FILE +*setup(struct pollfd fd[], const char *name) +{ + au_mask_t fmask, nomask; + fmask = get_audit_mask(name); + nomask = get_audit_mask("no"); + FILE *pipestream; + + fd[0].fd = open("/dev/auditpipe", O_RDONLY); + fd[0].events = POLLIN; + pipestream = fdopen(fd[0].fd, "r"); + + /* Set local preselection audit_class as "no" for audit startup */ + set_preselect_mode(fd[0].fd, &nomask); + ATF_REQUIRE_EQ(0, system("service auditd onestatus || \ + { service auditd onestart && touch started_auditd ; }")); + + /* If 'started_auditd' exists, that means we started auditd(8) */ + if (atf_utils_file_exists("started_auditd")) + check_audit_startup(fd, "audit startup", pipestream); + + /* Set local preselection parameters specific to "name" audit_class */ + set_preselect_mode(fd[0].fd, &fmask); + return (pipestream); +} + +void +cleanup(void) +{ + if (atf_utils_file_exists("started_auditd")) + system("service auditd onestop > /dev/null 2>&1"); +} Added: head/tests/sys/audit/utils.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/audit/utils.h Tue May 29 23:08:33 2018 (r334360) @@ -0,0 +1,42 @@ +/*- + * Copyright 2018 Aniket Pandey + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + + +#ifndef _UTILS_H_ +#define _UTILS_H_ + +#include +#include +#include +#include + +void check_audit(struct pollfd [], const char *, FILE *); +FILE *setup(struct pollfd [], const char *); +void cleanup(void); + +#endif /* _SETUP_H_ */ From owner-svn-src-head@freebsd.org Wed May 30 00:06:18 2018 Return-Path: Delivered-To: svn-src-head@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 154D2FBEAAA; Wed, 30 May 2018 00:06:18 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B26418542C; Wed, 30 May 2018 00:06:17 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EF91231A6; Wed, 30 May 2018 00:06:17 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4U06Htc055257; Wed, 30 May 2018 00:06:17 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4U06HK3055256; Wed, 30 May 2018 00:06:17 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805300006.w4U06HK3055256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Wed, 30 May 2018 00:06:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334361 - head/usr.sbin/pmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/usr.sbin/pmc X-SVN-Commit-Revision: 334361 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 00:06:18 -0000 Author: mmacy Date: Wed May 30 00:06:17 2018 New Revision: 334361 URL: https://svnweb.freebsd.org/changeset/base/334361 Log: pmc: don't break build with format issues Modified: head/usr.sbin/pmc/Makefile Modified: head/usr.sbin/pmc/Makefile ============================================================================== --- head/usr.sbin/pmc/Makefile Tue May 29 23:08:33 2018 (r334360) +++ head/usr.sbin/pmc/Makefile Wed May 30 00:06:17 2018 (r334361) @@ -9,4 +9,5 @@ LIBADD= kvm pmc m ncursesw pmcstat elf SRCS= pmc.c pmc_util.c cmd_pmc_stat.c +CWARNFLAGS.cmd_pmc_stat.c= -Wno-format .include From owner-svn-src-head@freebsd.org Wed May 30 00:10:53 2018 Return-Path: Delivered-To: svn-src-head@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 4E41CFBEF7C; Wed, 30 May 2018 00:10:53 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x244.google.com (mail-io0-x244.google.com [IPv6:2607:f8b0:4001:c06::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D59DB8589D; Wed, 30 May 2018 00:10:52 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io0-x244.google.com with SMTP id d73-v6so19570310iog.3; Tue, 29 May 2018 17:10:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=VQK5jAdVE6qZ8y+z9jSEQAq0ssYMm9IHnqg4ZA3uUUU=; b=p6/j20NhmhWKcG3W3m3mjFNn6V6jc9tKDpK0usbomMFYGofF3MjQuKpYspdANcvpzp UlWhfxdkGmfn2SL8sD42qiaspYvhOMZMXygdokp2n2yb02u5OofH9l8xv6kyfO68V2+o iQIoy8qtqp8mDS/P1Tw+MUkGs82D1EqnszAExIV1LgUXBBWvr0fnwNGVKO4W/lXlAZku gFzYzLaoohP8zBfzlsGApP1beH5x7h/Tq0WoSh6xBVD01qNoHeOkXqbOWqbCKP6l1n9Y epLRz7GJKrh0vHo0tiyW8sULwWZjSW3giMwy/aAzci4xbCQknywy5t70arFq2T1kUWfB q4vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=VQK5jAdVE6qZ8y+z9jSEQAq0ssYMm9IHnqg4ZA3uUUU=; b=Bq6OSwWVCN2dzGruzIMBDC2HMP2zbRcHOy27gpEjmXNR3tDWYgQK/HqDYZTkzc/hZK NT/mZdhj4KVgAEeMFdlhqHcUlfaf54jahG5UTtgwyjdbKmoekdTDm1mc1ufSFs4p2Rrt OntVChU9hmaOxSlopkpTnzzV2NL2u5XJgbpqLkdoJze0TNDGlfuNsQ9e8wlzRnsAQwb1 +p63UhorGcd0zrFap9K7740E5iZ3Py2WOeIlxbAxc6zzcfIDgarKpTPRwHSa7PpARFZG nsDGZJv/fB1U9kidplQdaN8ECnoGPaeyRhUG96MiL9Q1fzRYDooN7UJeQcARqEoADP3L busg== X-Gm-Message-State: APt69E1xbYs4oEtcVQDIsFHEeDvkw74MM/J6mFNfiHyTpMVgbtgikK9s bmWaGATq5SY+w50g8UwevpGCkEcu8KIvEowsrOaN/iu4 X-Google-Smtp-Source: ADUXVKKLot943utWWDiCCwyzibccmZD/69XRWHymMNLbHO0a0T0JQ7H9RozobNToxFUvVzmGTcSHtgp2saDfZNF+GKw= X-Received: by 2002:a6b:2cd:: with SMTP id 196-v6mr455508ioc.294.1527639052214; Tue, 29 May 2018 17:10:52 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 2002:a6b:87c4:0:0:0:0:0 with HTTP; Tue, 29 May 2018 17:10:31 -0700 (PDT) In-Reply-To: <201805292308.w4TN8XsD025422@repo.freebsd.org> References: <201805292308.w4TN8XsD025422@repo.freebsd.org> From: Ed Maste Date: Tue, 29 May 2018 20:10:31 -0400 X-Google-Sender-Auth: pNLWhP8SpOS1o-sWfoFjdcTmLNg Message-ID: Subject: Re: svn commit: r334360 - in head: etc/mtree tests/sys tests/sys/audit To: Alan Somers Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 00:10:53 -0000 On 29 May 2018 at 19:08, Alan Somers wrote: > Author: asomers > Date: Tue May 29 23:08:33 2018 > New Revision: 334360 > URL: https://svnweb.freebsd.org/changeset/base/334360 > > Log: > Add initial set of tests for audit(4) This has broken the build on many architectures, e.g. mips: https://ci.freebsd.org/job/FreeBSD-head-mips-build/2467/console 23:15:17 In file included from /usr/src/tests/sys/audit/utils.c:38: 23:15:17 /usr/obj/usr/src/mips.mips/tmp/usr/include/bsm/libbsm.h:880: warning: redundant redeclaration of 'au_bsm_to_domain' 23:15:17 /usr/obj/usr/src/mips.mips/tmp/usr/include/bsm/audit_record.h:301: warning: previous declaration of 'au_bsm_to_domain' was here ... From owner-svn-src-head@freebsd.org Wed May 30 00:36:58 2018 Return-Path: Delivered-To: svn-src-head@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 DA28AFC7BAD; Wed, 30 May 2018 00:36:58 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 901F386758; Wed, 30 May 2018 00:36:58 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 725D623682; Wed, 30 May 2018 00:36:58 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4U0awSW070337; Wed, 30 May 2018 00:36:58 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4U0awC8070336; Wed, 30 May 2018 00:36:58 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201805300036.w4U0awC8070336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 30 May 2018 00:36:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334362 - head/tests/sys X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/tests/sys X-SVN-Commit-Revision: 334362 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 00:36:59 -0000 Author: emaste Date: Wed May 30 00:36:58 2018 New Revision: 334362 URL: https://svnweb.freebsd.org/changeset/base/334362 Log: Temporarily disconnect audit tests Audit tests added in r334360 broke the build on a number of archs. Remove the subdir from the top level tests/sys/Makefile until they're fixed. Modified: head/tests/sys/Makefile Modified: head/tests/sys/Makefile ============================================================================== --- head/tests/sys/Makefile Wed May 30 00:06:17 2018 (r334361) +++ head/tests/sys/Makefile Wed May 30 00:36:58 2018 (r334362) @@ -6,7 +6,6 @@ TESTSDIR= ${TESTSBASE}/sys TESTS_SUBDIRS+= acl TESTS_SUBDIRS+= aio -TESTS_SUBDIRS+= audit TESTS_SUBDIRS+= capsicum TESTS_SUBDIRS+= ${_cddl} TESTS_SUBDIRS+= fifo From owner-svn-src-head@freebsd.org Wed May 30 00:58:37 2018 Return-Path: Delivered-To: svn-src-head@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 A9CA5FC9538; Wed, 30 May 2018 00:58:37 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf0-x22a.google.com (mail-lf0-x22a.google.com [IPv6:2a00:1450:4010:c07::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F2B30875A5; Wed, 30 May 2018 00:58:36 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf0-x22a.google.com with SMTP id z142-v6so1562588lff.5; Tue, 29 May 2018 17:58:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=SuHYjHfj69E+iYkZCMq77lo8+BAvRyhfCGvVpY+hCb0=; b=J1wC8xGzv+MIyzBr9d8p/1IxHchwnh47trXz2Xg7fnyd9x3nbpSI+J+PzzZchT3qPm eQjTBj8NESqKOuVaifKimk5b/nfyXIFTSizK9HdlsEGMmozhnpKOLrZpYgh58cgwfyzB pAnHYnEuHmU84v0UViiyt5IDUx5j/AMGyf0/e6u9N5ie3ti1VQkAm2mj5Kg9FmEh4hey pP3e17KtcVZDhkSgNheMjd+rzsIJPIwTWaeOjxnbHr07wR/u37tr3W04dwfnpo/d77VM FnTakspWX2eeBRsKyM5US2lhfaMgdv77As5/uXDVLdm17TDFUUqJJsgPy6BAbfJCLDgA Osjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=SuHYjHfj69E+iYkZCMq77lo8+BAvRyhfCGvVpY+hCb0=; b=hQjyIQtsMo7rroPWRYDSX+dqPSIAfKYPYkDZ5qydIc7Q3hlD8dn+PMZsOsPWSiig9s NpJJ++Y1NuI+7SPJJidGqGer/8CPosMSUGGQqfR2WijJiAE/PZl0LuBZJxSRa6nJX9p+ ZITjLjG91dEkLFtwkWeQ8BNCO3/wicTseQCc8fRRQUMlWZ79AccFII2I9QAgJC4vZp4y 5ZtLwjQK9Wod+cAe1gWEjNyY4mp8HczNtp6ta0M7h7rqq/rC8nBMIMRGMAahADhaZ38E V4KKUW00a8ZOadc24fdnDZ50hOkbI2A39u2blw4i0wruG5MIxysspD+S4NXBiN1NtvJa 0lCg== X-Gm-Message-State: ALKqPwd7hocldKkaCP55XqGiZXELdVH55SXQOCncC4gX1fc+H9dyMIVn FHIJZXXiDgu4cOsIs4lpUnAI1TV58xuBekRM00M= X-Google-Smtp-Source: ADUXVKJFUka4tkZHFdq1zxA8l3j80OtVi0+yGZeuqj+Xmo8sTQfOVY2uOYgY+92ncWuf9VfrPbe/peGNte1KWZ7A7Ng= X-Received: by 2002:a2e:9949:: with SMTP id r9-v6mr364325ljj.53.1527641915254; Tue, 29 May 2018 17:58:35 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 2002:ab3:724f:0:0:0:0:0 with HTTP; Tue, 29 May 2018 17:58:34 -0700 (PDT) In-Reply-To: <201805300036.w4U0awC8070336@repo.freebsd.org> References: <201805300036.w4U0awC8070336@repo.freebsd.org> From: Alan Somers Date: Tue, 29 May 2018 18:58:34 -0600 X-Google-Sender-Auth: 2rZYTgyFJSKPhSDxb0tU_iiNATQ Message-ID: Subject: Re: svn commit: r334362 - head/tests/sys To: Ed Maste Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 00:58:37 -0000 Thanks Ed. I'll try to figure out the root cause for this. On Tue, May 29, 2018 at 6:36 PM, Ed Maste wrote: > Author: emaste > Date: Wed May 30 00:36:58 2018 > New Revision: 334362 > URL: https://svnweb.freebsd.org/changeset/base/334362 > > Log: > Temporarily disconnect audit tests > > Audit tests added in r334360 broke the build on a number of archs. > Remove the subdir from the top level tests/sys/Makefile until they're > fixed. > > Modified: > head/tests/sys/Makefile > > Modified: head/tests/sys/Makefile > ============================================================ > ================== > --- head/tests/sys/Makefile Wed May 30 00:06:17 2018 (r334361) > +++ head/tests/sys/Makefile Wed May 30 00:36:58 2018 (r334362) > @@ -6,7 +6,6 @@ TESTSDIR= ${TESTSBASE}/sys > > TESTS_SUBDIRS+= acl > TESTS_SUBDIRS+= aio > -TESTS_SUBDIRS+= audit > TESTS_SUBDIRS+= capsicum > TESTS_SUBDIRS+= ${_cddl} > TESTS_SUBDIRS+= fifo > > From owner-svn-src-head@freebsd.org Wed May 30 01:16:51 2018 Return-Path: Delivered-To: svn-src-head@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 6651BEEE757; Wed, 30 May 2018 01:16:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 19C3387EE4; Wed, 30 May 2018 01:16:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAADB23CEE; Wed, 30 May 2018 01:16:50 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4U1GoiZ090164; Wed, 30 May 2018 01:16:50 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4U1GoWj090163; Wed, 30 May 2018 01:16:50 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201805300116.w4U1GoWj090163@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 30 May 2018 01:16:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334363 - head/usr.bin/elfdump X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.bin/elfdump X-SVN-Commit-Revision: 334363 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 01:16:51 -0000 Author: emaste Date: Wed May 30 01:16:50 2018 New Revision: 334363 URL: https://svnweb.freebsd.org/changeset/base/334363 Log: elfdump: chase ABI tag note name change from r232832 r232832 changed the ABI tag note name from .note.ABI-tag to .note.tag. Follow suit in elfdump. Elfdump's note parsing is very basic and should be significantly reworked, but for now just restore the broken functionality. PR: 228290 Submitted by: martin at lispworks.com MFC after: 1 week Modified: head/usr.bin/elfdump/elfdump.c Modified: head/usr.bin/elfdump/elfdump.c ============================================================================== --- head/usr.bin/elfdump/elfdump.c Wed May 30 00:36:58 2018 (r334362) +++ head/usr.bin/elfdump/elfdump.c Wed May 30 01:16:50 2018 (r334363) @@ -659,7 +659,7 @@ main(int ac, char **av) case SHT_NOTE: name = elf_get_word(e, v, SH_NAME); if (flags & ED_NOTE && - strcmp(shstrtab + name, ".note.ABI-tag") == 0) + strcmp(shstrtab + name, ".note.tag") == 0) elf_print_note(e, v); break; case SHT_DYNSYM: From owner-svn-src-head@freebsd.org Wed May 30 02:26:37 2018 Return-Path: Delivered-To: svn-src-head@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 29A84EF48F9; Wed, 30 May 2018 02:26:37 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D19C869D56; Wed, 30 May 2018 02:26:36 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2A1924827; Wed, 30 May 2018 02:26:36 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4U2Qamv025158; Wed, 30 May 2018 02:26:36 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4U2QadF025157; Wed, 30 May 2018 02:26:36 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201805300226.w4U2QadF025157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Wed, 30 May 2018 02:26:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334364 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 334364 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 02:26:37 -0000 Author: rpokala Date: Wed May 30 02:26:36 2018 New Revision: 334364 URL: https://svnweb.freebsd.org/changeset/base/334364 Log: Remove the mlx5 driver from LINT kernel config for 32-bit PPC The mlx5 driver requires 64-bit atomics, which are not supported on 32-bit PPC. Exclude that driver from the LINT kernel config. Submitted by: hps (but I re-worded the comment) Reported by: rpokala Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D15611 Modified: head/sys/conf/makeLINT.mk Modified: head/sys/conf/makeLINT.mk ============================================================================== --- head/sys/conf/makeLINT.mk Wed May 30 01:16:50 2018 (r334363) +++ head/sys/conf/makeLINT.mk Wed May 30 02:26:36 2018 (r334364) @@ -55,4 +55,8 @@ LINT: ${NOTES} ${MAKELINT_SED} cat ${.TARGET} > ${.TARGET}64 echo "machine ${TARGET} powerpc" >> ${.TARGET} echo "machine ${TARGET} powerpc64" >> ${.TARGET}64 +# mlx5 needs 64-bit atomics, so exclude from 32-bit PPC + echo "nodevice mlx5" >> ${.TARGET} + echo "nodevice mlx5en" >> ${.TARGET} + echo "nodevice mlx5ib" >> ${.TARGET} .endif From owner-svn-src-head@freebsd.org Wed May 30 02:41:48 2018 Return-Path: Delivered-To: svn-src-head@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 8AA31EF5D75; Wed, 30 May 2018 02:41:48 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 400FC6A7CC; Wed, 30 May 2018 02:41:48 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2119324B1E; Wed, 30 May 2018 02:41:48 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4U2fmlt033943; Wed, 30 May 2018 02:41:48 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4U2fmvB033942; Wed, 30 May 2018 02:41:48 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201805300241.w4U2fmvB033942@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 30 May 2018 02:41:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334365 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 334365 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 02:41:48 -0000 Author: jhibbits Date: Wed May 30 02:41:47 2018 New Revision: 334365 URL: https://svnweb.freebsd.org/changeset/base/334365 Log: Restrict PCIe maxslots to 0, instead of PCI_SLOTMAX Summary: PCIe only permits 1 device on an endpoint, so some devices ignore the device part of B:D:F probing. Although ARI likely fixes this, not all platforms support ARI completely or correctly, so some devices end up showing up 32 times on the bus. This was found during bringup of POWER9/Talos, and has been tested on POWER9 and POWER8 hardware. Reviewed by: leitao Differential Revision: https://reviews.freebsd.org/D15461 Modified: head/sys/dev/pci/pci_pci.c Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Wed May 30 02:26:36 2018 (r334364) +++ head/sys/dev/pci/pci_pci.c Wed May 30 02:41:47 2018 (r334365) @@ -2545,6 +2545,20 @@ pcib_enable_ari(struct pcib_softc *sc, uint32_t pcie_p int pcib_maxslots(device_t dev) { + uint32_t pcie_pos; + uint16_t val; + + /* + * If this is a PCIe rootport or downstream switch port, there's only + * one slot permitted. + */ + if (pci_find_cap(dev, PCIY_EXPRESS, &pcie_pos) == 0) { + val = pci_read_config(dev, pcie_pos + PCIER_FLAGS, 2); + val &= PCIEM_FLAGS_TYPE; + if (val == PCIEM_TYPE_ROOT_PORT || + val == PCIEM_TYPE_DOWNSTREAM_PORT) + return (0); + } return (PCI_SLOTMAX); } @@ -2558,7 +2572,7 @@ pcib_ari_maxslots(device_t dev) if (sc->flags & PCIB_ENABLE_ARI) return (PCIE_ARI_SLOTMAX); else - return (PCI_SLOTMAX); + return (pcib_maxslots(dev)); } static int From owner-svn-src-head@freebsd.org Wed May 30 02:47:24 2018 Return-Path: Delivered-To: svn-src-head@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 2E4CBEF61C8; Wed, 30 May 2018 02:47:24 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D3A976AB62; Wed, 30 May 2018 02:47:23 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B237024B5A; Wed, 30 May 2018 02:47:23 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4U2lNaK034965; Wed, 30 May 2018 02:47:23 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4U2lNTc034964; Wed, 30 May 2018 02:47:23 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201805300247.w4U2lNTc034964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 30 May 2018 02:47:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334366 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 334366 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 02:47:24 -0000 Author: jhibbits Date: Wed May 30 02:47:23 2018 New Revision: 334366 URL: https://svnweb.freebsd.org/changeset/base/334366 Log: Cache the phandle of the PCI node in opal_pci_attach Simple cleanup, no functional change. This is related to the fixups needed for POWER9 support. Modified: head/sys/powerpc/powernv/opal_pci.c Modified: head/sys/powerpc/powernv/opal_pci.c ============================================================================== --- head/sys/powerpc/powernv/opal_pci.c Wed May 30 02:41:47 2018 (r334365) +++ head/sys/powerpc/powernv/opal_pci.c Wed May 30 02:47:23 2018 (r334366) @@ -200,25 +200,27 @@ opalpci_attach(device_t dev) { struct opalpci_softc *sc; cell_t id[2], m64window[6], npe; + phandle_t node; int i, err; uint64_t maxmem; uint64_t entries; int rid; sc = device_get_softc(dev); + node = ofw_bus_get_node(dev); - switch (OF_getproplen(ofw_bus_get_node(dev), "ibm,opal-phbid")) { + switch (OF_getproplen(node, "ibm,opal-phbid")) { case 8: - OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-phbid", id, 8); + OF_getencprop(node, "ibm,opal-phbid", id, 8); sc->phb_id = ((uint64_t)id[0] << 32) | id[1]; break; case 4: - OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-phbid", id, 4); + OF_getencprop(node, "ibm,opal-phbid", id, 4); sc->phb_id = id[0]; break; default: device_printf(dev, "PHB ID property had wrong length (%zd)\n", - OF_getproplen(ofw_bus_get_node(dev), "ibm,opal-phbid")); + OF_getproplen(node, "ibm,opal-phbid")); return (ENXIO); } @@ -264,8 +266,7 @@ opalpci_attach(device_t dev) /* * Turn on MMIO, mapped to PE 1 */ - if (OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-num-pes", &npe, 4) - != 4) + if (OF_getencprop(node, "ibm,opal-num-pes", &npe, 4) != 4) npe = 1; for (i = 0; i < npe; i++) { err = opal_call(OPAL_PCI_MAP_PE_MMIO_WINDOW, sc->phb_id, @@ -275,7 +276,7 @@ opalpci_attach(device_t dev) } /* XXX: multiple M64 windows? */ - if (OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-m64-window", + if (OF_getencprop(node, "ibm,opal-m64-window", m64window, sizeof(m64window)) == sizeof(m64window)) { opal_call(OPAL_PCI_PHB_MMIO_ENABLE, sc->phb_id, OPAL_M64_WINDOW_TYPE, 0, 0); @@ -342,9 +343,9 @@ opalpci_attach(device_t dev) * Get MSI properties */ sc->msi_vmem = NULL; - if (OF_getproplen(ofw_bus_get_node(dev), "ibm,opal-msi-ranges") > 0) { + if (OF_getproplen(node, "ibm,opal-msi-ranges") > 0) { cell_t msi_ranges[2]; - OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-msi-ranges", + OF_getencprop(node, "ibm,opal-msi-ranges", msi_ranges, sizeof(msi_ranges)); sc->msi_base = msi_ranges[0]; @@ -352,7 +353,7 @@ opalpci_attach(device_t dev) msi_ranges[1], 1, 16, M_BESTFIT | M_WAITOK); sc->base_msi_irq = powerpc_register_pic(dev, - OF_xref_from_node(ofw_bus_get_node(dev)), + OF_xref_from_node(node), msi_ranges[0] + msi_ranges[1], 0, FALSE); if (bootverbose) @@ -377,7 +378,7 @@ opalpci_attach(device_t dev) /* * OPAL stores 64-bit BARs in a special property rather than "ranges" */ - if (OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-m64-window", + if (OF_getencprop(node, "ibm,opal-m64-window", m64window, sizeof(m64window)) == sizeof(m64window)) { struct ofw_pci_range *rp; From owner-svn-src-head@freebsd.org Wed May 30 03:00:58 2018 Return-Path: Delivered-To: svn-src-head@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 960DAEF6DB8; Wed, 30 May 2018 03:00:58 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475BC6B1F9; Wed, 30 May 2018 03:00:58 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2880624D32; Wed, 30 May 2018 03:00:58 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4U30wOL041303; Wed, 30 May 2018 03:00:58 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4U30wlv041302; Wed, 30 May 2018 03:00:58 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201805300300.w4U30wlv041302@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 30 May 2018 03:00:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334367 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 334367 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 03:00:58 -0000 Author: jhibbits Date: Wed May 30 03:00:57 2018 New Revision: 334367 URL: https://svnweb.freebsd.org/changeset/base/334367 Log: Make opal_pci driver work with POWER9 Summary: Coupled with r334365, this makes PCI work on POWER9. There is still more to do to fully exploit the hardware capabilities, but this is sufficient to enable USB and ethernet controllers on a POWER9 Talos II system. Reviewed by: nwhitehorn, leitao Differential Revision: https://reviews.freebsd.org/D15566 Modified: head/sys/powerpc/powernv/opal_pci.c Modified: head/sys/powerpc/powernv/opal_pci.c ============================================================================== --- head/sys/powerpc/powernv/opal_pci.c Wed May 30 02:47:23 2018 (r334366) +++ head/sys/powerpc/powernv/opal_pci.c Wed May 30 03:00:57 2018 (r334367) @@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$"); #include "opal.h" #define OPAL_PCI_TCE_MAX_ENTRIES (1024*1024UL) -#define OPAL_PCI_TCE_SEG_SIZE (16*1024*1024UL) +#define OPAL_PCI_TCE_DEFAULT_SEG_SIZE (16*1024*1024UL) #define OPAL_PCI_TCE_R (1UL << 0) #define OPAL_PCI_TCE_W (1UL << 1) #define PHB3_TCE_KILL_INVAL_ALL (1UL << 63) @@ -195,15 +195,52 @@ pci_phb3_tce_invalidate_entire(struct opalpci_softc *s mb(); } +/* Simple function to round to a power of 2 */ +static uint64_t +round_pow2(uint64_t val) +{ + + return (1 << (flsl(val + (val - 1)) - 1)); +} + +/* + * Starting with skiboot 5.10 PCIe nodes have a new property, + * "ibm,supported-tce-sizes", to denote the TCE sizes available. This allows us + * to avoid hard-coding the maximum TCE size allowed, and instead provide a sane + * default (however, the "sane" default, which works for all targets, is 64k, + * limiting us to 64GB if we have 1M entries. + */ +static uint64_t +max_tce_size(device_t dev) +{ + phandle_t node; + cell_t sizes[64]; /* Property is a list of bit-widths, up to 64-bits */ + int count; + + node = ofw_bus_get_node(dev); + + count = OF_getencprop(node, "ibm,supported-tce-sizes", + sizes, sizeof(sizes)); + if (count < sizeof(cell_t)) + return OPAL_PCI_TCE_DEFAULT_SEG_SIZE; + + count /= sizeof(cell_t); + + return (1ULL << sizes[count - 1]); +} + static int opalpci_attach(device_t dev) { struct opalpci_softc *sc; - cell_t id[2], m64window[6], npe; + cell_t id[2], m64ranges[2], m64window[6], npe; phandle_t node; int i, err; uint64_t maxmem; uint64_t entries; + uint64_t tce_size; + uint64_t tce_tbl_size; + int m64bar; int rid; sc = device_get_softc(dev); @@ -236,6 +273,7 @@ opalpci_attach(device_t dev) return (ENXIO); } +#if 0 /* * Reset PCI IODA table */ @@ -245,11 +283,32 @@ opalpci_attach(device_t dev) device_printf(dev, "IODA table reset failed: %d\n", err); return (ENXIO); } - while ((err = opal_call(OPAL_PCI_POLL, sc->phb_id)) > 0) - DELAY(1000*(err + 1)); /* Returns expected delay in ms */ + err = opal_call(OPAL_PCI_RESET, sc->phb_id, OPAL_RESET_PHB_COMPLETE, + 1); if (err < 0) { + device_printf(dev, "PHB reset failed: %d\n", err); + return (ENXIO); + } + if (err > 0) { + while ((err = opal_call(OPAL_PCI_POLL, sc->phb_id)) > 0) { + DELAY(1000*(err + 1)); /* Returns expected delay in ms */ + } + } + if (err < 0) { device_printf(dev, "WARNING: PHB IODA reset poll failed: %d\n", err); } + err = opal_call(OPAL_PCI_RESET, sc->phb_id, OPAL_RESET_PHB_COMPLETE, + 0); + if (err < 0) { + device_printf(dev, "PHB reset failed: %d\n", err); + return (ENXIO); + } + if (err > 0) { + while ((err = opal_call(OPAL_PCI_POLL, sc->phb_id)) > 0) { + DELAY(1000*(err + 1)); /* Returns expected delay in ms */ + } + } +#endif /* * Map all devices on the bus to partitionable endpoint one until @@ -275,49 +334,58 @@ opalpci_attach(device_t dev) device_printf(dev, "MMIO %d map failed: %d\n", i, err); } + if (OF_getencprop(node, "ibm,opal-available-m64-ranges", + m64ranges, sizeof(m64ranges)) == sizeof(m64ranges)) + m64bar = m64ranges[0]; + else + m64bar = 0; + /* XXX: multiple M64 windows? */ if (OF_getencprop(node, "ibm,opal-m64-window", m64window, sizeof(m64window)) == sizeof(m64window)) { opal_call(OPAL_PCI_PHB_MMIO_ENABLE, sc->phb_id, - OPAL_M64_WINDOW_TYPE, 0, 0); + OPAL_M64_WINDOW_TYPE, m64bar, 0); opal_call(OPAL_PCI_SET_PHB_MEM_WINDOW, sc->phb_id, - OPAL_M64_WINDOW_TYPE, 0 /* index */, + OPAL_M64_WINDOW_TYPE, m64bar /* index */, ((uint64_t)m64window[2] << 32) | m64window[3], 0, ((uint64_t)m64window[4] << 32) | m64window[5]); opal_call(OPAL_PCI_MAP_PE_MMIO_WINDOW, sc->phb_id, OPAL_PCI_DEFAULT_PE, OPAL_M64_WINDOW_TYPE, - 0 /* index */, 0); + m64bar /* index */, 0); opal_call(OPAL_PCI_PHB_MMIO_ENABLE, sc->phb_id, - OPAL_M64_WINDOW_TYPE, 0, OPAL_ENABLE_M64_NON_SPLIT); + OPAL_M64_WINDOW_TYPE, m64bar, OPAL_ENABLE_M64_NON_SPLIT); } /* * Enable IOMMU for PE1 - map everything 1:1 using - * segments of OPAL_PCI_TCE_SEG_SIZE size + * segments of max_tce_size size */ - maxmem = roundup2(powerpc_ptob(Maxmem), OPAL_PCI_TCE_SEG_SIZE); - entries = maxmem / OPAL_PCI_TCE_SEG_SIZE; + tce_size = max_tce_size(dev); + maxmem = roundup2(powerpc_ptob(Maxmem), tce_size); + entries = round_pow2(maxmem / tce_size); + tce_tbl_size = max(entries * sizeof(uint64_t), 4096); + device_printf(dev, "Entries: %ld, tce_size: %#lx\n", entries, tce_size); if (entries > OPAL_PCI_TCE_MAX_ENTRIES) panic("POWERNV supports only %jdGB of memory space\n", - (uintmax_t)((OPAL_PCI_TCE_MAX_ENTRIES * OPAL_PCI_TCE_SEG_SIZE) >> 30)); + (uintmax_t)((OPAL_PCI_TCE_MAX_ENTRIES * tce_size) >> 30)); if (bootverbose) device_printf(dev, "Mapping 0-%#jx for DMA\n", (uintmax_t)maxmem); - sc->tce = contigmalloc(OPAL_PCI_TCE_MAX_ENTRIES * sizeof(uint64_t), + sc->tce = contigmalloc(tce_tbl_size, M_DEVBUF, M_NOWAIT | M_ZERO, 0, - BUS_SPACE_MAXADDR_32BIT, OPAL_PCI_TCE_SEG_SIZE, 0); + BUS_SPACE_MAXADDR, tce_size, 0); if (sc->tce == NULL) panic("Failed to allocate TCE memory for PHB %jd\n", (uintmax_t)sc->phb_id); for (i = 0; i < entries; i++) - sc->tce[i] = (i * OPAL_PCI_TCE_SEG_SIZE) | OPAL_PCI_TCE_R | OPAL_PCI_TCE_W; + sc->tce[i] = (i * tce_size) | OPAL_PCI_TCE_R | OPAL_PCI_TCE_W; /* Map TCE for every PE. It seems necessary for Power8 */ for (i = 0; i < npe; i++) { err = opal_call(OPAL_PCI_MAP_PE_DMA_WINDOW, sc->phb_id, i, (i << 1), 1, pmap_kextract((uint64_t)&sc->tce[0]), - OPAL_PCI_TCE_MAX_ENTRIES * sizeof(uint64_t), OPAL_PCI_TCE_SEG_SIZE); + tce_tbl_size, tce_size); if (err != 0) { device_printf(dev, "DMA IOMMU mapping failed: %d\n", err); return (ENXIO); From owner-svn-src-head@freebsd.org Wed May 30 03:39:58 2018 Return-Path: Delivered-To: svn-src-head@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 BF687EF8F5F; Wed, 30 May 2018 03:39:58 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6D27A6C78D; Wed, 30 May 2018 03:39:58 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E454253F1; Wed, 30 May 2018 03:39:58 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4U3dwA2061192; Wed, 30 May 2018 03:39:58 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4U3dvSI061191; Wed, 30 May 2018 03:39:57 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805300339.w4U3dvSI061191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Wed, 30 May 2018 03:39:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334368 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 334368 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 03:39:59 -0000 Author: mmacy Date: Wed May 30 03:39:57 2018 New Revision: 334368 URL: https://svnweb.freebsd.org/changeset/base/334368 Log: epoch(9): make epoch closer to style(9) Modified: head/sys/kern/subr_epoch.c head/sys/sys/epoch.h Modified: head/sys/kern/subr_epoch.c ============================================================================== --- head/sys/kern/subr_epoch.c Wed May 30 03:00:57 2018 (r334367) +++ head/sys/kern/subr_epoch.c Wed May 30 03:39:57 2018 (r334368) @@ -72,49 +72,54 @@ SYSCTL_NODE(_kern_epoch, OID_AUTO, stats, CTLFLAG_RW, /* Stats. */ static counter_u64_t block_count; + SYSCTL_COUNTER_U64(_kern_epoch_stats, OID_AUTO, nblocked, CTLFLAG_RW, - &block_count, "# of times a thread was in an epoch when epoch_wait was called"); + &block_count, "# of times a thread was in an epoch when epoch_wait was called"); static counter_u64_t migrate_count; + SYSCTL_COUNTER_U64(_kern_epoch_stats, OID_AUTO, migrations, CTLFLAG_RW, - &migrate_count, "# of times thread was migrated to another CPU in epoch_wait"); + &migrate_count, "# of times thread was migrated to another CPU in epoch_wait"); static counter_u64_t turnstile_count; + SYSCTL_COUNTER_U64(_kern_epoch_stats, OID_AUTO, ncontended, CTLFLAG_RW, - &turnstile_count, "# of times a thread was blocked on a lock in an epoch during an epoch_wait"); + &turnstile_count, "# of times a thread was blocked on a lock in an epoch during an epoch_wait"); static counter_u64_t switch_count; + SYSCTL_COUNTER_U64(_kern_epoch_stats, OID_AUTO, switches, CTLFLAG_RW, - &switch_count, "# of times a thread voluntarily context switched in epoch_wait"); + &switch_count, "# of times a thread voluntarily context switched in epoch_wait"); static counter_u64_t epoch_call_count; + SYSCTL_COUNTER_U64(_kern_epoch_stats, OID_AUTO, epoch_calls, CTLFLAG_RW, - &epoch_call_count, "# of times a callback was deferred"); + &epoch_call_count, "# of times a callback was deferred"); static counter_u64_t epoch_call_task_count; + SYSCTL_COUNTER_U64(_kern_epoch_stats, OID_AUTO, epoch_call_tasks, CTLFLAG_RW, - &epoch_call_task_count, "# of times a callback task was run"); + &epoch_call_task_count, "# of times a callback task was run"); -TAILQ_HEAD(threadlist, thread); +TAILQ_HEAD (threadlist, thread); CK_STACK_CONTAINER(struct ck_epoch_entry, stack_entry, ck_epoch_entry_container) - typedef struct epoch_record { ck_epoch_record_t er_record; volatile struct threadlist er_tdlist; volatile uint32_t er_gen; uint32_t er_cpuid; -} *epoch_record_t; +} *epoch_record_t; struct epoch_pcpu_state { struct epoch_record eps_record; -} __aligned(EPOCH_ALIGN); +} __aligned(EPOCH_ALIGN); struct epoch { struct ck_epoch e_epoch __aligned(EPOCH_ALIGN); struct epoch_pcpu_state *e_pcpu_dom[MAXMEMDOM] __aligned(EPOCH_ALIGN); - int e_idx; - int e_flags; + int e_idx; + int e_flags; struct epoch_pcpu_state *e_pcpu[0]; }; -epoch_t allepochs[MAX_EPOCHS]; +epoch_t allepochs[MAX_EPOCHS]; DPCPU_DEFINE(struct grouptask, epoch_cb_task); DPCPU_DEFINE(int, epoch_cb_count); @@ -154,7 +159,7 @@ epoch_init(void *arg __unused) printf("domcount[%d] %d\n", domain, domcount[domain]); } for (domain = 1; domain < vm_ndomains; domain++) - domoffsets[domain] = domoffsets[domain-1] + domcount[domain-1]; + domoffsets[domain] = domoffsets[domain - 1] + domcount[domain - 1]; for (domain = 0; domain < vm_ndomains; domain++) { if (domcount[domain] == 0) { @@ -162,7 +167,7 @@ epoch_init(void *arg __unused) break; } } - done: +done: CPU_FOREACH(cpu) { GROUPTASK_INIT(DPCPU_ID_PTR(cpu, epoch_cb_task), 0, epoch_call_task, NULL); taskqgroup_attach_cpu(qgroup_softirq, DPCPU_ID_PTR(cpu, epoch_cb_task), NULL, cpu, -1, "epoch call task"); @@ -171,6 +176,7 @@ epoch_init(void *arg __unused) global_epoch = epoch_alloc(0); global_epoch_preempt = epoch_alloc(EPOCH_PREEMPT); } + SYSINIT(epoch, SI_SUB_TASKQ + 1, SI_ORDER_FIRST, epoch_init, NULL); static void @@ -181,8 +187,8 @@ epoch_init_numa(epoch_t epoch) epoch_record_t er; for (domain = 0; domain < vm_ndomains; domain++) { - eps = malloc_domain(sizeof(*eps)*domcount[domain], M_EPOCH, - domain, M_ZERO|M_WAITOK); + eps = malloc_domain(sizeof(*eps) * domcount[domain], M_EPOCH, + domain, M_ZERO | M_WAITOK); epoch->e_pcpu_dom[domain] = eps; cpu_offset = domoffsets[domain]; for (int i = 0; i < domcount[domain]; i++, eps++) { @@ -201,7 +207,7 @@ epoch_init_legacy(epoch_t epoch) struct epoch_pcpu_state *eps; epoch_record_t er; - eps = malloc(sizeof(*eps)*mp_ncpus, M_EPOCH, M_ZERO|M_WAITOK); + eps = malloc(sizeof(*eps) * mp_ncpus, M_EPOCH, M_ZERO | M_WAITOK); epoch->e_pcpu_dom[0] = eps; for (int i = 0; i < mp_ncpus; i++, eps++) { epoch->e_pcpu[i] = eps; @@ -219,14 +225,14 @@ epoch_alloc(int flags) if (__predict_false(!inited)) panic("%s called too early in boot", __func__); - epoch = malloc(sizeof(struct epoch) + mp_ncpus*sizeof(void*), - M_EPOCH, M_ZERO|M_WAITOK); + epoch = malloc(sizeof(struct epoch) + mp_ncpus * sizeof(void *), + M_EPOCH, M_ZERO | M_WAITOK); ck_epoch_init(&epoch->e_epoch); if (usedomains) epoch_init_numa(epoch); else epoch_init_legacy(epoch); - MPASS(epoch_count < MAX_EPOCHS-2); + MPASS(epoch_count < MAX_EPOCHS - 2); epoch->e_flags = flags; epoch->e_idx = epoch_count; allepochs[epoch_count++] = epoch; @@ -280,8 +286,8 @@ epoch_enter_preempt_internal(epoch_t epoch, struct thr int found = 0; TAILQ_FOREACH(curtd, &eps->eps_record.er_tdlist, td_epochq) - if (curtd == td) - found = 1; + if (curtd == td) + found = 1; KASSERT(found, ("recursing on a second epoch")); critical_exit(); return; @@ -289,7 +295,7 @@ epoch_enter_preempt_internal(epoch_t epoch, struct thr #endif TAILQ_INSERT_TAIL(&eps->eps_record.er_tdlist, td, td_epochq); sched_pin(); - ck_epoch_begin(&eps->eps_record.er_record, (ck_epoch_section_t*)&td->td_epoch_section); + ck_epoch_begin(&eps->eps_record.er_record, (ck_epoch_section_t *)&td->td_epoch_section); critical_exit(); } @@ -320,7 +326,7 @@ epoch_exit_preempt_internal(epoch_t epoch, struct thre eps = epoch->e_pcpu[curcpu]; MPASS(epoch->e_flags & EPOCH_PREEMPT); - ck_epoch_end(&eps->eps_record.er_record, (ck_epoch_section_t*)&td->td_epoch_section); + ck_epoch_end(&eps->eps_record.er_record, (ck_epoch_section_t *)&td->td_epoch_section); TAILQ_REMOVE(&eps->eps_record.er_tdlist, td, td_epochq); eps->eps_record.er_gen++; sched_unpin(); @@ -351,7 +357,7 @@ epoch_exit(epoch_t epoch) */ static void epoch_block_handler_preempt(struct ck_epoch *global __unused, ck_epoch_record_t *cr, - void *arg __unused) + void *arg __unused) { epoch_record_t record; struct thread *td, *tdwait, *owner; @@ -370,18 +376,17 @@ epoch_block_handler_preempt(struct ck_epoch *global __ * overhead of a migration */ if ((tdwait = TAILQ_FIRST(&record->er_tdlist)) != NULL && - TD_IS_RUNNING(tdwait)) { + TD_IS_RUNNING(tdwait)) { gen = record->er_gen; thread_unlock(td); do { cpu_spinwait(); } while (tdwait == TAILQ_FIRST(&record->er_tdlist) && - gen == record->er_gen && TD_IS_RUNNING(tdwait) && - spincount++ < MAX_ADAPTIVE_SPIN); + gen == record->er_gen && TD_IS_RUNNING(tdwait) && + spincount++ < MAX_ADAPTIVE_SPIN); thread_lock(td); return; } - /* * Being on the same CPU as that of the record on which * we need to wait allows us access to the thread @@ -403,7 +408,7 @@ epoch_block_handler_preempt(struct ck_epoch *global __ return; } /* - * Try to find a thread in an epoch section on this CPU + * Try to find a thread in an epoch section on this CPU * waiting on a turnstile. Otherwise find the lowest * priority thread (highest prio value) and drop our priority * to match to allow it to run. @@ -424,7 +429,7 @@ epoch_block_handler_preempt(struct ck_epoch *global __ critical_exit(); } if (TD_IS_INHIBITED(tdwait) && TD_ON_LOCK(tdwait) && - ((ts = tdwait->td_blocked) != NULL)) { + ((ts = tdwait->td_blocked) != NULL)) { /* * We unlock td to allow turnstile_wait to reacquire the * the thread lock. Before unlocking it we enter a critical @@ -455,7 +460,7 @@ epoch_block_handler_preempt(struct ck_epoch *global __ thread_lock(td); critical_exit(); KASSERT(td->td_locks == 0, - ("%d locks held", td->td_locks)); + ("%d locks held", td->td_locks)); } } /* @@ -529,12 +534,12 @@ epoch_wait_preempt(epoch_t epoch) thread_unlock(td); PICKUP_GIANT(); KASSERT(td->td_locks == locks, - ("%d residual locks held", td->td_locks - locks)); + ("%d residual locks held", td->td_locks - locks)); } static void epoch_block_handler(struct ck_epoch *g __unused, ck_epoch_record_t *c __unused, - void *arg __unused) + void *arg __unused) { cpu_spinwait(); } @@ -567,10 +572,10 @@ epoch_call(epoch_t epoch, epoch_context_t ctx, void (* critical_enter(); *DPCPU_PTR(epoch_cb_count) += 1; eps = epoch->e_pcpu[curcpu]; - ck_epoch_call(&eps->eps_record.er_record, cb, (ck_epoch_cb_t*)callback); + ck_epoch_call(&eps->eps_record.er_record, cb, (ck_epoch_cb_t *)callback); critical_exit(); return; - boottime: +boottime: callback(ctx); } @@ -605,7 +610,8 @@ epoch_call_task(void *arg __unused) head = ck_stack_batch_pop_npsc(&cb_stack); for (cursor = head; cursor != NULL; cursor = next) { struct ck_epoch_entry *entry = - ck_epoch_entry_container(cursor); + ck_epoch_entry_container(cursor); + next = CK_STACK_NEXT(cursor); entry->function(entry); } Modified: head/sys/sys/epoch.h ============================================================================== --- head/sys/sys/epoch.h Wed May 30 03:00:57 2018 (r334367) +++ head/sys/sys/epoch.h Wed May 30 03:39:57 2018 (r334368) @@ -44,21 +44,21 @@ extern epoch_t global_epoch; extern epoch_t global_epoch_preempt; struct epoch_context { - void *data[2]; -} __aligned(sizeof(void *)); + void *data[2]; +} __aligned(sizeof(void *)); typedef struct epoch_context *epoch_context_t; -epoch_t epoch_alloc(int flags); -void epoch_free(epoch_t epoch); -void epoch_enter(epoch_t epoch); -void epoch_enter_preempt_internal(epoch_t epoch, struct thread *td); -void epoch_exit(epoch_t epoch); -void epoch_exit_preempt_internal(epoch_t epoch, struct thread *td); -void epoch_wait(epoch_t epoch); -void epoch_wait_preempt(epoch_t epoch); -void epoch_call(epoch_t epoch, epoch_context_t ctx, void (*callback) (epoch_context_t)); -int in_epoch(void); +epoch_t epoch_alloc(int flags); +void epoch_free(epoch_t epoch); +void epoch_enter(epoch_t epoch); +void epoch_enter_preempt_internal(epoch_t epoch, struct thread *td); +void epoch_exit(epoch_t epoch); +void epoch_exit_preempt_internal(epoch_t epoch, struct thread *td); +void epoch_wait(epoch_t epoch); +void epoch_wait_preempt(epoch_t epoch); +void epoch_call(epoch_t epoch, epoch_context_t ctx, void (*callback) (epoch_context_t)); +int in_epoch(void); #ifdef _KERNEL DPCPU_DECLARE(int, epoch_cb_count); @@ -88,5 +88,5 @@ epoch_exit_preempt(epoch_t epoch) if (td->td_epochnest-- == 1) epoch_exit_preempt_internal(epoch, td); } -#endif /* _KERNEL */ +#endif /* _KERNEL */ #endif From owner-svn-src-head@freebsd.org Wed May 30 03:40:06 2018 Return-Path: Delivered-To: svn-src-head@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 6AE69EF8F98; Wed, 30 May 2018 03:40:06 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0F1716C810; Wed, 30 May 2018 03:40:03 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 51F91253F6; Wed, 30 May 2018 03:40:03 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4U3e3ts061281; Wed, 30 May 2018 03:40:03 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4U3e3GJ061280; Wed, 30 May 2018 03:40:03 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805300340.w4U3e3GJ061280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Wed, 30 May 2018 03:40:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334369 - head/lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/lib/libpmc X-SVN-Commit-Revision: 334369 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 03:40:06 -0000 Author: mmacy Date: Wed May 30 03:40:02 2018 New Revision: 334369 URL: https://svnweb.freebsd.org/changeset/base/334369 Log: libpmc: bring pmu_util closer in line with style(9) Modified: head/lib/libpmc/libpmc_pmu_util.c (contents, props changed) Modified: head/lib/libpmc/libpmc_pmu_util.c ============================================================================== --- head/lib/libpmc/libpmc_pmu_util.c Wed May 30 03:39:57 2018 (r334368) +++ head/lib/libpmc/libpmc_pmu_util.c Wed May 30 03:40:02 2018 (r334369) @@ -46,21 +46,21 @@ struct pmu_alias { const char *pa_name; }; static struct pmu_alias pmu_alias_table[] = { - { "UNHALTED_CORE_CYCLES", "CPU_CLK_UNHALTED.THREAD_P_ANY"}, - { "UNHALTED-CORE-CYCLES", "CPU_CLK_UNHALTED.THREAD_P_ANY"}, - { "LLC_MISSES", "LONGEST_LAT_CACHE.MISS"}, - { "LLC-MISSES", "LONGEST_LAT_CACHE.MISS"}, - { "LLC_REFERENCE", "LONGEST_LAT_CACHE.REFERENCE"}, - { "LLC-REFERENCE", "LONGEST_LAT_CACHE.REFERENCE"}, - { "LLC_MISS_RHITM", "mem_load_l3_miss_retired.remote_hitm"}, - { "LLC-MISS-RHITM", "mem_load_l3_miss_retired.remote_hitm"}, - { "RESOURCE_STALL", "RESOURCE_STALLS.ANY"}, - { "RESOURCE_STALLS_ANY", "RESOURCE_STALLS.ANY"}, - { "BRANCH_INSTRUCTION_RETIRED", "BR_INST_RETIRED.ALL_BRANCHES"}, - { "BRANCH-INSTRUCTION-RETIRED", "BR_INST_RETIRED.ALL_BRANCHES"}, - { "BRANCH_MISSES_RETIRED", "BR_MISP_RETIRED.ALL_BRANCHES"}, - { "BRANCH-MISSES-RETIRED", "BR_MISP_RETIRED.ALL_BRANCHES"}, - { NULL, NULL }, + {"UNHALTED_CORE_CYCLES", "CPU_CLK_UNHALTED.THREAD_P_ANY"}, + {"UNHALTED-CORE-CYCLES", "CPU_CLK_UNHALTED.THREAD_P_ANY"}, + {"LLC_MISSES", "LONGEST_LAT_CACHE.MISS"}, + {"LLC-MISSES", "LONGEST_LAT_CACHE.MISS"}, + {"LLC_REFERENCE", "LONGEST_LAT_CACHE.REFERENCE"}, + {"LLC-REFERENCE", "LONGEST_LAT_CACHE.REFERENCE"}, + {"LLC_MISS_RHITM", "mem_load_l3_miss_retired.remote_hitm"}, + {"LLC-MISS-RHITM", "mem_load_l3_miss_retired.remote_hitm"}, + {"RESOURCE_STALL", "RESOURCE_STALLS.ANY"}, + {"RESOURCE_STALLS_ANY", "RESOURCE_STALLS.ANY"}, + {"BRANCH_INSTRUCTION_RETIRED", "BR_INST_RETIRED.ALL_BRANCHES"}, + {"BRANCH-INSTRUCTION-RETIRED", "BR_INST_RETIRED.ALL_BRANCHES"}, + {"BRANCH_MISSES_RETIRED", "BR_MISP_RETIRED.ALL_BRANCHES"}, + {"BRANCH-MISSES-RETIRED", "BR_MISP_RETIRED.ALL_BRANCHES"}, + {NULL, NULL}, }; static const char *fixed_mode_cntrs[] = { @@ -89,13 +89,13 @@ struct pmu_event_desc { uint32_t ped_frontend; uint32_t ped_ldlat; uint32_t ped_config1; - uint8_t ped_umask; - uint8_t ped_cmask; - uint8_t ped_any; - uint8_t ped_inv; - uint8_t ped_edge; - uint8_t ped_fc_mask; - uint8_t ped_ch_mask; + uint8_t ped_umask; + uint8_t ped_cmask; + uint8_t ped_any; + uint8_t ped_inv; + uint8_t ped_edge; + uint8_t ped_fc_mask; + uint8_t ped_ch_mask; }; static const struct pmu_events_map * @@ -106,10 +106,10 @@ pmu_events_map_get(void) const struct pmu_events_map *pme; if (sysctlbyname("kern.hwpmc.cpuid", (void *)NULL, &s, - (void *)NULL, 0) == -1) + (void *)NULL, 0) == -1) return (NULL); if (sysctlbyname("kern.hwpmc.cpuid", buf, &s, - (void *)NULL, 0) == -1) + (void *)NULL, 0) == -1) return (NULL); for (pme = pmu_events_map; pme->cpuid != NULL; pme++) if (strcmp(buf, pme->cpuid) == 0) @@ -147,8 +147,7 @@ pmc_pmu_event_get_by_idx(int idx) if ((pme = pmu_events_map_get()) == NULL) return (NULL); - for (i = 0, pe = pme->table; (pe->name || pe->desc || pe->event) && i < idx; pe++, i++) - ; + for (i = 0, pe = pme->table; (pe->name || pe->desc || pe->event) && i < idx; pe++, i++); return (pe->name); } @@ -237,7 +236,7 @@ pmc_pmu_print_counters(void) struct pmu_event_desc ped; char *debug; int do_debug; - + debug = getenv("PMUDEBUG"); do_debug = 0; @@ -266,8 +265,8 @@ pmc_pmu_print_counter_desc(const char *ev) if (pe->name == NULL) continue; if (strcasestr(pe->name, ev) != NULL && - pe->desc != NULL) - printf("%s:\t%s\n", pe->name, pe->desc); + pe->desc != NULL) + printf("%s:\t%s\n", pe->name, pe->desc); } } @@ -318,12 +317,11 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc for (idx = 0; fixed_mode_cntrs[idx] != NULL; idx++) if (strcmp(fixed_mode_cntrs[idx], event_name) == 0) isfixed = 1; - if (isfixed) { if (strcasestr(pe->desc, "retired") != NULL) pm->pm_ev = PMC_EV_IAF_INSTR_RETIRED_ANY; else if (strcasestr(pe->desc, "core") != NULL || - strcasestr(pe->desc, "unhalted")) + strcasestr(pe->desc, "unhalted")) pm->pm_ev = PMC_EV_IAF_CPU_CLK_UNHALTED_CORE; else if (strcasestr(pe->desc, "ref") != NULL) pm->pm_ev = PMC_EV_IAF_CPU_CLK_UNHALTED_REF; @@ -378,13 +376,49 @@ pmc_pmu_stat_mode(const char ***cntrs) } #else -uint64_t pmc_pmu_sample_rate_get(const char *event_name __unused) { return (DEFAULT_SAMPLE_COUNT); } -void pmc_pmu_print_counters(void) {} -void pmc_pmu_print_counter_desc(const char *e __unused) {} -void pmc_pmu_print_counter_desc_long(const char *e __unused) {} -int pmc_pmu_enabled(void) { return (0); } -int pmc_pmu_pmcallocate(const char *e __unused, struct pmc_op_pmcallocate *p __unused) { return (EOPNOTSUPP); } -const char *pmc_pmu_event_get_by_idx(int idx __unused) { return (NULL); } -int pmc_pmu_stat_mode(const char ***a __unused) { return (EOPNOTSUPP); } + +uint64_t +pmc_pmu_sample_rate_get(const char *event_name __unused) +{ + return (DEFAULT_SAMPLE_COUNT); +} + +void +pmc_pmu_print_counters(void) +{ +} + +void +pmc_pmu_print_counter_desc(const char *e __unused) +{ +} + +void +pmc_pmu_print_counter_desc_long(const char *e __unused) +{ +} + +int +pmc_pmu_enabled(void) +{ + return (0); +} + +int +pmc_pmu_pmcallocate(const char *e __unused, struct pmc_op_pmcallocate *p __unused) +{ + return (EOPNOTSUPP); +} + +const char * +pmc_pmu_event_get_by_idx(int idx __unused) +{ + return (NULL); +} +int +pmc_pmu_stat_mode(const char ***a __unused) +{ + return (EOPNOTSUPP); +} #endif From owner-svn-src-head@freebsd.org Wed May 30 03:48:28 2018 Return-Path: Delivered-To: svn-src-head@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 A59E4EF9726; Wed, 30 May 2018 03:48:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 54B026CEED; Wed, 30 May 2018 03:48:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 35B0925597; Wed, 30 May 2018 03:48:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4U3mS6g066085; Wed, 30 May 2018 03:48:28 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4U3mSKM066084; Wed, 30 May 2018 03:48:28 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201805300348.w4U3mSKM066084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 30 May 2018 03:48:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334370 - head/sys/cddl/dev/dtrace/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/cddl/dev/dtrace/powerpc X-SVN-Commit-Revision: 334370 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 03:48:28 -0000 Author: jhibbits Date: Wed May 30 03:48:27 2018 New Revision: 334370 URL: https://svnweb.freebsd.org/changeset/base/334370 Log: Protect dtrace_getpcstack() from a NULL stack pointer in a trap frame Found when trying to use lockstat on a POWER9, the stack pointer (r1) could be NULL, and result in a NULL pointer dereference, crashing the kernel. Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Wed May 30 03:40:02 2018 (r334369) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Wed May 30 03:48:27 2018 (r334370) @@ -98,6 +98,7 @@ static __inline uintptr_t dtrace_next_sp(uintptr_t sp) { vm_offset_t callpc; + uintptr_t *r1; struct trapframe *frame; #ifdef __powerpc64__ @@ -114,7 +115,10 @@ dtrace_next_sp(uintptr_t sp) callpc + OFFSET == (vm_offset_t) &asttrapexit)) { /* Access the trap frame */ frame = (struct trapframe *)(sp + FRAME_OFFSET); - return (*(uintptr_t *)(frame->fixreg[1])); + r1 = (uintptr_t *)frame->fixreg[1]; + if (r1 == NULL) + return (0); + return (*r1); } return (*(uintptr_t*)sp); From owner-svn-src-head@freebsd.org Wed May 30 03:55:11 2018 Return-Path: Delivered-To: svn-src-head@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 A5290EF9E53; Wed, 30 May 2018 03:55:11 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-lf0-x229.google.com (mail-lf0-x229.google.com [IPv6:2a00:1450:4010:c07::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 10A926D62C; Wed, 30 May 2018 03:55:11 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-lf0-x229.google.com with SMTP id y72-v6so2007223lfd.2; Tue, 29 May 2018 20:55:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=d7iI7Wrf4P3XkVXteU/33MEGll9R2l4tIFz6WMAkzcc=; b=gwRDNyNkOUg+n5N6j4lJmvGACb23UpYqirF6w3hRhuOZ8ABqZ6fi0d21lw3Aw+MJ0U WzSlC5vy1W1bW9S/NEMIH2TgHbJOPJip5AWV/1aA8L1Ajh3h7oP2d+oNTHHsgk2HyYc2 s2781YJ7aLyQfuFnWGhc4FIPkfZlpNk7FN2pyI4kKpmoydLKDasTlxRHzAi+oemQzjzv UEoBUvKc1Diovm6cDcGwk5wwjyY9l0nhIFhGI00iuxFkbrnF/Pkb834tHabY8vIqdLp0 m1YMNY21SMaGUfCDBFg90jAHFtgh9Ly+6F32TB4ZPBb+zPp6le3R/Oj31P7/B2FKY5Ft 3LlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=d7iI7Wrf4P3XkVXteU/33MEGll9R2l4tIFz6WMAkzcc=; b=dklGcT4VWx947D8ipXsk9G92RhN1b4P+nOxtflzf+V1SNVSRfA3X2RnGHaBijTFyZ7 jnxc3W35A7zqpxFV/BOFYsy7eazkOnAX931PizwANa+pm115DbhdN772n6Dpc28a1kwp baOqmNZPyhBeHovXQmbH7LpMzGbIAHRpX8zxwN1Bjj9R2uSBYD4yNj2SPGvWC0XxO2J9 6G+wQMKt1NMGWIp7z8IJxfY/8gFh4T+iMja/k5Yp8Me5GlQysGtbaoDyO205acABqgOR QMY6C3xV6vUO2nuaVLXpE0fDe2aBsBoWfeo+zvxaILePRXUIeaCXQWOwrNM4k+rsx9J6 6nYQ== X-Gm-Message-State: ALKqPwdVyZWBVTS9AJJNbam01kfnQ9ihDK/Rr/B+V8vKPvGne5+rNDQr fii94KJDQSYsQWvUIL2dPwZ5iJOGO1pzL5AvsxU= X-Google-Smtp-Source: ADUXVKLa4mBcw/X92gsG99dz8zDcK3j3FhkzLxOf6mPhZFz1sqB/U0VWtZGOPop/F5m94NL4V70qJjzqnL9vh4BkbLs= X-Received: by 2002:a19:c452:: with SMTP id u79-v6mr502208lff.5.1527652508473; Tue, 29 May 2018 20:55:08 -0700 (PDT) MIME-Version: 1.0 Sender: chmeeedalf@gmail.com Received: by 2002:a2e:3a13:0:0:0:0:0 with HTTP; Tue, 29 May 2018 20:55:07 -0700 (PDT) In-Reply-To: <201805300300.w4U30wlv041302@repo.freebsd.org> References: <201805300300.w4U30wlv041302@repo.freebsd.org> From: Justin Hibbits Date: Tue, 29 May 2018 22:55:07 -0500 X-Google-Sender-Auth: TeaMXP1Pv2juTn04UgjYI_h-SgM Message-ID: Subject: Re: svn commit: r334367 - head/sys/powerpc/powernv To: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 03:55:11 -0000 On Tue, May 29, 2018 at 10:00 PM, Justin Hibbits wrote: > Author: jhibbits > Date: Wed May 30 03:00:57 2018 > New Revision: 334367 > URL: https://svnweb.freebsd.org/changeset/base/334367 > > Log: > Make opal_pci driver work with POWER9 > > Summary: > Coupled with r334365, this makes PCI work on POWER9. There is still more to > do to fully exploit the hardware capabilities, but this is sufficient to > enable USB and ethernet controllers on a POWER9 Talos II system. As mmacy pointed out, it's PCIe. POWER9 has no PCI controller, only PCIe. - Justin From owner-svn-src-head@freebsd.org Wed May 30 04:12:52 2018 Return-Path: Delivered-To: svn-src-head@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 42A0DEFAF80; Wed, 30 May 2018 04:12:52 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D43556E16B; Wed, 30 May 2018 04:12:51 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B0B1325A9A; Wed, 30 May 2018 04:12:51 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4U4CpxI081057; Wed, 30 May 2018 04:12:51 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4U4CpGc081056; Wed, 30 May 2018 04:12:51 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805300412.w4U4CpGc081056@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Wed, 30 May 2018 04:12:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334371 - head/lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/lib/libpmc X-SVN-Commit-Revision: 334371 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 04:12:52 -0000 Author: mmacy Date: Wed May 30 04:12:51 2018 New Revision: 334371 URL: https://svnweb.freebsd.org/changeset/base/334371 Log: libpmc: squelch valgrind warnings Modified: head/lib/libpmc/libpmc.c Modified: head/lib/libpmc/libpmc.c ============================================================================== --- head/lib/libpmc/libpmc.c Wed May 30 03:48:27 2018 (r334370) +++ head/lib/libpmc/libpmc.c Wed May 30 04:12:51 2018 (r334371) @@ -3277,6 +3277,7 @@ pmc_init(void) return (pmc_syscall = -1); } + bzero(&op_cpu_info, sizeof(op_cpu_info)); if (PMC_CALL(GETCPUINFO, &op_cpu_info) < 0) return (pmc_syscall = -1); @@ -3284,7 +3285,7 @@ pmc_init(void) cpu_info.pm_ncpu = op_cpu_info.pm_ncpu; cpu_info.pm_npmc = op_cpu_info.pm_npmc; cpu_info.pm_nclass = op_cpu_info.pm_nclass; - for (n = 0; n < cpu_info.pm_nclass; n++) + for (n = 0; n < op_cpu_info.pm_nclass; n++) memcpy(&cpu_info.pm_classes[n], &op_cpu_info.pm_classes[n], sizeof(cpu_info.pm_classes[n])); From owner-svn-src-head@freebsd.org Wed May 30 04:15:34 2018 Return-Path: Delivered-To: svn-src-head@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 765A2EFB152; Wed, 30 May 2018 04:15:34 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 154F26E308; Wed, 30 May 2018 04:15:34 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E511325A9D; Wed, 30 May 2018 04:15:33 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4U4FXpp081211; Wed, 30 May 2018 04:15:33 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4U4FX1r081210; Wed, 30 May 2018 04:15:33 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201805300415.w4U4FX1r081210@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Wed, 30 May 2018 04:15:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334372 - head/sys/dev/vt/hw/ofwfb X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: head/sys/dev/vt/hw/ofwfb X-SVN-Commit-Revision: 334372 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 04:15:34 -0000 Author: nwhitehorn Date: Wed May 30 04:15:33 2018 New Revision: 334372 URL: https://svnweb.freebsd.org/changeset/base/334372 Log: If linebytes property is missing from the graphics device, assume no overscan and synthesize it from the display depth and screen width. This may not be right, but it sometimes right and is better than returning CN_DEAD. Modified: head/sys/dev/vt/hw/ofwfb/ofwfb.c Modified: head/sys/dev/vt/hw/ofwfb/ofwfb.c ============================================================================== --- head/sys/dev/vt/hw/ofwfb/ofwfb.c Wed May 30 04:12:51 2018 (r334371) +++ head/sys/dev/vt/hw/ofwfb/ofwfb.c Wed May 30 04:15:33 2018 (r334372) @@ -394,8 +394,7 @@ ofwfb_init(struct vt_device *vd) /* Make sure we have needed properties */ if (OF_getproplen(node, "height") != sizeof(height) || OF_getproplen(node, "width") != sizeof(width) || - OF_getproplen(node, "depth") != sizeof(depth) || - OF_getproplen(node, "linebytes") != sizeof(sc->fb.fb_stride)) + OF_getproplen(node, "depth") != sizeof(depth)) return (CN_DEAD); /* Only support 8 and 32-bit framebuffers */ @@ -406,7 +405,9 @@ ofwfb_init(struct vt_device *vd) OF_getprop(node, "height", &height, sizeof(height)); OF_getprop(node, "width", &width, sizeof(width)); - OF_getprop(node, "linebytes", &stride, sizeof(stride)); + if (OF_getprop(node, "linebytes", &stride, sizeof(stride)) != + sizeof(stride)) + stride = width*depth/8; sc->fb.fb_height = height; sc->fb.fb_width = width; From owner-svn-src-head@freebsd.org Wed May 30 05:00:32 2018 Return-Path: Delivered-To: svn-src-head@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 F1292EFD344; Wed, 30 May 2018 05:00:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A32116F4E3; Wed, 30 May 2018 05:00:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8135F26104; Wed, 30 May 2018 05:00:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4U50Vma001423; Wed, 30 May 2018 05:00:31 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4U50VZ9001422; Wed, 30 May 2018 05:00:31 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201805300500.w4U50VZ9001422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 30 May 2018 05:00:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334373 - head X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 334373 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 05:00:32 -0000 Author: imp Date: Wed May 30 05:00:30 2018 New Revision: 334373 URL: https://svnweb.freebsd.org/changeset/base/334373 Log: We've removed the special case code for upgrading from FreeBSD 9 so remove the special warning. It's in svn if we need it. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed May 30 04:15:33 2018 (r334372) +++ head/UPDATING Wed May 30 05:00:30 2018 (r334373) @@ -32,25 +32,6 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: "ln -s 'abort:false,junk:false' /etc/malloc.conf".) -****************************** SPECIAL WARNING: ****************************** - - Due to a bug in some versions of clang that's very hard to workaround in - the upgrade process, to upgrade to -current you must first upgrade - either stable/9 after r286035 or stable/10 after r286033 (including - 10.3-RELEASE) or current after r286007 (including stable/11 and - 11.0-RELEASE). These revisions post-date the 10.2 and 9.3 releases, so - you'll need to take the unusual step of upgrading to the tip of the - stable branch before moving to 11 or -current via a source upgrade. - stable/11 and 11.0-RELEASE have working newer compiler. This differs - from the historical situation where one could upgrade from anywhere on - the last couple of stable branches, so be careful. - - If you're running a hybrid system on 9.x or 10.x with an updated clang - compiler or are using an supported external toolchain, the build system - will allow the upgrade. Otherwise it will print a reminder. - -****************************** SPECIAL WARNING: ****************************** - 20180523: The on-disk format for hwpmc callchain records has changed to include threadid corresponding to a given record. This changes the field offsets From owner-svn-src-head@freebsd.org Wed May 30 06:05:00 2018 Return-Path: Delivered-To: svn-src-head@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 1E76EF6E73C; Wed, 30 May 2018 06:05:00 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qt0-x22c.google.com (mail-qt0-x22c.google.com [IPv6:2607:f8b0:400d:c0d::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 924EA711B4; Wed, 30 May 2018 06:04:59 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-qt0-x22c.google.com with SMTP id c2-v6so21834940qtn.9; Tue, 29 May 2018 23:04:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Mx0NT5Jbrt53KuG/YveMh/R29+AJel5zI3msAK+sZSE=; b=aOK5n05DXDZCGtXhouGovCFow9yspHF9r3cIfFp3F16O7o2OAy8VJ1uLwYN2V13FhG 93P8/L1it1WXYsb5IyhR/fNlHtk9jrKYd5IEKJYA82UUEjJMObIZfURkTICEQgDGxvwR 8D3FFl2dwPRdmXSDxkzT+XBbvMcmMsRz2oh/eMsobCulLx9Rod+6OHEPsUTr4dnycZ1I PJ4zZ0COjwGQPEL7iuKie1GDmHHTy4z12/U6r6wANhhD/xCw46lanVmuinArZUYws5U6 AG1lRv2HvoaAnAkAnwB61Bug1wT4PX/fq+czy0rLFdF2IdWob/WXFOjQYmig5Nmg6MCV e5VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Mx0NT5Jbrt53KuG/YveMh/R29+AJel5zI3msAK+sZSE=; b=M1BoBlxuGY44iuBqm0o8fSWUs277H/cTLtTv6+YQCKFAqqlquLdfdP5tdjinz6kven w5EZFsigHN8rckM7rj/BhIj9IIW5WiX6e8Ka1+WfdtnBCd10C/DLA5hsibEF5sLN6KZF Qa13RdoXQPY4jypqazU/i++hEUJd9lRRSMuqD3CxEeQV9HSQe2j+OmAu3xjP9QIlUhNm 5DK7hKzd0HTzo0tTXUruFaFQ+QdhDcm5U32+285fPdXAmSF8njRnDNlCZtfCqkjrKu78 FQH9FniBi93PEgHOGsq8X+O4bwAiXs5zkq8GKnb0Fs0tYR2cmlnQce2ZxAEHRFNsJYrd 8deA== X-Gm-Message-State: APt69E3ldq33zp0VGmK1U/tI43cZoOnmE3CMx/QReMNxCUIRpYnrwkC4 +g9JmIQiOCm47eTARfb81haOWTSDGe1QAKLe4f1ZMg== X-Google-Smtp-Source: ADUXVKIRsQQNxT8ZA9JQxAn7k6xD6Y2XTngtOn+WfPbjQvQ7ZXeVV7KVLqFFiu8ftGHaNTBhWFu47Z3QlOERn3/8Lfo= X-Received: by 2002:ac8:1488:: with SMTP id l8-v6mr1239588qtj.182.1527660298926; Tue, 29 May 2018 23:04:58 -0700 (PDT) MIME-Version: 1.0 Sender: antoine.brodin.freebsd@gmail.com Received: by 2002:a0c:accf:0:0:0:0:0 with HTTP; Tue, 29 May 2018 23:04:58 -0700 (PDT) In-Reply-To: <201805280812.w4S8CI56046943@repo.freebsd.org> References: <201805280812.w4S8CI56046943@repo.freebsd.org> From: Antoine Brodin Date: Wed, 30 May 2018 08:04:58 +0200 X-Google-Sender-Auth: Ct5hYs_nB9Q9OqiM-L4keFHlYyo Message-ID: Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Hans Petter Selasky Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 06:05:00 -0000 On Mon, May 28, 2018 at 10:12 AM, Hans Petter Selasky wrote: > Author: hselasky > Date: Mon May 28 08:12:18 2018 > New Revision: 334277 > URL: https://svnweb.freebsd.org/changeset/base/334277 > > Log: > MFV r333789: libpcap 1.9.0 (pre-release) > > MFC after: 1 month > Sponsored by: Mellanox Technologies Hi, Some things seem to be missing. For instance, pcap_setsampling and pcap_open are now declared in pcap.h but they are not compiled in libpcap.so. net/p5-Net-Pcap is confused by this: http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/p5-Net-Pcap-0.18.log Cheers, Antoine From owner-svn-src-head@freebsd.org Wed May 30 06:29:23 2018 Return-Path: Delivered-To: svn-src-head@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 82519F700B2; Wed, 30 May 2018 06:29:23 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3458971F07; Wed, 30 May 2018 06:29:23 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 157B926F9E; Wed, 30 May 2018 06:29:23 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4U6TMaj046626; Wed, 30 May 2018 06:29:22 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4U6TMjG046625; Wed, 30 May 2018 06:29:22 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805300629.w4U6TMjG046625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Wed, 30 May 2018 06:29:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334374 - head/sys/dev/hwpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/dev/hwpmc X-SVN-Commit-Revision: 334374 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 06:29:23 -0000 Author: mmacy Date: Wed May 30 06:29:22 2018 New Revision: 334374 URL: https://svnweb.freebsd.org/changeset/base/334374 Log: hwpmc: remove stale assert Reported by: eadler Modified: head/sys/dev/hwpmc/hwpmc_mod.c Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Wed May 30 05:00:30 2018 (r334373) +++ head/sys/dev/hwpmc/hwpmc_mod.c Wed May 30 06:29:22 2018 (r334374) @@ -2197,7 +2197,6 @@ pmc_hook_handler(struct thread *td, int function, void break; case PMC_FN_MMAP: - MPASS(in_epoch() || sx_xlocked(&pmc_sx)); pmc_process_mmap(td, (struct pmckern_map_in *) arg); break; From owner-svn-src-head@freebsd.org Wed May 30 07:04:53 2018 Return-Path: Delivered-To: svn-src-head@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 EC390F7221A; Wed, 30 May 2018 07:04:52 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D02D73368; Wed, 30 May 2018 07:04:52 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 063382600D5; Wed, 30 May 2018 09:04:49 +0200 (CEST) Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805280812.w4S8CI56046943@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <383666b1-06a9-ac96-812f-c602c8e5e5af@selasky.org> Date: Wed, 30 May 2018 09:04:37 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 07:04:53 -0000 On 05/30/18 08:04, Antoine Brodin wrote: > On Mon, May 28, 2018 at 10:12 AM, Hans Petter Selasky > wrote: >> Author: hselasky >> Date: Mon May 28 08:12:18 2018 >> New Revision: 334277 >> URL: https://svnweb.freebsd.org/changeset/base/334277 >> >> Log: >> MFV r333789: libpcap 1.9.0 (pre-release) >> >> MFC after: 1 month >> Sponsored by: Mellanox Technologies > > Hi, > > Some things seem to be missing. > For instance, pcap_setsampling and pcap_open are now declared in > pcap.h but they are not compiled in libpcap.so. > net/p5-Net-Pcap is confused by this: > http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/p5-Net-Pcap-0.18.log > I'll have a look. --HPS From owner-svn-src-head@freebsd.org Wed May 30 07:11:36 2018 Return-Path: Delivered-To: svn-src-head@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 C2592F72B5E; Wed, 30 May 2018 07:11:36 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 753FA73868; Wed, 30 May 2018 07:11:36 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 55C862766F; Wed, 30 May 2018 07:11:36 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4U7BaKL067025; Wed, 30 May 2018 07:11:36 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4U7BYjS066960; Wed, 30 May 2018 07:11:34 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201805300711.w4U7BYjS066960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 30 May 2018 07:11:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334375 - in head/sys: net netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: in head/sys: net netpfil/pf X-SVN-Commit-Revision: 334375 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 07:11:37 -0000 Author: kp Date: Wed May 30 07:11:33 2018 New Revision: 334375 URL: https://svnweb.freebsd.org/changeset/base/334375 Log: pf: Replace rwlock on PF_RULES_LOCK with rmlock Given that PF_RULES_LOCK is a mostly read lock, replace the rwlock with rmlock. This change improves packet processing rate in high pps environments. Benchmarking by olivier@ shows a 65% improvement in pps. While here, also eliminate all appearances of "sys/rwlock.h" includes since it is not used anymore. Submitted by: farrokhi@ Differential Revision: https://reviews.freebsd.org/D15502 Modified: head/sys/net/pfvar.h head/sys/netpfil/pf/if_pfsync.c head/sys/netpfil/pf/pf.c head/sys/netpfil/pf/pf_if.c head/sys/netpfil/pf/pf_ioctl.c head/sys/netpfil/pf/pf_lb.c head/sys/netpfil/pf/pf_norm.c head/sys/netpfil/pf/pf_osfp.c head/sys/netpfil/pf/pf_table.c Modified: head/sys/net/pfvar.h ============================================================================== --- head/sys/net/pfvar.h Wed May 30 06:29:22 2018 (r334374) +++ head/sys/net/pfvar.h Wed May 30 07:11:33 2018 (r334375) @@ -38,8 +38,10 @@ #include #include #include +#include #include #include +#include #include #include @@ -147,14 +149,15 @@ extern struct mtx pf_unlnkdrules_mtx; #define PF_UNLNKDRULES_LOCK() mtx_lock(&pf_unlnkdrules_mtx) #define PF_UNLNKDRULES_UNLOCK() mtx_unlock(&pf_unlnkdrules_mtx) -extern struct rwlock pf_rules_lock; -#define PF_RULES_RLOCK() rw_rlock(&pf_rules_lock) -#define PF_RULES_RUNLOCK() rw_runlock(&pf_rules_lock) -#define PF_RULES_WLOCK() rw_wlock(&pf_rules_lock) -#define PF_RULES_WUNLOCK() rw_wunlock(&pf_rules_lock) -#define PF_RULES_ASSERT() rw_assert(&pf_rules_lock, RA_LOCKED) -#define PF_RULES_RASSERT() rw_assert(&pf_rules_lock, RA_RLOCKED) -#define PF_RULES_WASSERT() rw_assert(&pf_rules_lock, RA_WLOCKED) +extern struct rmlock pf_rules_lock; +#define PF_RULES_RLOCK_TRACKER struct rm_priotracker _pf_rules_tracker +#define PF_RULES_RLOCK() rm_rlock(&pf_rules_lock, &_pf_rules_tracker) +#define PF_RULES_RUNLOCK() rm_runlock(&pf_rules_lock, &_pf_rules_tracker) +#define PF_RULES_WLOCK() rm_wlock(&pf_rules_lock) +#define PF_RULES_WUNLOCK() rm_wunlock(&pf_rules_lock) +#define PF_RULES_ASSERT() rm_assert(&pf_rules_lock, RA_LOCKED) +#define PF_RULES_RASSERT() rm_assert(&pf_rules_lock, RA_RLOCKED) +#define PF_RULES_WASSERT() rm_assert(&pf_rules_lock, RA_WLOCKED) extern struct sx pf_end_lock; Modified: head/sys/netpfil/pf/if_pfsync.c ============================================================================== --- head/sys/netpfil/pf/if_pfsync.c Wed May 30 06:29:22 2018 (r334374) +++ head/sys/netpfil/pf/if_pfsync.c Wed May 30 07:11:33 2018 (r334375) @@ -587,6 +587,8 @@ pfsync_input(struct mbuf **mp, int *offp __unused, int int rv; uint16_t count; + PF_RULES_RLOCK_TRACKER; + *mp = NULL; V_pfsyncstats.pfsyncs_ipackets++; Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Wed May 30 06:29:22 2018 (r334374) +++ head/sys/netpfil/pf/pf.c Wed May 30 07:11:33 2018 (r334375) @@ -5874,6 +5874,8 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct struct pf_pdesc pd; int off, dirndx, pqid = 0; + PF_RULES_RLOCK_TRACKER; + M_ASSERTPKTHDR(m); if (!V_pf_status.running) @@ -6261,6 +6263,7 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struc struct pf_pdesc pd; int off, terminal = 0, dirndx, rh_cnt = 0, pqid = 0; + PF_RULES_RLOCK_TRACKER; M_ASSERTPKTHDR(m); if (!V_pf_status.running) Modified: head/sys/netpfil/pf/pf_if.c ============================================================================== --- head/sys/netpfil/pf/pf_if.c Wed May 30 06:29:22 2018 (r334374) +++ head/sys/netpfil/pf/pf_if.c Wed May 30 07:11:33 2018 (r334375) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- head/sys/netpfil/pf/pf_ioctl.c Wed May 30 06:29:22 2018 (r334374) +++ head/sys/netpfil/pf/pf_ioctl.c Wed May 30 07:11:33 2018 (r334375) @@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -202,7 +201,7 @@ VNET_DEFINE(int, pf_vnet_active); int pf_end_threads; struct proc *pf_purge_proc; -struct rwlock pf_rules_lock; +struct rmlock pf_rules_lock; struct sx pf_ioctl_lock; struct sx pf_end_lock; @@ -995,6 +994,7 @@ static int pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { int error = 0; + PF_RULES_RLOCK_TRACKER; /* XXX keep in sync with switch() below */ if (securelevel_gt(td->td_ucred, 2)) @@ -3924,7 +3924,7 @@ pf_load(void) { int error; - rw_init(&pf_rules_lock, "pf rulesets"); + rm_init(&pf_rules_lock, "pf rulesets"); sx_init(&pf_ioctl_lock, "pf ioctl"); sx_init(&pf_end_lock, "pf end thread"); @@ -3997,7 +3997,7 @@ pf_unload(void) pfi_cleanup(); - rw_destroy(&pf_rules_lock); + rm_destroy(&pf_rules_lock); sx_destroy(&pf_ioctl_lock); sx_destroy(&pf_end_lock); } Modified: head/sys/netpfil/pf/pf_lb.c ============================================================================== --- head/sys/netpfil/pf/pf_lb.c Wed May 30 06:29:22 2018 (r334374) +++ head/sys/netpfil/pf/pf_lb.c Wed May 30 07:11:33 2018 (r334375) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/netpfil/pf/pf_norm.c ============================================================================== --- head/sys/netpfil/pf/pf_norm.c Wed May 30 06:29:22 2018 (r334374) +++ head/sys/netpfil/pf/pf_norm.c Wed May 30 07:11:33 2018 (r334375) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/netpfil/pf/pf_osfp.c ============================================================================== --- head/sys/netpfil/pf/pf_osfp.c Wed May 30 06:29:22 2018 (r334374) +++ head/sys/netpfil/pf/pf_osfp.c Wed May 30 07:11:33 2018 (r334375) @@ -27,7 +27,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/netpfil/pf/pf_table.c ============================================================================== --- head/sys/netpfil/pf/pf_table.c Wed May 30 06:29:22 2018 (r334374) +++ head/sys/netpfil/pf/pf_table.c Wed May 30 07:11:33 2018 (r334375) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include From owner-svn-src-head@freebsd.org Wed May 30 07:31:49 2018 Return-Path: Delivered-To: svn-src-head@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 69EC0F74051; Wed, 30 May 2018 07:31:49 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 06F4374473; Wed, 30 May 2018 07:31:49 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 032402600D5; Wed, 30 May 2018 09:31:47 +0200 (CEST) Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool From: Hans Petter Selasky To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805280812.w4S8CI56046943@repo.freebsd.org> <383666b1-06a9-ac96-812f-c602c8e5e5af@selasky.org> Message-ID: <21342cd6-bf7e-263f-f077-2e073fe9ebef@selasky.org> Date: Wed, 30 May 2018 09:31:35 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <383666b1-06a9-ac96-812f-c602c8e5e5af@selasky.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 07:31:49 -0000 On 05/30/18 09:04, Hans Petter Selasky wrote: > On 05/30/18 08:04, Antoine Brodin wrote: >> On Mon, May 28, 2018 at 10:12 AM, Hans Petter Selasky >> wrote: >>> Author: hselasky >>> Date: Mon May 28 08:12:18 2018 >>> New Revision: 334277 >>> URL: https://svnweb.freebsd.org/changeset/base/334277 >>> >>> Log: >>>    MFV r333789: libpcap 1.9.0 (pre-release) >>> >>>    MFC after:    1 month >>>    Sponsored by: Mellanox Technologies >> >> Hi, >> >> Some things seem to be missing. >> For instance,  pcap_setsampling and pcap_open are now declared in >> pcap.h but they are not compiled in libpcap.so. >> net/p5-Net-Pcap is confused by this: >> http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/p5-Net-Pcap-0.18.log > Hi, net/p5-Net-Pcap is supposed to depend on and use net/libpcap which install into /usr/local/lib and /usr/local/include from what I understand. --HPS From owner-svn-src-head@freebsd.org Wed May 30 07:36:24 2018 Return-Path: Delivered-To: svn-src-head@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 B6010F745FE; Wed, 30 May 2018 07:36:24 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qt0-x233.google.com (mail-qt0-x233.google.com [IPv6:2607:f8b0:400d:c0d::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4988074939; Wed, 30 May 2018 07:36:24 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-qt0-x233.google.com with SMTP id g13-v6so22043116qth.8; Wed, 30 May 2018 00:36:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=kgvhvLUvwxaQHJK+pSi3JneyWhK/p9AETRASupldhLU=; b=c/dOg872v3LAEXEBxgDL8ZhLPUQ1pjSF3EmYoWGIwbJ2zT2h3kCh/SiUXRsb7DhNdv uegYSMEOCnk4cd/mHr9Ws7RS73v1PU+V/kJaMHwcoSV0hyNA2PD8IsRS1sS0XZ4mlAEx RUe5ooq8sa+kgjRsKhgufZkI2LKWzayDMi0alrxEZd4aOq1PvP8QE/iCgLN1nBRsNa/u PvOiGqh5hj9g4YACgO7znWdmNM9Eju5jdDN8/BNXDtLEaLT85bB614uiv/5k5tOnsP5b sL54Ju7i3Qvm3Z3LlogCczY+JwcQUoyaxTV4gJ+FVBgjrAO47oZyZfSum9JI7wQIZtwK S7sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=kgvhvLUvwxaQHJK+pSi3JneyWhK/p9AETRASupldhLU=; b=oajI1ZB+iIpxqZWI5xmD0+DYzdS/HiAWWZMA6XdKS4afHiEJwtlmXdpB22D43es/qX IzVAUNuRrhKxwy3Eb+uNO13+ddwmkksEvMBUfJzAtjPqQv2wDGxGDcQ5u1bzvofqERJy U0aXbDBb6BY+QuEY9PV320qww3bh0X1mzr1RR4WHaxOU+c96jPapOTrtPMF2WRn4vhCq twDstcE6iAa+ofzGY6f3ilCxcsYtpCi055o7a63YoCcVzwmC5NXYi49gJRyz3CGBHy44 /cddgB5UxAb8p+/cjjD85fo7vh9QDs6O2VljvHI96FZXO13RRgQGz33ssk8usdTtwj+a VeeQ== X-Gm-Message-State: APt69E0i2ip+u3ssofQUfmqg6wDwwhW6nkRIWN4vpMAN5HJmFtY+BG7U T7N+ZSo3Q7kJ2LyKqSWv2H4wYbI85ixDqq35k3HU+A== X-Google-Smtp-Source: ADUXVKLO9lnReUfQtgxb7NDNz8KjGV9+ec/G7BqCXSW7F48ePRNoxs/dX0NxwNC5Tt1P+i7muO6tqemvbl9E1vKvBdg= X-Received: by 2002:aed:3ed8:: with SMTP id o24-v6mr1483388qtf.177.1527665783938; Wed, 30 May 2018 00:36:23 -0700 (PDT) MIME-Version: 1.0 Sender: antoine.brodin.freebsd@gmail.com Received: by 2002:a0c:accf:0:0:0:0:0 with HTTP; Wed, 30 May 2018 00:36:23 -0700 (PDT) In-Reply-To: <21342cd6-bf7e-263f-f077-2e073fe9ebef@selasky.org> References: <201805280812.w4S8CI56046943@repo.freebsd.org> <383666b1-06a9-ac96-812f-c602c8e5e5af@selasky.org> <21342cd6-bf7e-263f-f077-2e073fe9ebef@selasky.org> From: Antoine Brodin Date: Wed, 30 May 2018 07:36:23 +0000 X-Google-Sender-Auth: x9lLWaiNMzR8RxmpL7P43ogqkS8 Message-ID: Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Hans Petter Selasky Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 07:36:25 -0000 On Wed, May 30, 2018 at 7:31 AM, Hans Petter Selasky wrote: > On 05/30/18 09:04, Hans Petter Selasky wrote: >> >> On 05/30/18 08:04, Antoine Brodin wrote: >>> >>> On Mon, May 28, 2018 at 10:12 AM, Hans Petter Selasky >>> wrote: >>>> >>>> Author: hselasky >>>> Date: Mon May 28 08:12:18 2018 >>>> New Revision: 334277 >>>> URL: https://svnweb.freebsd.org/changeset/base/334277 >>>> >>>> Log: >>>> MFV r333789: libpcap 1.9.0 (pre-release) >>>> >>>> MFC after: 1 month >>>> Sponsored by: Mellanox Technologies >>> >>> >>> Hi, >>> >>> Some things seem to be missing. >>> For instance, pcap_setsampling and pcap_open are now declared in >>> pcap.h but they are not compiled in libpcap.so. >>> net/p5-Net-Pcap is confused by this: >>> >>> http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/p5-Net-Pcap-0.18.log >> >> > > Hi, > > net/p5-Net-Pcap is supposed to depend on and use net/libpcap which install > into /usr/local/lib and /usr/local/include from what I understand. No, it worked fine with libpcap from base previously. pcap/pcap.h now exposes functions from pcap-new.c but pcap-new.c is not compiled. Antoine From owner-svn-src-head@freebsd.org Wed May 30 07:52:47 2018 Return-Path: Delivered-To: svn-src-head@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 36E14F756DE; Wed, 30 May 2018 07:52:47 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4EC475586; Wed, 30 May 2018 07:52:46 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 02C5A260174; Wed, 30 May 2018 09:52:44 +0200 (CEST) Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805280812.w4S8CI56046943@repo.freebsd.org> <383666b1-06a9-ac96-812f-c602c8e5e5af@selasky.org> <21342cd6-bf7e-263f-f077-2e073fe9ebef@selasky.org> From: Hans Petter Selasky Message-ID: <1cbed89b-e485-7f15-d3ab-f018024203eb@selasky.org> Date: Wed, 30 May 2018 09:52:32 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 07:52:47 -0000 On 05/30/18 09:36, Antoine Brodin wrote: > On Wed, May 30, 2018 at 7:31 AM, Hans Petter Selasky wrote: >> On 05/30/18 09:04, Hans Petter Selasky wrote: >>> >>> On 05/30/18 08:04, Antoine Brodin wrote: >>>> >>>> On Mon, May 28, 2018 at 10:12 AM, Hans Petter Selasky >>>> wrote: >>>>> >>>>> Author: hselasky >>>>> Date: Mon May 28 08:12:18 2018 >>>>> New Revision: 334277 >>>>> URL: https://svnweb.freebsd.org/changeset/base/334277 >>>>> >>>>> Log: >>>>> MFV r333789: libpcap 1.9.0 (pre-release) >>>>> >>>>> MFC after: 1 month >>>>> Sponsored by: Mellanox Technologies >>>> >>>> >>>> Hi, >>>> >>>> Some things seem to be missing. >>>> For instance, pcap_setsampling and pcap_open are now declared in >>>> pcap.h but they are not compiled in libpcap.so. >>>> net/p5-Net-Pcap is confused by this: >>>> >>>> http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/p5-Net-Pcap-0.18.log >>> >>> >> >> Hi, >> >> net/p5-Net-Pcap is supposed to depend on and use net/libpcap which install >> into /usr/local/lib and /usr/local/include from what I understand. > > No, it worked fine with libpcap from base previously. > pcap/pcap.h now exposes functions from pcap-new.c but pcap-new.c is > not compiled. Hi, pcap-new.c is only compiled if libpcap should have remote support, which the in-base library didn't have? Can you try to modify the net/p5-Net-Pcap Makefile like this: BUILD_DEPENDS= p5-IO-Interface>=0:net/p5-IO-Interface \ libpcap>=0:net/libpcap CFLAGS+= -I${PREFIX}/include LDFLAGS+= -L${PREFIX}/lib --HPS From owner-svn-src-head@freebsd.org Wed May 30 08:02:13 2018 Return-Path: Delivered-To: svn-src-head@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 CDE25F76172; Wed, 30 May 2018 08:02:13 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qt0-x244.google.com (mail-qt0-x244.google.com [IPv6:2607:f8b0:400d:c0d::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6365A75ADE; Wed, 30 May 2018 08:02:13 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-qt0-x244.google.com with SMTP id h5-v6so14107357qtm.13; Wed, 30 May 2018 01:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=LtObeZd/6ippPpKOO/sRj4arWUmHcqS1T5XyCE1zbEc=; b=YOldjOmR9hx5mGcbj/PRbsNExdohcMBnNvgQyqg4p9UNqvwNk24bVEf/J4MxvT8rc0 AxanXzkGi3TLChV/JhkA71k+q+sjjrYOZaEAq0othI0D2H2ncIO1eVbhG/V/N1SrLGnR 6zH92lqmDW8bKvM7J9rJh7f89x6ZTpZjYiwTG8TlbQlSBFO4h4KzPf/h+G6M2rWotWYO 5Er8Lc98ERLgJponUEb6lvhtRYaWI4XYIcu5Ge3w2JQ/yI0fYDIN/w8vjit+CFSVr8ay FUXbsnzu4Gy/mfbtb/cA9/O0vO/s7FE9W1srto1rRbx/ElZD5aM/O9kef5rnKWpdJfNa 6SNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=LtObeZd/6ippPpKOO/sRj4arWUmHcqS1T5XyCE1zbEc=; b=RkA3MQODJkl1kSEgOVtuJcbgRwM7ezlHKk+QVYAqVR5QapbRWFAuktzKFOjDYRN+6V PqDGCZOe0v/QTUNHVzOTLOdM1zwwqKrdP55j8w+lfhrJJ9BUSqDs69jVu91UTbmbvCRC WKMQ4Z4lYxGT5bRnO2BTS8IvXtQt6+eRVg7glSiwBRvZ3fZ9+31HxwEWUEIRi2kHeNCp tSMUyrr29HMDtG/E6ky0DRT4IpnfqM/UQEECuD6aK9KUkAarAhKqkofXHAlhsVndyLER flVWVoaWkC94Ssw1kWbaH383KkrfFsK7jBD9TlaqD8U4NtGBLAMdXmYI4s4wM5Rgtu4t nk9g== X-Gm-Message-State: APt69E3nTDQgiqwPRCQL2MWBJC49vJrq3t86tMFQk9tno6jzpO25BkMm t+hh6d9BaETimquMSW0q8O9eupyKhfarPoxCPEc= X-Google-Smtp-Source: ADUXVKI7GkXR6GsyXUNxPOtJH4YHj+W80fS+fVrYUSEZYY3T88hEOVu8sqsL+ve2/K5b4JI1ZMkIN0pRQpsloYhAF1E= X-Received: by 2002:ac8:1b7b:: with SMTP id p56-v6mr1517694qtk.254.1527667332922; Wed, 30 May 2018 01:02:12 -0700 (PDT) MIME-Version: 1.0 Sender: antoine.brodin.freebsd@gmail.com Received: by 2002:a0c:accf:0:0:0:0:0 with HTTP; Wed, 30 May 2018 01:02:12 -0700 (PDT) In-Reply-To: <1cbed89b-e485-7f15-d3ab-f018024203eb@selasky.org> References: <201805280812.w4S8CI56046943@repo.freebsd.org> <383666b1-06a9-ac96-812f-c602c8e5e5af@selasky.org> <21342cd6-bf7e-263f-f077-2e073fe9ebef@selasky.org> <1cbed89b-e485-7f15-d3ab-f018024203eb@selasky.org> From: Antoine Brodin Date: Wed, 30 May 2018 08:02:12 +0000 X-Google-Sender-Auth: S6qtF5osJgkeK3GQAlkCJV43p4U Message-ID: Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Hans Petter Selasky Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 08:02:14 -0000 On Wed, May 30, 2018 at 7:52 AM, Hans Petter Selasky wrote: > On 05/30/18 09:36, Antoine Brodin wrote: >> >> On Wed, May 30, 2018 at 7:31 AM, Hans Petter Selasky >> wrote: >>> >>> On 05/30/18 09:04, Hans Petter Selasky wrote: >>>> >>>> >>>> On 05/30/18 08:04, Antoine Brodin wrote: >>>>> >>>>> >>>>> On Mon, May 28, 2018 at 10:12 AM, Hans Petter Selasky >>>>> wrote: >>>>>> >>>>>> >>>>>> Author: hselasky >>>>>> Date: Mon May 28 08:12:18 2018 >>>>>> New Revision: 334277 >>>>>> URL: https://svnweb.freebsd.org/changeset/base/334277 >>>>>> >>>>>> Log: >>>>>> MFV r333789: libpcap 1.9.0 (pre-release) >>>>>> >>>>>> MFC after: 1 month >>>>>> Sponsored by: Mellanox Technologies >>>>> >>>>> >>>>> >>>>> Hi, >>>>> >>>>> Some things seem to be missing. >>>>> For instance, pcap_setsampling and pcap_open are now declared in >>>>> pcap.h but they are not compiled in libpcap.so. >>>>> net/p5-Net-Pcap is confused by this: >>>>> >>>>> >>>>> http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/p5-Net-Pcap-0.18.log >>>> >>>> >>>> >>> >>> Hi, >>> >>> net/p5-Net-Pcap is supposed to depend on and use net/libpcap which >>> install >>> into /usr/local/lib and /usr/local/include from what I understand. >> >> >> No, it worked fine with libpcap from base previously. >> pcap/pcap.h now exposes functions from pcap-new.c but pcap-new.c is >> not compiled. > > > Hi, > > pcap-new.c is only compiled if libpcap should have remote support, which the > in-base library didn't have? > > Can you try to modify the net/p5-Net-Pcap Makefile like this: > > BUILD_DEPENDS= p5-IO-Interface>=0:net/p5-IO-Interface \ > libpcap>=0:net/libpcap > > CFLAGS+= -I${PREFIX}/include > LDFLAGS+= -L${PREFIX}/lib Could the pcap/pcap.h header be fixed instead with #ifdef HAVE_REMOTE as it previously had? Antoine From owner-svn-src-head@freebsd.org Wed May 30 08:20:31 2018 Return-Path: Delivered-To: svn-src-head@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 94A3BF77037; Wed, 30 May 2018 08:20:31 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 29F0376243; Wed, 30 May 2018 08:20:31 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id B90AB260174; Wed, 30 May 2018 10:20:29 +0200 (CEST) Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805280812.w4S8CI56046943@repo.freebsd.org> <383666b1-06a9-ac96-812f-c602c8e5e5af@selasky.org> <21342cd6-bf7e-263f-f077-2e073fe9ebef@selasky.org> <1cbed89b-e485-7f15-d3ab-f018024203eb@selasky.org> From: Hans Petter Selasky Message-ID: <56e03042-872c-36df-4fea-d22a09d7ffca@selasky.org> Date: Wed, 30 May 2018 10:20:17 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 08:20:31 -0000 On 05/30/18 10:02, Antoine Brodin wrote: > Could the pcap/pcap.h header be fixed instead with #ifdef HAVE_REMOTE > as it previously had? The HAVE_REMOTE was removed upstream: https://github.com/the-tcpdump-group/libpcap/commit/a372536befc9b1ee1d355058daa2eb9f66aa0c59#diff-46964bcbd8e8a5cec9a75c66ab26a97b What do you think? Shall we re-add it to base? --HPS From owner-svn-src-head@freebsd.org Wed May 30 08:24:58 2018 Return-Path: Delivered-To: svn-src-head@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 76DD7F776AC; Wed, 30 May 2018 08:24:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 239CB767F2; Wed, 30 May 2018 08:24:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 04C02370; Wed, 30 May 2018 08:24:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4U8Ov1a007391; Wed, 30 May 2018 08:24:57 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4U8OvkC007390; Wed, 30 May 2018 08:24:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805300824.w4U8OvkC007390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 30 May 2018 08:24:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334376 - head/lib/libpcap X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/lib/libpcap X-SVN-Commit-Revision: 334376 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 08:24:58 -0000 Author: hselasky Date: Wed May 30 08:24:57 2018 New Revision: 334376 URL: https://svnweb.freebsd.org/changeset/base/334376 Log: Remove redundant header file from source list in libpcap. MFC after: 3 weeks Sponsored by: Mellanox Technologies Modified: head/lib/libpcap/Makefile Modified: head/lib/libpcap/Makefile ============================================================================== --- head/lib/libpcap/Makefile Wed May 30 07:11:33 2018 (r334375) +++ head/lib/libpcap/Makefile Wed May 30 08:24:57 2018 (r334376) @@ -21,7 +21,6 @@ SRCS= bpf_dump.c \ pcap-bpf.c \ pcap-common.c \ pcap-netmap.c \ - pcap-netmap.h \ pcap.c \ savefile.c \ scanner.l \ From owner-svn-src-head@freebsd.org Wed May 30 09:01:00 2018 Return-Path: Delivered-To: svn-src-head@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 720FDF799E3; Wed, 30 May 2018 09:01:00 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qk0-x22f.google.com (mail-qk0-x22f.google.com [IPv6:2607:f8b0:400d:c09::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B2A077A81; Wed, 30 May 2018 09:01:00 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-qk0-x22f.google.com with SMTP id j12-v6so10406564qkk.4; Wed, 30 May 2018 02:01:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=27jraynh7ziWdFsMfQTSdzFgNXVX0zCJkDspxaTsISA=; b=vB861zhWqmU+mNiSdUJm+0b//D+9dqtg0tJ/0UKQLCYSYA/YM+7h57+weSw7nkbYe3 fsyjb4mHdJw5dTAT7SyVGaJX6SesriQEAbmZA1zUctj1byzmX16ow31aIGP8QLdh32eH ISpCUjg6cklNsqVZifz1YlnPMoLY+MH7PpmuuCC89bokBiY24q6l5x7zrnNPwFDMahV2 YAbAUNCRRKeQdwm1PtC60FIhD0B4jsMDph/493FyQGdrbyodoQmlZzulfej3S6PnRJaE 1SZSjuqiHFWchAxgAjfWv4tei1j/K5yUgMiCPgiK/0oPmzCsmOOczy57AGUuVKopTgwT V75g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=27jraynh7ziWdFsMfQTSdzFgNXVX0zCJkDspxaTsISA=; b=DLKsgkfqYDjcV6DOWTF2sjGOmE0iN2/cZgnnv1IIRnjZwiDyl+BYfYD8iZbu7pTVsb VN/+TL1tVbpLq+G3jaRNmNu3XlTdQJu5UgEadFZoZKNQ1AGdNdfRpJ1mk8bmJ5RUqOyW L8fUbyGKv0bsZvA52tG3/d3Ua27ogK/2CtcZQ9qfCD0ZuQa/RALx2vjN7650pnGtOgqF uOtlYWzAr5dLlrxRZYdRmQa1lb7JZ8Ix+hRWi7+THHqy4ZXNcx0qjRmZiXsdhzcvtliA nlHNRrtkhWZr81YhM84yARanqJVv9JPHUYNWcjlCELjiuWV5Or0M/S52toOOXI5vu6uI vy6A== X-Gm-Message-State: APt69E1dYxCbqg3wAICYk0paMpJmthcRLNRnaVgY+2ho46DnpGrBLZlC vpgE1Ythz+v3ZQOkVyWq8nR+rBkaKAaEHitxYetGpQ== X-Google-Smtp-Source: ADUXVKLNN6ldP7aBk1DNdryqnnhBF+lX+5K6OLiM+vKDdtY76WVk4JZ6QqWe1iHkvLwT4VxhrbqWPqpCulH8DziVimI= X-Received: by 2002:a37:a5d1:: with SMTP id o200-v6mr1461513qke.199.1527670859611; Wed, 30 May 2018 02:00:59 -0700 (PDT) MIME-Version: 1.0 Sender: antoine.brodin.freebsd@gmail.com Received: by 2002:a0c:accf:0:0:0:0:0 with HTTP; Wed, 30 May 2018 02:00:59 -0700 (PDT) In-Reply-To: <56e03042-872c-36df-4fea-d22a09d7ffca@selasky.org> References: <201805280812.w4S8CI56046943@repo.freebsd.org> <383666b1-06a9-ac96-812f-c602c8e5e5af@selasky.org> <21342cd6-bf7e-263f-f077-2e073fe9ebef@selasky.org> <1cbed89b-e485-7f15-d3ab-f018024203eb@selasky.org> <56e03042-872c-36df-4fea-d22a09d7ffca@selasky.org> From: Antoine Brodin Date: Wed, 30 May 2018 09:00:59 +0000 X-Google-Sender-Auth: Itp0kYMZw9-fjec0OvTDt5QVM50 Message-ID: Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Hans Petter Selasky Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 09:01:00 -0000 On Wed, May 30, 2018 at 8:20 AM, Hans Petter Selasky wrote: > On 05/30/18 10:02, Antoine Brodin wrote: >> >> Could the pcap/pcap.h header be fixed instead with #ifdef HAVE_REMOTE >> as it previously had? > > > The HAVE_REMOTE was removed upstream: > > https://github.com/the-tcpdump-group/libpcap/commit/a372536befc9b1ee1d355058daa2eb9f66aa0c59#diff-46964bcbd8e8a5cec9a75c66ab26a97b > > What do you think? Shall we re-add it to base? Either hide remote packet capture functions from the header or enable remote capture functions? Note that net/p5-Net-Pcap will fail to build with libpcap from ports too when libpcap from ports is updated to version 1.9.0 (pre-release). Antoine From owner-svn-src-head@freebsd.org Wed May 30 09:25:15 2018 Return-Path: Delivered-To: svn-src-head@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 65875F7B065; Wed, 30 May 2018 09:25:15 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C9C71787BE; Wed, 30 May 2018 09:25:14 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTP id w4U9Oxi2028458; Wed, 30 May 2018 12:25:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w4U9Oxi2028458 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w4U9OxMf028457; Wed, 30 May 2018 12:24:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 30 May 2018 12:24:59 +0300 From: Konstantin Belousov To: Matt Macy Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334361 - head/usr.sbin/pmc Message-ID: <20180530092459.GP3789@kib.kiev.ua> References: <201805300006.w4U06HK3055256@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201805300006.w4U06HK3055256@repo.freebsd.org> User-Agent: Mutt/1.10.0 (2018-05-17) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 09:25:15 -0000 On Wed, May 30, 2018 at 12:06:17AM +0000, Matt Macy wrote: > Author: mmacy > Date: Wed May 30 00:06:17 2018 > New Revision: 334361 > URL: https://svnweb.freebsd.org/changeset/base/334361 > > Log: > pmc: don't break build with format issues > > Modified: > head/usr.sbin/pmc/Makefile > > Modified: head/usr.sbin/pmc/Makefile > ============================================================================== > --- head/usr.sbin/pmc/Makefile Tue May 29 23:08:33 2018 (r334360) > +++ head/usr.sbin/pmc/Makefile Wed May 30 00:06:17 2018 (r334361) > @@ -9,4 +9,5 @@ LIBADD= kvm pmc m ncursesw pmcstat elf > > SRCS= pmc.c pmc_util.c cmd_pmc_stat.c > > +CWARNFLAGS.cmd_pmc_stat.c= -Wno-format > .include So this builds knownly broken binary instead of stopping. If I understand your troubles right, the usual solution for them is printf("%jx", (uintmax_t)trouble); used in many places around the kernel, less so in userspace. From owner-svn-src-head@freebsd.org Wed May 30 09:42:53 2018 Return-Path: Delivered-To: svn-src-head@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 E3061F7C0D6 for ; Wed, 30 May 2018 09:42:52 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12]) by mx1.freebsd.org (Postfix) with ESMTP id 58DE679225 for ; Wed, 30 May 2018 09:42:52 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from iredmail.onthenet.com.au (iredmail.onthenet.com.au [203.13.68.150]) by alto.onthenet.com.au (Postfix) with ESMTPS id F21EE20B1AE1 for ; Wed, 30 May 2018 19:42:49 +1000 (AEST) Received: from localhost (iredmail.onthenet.com.au [127.0.0.1]) by iredmail.onthenet.com.au (Postfix) with ESMTP id EB9D2281F25 for ; Wed, 30 May 2018 19:42:49 +1000 (AEST) X-Amavis-Modified: Mail body modified (using disclaimer) - iredmail.onthenet.com.au Received: from iredmail.onthenet.com.au ([127.0.0.1]) by localhost (iredmail.onthenet.com.au [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 3DaAJtGnheTm for ; Wed, 30 May 2018 19:42:49 +1000 (AEST) Received: from Peters-MacBook-Pro-2.local (c122-106-248-59.belrs3.nsw.optusnet.com.au [122.106.248.59]) by iredmail.onthenet.com.au (Postfix) with ESMTPSA id 8ED122808C3; Wed, 30 May 2018 19:42:48 +1000 (AEST) Subject: Re: svn commit: r334365 - head/sys/dev/pci To: Justin Hibbits , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805300241.w4U2fmvB033942@repo.freebsd.org> From: Peter Grehan Message-ID: <25bd4319-6d7f-e668-88e4-4c3adbc1e8e9@freebsd.org> Date: Wed, 30 May 2018 19:42:49 +1000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <201805300241.w4U2fmvB033942@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=dNCIZtRb c=1 sm=1 tr=0 a=A6CF0fG5TOl4vs6YHvqXgw==:117 a=B4xUt+5V0tDuyGor23H9pw==:17 a=IkcTkHD0fZMA:10 a=VUJBJC2UJ8kA:10 a=pPZoCg0zbuVMT-0qolQA:9 a=QEXdDO2ut3YA:10 wl=host:3 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 09:42:53 -0000 > PCIe only permits 1 device on an endpoint, so some devices ignore the device > part of B:D:F probing. Although ARI likely fixes this, not all platforms > support ARI completely or correctly, so some devices end up showing up 32 > times on the bus. I think this might have broken bhyve - a fake PCIe capability is put on the root port so that guests will use MSI/MSI-x, but otherwise it looks like parallel PCI. Not exactly spec-compliant, but then neither is most of the world of PCI/PCIe. It may be worth #ifdef'ing this with powerpc. later, Peter. From owner-svn-src-head@freebsd.org Wed May 30 09:43:04 2018 Return-Path: Delivered-To: svn-src-head@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 71ABBF7C10C; Wed, 30 May 2018 09:43:04 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED3A979323; Wed, 30 May 2018 09:43:03 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id A34D8260174; Wed, 30 May 2018 11:43:01 +0200 (CEST) Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805280812.w4S8CI56046943@repo.freebsd.org> <383666b1-06a9-ac96-812f-c602c8e5e5af@selasky.org> <21342cd6-bf7e-263f-f077-2e073fe9ebef@selasky.org> <1cbed89b-e485-7f15-d3ab-f018024203eb@selasky.org> <56e03042-872c-36df-4fea-d22a09d7ffca@selasky.org> From: Hans Petter Selasky Message-ID: Date: Wed, 30 May 2018 11:42:48 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 09:43:04 -0000 On 05/30/18 11:00, Antoine Brodin wrote: > On Wed, May 30, 2018 at 8:20 AM, Hans Petter Selasky wrote: >> On 05/30/18 10:02, Antoine Brodin wrote: >>> >>> Could the pcap/pcap.h header be fixed instead with #ifdef HAVE_REMOTE >>> as it previously had? >> >> >> The HAVE_REMOTE was removed upstream: >> >> https://github.com/the-tcpdump-group/libpcap/commit/a372536befc9b1ee1d355058daa2eb9f66aa0c59#diff-46964bcbd8e8a5cec9a75c66ab26a97b >> >> What do you think? Shall we re-add it to base? Hi, > Either hide remote packet capture functions from the header or enable > remote capture functions? This feature is disabled by default for UNIX. > Note that net/p5-Net-Pcap will fail to build with libpcap from ports > too when libpcap from ports is updated to version 1.9.0 (pre-release). No, libpcap from ports has own header files and libraries and does not use anything from libpcap in base. Enabling remote packet capture in libcap won't solve the build failure. The right solution from my point of view is to extend the BUILD_DEPENDS and CFLAGS and LDFLAGS like shown: BUILD_DEPENDS= p5-IO-Interface>=0:net/p5-IO-Interface \ libpcap>=0:net/libpcap CFLAGS+= -I${PREFIX}/include LDFLAGS+= -L${PREFIX}/lib After the upgrade to 1.9.0 (pre-release) in ports you simply add: CFLAGS+= -DHAVE_PCAP_SETSAMPLING -DHAVE_PCAP_OPEN --HPS From owner-svn-src-head@freebsd.org Wed May 30 10:39:45 2018 Return-Path: Delivered-To: svn-src-head@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 089F4F7F30D; Wed, 30 May 2018 10:39:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8FFC67B4D2; Wed, 30 May 2018 10:39:44 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from coleburn.home.andric.com (coleburn.home.andric.com [192.168.0.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 18A793A413; Wed, 30 May 2018 12:39:36 +0200 (CEST) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_AFAF1CA4-C769-4151-A883-B4A1386A67C8"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: svn commit: r334361 - head/usr.sbin/pmc Date: Wed, 30 May 2018 12:39:32 +0200 In-Reply-To: <20180530092459.GP3789@kib.kiev.ua> Cc: Matt Macy , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Konstantin Belousov References: <201805300006.w4U06HK3055256@repo.freebsd.org> <20180530092459.GP3789@kib.kiev.ua> X-Mailer: Apple Mail (2.3445.6.18) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 10:39:45 -0000 --Apple-Mail=_AFAF1CA4-C769-4151-A883-B4A1386A67C8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 30 May 2018, at 11:24, Konstantin Belousov = wrote: >=20 > On Wed, May 30, 2018 at 12:06:17AM +0000, Matt Macy wrote: >> Author: mmacy >> Date: Wed May 30 00:06:17 2018 >> New Revision: 334361 >> URL: https://svnweb.freebsd.org/changeset/base/334361 >>=20 >> Log: >> pmc: don't break build with format issues >>=20 >> Modified: >> head/usr.sbin/pmc/Makefile >>=20 >> Modified: head/usr.sbin/pmc/Makefile >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/usr.sbin/pmc/Makefile Tue May 29 23:08:33 2018 = (r334360) >> +++ head/usr.sbin/pmc/Makefile Wed May 30 00:06:17 2018 = (r334361) >> @@ -9,4 +9,5 @@ LIBADD=3D kvm pmc m ncursesw pmcstat elf >>=20 >> SRCS=3D pmc.c pmc_util.c cmd_pmc_stat.c >>=20 >> +CWARNFLAGS.cmd_pmc_stat.c=3D -Wno-format >> .include > So this builds knownly broken binary instead of stopping. >=20 > If I understand your troubles right, the usual solution for them is > printf("%jx", (uintmax_t)trouble); > used in many places around the kernel, less so in userspace. Yes, or include and use the PRIu64 macro, even though Bruce hates it. :) -Dimitry --Apple-Mail=_AFAF1CA4-C769-4151-A883-B4A1386A67C8 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCWw5/ZAAKCRCwXqMKLiCW o64dAJ9GAEJ/8CtJOtWAZ6g/961XkkbscwCg/ZT6CN4vKovKqV+cOTL3/D69sRg= =dngA -----END PGP SIGNATURE----- --Apple-Mail=_AFAF1CA4-C769-4151-A883-B4A1386A67C8-- From owner-svn-src-head@freebsd.org Wed May 30 10:41:24 2018 Return-Path: Delivered-To: svn-src-head@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 62654F7F546; Wed, 30 May 2018 10:41:24 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qt0-x22b.google.com (mail-qt0-x22b.google.com [IPv6:2607:f8b0:400d:c0d::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E4D8A7B869; Wed, 30 May 2018 10:41:23 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-qt0-x22b.google.com with SMTP id h2-v6so22565674qtp.7; Wed, 30 May 2018 03:41:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=ose0IVVcbrEkU0gB1/zBBmaoSjncVbTDEeC3dS1EDq4=; b=Xd3YyJGglhGMicTUJY8du3fxvT5N32Kn5BezEeXf1hGj8gYpSSz0mJq3ZqZNRAURpr 7pNraUZj6Xuvz9vRjLazTzSitIxGLMUsaz1+rDucG9mATS4u33KCrquCHVhc6gqQF7Mr uSrSrQOgRKixBsjY4cBXijZIxEvuoRwUMLuXfyd9EOUQOQdzUW0FegbaWc1afR4t64aC 46YE9T1wP0Qft1nvnhGdwYj1xMtwzy9Jejx/wx2lsr0drqDHtafhoFO/0WJRLse4YM9t MqzcbWgrVRpa3yk6YsOoLRwk1rNVmOFNq3V0VMCBThwgeYFfMUJRYZfs1SAYFnMpWnYa 4RnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=ose0IVVcbrEkU0gB1/zBBmaoSjncVbTDEeC3dS1EDq4=; b=KnV2qPo9Y+tLnpm06Q8hxWSkFsmKEN0+JY31lF66zIUuPDXAupxlJf8D62cln9WzaF taTBENi8BoXVwfpO94a6tCcgJ1ppArpYcYeJLxdlUHUjc6GJM563xUVWZ0Jc6COJo/MD VLPN4gOTGfrXYyq2lCDCxf1MJ563X8tQd62ojURMsHxCUjCvCIevvUZiGv2XdGlKJu1H DbKJLGTIq3PkmF74+14FG06Org2WPxDO40A8ZJ1em4cyw6FPiWDxiC40CDUFMZFdCU+h 8Vbv6Y8epWSGbxLxC4jU0nYpsiAiLHfNMNJZ0QwPa24Nfj28iLpESaU2IiXt7cu9jKN1 cAaA== X-Gm-Message-State: APt69E2/zP/FRW0SYNNYcZeD2sqQrhtYS6HNiJZlB2QEIT9l/XZ7CgIf WzH67p6gGsENGLpabX8srFlj5xcNqY0UI0iBsgo= X-Google-Smtp-Source: ADUXVKKNe1+zsMmT520ZzzjxE22atISHfgwobbXiAgidqdbUuXITncrfXcc58jmWi6eCInkFtjC/IG0qNZ8dRzODatU= X-Received: by 2002:aed:3ed8:: with SMTP id o24-v6mr1944295qtf.177.1527676883434; Wed, 30 May 2018 03:41:23 -0700 (PDT) MIME-Version: 1.0 Sender: antoine.brodin.freebsd@gmail.com Received: by 2002:a0c:accf:0:0:0:0:0 with HTTP; Wed, 30 May 2018 03:41:22 -0700 (PDT) In-Reply-To: References: <201805280812.w4S8CI56046943@repo.freebsd.org> <383666b1-06a9-ac96-812f-c602c8e5e5af@selasky.org> <21342cd6-bf7e-263f-f077-2e073fe9ebef@selasky.org> <1cbed89b-e485-7f15-d3ab-f018024203eb@selasky.org> <56e03042-872c-36df-4fea-d22a09d7ffca@selasky.org> From: Antoine Brodin Date: Wed, 30 May 2018 10:41:22 +0000 X-Google-Sender-Auth: gIWed1uitpr6QW5L2P0W4GnAzKE Message-ID: Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Hans Petter Selasky Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 10:41:24 -0000 On Wed, May 30, 2018 at 9:42 AM, Hans Petter Selasky wrote: > On 05/30/18 11:00, Antoine Brodin wrote: >> >> On Wed, May 30, 2018 at 8:20 AM, Hans Petter Selasky >> wrote: >>> >>> On 05/30/18 10:02, Antoine Brodin wrote: >>>> >>>> >>>> Could the pcap/pcap.h header be fixed instead with #ifdef HAVE_REMOTE >>>> as it previously had? >>> >>> >>> >>> The HAVE_REMOTE was removed upstream: >>> >>> >>> https://github.com/the-tcpdump-group/libpcap/commit/a372536befc9b1ee1d355058daa2eb9f66aa0c59#diff-46964bcbd8e8a5cec9a75c66ab26a97b >>> >>> What do you think? Shall we re-add it to base? > > > Hi, >> >> Either hide remote packet capture functions from the header or enable >> remote capture functions? > > > This feature is disabled by default for UNIX. > >> Note that net/p5-Net-Pcap will fail to build with libpcap from ports >> too when libpcap from ports is updated to version 1.9.0 (pre-release). > > > No, libpcap from ports has own header files and libraries and does not use > anything from libpcap in base. > > Enabling remote packet capture in libcap won't solve the build failure. > > The right solution from my point of view is to extend the BUILD_DEPENDS and > CFLAGS and LDFLAGS like shown: > > BUILD_DEPENDS= p5-IO-Interface>=0:net/p5-IO-Interface \ > libpcap>=0:net/libpcap > > CFLAGS+= -I${PREFIX}/include > LDFLAGS+= -L${PREFIX}/lib > > After the upgrade to 1.9.0 (pre-release) in ports you simply add: > > CFLAGS+= -DHAVE_PCAP_SETSAMPLING -DHAVE_PCAP_OPEN No this won't solve the issue, libpcap from ports isn't compiled with remote support. Antoine From owner-svn-src-head@freebsd.org Wed May 30 11:09:39 2018 Return-Path: Delivered-To: svn-src-head@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 29AA3FC75D3; Wed, 30 May 2018 11:09:39 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B8FE47C8A5; Wed, 30 May 2018 11:09:38 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 7750E260174; Wed, 30 May 2018 13:09:30 +0200 (CEST) Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805280812.w4S8CI56046943@repo.freebsd.org> <383666b1-06a9-ac96-812f-c602c8e5e5af@selasky.org> <21342cd6-bf7e-263f-f077-2e073fe9ebef@selasky.org> <1cbed89b-e485-7f15-d3ab-f018024203eb@selasky.org> <56e03042-872c-36df-4fea-d22a09d7ffca@selasky.org> From: Hans Petter Selasky Message-ID: Date: Wed, 30 May 2018 13:09:17 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 11:09:39 -0000 On 05/30/18 12:41, Antoine Brodin wrote: > No this won't solve the issue, libpcap from ports isn't compiled with > remote support. Hi, Remote support is for WIN32 only from what I can see. Did you try my suggestions? The port builds fine over here with my patches. --HPS From owner-svn-src-head@freebsd.org Wed May 30 11:36:33 2018 Return-Path: Delivered-To: svn-src-head@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 506D4EEE6BD; Wed, 30 May 2018 11:36:33 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qt0-x244.google.com (mail-qt0-x244.google.com [IPv6:2607:f8b0:400d:c0d::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CB29B7DCEF; Wed, 30 May 2018 11:36:32 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-qt0-x244.google.com with SMTP id d3-v6so22721575qtp.11; Wed, 30 May 2018 04:36:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=XNlBmVKlCfSbXuElS7Qx/VLbVw9N1RyrSdeN1un17Os=; b=n9NhWHHh8waqGFAx8TUaEzyx65R3JUqVSPsTd43WWLyKqbEdivxdnYlzfnB1E97/RX FW6fSY6Ge/4mO2Ew2fPwN0L26kI/4ix33JDrFTwyqVKTQZlvNEQ67r1Br9EdqP41pbXh SO18Nvv+Af7Uc8QFNM6cbaCQWdWyNFi63BS99He5u+HZLzuABBy31YD+s8angMPoFoAu XdfT5Fz2BxztiCHDkCcyQyWY+HR+eEl9jINRy+qIgXFTyjXfLFyG8S9O0GvUn6foCpoO t6nZXjbOg4OSDfvuaMrBFhkgVCFS59xaQjefmcs4Qdxj0JqFytcT8K7EZeEjwfSZF10x BU+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=XNlBmVKlCfSbXuElS7Qx/VLbVw9N1RyrSdeN1un17Os=; b=eYK/y9ZT/M10AF6KhtYB2DmFUWJ8mRiP/axI4cvxU0lv6JcACLxuEFmeqkUA146+iA nKt8+e+wAAjcZY6JGBnQpW9+SFTxpK+qDASklQ2CTJPSKiOVjYZdzjpU3YaG7ZLrLNNN 9y7oADYIsVxUbcbCFQbvvI5jhyZGbhyA9V3hC3CmLC12JW+7b74Y6yiBIYnwatKA6ryF ejhABANSV1RlIyEk+oU/cPGJWb9Cjgwemkm2CrxE7eySBlYqomM10itNnch5AIcrZWIs 81lpRNWR95evMgcZv5cfOoP3ZCtTfKUn3hHvKL2N34XWZ9/CWuNzZADbmcSYl/fSjVKF 8s8g== X-Gm-Message-State: APt69E1ooTzE4XTAdW9ue4P3xusoXRQJJ5SFBqd9821Z9NtHQwz/cHRZ rOTbhIyTPLLrodcRfaaOKSL20U4CFbIM+qAiRGA= X-Google-Smtp-Source: ADUXVKLOWC3HNIKV4PBvy+cTeNKkq6z2BUnuF4P3FTBH1np6B3Jy7zAREnHkREch+qq2ziTlQjP8BPopcatlNF64mm8= X-Received: by 2002:aed:2459:: with SMTP id s25-v6mr2007715qtc.289.1527680192469; Wed, 30 May 2018 04:36:32 -0700 (PDT) MIME-Version: 1.0 Sender: antoine.brodin.freebsd@gmail.com Received: by 2002:a0c:accf:0:0:0:0:0 with HTTP; Wed, 30 May 2018 04:36:31 -0700 (PDT) In-Reply-To: References: <201805280812.w4S8CI56046943@repo.freebsd.org> <383666b1-06a9-ac96-812f-c602c8e5e5af@selasky.org> <21342cd6-bf7e-263f-f077-2e073fe9ebef@selasky.org> <1cbed89b-e485-7f15-d3ab-f018024203eb@selasky.org> <56e03042-872c-36df-4fea-d22a09d7ffca@selasky.org> From: Antoine Brodin Date: Wed, 30 May 2018 11:36:31 +0000 X-Google-Sender-Auth: V6Mk4cDwijVaTxQCx10GSKKYjPk Message-ID: Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Hans Petter Selasky Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: multipart/mixed; boundary="000000000000341336056d6ac375" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 11:36:33 -0000 --000000000000341336056d6ac375 Content-Type: text/plain; charset="UTF-8" On Wed, May 30, 2018 at 11:09 AM, Hans Petter Selasky wrote: > On 05/30/18 12:41, Antoine Brodin wrote: >> >> No this won't solve the issue, libpcap from ports isn't compiled with >> remote support. > > > Hi, > > Remote support is for WIN32 only from what I can see. > > Did you try my suggestions? > > The port builds fine over here with my patches. I tried your patch with libpcap from ports updated to last commit in github, it fails with the same error as with base libpcap. I suggest the attached patch which fixes the issue for me. (in my opinion upstream should generate the pcap/pcap.h file depending on the configure args) Cheers, Antoine --000000000000341336056d6ac375 Content-Type: text/x-patch; charset="US-ASCII"; name="pcap.diff" Content-Disposition: attachment; filename="pcap.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_jht0rf6g0 SW5kZXg6IGNvbnRyaWIvbGlicGNhcC9wY2FwL3BjYXAuaAo9PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBjb250cmli L2xpYnBjYXAvcGNhcC9wY2FwLmgJKHJldmlzaW9uIDMzNDM3MykKKysrIGNvbnRyaWIvbGlicGNh cC9wY2FwL3BjYXAuaAkod29ya2luZyBjb3B5KQpAQCAtNjA3LDYgKzYwNyw3IEBACiAKICNlbmRp ZiAvKiBfV0lOMzIvTVNET1MvVU4qWCAqLwogCisjaWYgMAkvKiBSZW1vdGUgY2FwdHVyZSBpcyBk aXNhYmxlZCBvbiBGcmVlQlNEICovCiAvKgogICogUmVtb3RlIGNhcHR1cmUgZGVmaW5pdGlvbnMu CiAgKgpAQCAtOTY1LDYgKzk2Niw3IEBACiAJICAgIGNoYXIgKmVycmJ1Zik7CiBQQ0FQX0FQSSBp bnQJcGNhcF9yZW1vdGVhY3RfY2xvc2UoY29uc3QgY2hhciAqaG9zdCwgY2hhciAqZXJyYnVmKTsK IFBDQVBfQVBJIHZvaWQJcGNhcF9yZW1vdGVhY3RfY2xlYW51cCh2b2lkKTsKKyNlbmRpZgkvKiBS ZW1vdGUgY2FwdHVyZSBpcyBkaXNhYmxlZCBvbiBGcmVlQlNEICovCiAKICNpZmRlZiBfX2NwbHVz cGx1cwogfQo= --000000000000341336056d6ac375-- From owner-svn-src-head@freebsd.org Wed May 30 11:45:30 2018 Return-Path: Delivered-To: svn-src-head@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 C64E6EEF6DE; Wed, 30 May 2018 11:45:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6D8847E37E; Wed, 30 May 2018 11:45:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4EAA72496; Wed, 30 May 2018 11:45:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UBjUqK007322; Wed, 30 May 2018 11:45:30 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UBjUYX007321; Wed, 30 May 2018 11:45:30 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805301145.w4UBjUYX007321@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 30 May 2018 11:45:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334378 - head/contrib/libpcap/pcap X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/contrib/libpcap/pcap X-SVN-Commit-Revision: 334378 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 11:45:31 -0000 Author: hselasky Date: Wed May 30 11:45:29 2018 New Revision: 334378 URL: https://svnweb.freebsd.org/changeset/base/334378 Log: Hide unsupported remote capture definitions to avoid breakage in ports. Suggested by: antoine@ MFC after: 3 weeks Sponsored by: Mellanox Technologies Modified: head/contrib/libpcap/pcap/pcap.h Modified: head/contrib/libpcap/pcap/pcap.h ============================================================================== --- head/contrib/libpcap/pcap/pcap.h Wed May 30 08:34:19 2018 (r334377) +++ head/contrib/libpcap/pcap/pcap.h Wed May 30 11:45:29 2018 (r334378) @@ -607,6 +607,7 @@ PCAP_API void bpf_dump(const struct bpf_program *, int #endif /* _WIN32/MSDOS/UN*X */ +#if 0 /* Remote capture is disabled on FreeBSD */ /* * Remote capture definitions. * @@ -965,6 +966,7 @@ PCAP_API int pcap_remoteact_list(char *hostlist, char char *errbuf); PCAP_API int pcap_remoteact_close(const char *host, char *errbuf); PCAP_API void pcap_remoteact_cleanup(void); +#endif /* Remote capture is disabled on FreeBSD */ #ifdef __cplusplus } From owner-svn-src-head@freebsd.org Wed May 30 11:46:19 2018 Return-Path: Delivered-To: svn-src-head@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 02680EEF8B6; Wed, 30 May 2018 11:46:19 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71FD37E4FB; Wed, 30 May 2018 11:46:18 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 29DEA260174; Wed, 30 May 2018 13:46:17 +0200 (CEST) Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805280812.w4S8CI56046943@repo.freebsd.org> <383666b1-06a9-ac96-812f-c602c8e5e5af@selasky.org> <21342cd6-bf7e-263f-f077-2e073fe9ebef@selasky.org> <1cbed89b-e485-7f15-d3ab-f018024203eb@selasky.org> <56e03042-872c-36df-4fea-d22a09d7ffca@selasky.org> From: Hans Petter Selasky Message-ID: <515e1a08-0089-7b5d-19a4-f0720adc43fd@selasky.org> Date: Wed, 30 May 2018 13:46:04 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 11:46:19 -0000 On 05/30/18 13:36, Antoine Brodin wrote: > On Wed, May 30, 2018 at 11:09 AM, Hans Petter Selasky wrote: >> On 05/30/18 12:41, Antoine Brodin wrote: >>> >>> No this won't solve the issue, libpcap from ports isn't compiled with >>> remote support. >> >> >> Hi, >> >> Remote support is for WIN32 only from what I can see. >> >> Did you try my suggestions? >> >> The port builds fine over here with my patches. > > I tried your patch with libpcap from ports updated to last commit in > github, it fails with the same error as with base libpcap. > > I suggest the attached patch which fixes the issue for me. (in my > opinion upstream should generate the pcap/pcap.h file depending on the > configure args) OK, then we agree :-) https://svnweb.freebsd.org/changeset/base/334378 --HPS From owner-svn-src-head@freebsd.org Wed May 30 11:52:00 2018 Return-Path: Delivered-To: svn-src-head@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 6DA09EF1762; Wed, 30 May 2018 11:52:00 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 015BD7EAD1; Wed, 30 May 2018 11:52:00 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 61DA4260174; Wed, 30 May 2018 13:51:58 +0200 (CEST) Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool From: Hans Petter Selasky To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805280812.w4S8CI56046943@repo.freebsd.org> <383666b1-06a9-ac96-812f-c602c8e5e5af@selasky.org> <21342cd6-bf7e-263f-f077-2e073fe9ebef@selasky.org> <1cbed89b-e485-7f15-d3ab-f018024203eb@selasky.org> <56e03042-872c-36df-4fea-d22a09d7ffca@selasky.org> <515e1a08-0089-7b5d-19a4-f0720adc43fd@selasky.org> Message-ID: Date: Wed, 30 May 2018 13:51:45 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <515e1a08-0089-7b5d-19a4-f0720adc43fd@selasky.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 11:52:00 -0000 On 05/30/18 13:46, Hans Petter Selasky wrote: > On 05/30/18 13:36, Antoine Brodin wrote: >> On Wed, May 30, 2018 at 11:09 AM, Hans Petter Selasky >> wrote: >>> On 05/30/18 12:41, Antoine Brodin wrote: >>>> >>>> No this won't solve the issue,  libpcap from ports isn't compiled with >>>> remote support. >>> >>> >>> Hi, >>> >>> Remote support is for WIN32 only from what I can see. >>> >>> Did you try my suggestions? >>> >>> The port builds fine over here with my patches. >> >> I tried your patch with libpcap from ports updated to last commit in >> github, it fails with the same error as with base libpcap. >> >> I suggest the attached patch which fixes the issue for me.  (in my >> opinion upstream should generate the pcap/pcap.h file depending on the >> configure args) > > OK, then we agree :-) > > https://svnweb.freebsd.org/changeset/base/334378 > FYI: https://github.com/the-tcpdump-group/libpcap/issues/723 --HPS From owner-svn-src-head@freebsd.org Wed May 30 12:10:44 2018 Return-Path: Delivered-To: svn-src-head@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 1BD75EF5264 for ; Wed, 30 May 2018 12:10:44 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-wm0-x230.google.com (mail-wm0-x230.google.com [IPv6:2a00:1450:400c:c09::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 89CDE7F8C1 for ; Wed, 30 May 2018 12:10:43 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-wm0-x230.google.com with SMTP id f6-v6so47432384wmc.4 for ; Wed, 30 May 2018 05:10:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=EbDqWsTa4OE0SEOcnEGZnTBZSVhmlXxzrWM4Fmp/ZQA=; b=OM0EVFyhGRWcsdL9B8h963UFLTYvBc8OWTHgXyWz6T/wj20YI+YL8oW0r6oCqqc4mt Z/fi/PlXOuFhByZKnBrpbesWBdSfMzFvOWDtlCeIeyjusGcsnRwny/TJXwtjro/1kgBK ekgSv7k7LmJtjOhEAcByjGWsyMPznQEZy7pHWrbXyuX2xdskE04na1HyDvSsSgRlYF6n 8aXizEuVA3LU3lyRZu85jnhScdoHbsv0C8u/6ppHJG2t71t+GottNA/+zdLIlYfR7etA WQH65ZNfUcNMyZ2ROxaIzaqUBamId+tqwd78E3kZtWXYZe6uHJN9fe4E9+gVvZxmbcq5 mm6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=EbDqWsTa4OE0SEOcnEGZnTBZSVhmlXxzrWM4Fmp/ZQA=; b=pQ7r1b6YYxXkoYoFDnDucmVPXErDAmelM6w0EEGejybUHkWf8ePwkEEy4FJM64WNyj GGBF/RImfhA5hHK8ijFKTFFmI+elgjSYQxfc1J+nFG3yJcpE3EX5So5rgpmRiJuxRofh lBX5FPXrvUKmfvLBGq8mOGv+VKZaDbIdxA2NWbn5fYx8cYnWU8t3vUGPnPrzsTzF6zkr EoDrP181RMIEz8WHmcjX1svNX3+GJNrVchVrh5LfUyH1NFOXSac2hXQ85ViLfURPIVLR 9cRnGunDwgyQYqo45+djzWis+HC2B2qO1GoArxPbfyyT4h63Kh/FSR5xm7il6ujppERc D4rw== X-Gm-Message-State: ALKqPwcIdEnO6fhFTDPQpFwKN/158KNZaNk9b0HG+vFyKn8ovo6vvWPc SiF1pb64VFbGU5rtyLFu6Ey/Fg== X-Google-Smtp-Source: ADUXVKIqaD2hwTh/C7lyCKrATPUbCVEUvvVzG63vXCvliJJtaMN4hPXp7Q9YSWpjE6UN9IF/SnC+DA== X-Received: by 2002:a1c:f407:: with SMTP id z7-v6mr1234965wma.143.1527682241891; Wed, 30 May 2018 05:10:41 -0700 (PDT) Received: from mutt-hbsd (62-210-37-82.rev.poneytelecom.eu. [62.210.37.82]) by smtp.gmail.com with ESMTPSA id y11-v6sm36777296wrc.93.2018.05.30.05.10.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 May 2018 05:10:40 -0700 (PDT) Date: Wed, 30 May 2018 08:10:15 -0400 From: Shawn Webb To: Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334363 - head/usr.bin/elfdump Message-ID: <20180530121015.mpdt6gh45kyriciv@mutt-hbsd> References: <201805300116.w4U1GoWj090163@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pufr72ltxxoexor4" Content-Disposition: inline In-Reply-To: <201805300116.w4U1GoWj090163@repo.freebsd.org> X-Operating-System: FreeBSD mutt-hbsd 12.0-CURRENT FreeBSD 12.0-CURRENT X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x6A84658F52456EEE User-Agent: NeoMutt/20180323 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 12:10:44 -0000 --pufr72ltxxoexor4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 30, 2018 at 01:16:50AM +0000, Ed Maste wrote: > Author: emaste > Date: Wed May 30 01:16:50 2018 > New Revision: 334363 > URL: https://svnweb.freebsd.org/changeset/base/334363 >=20 > Log: > elfdump: chase ABI tag note name change from r232832 > =20 > r232832 changed the ABI tag note name from .note.ABI-tag to .note.tag. > Follow suit in elfdump. > =20 > Elfdump's note parsing is very basic and should be significantly > reworked, but for now just restore the broken functionality. > =20 > PR: 228290 > Submitted by: martin at lispworks.com > MFC after: 1 week >=20 > Modified: > head/usr.bin/elfdump/elfdump.c >=20 > Modified: head/usr.bin/elfdump/elfdump.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.bin/elfdump/elfdump.c Wed May 30 00:36:58 2018 (r334362) > +++ head/usr.bin/elfdump/elfdump.c Wed May 30 01:16:50 2018 (r334363) > @@ -659,7 +659,7 @@ main(int ac, char **av) > case SHT_NOTE: > name =3D elf_get_word(e, v, SH_NAME); > if (flags & ED_NOTE && > - strcmp(shstrtab + name, ".note.ABI-tag") =3D=3D 0) > + strcmp(shstrtab + name, ".note.tag") =3D=3D 0) > elf_print_note(e, v); > break; > case SHT_DYNSYM: I wonder if it would be a good idea to handle .note.ABI-tag and =2Enote.tag so that it can handle binaries compiled both before and after r232832. Thanks, --=20 Shawn Webb Cofounder and Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --pufr72ltxxoexor4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEKrq2ve9q9Ia+iT2eaoRlj1JFbu4FAlsOlKIACgkQaoRlj1JF bu7+kA//aDsIerZl0f8HRNtCWMNTWEYlZP2JLnXJNaj+pvdvwgWfsQmXfshh4qQQ 5p6yFoUMNhRJu8fs+yc6Fy9zPFezmjrvYn/Lk4rwf4gGsIAIeXEs14kGu6+Qbc01 6UKY+4wBfE+aaCne7IM/Uq8Uh9IaRm612p37rTTYRIXCgpND3ml2i2YI/SZ0Aixt Jhk98i+bmvmOlCTtQuN3+QqPK0RUwXZFeIK6PPG22IBxsQu1ZH9TBFt71Cka1PyM +gtCmPEwqgQYUNySLCBEJPJXWt90H02fXM96bEpSQnKhKRCnCtMHQOCJc5vTgF+u xuQRhgoluJMmfjIGYQyZbpyPxXotVABpCTTPux9B8pxAGiPdfehFsSH+CgXmJIT8 VAvkpFwZ54QcO8fJP1+dn7RcxOSRNw1eOe1oFWHmkqRL4hBwgI7ti5xj8ONZmJFr uJf6JPadYTf+TGneAX+EGe4YgwU6pV3Yn+wCLdidTIworqrdlq43JeIyF+sHH6vW xbfy8FhnCT96ajyKFFQ1TnW/NtxBuKqIZOYgU04YL0W13t8K6xSaDfNaF8+dm2fs msetTZD77pNMQpF6Zj69D6MmPH9zboX0fARRgbvIXIy1tw5zB8tCCwn8VIA6GzOU +gK3MnWkfwOqwx6XkSurfsEI4hoMeviSdhtK7UuAR5EKYdx3F9A= =z9T0 -----END PGP SIGNATURE----- --pufr72ltxxoexor4-- From owner-svn-src-head@freebsd.org Wed May 30 12:14:08 2018 Return-Path: Delivered-To: svn-src-head@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 42CBFEF5ADC; Wed, 30 May 2018 12:14:08 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5C817FD87; Wed, 30 May 2018 12:14:07 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from hermann ([141.89.155.168]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LeBPM-1g6ynT2ZTw-00pxNn; Wed, 30 May 2018 14:13:59 +0200 Date: Wed, 30 May 2018 14:13:57 +0200 From: "Hartmann, O." To: Kristof Provost Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334375 - in head/sys: net netpfil/pf Message-ID: <20180530141347.1bf868ac@hermann> In-Reply-To: <201805300711.w4U7BYjS066960@repo.freebsd.org> References: <201805300711.w4U7BYjS066960@repo.freebsd.org> Organization: walstatt.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:rja4vSJndbIeSD13E5O0HDfSqebQhZ40Zts5KrlFoavq+KEW37S mz/4idc0uoLNjXCXqfct/CPrqItb8Ype98yI51FVB0jzbeYP8LamFY2GdDZai6DtfZ12vxP +rbvUECTKpmLyqtuqorniT6l6AUcREiIEJNHY812WQYvn2xzvRVHEDArcoR2sIIOtryyFgI ssrD6UiU5tNFQbXcZEWXw== X-UI-Out-Filterresults: notjunk:1;V01:K0:inGICIJri1g=:HOGhJFH0FVUijZ5AQUBnP8 mQL4CTS0NdyQM7LdkJlWo8torFVap5qsAKhb1UAZELfyNoUlQtX7MLjDCiN7a21SroW267OU3 mYl0nuFgs3aZgZq9crORfJhKqtgxUHro/7g3yI8TGxUkgognxd62DqJel5lMTS0NCpF4GCjCH 5DEhrehJqvHLWE9ijJxuqJ/yy9z1gYRIGo8B8iPO+z4tnd0rJLI2P4lg+ao/NU1/L7xBsGRkz si/kX7QsXeTwEm67XQ/7FtYfBXJnj/iB3RvXRDt8V4It1+DNgReDFR2BdpsvTmJbsvmrgpMLb lZ4AxEYntDemBVv1fG0maHsCljEE7WkHDhg/52JyePv9K32l2woptfPgo4TX9G7mZoVwqSFW2 UXiHCUYghvUM5uATK0oBbkIpANESp6owEo37vWTtNS4xGWE/keJxYwphnqcvSRI928CLZ68hW NqLAPJwhLiJ1vzfF6vZJc765ji8anQn4vvO1oSQrgPwT5G/FQyy7/jESmyHnaYGLHbZdo0hDY isfDpL7CR2Lg6cz96FS2Hqr3pz1oJ8yfY+chMYlG2oGzl/xSyXj7rpLEsM/rAZ6hbrHzBAoJF xj51A+bYi+lF9cl+rvFUpv/WW7CbaL09hSu2iy42jTpwMAi7bmjA1qV+ljUO+pajNjwT288TG YiG5dsLjDWYIgSjJwE2MGp4JwA+z8ef76GFsloe86tpgDHWtp7dwPCoe9rYjcf1m5vMc/ag5d Rg5444lRaOw4/2/yDCQy9yIL3BSEA31LXYaC5AvtSr3X+9vaUnz/j0FLh/PYBYxB9894hb0TT LP1ula7 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 12:14:08 -0000 On Wed, 30 May 2018 07:11:34 +0000 (UTC) Kristof Provost wrote: > Author: kp > Date: Wed May 30 07:11:33 2018 > New Revision: 334375 > URL: https://svnweb.freebsd.org/changeset/base/334375 > > Log: > pf: Replace rwlock on PF_RULES_LOCK with rmlock > > Given that PF_RULES_LOCK is a mostly read lock, replace the rwlock > with rmlock. This change improves packet processing rate in high pps > environments. Benchmarking by olivier@ shows a 65% improvement in pps. > > While here, also eliminate all appearances of "sys/rwlock.h" > includes since it is not used anymore. > > Submitted by: farrokhi@ > Differential Revision: https://reviews.freebsd.org/D15502 > > Modified: > head/sys/net/pfvar.h > head/sys/netpfil/pf/if_pfsync.c > head/sys/netpfil/pf/pf.c > head/sys/netpfil/pf/pf_if.c > head/sys/netpfil/pf/pf_ioctl.c > head/sys/netpfil/pf/pf_lb.c > head/sys/netpfil/pf/pf_norm.c > head/sys/netpfil/pf/pf_osfp.c > head/sys/netpfil/pf/pf_table.c > > Modified: head/sys/net/pfvar.h > ============================================================================== > --- head/sys/net/pfvar.h Wed May 30 06:29:22 2018 > (r334374) +++ head/sys/net/pfvar.h Wed May 30 07:11:33 > 2018 (r334375) @@ -38,8 +38,10 @@ > #include > #include > #include > +#include > #include > #include > +#include > #include > #include > > @@ -147,14 +149,15 @@ extern struct mtx pf_unlnkdrules_mtx; > #define PF_UNLNKDRULES_LOCK() > mtx_lock(&pf_unlnkdrules_mtx) #define > PF_UNLNKDRULES_UNLOCK() mtx_unlock(&pf_unlnkdrules_mtx) > -extern struct rwlock pf_rules_lock; > -#define PF_RULES_RLOCK() rw_rlock(&pf_rules_lock) > -#define PF_RULES_RUNLOCK() rw_runlock(&pf_rules_lock) > -#define PF_RULES_WLOCK() rw_wlock(&pf_rules_lock) > -#define PF_RULES_WUNLOCK() rw_wunlock(&pf_rules_lock) > -#define PF_RULES_ASSERT() rw_assert(&pf_rules_lock, > RA_LOCKED) -#define PF_RULES_RASSERT() > rw_assert(&pf_rules_lock, RA_RLOCKED) -#define > PF_RULES_WASSERT() rw_assert(&pf_rules_lock, RA_WLOCKED) > +extern struct rmlock pf_rules_lock; +#define > PF_RULES_RLOCK_TRACKER struct rm_priotracker _pf_rules_tracker > +#define PF_RULES_RLOCK() rm_rlock(&pf_rules_lock, > &_pf_rules_tracker) +#define PF_RULES_RUNLOCK() > rm_runlock(&pf_rules_lock, &_pf_rules_tracker) +#define > PF_RULES_WLOCK() rm_wlock(&pf_rules_lock) +#define > PF_RULES_WUNLOCK() rm_wunlock(&pf_rules_lock) +#define > PF_RULES_ASSERT() rm_assert(&pf_rules_lock, RA_LOCKED) > +#define PF_RULES_RASSERT() rm_assert(&pf_rules_lock, > RA_RLOCKED) +#define PF_RULES_WASSERT() > rm_assert(&pf_rules_lock, RA_WLOCKED) extern struct sx pf_end_lock; > > Modified: head/sys/netpfil/pf/if_pfsync.c > ============================================================================== > --- head/sys/netpfil/pf/if_pfsync.c Wed May 30 06:29:22 > 2018 (r334374) +++ head/sys/netpfil/pf/if_pfsync.c Wed > May 30 07:11:33 2018 (r334375) @@ -587,6 +587,8 @@ > pfsync_input(struct mbuf **mp, int *offp __unused, int int rv; > uint16_t count; > > + PF_RULES_RLOCK_TRACKER; > + > *mp = NULL; > V_pfsyncstats.pfsyncs_ipackets++; > > > Modified: head/sys/netpfil/pf/pf.c > ============================================================================== > --- head/sys/netpfil/pf/pf.c Wed May 30 06:29:22 2018 > (r334374) +++ head/sys/netpfil/pf/pf.c Wed May 30 07:11:33 > 2018 (r334375) @@ -5874,6 +5874,8 @@ pf_test(int dir, int > pflags, struct ifnet *ifp, struct struct pf_pdesc pd; > int off, dirndx, pqid = 0; > > + PF_RULES_RLOCK_TRACKER; > + > M_ASSERTPKTHDR(m); > > if (!V_pf_status.running) > @@ -6261,6 +6263,7 @@ pf_test6(int dir, int pflags, struct ifnet > *ifp, struc struct pf_pdesc pd; > int off, terminal = 0, dirndx, > rh_cnt = 0, pqid = 0; > + PF_RULES_RLOCK_TRACKER; > M_ASSERTPKTHDR(m); > > if (!V_pf_status.running) > > Modified: head/sys/netpfil/pf/pf_if.c > ============================================================================== > --- head/sys/netpfil/pf/pf_if.c Wed May 30 06:29:22 > 2018 (r334374) +++ head/sys/netpfil/pf/pf_if.c Wed May > 30 07:11:33 2018 (r334375) @@ -46,7 +46,6 @@ > __FBSDID("$FreeBSD$"); #include > #include > #include > -#include > #include > > #include > > Modified: head/sys/netpfil/pf/pf_ioctl.c > ============================================================================== > --- head/sys/netpfil/pf/pf_ioctl.c Wed May 30 06:29:22 > 2018 (r334374) +++ head/sys/netpfil/pf/pf_ioctl.c Wed > May 30 07:11:33 2018 (r334375) @@ -59,7 +59,6 @@ > __FBSDID("$FreeBSD$"); #include > #include > #include > -#include > #include > #include > #include > @@ -202,7 +201,7 @@ VNET_DEFINE(int, pf_vnet_active); > int pf_end_threads; > struct proc *pf_purge_proc; > > -struct rwlock pf_rules_lock; > +struct rmlock pf_rules_lock; > struct sx pf_ioctl_lock; > struct sx pf_end_lock; > > @@ -995,6 +994,7 @@ static int > pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, > struct thread *td) { > int error = 0; > + PF_RULES_RLOCK_TRACKER; > > /* XXX keep in sync with switch() below */ > if (securelevel_gt(td->td_ucred, 2)) > @@ -3924,7 +3924,7 @@ pf_load(void) > { > int error; > > - rw_init(&pf_rules_lock, "pf rulesets"); > + rm_init(&pf_rules_lock, "pf rulesets"); > sx_init(&pf_ioctl_lock, "pf ioctl"); > sx_init(&pf_end_lock, "pf end thread"); > > @@ -3997,7 +3997,7 @@ pf_unload(void) > > pfi_cleanup(); > > - rw_destroy(&pf_rules_lock); > + rm_destroy(&pf_rules_lock); > sx_destroy(&pf_ioctl_lock); > sx_destroy(&pf_end_lock); > } > > Modified: head/sys/netpfil/pf/pf_lb.c > ============================================================================== > --- head/sys/netpfil/pf/pf_lb.c Wed May 30 06:29:22 > 2018 (r334374) +++ head/sys/netpfil/pf/pf_lb.c Wed May > 30 07:11:33 2018 (r334375) @@ -46,7 +46,6 @@ > __FBSDID("$FreeBSD$"); #include > #include > #include > -#include > #include > #include > > > Modified: head/sys/netpfil/pf/pf_norm.c > ============================================================================== > --- head/sys/netpfil/pf/pf_norm.c Wed May 30 06:29:22 > 2018 (r334374) +++ head/sys/netpfil/pf/pf_norm.c Wed > May 30 07:11:33 2018 (r334375) @@ -41,7 +41,6 @@ > __FBSDID("$FreeBSD$"); #include > #include > #include > -#include > #include > > #include > > Modified: head/sys/netpfil/pf/pf_osfp.c > ============================================================================== > --- head/sys/netpfil/pf/pf_osfp.c Wed May 30 06:29:22 > 2018 (r334374) +++ head/sys/netpfil/pf/pf_osfp.c Wed > May 30 07:11:33 2018 (r334375) @@ -27,7 +27,6 @@ > __FBSDID("$FreeBSD$"); #include > #include > #include > -#include > #include > > #include > > Modified: head/sys/netpfil/pf/pf_table.c > ============================================================================== > --- head/sys/netpfil/pf/pf_table.c Wed May 30 06:29:22 > 2018 (r334374) +++ head/sys/netpfil/pf/pf_table.c Wed > May 30 07:11:33 2018 (r334375) @@ -44,7 +44,6 @@ > __FBSDID("$FreeBSD$"); #include > #include > #include > -#include > #include > #include > > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to > "svn-src-head-unsubscribe@freebsd.org" It seems, this commit issues an error while compiling the kernel: [...] --- all_subdir_pf --- --- pf_ruleset.o --- In file included from /usr/src/sys/netpfil/pf/pf_ruleset.c:57: In file included from /usr/src/sys/net/pfvar.h:44: In file included from /usr/src/sys/sys/rmlock.h:37: /usr/src/sys/sys/mutex.h:96:52: error: expected ')' int _mtx_trylock_flags_int(struct mtx *m, int opts LOCK_FILE_LINE_ARG_DEF); ^ /usr/src/sys/sys/mutex.h:96:27: note: to match this '(' int _mtx_trylock_flags_int(struct mtx *m, int opts LOCK_FILE_LINE_ARG_DEF); ^ /usr/src/sys/sys/mutex.h:100:5: error: 'LOCK_DEBUG' is not defined, evaluates to 0 [-Werror,-Wundef] #if LOCK_DEBUG > 0 ^ /usr/src/sys/sys/mutex.h:111:5: error: 'LOCK_DEBUG' is not defined, evaluates to 0 [-Werror,-Wundef] #if LOCK_DEBUG > 0 From owner-svn-src-head@freebsd.org Wed May 30 12:14:18 2018 Return-Path: Delivered-To: svn-src-head@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 1A01BEF5B5D; Wed, 30 May 2018 12:14:18 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x232.google.com (mail-it0-x232.google.com [IPv6:2607:f8b0:4001:c0b::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9B53B7FE7C; Wed, 30 May 2018 12:14:17 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x232.google.com with SMTP id c5-v6so1145115itj.1; Wed, 30 May 2018 05:14:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=y8Lv7GHVwZkFLKV1tKhsb/PUlciHasHSHKzz7SEbU48=; b=bz83g5RewBLnSBAzeWCRJC7F3pFhlDhD2m4O9DqxnbFR0zXx2+LZk4uq2JNEEER7xo 5oOja+PLKQCgy/okC+QFkCF8xjAOChUoxFzKdRUuZPOoApI2CDbaw/ar8oFXk2TBnd0F ybS6+A6muwob6xibSUlOkyDtjXXMo2tj4qzghYJSe2a5xs7L75CcMXof+YpQXkF9/f+a gMjcF8SigsVyqWpyZstBYP7OGTQV1FgkMjhbQ2Yk9RN28gOMLk7E1UWu5tsD4OZrQXJB bFtlRNhxkhnelgoF5HzXx/8e+6/wXzNo/RlR56Sabe2IlYkgKdgcvnY0C361fFTKra27 OpAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=y8Lv7GHVwZkFLKV1tKhsb/PUlciHasHSHKzz7SEbU48=; b=NnQAHfZelDuq8HLilbNaOlVQds2HVJsN4vgykM80cn492weyL7lpsrkDJsTGhjWxLe 5yNsQmDm8rRCEo6Y5+xT/E2kjIHTKWiFVw10OuBdcUabACdeDpWSPg5ABg8Xl3h7X7Qq qsdJBdrEK5uvNyFGA1S7WgdVieSY2l92/ZXIUYlC+tCfK13QO7qcWoPF/cPtcnq9Vi80 ZitJUT49L4ObWzUrZ3QzF1AMzlaJB8ZG470R47HyVuXheFtvCinTRdOb64FlC42864E3 aAm5RlXa4Sg4/loT0GgoB9rvuMExTzghC61nUfQnafQy7I+tkPLqjhlWAj6Hxl7m8d5D uHog== X-Gm-Message-State: APt69E0K+HxsaLyoJg5NyESR6C5KZMxllZWsZgwUChePpFh00apPeu+2 wooD7VWCfy/YZwVNCnq9EBDD1RGPO7kbKOor/ZcgKw== X-Google-Smtp-Source: ADUXVKJAONYNuuxBiMV7nD1FoWGjkHkrCWklCeUiXo5icoHW7ag/B0kCogNbpAY7VO609xcxBLy6yU0XwoBZVYJHaDM= X-Received: by 2002:a24:4293:: with SMTP id i141-v6mr1261115itb.54.1527682457025; Wed, 30 May 2018 05:14:17 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 2002:a6b:87c4:0:0:0:0:0 with HTTP; Wed, 30 May 2018 05:13:56 -0700 (PDT) In-Reply-To: <20180530121015.mpdt6gh45kyriciv@mutt-hbsd> References: <201805300116.w4U1GoWj090163@repo.freebsd.org> <20180530121015.mpdt6gh45kyriciv@mutt-hbsd> From: Ed Maste Date: Wed, 30 May 2018 08:13:56 -0400 X-Google-Sender-Auth: 1jQY-m8xgo3UmyjSJHYle_EwCf8 Message-ID: Subject: Re: svn commit: r334363 - head/usr.bin/elfdump To: Shawn Webb Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 12:14:18 -0000 On 30 May 2018 at 08:10, Shawn Webb wrote: > > I wonder if it would be a good idea to handle .note.ABI-tag and > .note.tag so that it can handle binaries compiled both before and > after r232832. As I said in the commit message, elfdump's note parsing needs a bunch of rework. r232832 was years ago and today I think it's much more likely that if elfdump encounters a .note.ABI-tag section that's going to be a GNU note (that will be misinterpreted) than one from a years-old FreeBSD binary. From owner-svn-src-head@freebsd.org Wed May 30 12:17:34 2018 Return-Path: Delivered-To: svn-src-head@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 6A58BEF61FF; Wed, 30 May 2018 12:17:34 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (unknown [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1D2E38019C; Wed, 30 May 2018 12:17:34 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id D667526A08; Wed, 30 May 2018 12:17:33 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from [172.28.128.1] (ptr-8ripyygk132m260h1d8.18120a2.ip6.access.telenet.be [IPv6:2a02:1811:2419:4e02:8deb:e195:6c41:992c]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id D0176411AF; Wed, 30 May 2018 14:17:31 +0200 (CEST) From: "Kristof Provost" To: "Hartmann, O." Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334375 - in head/sys: net netpfil/pf Date: Wed, 30 May 2018 14:17:30 +0200 X-Mailer: MailMate (2.0BETAr6111) Message-ID: <92B96A88-6F0C-4C5B-A924-4E4CD0777116@FreeBSD.org> In-Reply-To: <20180530141347.1bf868ac@hermann> References: <201805300711.w4U7BYjS066960@repo.freebsd.org> <20180530141347.1bf868ac@hermann> MIME-Version: 1.0 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 12:17:34 -0000 On 30 May 2018, at 14:13, Hartmann, O. wrote: > On Wed, 30 May 2018 07:11:34 +0000 (UTC) > Kristof Provost wrote: > >> Author: kp >> Date: Wed May 30 07:11:33 2018 >> New Revision: 334375 >> URL: https://svnweb.freebsd.org/changeset/base/334375 >> >> Log: >> pf: Replace rwlock on PF_RULES_LOCK with rmlock >> >> Given that PF_RULES_LOCK is a mostly read lock, replace the rwlock >> with rmlock. This change improves packet processing rate in high pps >> environments. Benchmarking by olivier@ shows a 65% improvement in pps. >> >> While here, also eliminate all appearances of "sys/rwlock.h" >> includes since it is not used anymore. >> >> Submitted by: farrokhi@ >> Differential Revision: https://reviews.freebsd.org/D15502 > > It seems, this commit issues an error while compiling the kernel: > > > [...] > --- all_subdir_pf --- > --- pf_ruleset.o --- > In file included from /usr/src/sys/netpfil/pf/pf_ruleset.c:57: > In file included from /usr/src/sys/net/pfvar.h:44: > In file included from /usr/src/sys/sys/rmlock.h:37: > /usr/src/sys/sys/mutex.h:96:52: error: expected ')' > int _mtx_trylock_flags_int(struct mtx *m, int opts > LOCK_FILE_LINE_ARG_DEF); ^ > /usr/src/sys/sys/mutex.h:96:27: note: to match this '(' > int _mtx_trylock_flags_int(struct mtx *m, int opts > LOCK_FILE_LINE_ARG_DEF); ^ > /usr/src/sys/sys/mutex.h:100:5: error: 'LOCK_DEBUG' is not defined, > evaluates to 0 [-Werror,-Wundef] #if LOCK_DEBUG > 0 > ^ > /usr/src/sys/sys/mutex.h:111:5: error: 'LOCK_DEBUG' is not defined, > evaluates to 0 [-Werror,-Wundef] #if LOCK_DEBUG > 0 Just to confirm: are you building for mips? Regards, Kristof From owner-svn-src-head@freebsd.org Wed May 30 12:33:12 2018 Return-Path: Delivered-To: svn-src-head@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 AD2E0EF7DE1; Wed, 30 May 2018 12:33:12 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0459080D59; Wed, 30 May 2018 12:33:11 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from hermann ([141.89.155.168]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0M5MIN-1gFXDj21vT-00zaKm; Wed, 30 May 2018 14:33:04 +0200 Date: Wed, 30 May 2018 14:33:03 +0200 From: "Hartmann, O." To: "Kristof Provost" Cc: "Hartmann, O." , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r334375 - in head/sys: net netpfil/pf Message-ID: <20180530143258.64b26810@hermann> In-Reply-To: <92B96A88-6F0C-4C5B-A924-4E4CD0777116@FreeBSD.org> References: <201805300711.w4U7BYjS066960@repo.freebsd.org> <20180530141347.1bf868ac@hermann> <92B96A88-6F0C-4C5B-A924-4E4CD0777116@FreeBSD.org> Organization: walstatt.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:XRi+v4+z3N0mvSyZxfGEQHSiBoGfDh1iMTVSXShL9s3l5e49GSK nZkTF2YR21qye4MrEC5ljy0n7hUXMKdxRCEnvtY/m8Ii/TsoVBfHas+KM3Yj0kUNBb9aA0S 9kRg+hUsnOiUNS/sRZgi/OSZauwK44JaNU8mZ7RRlKhO5B/VsceTG3OXK1cn+VkabIrJTOv 2L2uEuvqEgQCGUulQLJgg== X-UI-Out-Filterresults: notjunk:1;V01:K0:MM6CL5KGoxQ=:7HFc3UZkWGmm/DdUwEtYCQ hrX/jx4CliNoQhY0Df687TBw7zg7fRBKpUopCsYUbgl+gYdPWJqZ3uaysKIeFN64FhKoZ157U zeLY7PMoADEaSVdBgvezrg1dxWIxIp47SajtgLcG2L3dMtgz8oAU3BI6fkNlpPBE2OyEf2ZVp lE7C+TlG2chs8VmMQ81jl0oaocsqbgLMwwXebQFBdwJMLwwp4gYKOH2z2eQJ76Fb1hzL+E0YM UMP3BX8FKt2FKe2gY066ylVTDAu3G6Blvr0jYxsnqlGwabbBm9lT+wVCzaY8kbXHap0TjoQeA bCBZ5OrQPcHyEylyYxubBHr2lTUQ8Iw7xnyjwdpERA0pThW0NWY5p1cI4b5ntQvnOc9i1U9+W AOnVAzkhxh/KI8ciU/wT0RGjhQiCJ7wxFdY8WaSEm6yXexjyKT2YFVkFMrZ4JC07064nO1qt9 Cd0Oo80HIaPTo+1EeKm2oUywRNUxJn2F/rXh0+BjQ9kCfUo5y3xk/wkuTdRKQ4DbnDe7uf4CU rVSqql3k4aSKSRiI/vxWv8UduCgI+dijXiesAgHM+kDVG4LmkXWnl/2EyOAyu8eEeqnPzdfvr n9pMu8HLUgr8oq4q3mSldYXQCR67rCftKhf6ScadlPYFesBVVTsdf9nkGfI68FMw3JyfBQT0D Er2PLl12WfjettIxep7e9JomZiSiiOxZRhjfemF9FL1GVeJ/EnjAtdINajB9GYI0azy+JzX7a UeNmiczvNa07yc+9Wed3pHV+Z4jrq/s6yg00Pjc35XblDcFh5H6YG1fuq8s840D4EYJRIDAuL 8RwAZ5K X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 12:33:12 -0000 On Wed, 30 May 2018 14:17:30 +0200 "Kristof Provost" wrote: > On 30 May 2018, at 14:13, Hartmann, O. wrote: > > On Wed, 30 May 2018 07:11:34 +0000 (UTC) > > Kristof Provost wrote: > > > >> Author: kp > >> Date: Wed May 30 07:11:33 2018 > >> New Revision: 334375 > >> URL: https://svnweb.freebsd.org/changeset/base/334375 > >> > >> Log: > >> pf: Replace rwlock on PF_RULES_LOCK with rmlock > >> > >> Given that PF_RULES_LOCK is a mostly read lock, replace the > >> rwlock with rmlock. This change improves packet processing rate in > >> high pps environments. Benchmarking by olivier@ shows a 65% > >> improvement in pps. > >> > >> While here, also eliminate all appearances of "sys/rwlock.h" > >> includes since it is not used anymore. > >> > >> Submitted by: farrokhi@ > >> Differential Revision: > >> https://reviews.freebsd.org/D15502 > > > > It seems, this commit issues an error while compiling the kernel: > > > > > > [...] > > --- all_subdir_pf --- > > --- pf_ruleset.o --- > > In file included from /usr/src/sys/netpfil/pf/pf_ruleset.c:57: > > In file included from /usr/src/sys/net/pfvar.h:44: > > In file included from /usr/src/sys/sys/rmlock.h:37: > > /usr/src/sys/sys/mutex.h:96:52: error: expected ')' > > int _mtx_trylock_flags_int(struct mtx *m, int opts > > LOCK_FILE_LINE_ARG_DEF); ^ > > /usr/src/sys/sys/mutex.h:96:27: note: to match this '(' > > int _mtx_trylock_flags_int(struct mtx *m, int opts > > LOCK_FILE_LINE_ARG_DEF); ^ > > /usr/src/sys/sys/mutex.h:100:5: error: 'LOCK_DEBUG' is not defined, > > evaluates to 0 [-Werror,-Wundef] #if LOCK_DEBUG > 0 > > ^ > > /usr/src/sys/sys/mutex.h:111:5: error: 'LOCK_DEBUG' is not defined, > > evaluates to 0 [-Werror,-Wundef] #if LOCK_DEBUG > 0 > > Just to confirm: are you building for mips? > > Regards, > Kristof No, the hardware is a Lenovo E540 notebook equipted with a Intel 4200M CPU (Haswell) -> amd64. Regards, oh From owner-svn-src-head@freebsd.org Wed May 30 12:40:38 2018 Return-Path: Delivered-To: svn-src-head@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 57F5CEF880A; Wed, 30 May 2018 12:40:38 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F3B3781197; Wed, 30 May 2018 12:40:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D4F192CB9; Wed, 30 May 2018 12:40:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UCebjV032247; Wed, 30 May 2018 12:40:37 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UCebAZ032246; Wed, 30 May 2018 12:40:37 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201805301240.w4UCebAZ032246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 30 May 2018 12:40:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334379 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 334379 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 12:40:38 -0000 Author: kp Date: Wed May 30 12:40:37 2018 New Revision: 334379 URL: https://svnweb.freebsd.org/changeset/base/334379 Log: pf: Add missing include statement rmlocks require as well as . Unbreak mips build. Modified: head/sys/net/pfvar.h Modified: head/sys/net/pfvar.h ============================================================================== --- head/sys/net/pfvar.h Wed May 30 11:45:29 2018 (r334378) +++ head/sys/net/pfvar.h Wed May 30 12:40:37 2018 (r334379) @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include From owner-svn-src-head@freebsd.org Wed May 30 12:41:45 2018 Return-Path: Delivered-To: svn-src-head@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 8E13CEF8B10; Wed, 30 May 2018 12:41:45 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (unknown [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 37629815BA; Wed, 30 May 2018 12:41:42 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id F31CB26CF5; Wed, 30 May 2018 12:41:41 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from [172.28.128.1] (ptr-8ripyygk132m260h1d8.18120a2.ip6.access.telenet.be [IPv6:2a02:1811:2419:4e02:8deb:e195:6c41:992c]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id ABEA341292; Wed, 30 May 2018 14:41:40 +0200 (CEST) From: "Kristof Provost" To: "Hartmann, O." Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r334375 - in head/sys: net netpfil/pf Date: Wed, 30 May 2018 14:41:39 +0200 X-Mailer: MailMate (2.0BETAr6111) Message-ID: In-Reply-To: <20180530143258.64b26810@hermann> References: <201805300711.w4U7BYjS066960@repo.freebsd.org> <20180530141347.1bf868ac@hermann> <92B96A88-6F0C-4C5B-A924-4E4CD0777116@FreeBSD.org> <20180530143258.64b26810@hermann> MIME-Version: 1.0 Content-Type: text/plain; markup=markdown X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 12:41:45 -0000 On 30 May 2018, at 14:33, Hartmann, O. wrote: > On Wed, 30 May 2018 14:17:30 +0200 > "Kristof Provost" wrote: > >> On 30 May 2018, at 14:13, Hartmann, O. wrote: >>> On Wed, 30 May 2018 07:11:34 +0000 (UTC) >>> Kristof Provost wrote: >>> >>>> Author: kp >>>> Date: Wed May 30 07:11:33 2018 >>>> New Revision: 334375 >>>> URL: https://svnweb.freebsd.org/changeset/base/334375 >>>> >>>> Log: >>>> pf: Replace rwlock on PF_RULES_LOCK with rmlock >>>> >>>> Given that PF_RULES_LOCK is a mostly read lock, replace the >>>> rwlock with rmlock. This change improves packet processing rate in >>>> high pps environments. Benchmarking by olivier@ shows a 65% >>>> improvement in pps. >>>> >>>> While here, also eliminate all appearances of "sys/rwlock.h" >>>> includes since it is not used anymore. >>>> >>>> Submitted by: farrokhi@ >>>> Differential Revision: >>>> https://reviews.freebsd.org/D15502 >>> >>> It seems, this commit issues an error while compiling the kernel: >>> >>> >>> [...] >>> --- all_subdir_pf --- >>> --- pf_ruleset.o --- >>> In file included from /usr/src/sys/netpfil/pf/pf_ruleset.c:57: >>> In file included from /usr/src/sys/net/pfvar.h:44: >>> In file included from /usr/src/sys/sys/rmlock.h:37: >>> /usr/src/sys/sys/mutex.h:96:52: error: expected ')' >>> int _mtx_trylock_flags_int(struct mtx *m, int opts >>> LOCK_FILE_LINE_ARG_DEF); ^ >>> /usr/src/sys/sys/mutex.h:96:27: note: to match this '(' >>> int _mtx_trylock_flags_int(struct mtx *m, int opts >>> LOCK_FILE_LINE_ARG_DEF); ^ >>> /usr/src/sys/sys/mutex.h:100:5: error: 'LOCK_DEBUG' is not defined, >>> evaluates to 0 [-Werror,-Wundef] #if LOCK_DEBUG > 0 >>> ^ >>> /usr/src/sys/sys/mutex.h:111:5: error: 'LOCK_DEBUG' is not defined, >>> evaluates to 0 [-Werror,-Wundef] #if LOCK_DEBUG > 0 >> >> Just to confirm: are you building for mips? >> >> Regards, >> Kristof > > > No, the hardware is a Lenovo E540 notebook equipted with a Intel 4200M > CPU (Haswell) -> amd64. > Odd. The other reports I got were mips only. I did test amd64. Are you using gcc to build perhaps? r334379 should fix it. Regards, Kristof From owner-svn-src-head@freebsd.org Wed May 30 12:41:50 2018 Return-Path: Delivered-To: svn-src-head@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 40C12EF8B46; Wed, 30 May 2018 12:41:50 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.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 D2E9881656; Wed, 30 May 2018 12:41:47 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w4UCfhRE071875; Wed, 30 May 2018 05:41:43 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w4UCfhoE071874; Wed, 30 May 2018 05:41:43 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201805301241.w4UCfhoE071874@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool In-Reply-To: To: Antoine Brodin Date: Wed, 30 May 2018 05:41:42 -0700 (PDT) CC: Hans Petter Selasky , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 12:41:50 -0000 > On Wed, May 30, 2018 at 8:20 AM, Hans Petter Selasky wrote: > > On 05/30/18 10:02, Antoine Brodin wrote: > >> > >> Could the pcap/pcap.h header be fixed instead with #ifdef HAVE_REMOTE > >> as it previously had? > > > > > > The HAVE_REMOTE was removed upstream: > > > > https://github.com/the-tcpdump-group/libpcap/commit/a372536befc9b1ee1d355058daa2eb9f66aa0c59#diff-46964bcbd8e8a5cec9a75c66ab26a97b > > > > What do you think? Shall we re-add it to base? > > Either hide remote packet capture functions from the header or enable > remote capture functions? > Note that net/p5-Net-Pcap will fail to build with libpcap from ports > too when libpcap from ports is updated to version 1.9.0 (pre-release). If there is any thoughs of merging this to stable/11 wont the HAVE_REMOTE have to be turned on anyway? I suppose it get be #ifdef FreeBSD_VERSION. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Wed May 30 12:55:28 2018 Return-Path: Delivered-To: svn-src-head@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 6DE4EEF9E14; Wed, 30 May 2018 12:55:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1FE73820ED; Wed, 30 May 2018 12:55:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00F0A2FD9; Wed, 30 May 2018 12:55:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UCtRIZ043522; Wed, 30 May 2018 12:55:27 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UCtRLY043521; Wed, 30 May 2018 12:55:27 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201805301255.w4UCtRLY043521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 30 May 2018 12:55:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334380 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 334380 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 12:55:28 -0000 Author: emaste Date: Wed May 30 12:55:27 2018 New Revision: 334380 URL: https://svnweb.freebsd.org/changeset/base/334380 Log: link_elf_obj: correct an error message Previously we'd report that a file has "no valid symbol table" if it in fact had two or more. Change the message to report that there must be exactly one. Modified: head/sys/kern/link_elf_obj.c Modified: head/sys/kern/link_elf_obj.c ============================================================================== --- head/sys/kern/link_elf_obj.c Wed May 30 12:40:37 2018 (r334379) +++ head/sys/kern/link_elf_obj.c Wed May 30 12:55:27 2018 (r334380) @@ -656,7 +656,8 @@ link_elf_load_file(linker_class_t cls, const char *fil } if (nsym != 1) { /* Only allow one symbol table for now */ - link_elf_error(filename, "file has no valid symbol table"); + link_elf_error(filename, + "file must have exactly one symbol table"); error = ENOEXEC; goto out; } From owner-svn-src-head@freebsd.org Wed May 30 13:34:29 2018 Return-Path: Delivered-To: svn-src-head@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 68507EFCE79; Wed, 30 May 2018 13:34:29 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE742836AF; Wed, 30 May 2018 13:34:28 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 61D8E260174; Wed, 30 May 2018 15:34:27 +0200 (CEST) Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: rgrimes@freebsd.org, Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805301241.w4UCfhoE071874@pdx.rh.CN85.dnsmgr.net> From: Hans Petter Selasky Message-ID: <34baadb9-ab2c-6740-cc52-8dca80dec934@selasky.org> Date: Wed, 30 May 2018 15:34:13 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <201805301241.w4UCfhoE071874@pdx.rh.CN85.dnsmgr.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 13:34:29 -0000 On 05/30/18 14:41, Rodney W. Grimes wrote: >> Either hide remote packet capture functions from the header or enable >> remote capture functions? >> Note that net/p5-Net-Pcap will fail to build with libpcap from ports >> too when libpcap from ports is updated to version 1.9.0 (pre-release). > If there is any thoughs of merging this to stable/11 wont the > HAVE_REMOTE have to be turned on anyway? > > I suppose it get be #ifdef FreeBSD_VERSION. Yes, #if 0 is fine. --HPS From owner-svn-src-head@freebsd.org Wed May 30 13:47:55 2018 Return-Path: Delivered-To: svn-src-head@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 70DDBEFDF3A; Wed, 30 May 2018 13:47:55 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C79E383F43; Wed, 30 May 2018 13:47:54 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-lf0-x241.google.com with SMTP id o9-v6so4396777lfk.1; Wed, 30 May 2018 06:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=olEFy6mRCIxFynFBzWRAqLB46LpE0f/YMO+jDiuS7rk=; b=o+QmquWFjEXnyj9n8Gf5GIGrWYJmFBFbVd75a1DNCJTdwnext++cV3pwzzhpEAJ5En ZOKe0u8LObRYTKyGEryMbC2BKosWnaQSq7ZE0/8aLQPCQFNXETe4adRcB6XyLLmfTNXH BslhNVnPx8vyb3ipVU7XEdLuoQ6mREVfos8Q0AzxRUAf1YtL2vYG2XWQ/2qLbPTEswar CG6pGkhHa4cgdZzgdfU7gQBTXjxh/Mi8xwj5quignUSfGXRCGksUgQ3GGHlAjTOvt1Dt CN0fesu8FKetbMZnH6LXkff5ct57PLpIuMGRxupLGWswbf5FbTaQmIy0i1bKi1b+izVM Ey5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=olEFy6mRCIxFynFBzWRAqLB46LpE0f/YMO+jDiuS7rk=; b=FQgPnUd71VXGBZuMlHwiqmQPpcLjW+Eosewuh9v0KbodTGznSxUuUfGxNyGmV1fbel 2+7qCktl5K5T2s5wqLLeWAolQZUtpQrBr0L4PHfTknuUpLEe6OcjFinYR2+eLMGPpShc e1Wr71m/dCRckLFg6pyRv8bestSD5uCIjO5YdgXqRtVJ9Hr6JiKioxTYxBM1e2vv2+Ln 9d9cQ4/StZ89N6BqFd1kKHyknSR+QWXrC7wc3BHlo2CZmKhE1934XDpMVPfMfY1ZDYGl esrFMhAQuBA+YKpr/QzKDBLDiBLChIg0kkgXxxBEaiQc7W1WmxuUPAnR2xLUCBk8SmDc J1rA== X-Gm-Message-State: ALKqPwctLHSmXVraDghLmOnHPXoPhOB6VcOLMvLubznTbaDnAX1TKY60 /lCmsZEiuUIp3mCnThW5Z0v/2csO8+kcnxwDzk0= X-Google-Smtp-Source: ADUXVKLFbKxEEBPHfcWHUrjEDwI4x0NbXgEPgL/rV70HxzmjSHLrT3k/zZhGMJmpa2KEnEfR0Le6xK2is1brRTk+QcU= X-Received: by 2002:a19:51db:: with SMTP id g88-v6mr1831237lfl.78.1527688069464; Wed, 30 May 2018 06:47:49 -0700 (PDT) MIME-Version: 1.0 Sender: chmeeedalf@gmail.com Received: by 2002:a2e:3a13:0:0:0:0:0 with HTTP; Wed, 30 May 2018 06:47:48 -0700 (PDT) In-Reply-To: <25bd4319-6d7f-e668-88e4-4c3adbc1e8e9@freebsd.org> References: <201805300241.w4U2fmvB033942@repo.freebsd.org> <25bd4319-6d7f-e668-88e4-4c3adbc1e8e9@freebsd.org> From: Justin Hibbits Date: Wed, 30 May 2018 08:47:48 -0500 X-Google-Sender-Auth: eZG7tQrEmeCwrxjZJGmjPc90l1g Message-ID: Subject: Re: svn commit: r334365 - head/sys/dev/pci To: Peter Grehan Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 13:47:55 -0000 On Wed, May 30, 2018 at 4:42 AM, Peter Grehan wrote: >> PCIe only permits 1 device on an endpoint, so some devices ignore the >> device >> part of B:D:F probing. Although ARI likely fixes this, not all >> platforms >> support ARI completely or correctly, so some devices end up showing up >> 32 >> times on the bus. > > > I think this might have broken bhyve - a fake PCIe capability is put on the > root port so that guests will use MSI/MSI-x, but otherwise it looks like > parallel PCI. Not exactly spec-compliant, but then neither is most of the > world of PCI/PCIe. > > It may be worth #ifdef'ing this with powerpc. > > later, > > Peter. I can special case i386 and amd64, but this change should (eventually) remove the majority of the current special case overrides for alternative architectures. I think it'd be better to have a bhyve root bridge driver that itself overrides pci_maxslots(), and have the 'compliant' path be the common. Thoughts? - Justin From owner-svn-src-head@freebsd.org Wed May 30 13:51:01 2018 Return-Path: Delivered-To: svn-src-head@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 375DDEFE335; Wed, 30 May 2018 13:51:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E13298428A; Wed, 30 May 2018 13:51:00 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C25DC3C57; Wed, 30 May 2018 13:51:00 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UDp0wA068651; Wed, 30 May 2018 13:51:00 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UDp0bL068650; Wed, 30 May 2018 13:51:00 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201805301351.w4UDp0bL068650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 30 May 2018 13:51:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334381 - head/tools/tools/makeroot X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/tools/tools/makeroot X-SVN-Commit-Revision: 334381 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 13:51:01 -0000 Author: emaste Date: Wed May 30 13:51:00 2018 New Revision: 334381 URL: https://svnweb.freebsd.org/changeset/base/334381 Log: makeroot.sh: allow duplicate entries even with -f makefs disallows duplicate entries unless the -D option is specified. Previously makeroot.sh enabled -D unless a filelist was provided via the -f options. The filelist logic creates an mtree manifest from the METALOG and the provided filelist by passing them through `sort -u`, so duplicates were not expected. However, duplicates can still occur when a directory appears in multiple packages -- for example, ./etc/pam.d type=dir uname=root gname=wheel mode=0755 ./etc/pam.d type=dir mode=0755 tags=package=runtime ./etc/pam.d type=dir mode=0755 tags=package=at ./etc/pam.d type=dir mode=0755 tags=package=ftp ./etc/pam.d type=dir mode=0755 tags=package=telnet For the purposes of makefs these directory entries are identical, but are of course not identical for sort -u. For now just leave the allow duplicates -D flag enabled. PR: 228606 Sponsored by: The FreeBSD Foundation Modified: head/tools/tools/makeroot/makeroot.sh Modified: head/tools/tools/makeroot/makeroot.sh ============================================================================== --- head/tools/tools/makeroot/makeroot.sh Wed May 30 12:55:27 2018 (r334380) +++ head/tools/tools/makeroot/makeroot.sh Wed May 30 13:51:00 2018 (r334381) @@ -80,7 +80,7 @@ while getopts "B:de:f:g:K:k:l:p:s:" opt; do B) BFLAG="-B ${OPTARG}" ;; d) DEBUG=1 ;; e) EXTRAS="${EXTRAS} ${OPTARG}" ;; - f) FILELIST="${OPTARG}"; DUPFLAG= ;; + f) FILELIST="${OPTARG}";; g) GROUP="${OPTARG}" ;; K) KEYUSERS="${KEYUSERS} ${OPTARG}" ;; k) KEYDIR="${OPTARG}" ;; From owner-svn-src-head@freebsd.org Wed May 30 14:18:20 2018 Return-Path: Delivered-To: svn-src-head@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 4A1CFF6FC51; Wed, 30 May 2018 14:18:20 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EDE8D856A8; Wed, 30 May 2018 14:18:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CEE654161; Wed, 30 May 2018 14:18:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UEIJXW083405; Wed, 30 May 2018 14:18:19 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UEIJwq083404; Wed, 30 May 2018 14:18:19 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201805301418.w4UEIJwq083404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 30 May 2018 14:18:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334382 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 334382 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 14:18:20 -0000 Author: andrew Date: Wed May 30 14:18:19 2018 New Revision: 334382 URL: https://svnweb.freebsd.org/changeset/base/334382 Log: Push down the locking in pmap_fault to just be around the calls to arm64_address_translate_*. There is no need to lock around the switch statement as we only care about a few cases. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Wed May 30 13:51:00 2018 (r334381) +++ head/sys/arm64/arm64/pmap.c Wed May 30 14:18:19 2018 (r334382) @@ -4964,12 +4964,12 @@ pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far) } /* Data and insn aborts use same encoding for FCS field. */ - PMAP_LOCK(pmap); switch (esr & ISS_DATA_DFSC_MASK) { case ISS_DATA_DFSC_TF_L0: case ISS_DATA_DFSC_TF_L1: case ISS_DATA_DFSC_TF_L2: case ISS_DATA_DFSC_TF_L3: + PMAP_LOCK(pmap); /* Ask the MMU to check the address */ intr = intr_disable(); if (pmap == kernel_pmap) @@ -4977,21 +4977,19 @@ pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far) else par = arm64_address_translate_s1e0r(far); intr_restore(intr); + PMAP_UNLOCK(pmap); /* * If the translation was successful the address was invalid * due to a break-before-make sequence. We can unlock and * return success to the trap handler. */ - if (PAR_SUCCESS(par)) { - PMAP_UNLOCK(pmap); + if (PAR_SUCCESS(par)) return (KERN_SUCCESS); - } break; default: break; } - PMAP_UNLOCK(pmap); #endif return (KERN_FAILURE); From owner-svn-src-head@freebsd.org Wed May 30 14:37:48 2018 Return-Path: Delivered-To: svn-src-head@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 A412BF718F5; Wed, 30 May 2018 14:37:48 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from c.mail.sonic.net (c.mail.sonic.net [64.142.111.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34341862D8; Wed, 30 May 2018 14:37:48 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from comporellon.tachypleus.net (cpe-75-82-218-62.socal.res.rr.com [75.82.218.62]) (authenticated bits=0) by c.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id w4UER4lp007350 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Wed, 30 May 2018 07:27:04 -0700 Subject: Re: svn commit: r334365 - head/sys/dev/pci To: Peter Grehan , Justin Hibbits , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805300241.w4U2fmvB033942@repo.freebsd.org> <25bd4319-6d7f-e668-88e4-4c3adbc1e8e9@freebsd.org> From: Nathan Whitehorn Message-ID: <264b6c9f-efa3-13e8-1d41-0cdc8631ec82@freebsd.org> Date: Wed, 30 May 2018 07:27:03 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <25bd4319-6d7f-e668-88e4-4c3adbc1e8e9@freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Sonic-CAuth: UmFuZG9tSVY68c4vhh+HeWvzBM1e+W/fFe9bF75e0Bg6DbhyHDYEPMx4KDxESJtgzCmwVrGJsCSrczTht8XRZaY2uwUrHxsNA1vSApdEKLk= X-Sonic-ID: C;+GY+hhVk6BGh5K41UvMdPQ== M;WKGPhhVk6BGh5K41UvMdPQ== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 14:37:48 -0000 On 05/30/18 02:42, Peter Grehan wrote: >>    PCIe only permits 1 device on an endpoint, so some devices ignore >> the device >>    part of B:D:F probing.  Although ARI likely fixes this, not all >> platforms >>    support ARI completely or correctly, so some devices end up >> showing up 32 >>    times on the bus. > >  I think this might have broken bhyve - a fake PCIe capability is put > on the root port so that guests will use MSI/MSI-x, but otherwise it > looks like parallel PCI. Not exactly spec-compliant, but then neither > is most of the world of PCI/PCIe. > >  It may be worth #ifdef'ing this with powerpc. > > later, > > Peter. > There are a ton of ARM boards that need this too. You can find one-off hacks all through the tree and one of the nice things about this change is that all of those can be consolidated/removed now. If we are going to have some #ifdef and special cases, it would be better to make them for bhyve. -Nathan From owner-svn-src-head@freebsd.org Wed May 30 15:08:47 2018 Return-Path: Delivered-To: svn-src-head@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 F14D4F74598; Wed, 30 May 2018 15:08:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9629A87C49; Wed, 30 May 2018 15:08:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73428499F; Wed, 30 May 2018 15:08:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UF8k0F008719; Wed, 30 May 2018 15:08:46 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UF8kVG008718; Wed, 30 May 2018 15:08:46 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201805301508.w4UF8kVG008718@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 30 May 2018 15:08:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334383 - head/lib/libdevinfo X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/lib/libdevinfo X-SVN-Commit-Revision: 334383 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 15:08:47 -0000 Author: imp Date: Wed May 30 15:08:46 2018 New Revision: 334383 URL: https://svnweb.freebsd.org/changeset/base/334383 Log: There's no meaningful errno when there's a version mismatch, so use warnx. Also, report the mis-matched versions. Modified: head/lib/libdevinfo/devinfo.c Modified: head/lib/libdevinfo/devinfo.c ============================================================================== --- head/lib/libdevinfo/devinfo.c Wed May 30 14:18:19 2018 (r334382) +++ head/lib/libdevinfo/devinfo.c Wed May 30 15:08:46 2018 (r334383) @@ -125,7 +125,8 @@ devinfo_init(void) } if ((ub_size != sizeof(ubus)) || (ubus.ub_version != BUS_USER_VERSION)) { - warn("kernel bus interface version mismatch"); + warnx("kernel bus interface version mismatch: kernel %d expected %d", + ubus.ub_version, BUS_USER_VERSION); return(EINVAL); } debug("generation count is %d", ubus.ub_generation); From owner-svn-src-head@freebsd.org Wed May 30 15:09:00 2018 Return-Path: Delivered-To: svn-src-head@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 01F4AF745E6; Wed, 30 May 2018 15:09:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A415487D50; Wed, 30 May 2018 15:08:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 853ED49A0; Wed, 30 May 2018 15:08:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UF8xPG008775; Wed, 30 May 2018 15:08:59 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UF8xxo008774; Wed, 30 May 2018 15:08:59 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201805301508.w4UF8xxo008774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 30 May 2018 15:08:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334384 - head/usr.sbin/devinfo X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.sbin/devinfo X-SVN-Commit-Revision: 334384 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 15:09:00 -0000 Author: imp Date: Wed May 30 15:08:59 2018 New Revision: 334384 URL: https://svnweb.freebsd.org/changeset/base/334384 Log: devinfo_init() returns an errno, but doesn't set errno, so the error message when it fails reflects some random thing rather than what it returned. Set errno to the return value. Modified: head/usr.sbin/devinfo/devinfo.c Modified: head/usr.sbin/devinfo/devinfo.c ============================================================================== --- head/usr.sbin/devinfo/devinfo.c Wed May 30 15:08:46 2018 (r334383) +++ head/usr.sbin/devinfo/devinfo.c Wed May 30 15:08:59 2018 (r334384) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -242,7 +243,7 @@ int main(int argc, char *argv[]) { struct devinfo_dev *root; - int c, uflag; + int c, uflag, rv; char *path = NULL; uflag = 0; @@ -268,8 +269,10 @@ main(int argc, char *argv[]) if (path && (rflag || uflag)) usage(); - if (devinfo_init()) + if ((rv = devinfo_init()) != 0) { + errno = rv; err(1, "devinfo_init"); + } if ((root = devinfo_handle_to_device(DEVINFO_ROOT_DEVICE)) == NULL) errx(1, "can't find root device"); From owner-svn-src-head@freebsd.org Wed May 30 15:25:50 2018 Return-Path: Delivered-To: svn-src-head@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 E4032F763A3; Wed, 30 May 2018 15:25:49 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 82FC568ED7; Wed, 30 May 2018 15:25:49 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63C394CCF; Wed, 30 May 2018 15:25:49 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UFPnIB018515; Wed, 30 May 2018 15:25:49 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UFPneq018514; Wed, 30 May 2018 15:25:49 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201805301525.w4UFPneq018514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 30 May 2018 15:25:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334385 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 334385 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 15:25:50 -0000 Author: andrew Date: Wed May 30 15:25:48 2018 New Revision: 334385 URL: https://svnweb.freebsd.org/changeset/base/334385 Log: Further limit when we call pmap_fault. We should only call pmap_fault in the kernel when accessing a userspace address. As this should always happen through specific functions that set a fault handler we can use this to limit calls to pmap_fault to when this is set. This should help with NULL pointer dereferences when we are unable to sleep so we fall into the correct case. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/trap.c Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Wed May 30 15:08:59 2018 (r334384) +++ head/sys/arm64/arm64/trap.c Wed May 30 15:25:48 2018 (r334385) @@ -190,16 +190,32 @@ data_abort(struct thread *td, struct trapframe *frame, } /* - * We may fault from userspace or when in a DMAP region due to - * a superpage being unmapped when the access took place. In these - * cases we need to wait for the pmap to be unlocked and check - * if the translation is still invalid. + * The call to pmap_fault can be dangerous when coming from the + * kernel as it may be not be able to lock the pmap to check if + * the address is now valid. Because of this we filter the cases + * when we are not going to see superpage activity. */ - if (map != kernel_map || VIRT_IN_DMAP(far)) { - if (pmap_fault(map->pmap, esr, far) == KERN_SUCCESS) - return; + if (!lower) { + /* + * We may fault in a DMAP region due to a superpage being + * unmapped when the access took place. + */ + if (map == kernel_map && !VIRT_IN_DMAP(far)) + goto no_pmap_fault; + /* + * We can also fault in the userspace handling functions, + * e.g. copyin. In these cases we will have set a fault + * handler so we can check if this is set before calling + * pmap_fault. + */ + if (map != kernel_map && pcb->pcb_onfault == 0) + goto no_pmap_fault; } + if (pmap_fault(map->pmap, esr, far) == KERN_SUCCESS) + return; + +no_pmap_fault: KASSERT(td->td_md.md_spinlock_count == 0, ("data abort with spinlock held")); if (td->td_critnest != 0 || WITNESS_CHECK(WARN_SLEEPOK | From owner-svn-src-head@freebsd.org Wed May 30 15:32:32 2018 Return-Path: Delivered-To: svn-src-head@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 B533AF76F74; Wed, 30 May 2018 15:32:32 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 680F6696F2; Wed, 30 May 2018 15:32:32 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 494F44E68; Wed, 30 May 2018 15:32:32 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UFWWnF023472; Wed, 30 May 2018 15:32:32 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UFWWbn023471; Wed, 30 May 2018 15:32:32 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201805301532.w4UFWWbn023471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 30 May 2018 15:32:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334386 - head/sys/dev/extres/regulator X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/extres/regulator X-SVN-Commit-Revision: 334386 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 15:32:32 -0000 Author: manu Date: Wed May 30 15:32:31 2018 New Revision: 334386 URL: https://svnweb.freebsd.org/changeset/base/334386 Log: regulator: Fix typo (shuting/shutting) Submitted by: Jose Luis Duran (github pull #151) Modified: head/sys/dev/extres/regulator/regulator.c Modified: head/sys/dev/extres/regulator/regulator.c ============================================================================== --- head/sys/dev/extres/regulator/regulator.c Wed May 30 15:25:48 2018 (r334385) +++ head/sys/dev/extres/regulator/regulator.c Wed May 30 15:32:31 2018 (r334386) @@ -174,7 +174,7 @@ regulator_shutdown(void *dummy) TAILQ_FOREACH(entry, ®node_list, reglist_link) { if (entry->std_param.always_on == 0 && disable) { if (bootverbose) - printf("regulator: shuting down %s\n", + printf("regulator: shutting down %s\n", entry->name); ret = regnode_status(entry, &status); if (ret == 0 && status == REGULATOR_STATUS_ENABLED) From owner-svn-src-head@freebsd.org Wed May 30 15:37:10 2018 Return-Path: Delivered-To: svn-src-head@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 77CC9F77598; Wed, 30 May 2018 15:37:10 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2086F69A0F; Wed, 30 May 2018 15:37:10 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 019404E6C; Wed, 30 May 2018 15:37:10 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UFb9JT023711; Wed, 30 May 2018 15:37:09 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UFb9kr023710; Wed, 30 May 2018 15:37:09 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201805301537.w4UFb9kr023710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 30 May 2018 15:37:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334387 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 334387 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 15:37:10 -0000 Author: andrew Date: Wed May 30 15:37:09 2018 New Revision: 334387 URL: https://svnweb.freebsd.org/changeset/base/334387 Log: Remove max_pa, it's unused. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Wed May 30 15:32:31 2018 (r334386) +++ head/sys/arm64/arm64/pmap.c Wed May 30 15:37:09 2018 (r334387) @@ -766,7 +766,7 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_ pt_entry_t *l2; vm_offset_t va, freemempos; vm_offset_t dpcpu, msgbufpv; - vm_paddr_t start_pa, pa, max_pa, min_pa; + vm_paddr_t start_pa, pa, min_pa; int i; kern_delta = KERNBASE - kernstart; @@ -780,7 +780,7 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_ PMAP_LOCK_INIT(kernel_pmap); /* Assume the address we were loaded to is a valid physical address */ - min_pa = max_pa = KERNBASE - kern_delta; + min_pa = KERNBASE - kern_delta; physmap_idx = arm_physmem_avail(physmap, nitems(physmap)); physmap_idx /= 2; @@ -794,8 +794,6 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_ continue; if (physmap[i] <= min_pa) min_pa = physmap[i]; - if (physmap[i + 1] > max_pa) - max_pa = physmap[i + 1]; } freemempos = KERNBASE + kernlen; From owner-svn-src-head@freebsd.org Wed May 30 15:43:19 2018 Return-Path: Delivered-To: svn-src-head@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 08C21F77FEB; Wed, 30 May 2018 15:43:19 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f182.google.com (mail-io0-f182.google.com [209.85.223.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 89DBA6A0ED; Wed, 30 May 2018 15:43:18 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f182.google.com with SMTP id 200-v6so21140286ioz.6; Wed, 30 May 2018 08:43:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=rVRHm2afVEKfXyFgtueiCweZOtXV8k8vdIf6G+APYdk=; b=pmDSnn8RZbSZQC227kc/NjE89smwhecpIi5c/9fKoEN4nwtbS3Miw3FQXTSBATMDUB smtGLnWLLp7Z26+XOP3Boe7guKwrL0mWrWSmOetSlcmI4cE2fQywxgqESKnzNHMDWPJ6 LcLvN2jOVFyym8Nipj5KXie0ZZkUqpeZ8MtBZPOPcDI0zuThzl/dStKKt3GtnScIgtiL +qfyX6a3PIRB277nxMgLC2RMb01yDG0jqNf1ka0BNAP6LQ5UWPBHEljHwUshYLrQS1qx wGkbGf46Yui5nS0gVmiMSeuYCaTwlVKO81D03B9ttMpUlfFjaPy9wQdIoewtgjK+xtfT Y+pA== X-Gm-Message-State: ALKqPwcCxyRBcRZcfyu0YDo+Jco/ZISukduSIBKGhjiWFI2ekz1vvPuT Af3f8PFT6Mtp7WYohi9c2xhHE8CR X-Google-Smtp-Source: ADUXVKIv/enjT9zruCv/18DCla2ledHfQ8tg5NHlvlESL7QA8ZQ2nd3kPjOx7aXDBi5/10XBrEqkSQ== X-Received: by 2002:a6b:8c0f:: with SMTP id o15-v6mr2787360iod.84.1527694991573; Wed, 30 May 2018 08:43:11 -0700 (PDT) Received: from mail-it0-f43.google.com (mail-it0-f43.google.com. [209.85.214.43]) by smtp.gmail.com with ESMTPSA id s74-v6sm9472009ita.43.2018.05.30.08.43.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 May 2018 08:43:11 -0700 (PDT) Received: by mail-it0-f43.google.com with SMTP id q4-v6so24036856ite.3; Wed, 30 May 2018 08:43:11 -0700 (PDT) X-Received: by 2002:a24:68c6:: with SMTP id v189-v6mr2246549itb.61.1527694991016; Wed, 30 May 2018 08:43:11 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 2002:a02:5995:0:0:0:0:0 with HTTP; Wed, 30 May 2018 08:43:10 -0700 (PDT) In-Reply-To: References: <201805300711.w4U7BYjS066960@repo.freebsd.org> <20180530141347.1bf868ac@hermann> <92B96A88-6F0C-4C5B-A924-4E4CD0777116@FreeBSD.org> <20180530143258.64b26810@hermann> From: Conrad Meyer Date: Wed, 30 May 2018 08:43:10 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r334375 - in head/sys: net netpfil/pf To: Kristof Provost Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 15:43:19 -0000 On Wed, May 30, 2018 at 5:41 AM, Kristof Provost wrote: > Odd. The other reports I got were mips only. I did test amd64. > Are you using gcc to build perhaps? > > r334379 should fix it. Hi Kristof, Oliver uses a non-GENERIC kernel, which often catches some oversights :-). I appreciate the prompt testing and reports he seems to do continuously, it's fantastic. Best, Conrad From owner-svn-src-head@freebsd.org Wed May 30 15:45:57 2018 Return-Path: Delivered-To: svn-src-head@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 87A93F782ED; Wed, 30 May 2018 15:45:57 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B7496A2D7; Wed, 30 May 2018 15:45:57 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id E4C0B27EEF; Wed, 30 May 2018 15:45:56 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from [172.28.128.1] (ptr-8ripyygk132m260h1d8.18120a2.ip6.access.telenet.be [IPv6:2a02:1811:2419:4e02:8deb:e195:6c41:992c]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id C0DE841775; Wed, 30 May 2018 17:45:54 +0200 (CEST) From: "Kristof Provost" To: "Conrad Meyer" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Subject: Re: svn commit: r334375 - in head/sys: net netpfil/pf Date: Wed, 30 May 2018 17:45:51 +0200 X-Mailer: MailMate (2.0BETAr6111) Message-ID: <9B1021F6-1746-4198-97BE-42663FE8DFC4@FreeBSD.org> In-Reply-To: References: <201805300711.w4U7BYjS066960@repo.freebsd.org> <20180530141347.1bf868ac@hermann> <92B96A88-6F0C-4C5B-A924-4E4CD0777116@FreeBSD.org> <20180530143258.64b26810@hermann> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; markup=markdown Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 15:45:57 -0000 On 30 May 2018, at 17:43, Conrad Meyer wrote: > On Wed, May 30, 2018 at 5:41 AM, Kristof Provost > wrote: >> Odd. The other reports I got were mips only. I did test amd64. >> Are you using gcc to build perhaps? >> >> r334379 should fix it. > > Hi Kristof, > > Oliver uses a non-GENERIC kernel, which often catches some oversights > :-). I appreciate the prompt testing and reports he seems to do > continuously, it's fantastic. > This was very much not criticism of Olivier’s choices ;) I broke it, so it’s good that someone told me so. I’m just interested in understanding why he saw the build failure on amd64 and I didn’t. Regards, Kristof From owner-svn-src-head@freebsd.org Wed May 30 15:51:49 2018 Return-Path: Delivered-To: svn-src-head@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 B7A86F78C80; Wed, 30 May 2018 15:51:49 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5E6DC6AA4A; Wed, 30 May 2018 15:51:49 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4118651D5; Wed, 30 May 2018 15:51:49 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UFpn5K033117; Wed, 30 May 2018 15:51:49 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UFpnFf033116; Wed, 30 May 2018 15:51:49 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201805301551.w4UFpnFf033116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 30 May 2018 15:51:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334388 - head/contrib/openbsm/bsm X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/contrib/openbsm/bsm X-SVN-Commit-Revision: 334388 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 15:51:49 -0000 Author: asomers Date: Wed May 30 15:51:48 2018 New Revision: 334388 URL: https://svnweb.freebsd.org/changeset/base/334388 Log: Fix OpenBSM with GCC with -Wredundant-decls Upstream change ed47534 consciously added some redundant functional declarations, and I'm not sure why. AFAICT they were never required. On FreeBSD, they break the build with GCC (but not Clang) for any program including libbsm.h with WARNS=6. Fix by cherry-picking upstream change https://github.com/openbsm/openbsm/commit/0553c27 Reported by: emaste Reviewed by: cem Obtained from: OpenBSM MFC after: 2 weeks Pull Request: https://github.com/openbsm/openbsm/pull/31 Modified: head/contrib/openbsm/bsm/libbsm.h Modified: head/contrib/openbsm/bsm/libbsm.h ============================================================================== --- head/contrib/openbsm/bsm/libbsm.h Wed May 30 15:37:09 2018 (r334387) +++ head/contrib/openbsm/bsm/libbsm.h Wed May 30 15:51:48 2018 (r334388) @@ -872,21 +872,6 @@ void au_print_tok_xml(FILE *outfp, tokenstr_t *tok, void au_print_xml_header(FILE *outfp); void au_print_xml_footer(FILE *outfp); -/* - * BSM library routines for converting between local and BSM constant spaces. - * (Note: some of these are replicated in audit_record.h for the benefit of - * the FreeBSD and Mac OS X kernels) - */ -int au_bsm_to_domain(u_short bsm_domain, int *local_domainp); -int au_bsm_to_errno(u_char bsm_error, int *errorp); -int au_bsm_to_fcntl_cmd(u_short bsm_fcntl_cmd, int *local_fcntl_cmdp); -int au_bsm_to_socket_type(u_short bsm_socket_type, - int *local_socket_typep); -u_short au_domain_to_bsm(int local_domain); -u_char au_errno_to_bsm(int local_errno); -u_short au_fcntl_cmd_to_bsm(int local_fcntl_command); -u_short au_socket_type_to_bsm(int local_socket_type); - const char *au_strerror(u_char bsm_error); __END_DECLS From owner-svn-src-head@freebsd.org Wed May 30 15:52:25 2018 Return-Path: Delivered-To: svn-src-head@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 4EE5BF78D8C; Wed, 30 May 2018 15:52:25 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf0-x22e.google.com (mail-lf0-x22e.google.com [IPv6:2a00:1450:4010:c07::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F3B36AC10; Wed, 30 May 2018 15:52:24 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf0-x22e.google.com with SMTP id q11-v6so5072644lfc.7; Wed, 30 May 2018 08:52:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=lwZQKId89N83LbIrbPEmZyVGcBb1+gDdRKUfoHzP9P0=; b=miG11ngNW9YSvRKVIGQHUTIFMJgJI2mk7WjtWzIb0LaPf/PMRDJg+AKABQitygnGHD akfWRDEmupk69TaTXqk6apG6HM7VqpSdulA3mwvy3Q1+kzCGsMIDl06aOqom4XGeicaC vR/LFJEqRFcspwgNWkh49171vTtOypZ+awdwWTbtYaaCUMx+nQCOg2R/gf0Uhz5EWWL+ 1zpIm6DrMkqBwuwYsNJLKNrzvqCDB5KfJkhD22hialBY1uic00IE7NBfMjkhFsp3xPin 13niwuwKUHBokyruzPJ/DC1SsKjMPGbqRfxdri2fctU5G4SLVG3OEX7QD2j7tSUNb2Wd IPDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=lwZQKId89N83LbIrbPEmZyVGcBb1+gDdRKUfoHzP9P0=; b=Bt/cE24rFOLxN9ONdHP93QKHEVX2aDCWv214gg8fCLWMcjwjv6IA9b2fjoqCy9aWCU CO0brOkvDbk9K8LoqfFdqX6AsV0chqeHvITOA8BjlZzdjnpsTklzoQnSzOv0FVjah5at FpbUAaRVE+XlCbglxu12Oov1oJC5lsB7WVeFAiS+h2dQEdaAciUu2wctM+z6GpOs0bp8 tLENTml4jxQCtSlElFABt3UkCmVfHkNVmpCupYXo9yh/6P+YmnIrnHAr7u3Ur+hHYxGu B6xpTLe8PtOWNjeZgdYcltPuok1RnRuDk3ZA0cFvH3fujLrWruX6I8G6R7sksjnAEYZy 4RhQ== X-Gm-Message-State: ALKqPwe0rufh/15abMbj4rhslnEk7cAgrQ+2BobRdW6LPkbMp6oJyN6o oja2qW3SJYdk/pE5APES/69oWd+zVt3hYOcKiVI0Lw== X-Google-Smtp-Source: ADUXVKLkeWgcYCfe6mC8dcFkOtpdQhim7+3nFyzU8UW4BvqlllSZs9B2E8KuCSNjUxkNqIipqgc/Blcd2Lr77QNiu/s= X-Received: by 2002:a2e:4949:: with SMTP id b9-v6mr2671530ljd.116.1527695542398; Wed, 30 May 2018 08:52:22 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 2002:ab3:724f:0:0:0:0:0 with HTTP; Wed, 30 May 2018 08:52:21 -0700 (PDT) In-Reply-To: References: <201805292308.w4TN8XsD025422@repo.freebsd.org> From: Alan Somers Date: Wed, 30 May 2018 09:52:21 -0600 X-Google-Sender-Auth: gQcKPyZNiX5gfHesal6JJWuc8zY Message-ID: Subject: Re: svn commit: r334360 - in head: etc/mtree tests/sys tests/sys/audit To: Ed Maste Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 15:52:25 -0000 On Tue, May 29, 2018 at 6:10 PM, Ed Maste wrote: > On 29 May 2018 at 19:08, Alan Somers wrote: > > Author: asomers > > Date: Tue May 29 23:08:33 2018 > > New Revision: 334360 > > URL: https://svnweb.freebsd.org/changeset/base/334360 > > > > Log: > > Add initial set of tests for audit(4) > > This has broken the build on many architectures, e.g. mips: > https://ci.freebsd.org/job/FreeBSD-head-mips-build/2467/console > > 23:15:17 In file included from /usr/src/tests/sys/audit/utils.c:38: > 23:15:17 /usr/obj/usr/src/mips.mips/tmp/usr/include/bsm/libbsm.h:880: > warning: redundant redeclaration of 'au_bsm_to_domain' > 23:15:17 /usr/obj/usr/src/mips.mips/tmp/usr/include/bsm/audit_ > record.h:301: > warning: previous declaration of 'au_bsm_to_domain' was here > ... > Fixed by r334388. From owner-svn-src-head@freebsd.org Wed May 30 16:48:49 2018 Return-Path: Delivered-To: svn-src-head@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 AB5E6F7E04D; Wed, 30 May 2018 16:48:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A5CA6D1AD; Wed, 30 May 2018 16:48:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B76D5A7F; Wed, 30 May 2018 16:48:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UGmn09058927; Wed, 30 May 2018 16:48:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UGmnY4058926; Wed, 30 May 2018 16:48:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201805301648.w4UGmnY4058926@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 30 May 2018 16:48:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334389 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 334389 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 16:48:49 -0000 Author: markj Date: Wed May 30 16:48:48 2018 New Revision: 334389 URL: https://svnweb.freebsd.org/changeset/base/334389 Log: Typo. PR: 228533 Submitted by: Jakub Piecuch MFC after: 1 week Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Wed May 30 15:51:48 2018 (r334388) +++ head/sys/vm/vm_fault.c Wed May 30 16:48:48 2018 (r334389) @@ -1671,7 +1671,7 @@ vm_fault_copy_entry(vm_map_t dst_map, vm_map_t src_map * range, copying each page from the source object to the * destination object. Since the source is wired, those pages * must exist. In contrast, the destination is pageable. - * Since the destination object does share any backing storage + * Since the destination object doesn't share any backing storage * with the source object, all of its pages must be dirtied, * regardless of whether they can be written. */ From owner-svn-src-head@freebsd.org Wed May 30 17:05:49 2018 Return-Path: Delivered-To: svn-src-head@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 6AADEF7F6BF; Wed, 30 May 2018 17:05:49 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 189426DEA9; Wed, 30 May 2018 17:05:49 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDA2F5DE9; Wed, 30 May 2018 17:05:48 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UH5mlO069184; Wed, 30 May 2018 17:05:48 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UH5mqt069183; Wed, 30 May 2018 17:05:48 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201805301705.w4UH5mqt069183@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 30 May 2018 17:05:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334390 - head/contrib/openbsm/libbsm X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/contrib/openbsm/libbsm X-SVN-Commit-Revision: 334390 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 17:05:49 -0000 Author: asomers Date: Wed May 30 17:05:48 2018 New Revision: 334390 URL: https://svnweb.freebsd.org/changeset/base/334390 Log: au_read_rec(3): correct return value in man page Submitted by: aniketp Reviewed by: csjp (earlier version) MFC after: 2 weeks Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15618 Modified: head/contrib/openbsm/libbsm/au_io.3 Modified: head/contrib/openbsm/libbsm/au_io.3 ============================================================================== --- head/contrib/openbsm/libbsm/au_io.3 Wed May 30 16:48:48 2018 (r334389) +++ head/contrib/openbsm/libbsm/au_io.3 Wed May 30 17:05:48 2018 (r334390) @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 4, 2009 +.Dd May 30, 2018 .Dt AU_IO 3 .Os .Sh NAME @@ -129,14 +129,14 @@ would be used to free the record buffer. Finally, the source stream would be closed by a call to .Xr fclose 3 . .Sh RETURN VALUES -The +On success, .Fn au_fetch_tok -and +returns 0 while .Fn au_read_rec -functions -return 0 on success, or \-1 on failure along with additional error information -returned via -.Va errno . +returns the number of bytes read. +Both functions return \-1 on failure with +.Va errno +set appropriately. .Sh SEE ALSO .Xr free 3 , .Xr libbsm 3 From owner-svn-src-head@freebsd.org Wed May 30 18:04:26 2018 Return-Path: Delivered-To: svn-src-head@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 260B1FCAC2E; Wed, 30 May 2018 18:04:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CCF4B706FC; Wed, 30 May 2018 18:04:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF1856829; Wed, 30 May 2018 18:04:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UI4PKA099333; Wed, 30 May 2018 18:04:25 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UI4PT6099332; Wed, 30 May 2018 18:04:25 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201805301804.w4UI4PT6099332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 30 May 2018 18:04:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334391 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 334391 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 18:04:26 -0000 Author: emaste Date: Wed May 30 18:04:25 2018 New Revision: 334391 URL: https://svnweb.freebsd.org/changeset/base/334391 Log: Enable lld as the system linker by default on amd64 The migration to LLVM's lld linker has been in progress for quite some time - about three years ago I opened an upstream LLVM meta-bug to track issues using lld as FreeBSD's linker, and about 1.5 years ago requested the first exp-run with lld as the system linker. As of r327783 we enabled LLD_BOOTSTRAP by default on amd64, using lld as the linker to link the kernel and world, but GNU ld was still installed as /usr/bin/ld. The vast majority of issues observed when building ports with lld as the system linker have now been solved, so set LLD_IS_LD by default on amd64 and install lld as /usr/bin/ld. A small number of port failures remain and these will be addressed in the near future. Thanks to antoine@ for handling the exp-runs, krion@ for investigating many port failures and adding LLD_UNSAFE or other fixes or workarounds, and everyone who helped investigate, fix or tag ports. PR: 214864 (exp-run) Sponsored by: The FreeBSD Foundation Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Wed May 30 17:05:48 2018 (r334390) +++ head/share/mk/src.opts.mk Wed May 30 18:04:25 2018 (r334391) @@ -263,11 +263,8 @@ __DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND .else __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND .endif -.if ${__T} == "aarch64" +.if ${__T} == "aarch64" || ${__T} == "amd64" __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD -.elif ${__T} == "amd64" -__DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP -__DEFAULT_NO_OPTIONS+=LLD_IS_LD .else __DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD .endif From owner-svn-src-head@freebsd.org Wed May 30 18:32:25 2018 Return-Path: Delivered-To: svn-src-head@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 CD6DDEEE207; Wed, 30 May 2018 18:32:24 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qt0-x230.google.com (mail-qt0-x230.google.com [IPv6:2607:f8b0:400d:c0d::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 62B7172107; Wed, 30 May 2018 18:32:24 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-qt0-x230.google.com with SMTP id q6-v6so24541147qtn.3; Wed, 30 May 2018 11:32:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=ejux0tWSKIDCm2MOLD43NWb74Wye22uLGukdmS/LNkg=; b=vJsP8xlse5ExI9VCn1NdkfGqi07iwUWyfBwEqk56/DLL99tucFolLZeYnZmkKKHKnh CBf1MYLwBUZWjRaL6MiREThEEBy3quN3gzXajxlCgncb0xfzZVQxEGBdlLvIWx6CXQll LDdOXe2Yy/hl2kCrvAHEwVnWm/1InqS9j3RA5cb78YUODGEE2WhGBfszrG2VlX9KibKG i6c9RDl3Awc3OkBnEO+lX1jv5JUC9sK/s3W+RK+ESzTGCJBtIFDQMw8vhnuJPe8lirN9 7YwNgQAJnvIdcx4KyRehY5sItHh0gWe+dhf4tPYcznop4Qgsk9+Mq8AHKvifjeDYowY5 9B6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=ejux0tWSKIDCm2MOLD43NWb74Wye22uLGukdmS/LNkg=; b=ail6I6RprCfjOag1SktbhkjnFMr4QCy2C/9e+G7IJQqng+o/0QsFWdltjZX4qpfapX xhQX5svvr2MaXv1VAfX6HYnm42w8NEXp+8l/xjXHlQig05vrky10v5st16p6k2iQdz4g 3+aifzhDJo4GJOlfrG2b94/7AUTfAVvxxUUCoecdS+8wMKnMoN88iCuqM7pp59X2y2KI dqaWtboSVMDI1mI6ALhA6vjqC3IKZrs6fLhBZuyPjQS758a9S8sPYZIwwWFa9mN1XDuC 4WG7zQj608pb7XbB2py/9bzuXAbOobifYgZwQn7jQZUSV4YKj+S1V/A37WdwjlkacZVg i5Cw== X-Gm-Message-State: APt69E3xbRV+KFCTwN/0aLoU+wIphpeWSwW8g9NfmEmTo8KJ6/ty1/DO 18giA+v6HZg7ITrhYWuE/prVPJr5vBHvXymgD0xraw== X-Google-Smtp-Source: ADUXVKLfK1SuocSVn6LwjMlMt/feG3jR28lb9uyB0I5gpCrnvoyKyIDv+pxqPHJXAxHz3XcgLHYJtZRN7pVHr01XtqU= X-Received: by 2002:ac8:1488:: with SMTP id l8-v6mr3679684qtj.182.1527705143078; Wed, 30 May 2018 11:32:23 -0700 (PDT) MIME-Version: 1.0 Sender: antoine.brodin.freebsd@gmail.com Received: by 2002:a0c:accf:0:0:0:0:0 with HTTP; Wed, 30 May 2018 11:32:22 -0700 (PDT) In-Reply-To: <201805280812.w4S8CI56046943@repo.freebsd.org> References: <201805280812.w4S8CI56046943@repo.freebsd.org> From: Antoine Brodin Date: Wed, 30 May 2018 20:32:22 +0200 X-Google-Sender-Auth: 0sjbphdVoDSPLWquhP8veJoSvsE Message-ID: Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Hans Petter Selasky Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 18:32:25 -0000 On Mon, May 28, 2018 at 10:12 AM, Hans Petter Selasky wrote: > Author: hselasky > Date: Mon May 28 08:12:18 2018 > New Revision: 334277 > URL: https://svnweb.freebsd.org/changeset/base/334277 > > Log: > MFV r333789: libpcap 1.9.0 (pre-release) > > MFC after: 1 month > Sponsored by: Mellanox Technologies Hi, It seems that this local change was lost during the upgrade: https://svnweb.freebsd.org/base/head/contrib/libpcap/pcap/pcap.h?r1=190640&r2=190639&pathrev=190640 I think this broke at least the following ports: http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/packetdrill-0.0.2018012501.log http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/spamd-4.9.1_4.log http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/vde2-2.3.2_2.log http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/xprobe2-0.3.log Cheers, Antoine From owner-svn-src-head@freebsd.org Wed May 30 18:34:46 2018 Return-Path: Delivered-To: svn-src-head@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 AB566EEE591; Wed, 30 May 2018 18:34:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5E8A6723FC; Wed, 30 May 2018 18:34:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3FC4F6D0F; Wed, 30 May 2018 18:34:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UIYkTE015665; Wed, 30 May 2018 18:34:46 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UIYkA3015664; Wed, 30 May 2018 18:34:46 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201805301834.w4UIYkA3015664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 30 May 2018 18:34:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334393 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 334393 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 18:34:46 -0000 Author: emaste Date: Wed May 30 18:34:45 2018 New Revision: 334393 URL: https://svnweb.freebsd.org/changeset/base/334393 Log: Regen src.conf.5 after r334391 - LLD_IS_LD default on amd64 Relnotes: yes Sponsored by: The FreeBSD Foundation Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Wed May 30 18:27:48 2018 (r334392) +++ head/share/man/man5/src.conf.5 Wed May 30 18:34:45 2018 (r334393) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd May 26, 2018 +.Dd May 30, 2018 .Dt SRC.CONF 5 .Os .Sh NAME @@ -989,12 +989,12 @@ amd64/amd64 and arm64/aarch64. Set to use GNU binutils ld as the system linker, instead of LLVM's LLD. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. +arm/arm, arm/armeb, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. .It Va WITH_LLD_IS_LD Set to use LLVM's LLD as the system linker, instead of GNU binutils ld. .Pp This is a default setting on -arm64/aarch64. +amd64/amd64 and arm64/aarch64. .It Va WITHOUT_LLVM_COV Set to not build the .Xr llvm-cov 1 From owner-svn-src-head@freebsd.org Wed May 30 18:42:13 2018 Return-Path: Delivered-To: svn-src-head@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 1C64BEEF1D6; Wed, 30 May 2018 18:42:13 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-oi0-x230.google.com (mail-oi0-x230.google.com [IPv6:2607:f8b0:4003:c06::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9AD5372A47; Wed, 30 May 2018 18:42:12 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: by mail-oi0-x230.google.com with SMTP id c128-v6so8006436oig.11; Wed, 30 May 2018 11:42:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=9QRicXcOAnjtoQN7MM4Vjti/paCFEfhOp8ztkuqEeYc=; b=LO2Jjz5npNi/P5p6GFdKuTn9nHQDdKGUn7RHxBnw5b8AW9lg1MhFWQ+t9JZSeMG82D ySm35HKEZDrjaBzKmelSvHhu74Vf46Ojwh9oGXh6t4iqPxZinfxhP4LMANEEuGZr4oS9 JyQ8SPdfCx4jBK50vLV3Q1oo/WA6MBNGhzEAe2uOYwaQvmCdokk+PkQBk92gcENLX7LE W11o+zPV8cgeub0vmcLeOa4c0twcWUH1WWmx5UBwBGweuWzlAAVuectqR88oi+hQDSdM IkxU7rvbHygjc2s6VldHNGIyK1Up/2mXb1FEBb0WZdRE1u9Xz9bLBmOcF8ap3iY4aV8n AZdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=9QRicXcOAnjtoQN7MM4Vjti/paCFEfhOp8ztkuqEeYc=; b=KnllixncpoCI8eYDFhkzzO+GfHQty8YPeNiaxc8aqE7nyzC1kRIqwJ1KHFmBYcWL82 uSQW7yyA1KpjLQXoF7m7QimTXNuY2/xTpu2XrpddMnAwcnFLFCG8XAgwhcNv3/cUTlXz BmMHFxEflrx4rCWidVUlbftI39YICLRXoeVBKotqBfAbspooXdwUJ58P8hYxSrGfpWSm 8xEK1OjRHypna9pbPaJA8auJnafnYAcaZihFnp6r3vBSB8AnqTLIbunuV9mzAhrzR+O0 PyrLDQgu7w5orQu6+ggI595gnZJLHawHF6HAnlaaV9AEdYKIFncREEOExX0JzkAxqysZ MuwQ== X-Gm-Message-State: ALKqPwcF2dWQ1JjKTeKjWfIwaxrMyqnaTmbCCm/uK1b0Ntk5xSAE2Ue8 YxmeS+CBoTpeuYEEaTrcfE8Dqg== X-Google-Smtp-Source: ADUXVKKxMckZFFDOh1yRT9qfO0C2Ugd+YavaAdn5Q8TEWFZGf3ioQ1Y1GcrGacx6LYIoy9oX4sXnqw== X-Received: by 2002:aca:f388:: with SMTP id r130-v6mr2102865oih.17.1527705731304; Wed, 30 May 2018 11:42:11 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [12.32.117.8]) by smtp.googlemail.com with ESMTPSA id w189-v6sm18543936oie.30.2018.05.30.11.42.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 May 2018 11:42:10 -0700 (PDT) Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Antoine Brodin , Hans Petter Selasky Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805280812.w4S8CI56046943@repo.freebsd.org> From: Navdeep Parhar Message-ID: Date: Wed, 30 May 2018 11:42:09 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 18:42:13 -0000 On 05/30/18 11:32, Antoine Brodin wrote: > On Mon, May 28, 2018 at 10:12 AM, Hans Petter Selasky > wrote: >> Author: hselasky >> Date: Mon May 28 08:12:18 2018 >> New Revision: 334277 >> URL: https://svnweb.freebsd.org/changeset/base/334277 >> >> Log: >> MFV r333789: libpcap 1.9.0 (pre-release) >> >> MFC after: 1 month >> Sponsored by: Mellanox Technologies > > Hi, > > It seems that this local change was lost during the upgrade: > https://svnweb.freebsd.org/base/head/contrib/libpcap/pcap/pcap.h?r1=190640&r2=190639&pathrev=190640 Hi Hans, If pcap.h is changed to include net/bpf.h like it used to then the change made to cxgbetool in r334277 should be reverted too. Regards, Navdeep > > I think this broke at least the following ports: > > http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/packetdrill-0.0.2018012501.log > http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/spamd-4.9.1_4.log > http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/vde2-2.3.2_2.log > http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/xprobe2-0.3.log > > Cheers, > > Antoine > From owner-svn-src-head@freebsd.org Wed May 30 19:57:16 2018 Return-Path: Delivered-To: svn-src-head@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 5E753EF8295; Wed, 30 May 2018 19:57:16 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1493B766D5; Wed, 30 May 2018 19:57:16 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E94BD7A52; Wed, 30 May 2018 19:57:15 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UJvFrT058565; Wed, 30 May 2018 19:57:15 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UJvFqn058564; Wed, 30 May 2018 19:57:15 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201805301957.w4UJvFqn058564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 30 May 2018 19:57:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334394 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 334394 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 19:57:16 -0000 Author: asomers Date: Wed May 30 19:57:15 2018 New Revision: 334394 URL: https://svnweb.freebsd.org/changeset/base/334394 Log: auditpipe(4): fix some ioctl arguments in the man page Fix the argument types for the AUDITPIPE_[GS]ET_PRESELECT_(NA)?FLAGS ioctls. Also, fix some grammar. [skip ci] PR: 226713 Submitted by: aniketp MFC after: 2 weeks Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15620 Modified: head/share/man/man4/auditpipe.4 Modified: head/share/man/man4/auditpipe.4 ============================================================================== --- head/share/man/man4/auditpipe.4 Wed May 30 18:34:45 2018 (r334393) +++ head/share/man/man4/auditpipe.4 Wed May 30 19:57:15 2018 (r334394) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 5, 2006 +.Dd May 30, 2018 .Dt AUDITPIPE 4 .Os .Sh NAME @@ -154,7 +154,7 @@ These flags correspond to the field in .Xr audit_control 5 . The ioctl argument should be of type -.Vt u_int . +.Vt au_mask_t . .It Dv AUDITPIPE_SET_PRESELECT_FLAGS Set the current default preselection flags for attributable events on the pipe. @@ -163,7 +163,7 @@ These flags correspond to the field in .Xr audit_control 5 . The ioctl argument should be of type -.Vt u_int . +.Vt au_mask_t . .It Dv AUDITPIPE_GET_PRESELECT_NAFLAGS Retrieve the current default preselection flags for non-attributable events on the pipe. @@ -172,7 +172,7 @@ These flags correspond to the field in .Xr audit_control 5 . The ioctl argument should be of type -.Vt u_int . +.Vt au_mask_t . .It Dv AUDITPIPE_SET_PRESELECT_NAFLAGS Set the current default preselection flags for non-attributable events on the pipe. @@ -181,7 +181,7 @@ These flags correspond to the field in .Xr audit_control 5 . The ioctl argument should be of type -.Vt u_int . +.Vt au_mask_t . .It Dv AUDITPIPE_GET_PRESELECT_AUID Query the current preselection masks for a specific auid on the pipe. The ioctl argument should be of type @@ -245,7 +245,7 @@ manual page for information on audit-related bugs and .Pp The configurable preselection mechanism mirrors the selection model present for the global audit trail. -It might be desirable to provided a more flexible selection model. +It might be desirable to provide a more flexible selection model. .Pp The per-pipe audit event queue is fifo, with drops occurring if either the user thread provides in sufficient for the record on the queue head, or on From owner-svn-src-head@freebsd.org Wed May 30 19:58:37 2018 Return-Path: Delivered-To: svn-src-head@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 E81B9EF8486; Wed, 30 May 2018 19:58:36 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9BCE5768B5; Wed, 30 May 2018 19:58:36 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CE637A65; Wed, 30 May 2018 19:58:36 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UJwajn058667; Wed, 30 May 2018 19:58:36 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UJwaI6058666; Wed, 30 May 2018 19:58:36 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201805301958.w4UJwaI6058666@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 30 May 2018 19:58:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334395 - head/tests/sys X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/tests/sys X-SVN-Commit-Revision: 334395 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 19:58:37 -0000 Author: asomers Date: Wed May 30 19:58:36 2018 New Revision: 334395 URL: https://svnweb.freebsd.org/changeset/base/334395 Log: Revert r334362 Reconnect tests/sys/audit now that the GCC issue is fixed by 334388 MFC after: 2 weeks X-MFC-With: 334362, 334360, 334388 Modified: head/tests/sys/Makefile Modified: head/tests/sys/Makefile ============================================================================== --- head/tests/sys/Makefile Wed May 30 19:57:15 2018 (r334394) +++ head/tests/sys/Makefile Wed May 30 19:58:36 2018 (r334395) @@ -6,6 +6,7 @@ TESTSDIR= ${TESTSBASE}/sys TESTS_SUBDIRS+= acl TESTS_SUBDIRS+= aio +TESTS_SUBDIRS+= audit TESTS_SUBDIRS+= capsicum TESTS_SUBDIRS+= ${_cddl} TESTS_SUBDIRS+= fifo From owner-svn-src-head@freebsd.org Wed May 30 20:10:53 2018 Return-Path: Delivered-To: svn-src-head@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 8D6BBEF9712; Wed, 30 May 2018 20:10:53 +0000 (UTC) (envelope-from delphij@gmail.com) Received: from mail-io0-x22c.google.com (mail-io0-x22c.google.com [IPv6:2607:f8b0:4001:c06::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1C351774A4; Wed, 30 May 2018 20:10:53 +0000 (UTC) (envelope-from delphij@gmail.com) Received: by mail-io0-x22c.google.com with SMTP id l25-v6so688255ioh.12; Wed, 30 May 2018 13:10:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Hz/ip/htVLaB+ssMMH1CAPoGw2MXV5E+UlUC1lRVgP0=; b=GdjF0Nkdv+hRBuRa8X1KQGz+Q/QfA87Ljz6/5Xug3+o9iY6s7iC6mtVAAfSg+Uv3se phx4dF7ZD+81qpPLHmEMk0LhCKSYOzanGxVBmYPeHSjoQeLKIwG8EXAl9W9iZHnQr8eC wri+OyaLqFDm6NKP9b3Zz8hGz8oWYe4n7lSvt3hxPiBnlTZPWoGbb17zFdUCUMxCWBfa MLa+h3IgvrWMB7ycAvz852J94cK4k8SDbAxxVUi+XzcJqDrli+8CERLEihimVMQvpibs CEydZg5XVCZ7OYQkobCoKExknrkOj0WjpDXFpFwOK8gn3SRXQI8BSDfsWMDLdOBXy2Zp SXtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Hz/ip/htVLaB+ssMMH1CAPoGw2MXV5E+UlUC1lRVgP0=; b=bK6JyWDgrQsF9vfc+cL7gu4wd9l0CfoqKp+gA1A2yysLVYbRi8fZ+xM2Q+pjziOjaD 4HJZwyo1BopAIlhXA/2Qo5cWcr11NpB0kGXccumZvpzOewBp9yui5fDgvPGKusrKOZMx lIiy5HiYwP8ZHUcaYKKuE9vZlQv4eS8zP15VmT7qLNpCHMPW7L5xEnTVcr3h3DL0qWKo RX0aE2l5BPnaOYY5f15ZBYY/kUwpb4N1Ptg93+nDUp1yUB8DKnbkug1G9ogySRF07f3C 9rBZU2JG/FqX3ouYmnwDAYN/sTOMnZXD3UBbl0nHX9eesdVWfJxEtbwHMlBmaORr+JcN bFSQ== X-Gm-Message-State: APt69E2N/K8cQeIv7nqKOcpkDZv5zjgFSLhoMbJQQAIAF10qzW8KoIZV I5n+rnfepisU8W+KMkrjDHZ7D3a4LWtJaUwZiy5/keCe X-Google-Smtp-Source: ADUXVKLzWP1Bi2OLIEXQx+kmmnreODJBlD1VnMZtWtQEQYGmiSXxyF3SLMRagbgZRN9k1nd5G/WVpI2Ws57YNud48to= X-Received: by 2002:a6b:c38b:: with SMTP id t133-v6mr3567848iof.197.1527711051897; Wed, 30 May 2018 13:10:51 -0700 (PDT) MIME-Version: 1.0 References: <201805280812.w4S8CI56046943@repo.freebsd.org> In-Reply-To: <201805280812.w4S8CI56046943@repo.freebsd.org> From: Xin LI Date: Wed, 30 May 2018 13:10:39 -0700 Message-ID: Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: hselasky@freebsd.org Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 20:10:53 -0000 On Mon, May 28, 2018 at 1:14 AM Hans Petter Selasky wrote: > Author: hselasky > Date: Mon May 28 08:12:18 2018 > New Revision: 334277 > URL: https://svnweb.freebsd.org/changeset/base/334277 > Log: > MFV r333789: libpcap 1.9.0 (pre-release) > MFC after: 1 month > Sponsored by: Mellanox Technologies > Replaced: > head/contrib/libpcap/ > - copied from r333789, vendor/libpcap/dist/ This would make vendor/libpcap/dist history replace head/contrib/libpcap, which effectively discards all FreeBSD local changes for base purposes, and hides its change history. Is this intentional? If not, could you please revert the tree back to its previous state and redo the merge? (You should probably also update sys/net/bpf.h and/or sys/net/dlt.h, by the way). From owner-svn-src-head@freebsd.org Wed May 30 20:16:18 2018 Return-Path: Delivered-To: svn-src-head@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 C88C5EF9E81; Wed, 30 May 2018 20:16:18 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7722977882; Wed, 30 May 2018 20:16:18 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 584DE7DC2; Wed, 30 May 2018 20:16:18 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UKGIuO068734; Wed, 30 May 2018 20:16:18 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UKGInM068733; Wed, 30 May 2018 20:16:18 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201805302016.w4UKGInM068733@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 30 May 2018 20:16:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334396 - head/sys/fs/nfsserver X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfsserver X-SVN-Commit-Revision: 334396 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 20:16:19 -0000 Author: rmacklem Date: Wed May 30 20:16:17 2018 New Revision: 334396 URL: https://svnweb.freebsd.org/changeset/base/334396 Log: Strengthen locking for the NFSv4.1 server DestroySession operation. If a client did a DestroySession on a session while it was still in use, the server might try to use the session structure after it is free'd. I think the client has violated RFC5661 if it does this, but this patch makes DestroySession block all other nfsd threads so no thread could be using the session when it is free'd. After the DestroySession, nfsd threads will not be able to find the session. The patch also adds a check for nd_sessionid being set, although if that was not the case it would have been all 0s and unlikely to have a false match. This might fix the crashes described in PR#228497 for the FreeNAS server. PR: 228497 MFC after: 1 week Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdstate.c Wed May 30 19:58:36 2018 (r334395) +++ head/sys/fs/nfsserver/nfs_nfsdstate.c Wed May 30 20:16:17 2018 (r334396) @@ -6006,17 +6006,32 @@ nfsrv_findsession(uint8_t *sessionid) int nfsrv_destroysession(struct nfsrv_descript *nd, uint8_t *sessionid) { - int error, samesess; + int error, igotlock, samesess; samesess = 0; - if (!NFSBCMP(sessionid, nd->nd_sessionid, NFSX_V4SESSIONID)) { + if (!NFSBCMP(sessionid, nd->nd_sessionid, NFSX_V4SESSIONID) && + (nd->nd_flag & ND_HASSEQUENCE) != 0) { samesess = 1; if ((nd->nd_flag & ND_LASTOP) == 0) return (NFSERR_BADSESSION); } + + /* Lock out other nfsd threads */ + NFSLOCKV4ROOTMUTEX(); + nfsv4_relref(&nfsv4rootfs_lock); + do { + igotlock = nfsv4_lock(&nfsv4rootfs_lock, 1, NULL, + NFSV4ROOTLOCKMUTEXPTR, NULL); + } while (igotlock == 0); + NFSUNLOCKV4ROOTMUTEX(); + error = nfsrv_freesession(NULL, sessionid); if (error == 0 && samesess != 0) nd->nd_flag &= ~ND_HASSEQUENCE; + + NFSLOCKV4ROOTMUTEX(); + nfsv4_unlock(&nfsv4rootfs_lock, 1); + NFSUNLOCKV4ROOTMUTEX(); return (error); } From owner-svn-src-head@freebsd.org Wed May 30 20:24:22 2018 Return-Path: Delivered-To: svn-src-head@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 7A663EFA926; Wed, 30 May 2018 20:24:22 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 29B4E77ED3; Wed, 30 May 2018 20:24:22 +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 0AFE27FB9; Wed, 30 May 2018 20:24:22 +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 w4UKOLXM073910; Wed, 30 May 2018 20:24:21 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UKOLs1073909; Wed, 30 May 2018 20:24:21 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201805302024.w4UKOLs1073909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 30 May 2018 20:24:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334397 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 334397 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 20:24:22 -0000 Author: kib Date: Wed May 30 20:24:21 2018 New Revision: 334397 URL: https://svnweb.freebsd.org/changeset/base/334397 Log: Avoid unneccessary TLB shootdowns in pmap_unwire_ptp() for user pmaps, which no longer create recursive page table mappings. Benchmarked by: bde Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Wed May 30 20:16:17 2018 (r334396) +++ head/sys/i386/i386/pmap.c Wed May 30 20:24:21 2018 (r334397) @@ -1872,7 +1872,6 @@ pmap_unwire_ptp(pmap_t pmap, vm_page_t m, struct spgli static void _pmap_unwire_ptp(pmap_t pmap, vm_page_t m, struct spglist *free) { - vm_offset_t pteva; /* * unmap the page table page @@ -1881,16 +1880,13 @@ _pmap_unwire_ptp(pmap_t pmap, vm_page_t m, struct spgl --pmap->pm_stats.resident_count; /* - * Do an invltlb to make the invalidated mapping - * take effect immediately. + * There is not need to invalidate the recursive mapping since + * we never instantiate such mapping for the usermode pmaps, + * and never remove page table pages from the kernel pmap. + * Put page on a list so that it is released since all TLB + * shootdown is done. */ - pteva = VM_MAXUSER_ADDRESS + i386_ptob(m->pindex); - pmap_invalidate_page(pmap, pteva); - - /* - * Put page on a list so that it is released after - * *ALL* TLB shootdown is done - */ + MPASS(pmap != kernel_pmap); pmap_add_delayed_free_list(m, free, TRUE); } From owner-svn-src-head@freebsd.org Wed May 30 20:26:47 2018 Return-Path: Delivered-To: svn-src-head@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 E08C6EFACBD; Wed, 30 May 2018 20:26:47 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 93E53780C2; Wed, 30 May 2018 20:26: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 764F87FBB; Wed, 30 May 2018 20:26: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 w4UKQl7l074047; Wed, 30 May 2018 20:26:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UKQl6l074046; Wed, 30 May 2018 20:26:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201805302026.w4UKQl6l074046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 30 May 2018 20:26:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334398 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 334398 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 20:26:48 -0000 Author: kib Date: Wed May 30 20:26:47 2018 New Revision: 334398 URL: https://svnweb.freebsd.org/changeset/base/334398 Log: Do use pmap_pte_quick() in pmap_enter_quick_locked(). Benchmarked by: bde Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Wed May 30 20:24:21 2018 (r334397) +++ head/sys/i386/i386/pmap.c Wed May 30 20:26:47 2018 (r334398) @@ -3916,14 +3916,14 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v mpte = NULL; } - /* XXXKIB: pmap_pte_quick() instead ? */ - pte = pmap_pte(pmap, va); + sched_pin(); + pte = pmap_pte_quick(pmap, va); if (*pte) { if (mpte != NULL) { mpte->wire_count--; mpte = NULL; } - pmap_pte_release(pte); + sched_unpin(); return (mpte); } @@ -3941,7 +3941,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v mpte = NULL; } - pmap_pte_release(pte); + sched_unpin(); return (mpte); } @@ -3963,7 +3963,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v pte_store(pte, pa | PG_V | PG_U); else pte_store(pte, pa | PG_V | PG_U | PG_MANAGED); - pmap_pte_release(pte); + sched_unpin(); return (mpte); } From owner-svn-src-head@freebsd.org Wed May 30 20:39:23 2018 Return-Path: Delivered-To: svn-src-head@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 35435EFBCFA; Wed, 30 May 2018 20:39:23 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DB497788A6; Wed, 30 May 2018 20:39:22 +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 BD9EA1017B; Wed, 30 May 2018 20:39:22 +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 w4UKdMaW079280; Wed, 30 May 2018 20:39:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UKdMLJ079279; Wed, 30 May 2018 20:39:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201805302039.w4UKdMLJ079279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 30 May 2018 20:39:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334399 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 334399 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 20:39:23 -0000 Author: kib Date: Wed May 30 20:39:22 2018 New Revision: 334399 URL: https://svnweb.freebsd.org/changeset/base/334399 Log: Restore pmap_copy() for 4/4 i386 pmap. Create yet another temporal pte mapping routine pmap_pte_quick3(), which is the copy of the pmap_pte_quick() and relies on the pvh_global_lock to protect the frame. It accounts into the same counters as pmap_pte_quick(). It is needed since pmap_copy() uses pmap_pte_quick() already, and since a user pmap is no longer current pmap. pmap_copy() still provides the advantage for real-world workloads involving lot of forks where processes do not exec immediately. Benchmarked by: bde Sponsored by: The FreeBSD Foundation Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Wed May 30 20:26:47 2018 (r334398) +++ head/sys/i386/i386/pmap.c Wed May 30 20:39:22 2018 (r334399) @@ -264,10 +264,10 @@ caddr_t CADDR3; */ static caddr_t crashdumpmap; -static pt_entry_t *PMAP1 = NULL, *PMAP2; -static pt_entry_t *PADDR1 = NULL, *PADDR2; +static pt_entry_t *PMAP1 = NULL, *PMAP2, *PMAP3; +static pt_entry_t *PADDR1 = NULL, *PADDR2, *PADDR3; #ifdef SMP -static int PMAP1cpu; +static int PMAP1cpu, PMAP3cpu; static int PMAP1changedcpu; SYSCTL_INT(_debug, OID_AUTO, PMAP1changedcpu, CTLFLAG_RD, &PMAP1changedcpu, 0, @@ -658,6 +658,7 @@ pmap_bootstrap(vm_paddr_t firstaddr) */ SYSMAP(pt_entry_t *, PMAP1, PADDR1, 1) SYSMAP(pt_entry_t *, PMAP2, PADDR2, 1) + SYSMAP(pt_entry_t *, PMAP3, PADDR3, 1) mtx_init(&PMAP2mutex, "PMAP2", NULL, MTX_DEF); @@ -1563,6 +1564,40 @@ pmap_pte_quick(pmap_t pmap, vm_offset_t va) return (0); } +static pt_entry_t * +pmap_pte_quick3(pmap_t pmap, vm_offset_t va) +{ + pd_entry_t newpf; + pd_entry_t *pde; + + pde = pmap_pde(pmap, va); + if (*pde & PG_PS) + return (pde); + if (*pde != 0) { + rw_assert(&pvh_global_lock, RA_WLOCKED); + KASSERT(curthread->td_pinned > 0, ("curthread not pinned")); + newpf = *pde & PG_FRAME; + if ((*PMAP3 & PG_FRAME) != newpf) { + *PMAP3 = newpf | PG_RW | PG_V | PG_A | PG_M; +#ifdef SMP + PMAP3cpu = PCPU_GET(cpuid); +#endif + invlcaddr(PADDR3); + PMAP1changed++; + } else +#ifdef SMP + if (PMAP3cpu != PCPU_GET(cpuid)) { + PMAP3cpu = PCPU_GET(cpuid); + invlcaddr(PADDR3); + PMAP1changedcpu++; + } else +#endif + PMAP1unchanged++; + return (PADDR3 + (i386_btop(va) & (NPTEPG - 1))); + } + return (0); +} + /* * Routine: pmap_extract * Function: @@ -4166,6 +4201,109 @@ void pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, vm_offset_t src_addr) { + struct spglist free; + pt_entry_t *src_pte, *dst_pte, ptetemp; + pd_entry_t srcptepaddr; + vm_page_t dstmpte, srcmpte; + vm_offset_t addr, end_addr, pdnxt; + u_int ptepindex; + + if (dst_addr != src_addr) + return; + + end_addr = src_addr + len; + + rw_wlock(&pvh_global_lock); + if (dst_pmap < src_pmap) { + PMAP_LOCK(dst_pmap); + PMAP_LOCK(src_pmap); + } else { + PMAP_LOCK(src_pmap); + PMAP_LOCK(dst_pmap); + } + sched_pin(); + for (addr = src_addr; addr < end_addr; addr = pdnxt) { + KASSERT(addr < PMAP_TRM_MIN_ADDRESS, + ("pmap_copy: invalid to pmap_copy the trampoline")); + + pdnxt = (addr + NBPDR) & ~PDRMASK; + if (pdnxt < addr) + pdnxt = end_addr; + ptepindex = addr >> PDRSHIFT; + + srcptepaddr = src_pmap->pm_pdir[ptepindex]; + if (srcptepaddr == 0) + continue; + + if (srcptepaddr & PG_PS) { + if ((addr & PDRMASK) != 0 || addr + NBPDR > end_addr) + continue; + if (dst_pmap->pm_pdir[ptepindex] == 0 && + ((srcptepaddr & PG_MANAGED) == 0 || + pmap_pv_insert_pde(dst_pmap, addr, srcptepaddr & + PG_PS_FRAME))) { + dst_pmap->pm_pdir[ptepindex] = srcptepaddr & + ~PG_W; + dst_pmap->pm_stats.resident_count += + NBPDR / PAGE_SIZE; + pmap_pde_mappings++; + } + continue; + } + + srcmpte = PHYS_TO_VM_PAGE(srcptepaddr & PG_FRAME); + KASSERT(srcmpte->wire_count > 0, + ("pmap_copy: source page table page is unused")); + + if (pdnxt > end_addr) + pdnxt = end_addr; + + src_pte = pmap_pte_quick3(src_pmap, addr); + while (addr < pdnxt) { + ptetemp = *src_pte; + /* + * we only virtual copy managed pages + */ + if ((ptetemp & PG_MANAGED) != 0) { + dstmpte = pmap_allocpte(dst_pmap, addr, + PMAP_ENTER_NOSLEEP); + if (dstmpte == NULL) + goto out; + dst_pte = pmap_pte_quick(dst_pmap, addr); + if (*dst_pte == 0 && + pmap_try_insert_pv_entry(dst_pmap, addr, + PHYS_TO_VM_PAGE(ptetemp & PG_FRAME))) { + /* + * Clear the wired, modified, and + * accessed (referenced) bits + * during the copy. + */ + *dst_pte = ptetemp & ~(PG_W | PG_M | + PG_A); + dst_pmap->pm_stats.resident_count++; + } else { + SLIST_INIT(&free); + if (pmap_unwire_ptp(dst_pmap, dstmpte, + &free)) { + pmap_invalidate_page(dst_pmap, + addr); + vm_page_free_pages_toq(&free, + true); + } + goto out; + } + if (dstmpte->wire_count >= srcmpte->wire_count) + break; + } + addr += PAGE_SIZE; + src_pte++; + } + } +out: + sched_unpin(); + rw_wunlock(&pvh_global_lock); + PMAP_UNLOCK(src_pmap); + PMAP_UNLOCK(dst_pmap); } /* From owner-svn-src-head@freebsd.org Wed May 30 20:43:49 2018 Return-Path: Delivered-To: svn-src-head@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 54BBCEFC4BF; Wed, 30 May 2018 20:43:49 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0756678DE3; Wed, 30 May 2018 20:43:49 +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 DB5B410320; Wed, 30 May 2018 20:43:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UKhmwE083974; Wed, 30 May 2018 20:43:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UKhmAn083973; Wed, 30 May 2018 20:43:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201805302043.w4UKhmAn083973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 30 May 2018 20:43:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334400 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 334400 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 20:43:49 -0000 Author: kib Date: Wed May 30 20:43:48 2018 New Revision: 334400 URL: https://svnweb.freebsd.org/changeset/base/334400 Log: Extract code for fast mapping of pte from pmap_extract_and_hold() into the helper function pmap_pte_ufast(). Benchmarked by: bde Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Wed May 30 20:39:22 2018 (r334399) +++ head/sys/i386/i386/pmap.c Wed May 30 20:43:48 2018 (r334400) @@ -1598,6 +1598,26 @@ pmap_pte_quick3(pmap_t pmap, vm_offset_t va) return (0); } +static pt_entry_t +pmap_pte_ufast(pmap_t pmap, vm_offset_t va, pd_entry_t pde) +{ + pt_entry_t *eh_ptep, pte, *ptep; + + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + pde &= PG_FRAME; + critical_enter(); + eh_ptep = (pt_entry_t *)PCPU_GET(pmap_eh_ptep); + if ((*eh_ptep & PG_FRAME) != pde) { + *eh_ptep = pde | PG_RW | PG_V | PG_A | PG_M; + invlcaddr((void *)PCPU_GET(pmap_eh_va)); + } + ptep = (pt_entry_t *)PCPU_GET(pmap_eh_va) + (i386_btop(va) & + (NPTEPG - 1)); + pte = *ptep; + critical_exit(); + return (pte); +} + /* * Routine: pmap_extract * Function: @@ -1637,8 +1657,8 @@ pmap_extract(pmap_t pmap, vm_offset_t va) vm_page_t pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot) { - pd_entry_t pde, newpf; - pt_entry_t *eh_ptep, pte, *ptep; + pd_entry_t pde; + pt_entry_t pte; vm_page_t m; vm_paddr_t pa; @@ -1658,17 +1678,7 @@ retry: vm_page_hold(m); } } else { - newpf = pde & PG_FRAME; - critical_enter(); - eh_ptep = (pt_entry_t *)PCPU_GET(pmap_eh_ptep); - if ((*eh_ptep & PG_FRAME) != newpf) { - *eh_ptep = newpf | PG_RW | PG_V | PG_A | PG_M; - invlcaddr((void *)PCPU_GET(pmap_eh_va)); - } - ptep = (pt_entry_t *)PCPU_GET(pmap_eh_va) + - (i386_btop(va) & (NPTEPG - 1)); - pte = *ptep; - critical_exit(); + pte = pmap_pte_ufast(pmap, va, pde); if (pte != 0 && ((pte & PG_RW) || (prot & VM_PROT_WRITE) == 0)) { if (vm_page_pa_tryrelock(pmap, pte & PG_FRAME, From owner-svn-src-head@freebsd.org Wed May 30 20:44:41 2018 Return-Path: Delivered-To: svn-src-head@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 EFCE5EFC631 for ; Wed, 30 May 2018 20:44:40 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12]) by mx1.freebsd.org (Postfix) with ESMTP id 64F2F78F6D for ; Wed, 30 May 2018 20:44:40 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from iredmail.onthenet.com.au (iredmail.onthenet.com.au [203.13.68.150]) by alto.onthenet.com.au (Postfix) with ESMTPS id CFF5C20195CB for ; Thu, 31 May 2018 06:44:37 +1000 (AEST) Received: from localhost (iredmail.onthenet.com.au [127.0.0.1]) by iredmail.onthenet.com.au (Postfix) with ESMTP id C0626281F24 for ; Thu, 31 May 2018 06:44:37 +1000 (AEST) X-Amavis-Modified: Mail body modified (using disclaimer) - iredmail.onthenet.com.au Received: from iredmail.onthenet.com.au ([127.0.0.1]) by localhost (iredmail.onthenet.com.au [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id tqYbGroVWa4s for ; Thu, 31 May 2018 06:44:37 +1000 (AEST) Received: from Peters-MacBook-Pro-2.local (c122-106-248-59.belrs3.nsw.optusnet.com.au [122.106.248.59]) by iredmail.onthenet.com.au (Postfix) with ESMTPSA id 1CF31280982; Thu, 31 May 2018 06:44:35 +1000 (AEST) Subject: Re: svn commit: r334365 - head/sys/dev/pci To: Nathan Whitehorn , Justin Hibbits , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805300241.w4U2fmvB033942@repo.freebsd.org> <25bd4319-6d7f-e668-88e4-4c3adbc1e8e9@freebsd.org> <264b6c9f-efa3-13e8-1d41-0cdc8631ec82@freebsd.org> From: Peter Grehan Message-ID: Date: Thu, 31 May 2018 06:44:35 +1000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <264b6c9f-efa3-13e8-1d41-0cdc8631ec82@freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=dNCIZtRb c=1 sm=1 tr=0 a=A6CF0fG5TOl4vs6YHvqXgw==:117 a=B4xUt+5V0tDuyGor23H9pw==:17 a=IkcTkHD0fZMA:10 a=VUJBJC2UJ8kA:10 a=w0zRwdbxUSQcq9YFS_AA:9 a=QEXdDO2ut3YA:10 wl=host:3 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 20:44:41 -0000 Hi Nathan, > There are a ton of ARM boards that need this too. You can find one-off > hacks all through the tree and one of the nice things about this change > is that all of those can be consolidated/removed now. If we are going to > have some #ifdef and special cases, it would be better to make them for > bhyve. Sure, but there are multiple orders of magnitude more users of bhyve than power9/affected ARM boards, so can a amd64/i386 ifdef be put there until that work is done ? later, Peter. From owner-svn-src-head@freebsd.org Wed May 30 20:47:21 2018 Return-Path: Delivered-To: svn-src-head@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 29763EFCA18; Wed, 30 May 2018 20:47:21 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D386979236; Wed, 30 May 2018 20:47:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5B6910350; Wed, 30 May 2018 20:47:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UKlKaX084176; Wed, 30 May 2018 20:47:20 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UKlKnE084175; Wed, 30 May 2018 20:47:20 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201805302047.w4UKlKnE084175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 30 May 2018 20:47:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334401 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 334401 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 20:47:21 -0000 Author: kib Date: Wed May 30 20:47:20 2018 New Revision: 334401 URL: https://svnweb.freebsd.org/changeset/base/334401 Log: Use pmap_pte_ufast() instead of pmap_pte() in pmap_extract(), pmap_is_prefaultable() and pmap_incore(), pushing the number of shootdown IPIs back to the 3/1 kernel. Benchmarked by: bde Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Wed May 30 20:43:48 2018 (r334400) +++ head/sys/i386/i386/pmap.c Wed May 30 20:47:20 2018 (r334401) @@ -1628,7 +1628,7 @@ vm_paddr_t pmap_extract(pmap_t pmap, vm_offset_t va) { vm_paddr_t rtval; - pt_entry_t *pte; + pt_entry_t pte; pd_entry_t pde; rtval = 0; @@ -1638,9 +1638,8 @@ pmap_extract(pmap_t pmap, vm_offset_t va) if ((pde & PG_PS) != 0) rtval = (pde & PG_PS_FRAME) | (va & PDRMASK); else { - pte = pmap_pte(pmap, va); - rtval = (*pte & PG_FRAME) | (va & PAGE_MASK); - pmap_pte_release(pte); + pte = pmap_pte_ufast(pmap, va, pde); + rtval = (pte & PG_FRAME) | (va & PAGE_MASK); } } PMAP_UNLOCK(pmap); @@ -4787,19 +4786,14 @@ pmap_is_modified_pvh(struct md_page *pvh) boolean_t pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr) { - pd_entry_t *pde; - pt_entry_t *pte; + pd_entry_t pde; boolean_t rv; rv = FALSE; PMAP_LOCK(pmap); - pde = pmap_pde(pmap, addr); - if (*pde != 0 && (*pde & PG_PS) == 0) { - pte = pmap_pte(pmap, addr); - if (pte != NULL) - rv = *pte == 0; - pmap_pte_release(pte); - } + pde = *pmap_pde(pmap, addr); + if (pde != 0 && (pde & PG_PS) == 0) + rv = pmap_pte_ufast(pmap, addr, pde) == 0; PMAP_UNLOCK(pmap); return (rv); } @@ -5584,25 +5578,23 @@ pmap_change_attr(vm_offset_t va, vm_size_t size, int m int pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) { - pd_entry_t *pdep; - pt_entry_t *ptep, pte; + pd_entry_t pde; + pt_entry_t pte; vm_paddr_t pa; int val; PMAP_LOCK(pmap); retry: - pdep = pmap_pde(pmap, addr); - if (*pdep != 0) { - if (*pdep & PG_PS) { - pte = *pdep; + pde = *pmap_pde(pmap, addr); + if (pde != 0) { + if ((pde & PG_PS) != 0) { + pte = pde; /* Compute the physical address of the 4KB page. */ - pa = ((*pdep & PG_PS_FRAME) | (addr & PDRMASK)) & + pa = ((pde & PG_PS_FRAME) | (addr & PDRMASK)) & PG_FRAME; val = MINCORE_SUPER; } else { - ptep = pmap_pte(pmap, addr); - pte = *ptep; - pmap_pte_release(ptep); + pte = pmap_pte_ufast(pmap, addr, pde); pa = pte & PG_FRAME; val = 0; } From owner-svn-src-head@freebsd.org Wed May 30 20:51:58 2018 Return-Path: Delivered-To: svn-src-head@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 CC773EFD15B; Wed, 30 May 2018 20:51:57 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3FBCF796E7; Wed, 30 May 2018 20:51:57 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-lf0-f51.google.com with SMTP id y20-v6so6384968lfy.0; Wed, 30 May 2018 13:51:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kcwwxoPAcRgEBfIwuIBZ+Dn96es4KcwvFd+7uKA7vYs=; b=WlYl8Yk0OCNybqaEPz/YNTALS7xumFzaOcF7MhUy8MOqQn0i9YRxqNdoikmVXBfCgr 3vZhSiiZlY5JQPhpaYFriqYbGM6bWqwsu3X5rNQmPCylRVwPS+iGVsX/f/6VrfdLbVBC ACZDOlcmbsOuPh9RZGLSX3q/8fxW6yRkTql7M/pqvHDYF/kwbgnU0u13bugkwhTn7Oy1 96B4Oe71aWHuWiI6rXukg8mb0PklFAsVChaEkvEdKDU+T9C1IczVhMvb4BjYIjF+Wc4X 2VTGjal0jBBA7a0TwR79VvLtLTTIcg5H5vsOFO3rUg5fdqxE3U5sMsoqFXY80wXbo7sI YVNA== X-Gm-Message-State: ALKqPwebNvehVfzuDV/r12FCwGMWA54nFu5T8K1vkJQAf4r8NzQQnaKe 9CkjVuHiKF0MDB4V8huZ26TVxQIj5g1UJs82oI0= X-Google-Smtp-Source: ADUXVKLwJvYrNng0hEZeG33Fw2/KypsYEaoeTeF6L8jUz7FbHm1Ap1l7+7KxtAZOMTV5BfroZKeufu3DWI+qUkgdVNs= X-Received: by 2002:a2e:1d53:: with SMTP id d80-v6mr3333459ljd.104.1527713509832; Wed, 30 May 2018 13:51:49 -0700 (PDT) MIME-Version: 1.0 References: <201805300241.w4U2fmvB033942@repo.freebsd.org> <25bd4319-6d7f-e668-88e4-4c3adbc1e8e9@freebsd.org> <264b6c9f-efa3-13e8-1d41-0cdc8631ec82@freebsd.org> In-Reply-To: From: Justin Hibbits Date: Wed, 30 May 2018 15:51:40 -0500 Message-ID: Subject: Re: svn commit: r334365 - head/sys/dev/pci To: Peter Grehan Cc: Nathan Whitehorn , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 20:51:58 -0000 Hi Peter, On Wed, May 30, 2018, 15:44 Peter Grehan wrote: > Hi Nathan, > > > There are a ton of ARM boards that need this too. You can find one-off > > hacks all through the tree and one of the nice things about this change > > is that all of those can be consolidated/removed now. If we are going to > > have some #ifdef and special cases, it would be better to make them for > > bhyve. > > Sure, but there are multiple orders of magnitude more users of bhyve > than power9/affected ARM boards, so can a amd64/i386 ifdef be put there > until that work is done ? > I can add one either tonight or tomorrow. If bhyve has its own attachment id, it is trivial to add a special case on it quickly, too. > later, > > Peter. > - Justin > From owner-svn-src-head@freebsd.org Wed May 30 20:53:31 2018 Return-Path: Delivered-To: svn-src-head@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 832FFEFD375 for ; Wed, 30 May 2018 20:53:31 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12]) by mx1.freebsd.org (Postfix) with ESMTP id E9E3179970 for ; Wed, 30 May 2018 20:53:30 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from iredmail.onthenet.com.au (iredmail.onthenet.com.au [203.13.68.150]) by alto.onthenet.com.au (Postfix) with ESMTPS id 586B02071F48 for ; Thu, 31 May 2018 06:53:28 +1000 (AEST) Received: from localhost (iredmail.onthenet.com.au [127.0.0.1]) by iredmail.onthenet.com.au (Postfix) with ESMTP id 5291F281F26 for ; Thu, 31 May 2018 06:53:28 +1000 (AEST) X-Amavis-Modified: Mail body modified (using disclaimer) - iredmail.onthenet.com.au Received: from iredmail.onthenet.com.au ([127.0.0.1]) by localhost (iredmail.onthenet.com.au [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id fvkChKT2WrDX for ; Thu, 31 May 2018 06:53:28 +1000 (AEST) Received: from Peters-MacBook-Pro-2.local (c122-106-248-59.belrs3.nsw.optusnet.com.au [122.106.248.59]) by iredmail.onthenet.com.au (Postfix) with ESMTPSA id 323AD2808C3; Thu, 31 May 2018 06:53:27 +1000 (AEST) Subject: Re: svn commit: r334365 - head/sys/dev/pci To: Justin Hibbits Cc: Nathan Whitehorn , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805300241.w4U2fmvB033942@repo.freebsd.org> <25bd4319-6d7f-e668-88e4-4c3adbc1e8e9@freebsd.org> <264b6c9f-efa3-13e8-1d41-0cdc8631ec82@freebsd.org> From: Peter Grehan Message-ID: Date: Thu, 31 May 2018 06:53:27 +1000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=dNCIZtRb c=1 sm=1 tr=0 a=A6CF0fG5TOl4vs6YHvqXgw==:117 a=B4xUt+5V0tDuyGor23H9pw==:17 a=IkcTkHD0fZMA:10 a=VUJBJC2UJ8kA:10 a=W0HC56pF2krChlaGEUcA:9 a=QEXdDO2ut3YA:10 wl=host:3 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 20:53:31 -0000 Hi Justin, > I can add one either tonight or tomorrow. Thanks. > If bhyve has its own attachment id, it is trivial > to add a special case on it quickly, too. vendor_id -- 0x1275 later, Peter. From owner-svn-src-head@freebsd.org Wed May 30 20:55:48 2018 Return-Path: Delivered-To: svn-src-head@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 97A91EFD6A1 for ; Wed, 30 May 2018 20:55:48 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12]) by mx1.freebsd.org (Postfix) with ESMTP id 03C3979BD0 for ; Wed, 30 May 2018 20:55:47 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from iredmail.onthenet.com.au (iredmail.onthenet.com.au [203.13.68.150]) by alto.onthenet.com.au (Postfix) with ESMTPS id DD8DC2018C62 for ; Thu, 31 May 2018 06:55:46 +1000 (AEST) Received: from localhost (iredmail.onthenet.com.au [127.0.0.1]) by iredmail.onthenet.com.au (Postfix) with ESMTP id D94AE2808C7 for ; Thu, 31 May 2018 06:55:46 +1000 (AEST) X-Amavis-Modified: Mail body modified (using disclaimer) - iredmail.onthenet.com.au Received: from iredmail.onthenet.com.au ([127.0.0.1]) by localhost (iredmail.onthenet.com.au [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id bfua-BfE1kaD for ; Thu, 31 May 2018 06:55:46 +1000 (AEST) Received: from Peters-MacBook-Pro-2.local (c122-106-248-59.belrs3.nsw.optusnet.com.au [122.106.248.59]) by iredmail.onthenet.com.au (Postfix) with ESMTPSA id 7ADDA2808C3; Thu, 31 May 2018 06:55:46 +1000 (AEST) Subject: Re: svn commit: r334365 - head/sys/dev/pci From: Peter Grehan To: Justin Hibbits Cc: Nathan Whitehorn , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805300241.w4U2fmvB033942@repo.freebsd.org> <25bd4319-6d7f-e668-88e4-4c3adbc1e8e9@freebsd.org> <264b6c9f-efa3-13e8-1d41-0cdc8631ec82@freebsd.org> Message-ID: Date: Thu, 31 May 2018 06:55:46 +1000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=dNCIZtRb c=1 sm=1 tr=0 a=A6CF0fG5TOl4vs6YHvqXgw==:117 a=B4xUt+5V0tDuyGor23H9pw==:17 a=IkcTkHD0fZMA:10 a=VUJBJC2UJ8kA:10 a=HoEhCaf3sUPyMsOJWiIA:9 a=QEXdDO2ut3YA:10 wl=host:3 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 20:55:48 -0000 >> If bhyve has its own=C2=A0 attachment id, it is trivial >> to add a special case on it quickly, too. >=20 > =C2=A0vendor_id -- 0x1275 Actually, this can also be AMD. A better check would be if the system=20 is running virtualized. later, Peter. From owner-svn-src-head@freebsd.org Wed May 30 21:18:20 2018 Return-Path: Delivered-To: svn-src-head@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 D4DB1EFF83D; Wed, 30 May 2018 21:18:19 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com [209.85.215.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 56E637AB6F; Wed, 30 May 2018 21:18:19 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-lf0-f44.google.com with SMTP id r2-v6so6481805lff.4; Wed, 30 May 2018 14:18:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+zsp0dCm3ZnHGBbCE4Q/vyjInH0MdvmecXFo76gr3ok=; b=DUa6g4CMCMY8etlKjkSC1X7XqUPNC7miFPDyclYvyJ9xe5RZiRsCniplWPDnapf34u 48/j1S6QbIoViJQFq2Z7+v/mpghSV9SABGqT2Pe8vU9ipchewIrjuHm3E/KOO1rzYtCy D+s2/q6U6hToPy1cO+i3keTpthIGq85UCMTOwLVzURHCPnThH8/72zsEdB09JhX1IHRD FwO2imWvmfNbcopbPYGN3UqnPsAVgUQGysdQn+PGaNnept/+lv71z+hQMcGRf7zeyIG8 KnO3wln/FqMM9FQ99pbljeBIn1CGzSjPxARhZJ57nnPqDDUFLDiNGlJ7/Yk8nhh1DVOM lwpw== X-Gm-Message-State: ALKqPwd688s1oYtpA6BHe3ro/u+zCK1b9SwPLL/jWPw/TtYsOXcaslQG ygKgoOHbK8SLQn6whefjKkpQtNhLQzIqfEIKVAk= X-Google-Smtp-Source: ADUXVKJFh4RMkHDnvDZX4Jsjw2+8+L8wLjWJi3la1tCFlUoibK4RDQLWTboNSF1v38bNpJffhW4O032d/gA2CBhePMQ= X-Received: by 2002:a2e:42d2:: with SMTP id h79-v6mr3443832ljf.26.1527715097441; Wed, 30 May 2018 14:18:17 -0700 (PDT) MIME-Version: 1.0 References: <201805300241.w4U2fmvB033942@repo.freebsd.org> <25bd4319-6d7f-e668-88e4-4c3adbc1e8e9@freebsd.org> <264b6c9f-efa3-13e8-1d41-0cdc8631ec82@freebsd.org> In-Reply-To: From: Justin Hibbits Date: Wed, 30 May 2018 16:18:08 -0500 Message-ID: Subject: Re: svn commit: r334365 - head/sys/dev/pci To: Peter Grehan Cc: Nathan Whitehorn , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 21:18:20 -0000 On Wed, May 30, 2018, 15:55 Peter Grehan wrote: > >> If bhyve has its own attachment id, it is trivial > >> to add a special case on it quickly, too. > > > > vendor_id -- 0x1275 > > Actually, this can also be AMD. A better check would be if the system > is running virtualized. > I'm thinking more of a root complex driver. If there is something characterized for bhyve, we can just make a driver that had the override. > later, > > Peter. > - Justin > From owner-svn-src-head@freebsd.org Wed May 30 21:46:11 2018 Return-Path: Delivered-To: svn-src-head@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 105A0F7113C; Wed, 30 May 2018 21:46:11 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B81087C298; Wed, 30 May 2018 21:46:10 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9952810E14; Wed, 30 May 2018 21:46:10 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4ULkADL014520; Wed, 30 May 2018 21:46:10 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4ULkAaB014519; Wed, 30 May 2018 21:46:10 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805302146.w4ULkAaB014519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Wed, 30 May 2018 21:46:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334402 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 334402 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 21:46:11 -0000 Author: mmacy Date: Wed May 30 21:46:10 2018 New Revision: 334402 URL: https://svnweb.freebsd.org/changeset/base/334402 Log: if_setlladdr: don't call ioctl in epoch context PR: 228612 Reported by: markj Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Wed May 30 20:47:20 2018 (r334401) +++ head/sys/net/if.c Wed May 30 21:46:10 2018 (r334402) @@ -3839,6 +3839,7 @@ if_setlladdr(struct ifnet *ifp, const u_char *lladdr, * to re-init it in order to reprogram its * address filter. */ + NET_EPOCH_EXIT(); if ((ifp->if_flags & IFF_UP) != 0) { if (ifp->if_ioctl) { ifp->if_flags &= ~IFF_UP; @@ -3852,6 +3853,7 @@ if_setlladdr(struct ifnet *ifp, const u_char *lladdr, } } EVENTHANDLER_INVOKE(iflladdr_event, ifp); + return (0); out: NET_EPOCH_EXIT(); return (rc); From owner-svn-src-head@freebsd.org Wed May 30 21:50:24 2018 Return-Path: Delivered-To: svn-src-head@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 17400F719AD; Wed, 30 May 2018 21:50:24 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BE93A7C883; Wed, 30 May 2018 21:50:23 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9FBEE10E28; Wed, 30 May 2018 21:50:23 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4ULoNbE014956; Wed, 30 May 2018 21:50:23 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4ULoNEq014955; Wed, 30 May 2018 21:50:23 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201805302150.w4ULoNEq014955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 30 May 2018 21:50:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334403 - head/sys/security/audit X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sys/security/audit X-SVN-Commit-Revision: 334403 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 21:50:24 -0000 Author: asomers Date: Wed May 30 21:50:23 2018 New Revision: 334403 URL: https://svnweb.freebsd.org/changeset/base/334403 Log: #include in security/audit/audit_ioctl.h security/audit/audit_ioctl.h uses a type from bsm/audit.h, so needs to include it. And it needs to know the type's size, so it can't just forward-declare. PR: 228470 Submitted by: aniketp MFC after: 2 weeks Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15561 Modified: head/sys/security/audit/audit_ioctl.h Modified: head/sys/security/audit/audit_ioctl.h ============================================================================== --- head/sys/security/audit/audit_ioctl.h Wed May 30 21:46:10 2018 (r334402) +++ head/sys/security/audit/audit_ioctl.h Wed May 30 21:50:23 2018 (r334403) @@ -31,6 +31,8 @@ #ifndef _SECURITY_AUDIT_AUDIT_IOCTL_H_ #define _SECURITY_AUDIT_AUDIT_IOCTL_H_ +#include + #define AUDITPIPE_IOBASE 'A' /* From owner-svn-src-head@freebsd.org Wed May 30 22:03:03 2018 Return-Path: Delivered-To: svn-src-head@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 C7083F73393; Wed, 30 May 2018 22:03:03 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7605F7DC1A; Wed, 30 May 2018 22:03:03 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 581BA1118E; Wed, 30 May 2018 22:03:03 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UM33Te025148; Wed, 30 May 2018 22:03:03 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UM32SN025146; Wed, 30 May 2018 22:03:02 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805302203.w4UM32SN025146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Wed, 30 May 2018 22:03:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334404 - head/usr.sbin/pmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/usr.sbin/pmc X-SVN-Commit-Revision: 334404 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 22:03:04 -0000 Author: mmacy Date: Wed May 30 22:03:02 2018 New Revision: 334404 URL: https://svnweb.freebsd.org/changeset/base/334404 Log: pmc stat: fix format strings for 32-bit Modified: head/usr.sbin/pmc/Makefile (contents, props changed) head/usr.sbin/pmc/cmd_pmc_stat.c (contents, props changed) Modified: head/usr.sbin/pmc/Makefile ============================================================================== --- head/usr.sbin/pmc/Makefile Wed May 30 21:50:23 2018 (r334403) +++ head/usr.sbin/pmc/Makefile Wed May 30 22:03:02 2018 (r334404) @@ -9,5 +9,4 @@ LIBADD= kvm pmc m ncursesw pmcstat elf SRCS= pmc.c pmc_util.c cmd_pmc_stat.c -CWARNFLAGS.cmd_pmc_stat.c= -Wno-format .include Modified: head/usr.sbin/pmc/cmd_pmc_stat.c ============================================================================== --- head/usr.sbin/pmc/cmd_pmc_stat.c Wed May 30 21:50:23 2018 (r334403) +++ head/usr.sbin/pmc/cmd_pmc_stat.c Wed May 30 22:03:02 2018 (r334404) @@ -271,23 +271,23 @@ pmc_stat_print_stat(struct rusage *ru) fprintf(pmc_args.pa_printfile, "%16ld %s\t#\t%02.03f M/sec\n", ru->ru_nivcsw, "involuntary csw", ((double)ru->ru_nivcsw / (double)ticks) / hz); - fprintf(pmc_args.pa_printfile, "%16ld %s\n", cvals[CYCLES], stat_mode_names[CYCLES]); - fprintf(pmc_args.pa_printfile, "%16ld %s\t\t#\t%01.03f inst/cycle\n", cvals[INST], stat_mode_names[INST], + fprintf(pmc_args.pa_printfile, "%16jd %s\n", (uintmax_t)cvals[CYCLES], stat_mode_names[CYCLES]); + fprintf(pmc_args.pa_printfile, "%16jd %s\t\t#\t%01.03f inst/cycle\n", (uintmax_t)cvals[INST], stat_mode_names[INST], (double)cvals[INST] / cvals[CYCLES]); - fprintf(pmc_args.pa_printfile, "%16ld %s\n", cvals[BR], stat_mode_names[BR]); + fprintf(pmc_args.pa_printfile, "%16jd %s\n", (uintmax_t)cvals[BR], stat_mode_names[BR]); if (stat_mode_names[BR_MISS] == pmc_stat_mode_names[BR_MISS]) - fprintf(pmc_args.pa_printfile, "%16ld %s\t\t#\t%.03f%%\n", - cvals[BR_MISS], stat_mode_names[BR_MISS], + fprintf(pmc_args.pa_printfile, "%16jd %s\t\t#\t%.03f%%\n", + (uintmax_t)cvals[BR_MISS], stat_mode_names[BR_MISS], 100 * ((double)cvals[BR_MISS] / cvals[BR])); else - fprintf(pmc_args.pa_printfile, "%16ld %s\n", - cvals[BR_MISS], stat_mode_names[BR_MISS]); - fprintf(pmc_args.pa_printfile, "%16ld %s%s", cvals[CACHE], stat_mode_names[CACHE], + fprintf(pmc_args.pa_printfile, "%16jd %s\n", + (uintmax_t)cvals[BR_MISS], stat_mode_names[BR_MISS]); + fprintf(pmc_args.pa_printfile, "%16jd %s%s", (uintmax_t)cvals[CACHE], stat_mode_names[CACHE], stat_mode_names[CACHE] != pmc_stat_mode_names[CACHE] ? "\n" : ""); if (stat_mode_names[CACHE] == pmc_stat_mode_names[CACHE]) fprintf(pmc_args.pa_printfile, "\t#\t%.03f refs/inst\n", ((double)cvals[CACHE] / cvals[INST])); - fprintf(pmc_args.pa_printfile, "%16ld %s%s", cvals[CACHE_MISS], stat_mode_names[CACHE_MISS], + fprintf(pmc_args.pa_printfile, "%16jd %s%s", (uintmax_t)cvals[CACHE_MISS], stat_mode_names[CACHE_MISS], stat_mode_names[CACHE_MISS] != pmc_stat_mode_names[CACHE_MISS] ? "\n" : ""); if (stat_mode_names[CACHE_MISS] == pmc_stat_mode_names[CACHE_MISS]) fprintf(pmc_args.pa_printfile, "\t\t#\t%.03f%%\n", @@ -296,7 +296,6 @@ pmc_stat_print_stat(struct rusage *ru) showtime(pmc_args.pa_printfile, &before_ts, &after, ru); } - static struct option longopts[] = { {"events", required_argument, NULL, 'j'}, From owner-svn-src-head@freebsd.org Wed May 30 22:23:00 2018 Return-Path: Delivered-To: svn-src-head@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 D832EF75247; Wed, 30 May 2018 22:22:59 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 612E57EA0F; Wed, 30 May 2018 22:22:59 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42539114BF; Wed, 30 May 2018 22:22:59 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UMMxJT035338; Wed, 30 May 2018 22:22:59 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UMMwTr035336; Wed, 30 May 2018 22:22:58 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201805302222.w4UMMwTr035336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 30 May 2018 22:22:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334405 - in head/sys: compat/freebsd32 kern X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head/sys: compat/freebsd32 kern X-SVN-Commit-Revision: 334405 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 22:23:00 -0000 Author: brooks Date: Wed May 30 22:22:58 2018 New Revision: 334405 URL: https://svnweb.freebsd.org/changeset/base/334405 Log: Remove alternative names that are identical to the default. Verified by make sysent producing no changes. Modified: head/sys/compat/freebsd32/syscalls.master head/sys/kern/syscalls.master Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Wed May 30 22:03:02 2018 (r334404) +++ head/sys/compat/freebsd32/syscalls.master Wed May 30 22:22:58 2018 (r334405) @@ -156,8 +156,7 @@ size_t count); } 59 AUE_EXECVE STD { int freebsd32_execve(char *fname, \ uint32_t *argv, uint32_t *envv); } -60 AUE_UMASK NOPROTO { int umask(int newmask); } umask \ - umask_args int +60 AUE_UMASK NOPROTO { int umask(int newmask); } 61 AUE_CHROOT NOPROTO { int chroot(char *path); } 62 AUE_FSTAT COMPAT { int freebsd32_fstat(int fd, \ struct ostat32 *ub); } Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Wed May 30 22:03:02 2018 (r334404) +++ head/sys/kern/syscalls.master Wed May 30 22:22:58 2018 (r334405) @@ -210,8 +210,7 @@ _In_z_ char *fname, \ _In_z_ char **argv, \ _In_z_ char **envv); } -60 AUE_UMASK STD { int umask(int newmask); } umask umask_args \ - int +60 AUE_UMASK STD { int umask(int newmask); } 61 AUE_CHROOT STD { int chroot(_In_z_ char *path); } 62 AUE_FSTAT COMPAT { int fstat(int fd, _Out_ struct ostat *sb); } 63 AUE_NULL COMPAT { int getkerninfo(int op, \ From owner-svn-src-head@freebsd.org Wed May 30 22:36:11 2018 Return-Path: Delivered-To: svn-src-head@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 76980F76538; Wed, 30 May 2018 22:36:11 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 27E837F2B0; Wed, 30 May 2018 22:36:11 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0917B1165D; Wed, 30 May 2018 22:36:11 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UMaB5d040276; Wed, 30 May 2018 22:36:11 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UMaA1M040271; Wed, 30 May 2018 22:36:10 GMT (envelope-from np@FreeBSD.org) Message-Id: <201805302236.w4UMaA1M040271@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 30 May 2018 22:36:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334406 - in head/sys/dev/cxgbe: . common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common X-SVN-Commit-Revision: 334406 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 22:36:11 -0000 Author: np Date: Wed May 30 22:36:09 2018 New Revision: 334406 URL: https://svnweb.freebsd.org/changeset/base/334406 Log: cxgbe(4): Consider all supported speeds when building the ifmedia list for a port. Fix other related issues while here: - Require port lock for access to link_config. - Allow 100Mbps operation by tracking the speed in Mbps. Yes, really. - New port flag to indicate that the media list is immutable. It will be used in future refinements. This also fixes a bug where the driver reports incorrect media with recent firmwares. MFC after: 2 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Wed May 30 22:22:58 2018 (r334405) +++ head/sys/dev/cxgbe/adapter.h Wed May 30 22:36:09 2018 (r334406) @@ -164,6 +164,7 @@ enum { /* port flags */ HAS_TRACEQ = (1 << 3), + FIXED_IFMEDIA = (1 << 4), /* ifmedia list doesn't change. */ /* VI flags */ DOOMED = (1 << 0), Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Wed May 30 22:22:58 2018 (r334405) +++ head/sys/dev/cxgbe/common/common.h Wed May 30 22:36:09 2018 (r334406) @@ -418,12 +418,12 @@ struct link_config { unsigned char requested_aneg; /* link aneg user has requested */ unsigned char requested_fc; /* flow control user has requested */ unsigned char requested_fec; /* FEC user has requested */ - unsigned int requested_speed; /* speed user has requested */ + unsigned int requested_speed; /* speed user has requested (Mbps) */ unsigned short supported; /* link capabilities */ unsigned short advertising; /* advertised capabilities */ unsigned short lp_advertising; /* peer advertised capabilities */ - unsigned int speed; /* actual link speed */ + unsigned int speed; /* actual link speed (Mbps) */ unsigned char fc; /* actual link flow control */ unsigned char fec; /* actual FEC */ unsigned char link_ok; /* link up? */ Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Wed May 30 22:22:58 2018 (r334405) +++ head/sys/dev/cxgbe/common/t4_hw.c Wed May 30 22:36:09 2018 (r334406) @@ -3727,21 +3727,24 @@ int t4_link_l1cfg(struct adapter *adap, unsigned int m lc->requested_aneg == AUTONEG_DISABLE) { aneg = 0; switch (lc->requested_speed) { - case 100: + case 100000: speed = FW_PORT_CAP_SPEED_100G; break; - case 40: + case 40000: speed = FW_PORT_CAP_SPEED_40G; break; - case 25: + case 25000: speed = FW_PORT_CAP_SPEED_25G; break; - case 10: + case 10000: speed = FW_PORT_CAP_SPEED_10G; break; - case 1: + case 1000: speed = FW_PORT_CAP_SPEED_1G; break; + case 100: + speed = FW_PORT_CAP_SPEED_100M; + break; default: return -EINVAL; break; @@ -7715,9 +7718,9 @@ static void handle_port_info(struct port_info *pi, con fec = 0; if (lc->advertising & FW_PORT_CAP_FEC_RS) - fec |= FEC_RS; - if (lc->advertising & FW_PORT_CAP_FEC_BASER_RS) - fec |= FEC_BASER_RS; + fec = FEC_RS; + else if (lc->advertising & FW_PORT_CAP_FEC_BASER_RS) + fec = FEC_BASER_RS; lc->fec = fec; } @@ -7778,14 +7781,16 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be6 } lc = &pi->link_cfg; + PORT_LOCK(pi); old_lc = &pi->old_link_cfg; old_ptype = pi->port_type; old_mtype = pi->mod_type; - handle_port_info(pi, &p->u.info); + PORT_UNLOCK(pi); if (old_ptype != pi->port_type || old_mtype != pi->mod_type) { t4_os_portmod_changed(pi); } + PORT_LOCK(pi); if (old_lc->link_ok != lc->link_ok || old_lc->speed != lc->speed || old_lc->fec != lc->fec || @@ -7793,6 +7798,7 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be6 t4_os_link_changed(pi); *old_lc = *lc; } + PORT_UNLOCK(pi); } else { CH_WARN_RATELIMIT(adap, "Unknown firmware reply %d\n", opcode); return -EINVAL; Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Wed May 30 22:22:58 2018 (r334405) +++ head/sys/dev/cxgbe/t4_main.c Wed May 30 22:36:09 2018 (r334406) @@ -2087,68 +2087,210 @@ cxgbe_media_change(struct ifnet *ifp) return (EOPNOTSUPP); } +/* + * Mbps to FW_PORT_CAP_SPEED_* bit. + */ +static uint16_t +speed_to_fwspeed(int speed) +{ + + switch (speed) { + case 100000: + return (FW_PORT_CAP_SPEED_100G); + case 40000: + return (FW_PORT_CAP_SPEED_40G); + case 25000: + return (FW_PORT_CAP_SPEED_25G); + case 10000: + return (FW_PORT_CAP_SPEED_10G); + case 1000: + return (FW_PORT_CAP_SPEED_1G); + case 100: + return (FW_PORT_CAP_SPEED_100M); + } + + return (0); +} + +/* + * Base media word (without ETHER, pause, link active, etc.) for the port at the + * given speed. + */ +static int +port_mword(struct port_info *pi, uint16_t speed) +{ + + MPASS(speed & M_FW_PORT_CAP_SPEED); + MPASS(powerof2(speed)); + + switch(pi->port_type) { + case FW_PORT_TYPE_BT_SGMII: + case FW_PORT_TYPE_BT_XFI: + case FW_PORT_TYPE_BT_XAUI: + /* BaseT */ + switch (speed) { + case FW_PORT_CAP_SPEED_100M: + return (IFM_100_T); + case FW_PORT_CAP_SPEED_1G: + return (IFM_1000_T); + case FW_PORT_CAP_SPEED_10G: + return (IFM_10G_T); + } + break; + case FW_PORT_TYPE_KX4: + if (speed == FW_PORT_CAP_SPEED_10G) + return (IFM_10G_KX4); + break; + case FW_PORT_TYPE_CX4: + if (speed == FW_PORT_CAP_SPEED_10G) + return (IFM_10G_CX4); + break; + case FW_PORT_TYPE_KX: + if (speed == FW_PORT_CAP_SPEED_1G) + return (IFM_1000_KX); + break; + case FW_PORT_TYPE_KR: + case FW_PORT_TYPE_BP_AP: + case FW_PORT_TYPE_BP4_AP: + case FW_PORT_TYPE_BP40_BA: + case FW_PORT_TYPE_KR4_100G: + case FW_PORT_TYPE_KR_SFP28: + case FW_PORT_TYPE_KR_XLAUI: + switch (speed) { + case FW_PORT_CAP_SPEED_1G: + return (IFM_1000_KX); + case FW_PORT_CAP_SPEED_10G: + return (IFM_10G_KR); + case FW_PORT_CAP_SPEED_25G: + return (IFM_25G_KR); + case FW_PORT_CAP_SPEED_40G: + return (IFM_40G_KR4); + case FW_PORT_CAP_SPEED_100G: + return (IFM_100G_KR4); + } + break; + case FW_PORT_TYPE_FIBER_XFI: + case FW_PORT_TYPE_FIBER_XAUI: + case FW_PORT_TYPE_SFP: + case FW_PORT_TYPE_QSFP_10G: + case FW_PORT_TYPE_QSA: + case FW_PORT_TYPE_QSFP: + case FW_PORT_TYPE_CR4_QSFP: + case FW_PORT_TYPE_CR_QSFP: + case FW_PORT_TYPE_CR2_QSFP: + case FW_PORT_TYPE_SFP28: + /* Pluggable transceiver */ + switch (pi->mod_type) { + case FW_PORT_MOD_TYPE_LR: + switch (speed) { + case FW_PORT_CAP_SPEED_1G: + return (IFM_1000_LX); + case FW_PORT_CAP_SPEED_10G: + return (IFM_10G_LR); + case FW_PORT_CAP_SPEED_25G: + return (IFM_25G_LR); + case FW_PORT_CAP_SPEED_40G: + return (IFM_40G_LR4); + case FW_PORT_CAP_SPEED_100G: + return (IFM_100G_LR4); + } + break; + case FW_PORT_MOD_TYPE_SR: + switch (speed) { + case FW_PORT_CAP_SPEED_1G: + return (IFM_1000_SX); + case FW_PORT_CAP_SPEED_10G: + return (IFM_10G_SR); + case FW_PORT_CAP_SPEED_25G: + return (IFM_25G_SR); + case FW_PORT_CAP_SPEED_40G: + return (IFM_40G_SR4); + case FW_PORT_CAP_SPEED_100G: + return (IFM_100G_SR4); + } + break; + case FW_PORT_MOD_TYPE_ER: + if (speed == FW_PORT_CAP_SPEED_10G) + return (IFM_10G_ER); + break; + case FW_PORT_MOD_TYPE_TWINAX_PASSIVE: + case FW_PORT_MOD_TYPE_TWINAX_ACTIVE: + switch (speed) { + case FW_PORT_CAP_SPEED_1G: + return (IFM_1000_CX); + case FW_PORT_CAP_SPEED_10G: + return (IFM_10G_TWINAX); + case FW_PORT_CAP_SPEED_25G: + return (IFM_25G_CR); + case FW_PORT_CAP_SPEED_40G: + return (IFM_40G_CR4); + case FW_PORT_CAP_SPEED_100G: + return (IFM_100G_CR4); + } + break; + case FW_PORT_MOD_TYPE_LRM: + if (speed == FW_PORT_CAP_SPEED_10G) + return (IFM_10G_LRM); + break; + case FW_PORT_MOD_TYPE_NA: + MPASS(0); /* Not pluggable? */ + /* fall throough */ + case FW_PORT_MOD_TYPE_ERROR: + case FW_PORT_MOD_TYPE_UNKNOWN: + case FW_PORT_MOD_TYPE_NOTSUPPORTED: + break; + case FW_PORT_MOD_TYPE_NONE: + return (IFM_NONE); + } + break; + case FW_PORT_TYPE_NONE: + return (IFM_NONE); + } + + return (IFM_UNKNOWN); +} + static void cxgbe_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) { struct vi_info *vi = ifp->if_softc; struct port_info *pi = vi->pi; - struct ifmedia_entry *cur; + struct adapter *sc = pi->adapter; struct link_config *lc = &pi->link_cfg; - /* - * If all the interfaces are administratively down the firmware does not - * report transceiver changes. Refresh port info here so that ifconfig - * displays accurate information at all times. - */ - if (begin_synchronized_op(pi->adapter, NULL, SLEEP_OK | INTR_OK, - "t4med") == 0) { - PORT_LOCK(pi); - if (pi->up_vis == 0) { - t4_update_port_info(pi); - build_medialist(pi, &pi->media); - } - PORT_UNLOCK(pi); - end_synchronized_op(pi->adapter, 0); + if (begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4med") != 0) + return; + PORT_LOCK(pi); + + if (pi->up_vis == 0) { + /* + * If all the interfaces are administratively down the firmware + * does not report transceiver changes. Refresh port info here + * so that ifconfig displays accurate ifmedia at all times. + * This is the only reason we have a synchronized op in this + * function. Just PORT_LOCK would have been enough otherwise. + */ + t4_update_port_info(pi); + build_medialist(pi, &pi->media); } + /* ifm_status */ ifmr->ifm_status = IFM_AVALID; if (lc->link_ok == 0) - return; - + goto done; ifmr->ifm_status |= IFM_ACTIVE; + + /* ifm_active */ + ifmr->ifm_active = IFM_ETHER; ifmr->ifm_active &= ~(IFM_ETH_TXPAUSE | IFM_ETH_RXPAUSE); if (lc->fc & PAUSE_RX) ifmr->ifm_active |= IFM_ETH_RXPAUSE; if (lc->fc & PAUSE_TX) ifmr->ifm_active |= IFM_ETH_TXPAUSE; - - /* active and current will differ iff current media is autoselect. */ - cur = pi->media.ifm_cur; - if (cur != NULL && IFM_SUBTYPE(cur->ifm_media) != IFM_AUTO) - return; - - ifmr->ifm_active = IFM_ETHER | IFM_FDX; - if (lc->fc & PAUSE_RX) - ifmr->ifm_active |= IFM_ETH_RXPAUSE; - if (lc->fc & PAUSE_TX) - ifmr->ifm_active |= IFM_ETH_TXPAUSE; - switch (lc->speed) { - case 10000: - ifmr->ifm_active |= IFM_10G_T; - break; - case 1000: - ifmr->ifm_active |= IFM_1000_T; - break; - case 100: - ifmr->ifm_active |= IFM_100_TX; - break; - case 10: - ifmr->ifm_active |= IFM_10_T; - break; - default: - device_printf(vi->dev, "link up but speed unknown (%u)\n", - lc->speed); - } + ifmr->ifm_active |= port_mword(pi, speed_to_fwspeed(lc->speed)); +done: + PORT_UNLOCK(pi); + end_synchronized_op(sc, 0); } static int @@ -3995,214 +4137,114 @@ t4_set_desc(struct adapter *sc) device_set_desc_copy(sc->dev, buf); } +static inline void +ifmedia_add4(struct ifmedia *media, int m) +{ + + ifmedia_add(media, m, 0, NULL); + ifmedia_add(media, m | IFM_ETH_TXPAUSE, 0, NULL); + ifmedia_add(media, m | IFM_ETH_RXPAUSE, 0, NULL); + ifmedia_add(media, m | IFM_ETH_TXPAUSE | IFM_ETH_RXPAUSE, 0, NULL); +} + static void -build_medialist(struct port_info *pi, struct ifmedia *media) +set_current_media(struct port_info *pi, struct ifmedia *media) { - int m; + struct link_config *lc; + int mword; PORT_LOCK_ASSERT_OWNED(pi); - ifmedia_removeall(media); + /* Leave current media alone if it's already set to IFM_NONE. */ + if (media->ifm_cur != NULL && + IFM_SUBTYPE(media->ifm_cur->ifm_media) == IFM_NONE) + return; - /* - * XXX: Would it be better to ifmedia_add all 4 combinations of pause - * settings for every speed instead of just txpause|rxpause? ifconfig - * media display looks much better if autoselect is the only case where - * ifm_current is different from ifm_active. If the user picks anything - * except txpause|rxpause the display is ugly. - */ - m = IFM_ETHER | IFM_FDX | IFM_ETH_TXPAUSE | IFM_ETH_RXPAUSE; + mword = IFM_ETHER; + lc = &pi->link_cfg; + if (lc->requested_aneg == AUTONEG_ENABLE && + lc->supported & FW_PORT_CAP_ANEG) { + ifmedia_set(media, mword | IFM_AUTO); + return; + } + if (lc->requested_fc & PAUSE_TX) + mword |= IFM_ETH_TXPAUSE; + if (lc->requested_fc & PAUSE_RX) + mword |= IFM_ETH_RXPAUSE; + mword |= port_mword(pi, speed_to_fwspeed(lc->requested_speed)); + ifmedia_set(media, mword); +} - switch(pi->port_type) { - case FW_PORT_TYPE_BT_XFI: - case FW_PORT_TYPE_BT_XAUI: - ifmedia_add(media, m | IFM_10G_T, 0, NULL); - /* fall through */ +static void +build_medialist(struct port_info *pi, struct ifmedia *media) +{ + uint16_t ss, speed; + int unknown, mword, bit; + struct link_config *lc; - case FW_PORT_TYPE_BT_SGMII: - ifmedia_add(media, m | IFM_1000_T, 0, NULL); - ifmedia_add(media, m | IFM_100_TX, 0, NULL); - ifmedia_add(media, IFM_ETHER | IFM_AUTO, 0, NULL); - ifmedia_set(media, IFM_ETHER | IFM_AUTO); - break; + PORT_LOCK_ASSERT_OWNED(pi); - case FW_PORT_TYPE_CX4: - ifmedia_add(media, m | IFM_10G_CX4, 0, NULL); - ifmedia_set(media, m | IFM_10G_CX4); - break; + if (pi->flags & FIXED_IFMEDIA) + return; - case FW_PORT_TYPE_QSFP_10G: - case FW_PORT_TYPE_SFP: - case FW_PORT_TYPE_FIBER_XFI: - case FW_PORT_TYPE_FIBER_XAUI: - switch (pi->mod_type) { + /* + * First setup all the requested_ fields so that they comply with what's + * supported by the port + transceiver. Note that this clobbers any + * user preferences set via sysctl_pause_settings or sysctl_autoneg. + */ + init_l1cfg(pi); - case FW_PORT_MOD_TYPE_LR: - ifmedia_add(media, m | IFM_10G_LR, 0, NULL); - ifmedia_set(media, m | IFM_10G_LR); - break; + /* + * Now (re)build the ifmedia list. + */ + ifmedia_removeall(media); + lc = &pi->link_cfg; + ss = G_FW_PORT_CAP_SPEED(lc->supported); /* Supported Speeds */ + if (__predict_false(ss == 0)) { /* not supposed to happen. */ + MPASS(ss != 0); +no_media: + MPASS(LIST_EMPTY(&media->ifm_list)); + ifmedia_add(media, IFM_ETHER | IFM_NONE, 0, NULL); + ifmedia_set(media, IFM_ETHER | IFM_NONE); + return; + } - case FW_PORT_MOD_TYPE_SR: - ifmedia_add(media, m | IFM_10G_SR, 0, NULL); - ifmedia_set(media, m | IFM_10G_SR); - break; - - case FW_PORT_MOD_TYPE_LRM: - ifmedia_add(media, m | IFM_10G_LRM, 0, NULL); - ifmedia_set(media, m | IFM_10G_LRM); - break; - - case FW_PORT_MOD_TYPE_TWINAX_PASSIVE: - case FW_PORT_MOD_TYPE_TWINAX_ACTIVE: - ifmedia_add(media, m | IFM_10G_TWINAX, 0, NULL); - ifmedia_set(media, m | IFM_10G_TWINAX); - break; - - case FW_PORT_MOD_TYPE_NONE: - m &= ~IFM_FDX; - ifmedia_add(media, m | IFM_NONE, 0, NULL); - ifmedia_set(media, m | IFM_NONE); - break; - - case FW_PORT_MOD_TYPE_NA: - case FW_PORT_MOD_TYPE_ER: - default: - device_printf(pi->dev, - "unknown port_type (%d), mod_type (%d)\n", - pi->port_type, pi->mod_type); - ifmedia_add(media, m | IFM_UNKNOWN, 0, NULL); - ifmedia_set(media, m | IFM_UNKNOWN); - break; + unknown = 0; + for (bit = 0; bit < fls(ss); bit++) { + speed = 1 << bit; + MPASS(speed & M_FW_PORT_CAP_SPEED); + if (ss & speed) { + mword = port_mword(pi, speed); + if (mword == IFM_NONE) { + goto no_media; + } else if (mword == IFM_UNKNOWN) + unknown++; + else + ifmedia_add4(media, IFM_ETHER | mword); } - break; - - case FW_PORT_TYPE_CR_QSFP: - case FW_PORT_TYPE_SFP28: - case FW_PORT_TYPE_KR_SFP28: - switch (pi->mod_type) { - - case FW_PORT_MOD_TYPE_SR: - ifmedia_add(media, m | IFM_25G_SR, 0, NULL); - ifmedia_set(media, m | IFM_25G_SR); - break; - - case FW_PORT_MOD_TYPE_TWINAX_PASSIVE: - case FW_PORT_MOD_TYPE_TWINAX_ACTIVE: - ifmedia_add(media, m | IFM_25G_CR, 0, NULL); - ifmedia_set(media, m | IFM_25G_CR); - break; - - case FW_PORT_MOD_TYPE_NONE: - m &= ~IFM_FDX; - ifmedia_add(media, m | IFM_NONE, 0, NULL); - ifmedia_set(media, m | IFM_NONE); - break; - - default: - device_printf(pi->dev, - "unknown port_type (%d), mod_type (%d)\n", - pi->port_type, pi->mod_type); - ifmedia_add(media, m | IFM_UNKNOWN, 0, NULL); - ifmedia_set(media, m | IFM_UNKNOWN); - break; - } - break; - - case FW_PORT_TYPE_QSFP: - switch (pi->mod_type) { - - case FW_PORT_MOD_TYPE_LR: - ifmedia_add(media, m | IFM_40G_LR4, 0, NULL); - ifmedia_set(media, m | IFM_40G_LR4); - break; - - case FW_PORT_MOD_TYPE_SR: - ifmedia_add(media, m | IFM_40G_SR4, 0, NULL); - ifmedia_set(media, m | IFM_40G_SR4); - break; - - case FW_PORT_MOD_TYPE_TWINAX_PASSIVE: - case FW_PORT_MOD_TYPE_TWINAX_ACTIVE: - ifmedia_add(media, m | IFM_40G_CR4, 0, NULL); - ifmedia_set(media, m | IFM_40G_CR4); - break; - - case FW_PORT_MOD_TYPE_NONE: - m &= ~IFM_FDX; - ifmedia_add(media, m | IFM_NONE, 0, NULL); - ifmedia_set(media, m | IFM_NONE); - break; - - default: - device_printf(pi->dev, - "unknown port_type (%d), mod_type (%d)\n", - pi->port_type, pi->mod_type); - ifmedia_add(media, m | IFM_UNKNOWN, 0, NULL); - ifmedia_set(media, m | IFM_UNKNOWN); - break; - } - break; - - case FW_PORT_TYPE_KR4_100G: - case FW_PORT_TYPE_CR4_QSFP: - switch (pi->mod_type) { - - case FW_PORT_MOD_TYPE_LR: - ifmedia_add(media, m | IFM_100G_LR4, 0, NULL); - ifmedia_set(media, m | IFM_100G_LR4); - break; - - case FW_PORT_MOD_TYPE_SR: - ifmedia_add(media, m | IFM_100G_SR4, 0, NULL); - ifmedia_set(media, m | IFM_100G_SR4); - break; - - case FW_PORT_MOD_TYPE_TWINAX_PASSIVE: - case FW_PORT_MOD_TYPE_TWINAX_ACTIVE: - ifmedia_add(media, m | IFM_100G_CR4, 0, NULL); - ifmedia_set(media, m | IFM_100G_CR4); - break; - - case FW_PORT_MOD_TYPE_NONE: - m &= ~IFM_FDX; - ifmedia_add(media, m | IFM_NONE, 0, NULL); - ifmedia_set(media, m | IFM_NONE); - break; - - default: - device_printf(pi->dev, - "unknown port_type (%d), mod_type (%d)\n", - pi->port_type, pi->mod_type); - ifmedia_add(media, m | IFM_UNKNOWN, 0, NULL); - ifmedia_set(media, m | IFM_UNKNOWN); - break; - } - break; - - default: - device_printf(pi->dev, - "unknown port_type (%d), mod_type (%d)\n", pi->port_type, - pi->mod_type); - ifmedia_add(media, m | IFM_UNKNOWN, 0, NULL); - ifmedia_set(media, m | IFM_UNKNOWN); - break; } + if (unknown > 0) /* Add one unknown for all unknown media types. */ + ifmedia_add4(media, IFM_ETHER | IFM_UNKNOWN); + if (lc->supported & FW_PORT_CAP_ANEG) + ifmedia_add(media, IFM_ETHER | IFM_AUTO, 0, NULL); + + set_current_media(pi, media); } /* - * Update all the requested_* fields in the link config and then send a mailbox - * command to apply the settings. + * Update all the requested_* fields in the link config to something valid (and + * reasonable). */ static void init_l1cfg(struct port_info *pi) { - struct adapter *sc = pi->adapter; struct link_config *lc = &pi->link_cfg; - int rc; - ASSERT_SYNCHRONIZED_OP(sc); + PORT_LOCK_ASSERT_OWNED(pi); - lc->requested_speed = port_top_speed(pi); /* in Gbps */ + /* Gbps -> Mbps */ + lc->requested_speed = port_top_speed(pi) * 1000; + if (t4_autoneg != 0 && lc->supported & FW_PORT_CAP_ANEG) { lc->requested_aneg = AUTONEG_ENABLE; } else { @@ -4212,18 +4254,58 @@ init_l1cfg(struct port_info *pi) lc->requested_fc = t4_pause_settings & (PAUSE_TX | PAUSE_RX); if (t4_fec != -1) { - lc->requested_fec = t4_fec & (FEC_RS | FEC_BASER_RS | - FEC_RESERVED); + if (t4_fec & FEC_RS && lc->supported & FW_PORT_CAP_FEC_RS) { + lc->requested_fec = FEC_RS; + } else if (t4_fec & FEC_BASER_RS && + lc->supported & FW_PORT_CAP_FEC_BASER_RS) { + lc->requested_fec = FEC_BASER_RS; + } else { + lc->requested_fec = 0; + } } else { /* Use the suggested value provided by the firmware in acaps */ - if (lc->advertising & FW_PORT_CAP_FEC_RS) + if (lc->advertising & FW_PORT_CAP_FEC_RS && + lc->supported & FW_PORT_CAP_FEC_RS) { lc->requested_fec = FEC_RS; - else if (lc->advertising & FW_PORT_CAP_FEC_BASER_RS) + } else if (lc->advertising & FW_PORT_CAP_FEC_BASER_RS && + lc->supported & FW_PORT_CAP_FEC_BASER_RS) { lc->requested_fec = FEC_BASER_RS; - else + } else { lc->requested_fec = 0; + } } +} +/* + * Apply the settings in requested_* to the hardware. The parameters are + * expected to be sane. + */ +static int +apply_l1cfg(struct port_info *pi) +{ + struct adapter *sc = pi->adapter; + struct link_config *lc = &pi->link_cfg; + int rc; +#ifdef INVARIANTS + uint16_t fwspeed; + + ASSERT_SYNCHRONIZED_OP(sc); + PORT_LOCK_ASSERT_OWNED(pi); + + if (lc->requested_aneg == AUTONEG_ENABLE) + MPASS(lc->supported & FW_PORT_CAP_ANEG); + if (lc->requested_fc & PAUSE_TX) + MPASS(lc->supported & FW_PORT_CAP_FC_TX); + if (lc->requested_fc & PAUSE_RX) + MPASS(lc->supported & FW_PORT_CAP_FC_RX); + if (lc->requested_fec == FEC_RS) + MPASS(lc->supported & FW_PORT_CAP_FEC_RS); + if (lc->requested_fec == FEC_BASER_RS) + MPASS(lc->supported & FW_PORT_CAP_FEC_BASER_RS); + fwspeed = speed_to_fwspeed(lc->requested_speed); + MPASS(fwspeed != 0); + MPASS(lc->supported & fwspeed); +#endif rc = -t4_link_l1cfg(sc, sc->mbox, pi->tx_chan, lc); if (rc != 0) { device_printf(pi->dev, "l1cfg failed: %d\n", rc); @@ -4231,6 +4313,7 @@ init_l1cfg(struct port_info *pi) lc->fc = lc->requested_fc; lc->fec = lc->requested_fec; } + return (rc); } #define FW_MAC_EXACT_CHUNK 7 @@ -4515,7 +4598,7 @@ cxgbe_init_synchronized(struct vi_info *vi) if (pi->up_vis++ == 0) { t4_update_port_info(pi); build_medialist(pi, &pi->media); - init_l1cfg(pi); + apply_l1cfg(pi); } ifp->if_drv_flags |= IFF_DRV_RUNNING; @@ -4590,13 +4673,13 @@ cxgbe_uninit_synchronized(struct vi_info *vi) PORT_UNLOCK(pi); return (0); } - PORT_UNLOCK(pi); pi->link_cfg.link_ok = 0; pi->link_cfg.speed = 0; pi->link_cfg.link_down_rc = 255; t4_os_link_changed(pi); pi->old_link_cfg = pi->link_cfg; + PORT_UNLOCK(pi); return (0); } @@ -6346,14 +6429,17 @@ sysctl_pause_settings(SYSCTL_HANDLER_ARGS) "t4PAUSE"); if (rc) return (rc); + PORT_LOCK(pi); if ((lc->requested_fc & (PAUSE_TX | PAUSE_RX)) != n) { lc->requested_fc &= ~(PAUSE_TX | PAUSE_RX); lc->requested_fc |= n; rc = -t4_link_l1cfg(sc, sc->mbox, pi->tx_chan, lc); if (rc == 0) { lc->fc = lc->requested_fc; + set_current_media(pi, &pi->media); } } + PORT_UNLOCK(pi); end_synchronized_op(sc, 0); } @@ -6401,11 +6487,14 @@ sysctl_fec(SYSCTL_HANDLER_ARGS) n = s[0] - '0'; if (n & ~M_FW_PORT_CAP_FEC) return (EINVAL); /* some other bit is set too */ + if (!powerof2(n)) + return (EINVAL); /* one bit can be set at most */ rc = begin_synchronized_op(sc, &pi->vi[0], SLEEP_OK | INTR_OK, "t4fec"); if (rc) return (rc); + PORT_LOCK(pi); if ((lc->requested_fec & M_FW_PORT_CAP_FEC) != n) { lc->requested_fec = n & G_FW_PORT_CAP_FEC(lc->supported); @@ -6414,6 +6503,7 @@ sysctl_fec(SYSCTL_HANDLER_ARGS) lc->fec = lc->requested_fec; } } + PORT_UNLOCK(pi); end_synchronized_op(sc, 0); } @@ -6435,27 +6525,35 @@ sysctl_autoneg(SYSCTL_HANDLER_ARGS) rc = sysctl_handle_int(oidp, &val, 0, req); if (rc != 0 || req->newptr == NULL) return (rc); - if ((lc->supported & FW_PORT_CAP_ANEG) == 0) - return (ENOTSUP); - if (val == 0) val = AUTONEG_DISABLE; else if (val == 1) val = AUTONEG_ENABLE; else return (EINVAL); - if (lc->requested_aneg == val) - return (0); /* no change */ rc = begin_synchronized_op(sc, &pi->vi[0], SLEEP_OK | INTR_OK, "t4aneg"); if (rc) return (rc); + PORT_LOCK(pi); + if ((lc->supported & FW_PORT_CAP_ANEG) == 0) { + rc = ENOTSUP; + goto done; + } + if (lc->requested_aneg == val) { + rc = 0; /* no change, do nothing. */ + goto done; + } old = lc->requested_aneg; lc->requested_aneg = val; rc = -t4_link_l1cfg(sc, sc->mbox, pi->tx_chan, lc); if (rc != 0) lc->requested_aneg = old; + else + set_current_media(pi, &pi->media); +done: + PORT_UNLOCK(pi); end_synchronized_op(sc, 0); return (rc); } @@ -9192,12 +9290,14 @@ t4_os_portmod_changed(struct port_info *pi) NULL, "LR", "SR", "ER", "TWINAX", "active TWINAX", "LRM" }; - PORT_LOCK(pi); - build_medialist(pi, &pi->media); - PORT_UNLOCK(pi); + MPASS((pi->flags & FIXED_IFMEDIA) == 0); + vi = &pi->vi[0]; if (begin_synchronized_op(sc, vi, HOLD_LOCK, "t4mod") == 0) { - init_l1cfg(pi); + PORT_LOCK(pi); + build_medialist(pi, &pi->media); + apply_l1cfg(pi); + PORT_UNLOCK(pi); end_synchronized_op(sc, LOCK_HELD); } @@ -9224,6 +9324,8 @@ t4_os_link_changed(struct port_info *pi) struct ifnet *ifp; struct link_config *lc; int v; + + PORT_LOCK_ASSERT_OWNED(pi); for_each_vi(pi, v, vi) { ifp = vi->ifp; From owner-svn-src-head@freebsd.org Wed May 30 22:39:42 2018 Return-Path: Delivered-To: svn-src-head@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 9E61EF769F8; Wed, 30 May 2018 22:39:42 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5223F7F58C; Wed, 30 May 2018 22:39:42 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3349311684; Wed, 30 May 2018 22:39:42 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4UMdg3a040477; Wed, 30 May 2018 22:39:42 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4UMdgVV040476; Wed, 30 May 2018 22:39:42 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201805302239.w4UMdgVV040476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 30 May 2018 22:39:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334407 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 334407 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 22:39:42 -0000 Author: jhibbits Date: Wed May 30 22:39:41 2018 New Revision: 334407 URL: https://svnweb.freebsd.org/changeset/base/334407 Log: Only conform to PCIe spec of 1 device per bus on !x86 bhyve's root PCI complex shows up as PCIe, but behaves as traditional PCI. Until that is special cased in a root complex driver, leave x86 as it was. Requested by: grehan Modified: head/sys/dev/pci/pci_pci.c Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Wed May 30 22:36:09 2018 (r334406) +++ head/sys/dev/pci/pci_pci.c Wed May 30 22:39:41 2018 (r334407) @@ -2545,6 +2545,7 @@ pcib_enable_ari(struct pcib_softc *sc, uint32_t pcie_p int pcib_maxslots(device_t dev) { +#if !defined(__amd64__) && !defined(__i386__) uint32_t pcie_pos; uint16_t val; @@ -2559,6 +2560,7 @@ pcib_maxslots(device_t dev) val == PCIEM_TYPE_DOWNSTREAM_PORT) return (0); } +#endif return (PCI_SLOTMAX); } From owner-svn-src-head@freebsd.org Wed May 30 22:46:12 2018 Return-Path: Delivered-To: svn-src-head@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 F1D99F77490 for ; Wed, 30 May 2018 22:46:11 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12]) by mx1.freebsd.org (Postfix) with ESMTP id 70D2F7FBDD for ; Wed, 30 May 2018 22:46:11 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from iredmail.onthenet.com.au (iredmail.onthenet.com.au [203.13.68.150]) by alto.onthenet.com.au (Postfix) with ESMTPS id 36123206B620 for ; Thu, 31 May 2018 08:46:04 +1000 (AEST) Received: from localhost (iredmail.onthenet.com.au [127.0.0.1]) by iredmail.onthenet.com.au (Postfix) with ESMTP id 2F6B8281F27 for ; Thu, 31 May 2018 08:46:04 +1000 (AEST) X-Amavis-Modified: Mail body modified (using disclaimer) - iredmail.onthenet.com.au Received: from iredmail.onthenet.com.au ([127.0.0.1]) by localhost (iredmail.onthenet.com.au [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id NPvARO1sZlhi for ; Thu, 31 May 2018 08:46:04 +1000 (AEST) Received: from Peters-MacBook-Pro-2.local (c122-106-248-59.belrs3.nsw.optusnet.com.au [122.106.248.59]) by iredmail.onthenet.com.au (Postfix) with ESMTPSA id E0A44280A85; Thu, 31 May 2018 08:46:02 +1000 (AEST) Subject: Re: svn commit: r334407 - head/sys/dev/pci To: Justin Hibbits , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805302239.w4UMdgVV040476@repo.freebsd.org> From: Peter Grehan Message-ID: <473ff927-7778-a4bb-8efd-fe1d28073174@freebsd.org> Date: Thu, 31 May 2018 08:46:01 +1000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <201805302239.w4UMdgVV040476@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=dNCIZtRb c=1 sm=1 tr=0 a=A6CF0fG5TOl4vs6YHvqXgw==:117 a=B4xUt+5V0tDuyGor23H9pw==:17 a=IkcTkHD0fZMA:10 a=VUJBJC2UJ8kA:10 a=CvaLslu8xlpAzzx8tIUA:9 a=QEXdDO2ut3YA:10 wl=host:3 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 22:46:12 -0000 > Log: > Only conform to PCIe spec of 1 device per bus on !x86 > > bhyve's root PCI complex shows up as PCIe, but behaves as traditional PCI. > Until that is special cased in a root complex driver, leave x86 as it was. Thanks Justin ! later, Peter. From owner-svn-src-head@freebsd.org Thu May 31 01:01:36 2018 Return-Path: Delivered-To: svn-src-head@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 E73BBFC8728; Thu, 31 May 2018 01:01:35 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 94DE084572; Thu, 31 May 2018 01:01:35 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76FCF12ED3; Thu, 31 May 2018 01:01:35 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4V11Z9x011909; Thu, 31 May 2018 01:01:35 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4V11ZlL011908; Thu, 31 May 2018 01:01:35 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805310101.w4V11ZlL011908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Thu, 31 May 2018 01:01:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334408 - head X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 334408 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 01:01:36 -0000 Author: mmacy Date: Thu May 31 01:01:35 2018 New Revision: 334408 URL: https://svnweb.freebsd.org/changeset/base/334408 Log: libpmc/jevents: fix cross-compile _to_ amd64 Reported by: emaste Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed May 30 22:39:41 2018 (r334407) +++ head/Makefile.inc1 Thu May 31 01:01:35 2018 (r334408) @@ -2030,7 +2030,7 @@ _tcsh=bin/csh _libmagic=lib/libmagic .endif -.if ${MACHINE_CPUARCH} == "amd64" +.if ${TARGET_ARCH} == "amd64" _jevents=lib/libpmc/pmu-events .endif From owner-svn-src-head@freebsd.org Thu May 31 02:10:50 2018 Return-Path: Delivered-To: svn-src-head@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 DD3BAEF4DA9; Thu, 31 May 2018 02:10:50 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 909E487EA0; Thu, 31 May 2018 02:10:50 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7336713AC6; Thu, 31 May 2018 02:10:50 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4V2AoRC051212; Thu, 31 May 2018 02:10:50 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4V2AoJZ051211; Thu, 31 May 2018 02:10:50 GMT (envelope-from np@FreeBSD.org) Message-Id: <201805310210.w4V2AoJZ051211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 31 May 2018 02:10:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334409 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 334409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 02:10:51 -0000 Author: np Date: Thu May 31 02:10:50 2018 New Revision: 334409 URL: https://svnweb.freebsd.org/changeset/base/334409 Log: cxgbe(4): Implement ifm_change callback. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu May 31 01:01:35 2018 (r334408) +++ head/sys/dev/cxgbe/t4_main.c Thu May 31 02:10:50 2018 (r334409) @@ -529,6 +529,7 @@ static int set_params__post_init(struct adapter *); static void t4_set_desc(struct adapter *); static void build_medialist(struct port_info *, struct ifmedia *); static void init_l1cfg(struct port_info *); +static int apply_l1cfg(struct port_info *); static int cxgbe_init_synchronized(struct vi_info *); static int cxgbe_uninit_synchronized(struct vi_info *); static void quiesce_txq(struct adapter *, struct sge_txq *); @@ -2077,14 +2078,42 @@ cxgbe_get_counter(struct ifnet *ifp, ift_counter c) } } +/* + * The kernel picks a media from the list we had provided so we do not have to + * validate the request. + */ static int cxgbe_media_change(struct ifnet *ifp) { struct vi_info *vi = ifp->if_softc; + struct port_info *pi = vi->pi; + struct ifmedia *ifm = &pi->media; + struct link_config *lc = &pi->link_cfg; + struct adapter *sc = pi->adapter; + int rc; - device_printf(vi->dev, "%s unimplemented.\n", __func__); - - return (EOPNOTSUPP); + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4mec"); + if (rc != 0) + return (rc); + PORT_LOCK(pi); + if (IFM_SUBTYPE(ifm->ifm_media) == IFM_AUTO) { + MPASS(lc->supported & FW_PORT_CAP_ANEG); + lc->requested_aneg = AUTONEG_ENABLE; + } else { + lc->requested_aneg = AUTONEG_DISABLE; + lc->requested_speed = + ifmedia_baudrate(ifm->ifm_media) / 1000000; + lc->requested_fc = 0; + if (IFM_OPTIONS(ifm->ifm_media) & IFM_ETH_RXPAUSE) + lc->requested_fc |= PAUSE_RX; + if (IFM_OPTIONS(ifm->ifm_media) & IFM_ETH_TXPAUSE) + lc->requested_fc |= PAUSE_TX; + } + if (pi->up_vis > 0) + rc = apply_l1cfg(pi); + PORT_UNLOCK(pi); + end_synchronized_op(sc, 0); + return (rc); } /* From owner-svn-src-head@freebsd.org Thu May 31 02:22:41 2018 Return-Path: Delivered-To: svn-src-head@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 ECCC0EF66F1; Thu, 31 May 2018 02:22:40 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 90CC168ACC; Thu, 31 May 2018 02:22:40 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7209113E01; Thu, 31 May 2018 02:22:40 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4V2MeOI057891; Thu, 31 May 2018 02:22:40 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4V2Mefr057890; Thu, 31 May 2018 02:22:40 GMT (envelope-from np@FreeBSD.org) Message-Id: <201805310222.w4V2Mefr057890@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 31 May 2018 02:22:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334410 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 334410 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 02:22:41 -0000 Author: np Date: Thu May 31 02:22:40 2018 New Revision: 334410 URL: https://svnweb.freebsd.org/changeset/base/334410 Log: cxgbe(4): Use ifm for ifmedia just like the rest of the kernel. No functional change. Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu May 31 02:10:50 2018 (r334409) +++ head/sys/dev/cxgbe/t4_main.c Thu May 31 02:22:40 2018 (r334410) @@ -4167,17 +4167,17 @@ t4_set_desc(struct adapter *sc) } static inline void -ifmedia_add4(struct ifmedia *media, int m) +ifmedia_add4(struct ifmedia *ifm, int m) { - ifmedia_add(media, m, 0, NULL); - ifmedia_add(media, m | IFM_ETH_TXPAUSE, 0, NULL); - ifmedia_add(media, m | IFM_ETH_RXPAUSE, 0, NULL); - ifmedia_add(media, m | IFM_ETH_TXPAUSE | IFM_ETH_RXPAUSE, 0, NULL); + ifmedia_add(ifm, m, 0, NULL); + ifmedia_add(ifm, m | IFM_ETH_TXPAUSE, 0, NULL); + ifmedia_add(ifm, m | IFM_ETH_RXPAUSE, 0, NULL); + ifmedia_add(ifm, m | IFM_ETH_TXPAUSE | IFM_ETH_RXPAUSE, 0, NULL); } static void -set_current_media(struct port_info *pi, struct ifmedia *media) +set_current_media(struct port_info *pi, struct ifmedia *ifm) { struct link_config *lc; int mword; @@ -4185,15 +4185,15 @@ set_current_media(struct port_info *pi, struct ifmedia PORT_LOCK_ASSERT_OWNED(pi); /* Leave current media alone if it's already set to IFM_NONE. */ - if (media->ifm_cur != NULL && - IFM_SUBTYPE(media->ifm_cur->ifm_media) == IFM_NONE) + if (ifm->ifm_cur != NULL && + IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_NONE) return; mword = IFM_ETHER; lc = &pi->link_cfg; if (lc->requested_aneg == AUTONEG_ENABLE && lc->supported & FW_PORT_CAP_ANEG) { - ifmedia_set(media, mword | IFM_AUTO); + ifmedia_set(ifm, mword | IFM_AUTO); return; } if (lc->requested_fc & PAUSE_TX) @@ -4201,11 +4201,11 @@ set_current_media(struct port_info *pi, struct ifmedia if (lc->requested_fc & PAUSE_RX) mword |= IFM_ETH_RXPAUSE; mword |= port_mword(pi, speed_to_fwspeed(lc->requested_speed)); - ifmedia_set(media, mword); + ifmedia_set(ifm, mword); } static void -build_medialist(struct port_info *pi, struct ifmedia *media) +build_medialist(struct port_info *pi, struct ifmedia *ifm) { uint16_t ss, speed; int unknown, mword, bit; @@ -4226,15 +4226,15 @@ build_medialist(struct port_info *pi, struct ifmedia * /* * Now (re)build the ifmedia list. */ - ifmedia_removeall(media); + ifmedia_removeall(ifm); lc = &pi->link_cfg; ss = G_FW_PORT_CAP_SPEED(lc->supported); /* Supported Speeds */ if (__predict_false(ss == 0)) { /* not supposed to happen. */ MPASS(ss != 0); no_media: - MPASS(LIST_EMPTY(&media->ifm_list)); - ifmedia_add(media, IFM_ETHER | IFM_NONE, 0, NULL); - ifmedia_set(media, IFM_ETHER | IFM_NONE); + MPASS(LIST_EMPTY(&ifm->ifm_list)); + ifmedia_add(ifm, IFM_ETHER | IFM_NONE, 0, NULL); + ifmedia_set(ifm, IFM_ETHER | IFM_NONE); return; } @@ -4249,15 +4249,15 @@ no_media: } else if (mword == IFM_UNKNOWN) unknown++; else - ifmedia_add4(media, IFM_ETHER | mword); + ifmedia_add4(ifm, IFM_ETHER | mword); } } if (unknown > 0) /* Add one unknown for all unknown media types. */ - ifmedia_add4(media, IFM_ETHER | IFM_UNKNOWN); + ifmedia_add4(ifm, IFM_ETHER | IFM_UNKNOWN); if (lc->supported & FW_PORT_CAP_ANEG) - ifmedia_add(media, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_add(ifm, IFM_ETHER | IFM_AUTO, 0, NULL); - set_current_media(pi, media); + set_current_media(pi, ifm); } /* From owner-svn-src-head@freebsd.org Thu May 31 02:54:13 2018 Return-Path: Delivered-To: svn-src-head@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 C5F6EEFA87D; Thu, 31 May 2018 02:54:12 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 79DD76A5ED; Thu, 31 May 2018 02:54:12 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C5BA14368; Thu, 31 May 2018 02:54:12 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4V2sCag073084; Thu, 31 May 2018 02:54:12 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4V2sCWW073082; Thu, 31 May 2018 02:54:12 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201805310254.w4V2sCWW073082@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 31 May 2018 02:54:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334412 - head/stand/userboot/userboot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/userboot/userboot X-SVN-Commit-Revision: 334412 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 02:54:13 -0000 Author: imp Date: Thu May 31 02:54:11 2018 New Revision: 334412 URL: https://svnweb.freebsd.org/changeset/base/334412 Log: Pass a struct devdesc to the format commands. Use proper type rather than doing weird type-punning that happened to work because the size was right. We copied a zfs devdesc into a disk_devdesc and then after passing through a NULL pointer reinterpreted it as a zfs_devdesc. Instead, pass the base devdesc around and 'upcase' when we know the types are right. This has the happy side effect of fixing a gcc warning about bad type punning. Differential Revision: https://reviews.freebsd.org/D15629 Modified: head/stand/userboot/userboot/devicename.c head/stand/userboot/userboot/main.c Modified: head/stand/userboot/userboot/devicename.c ============================================================================== --- head/stand/userboot/userboot/devicename.c Thu May 31 02:25:46 2018 (r334411) +++ head/stand/userboot/userboot/devicename.c Thu May 31 02:54:11 2018 (r334412) @@ -175,30 +175,30 @@ userboot_parsedev(struct disk_devdesc **dev, const cha char * userboot_fmtdev(void *vdev) { - struct disk_devdesc *dev = (struct disk_devdesc *)vdev; + struct devdesc *dev = (struct devdesc *)vdev; static char buf[128]; /* XXX device length constant? */ - switch(dev->dd.d_dev->dv_type) { + switch(dev->d_dev->dv_type) { case DEVT_NONE: strcpy(buf, "(no device)"); break; case DEVT_CD: - sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit); + sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); break; case DEVT_DISK: return (disk_fmtdev(vdev)); case DEVT_NET: - sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit); + sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); break; case DEVT_ZFS: #if defined(USERBOOT_ZFS_SUPPORT) return (zfs_fmtdev(vdev)); #else - sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit); + sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); #endif break; } Modified: head/stand/userboot/userboot/main.c ============================================================================== --- head/stand/userboot/userboot/main.c Thu May 31 02:25:46 2018 (r334411) +++ head/stand/userboot/userboot/main.c Thu May 31 02:54:11 2018 (r334412) @@ -155,20 +155,19 @@ static void extract_currdev(void) { struct disk_devdesc dev; - - //bzero(&dev, sizeof(dev)); - + struct devdesc *dd; #if defined(USERBOOT_ZFS_SUPPORT) + struct zfs_devdesc zdev; + CTASSERT(sizeof(struct disk_devdesc) >= sizeof(struct zfs_devdesc)); if (userboot_zfs_found) { - struct zfs_devdesc zdev; /* Leave the pool/root guid's unassigned */ bzero(&zdev, sizeof(zdev)); zdev.dd.d_dev = &zfs_dev; - dev = *(struct disk_devdesc *)&zdev; - init_zfs_bootenv(zfs_fmtdev(&dev)); + init_zfs_bootenv(zfs_fmtdev(&zdev)); + dd = &zdev.dd; } else #endif @@ -185,14 +184,16 @@ extract_currdev(void) dev.d_slice = -1; dev.d_partition = -1; } + dd = &dev.dd; } else { dev.dd.d_dev = &host_dev; dev.dd.d_unit = 0; + dd = &dev.dd; } - env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(&dev), + env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(dd), userboot_setcurrdev, env_nounset); - env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(&dev), + env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(dd), env_noset, env_nounset); } From owner-svn-src-head@freebsd.org Thu May 31 02:57:59 2018 Return-Path: Delivered-To: svn-src-head@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 A2C91EFAE09; Thu, 31 May 2018 02:57:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 552FE6A9C9; Thu, 31 May 2018 02:57:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36C3614395; Thu, 31 May 2018 02:57:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4V2vxoN073337; Thu, 31 May 2018 02:57:59 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4V2vwFN073334; Thu, 31 May 2018 02:57:58 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201805310257.w4V2vwFN073334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 31 May 2018 02:57:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334414 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 334414 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 02:58:00 -0000 Author: imp Date: Thu May 31 02:57:58 2018 New Revision: 334414 URL: https://svnweb.freebsd.org/changeset/base/334414 Log: Make the data returned by devinfo harder to overflow. Rather than using fixed-length strings, pack them into a string table to return. Also expand the buffer from ~300 charaters to 3k. This should be enough, even for USB. This fixes a problem where USB pnp info is truncated on return to userland. Differential Revision: https://reviews.freebsd.org/D15629 Modified: head/sys/kern/subr_bus.c head/sys/sys/bus.h Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Thu May 31 02:57:51 2018 (r334413) +++ head/sys/kern/subr_bus.c Thu May 31 02:57:58 2018 (r334414) @@ -5264,8 +5264,9 @@ sysctl_devices(SYSCTL_HANDLER_ARGS) u_int namelen = arg2; int index; device_t dev; - struct u_device udev; /* XXX this is a bit big */ + struct u_device *udev; int error; + char *walker, *ep; if (namelen != 2) return (EINVAL); @@ -5286,24 +5287,45 @@ sysctl_devices(SYSCTL_HANDLER_ARGS) return (ENOENT); /* - * Populate the return array. + * Populate the return item, careful not to overflow the buffer. */ - bzero(&udev, sizeof(udev)); - udev.dv_handle = (uintptr_t)dev; - udev.dv_parent = (uintptr_t)dev->parent; - if (dev->nameunit != NULL) - strlcpy(udev.dv_name, dev->nameunit, sizeof(udev.dv_name)); - if (dev->desc != NULL) - strlcpy(udev.dv_desc, dev->desc, sizeof(udev.dv_desc)); - if (dev->driver != NULL && dev->driver->name != NULL) - strlcpy(udev.dv_drivername, dev->driver->name, - sizeof(udev.dv_drivername)); - bus_child_pnpinfo_str(dev, udev.dv_pnpinfo, sizeof(udev.dv_pnpinfo)); - bus_child_location_str(dev, udev.dv_location, sizeof(udev.dv_location)); - udev.dv_devflags = dev->devflags; - udev.dv_flags = dev->flags; - udev.dv_state = dev->state; - error = SYSCTL_OUT(req, &udev, sizeof(udev)); + udev = malloc(sizeof(*udev), M_BUS, M_WAITOK | M_ZERO); + if (udev == NULL) + return (ENOMEM); + udev->dv_handle = (uintptr_t)dev; + udev->dv_parent = (uintptr_t)dev->parent; + udev->dv_devflags = dev->devflags; + udev->dv_flags = dev->flags; + udev->dv_state = dev->state; + walker = udev->dv_fields; + ep = walker + sizeof(udev->dv_fields); +#define CP(src) \ + if ((src) == NULL) \ + *walker++ = '\0'; \ + else { \ + strlcpy(walker, (src), ep - walker); \ + walker += strlen(walker) + 1; \ + } \ + if (walker >= ep) \ + break; + + do { + CP(dev->nameunit); + CP(dev->desc); + CP(dev->driver != NULL ? dev->driver->name : NULL); + bus_child_pnpinfo_str(dev, walker, ep - walker); + walker += strlen(walker) + 1; + if (walker >= ep) + break; + bus_child_location_str(dev, walker, ep - walker); + walker += strlen(walker) + 1; + if (walker >= ep) + break; + *walker++ = '\0'; + } while (0); +#undef CP + error = SYSCTL_OUT(req, udev, sizeof(*udev)); + free(udev, M_BUS); return (error); } Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Thu May 31 02:57:51 2018 (r334413) +++ head/sys/sys/bus.h Thu May 31 02:57:58 2018 (r334414) @@ -46,7 +46,7 @@ */ struct u_businfo { int ub_version; /**< @brief interface version */ -#define BUS_USER_VERSION 1 +#define BUS_USER_VERSION 2 int ub_generation; /**< @brief generation count */ }; @@ -63,20 +63,23 @@ typedef enum device_state { /** * @brief Device information exported to userspace. + * The strings are placed one after the other, separated by NUL characters. + * Fields should be added after the last one and order maintained for compatibility */ +#define BUS_USER_BUFFER (3*1024) struct u_device { uintptr_t dv_handle; uintptr_t dv_parent; - - char dv_name[32]; /**< @brief Name of device in tree. */ - char dv_desc[32]; /**< @brief Driver description */ - char dv_drivername[32]; /**< @brief Driver name */ - char dv_pnpinfo[128]; /**< @brief Plug and play info */ - char dv_location[128]; /**< @brief Where is the device? */ uint32_t dv_devflags; /**< @brief API Flags for device */ uint16_t dv_flags; /**< @brief flags for dev state */ device_state_t dv_state; /**< @brief State of attachment */ - /* XXX more driver info? */ + char dv_fields[BUS_USER_BUFFER]; /**< @brief NUL terminated fields */ + /* name (name of the device in tree) */ + /* desc (driver description) */ + /* drivername (Name of driver without unit number) */ + /* pnpinfo (Plug and play information from bus) */ + /* location (Location of device on parent */ + /* NUL */ }; /* Flags exported via dv_flags. */ From owner-svn-src-head@freebsd.org Thu May 31 02:57:52 2018 Return-Path: Delivered-To: svn-src-head@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 E41ACEFADDD; Thu, 31 May 2018 02:57:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 967036A8EA; Thu, 31 May 2018 02:57:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 78D3114393; Thu, 31 May 2018 02:57:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4V2vpPd073280; Thu, 31 May 2018 02:57:51 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4V2vpl1073279; Thu, 31 May 2018 02:57:51 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201805310257.w4V2vpl1073279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 31 May 2018 02:57:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334413 - head/lib/libdevinfo X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/lib/libdevinfo X-SVN-Commit-Revision: 334413 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 02:57:52 -0000 Author: imp Date: Thu May 31 02:57:51 2018 New Revision: 334413 URL: https://svnweb.freebsd.org/changeset/base/334413 Log: Sanity check the return from the kernel. We should be getting back as many bytes as we asked for, and we don't handle shortages at all, so just reject anything that's not right. Differential Revision: https://reviews.freebsd.org/D15629 Modified: head/lib/libdevinfo/devinfo.c Modified: head/lib/libdevinfo/devinfo.c ============================================================================== --- head/lib/libdevinfo/devinfo.c Thu May 31 02:54:11 2018 (r334412) +++ head/lib/libdevinfo/devinfo.c Thu May 31 02:57:51 2018 (r334413) @@ -220,6 +220,11 @@ devinfo_init_devices(int generation) warn("sysctl hw.bus.devices.%d", dev_idx); return(errno); } + if (rlen != sizeof(udev)) { + warnx("sysctl returned wrong data %zd bytes instead of %zd", + rlen, sizeof(udev)); + return (EINVAL); + } if ((dd = malloc(sizeof(*dd))) == NULL) return(ENOMEM); dd->dd_dev.dd_handle = udev.dv_handle; From owner-svn-src-head@freebsd.org Thu May 31 02:58:06 2018 Return-Path: Delivered-To: svn-src-head@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 A3D5EEFAE3C; Thu, 31 May 2018 02:58:06 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DAD946AA45; Thu, 31 May 2018 02:58:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57FEA14396; Thu, 31 May 2018 02:58:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4V2w4Y2073394; Thu, 31 May 2018 02:58:04 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4V2w3Mk073392; Thu, 31 May 2018 02:58:03 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201805310258.w4V2w3Mk073392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 31 May 2018 02:58:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334415 - head/lib/libdevinfo X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/lib/libdevinfo X-SVN-Commit-Revision: 334415 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 02:58:07 -0000 Author: imp Date: Thu May 31 02:58:03 2018 New Revision: 334415 URL: https://svnweb.freebsd.org/changeset/base/334415 Log: Update to device enumeration protocol 2 The new protocol from the kernel encodes things as a string table, extract it into fields. strdup the strings, and free them when we're done. Differential Revision: https://reviews.freebsd.org/D15629 Modified: head/lib/libdevinfo/devinfo.c head/lib/libdevinfo/devinfo_var.h Modified: head/lib/libdevinfo/devinfo.c ============================================================================== --- head/lib/libdevinfo/devinfo.c Thu May 31 02:57:58 2018 (r334414) +++ head/lib/libdevinfo/devinfo.c Thu May 31 02:58:03 2018 (r334415) @@ -175,7 +175,7 @@ devinfo_init_devices(int generation) int name2oid[2]; int oid[CTL_MAXNAME + 12]; size_t oidlen, rlen; - char *name; + char *name, *walker, *ep; int error; /* @@ -229,22 +229,31 @@ devinfo_init_devices(int generation) return(ENOMEM); dd->dd_dev.dd_handle = udev.dv_handle; dd->dd_dev.dd_parent = udev.dv_parent; - snprintf(dd->dd_name, sizeof(dd->dd_name), "%s", udev.dv_name); - dd->dd_dev.dd_name = &dd->dd_name[0]; - snprintf(dd->dd_desc, sizeof(dd->dd_desc), "%s", udev.dv_desc); - dd->dd_dev.dd_desc = &dd->dd_desc[0]; - snprintf(dd->dd_drivername, sizeof(dd->dd_drivername), "%s", - udev.dv_drivername); - dd->dd_dev.dd_drivername = &dd->dd_drivername[0]; - snprintf(dd->dd_pnpinfo, sizeof(dd->dd_pnpinfo), "%s", - udev.dv_pnpinfo); - dd->dd_dev.dd_pnpinfo = &dd->dd_pnpinfo[0]; - snprintf(dd->dd_location, sizeof(dd->dd_location), "%s", - udev.dv_location); - dd->dd_dev.dd_location = &dd->dd_location[0]; dd->dd_dev.dd_devflags = udev.dv_devflags; dd->dd_dev.dd_flags = udev.dv_flags; dd->dd_dev.dd_state = udev.dv_state; + + walker = udev.dv_fields; + ep = walker + sizeof(udev.dv_fields); + dd->dd_name = NULL; + dd->dd_desc = NULL; + dd->dd_drivername = NULL; + dd->dd_pnpinfo = NULL; + dd->dd_location = NULL; +#define UNPACK(x) \ + dd->dd_dev.x = dd->x = strdup(walker); \ + if (dd->x == NULL) \ + return(ENOMEM); \ + if (walker + strnlen(walker, ep - walker) >= ep) \ + return(EINVAL); \ + walker += strlen(walker) + 1; + + UNPACK(dd_name); + UNPACK(dd_desc); + UNPACK(dd_drivername); + UNPACK(dd_pnpinfo); + UNPACK(dd_location); +#undef UNPACK TAILQ_INSERT_TAIL(&devinfo_dev, dd, dd_link); } debug("fetched %d devices", dev_idx); @@ -367,6 +376,11 @@ devinfo_free(void) while ((dd = TAILQ_FIRST(&devinfo_dev)) != NULL) { TAILQ_REMOVE(&devinfo_dev, dd, dd_link); + free(dd->dd_name); + free(dd->dd_desc); + free(dd->dd_drivername); + free(dd->dd_pnpinfo); + free(dd->dd_location); free(dd); } while ((dm = TAILQ_FIRST(&devinfo_rman)) != NULL) { Modified: head/lib/libdevinfo/devinfo_var.h ============================================================================== --- head/lib/libdevinfo/devinfo_var.h Thu May 31 02:57:58 2018 (r334414) +++ head/lib/libdevinfo/devinfo_var.h Thu May 31 02:58:03 2018 (r334415) @@ -45,11 +45,11 @@ */ struct devinfo_i_dev { struct devinfo_dev dd_dev; - char dd_name[DEVINFO_STRLEN]; - char dd_desc[DEVINFO_STRLEN]; - char dd_drivername[DEVINFO_STRLEN]; - char dd_pnpinfo[DEVINFO_STRLEN * 4]; - char dd_location[DEVINFO_STRLEN * 4]; + char *dd_name; + char *dd_desc; + char *dd_drivername; + char *dd_pnpinfo; + char *dd_location; uint32_t dd_devflags; uint16_t dd_flags; device_state_t dd_state; From owner-svn-src-head@freebsd.org Thu May 31 02:58:09 2018 Return-Path: Delivered-To: svn-src-head@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 7BE53EFAE55; Thu, 31 May 2018 02:58:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F3DA6AADF; Thu, 31 May 2018 02:58:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E58914397; Thu, 31 May 2018 02:58:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4V2w8mF073448; Thu, 31 May 2018 02:58:08 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4V2w8ic073447; Thu, 31 May 2018 02:58:08 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201805310258.w4V2w8ic073447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 31 May 2018 02:58:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334416 - head X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 334416 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 02:58:09 -0000 Author: imp Date: Thu May 31 02:58:08 2018 New Revision: 334416 URL: https://svnweb.freebsd.org/changeset/base/334416 Log: Note the need for a new kernel / userland for devinfo to work Differential Revision: https://reviews.freebsd.org/D15628 Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Thu May 31 02:58:03 2018 (r334415) +++ head/UPDATING Thu May 31 02:58:08 2018 (r334416) @@ -32,6 +32,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20180530: + The kernel / userland interface for devinfo changed, so you'll + need a new kernel and userland as a pair for it to work (rebuilding + lib/libdevinfo is all that's required). devinfo and devmatch will + not work, but everything else will when there's a mismatch. + 20180523: The on-disk format for hwpmc callchain records has changed to include threadid corresponding to a given record. This changes the field offsets From owner-svn-src-head@freebsd.org Thu May 31 02:59:01 2018 Return-Path: Delivered-To: svn-src-head@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 B7A1FEFAFCF for ; Thu, 31 May 2018 02:59:00 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22a.google.com (mail-it0-x22a.google.com [IPv6:2607:f8b0:4001:c0b::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4486A6ADB9 for ; Thu, 31 May 2018 02:59:00 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22a.google.com with SMTP id p3-v6so25825900itc.0 for ; Wed, 30 May 2018 19:59:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=NrL8LCtiBrQKvqYTIlS32/2aKKbAX3/U0jIp/Ma18pw=; b=pgv0u1ZVbE5gKoR046py/vOlvB9T6cYmLRWATgb1pBCheHXK9wVY0QMtPbaqaCpIrE dtCjJBGZMkEuq0uik3XEyA4Pa1uabLLdkIyYCgnuFGqAQsdcERrxv5Zd2eGBNDc6IB29 jLazQFNkySladcT9VDLZyL8onDkt35heB0j1RVldS9GB/+UmCexfYS76STkp+itmECp3 jVYbTd+fLMoy98UMZZf6Hd7nAXfwjKOzhcmFlzY5u39GiAyaaDns4TuCFY8MNBxIkTqL qOoUCCE64svZh1vTn3x+cUKyvPXSC59v2MS/AIjEBM86Ekkupc13di0uvnfnXxtOonC8 Q+KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=NrL8LCtiBrQKvqYTIlS32/2aKKbAX3/U0jIp/Ma18pw=; b=eea7la4aR3rs2AMR8CoeuvwxJ0xcBNBJ5xVfgMMYLPmHgPKhaP8IFb+GGDYOoW7dF9 iPlCTst18/564M3pY2hHU1gYeSOGdRGl8bqkxZKhfdWBwcouIsglrgrV4FY2SQKS0Se3 U3Wh5rQWpUmQuo8PW/T0wkwF2KmFijECE1ASklFgMxwvKduGnuxz8zqJEiDB4Joj1kTn vBfAEBnMWy3pJ6lhPm3g3uRBqypJ935zcpfOHok6QJH1Hu+RaBGaDp2GweyS9fECaAJN MpVFURKtnTfW4ex28wH/2cu6qsBnHG1SOGAf5PkwDQjsvruorzoNeiQAkEUk99AMKK3G dvTw== X-Gm-Message-State: ALKqPwcvA1qzj94LdUFxiYcEKqm4o+Pd+a8K1x8run4Iypcsy1k3h00q JALQdDH8S4Lhe9A2HR/uzhBtUa608uREy0mqRCcPIg== X-Google-Smtp-Source: ADUXVKJ3J2l3djqU8VbG3lWx9xK4bBmlzrhKEVzLQ54XgwyKeonfAZi7ywDwrgnb4GbrvPR69scIZfdXP1h42Igj1HU= X-Received: by 2002:a24:efc2:: with SMTP id i185-v6mr3956561ith.57.1527735539261; Wed, 30 May 2018 19:58:59 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 2002:a4f:d028:0:0:0:0:0 with HTTP; Wed, 30 May 2018 19:58:58 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <201805310254.w4V2sCWW073082@repo.freebsd.org> References: <201805310254.w4V2sCWW073082@repo.freebsd.org> From: Warner Losh Date: Wed, 30 May 2018 20:58:58 -0600 X-Google-Sender-Auth: JHA-6_JGpcDBr4mkBKTAUCNAc8E Message-ID: Subject: Re: svn commit: r334412 - head/stand/userboot/userboot To: Warner Losh Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 02:59:01 -0000 On Wed, May 30, 2018 at 8:54 PM, Warner Losh wrote: > Author: imp > Date: Thu May 31 02:54:11 2018 > New Revision: 334412 > URL: https://svnweb.freebsd.org/changeset/base/334412 > > Log: > Pass a struct devdesc to the format commands. Use proper type rather > than doing weird type-punning that happened to work because the size > was right. We copied a zfs devdesc into a disk_devdesc and then after > passing through a NULL pointer reinterpreted it as a > zfs_devdesc. Instead, pass the base devdesc around and 'upcase' when > we know the types are right. > > This has the happy side effect of fixing a gcc warning about bad > type punning. > > Differential Revision: https://reviews.freebsd.org/D15629 This should have been https://reviews.freebsd.org/D15628. Closed manually. Warner > > Modified: > head/stand/userboot/userboot/devicename.c > head/stand/userboot/userboot/main.c > > Modified: head/stand/userboot/userboot/devicename.c > ============================================================ > ================== > --- head/stand/userboot/userboot/devicename.c Thu May 31 02:25:46 2018 > (r334411) > +++ head/stand/userboot/userboot/devicename.c Thu May 31 02:54:11 2018 > (r334412) > @@ -175,30 +175,30 @@ userboot_parsedev(struct disk_devdesc **dev, const > cha > char * > userboot_fmtdev(void *vdev) > { > - struct disk_devdesc *dev = (struct disk_devdesc *)vdev; > + struct devdesc *dev = (struct devdesc *)vdev; > static char buf[128]; /* XXX device length > constant? */ > > - switch(dev->dd.d_dev->dv_type) { > + switch(dev->d_dev->dv_type) { > case DEVT_NONE: > strcpy(buf, "(no device)"); > break; > > case DEVT_CD: > - sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit); > + sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); > break; > > case DEVT_DISK: > return (disk_fmtdev(vdev)); > > case DEVT_NET: > - sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit); > + sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); > break; > > case DEVT_ZFS: > #if defined(USERBOOT_ZFS_SUPPORT) > return (zfs_fmtdev(vdev)); > #else > - sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit); > + sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); > #endif > break; > } > > Modified: head/stand/userboot/userboot/main.c > ============================================================ > ================== > --- head/stand/userboot/userboot/main.c Thu May 31 02:25:46 2018 > (r334411) > +++ head/stand/userboot/userboot/main.c Thu May 31 02:54:11 2018 > (r334412) > @@ -155,20 +155,19 @@ static void > extract_currdev(void) > { > struct disk_devdesc dev; > - > - //bzero(&dev, sizeof(dev)); > - > + struct devdesc *dd; > #if defined(USERBOOT_ZFS_SUPPORT) > + struct zfs_devdesc zdev; > + > CTASSERT(sizeof(struct disk_devdesc) >= sizeof(struct > zfs_devdesc)); > if (userboot_zfs_found) { > - struct zfs_devdesc zdev; > > /* Leave the pool/root guid's unassigned */ > bzero(&zdev, sizeof(zdev)); > zdev.dd.d_dev = &zfs_dev; > > - dev = *(struct disk_devdesc *)&zdev; > - init_zfs_bootenv(zfs_fmtdev(&dev)); > + init_zfs_bootenv(zfs_fmtdev(&zdev)); > + dd = &zdev.dd; > } else > #endif > > @@ -185,14 +184,16 @@ extract_currdev(void) > dev.d_slice = -1; > dev.d_partition = -1; > } > + dd = &dev.dd; > } else { > dev.dd.d_dev = &host_dev; > dev.dd.d_unit = 0; > + dd = &dev.dd; > } > > - env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(&dev), > + env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(dd), > userboot_setcurrdev, env_nounset); > - env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(&dev), > + env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(dd), > env_noset, env_nounset); > } > > > From owner-svn-src-head@freebsd.org Thu May 31 04:11:41 2018 Return-Path: Delivered-To: svn-src-head@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 F3DBBF71CD4; Thu, 31 May 2018 04:11:40 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A92A36E676; Thu, 31 May 2018 04:11:40 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88D3915254; Thu, 31 May 2018 04:11:40 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4V4BeGd012337; Thu, 31 May 2018 04:11:40 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4V4Belv012336; Thu, 31 May 2018 04:11:40 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201805310411.w4V4Belv012336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 31 May 2018 04:11:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334417 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 334417 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 04:11:41 -0000 Author: jhibbits Date: Thu May 31 04:11:40 2018 New Revision: 334417 URL: https://svnweb.freebsd.org/changeset/base/334417 Log: Remove a debug printf from opal_pci driver Modified: head/sys/powerpc/powernv/opal_pci.c Modified: head/sys/powerpc/powernv/opal_pci.c ============================================================================== --- head/sys/powerpc/powernv/opal_pci.c Thu May 31 02:58:08 2018 (r334416) +++ head/sys/powerpc/powernv/opal_pci.c Thu May 31 04:11:40 2018 (r334417) @@ -364,7 +364,6 @@ opalpci_attach(device_t dev) maxmem = roundup2(powerpc_ptob(Maxmem), tce_size); entries = round_pow2(maxmem / tce_size); tce_tbl_size = max(entries * sizeof(uint64_t), 4096); - device_printf(dev, "Entries: %ld, tce_size: %#lx\n", entries, tce_size); if (entries > OPAL_PCI_TCE_MAX_ENTRIES) panic("POWERNV supports only %jdGB of memory space\n", (uintmax_t)((OPAL_PCI_TCE_MAX_ENTRIES * tce_size) >> 30)); From owner-svn-src-head@freebsd.org Thu May 31 07:32:27 2018 Return-Path: Delivered-To: svn-src-head@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 73F40FC96C2; Thu, 31 May 2018 07:32:27 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 13248750D6; Thu, 31 May 2018 07:32:27 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 98892260338; Thu, 31 May 2018 09:32:24 +0200 (CEST) Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805280812.w4S8CI56046943@repo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Thu, 31 May 2018 09:32:11 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 07:32:27 -0000 On 05/30/18 20:32, Antoine Brodin wrote: > Hi, > > It seems that this local change was lost during the upgrade: > https://svnweb.freebsd.org/base/head/contrib/libpcap/pcap/pcap.h?r1=190640&r2=190639&pathrev=190640 > Hi, This change has been removed upstream. > I think this broke at least the following ports: > > http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/packetdrill-0.0.2018012501.log > http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/spamd-4.9.1_4.log > http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/vde2-2.3.2_2.log > http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/xprobe2-0.3.log > Can these ports include net/bpf.h before pcap.h ? That should fix the issue. pcap.h has its own stripped down bpf.h now and that might not work. --HPS From owner-svn-src-head@freebsd.org Thu May 31 07:36:36 2018 Return-Path: Delivered-To: svn-src-head@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 CBA1FFC9EB3; Thu, 31 May 2018 07:36:36 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 67A06754E6; Thu, 31 May 2018 07:36:36 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 1BAA2260338; Thu, 31 May 2018 09:36:35 +0200 (CEST) Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Navdeep Parhar , Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805280812.w4S8CI56046943@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <52b81d7d-3031-02d4-22e9-b519e631552c@selasky.org> Date: Thu, 31 May 2018 09:36:22 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 07:36:37 -0000 On 05/30/18 20:42, Navdeep Parhar wrote: > Hi Hans, > > If pcap.h is changed to include net/bpf.h like it used to then the > change made to cxgbetool in r334277 should be reverted too. > > Regards, > Navdeep Noted. --HPS From owner-svn-src-head@freebsd.org Thu May 31 07:37:09 2018 Return-Path: Delivered-To: svn-src-head@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 BFAE7FC9FB2; Thu, 31 May 2018 07:37:09 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qk0-x229.google.com (mail-qk0-x229.google.com [IPv6:2607:f8b0:400d:c09::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 53EF675635; Thu, 31 May 2018 07:37:09 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-qk0-x229.google.com with SMTP id h19-v6so16503394qkj.10; Thu, 31 May 2018 00:37:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=D5WcMojv9gc/myh/xguaZmayMhA2OuAxkfd9WjzVO2I=; b=KSD373LYLov4SZkDnowuYObGnr60RarO6jV00i/O9e8wj/RXV/cltrUeAsclaB2m36 2TSXWWqodCo65NK7ofA9uw3XrJvXV6Kph56V7choG7U4L5DXhLKxBqXzS0xGFsXij9qD +gh0AvG7ImeL0Dx4+iyoGkce1VlAl9kQG3zIIbog/a3QuCs7A+DbaeW2m1R6qpwAWlcF 0DuxyiZlCOSVXVGbGZ/iKqjwMO8zwO1HeRVJfHdlt7VZurpoW5sPYnBciwDVtT//5Uh7 Kz3xdSCUTV3ZTPuzpp3VNiZGK/8xgAXfNKGET4pAiila24zB38zeLi5zy9tmBSq3rcFR gBcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=D5WcMojv9gc/myh/xguaZmayMhA2OuAxkfd9WjzVO2I=; b=Mpvgx6LftTdhXLt/psbtj9Ck0G5ej9IGK9Tg/aT4O8gL48ftxrxrzYEnGv5teQimwl fbSqbsscPLOkis629F30/m0z6Dp+n4mBhtN/7ZOVhNn1iUrRph+HiTSQWZPLj94vUIkX FMmO98AgXq73vvuoHlPoQiTNPXvm+WvGMCTuLv6pTLpskILqGnzI544WVCPMuiTVNDjL rzIbM4akStmbLBlynwpIV75YJJFb3wSqZW4k1KXoTICeWxUXXsUWTCRJ67FRT7WmpeF1 A+AjvVu3UilssYDLJdGk0zDeTSu0YP+blDbZ+akHWDQYFJZ3XUWX3OCTbx1EXrF1Tp3P 3Qtg== X-Gm-Message-State: APt69E1Y6XlSocP1voGhMRT0DCwA58lR5wv+7tJOFCjuO3SlZbOdWcJ5 s0OP/ZE6C6pnH4frpIuD3cNQWji4o7KCMbA0J7I= X-Google-Smtp-Source: ADUXVKLzjPYOLmL7FFOenFYvLVq7m1bG8KcPqqzSi9ujeWnzjL+fuHo9rVBQS1I9Z+oJ2pSWB39u/I9L0qU02UHsM30= X-Received: by 2002:a37:9c02:: with SMTP id f2-v6mr5347547qke.65.1527752228888; Thu, 31 May 2018 00:37:08 -0700 (PDT) MIME-Version: 1.0 Sender: antoine.brodin.freebsd@gmail.com Received: by 2002:a0c:c206:0:0:0:0:0 with HTTP; Thu, 31 May 2018 00:37:08 -0700 (PDT) In-Reply-To: References: <201805280812.w4S8CI56046943@repo.freebsd.org> From: Antoine Brodin Date: Thu, 31 May 2018 07:37:08 +0000 X-Google-Sender-Auth: PD5cFcuQD31YMM9guBzaQd3X2Rw Message-ID: Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Hans Petter Selasky Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 07:37:09 -0000 On Thu, May 31, 2018 at 7:32 AM, Hans Petter Selasky wrote: > On 05/30/18 20:32, Antoine Brodin wrote: >> >> Hi, >> >> It seems that this local change was lost during the upgrade: >> >> https://svnweb.freebsd.org/base/head/contrib/libpcap/pcap/pcap.h?r1=190640&r2=190639&pathrev=190640 >> > > Hi, > > This change has been removed upstream. This was a change local to FreeBSD. Antoine From owner-svn-src-head@freebsd.org Thu May 31 07:41:42 2018 Return-Path: Delivered-To: svn-src-head@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 24A9CFCA928; Thu, 31 May 2018 07:41:42 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B24C875BF8; Thu, 31 May 2018 07:41:41 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 92855260338; Thu, 31 May 2018 09:41:40 +0200 (CEST) Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Xin LI Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" References: <201805280812.w4S8CI56046943@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <22f8b1c6-a03c-4cf0-8ead-551cccdfea95@selasky.org> Date: Thu, 31 May 2018 09:41:27 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 07:41:42 -0000 On 05/30/18 22:10, Xin LI wrote: > This would make vendor/libpcap/dist history replace head/contrib/libpcap, > which effectively discards all FreeBSD local changes for base purposes, and > hides its change history. Is this intentional? If not, could you please > revert the tree back to its previous state and redo the merge? > Hi, > (You should probably also update sys/net/bpf.h and/or sys/net/dlt.h, by the > way). It is a vendor library, we should try to avoid local changes? The problem is that some files are deleted upstream and I'm not sure if "merge" will track that when we don't merge from the same branch. --HPS From owner-svn-src-head@freebsd.org Thu May 31 08:06:26 2018 Return-Path: Delivered-To: svn-src-head@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 20C9BFD2218; Thu, 31 May 2018 08:06:26 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADEED7722B; Thu, 31 May 2018 08:06:25 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 97C8A2600B9; Thu, 31 May 2018 10:06:23 +0200 (CEST) Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805280812.w4S8CI56046943@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <7d21ad79-5bc1-716f-45f1-6f4b5a5890b1@selasky.org> Date: Thu, 31 May 2018 10:06:10 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 08:06:26 -0000 On 05/31/18 09:37, Antoine Brodin wrote: > This was a change local to FreeBSD. I'll have a look. --HPS From owner-svn-src-head@freebsd.org Thu May 31 09:11:23 2018 Return-Path: Delivered-To: svn-src-head@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 EB7FBEF7D1E; Thu, 31 May 2018 09:11:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9BF00797FD; Thu, 31 May 2018 09:11:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D0241822E; Thu, 31 May 2018 09:11:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4V9BMHW062482; Thu, 31 May 2018 09:11:22 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4V9BLIc062477; Thu, 31 May 2018 09:11:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805310911.w4V9BLIc062477@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 31 May 2018 09:11:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334418 - in head: contrib/libpcap/pcap contrib/pf/pflogd contrib/wpa/src/l2_packet sys/net usr.sbin/cxgbetool X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head: contrib/libpcap/pcap contrib/pf/pflogd contrib/wpa/src/l2_packet sys/net usr.sbin/cxgbetool X-SVN-Commit-Revision: 334418 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 09:11:23 -0000 Author: hselasky Date: Thu May 31 09:11:21 2018 New Revision: 334418 URL: https://svnweb.freebsd.org/changeset/base/334418 Log: Re-apply r190640. - Restore local change to include inside pcap.h. This fixes ports build problems. - Update local copy of dlt.h with new DLT types. - Revert no longer needed includes which were added as part of r334277. Suggested by: antoine@, delphij@, np@ MFC after: 3 weeks Sponsored by: Mellanox Technologies Modified: head/contrib/libpcap/pcap/pcap.h head/contrib/pf/pflogd/pflogd.c head/contrib/wpa/src/l2_packet/l2_packet_freebsd.c head/sys/net/dlt.h head/usr.sbin/cxgbetool/cxgbetool.c Modified: head/contrib/libpcap/pcap/pcap.h ============================================================================== --- head/contrib/libpcap/pcap/pcap.h Thu May 31 04:11:40 2018 (r334417) +++ head/contrib/libpcap/pcap/pcap.h Thu May 31 09:11:21 2018 (r334418) @@ -84,9 +84,7 @@ #include #endif /* _WIN32/MSDOS/UN*X */ -#ifndef PCAP_DONT_INCLUDE_PCAP_BPF_H -#include -#endif +#include #include Modified: head/contrib/pf/pflogd/pflogd.c ============================================================================== --- head/contrib/pf/pflogd/pflogd.c Thu May 31 04:11:40 2018 (r334417) +++ head/contrib/pf/pflogd/pflogd.c Thu May 31 09:11:21 2018 (r334418) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/contrib/wpa/src/l2_packet/l2_packet_freebsd.c ============================================================================== --- head/contrib/wpa/src/l2_packet/l2_packet_freebsd.c Thu May 31 04:11:40 2018 (r334417) +++ head/contrib/wpa/src/l2_packet/l2_packet_freebsd.c Thu May 31 09:11:21 2018 (r334418) @@ -8,7 +8,7 @@ */ #include "includes.h" -#if defined(__APPLE__) || defined(__GLIBC__) || defined(__FreeBSD__) +#if defined(__APPLE__) || defined(__GLIBC__) #include #endif /* __APPLE__ */ #include Modified: head/sys/net/dlt.h ============================================================================== --- head/sys/net/dlt.h Thu May 31 04:11:40 2018 (r334417) +++ head/sys/net/dlt.h Thu May 31 09:11:21 2018 (r334418) @@ -122,9 +122,9 @@ /* * 18 is used for DLT_PFSYNC in OpenBSD, NetBSD, DragonFly BSD and - * Mac OS X; don't use it for anything else. (FreeBSD uses 121, - * which collides with DLT_HHDLC, even though it doesn't use 18 - * for anything and doesn't appear to have ever used it for anything.) + * macOS; don't use it for anything else. (FreeBSD uses 121, which + * collides with DLT_HHDLC, even though it doesn't use 18 for + * anything and doesn't appear to have ever used it for anything.) * * We define it as 18 on those platforms; it is, unfortunately, used * for DLT_CIP in Suse 6.3, so we don't define it as DLT_PFSYNC @@ -342,7 +342,7 @@ * * FreeBSD's libpcap won't map a link-layer header type of 18 - i.e., * DLT_PFSYNC files from OpenBSD and possibly older versions of NetBSD, - * DragonFly BSD, and OS X - to DLT_PFSYNC, so code built with FreeBSD's + * DragonFly BSD, and macOS - to DLT_PFSYNC, so code built with FreeBSD's * libpcap won't treat those files as DLT_PFSYNC files. * * Other libpcaps won't map a link-layer header type of 121 to DLT_PFSYNC; @@ -948,14 +948,14 @@ * the pseudo-header is: * * struct dl_ipnetinfo { - * u_int8_t dli_version; - * u_int8_t dli_family; - * u_int16_t dli_htype; - * u_int32_t dli_pktlen; - * u_int32_t dli_ifindex; - * u_int32_t dli_grifindex; - * u_int32_t dli_zsrc; - * u_int32_t dli_zdst; + * uint8_t dli_version; + * uint8_t dli_family; + * uint16_t dli_htype; + * uint32_t dli_pktlen; + * uint32_t dli_ifindex; + * uint32_t dli_grifindex; + * uint32_t dli_zsrc; + * uint32_t dli_zdst; * }; * * dli_version is 2 for the current version of the pseudo-header. @@ -1231,7 +1231,7 @@ * So I'll just give them one; hopefully this will show up in a * libpcap release in time for them to get this into 10.10 Big Sur * or whatever Mavericks' successor is called. LINKTYPE_PKTAP - * will be 258 *even on OS X*; that is *intentional*, so that + * will be 258 *even on macOS*; that is *intentional*, so that * PKTAP files look the same on *all* OSes (different OSes can have * different numerical values for a given DLT_, but *MUST NOT* have * different values for what goes in a file, as files can be moved @@ -1243,9 +1243,9 @@ * and that will continue to be DLT_USER2 on Darwin-based OSes. That way, * binary compatibility with Mavericks is preserved for programs using * this version of libpcap. This does mean that if you were using - * DLT_USER2 for some capture device on OS X, you can't do so with + * DLT_USER2 for some capture device on macOS, you can't do so with * this version of libpcap, just as you can't with Apple's libpcap - - * on OS X, they define DLT_PKTAP to be DLT_USER2, so programs won't + * on macOS, they define DLT_PKTAP to be DLT_USER2, so programs won't * be able to distinguish between PKTAP and whatever you were using * DLT_USER2 for. * @@ -1305,6 +1305,66 @@ #define DLT_RDS 265 /* + * USB packets, beginning with a Darwin (macOS, etc.) header. + */ +#define DLT_USB_DARWIN 266 + +/* + * OpenBSD DLT_OPENFLOW. + */ +#define DLT_OPENFLOW 267 + +/* + * SDLC frames containing SNA PDUs. + */ +#define DLT_SDLC 268 + +/* + * per "Selvig, Bjorn" used for + * TI protocol sniffer. + */ +#define DLT_TI_LLN_SNIFFER 269 + +/* + * per: Erik de Jong for + * https://github.com/eriknl/LoRaTap/releases/tag/v0.1 + */ +#define DLT_LORATAP 270 + +/* + * per: Stefanha at gmail.com for + * http://lists.sandelman.ca/pipermail/tcpdump-workers/2017-May/000772.html + * and: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/vsockmon.h + * for: http://qemu-project.org/Features/VirtioVsock + */ +#define DLT_VSOCK 271 + +/* + * Nordic Semiconductor Bluetooth LE sniffer. + */ +#define DLT_NORDIC_BLE 272 + +/* + * Excentis DOCSIS 3.1 RF sniffer (XRA-31) + * per: bruno.verstuyft at excentis.com + * http://www.xra31.com/xra-header + */ +#define DLT_DOCSIS31_XRA31 273 + +/* + * mPackets, as specified by IEEE 802.3br Figure 99-4, starting + * with the preamble and always ending with a CRC field. + */ +#define DLT_ETHERNET_MPACKET 274 + +/* + * DisplayPort AUX channel monitoring data as specified by VESA + * DisplayPort(DP) Standard preceeded by a pseudo-header. + * per dirk.eibach at gdsys.cc + */ +#define DLT_DISPLAYPORT_AUX 275 + +/* * In case the code that includes this file (directly or indirectly) * has also included OS files that happen to define DLT_MATCHING_MAX, * with a different value (perhaps because that OS hasn't picked up @@ -1314,7 +1374,7 @@ #ifdef DLT_MATCHING_MAX #undef DLT_MATCHING_MAX #endif -#define DLT_MATCHING_MAX 265 /* highest value in the "matching" range */ +#define DLT_MATCHING_MAX 275 /* highest value in the "matching" range */ /* * DLT and savefile link type values are split into a class and Modified: head/usr.sbin/cxgbetool/cxgbetool.c ============================================================================== --- head/usr.sbin/cxgbetool/cxgbetool.c Thu May 31 04:11:40 2018 (r334417) +++ head/usr.sbin/cxgbetool/cxgbetool.c Thu May 31 09:11:21 2018 (r334418) @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include From owner-svn-src-head@freebsd.org Thu May 31 09:12:45 2018 Return-Path: Delivered-To: svn-src-head@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 70D5DEF7FB3; Thu, 31 May 2018 09:12:45 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A38A579C2F; Thu, 31 May 2018 09:12:44 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 56BAA2600B9; Thu, 31 May 2018 11:12:42 +0200 (CEST) Subject: Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool From: Hans Petter Selasky To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201805280812.w4S8CI56046943@repo.freebsd.org> <7d21ad79-5bc1-716f-45f1-6f4b5a5890b1@selasky.org> Message-ID: <33348243-9f14-93a7-7b79-627f4b984507@selasky.org> Date: Thu, 31 May 2018 11:12:29 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <7d21ad79-5bc1-716f-45f1-6f4b5a5890b1@selasky.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 09:12:45 -0000 On 05/31/18 10:06, Hans Petter Selasky wrote: > On 05/31/18 09:37, Antoine Brodin wrote: >> This was a change local to FreeBSD. > > I'll have a look. > Hi Antoine, Can you test this with ports and see how it goes: https://svnweb.freebsd.org/changeset/base/334418 --HPS From owner-svn-src-head@freebsd.org Thu May 31 09:56:03 2018 Return-Path: Delivered-To: svn-src-head@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 1B38AEFB727; Thu, 31 May 2018 09:56:03 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C287B7B4B1; Thu, 31 May 2018 09:56:02 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3983189F4; Thu, 31 May 2018 09:56:02 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4V9u2tF084195; Thu, 31 May 2018 09:56:02 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4V9u2rL084194; Thu, 31 May 2018 09:56:02 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201805310956.w4V9u2rL084194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 31 May 2018 09:56:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334419 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 334419 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 09:56:03 -0000 Author: mjg Date: Thu May 31 09:56:02 2018 New Revision: 334419 URL: https://svnweb.freebsd.org/changeset/base/334419 Log: amd64: switch pagecopy from non-temporal stores to rep movsq The copied data is accessed in part soon after and it results with additional cache misses during a -j 1 buildkernel WITHOUT_CTF=yes KERNFAST=1, as measured with pmc stat. before: 256165411 cache-references # 0.003 refs/inst 15105408 cache-misses # 5.897% 20.70 real # 99.67% cpu 13.24 user # 63.94% cpu 7.40 sys # 35.73% cpu after: 256764469 cache-references # 0.003 refs/inst 11913551 cache-misses # 4.640% 20.70 real # 99.67% cpu 13.19 user # 63.73% cpu 7.44 sys # 35.95% cpu Note the real time did not change, but traffic to RAM was reduced (multiple measurements performed with switching the implementation at runtime). Since nobody else is using non-temporal for this and there is no apparent benefit at least these days, don't use them either. Side note is that pagecopy arguments should probably get reversed to not have to flip them around in the primitive. Discussed with: jeff Modified: head/sys/amd64/amd64/support.S Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Thu May 31 09:11:21 2018 (r334418) +++ head/sys/amd64/amd64/support.S Thu May 31 09:56:02 2018 (r334419) @@ -281,26 +281,12 @@ END(memset) */ ENTRY(pagecopy) PUSH_FRAME_POINTER - movq $-PAGE_SIZE,%rax - movq %rax,%rdx - subq %rax,%rdi - subq %rax,%rsi -1: - prefetchnta (%rdi,%rax) - addq $64,%rax - jne 1b -2: - movq (%rdi,%rdx),%rax - movnti %rax,(%rsi,%rdx) - movq 8(%rdi,%rdx),%rax - movnti %rax,8(%rsi,%rdx) - movq 16(%rdi,%rdx),%rax - movnti %rax,16(%rsi,%rdx) - movq 24(%rdi,%rdx),%rax - movnti %rax,24(%rsi,%rdx) - addq $32,%rdx - jne 2b - sfence + movq $PAGE_SIZE/8,%rcx + movq %rdi,%r9 + movq %rsi,%rdi + movq %r9,%rsi + rep + movsq POP_FRAME_POINTER ret END(pagecopy) From owner-svn-src-head@freebsd.org Thu May 31 11:11:24 2018 Return-Path: Delivered-To: svn-src-head@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 4FCB4F72715; Thu, 31 May 2018 11:11:24 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0586F7E3FB; Thu, 31 May 2018 11:11:24 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC50719676; Thu, 31 May 2018 11:11:23 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VBBNKe021998; Thu, 31 May 2018 11:11:23 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VBBNqY021988; Thu, 31 May 2018 11:11:23 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201805311111.w4VBBNqY021988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 31 May 2018 11:11:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334420 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 334420 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 11:11:24 -0000 Author: andrew Date: Thu May 31 11:11:23 2018 New Revision: 334420 URL: https://svnweb.freebsd.org/changeset/base/334420 Log: Fix the memory attribute for EFI_MD_ATTR_UC on arm64. This is defined as Device-nGnRnE in the UEFI spec (UEFI 2.4, section 2.3.6.1). This is the VM_MEMATTR_DEVICE type in FreeBSD. Reported by: tuexen Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/efirt_machdep.c Modified: head/sys/arm64/arm64/efirt_machdep.c ============================================================================== --- head/sys/arm64/arm64/efirt_machdep.c Thu May 31 09:56:02 2018 (r334419) +++ head/sys/arm64/arm64/efirt_machdep.c Thu May 31 11:11:23 2018 (r334420) @@ -196,7 +196,7 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int else if ((p->md_attr & EFI_MD_ATTR_WC) != 0) mode = VM_MEMATTR_WRITE_COMBINING; else if ((p->md_attr & EFI_MD_ATTR_UC) != 0) - mode = VM_MEMATTR_UNCACHEABLE; + mode = VM_MEMATTR_DEVICE; else { if (bootverbose) printf("EFI Runtime entry %d mapping " From owner-svn-src-head@freebsd.org Thu May 31 11:52:53 2018 Return-Path: Delivered-To: svn-src-head@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 99180F766F7; Thu, 31 May 2018 11:52:53 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 5947380014; Thu, 31 May 2018 11:52:52 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id 607AED675D6; Thu, 31 May 2018 21:19:59 +1000 (AEST) Date: Thu, 31 May 2018 21:19:58 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Mateusz Guzik cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334419 - head/sys/amd64/amd64 In-Reply-To: <201805310956.w4V9u2rL084194@repo.freebsd.org> Message-ID: <20180531201225.L2478@besplex.bde.org> References: <201805310956.w4V9u2rL084194@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=FMc4V8sSKksN_f48SpAA:9 a=7Zwj6sZBwVKJAoWSPKxL6X1jA+E=:19 a=OZzHa35JTbS_HLTY:21 a=NunYgISpA0Gx1Hiq:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 11:52:53 -0000 On Thu, 31 May 2018, Mateusz Guzik wrote: > Log: > amd64: switch pagecopy from non-temporal stores to rep movsq As for pagezero, this pessimizes for machines with slow movsq and/or caches (mostly older machines). > The copied data is accessed in part soon after and it results with additional > cache misses during a -j 1 buildkernel WITHOUT_CTF=yes KERNFAST=1, as measured > with pmc stat. Of course it causes more cache misses later, but for large data going through slow caches is much slower so the cache misses later cost less. > Modified: head/sys/amd64/amd64/support.S > ============================================================================== > --- head/sys/amd64/amd64/support.S Thu May 31 09:11:21 2018 (r334418) > +++ head/sys/amd64/amd64/support.S Thu May 31 09:56:02 2018 (r334419) > @@ -281,26 +281,12 @@ END(memset) > */ > ENTRY(pagecopy) > PUSH_FRAME_POINTER > - movq $-PAGE_SIZE,%rax > - movq %rax,%rdx > - subq %rax,%rdi > - subq %rax,%rsi > -1: > - prefetchnta (%rdi,%rax) > - addq $64,%rax > - jne 1b > -2: > - movq (%rdi,%rdx),%rax > - movnti %rax,(%rsi,%rdx) > - movq 8(%rdi,%rdx),%rax > - movnti %rax,8(%rsi,%rdx) > - movq 16(%rdi,%rdx),%rax > - movnti %rax,16(%rsi,%rdx) > - movq 24(%rdi,%rdx),%rax > - movnti %rax,24(%rsi,%rdx) > - addq $32,%rdx > - jne 2b > - sfence > + movq $PAGE_SIZE/8,%rcx > + movq %rdi,%r9 > + movq %rsi,%rdi > + movq %r9,%rsi > + rep > + movsq > POP_FRAME_POINTER > ret > END(pagecopy) It is negatively useful to write this in asm. This is now just memcpy() and the asm version of that is fast enough, though movsq takes too long to start up. This memcpy() might be inlined and then it would be insignificantly faster than the function call. __builtin_memcpy() won't actually inline it, since its size is large and compilers know that they don't understand memory. This doesn't even pessimize for i386. I have used many versions of this, with sysctls to control it. Newer machines normally select memcpy and older machines normally select pagecopy. This change breaks the selection for older machines. They actually want nontemporal pagecopy. My current version is: XX Index: amd64/amd64/pmap.c XX =================================================================== XX --- amd64/amd64/pmap.c (revision 332488) XX +++ amd64/amd64/pmap.c (working copy) XX @@ -360,6 +360,14 @@ XX SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, XX &pg_ps_enabled, 0, "Are large page mappings enabled?"); XX XX +static int pagecopy_memcpy; XX +SYSCTL_INT(_vm_pmap, OID_AUTO, pagecopy_memcpy, CTLFLAG_RW, XX + &pagecopy_memcpy, 0, "Use memcpy for pagecopy?"); XX + XX +static int pagezero_bzero; XX +SYSCTL_INT(_vm_pmap, OID_AUTO, pagezero_bzero, CTLFLAG_RW, XX + &pagezero_bzero, 0, "Use bzero for pagezero?"); XX + XX #define PAT_INDEX_SIZE 8 XX static int pat_index[PAT_INDEX_SIZE]; /* cache mode to PAT index conversion */ XX XX @@ -5638,7 +5646,10 @@ XX { XX vm_offset_t va = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); XX XX - pagezero((void *)va); XX + if (pagezero_bzero || (cpu_stdext_feature & CPUID_STDEXT_ERMS) != 0) XX + pagezero((void *)va); XX + else XX + sse2_pagezero((void *)va); XX } XX XX /* XX @@ -5665,7 +5676,10 @@ XX vm_offset_t src = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(msrc)); XX vm_offset_t dst = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(mdst)); XX XX - pagecopy((void *)src, (void *)dst); XX + if (pagecopy_memcpy || (cpu_stdext_feature & CPUID_STDEXT_ERMS) != 0) XX + memcpy((void *)dst, (void *)src, PAGE_SIZE); XX + else XX + pagecopy((void *)src, (void *)dst); XX } XX XX int unmapped_buf_allowed = 1; XX Index: i386/i386/pmap.c XX =================================================================== XX --- i386/i386/pmap.c (revision 332488) XX +++ i386/i386/pmap.c (working copy) XX @@ -219,6 +219,10 @@ XX SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, XX &pg_ps_enabled, 0, "Are large page mappings enabled?"); XX XX +static int pagezero_bzero; XX +SYSCTL_INT(_vm_pmap, OID_AUTO, pagezero_bzero, CTLFLAG_RW, XX + &pagezero_bzero, 0, "Use bzero for pagezero?"); XX + XX #define PAT_INDEX_SIZE 8 XX static int pat_index[PAT_INDEX_SIZE]; /* cache mode to PAT index conversion */ XX XX @@ -4212,6 +4217,10 @@ XX static __inline void XX pagezero(void *page) XX { XX + if (pagezero_bzero || (cpu_stdext_feature & CPUID_STDEXT_ERMS) != 0) { XX + bzero(page, PAGE_SIZE); XX + return; XX + } XX #if defined(I686_CPU) XX if (cpu_class == CPUCLASS_686) { XX if (cpu_feature & CPUID_SSE2) i386 doesn't have a nontemporal pagecopy() and this patch doesn't bother to add one, but in other versions I use: - nontemporal pagecopy through SSE1 if available (requires slow FPU switch but is otherwise better than movnti, starting with not needing SSE2) - nontemporal pagezero through SSE1 if available. - nontemporal pagecopy through SSE2 (see next set of patches) This actually defaults to using memcpy() or bzero() accoring to (cpu_stdext_feature & CPUID_STDEXT_ERMS). This is not quite the right test, but it distinguishes right between all of my slow and fast machines. Newer machines tend to have CPUID_STDEXT_ERMS. Cache speed is more important than fast-strings but newer machines tend to have both. The default and sysctl recover from the loss of nontemporal pagezero on amd64 and maintain i386 to have the same functionality. I recovered nontemporal pagezero as sse2_pagezero on amd64, but it is unreachable without the above sysctl. kib didn't like the fast-strings heuristic and I haven't found or needed a better one. Here is the more elaborate version that I used 2 years ago. Testing with hundreds of makeworlds showed that nothing with temporal moves was any good on Haswell. Nontemporal pagecopy was better for Turion2, but pagecopy is used so rarely that nontemporal pagecopy is not worth adding for i386 now. Much older tests showed that nontemporal stores are not worth using for almost anything, even for older machines than Turion2 where they look useful. They are useful for data larger than all caches or large enough to go out of caches before it is used, but the former is rare and the latter is hard to predict. SunOS used nontemporal copies for not very large sizes in bcopy() and/or copyin/out(). I tried that, and couldn't find any threshold where nontemporal copies worked better. Nontemporal copies are just worse for small data and for large data it makes little difference. pagecopy() is more predictable but still hard to predict. A single page is too small for a nontemporal copying. There might be a large process with a few GB of page faults all at once, but that is rare, especially with the non-bloatware that use. YY diff -c2 ./amd64/amd64/pmap.c~ ./amd64/amd64/pmap.c YY *** ./amd64/amd64/pmap.c~ Sat Jan 23 05:12:31 2016 YY --- ./amd64/amd64/pmap.c Sun Feb 14 17:22:07 2016 YY *************** YY *** 352,355 **** YY --- 352,395 ---- YY &pg_ps_enabled, 0, "Are large page mappings enabled?"); YY YY + static u_long pagecopy_calls; YY + SYSCTL_ULONG(_vm_pmap, OID_AUTO, pagecopy_calls, CTLFLAG_RW, YY + &pagecopy_calls, 0, "Number of calls to pmap_copy_page"); YY + YY + static int pagecopy_memcpy; YY + SYSCTL_INT(_vm_pmap, OID_AUTO, pagecopy_memcpy, CTLFLAG_RW, YY + &pagecopy_memcpy, 0, "Use memcpy for pagecopy?"); YY + YY + static int pagecopy_pagecopy1; YY + SYSCTL_INT(_vm_pmap, OID_AUTO, pagecopy_pagecopy1, CTLFLAG_RW, YY + &pagecopy_pagecopy1, 0, "Use pagecopy1 for pagecopy?"); YY + YY + static int pagecopy_pagecopy8; YY + SYSCTL_INT(_vm_pmap, OID_AUTO, pagecopy_pagecopy8, CTLFLAG_RW, YY + &pagecopy_pagecopy8, 0, "Use pagecopy8 for pagecopy?"); YY + YY + static int pagecopy_pagecopy81; YY + SYSCTL_INT(_vm_pmap, OID_AUTO, pagecopy_pagecopy81, CTLFLAG_RW, YY + &pagecopy_pagecopy81, 0, "Use pagecopy81 for pagecopy?"); YY + YY + static u_long pagezero_calls; YY + SYSCTL_ULONG(_vm_pmap, OID_AUTO, pagezero_calls, CTLFLAG_RW, YY + &pagezero_calls, 0, "Number of calls to pagezero"); YY + YY + static int pagezero_pagezero1; YY + SYSCTL_INT(_vm_pmap, OID_AUTO, pagezero_pagezero1, CTLFLAG_RW, YY + &pagezero_pagezero1, 0, "Use pagezero1 for pagezero?"); YY + YY + static int pagezero_pagezero2; YY + SYSCTL_INT(_vm_pmap, OID_AUTO, pagezero_pagezero2, CTLFLAG_RW, YY + &pagezero_pagezero2, 0, "Use pagezero2 for pagezero?"); YY + YY + static int pagezero_pagezero8; YY + SYSCTL_INT(_vm_pmap, OID_AUTO, pagezero_pagezero8, CTLFLAG_RW, YY + &pagezero_pagezero8, 0, "Use pagezero8 for pagezero?"); YY + YY + static int pagezero_bzero; YY + SYSCTL_INT(_vm_pmap, OID_AUTO, pagezero_bzero, CTLFLAG_RW, YY + &pagezero_bzero, 0, "Use bzero for pagezero?"); YY + YY #define PAT_INDEX_SIZE 8 YY static int pat_index[PAT_INDEX_SIZE]; /* cache mode to PAT index conversion */ YY *************** YY *** 4989,4995 **** YY } YY YY /* YY ! * pmap_zero_page zeros the specified hardware page by mapping YY ! * the page into KVM and using bzero to clear its contents. YY */ YY void YY --- 5029,5038 ---- YY } YY YY + void pagezero1(void *); YY + void pagezero2(void *); YY + void pagezero8(void *); YY + YY /* YY ! * Zero the specified hardware page. YY */ YY void YY *************** YY *** 4998,5009 **** YY vm_offset_t va = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); YY YY ! pagezero((void *)va); YY } YY YY /* YY ! * pmap_zero_page_area zeros the specified hardware page by mapping YY ! * the page into KVM and using bzero to clear its contents. YY ! * YY ! * off and size may not cover an area beyond a single hardware page. YY */ YY void YY --- 5041,5060 ---- YY vm_offset_t va = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); YY YY ! pagezero_calls++; YY ! if (pagezero_pagezero1) YY ! pagezero1((void *)va); YY ! else if (pagezero_pagezero2) YY ! pagezero2((void *)va); YY ! else if (pagezero_pagezero8) YY ! pagezero8((void *)va); YY ! else if (pagezero_bzero) YY ! bzero((void *)va, PAGE_SIZE); YY ! else YY ! pagezero((void *)va); YY } YY YY /* YY ! * Zero an an area within a single hardware page. off and size must not YY ! * cover an area beyond a single hardware page. YY */ YY void YY *************** YY *** 5032,5035 **** YY --- 5083,5090 ---- YY } YY YY + void pagecopy1(void *, void *); YY + void pagecopy8(void *, void *); YY + void pagecopy81(void *, void *); YY + YY /* YY * pmap_copy_page copies the specified (machine independent) YY *************** YY *** 5044,5048 **** YY vm_offset_t dst = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(mdst)); YY YY ! pagecopy((void *)src, (void *)dst); YY } YY YY --- 5099,5113 ---- YY vm_offset_t dst = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(mdst)); YY YY ! pagecopy_calls++; YY ! if (pagecopy_pagecopy1) YY ! pagecopy1((void *)src, (void *)dst); YY ! else if (pagecopy_pagecopy8) YY ! pagecopy8((void *)src, (void *)dst); YY ! else if (pagecopy_pagecopy81) YY ! pagecopy81((void *)src, (void *)dst); YY ! else if (pagecopy_memcpy) YY ! memcpy((void *)dst, (void *)src, PAGE_SIZE); YY ! else YY ! pagecopy((void *)src, (void *)dst); YY } YY YY diff -c2 ./amd64/amd64/support.S~ ./amd64/amd64/support.S YY *** ./amd64/amd64/support.S~ Wed Feb 24 22:35:30 2016 YY --- ./amd64/amd64/support.S Wed Feb 24 22:47:10 2016 YY *************** YY *** 80,83 **** YY --- 80,133 ---- YY END(pagezero) YY YY + ENTRY(pagezero1) YY + PUSH_FRAME_POINTER YY + movq $-PAGE_SIZE,%rdx YY + subq %rdx,%rdi YY + xorl %eax,%eax YY + 1: YY + movnti %rax,(%rdi,%rdx) YY + addq $8,%rdx YY + jne 1b YY + sfence YY + POP_FRAME_POINTER YY + ret YY + END(pagezero1) YY + YY + ENTRY(pagezero2) YY + PUSH_FRAME_POINTER YY + movq $-PAGE_SIZE,%rdx YY + subq %rdx,%rdi YY + xorl %eax,%eax YY + 1: YY + movnti %rax,(%rdi,%rdx) YY + movnti %rax,8(%rdi,%rdx) YY + addq $16,%rdx YY + jne 1b YY + sfence YY + POP_FRAME_POINTER YY + ret YY + END(pagezero2) YY + YY + ENTRY(pagezero8) YY + PUSH_FRAME_POINTER YY + movq $-PAGE_SIZE,%rdx YY + subq %rdx,%rdi YY + xorl %eax,%eax YY + 1: YY + movnti %rax,(%rdi,%rdx) YY + movnti %rax,8(%rdi,%rdx) YY + movnti %rax,16(%rdi,%rdx) YY + movnti %rax,24(%rdi,%rdx) YY + movnti %rax,32(%rdi,%rdx) YY + movnti %rax,40(%rdi,%rdx) YY + movnti %rax,48(%rdi,%rdx) YY + movnti %rax,56(%rdi,%rdx) YY + addq $64,%rdx YY + jne 1b YY + sfence YY + POP_FRAME_POINTER YY + ret YY + END(pagezero8) YY + YY ENTRY(bcmp) YY PUSH_FRAME_POINTER YY *************** YY *** 195,198 **** YY --- 245,334 ---- YY END(pagecopy) YY YY + ENTRY(pagecopy1) YY + PUSH_FRAME_POINTER YY + movq $-PAGE_SIZE,%rax YY + movq %rax,%rdx YY + subq %rax,%rdi YY + subq %rax,%rsi YY + 2: YY + movq (%rdi,%rdx),%rax YY + movnti %rax,(%rsi,%rdx) YY + movq 8(%rdi,%rdx),%rax YY + movnti %rax,8(%rsi,%rdx) YY + movq 16(%rdi,%rdx),%rax YY + movnti %rax,16(%rsi,%rdx) YY + movq 24(%rdi,%rdx),%rax YY + movnti %rax,24(%rsi,%rdx) YY + addq $32,%rdx YY + jne 2b YY + sfence YY + POP_FRAME_POINTER YY + ret YY + END(pagecopy1) YY + YY + ENTRY(pagecopy8) YY + PUSH_FRAME_POINTER YY + movq $-PAGE_SIZE,%rax YY + movq %rax,%rdx YY + subq %rax,%rdi YY + subq %rax,%rsi YY + 1: YY + prefetchnta (%rdi,%rax) YY + addq $64,%rax YY + jne 1b YY + 2: YY + movq (%rdi,%rdx),%rax YY + movnti %rax,(%rsi,%rdx) YY + movq 8(%rdi,%rdx),%rax YY + movnti %rax,8(%rsi,%rdx) YY + movq 16(%rdi,%rdx),%rax YY + movnti %rax,16(%rsi,%rdx) YY + movq 24(%rdi,%rdx),%rax YY + movnti %rax,24(%rsi,%rdx) YY + movq 32(%rdi,%rdx),%rax YY + movnti %rax,32(%rsi,%rdx) YY + movq 40(%rdi,%rdx),%rax YY + movnti %rax,40(%rsi,%rdx) YY + movq 48(%rdi,%rdx),%rax YY + movnti %rax,48(%rsi,%rdx) YY + movq 56(%rdi,%rdx),%rax YY + movnti %rax,56(%rsi,%rdx) YY + addq $64,%rdx YY + jne 2b YY + sfence YY + POP_FRAME_POINTER YY + ret YY + END(pagecopy8) YY + YY + ENTRY(pagecopy81) YY + PUSH_FRAME_POINTER YY + movq $-PAGE_SIZE,%rax YY + movq %rax,%rdx YY + subq %rax,%rdi YY + subq %rax,%rsi YY + 2: YY + movq (%rdi,%rdx),%rax YY + movnti %rax,(%rsi,%rdx) YY + movq 8(%rdi,%rdx),%rax YY + movnti %rax,8(%rsi,%rdx) YY + movq 16(%rdi,%rdx),%rax YY + movnti %rax,16(%rsi,%rdx) YY + movq 24(%rdi,%rdx),%rax YY + movnti %rax,24(%rsi,%rdx) YY + movq 32(%rdi,%rdx),%rax YY + movnti %rax,32(%rsi,%rdx) YY + movq 40(%rdi,%rdx),%rax YY + movnti %rax,40(%rsi,%rdx) YY + movq 48(%rdi,%rdx),%rax YY + movnti %rax,48(%rsi,%rdx) YY + movq 56(%rdi,%rdx),%rax YY + movnti %rax,56(%rsi,%rdx) YY + addq $64,%rdx YY + jne 2b YY + sfence YY + POP_FRAME_POINTER YY + ret YY + END(pagecopy81) YY + YY /* fillw(pat, base, cnt) */ YY /* %rdi,%rsi, %rdx */ Bruce From owner-svn-src-head@freebsd.org Thu May 31 11:53:47 2018 Return-Path: Delivered-To: svn-src-head@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 81FD7F76805; Thu, 31 May 2018 11:53:47 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 34BD880165; Thu, 31 May 2018 11:53:47 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 15A9019D61; Thu, 31 May 2018 11:53:47 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VBrkSx043848; Thu, 31 May 2018 11:53:46 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VBrk6h043847; Thu, 31 May 2018 11:53:46 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201805311153.w4VBrk6h043847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 31 May 2018 11:53:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334421 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 334421 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 11:53:47 -0000 Author: andrew Date: Thu May 31 11:53:46 2018 New Revision: 334421 URL: https://svnweb.freebsd.org/changeset/base/334421 Log: Fix the early spelling of bootverbose. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/machdep.c Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Thu May 31 11:11:23 2018 (r334420) +++ head/sys/arm64/arm64/machdep.c Thu May 31 11:53:46 2018 (r334421) @@ -1075,7 +1075,7 @@ initarm(struct arm64_bootparams *abp) if (env != NULL) strlcpy(kernelname, env, sizeof(kernelname)); - if (bootverbose) + if (boothowto & RB_VERBOSE) arm_physmem_print_tables(); early_boot = 0; From owner-svn-src-head@freebsd.org Thu May 31 12:10:31 2018 Return-Path: Delivered-To: svn-src-head@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 5756FF78C6B; Thu, 31 May 2018 12:10:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0D7A981127; Thu, 31 May 2018 12:10:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E2B2019F12; Thu, 31 May 2018 12:10:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VCAUiP048926; Thu, 31 May 2018 12:10:30 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VCAUrw048925; Thu, 31 May 2018 12:10:30 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805311210.w4VCAUrw048925@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 31 May 2018 12:10:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334422 - head/sys/dev/atkbdc X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/atkbdc X-SVN-Commit-Revision: 334422 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 12:10:31 -0000 Author: hselasky Date: Thu May 31 12:10:30 2018 New Revision: 334422 URL: https://svnweb.freebsd.org/changeset/base/334422 Log: Correct argument for evdev_push_rel(). This is a regression issue after r319162. Submitted by: Johannes Lundberg MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/atkbdc/psm.c Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Thu May 31 11:53:46 2018 (r334421) +++ head/sys/dev/atkbdc/psm.c Thu May 31 12:10:30 2018 (r334422) @@ -4966,8 +4966,8 @@ psmsoftintr(void *arg) if (evdev_rcpt_mask & EVDEV_RCPT_HW_MOUSE && sc->hw.model != MOUSE_MODEL_ELANTECH && sc->hw.model != MOUSE_MODEL_SYNAPTICS) { - evdev_push_rel(sc->evdev_r, EV_REL, x); - evdev_push_rel(sc->evdev_r, EV_REL, -y); + evdev_push_rel(sc->evdev_r, REL_X, x); + evdev_push_rel(sc->evdev_r, REL_Y, -y); switch (sc->hw.model) { case MOUSE_MODEL_EXPLORER: From owner-svn-src-head@freebsd.org Thu May 31 12:35:23 2018 Return-Path: Delivered-To: svn-src-head@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 06A2CF7B259; Thu, 31 May 2018 12:35:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AA1038288E; Thu, 31 May 2018 12:35:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 873B21A3EF; Thu, 31 May 2018 12:35:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VCZMWr064396; Thu, 31 May 2018 12:35:22 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VCZM0e064394; Thu, 31 May 2018 12:35:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805311235.w4VCZM0e064394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 31 May 2018 12:35:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334423 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 334423 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 12:35:23 -0000 Author: hselasky Date: Thu May 31 12:35:21 2018 New Revision: 334423 URL: https://svnweb.freebsd.org/changeset/base/334423 Log: Implement idr_is_empty() in the LinuxKPI and make idr_remove() API compatible with upstream Linux by returning the pointer to the removed element. Submitted by: Johannes Lundberg MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/idr.h head/sys/compat/linuxkpi/common/src/linux_idr.c Modified: head/sys/compat/linuxkpi/common/include/linux/idr.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/idr.h Thu May 31 12:10:30 2018 (r334422) +++ head/sys/compat/linuxkpi/common/include/linux/idr.h Thu May 31 12:35:21 2018 (r334423) @@ -79,11 +79,12 @@ void idr_preload(gfp_t gfp_mask); void idr_preload_end(void); void *idr_find(struct idr *idp, int id); void *idr_get_next(struct idr *idp, int *nextid); +bool idr_is_empty(struct idr *idp); int idr_pre_get(struct idr *idp, gfp_t gfp_mask); int idr_get_new(struct idr *idp, void *ptr, int *id); int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id); void *idr_replace(struct idr *idp, void *ptr, int id); -void idr_remove(struct idr *idp, int id); +void *idr_remove(struct idr *idp, int id); void idr_remove_all(struct idr *idp); void idr_destroy(struct idr *idp); void idr_init(struct idr *idp); Modified: head/sys/compat/linuxkpi/common/src/linux_idr.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_idr.c Thu May 31 12:10:30 2018 (r334422) +++ head/sys/compat/linuxkpi/common/src/linux_idr.c Thu May 31 12:35:21 2018 (r334423) @@ -218,10 +218,11 @@ idr_remove_all(struct idr *idr) mtx_unlock(&idr->lock); } -static void +static void * idr_remove_locked(struct idr *idr, int id) { struct idr_layer *il; + void *res; int layer; int idx; @@ -229,7 +230,7 @@ idr_remove_locked(struct idr *idr, int id) il = idr->top; layer = idr->layers - 1; if (il == NULL || id > idr_max(idr)) - return; + return (NULL); /* * Walk down the tree to this item setting bitmaps along the way * as we know at least one item will be free along this path. @@ -249,16 +250,23 @@ idr_remove_locked(struct idr *idr, int id) if (il == NULL || (il->bitmap & (1 << idx)) != 0) panic("idr_remove: Item %d not allocated (%p, %p)\n", id, idr, il); + res = il->ary[idx]; il->ary[idx] = NULL; il->bitmap |= 1 << idx; + + return (res); } -void +void * idr_remove(struct idr *idr, int id) { + void *res; + mtx_lock(&idr->lock); - idr_remove_locked(idr, id); + res = idr_remove_locked(idr, id); mtx_unlock(&idr->lock); + + return (res); } @@ -713,6 +721,20 @@ int idr_for_each(struct idr *idp, int (*f)(int id, void *p, void *data), void *data) { return (idr_for_each_layer(idp->top, 0, idp->layers - 1, f, data)); +} + +static int +idr_has_entry(int id, void *p, void *data) +{ + + return (1); +} + +bool +idr_is_empty(struct idr *idp) +{ + + return (idr_for_each(idp, idr_has_entry, NULL) == 0); } int From owner-svn-src-head@freebsd.org Thu May 31 12:37:36 2018 Return-Path: Delivered-To: svn-src-head@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 D1A1DF7B630; Thu, 31 May 2018 12:37:35 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7FC2182AE6; Thu, 31 May 2018 12:37:35 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D7D11A3F0; Thu, 31 May 2018 12:37:35 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VCbZCC064525; Thu, 31 May 2018 12:37:35 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VCbZSS064524; Thu, 31 May 2018 12:37:35 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201805311237.w4VCbZSS064524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 31 May 2018 12:37:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334424 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 334424 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 12:37:36 -0000 Author: andrew Date: Thu May 31 12:37:34 2018 New Revision: 334424 URL: https://svnweb.freebsd.org/changeset/base/334424 Log: Move the code to print the EFI memory table to a new function and call it in teh bootverbose path after cninit(). This allows users to see these tables when booting with boot -v. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/machdep.c Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Thu May 31 12:35:21 2018 (r334423) +++ head/sys/arm64/arm64/machdep.c Thu May 31 12:37:34 2018 (r334424) @@ -726,28 +726,9 @@ static void foreach_efi_map_entry(struct efi_map_header *efihdr, efi_map_entry_cb cb) { struct efi_md *map, *p; - const char *type; size_t efisz; int ndesc, i; - static const char *types[] = { - "Reserved", - "LoaderCode", - "LoaderData", - "BootServicesCode", - "BootServicesData", - "RuntimeServicesCode", - "RuntimeServicesData", - "ConventionalMemory", - "UnusableMemory", - "ACPIReclaimMemory", - "ACPIMemoryNVS", - "MemoryMappedIO", - "MemoryMappedIOPortSpace", - "PalCode", - "PersistentMemory" - }; - /* * Memory map data provided by UEFI via the GetMemoryMap * Boot Services API. @@ -759,46 +740,8 @@ foreach_efi_map_entry(struct efi_map_header *efihdr, e return; ndesc = efihdr->memory_size / efihdr->descriptor_size; - if (boothowto & RB_VERBOSE) - printf("%23s %12s %12s %8s %4s\n", - "Type", "Physical", "Virtual", "#Pages", "Attr"); - for (i = 0, p = map; i < ndesc; i++, p = efi_next_descriptor(p, efihdr->descriptor_size)) { - if (boothowto & RB_VERBOSE) { - if (p->md_type < nitems(types)) - type = types[p->md_type]; - else - type = ""; - printf("%23s %012lx %12p %08lx ", type, p->md_phys, - p->md_virt, p->md_pages); - if (p->md_attr & EFI_MD_ATTR_UC) - printf("UC "); - if (p->md_attr & EFI_MD_ATTR_WC) - printf("WC "); - if (p->md_attr & EFI_MD_ATTR_WT) - printf("WT "); - if (p->md_attr & EFI_MD_ATTR_WB) - printf("WB "); - if (p->md_attr & EFI_MD_ATTR_UCE) - printf("UCE "); - if (p->md_attr & EFI_MD_ATTR_WP) - printf("WP "); - if (p->md_attr & EFI_MD_ATTR_RP) - printf("RP "); - if (p->md_attr & EFI_MD_ATTR_XP) - printf("XP "); - if (p->md_attr & EFI_MD_ATTR_NV) - printf("NV "); - if (p->md_attr & EFI_MD_ATTR_MORE_RELIABLE) - printf("MORE_RELIABLE "); - if (p->md_attr & EFI_MD_ATTR_RO) - printf("RO "); - if (p->md_attr & EFI_MD_ATTR_RT) - printf("RUNTIME"); - printf("\n"); - } - cb(p); } } @@ -862,6 +805,70 @@ add_efi_map_entries(struct efi_map_header *efihdr) foreach_efi_map_entry(efihdr, add_efi_map_entry); } +static void +print_efi_map_entry(struct efi_md *p) +{ + const char *type; + static const char *types[] = { + "Reserved", + "LoaderCode", + "LoaderData", + "BootServicesCode", + "BootServicesData", + "RuntimeServicesCode", + "RuntimeServicesData", + "ConventionalMemory", + "UnusableMemory", + "ACPIReclaimMemory", + "ACPIMemoryNVS", + "MemoryMappedIO", + "MemoryMappedIOPortSpace", + "PalCode", + "PersistentMemory" + }; + + if (p->md_type < nitems(types)) + type = types[p->md_type]; + else + type = ""; + printf("%23s %012lx %12p %08lx ", type, p->md_phys, + p->md_virt, p->md_pages); + if (p->md_attr & EFI_MD_ATTR_UC) + printf("UC "); + if (p->md_attr & EFI_MD_ATTR_WC) + printf("WC "); + if (p->md_attr & EFI_MD_ATTR_WT) + printf("WT "); + if (p->md_attr & EFI_MD_ATTR_WB) + printf("WB "); + if (p->md_attr & EFI_MD_ATTR_UCE) + printf("UCE "); + if (p->md_attr & EFI_MD_ATTR_WP) + printf("WP "); + if (p->md_attr & EFI_MD_ATTR_RP) + printf("RP "); + if (p->md_attr & EFI_MD_ATTR_XP) + printf("XP "); + if (p->md_attr & EFI_MD_ATTR_NV) + printf("NV "); + if (p->md_attr & EFI_MD_ATTR_MORE_RELIABLE) + printf("MORE_RELIABLE "); + if (p->md_attr & EFI_MD_ATTR_RO) + printf("RO "); + if (p->md_attr & EFI_MD_ATTR_RT) + printf("RUNTIME"); + printf("\n"); +} + +static void +print_efi_map_entries(struct efi_map_header *efihdr) +{ + + printf("%23s %12s %12s %8s %4s\n", + "Type", "Physical", "Virtual", "#Pages", "Attr"); + foreach_efi_map_entry(efihdr, print_efi_map_entry); +} + #ifdef FDT static void try_load_dtb(caddr_t kmdp) @@ -1075,8 +1082,10 @@ initarm(struct arm64_bootparams *abp) if (env != NULL) strlcpy(kernelname, env, sizeof(kernelname)); - if (boothowto & RB_VERBOSE) + if (boothowto & RB_VERBOSE) { + print_efi_map_entries(efihdr); arm_physmem_print_tables(); + } early_boot = 0; } From owner-svn-src-head@freebsd.org Thu May 31 12:48:25 2018 Return-Path: Delivered-To: svn-src-head@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 7309EF7C788; Thu, 31 May 2018 12:48:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2049A8340E; Thu, 31 May 2018 12:48:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9BC11A58B; Thu, 31 May 2018 12:48:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VCmOOj069597; Thu, 31 May 2018 12:48:24 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VCmOin069596; Thu, 31 May 2018 12:48:24 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805311248.w4VCmOin069596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 31 May 2018 12:48:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334425 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 334425 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 12:48:25 -0000 Author: hselasky Date: Thu May 31 12:48:24 2018 New Revision: 334425 URL: https://svnweb.freebsd.org/changeset/base/334425 Log: Implement bitmap_complement() in the LinuxKPI. Submitted by: Johannes Lundberg MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/bitmap.h Modified: head/sys/compat/linuxkpi/common/include/linux/bitmap.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/bitmap.h Thu May 31 12:37:34 2018 (r334424) +++ head/sys/compat/linuxkpi/common/include/linux/bitmap.h Thu May 31 12:48:24 2018 (r334425) @@ -244,6 +244,17 @@ bitmap_equal(const unsigned long *pa, } static inline void +bitmap_complement(unsigned long *dst, const unsigned long *src, + const unsigned int size) +{ + const unsigned int end = BITS_TO_LONGS(size); + unsigned int i; + + for (i = 0; i != end; i++) + dst[i] = ~src[i]; +} + +static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, const unsigned long *src2, const unsigned int size) { From owner-svn-src-head@freebsd.org Thu May 31 12:50:43 2018 Return-Path: Delivered-To: svn-src-head@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 17139F7CBC7; Thu, 31 May 2018 12:50:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BDA3B835FE; Thu, 31 May 2018 12:50:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9EE521A5A0; Thu, 31 May 2018 12:50:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VCog5f073545; Thu, 31 May 2018 12:50:42 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VCog24073544; Thu, 31 May 2018 12:50:42 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805311250.w4VCog24073544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 31 May 2018 12:50:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334426 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 334426 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 12:50:43 -0000 Author: hselasky Date: Thu May 31 12:50:42 2018 New Revision: 334426 URL: https://svnweb.freebsd.org/changeset/base/334426 Log: Define __initconst in the LinuxKPI. Submitted by: Johannes Lundberg MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/compiler.h Modified: head/sys/compat/linuxkpi/common/include/linux/compiler.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/compiler.h Thu May 31 12:48:24 2018 (r334425) +++ head/sys/compat/linuxkpi/common/include/linux/compiler.h Thu May 31 12:50:42 2018 (r334426) @@ -52,6 +52,7 @@ #define __devinitdata #define __deprecated #define __init +#define __initconst #define __devinit #define __devexit #define __exit From owner-svn-src-head@freebsd.org Thu May 31 12:55:39 2018 Return-Path: Delivered-To: svn-src-head@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 B1164F7D3FF; Thu, 31 May 2018 12:55:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 621AA83BE4; Thu, 31 May 2018 12:55:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 434841A71E; Thu, 31 May 2018 12:55:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VCtd5D074662; Thu, 31 May 2018 12:55:39 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VCtddZ074661; Thu, 31 May 2018 12:55:39 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805311255.w4VCtddZ074661@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 31 May 2018 12:55:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334427 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 334427 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 12:55:39 -0000 Author: hselasky Date: Thu May 31 12:55:38 2018 New Revision: 334427 URL: https://svnweb.freebsd.org/changeset/base/334427 Log: Correct macroname in the LinuxKPI. Submitted by: Johannes Lundberg MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/completion.h Modified: head/sys/compat/linuxkpi/common/include/linux/completion.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/completion.h Thu May 31 12:50:42 2018 (r334426) +++ head/sys/compat/linuxkpi/common/include/linux/completion.h Thu May 31 12:55:38 2018 (r334427) @@ -49,7 +49,7 @@ struct completion { linux_complete_common((c), 1) #define wait_for_completion(c) \ linux_wait_for_common((c), 0) -#define wait_for_completion_interuptible(c) \ +#define wait_for_completion_interruptible(c) \ linux_wait_for_common((c), 1) #define wait_for_completion_timeout(c, timeout) \ linux_wait_for_timeout_common((c), (timeout), 0) From owner-svn-src-head@freebsd.org Thu May 31 13:13:09 2018 Return-Path: Delivered-To: svn-src-head@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 B352CF7EE09; Thu, 31 May 2018 13:13:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6215184835; Thu, 31 May 2018 13:13:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42C931AA55; Thu, 31 May 2018 13:13:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VDD9Pa084670; Thu, 31 May 2018 13:13:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VDD9Vv084669; Thu, 31 May 2018 13:13:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805311313.w4VDD9Vv084669@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 31 May 2018 13:13:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334428 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 334428 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 13:13:09 -0000 Author: hselasky Date: Thu May 31 13:13:08 2018 New Revision: 334428 URL: https://svnweb.freebsd.org/changeset/base/334428 Log: Implement support for the kvmalloc_array() function in the LinuxKPI. Submitted by: Johannes Lundberg MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/slab.h Thu May 31 12:55:38 2018 (r334427) +++ head/sys/compat/linuxkpi/common/include/linux/slab.h Thu May 31 13:13:08 2018 (r334428) @@ -132,6 +132,12 @@ kmalloc_array(size_t n, size_t size, gfp_t flags) } static inline void * +kvmalloc_array(size_t n, size_t size, gfp_t flags) +{ + return (mallocarray(n, size, M_KMALLOC, linux_check_m_flags(flags))); +} + +static inline void * krealloc(void *ptr, size_t size, gfp_t flags) { return (realloc(ptr, size, M_KMALLOC, linux_check_m_flags(flags))); From owner-svn-src-head@freebsd.org Thu May 31 13:17:35 2018 Return-Path: Delivered-To: svn-src-head@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 A1DBCF7F70A; Thu, 31 May 2018 13:17:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 541F084C56; Thu, 31 May 2018 13:17:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31A2B1AA68; Thu, 31 May 2018 13:17:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VDHZq3084862; Thu, 31 May 2018 13:17:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VDHZYC084861; Thu, 31 May 2018 13:17:35 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805311317.w4VDHZYC084861@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 31 May 2018 13:17:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334429 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 334429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 13:17:35 -0000 Author: hselasky Date: Thu May 31 13:17:34 2018 New Revision: 334429 URL: https://svnweb.freebsd.org/changeset/base/334429 Log: Implement support for the PCI_BUS_NUM() function macro in the LinuxKPI. Submitted by: Johannes Lundberg MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/pci.h Thu May 31 13:13:08 2018 (r334428) +++ head/sys/compat/linuxkpi/common/include/linux/pci.h Thu May 31 13:17:34 2018 (r334429) @@ -98,6 +98,7 @@ struct pci_device_id { #define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) #define PCI_FUNC(devfn) ((devfn) & 0x07) +#define PCI_BUS_NUM(devfn) (((devfn) >> 8) & 0xff) #define PCI_VDEVICE(_vendor, _device) \ .vendor = PCI_VENDOR_ID_##_vendor, .device = (_device), \ From owner-svn-src-head@freebsd.org Thu May 31 13:26:13 2018 Return-Path: Delivered-To: svn-src-head@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 4FDFAFC7670; Thu, 31 May 2018 13:26:13 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 233AF8538F; Thu, 31 May 2018 13:26:13 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0456B1ABFB; Thu, 31 May 2018 13:26:13 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VDQCsZ089802; Thu, 31 May 2018 13:26:12 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VDQCVx089801; Thu, 31 May 2018 13:26:12 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201805311326.w4VDQCVx089801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Thu, 31 May 2018 13:26:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334430 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: brd X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 334430 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 13:26:13 -0000 Author: brd Date: Thu May 31 13:26:12 2018 New Revision: 334430 URL: https://svnweb.freebsd.org/changeset/base/334430 Log: Move all of the directory path into the DIR part of the component and make the NAME be only the filename. This makes it possible to use the DIR as part of the dep in the future. Approved by: bapt (mentor) Modified: head/share/mk/bsd.nls.mk Modified: head/share/mk/bsd.nls.mk ============================================================================== --- head/share/mk/bsd.nls.mk Thu May 31 13:17:34 2018 (r334429) +++ head/share/mk/bsd.nls.mk Thu May 31 13:26:12 2018 (r334430) @@ -71,12 +71,12 @@ STAGE_SYMLINKS_DIR.NLS= ${STAGE_OBJTOP} SYMLINKS+= ${NLSSYMLINKS} .endif .for file in ${NLS} -NLSNAME_${file:T}= ${file:T:R}/${NLSNAME}.cat +NLSDIR_${file:T}= ${NLSDIR}/${file:T:R} +NLSNAME_${file:T}= ${NLSNAME}.cat .if defined(NLSLINKS_${file:R}) && !empty(NLSLINKS_${file:R}) .if !empty(NLSLINKS_${file:R}:M${file:R}) .error NLSLINKS_${file:R} contains itself: ${file:R} .endif -NLSLINKS+= ${file:R} .endif .for dst in ${NLSLINKS_${file:R}} NLSSYMLINKS+= ../${file:R}/${NLSNAME}.cat ${NLSDIR}/${dst}/${NLSNAME}.cat From owner-svn-src-head@freebsd.org Thu May 31 14:23:34 2018 Return-Path: Delivered-To: svn-src-head@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 37463FD262E; Thu, 31 May 2018 14:23:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D412B68323; Thu, 31 May 2018 14:23:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B36E11B5CF; Thu, 31 May 2018 14:23:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VENXBX020240; Thu, 31 May 2018 14:23:33 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VENXwY020239; Thu, 31 May 2018 14:23:33 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201805311423.w4VENXwY020239@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 31 May 2018 14:23:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334431 - head/share/man/man3 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/man/man3 X-SVN-Commit-Revision: 334431 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 14:23:34 -0000 Author: imp Date: Thu May 31 14:23:33 2018 New Revision: 334431 URL: https://svnweb.freebsd.org/changeset/base/334431 Log: Depart from normal man page proactice a little and provide guidance on when to use assert, as well as providing a bad example of using assert. While not strictly necessary, experience has shown issues with poor assert choice happen often enough that this departure seems warranted. Also, tighten up the previous example (there's no need to have extra paragraphs or gratuitously long lines). Reviewed by: emaste@ (earlier version) Modified: head/share/man/man3/assert.3 Modified: head/share/man/man3/assert.3 ============================================================================== --- head/share/man/man3/assert.3 Thu May 31 13:26:12 2018 (r334430) +++ head/share/man/man3/assert.3 Thu May 31 14:23:33 2018 (r334431) @@ -28,7 +28,7 @@ .\" @(#)assert.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd May 28, 2018 +.Dd May 31, 2018 .Dt ASSERT 3 .Os .Sh NAME @@ -44,8 +44,7 @@ macro tests the given .Ar expression and if it is false, the calling process is terminated. -A -diagnostic message is written to +A diagnostic message is written to .Dv stderr and the function .Xr abort 3 @@ -76,14 +75,26 @@ Each time whether or not is defined determines the behavior of assert from that point forward until the end of the unit or another include of .In assert.h . +.Pp +The +.Fn assert +macro should only be used for ensuring the developer's expectations +hold true. +It is not appropriate for regular run-time error detection. .Sh EXAMPLES The assertion: -.Pp .Dl "assert(1 == 0);" -.Pp generates a diagnostic message similar to the following: +.Dl "Assertion failed: (1 == 0), function main, file main.c, line 100." .Pp -.Dl "Assertion failed: (1 == 0), function main, file assertion.c, line 100." +The following assert tries to assert there was no partial read: +.Dl "assert(read(fd, buf, nbytes) == nbytes);" +However, there are two problems. +First, it checks for normal conditions, rather than conditions that +indicate a bug. +Second, the code will disappear if +.Dv NDEBUG +is defined, changing the semantics of the program. .Sh SEE ALSO .Xr abort2 2 , .Xr abort 3 From owner-svn-src-head@freebsd.org Thu May 31 14:38:15 2018 Return-Path: Delivered-To: svn-src-head@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 698ECFD426E; Thu, 31 May 2018 14:38:15 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F079690E1; Thu, 31 May 2018 14:38:15 +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 F03811B779; Thu, 31 May 2018 14:38:14 +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 w4VEcE5v025481; Thu, 31 May 2018 14:38:14 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VEcDwa025474; Thu, 31 May 2018 14:38:13 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201805311438.w4VEcDwa025474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 31 May 2018 14:38:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334432 - in head/stand: . common i386/gptboot i386/gptzfsboot i386/isoboot i386/zfsboot X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/stand: . common i386/gptboot i386/gptzfsboot i386/isoboot i386/zfsboot X-SVN-Commit-Revision: 334432 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 14:38:15 -0000 Author: dim Date: Thu May 31 14:38:13 2018 New Revision: 334432 URL: https://svnweb.freebsd.org/changeset/base/334432 Log: Fix build of stand with base gcc * Make autoboot() a static function in stand/common/boot.c, so it does not shadow local variables in gptboot.c and zfsboot.c. * Remove -Winline from the Makefiles for gptboot, gptzfsboot and zfsboot, as gcc will always fail to inline some functions, and there is nothing we can do about it. * For gcc <= 4.2.1, silence -Wuninitialized for isoboot, as it produces a false positive warning. * Remove deprecated and unnecessary -mcpu=i386 flag from stand/defs.mk, as there is already a -march=i386 flag further in the file. Reviewed by: imp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D15628 Modified: head/stand/common/boot.c head/stand/common/bootstrap.h head/stand/defs.mk head/stand/i386/gptboot/Makefile head/stand/i386/gptzfsboot/Makefile head/stand/i386/isoboot/Makefile head/stand/i386/zfsboot/Makefile Modified: head/stand/common/boot.c ============================================================================== --- head/stand/common/boot.c Thu May 31 14:23:33 2018 (r334431) +++ head/stand/common/boot.c Thu May 31 14:38:13 2018 (r334432) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" +static int autoboot(int timeout, char *prompt); static char *getbootfile(int try); static int loadakernel(int try, int argc, char* argv[]); @@ -157,7 +158,7 @@ autoboot_maybe() autoboot(-1, NULL); /* try to boot automatically */ } -int +static int autoboot(int timeout, char *prompt) { time_t when, otime, ntime; Modified: head/stand/common/bootstrap.h ============================================================================== --- head/stand/common/bootstrap.h Thu May 31 14:23:33 2018 (r334431) +++ head/stand/common/bootstrap.h Thu May 31 14:38:13 2018 (r334432) @@ -61,7 +61,6 @@ char *backslash(const char *str); int parse(int *argc, char ***argv, const char *str); /* boot.c */ -int autoboot(int timeout, char *prompt); void autoboot_maybe(void); int getrootmount(char *rootdev); Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Thu May 31 14:23:33 2018 (r334431) +++ head/stand/defs.mk Thu May 31 14:38:13 2018 (r334432) @@ -91,7 +91,7 @@ CFLAGS+= -m32 -mcpu=powerpc # build 32-bit and some 64-bit (lib*, efi). Centralize all the 32-bit magic here # and activate it when DO32 is explicitly defined to be 1. .if ${MACHINE_ARCH} == "amd64" && ${DO32:U0} == 1 -CFLAGS+= -m32 -mcpu=i386 +CFLAGS+= -m32 # LD_FLAGS is passed directly to ${LD}, not via ${CC}: LD_FLAGS+= -m elf_i386_fbsd AFLAGS+= --32 Modified: head/stand/i386/gptboot/Makefile ============================================================================== --- head/stand/i386/gptboot/Makefile Thu May 31 14:23:33 2018 (r334431) +++ head/stand/i386/gptboot/Makefile Thu May 31 14:38:13 2018 (r334432) @@ -37,7 +37,7 @@ CFLAGS+=-DBOOTPROG=\"gptboot\" \ -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ - -Winline -Wno-pointer-sign + -Wno-pointer-sign CFLAGS.gcc+= --param max-inline-insns-single=100 Modified: head/stand/i386/gptzfsboot/Makefile ============================================================================== --- head/stand/i386/gptzfsboot/Makefile Thu May 31 14:23:33 2018 (r334431) +++ head/stand/i386/gptzfsboot/Makefile Thu May 31 14:38:13 2018 (r334432) @@ -37,7 +37,7 @@ CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \ -Wall -Waggregate-return -Wbad-function-cast \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ - -Winline -Wno-pointer-sign + -Wno-pointer-sign CFLAGS.clang+= -Wno-tentative-definition-incomplete-type Modified: head/stand/i386/isoboot/Makefile ============================================================================== --- head/stand/i386/isoboot/Makefile Thu May 31 14:23:33 2018 (r334431) +++ head/stand/i386/isoboot/Makefile Thu May 31 14:38:13 2018 (r334432) @@ -36,6 +36,9 @@ CFLAGS+=-DBOOTPROG=\"isoboot\" \ -Winline -Wno-pointer-sign CFLAGS.gcc+= --param max-inline-insns-single=100 +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} <= 40201 +CFLAGS.gcc+= -Wno-uninitialized +.endif CFLAGS.clang+= -Oz ${CLANG_OPT_SMALL} LD_FLAGS+=${LD_FLAGS_BIN} Modified: head/stand/i386/zfsboot/Makefile ============================================================================== --- head/stand/i386/zfsboot/Makefile Thu May 31 14:23:33 2018 (r334431) +++ head/stand/i386/zfsboot/Makefile Thu May 31 14:38:13 2018 (r334432) @@ -34,8 +34,7 @@ CFLAGS+=-DBOOTPROG=\"zfsboot\" \ -I${BOOTSRC}/i386/boot2 \ -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ - -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ - -Winline + -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings CFLAGS.gcc+= --param max-inline-insns-single=100 .if ${MACHINE} == "amd64" From owner-svn-src-head@freebsd.org Thu May 31 14:42:10 2018 Return-Path: Delivered-To: svn-src-head@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 B065CFD49C1; Thu, 31 May 2018 14:42:10 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.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 14FF66963D; Thu, 31 May 2018 14:42:09 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w4VEg8rg077098; Thu, 31 May 2018 07:42:08 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w4VEg8c9077097; Thu, 31 May 2018 07:42:08 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201805311442.w4VEg8c9077097@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r334431 - head/share/man/man3 In-Reply-To: <201805311423.w4VENXwY020239@repo.freebsd.org> To: Warner Losh Date: Thu, 31 May 2018 07:42:08 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 14:42:10 -0000 > Author: imp > Date: Thu May 31 14:23:33 2018 > New Revision: 334431 > URL: https://svnweb.freebsd.org/changeset/base/334431 > > Log: > Depart from normal man page proactice a little and provide guidance on > when to use assert, as well as providing a bad example of using > assert. While not strictly necessary, experience has shown issues > with poor assert choice happen often enough that this departure seems > warranted. Also, tighten up the previous example (there's no need > to have extra paragraphs or gratuitously long lines). Thank you! > Reviewed by: emaste@ (earlier version) > > Modified: > head/share/man/man3/assert.3 > > Modified: head/share/man/man3/assert.3 > ============================================================================== > --- head/share/man/man3/assert.3 Thu May 31 13:26:12 2018 (r334430) > +++ head/share/man/man3/assert.3 Thu May 31 14:23:33 2018 (r334431) > @@ -28,7 +28,7 @@ > .\" @(#)assert.3 8.1 (Berkeley) 6/9/93 > .\" $FreeBSD$ > .\" > -.Dd May 28, 2018 > +.Dd May 31, 2018 > .Dt ASSERT 3 > .Os > .Sh NAME > @@ -44,8 +44,7 @@ macro tests the given > .Ar expression > and if it is false, > the calling process is terminated. > -A > -diagnostic message is written to > +A diagnostic message is written to > .Dv stderr > and the function > .Xr abort 3 > @@ -76,14 +75,26 @@ Each time whether or not > is defined determines the behavior of assert from that point forward > until the end of the unit or another include of > .In assert.h . > +.Pp > +The > +.Fn assert > +macro should only be used for ensuring the developer's expectations > +hold true. > +It is not appropriate for regular run-time error detection. > .Sh EXAMPLES > The assertion: > -.Pp > .Dl "assert(1 == 0);" > -.Pp > generates a diagnostic message similar to the following: > +.Dl "Assertion failed: (1 == 0), function main, file main.c, line 100." > .Pp > -.Dl "Assertion failed: (1 == 0), function main, file assertion.c, line 100." > +The following assert tries to assert there was no partial read: > +.Dl "assert(read(fd, buf, nbytes) == nbytes);" > +However, there are two problems. > +First, it checks for normal conditions, rather than conditions that > +indicate a bug. > +Second, the code will disappear if > +.Dv NDEBUG > +is defined, changing the semantics of the program. > .Sh SEE ALSO > .Xr abort2 2 , > .Xr abort 3 > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Thu May 31 14:54:02 2018 Return-Path: Delivered-To: svn-src-head@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 1C6F7FD5AD0; Thu, 31 May 2018 14:54:02 +0000 (UTC) (envelope-from ben@bwidawsk.net) Received: from mail.bwidawsk.net (zangief2.bwidawsk.net [107.170.211.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "bwidawsk.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC9A46A213; Thu, 31 May 2018 14:54:01 +0000 (UTC) (envelope-from ben@bwidawsk.net) Received: by mail.bwidawsk.net (Postfix, from userid 5001) id F3796123191; Thu, 31 May 2018 07:46:21 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on zangief.bwidawsk.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-1.0 required=4.1 tests=ALL_TRUSTED=-1 shortcircuit=no autolearn=no autolearn_force=no version=3.4.1 Received: from mail.bwidawsk.net (c-73-25-164-31.hsd1.or.comcast.net [73.25.164.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail.bwidawsk.net (Postfix) with ESMTPSA id AEA26123190; Thu, 31 May 2018 07:46:19 -0700 (PDT) Date: Thu, 31 May 2018 07:46:19 -0700 From: Ben Widawsky To: rgrimes@freebsd.org Cc: Warner Losh , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r334431 - head/share/man/man3 Message-ID: <20180531144619.jjy45q6elg2hanmi@mail.bwidawsk.net> Mail-Followup-To: rgrimes@freebsd.org, Warner Losh , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org References: <201805311423.w4VENXwY020239@repo.freebsd.org> <201805311442.w4VEg8c9077097@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201805311442.w4VEg8c9077097@pdx.rh.CN85.dnsmgr.net> User-Agent: NeoMutt/20180323 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 14:54:02 -0000 On 18-05-31 07:42:08, Rodney W. Grimes wrote: > > Author: imp > > Date: Thu May 31 14:23:33 2018 > > New Revision: 334431 > > URL: https://svnweb.freebsd.org/changeset/base/334431 > > > > Log: > > Depart from normal man page proactice a little and provide guidance on ^ typo > > when to use assert, as well as providing a bad example of using > > assert. While not strictly necessary, experience has shown issues > > with poor assert choice happen often enough that this departure seems > > warranted. Also, tighten up the previous example (there's no need > > to have extra paragraphs or gratuitously long lines). > > Thank you! > > > Reviewed by: emaste@ (earlier version) > > > > Modified: > > head/share/man/man3/assert.3 > > > > Modified: head/share/man/man3/assert.3 > > ============================================================================== > > --- head/share/man/man3/assert.3 Thu May 31 13:26:12 2018 (r334430) > > +++ head/share/man/man3/assert.3 Thu May 31 14:23:33 2018 (r334431) > > @@ -28,7 +28,7 @@ > > .\" @(#)assert.3 8.1 (Berkeley) 6/9/93 > > .\" $FreeBSD$ > > .\" > > -.Dd May 28, 2018 > > +.Dd May 31, 2018 > > .Dt ASSERT 3 > > .Os > > .Sh NAME > > @@ -44,8 +44,7 @@ macro tests the given > > .Ar expression > > and if it is false, > > the calling process is terminated. > > -A > > -diagnostic message is written to > > +A diagnostic message is written to > > .Dv stderr > > and the function > > .Xr abort 3 > > @@ -76,14 +75,26 @@ Each time whether or not > > is defined determines the behavior of assert from that point forward > > until the end of the unit or another include of > > .In assert.h . > > +.Pp > > +The > > +.Fn assert > > +macro should only be used for ensuring the developer's expectations > > +hold true. > > +It is not appropriate for regular run-time error detection. > > .Sh EXAMPLES > > The assertion: > > -.Pp > > .Dl "assert(1 == 0);" > > -.Pp > > generates a diagnostic message similar to the following: > > +.Dl "Assertion failed: (1 == 0), function main, file main.c, line 100." > > .Pp > > -.Dl "Assertion failed: (1 == 0), function main, file assertion.c, line 100." > > +The following assert tries to assert there was no partial read: > > +.Dl "assert(read(fd, buf, nbytes) == nbytes);" > > +However, there are two problems. > > +First, it checks for normal conditions, rather than conditions that > > +indicate a bug. > > +Second, the code will disappear if > > +.Dv NDEBUG > > +is defined, changing the semantics of the program. > > .Sh SEE ALSO > > .Xr abort2 2 , > > .Xr abort 3 > > > > > > -- > Rod Grimes rgrimes@freebsd.org > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" From owner-svn-src-head@freebsd.org Thu May 31 15:22:28 2018 Return-Path: Delivered-To: svn-src-head@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 6958BEF7427; Thu, 31 May 2018 15:22:28 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qt0-x244.google.com (mail-qt0-x244.google.com [IPv6:2607:f8b0:400d:c0d::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 032256BE38; Thu, 31 May 2018 15:22:28 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qt0-x244.google.com with SMTP id d3-v6so28275607qtp.11; Thu, 31 May 2018 08:22:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=I89NyOoix1XNxzbd134qrKy+lwlJkFrjR1K+FlgJCw4=; b=F9RBUVDO7MwxEuqbzxoURjz8EGTs7SFcxpwv9Jo7aBnN7sv42C93X/WDFEihuoGU6q PE0HLsGgsSBGVKEc4WuYPE1VZnbq2ywxsjzAXNYk+7jm9oDb2feEVigxAzdkpfVUKuQn mo28toghd0/903N27m4eydU8ABSMtxHFU02DshL94gHmwPONpJFd6JjSlIDmzHTQK9hj a+Jx2uLhYfkw9zBavGR6js6NsVvUfzMz36YiNXDylLqlb62ZR97AomHs/3h76LFvxWjR pENW5GKdm3ewkRJ7BzHPEb82JpytnX0WXHLnwVhXiForRrGY9O/Mk5KsWOemAAz1i5er LRsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=I89NyOoix1XNxzbd134qrKy+lwlJkFrjR1K+FlgJCw4=; b=ahW9IEovaGgi/P9DMgoKptRmhTjefxzuVOUKMNfFrIJ28uEiWWZsE5Obd9VyFAU8ZF ocIyfQQCyFvPm11A2UE2tUEpaYTZDXV/C8yJ7P0Q4q4Qc7tvIF+Ebbwxv9HNUL17T79t KOzgnMeCWYfjevTGSr9rDaYsH5Vz5mZqAdiB9s02I7q+k+Nep6ogql6SJ1jDGszffPIU QFqGKDVqNUFLnVYNGeZiVIiQSuxxzUZizcJsaOItyAQke55He6IC2eh4Vg14ZWKTck98 wHhspfu9frr+TFnjq/51+6jwa3qnRd0ybz9S60/TrpQu9t1aCwv5RKi06dbIkzVCMpvL uXYg== X-Gm-Message-State: APt69E1RnkqJvXRSqDRu55OLgFtT324JOMEhl8MCQxex7S0g5UsEci6T i68mxShZf8DjHBkdxFWdC91dDeRQgN4yGgNkZ5I= X-Google-Smtp-Source: ADUXVKIL5tdr0OLgh/7PxHCjeSUKCOTWG0xpReV8T/JQSFDWvFDhoZh0pOHgbPuFfLni/wp4lFiiM18IxM8irSqIbqY= X-Received: by 2002:aed:374a:: with SMTP id i68-v6mr7137779qtb.129.1527780147678; Thu, 31 May 2018 08:22:27 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac8:1c4e:0:0:0:0:0 with HTTP; Thu, 31 May 2018 08:22:27 -0700 (PDT) In-Reply-To: <20180531201225.L2478@besplex.bde.org> References: <201805310956.w4V9u2rL084194@repo.freebsd.org> <20180531201225.L2478@besplex.bde.org> From: Mateusz Guzik Date: Thu, 31 May 2018 17:22:27 +0200 Message-ID: Subject: Re: svn commit: r334419 - head/sys/amd64/amd64 To: Bruce Evans Cc: Mateusz Guzik , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 15:22:28 -0000 On Thu, May 31, 2018 at 09:19:58PM +1000, Bruce Evans wrote: > On Thu, 31 May 2018, Mateusz Guzik wrote: > > > Log: > > amd64: switch pagecopy from non-temporal stores to rep movsq > > As for pagezero, this pessimizes for machines with slow movsq and/or caches > (mostly older machines). > Can you give examples of such machines? I tested with old yellers like Nehalem and Westmere, no loss. > > The copied data is accessed in part soon after and it results with additional > > cache misses during a -j 1 buildkernel WITHOUT_CTF=yes KERNFAST=1, as measured > > with pmc stat. > > Of course it causes more cache misses later, but for large data going through > slow caches is much slower so the cache misses later cost less. > The note was predominantly for people who would want to defend nt stores claiming it prevents evicting cached data by data being copied and then mostly not accessed. As for speed diff, see above. > It is negatively useful to write this in asm. This is now just memcpy() > and the asm version of that is fast enough, though movsq takes too long > to start up. This memcpy() might be inlined and then it would be > insignificantly faster than the function call. __builtin_memcpy() won't > actually inline it, since its size is large and compilers know that they > don't understand memory. > It is true that currently it can be the current memcpy with almost no loss. However, even on a kernel with #define memcpy __builtin_memcpy, there are plenty of calls with very small sizes. See the list here (taken during buildkernel): https://people.freebsd.org/~mjg/bufsizes.txt In particular you can find a lot of < 64 entries. Spinning up rep stosb for such sizes even with ERMS turns out to be pessimal even on Skylake. In other words, the primitive will need to get special casing for small-sized callers. Known big-size callers should be moved to something else. As such, pointing pagecopy at the primitive is imo a bad idea. As was noted elsewhere the current ifunc support has an undesirable property of generating indirect calls. Whatever happens next (this gets fixed or abandoned perhaps), there will be a way to select appropriate routines at boot time. If you know of specific amd64 microarchs which benefit from nt stores in either pagzero or pagecopy, we can just special case them later. In the meantime, I find the current change to be in the right direction. -- Mateusz Guzik From owner-svn-src-head@freebsd.org Thu May 31 15:36:28 2018 Return-Path: Delivered-To: svn-src-head@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 D2573EF9044; Thu, 31 May 2018 15:36:27 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A60AB6CEAE; Thu, 31 May 2018 15:36:27 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6EC201C196; Thu, 31 May 2018 15:36:27 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VFaRWC055642; Thu, 31 May 2018 15:36:27 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VFaRXh055640; Thu, 31 May 2018 15:36:27 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201805311536.w4VFaRXh055640@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 31 May 2018 15:36:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334433 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 334433 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 15:36:28 -0000 Author: manu Date: Thu May 31 15:36:26 2018 New Revision: 334433 URL: https://svnweb.freebsd.org/changeset/base/334433 Log: aw_mmc: Rename clock register defines consistently Modified: head/sys/arm/allwinner/aw_mmc.c head/sys/arm/allwinner/aw_mmc.h Modified: head/sys/arm/allwinner/aw_mmc.c ============================================================================== --- head/sys/arm/allwinner/aw_mmc.c Thu May 31 14:38:13 2018 (r334432) +++ head/sys/arm/allwinner/aw_mmc.c Thu May 31 15:36:26 2018 (r334433) @@ -885,13 +885,13 @@ aw_mmc_update_clock(struct aw_mmc_softc *sc, uint32_t int retry; reg = AW_MMC_READ_4(sc, AW_MMC_CKCR); - reg &= ~(AW_MMC_CKCR_CCLK_ENB | AW_MMC_CKCR_CCLK_CTRL | - AW_MMC_CKCR_CCLK_MASK_DATA0); + reg &= ~(AW_MMC_CKCR_ENB | AW_MMC_CKCR_LOW_POWER | + AW_MMC_CKCR_MASK_DATA0); if (clkon) - reg |= AW_MMC_CKCR_CCLK_ENB; + reg |= AW_MMC_CKCR_ENB; if (sc->aw_mmc_conf->mask_data0) - reg |= AW_MMC_CKCR_CCLK_MASK_DATA0; + reg |= AW_MMC_CKCR_MASK_DATA0; AW_MMC_WRITE_4(sc, AW_MMC_CKCR, reg); @@ -913,7 +913,7 @@ aw_mmc_update_clock(struct aw_mmc_softc *sc, uint32_t if (sc->aw_mmc_conf->mask_data0) { reg = AW_MMC_READ_4(sc, AW_MMC_CKCR); - reg &= ~AW_MMC_CKCR_CCLK_MASK_DATA0; + reg &= ~AW_MMC_CKCR_MASK_DATA0; AW_MMC_WRITE_4(sc, AW_MMC_CKCR, reg); } @@ -1030,7 +1030,7 @@ aw_mmc_update_ios(device_t bus, device_t child) /* Reset the divider. */ reg = AW_MMC_READ_4(sc, AW_MMC_CKCR); - reg &= ~AW_MMC_CKCR_CCLK_DIV; + reg &= ~AW_MMC_CKCR_DIV; reg |= div - 1; AW_MMC_WRITE_4(sc, AW_MMC_CKCR, reg); Modified: head/sys/arm/allwinner/aw_mmc.h ============================================================================== --- head/sys/arm/allwinner/aw_mmc.h Thu May 31 14:38:13 2018 (r334432) +++ head/sys/arm/allwinner/aw_mmc.h Thu May 31 15:36:26 2018 (r334433) @@ -82,10 +82,10 @@ (AW_MMC_GCTL_SOFT_RST | AW_MMC_GCTL_FIFO_RST | AW_MMC_GCTL_DMA_RST) /* AW_MMC_CKCR */ -#define AW_MMC_CKCR_CCLK_ENB (1U << 16) -#define AW_MMC_CKCR_CCLK_CTRL (1U << 17) -#define AW_MMC_CKCR_CCLK_MASK_DATA0 (1U << 31) -#define AW_MMC_CKCR_CCLK_DIV 0xff +#define AW_MMC_CKCR_DIV 0xff +#define AW_MMC_CKCR_ENB (1U << 16) +#define AW_MMC_CKCR_LOW_POWER (1U << 17) +#define AW_MMC_CKCR_MASK_DATA0 (1U << 31) /* AW_MMC_TMOR */ #define AW_MMC_TMOR_RTO_LMT_SHIFT(x) x /* Response timeout limit */ From owner-svn-src-head@freebsd.org Thu May 31 15:39:40 2018 Return-Path: Delivered-To: svn-src-head@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 976C5EF9806; Thu, 31 May 2018 15:39:40 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0742D6D3C6; Thu, 31 May 2018 15:39:40 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D88141C197; Thu, 31 May 2018 15:39:39 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VFddq7055798; Thu, 31 May 2018 15:39:39 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VFdd8w055797; Thu, 31 May 2018 15:39:39 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201805311539.w4VFdd8w055797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 31 May 2018 15:39:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334434 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 334434 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 15:39:40 -0000 Author: manu Date: Thu May 31 15:39:39 2018 New Revision: 334434 URL: https://svnweb.freebsd.org/changeset/base/334434 Log: aw_mmc: Rework DMA - Calculate the number of segments based on the page size - Add some comments on dma function so it's easier to read - Only enable interrupts on the last dma segment - If the segments size is the max transfer size, use the special size 0 for the controller. - The max_data ivars is in block so calculate it properly. Modified: head/sys/arm/allwinner/aw_mmc.c Modified: head/sys/arm/allwinner/aw_mmc.c ============================================================================== --- head/sys/arm/allwinner/aw_mmc.c Thu May 31 15:36:26 2018 (r334433) +++ head/sys/arm/allwinner/aw_mmc.c Thu May 31 15:39:39 2018 (r334434) @@ -58,8 +58,10 @@ __FBSDID("$FreeBSD$"); #define AW_MMC_MEMRES 0 #define AW_MMC_IRQRES 1 #define AW_MMC_RESSZ 2 -#define AW_MMC_DMA_SEGS ((MAXPHYS / PAGE_SIZE) + 1) +#define AW_MMC_DMA_SEGS (PAGE_SIZE / sizeof(struct aw_mmc_dma_desc)) +#define AW_MMC_DMA_DESC_SIZE (sizeof(struct aw_mmc_dma_desc) * AW_MMC_DMA_SEGS) #define AW_MMC_DMA_FTRGLEVEL 0x20070008 + #define AW_MMC_RESET_RETRY 1000 #define CARD_ID_FREQUENCY 400000 @@ -335,34 +337,50 @@ aw_dma_desc_cb(void *arg, bus_dma_segment_t *segs, int static int aw_mmc_setup_dma(struct aw_mmc_softc *sc) { - int dma_desc_size, error; + int error; /* Allocate the DMA descriptor memory. */ - dma_desc_size = sizeof(struct aw_mmc_dma_desc) * AW_MMC_DMA_SEGS; - error = bus_dma_tag_create(bus_get_dma_tag(sc->aw_dev), - AW_MMC_DMA_ALIGN, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - dma_desc_size, 1, dma_desc_size, 0, NULL, NULL, &sc->aw_dma_tag); + error = bus_dma_tag_create( + bus_get_dma_tag(sc->aw_dev), /* parent */ + AW_MMC_DMA_ALIGN, 0, /* align, boundary */ + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg*/ + AW_MMC_DMA_DESC_SIZE, 1, /* maxsize, nsegment */ + AW_MMC_DMA_DESC_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lock, lockarg*/ + &sc->aw_dma_tag); if (error) return (error); + error = bus_dmamem_alloc(sc->aw_dma_tag, &sc->aw_dma_desc, - BUS_DMA_WAITOK | BUS_DMA_ZERO, &sc->aw_dma_map); + BUS_DMA_COHERENT | BUS_DMA_WAITOK | BUS_DMA_ZERO, + &sc->aw_dma_map); if (error) return (error); - error = bus_dmamap_load(sc->aw_dma_tag, sc->aw_dma_map, - sc->aw_dma_desc, dma_desc_size, aw_dma_desc_cb, sc, 0); + error = bus_dmamap_load(sc->aw_dma_tag, + sc->aw_dma_map, + sc->aw_dma_desc, AW_MMC_DMA_DESC_SIZE, + aw_dma_desc_cb, sc, 0); if (error) return (error); if (sc->aw_dma_map_err) return (sc->aw_dma_map_err); /* Create the DMA map for data transfers. */ - error = bus_dma_tag_create(bus_get_dma_tag(sc->aw_dev), - AW_MMC_DMA_ALIGN, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - sc->aw_mmc_conf->dma_xferlen * AW_MMC_DMA_SEGS, AW_MMC_DMA_SEGS, - sc->aw_mmc_conf->dma_xferlen, BUS_DMA_ALLOCNOW, NULL, NULL, + error = bus_dma_tag_create( + bus_get_dma_tag(sc->aw_dev), /* parent */ + AW_MMC_DMA_ALIGN, 0, /* align, boundary */ + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg*/ + sc->aw_mmc_conf->dma_xferlen * + AW_MMC_DMA_SEGS, AW_MMC_DMA_SEGS, /* maxsize, nsegments */ + sc->aw_mmc_conf->dma_xferlen, /* maxsegsize */ + BUS_DMA_ALLOCNOW, /* flags */ + NULL, NULL, /* lock, lockarg*/ &sc->aw_dma_buf_tag); if (error) return (error); @@ -389,22 +407,23 @@ aw_dma_cb(void *arg, bus_dma_segment_t *segs, int nseg dma_desc = sc->aw_dma_desc; for (i = 0; i < nsegs; i++) { - dma_desc[i].buf_size = segs[i].ds_len; + if (segs[i].ds_len == sc->aw_mmc_conf->dma_xferlen) + dma_desc[i].buf_size = 0; /* Size of 0 indicate max len */ + else + dma_desc[i].buf_size = segs[i].ds_len; dma_desc[i].buf_addr = segs[i].ds_addr; dma_desc[i].config = AW_MMC_DMA_CONFIG_CH | - AW_MMC_DMA_CONFIG_OWN; - if (i == 0) - dma_desc[i].config |= AW_MMC_DMA_CONFIG_FD; - if (i < (nsegs - 1)) { - dma_desc[i].config |= AW_MMC_DMA_CONFIG_DIC; - dma_desc[i].next = sc->aw_dma_desc_phys + - ((i + 1) * sizeof(struct aw_mmc_dma_desc)); - } else { - dma_desc[i].config |= AW_MMC_DMA_CONFIG_LD | - AW_MMC_DMA_CONFIG_ER; - dma_desc[i].next = 0; - } + AW_MMC_DMA_CONFIG_OWN | AW_MMC_DMA_CONFIG_DIC; + + dma_desc[i].next = sc->aw_dma_desc_phys + + ((i + 1) * sizeof(struct aw_mmc_dma_desc)); } + + dma_desc[0].config |= AW_MMC_DMA_CONFIG_FD; + dma_desc[nsegs - 1].config |= AW_MMC_DMA_CONFIG_LD | + AW_MMC_DMA_CONFIG_ER; + dma_desc[nsegs - 1].config &= ~AW_MMC_DMA_CONFIG_DIC; + dma_desc[nsegs - 1].next = 0; } static int @@ -472,7 +491,7 @@ aw_mmc_reset(struct aw_mmc_softc *sc) reg = AW_MMC_READ_4(sc, AW_MMC_GCTL); reg |= AW_MMC_GCTL_RESET; AW_MMC_WRITE_4(sc, AW_MMC_GCTL, reg); - timeout = 1000; + timeout = AW_MMC_RESET_RETRY; while (--timeout > 0) { if ((AW_MMC_READ_4(sc, AW_MMC_GCTL) & AW_MMC_GCTL_RESET) == 0) break; @@ -540,10 +559,10 @@ aw_mmc_req_done(struct aw_mmc_softc *sc) retry = AW_MMC_RESET_RETRY; while (--retry > 0) { - val = AW_MMC_READ_4(sc, AW_MMC_GCTL); - if ((val & mask) == 0) + if ((AW_MMC_READ_4(sc, AW_MMC_GCTL) & + AW_MMC_GCTL_RESET) == 0) break; - DELAY(10); + DELAY(100); } if (retry == 0) device_printf(sc->aw_dev, @@ -688,6 +707,7 @@ aw_mmc_request(device_t bus, device_t child, struct mm int err; sc = device_get_softc(bus); + AW_MMC_LOCK(sc); if (sc->aw_req) { AW_MMC_UNLOCK(sc); @@ -819,7 +839,8 @@ aw_mmc_read_ivar(device_t bus, device_t child, int whi *(int *)result = sc->aw_host.ios.timing; break; case MMCBR_IVAR_MAX_DATA: - *(int *)result = 65535; + *(int *)result = (sc->aw_mmc_conf->dma_xferlen * + AW_MMC_DMA_SEGS) / MMC_SECTOR_SIZE; break; } From owner-svn-src-head@freebsd.org Thu May 31 15:41:01 2018 Return-Path: Delivered-To: svn-src-head@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 7620DEF9ABE; Thu, 31 May 2018 15:41:01 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1DC226D663; Thu, 31 May 2018 15:41:01 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA7191C1BB; Thu, 31 May 2018 15:41:00 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VFf0QI056697; Thu, 31 May 2018 15:41:00 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VFf0x3056696; Thu, 31 May 2018 15:41:00 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201805311541.w4VFf0x3056696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 31 May 2018 15:41:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334435 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 334435 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 15:41:01 -0000 Author: manu Date: Thu May 31 15:41:00 2018 New Revision: 334435 URL: https://svnweb.freebsd.org/changeset/base/334435 Log: aw_mmc: Use the DEVMETHOD vccq for the IO line voltage MMC controller should use this and not set the voltage during update_ios. Modified: head/sys/arm/allwinner/aw_mmc.c Modified: head/sys/arm/allwinner/aw_mmc.c ============================================================================== --- head/sys/arm/allwinner/aw_mmc.c Thu May 31 15:39:39 2018 (r334434) +++ head/sys/arm/allwinner/aw_mmc.c Thu May 31 15:41:00 2018 (r334435) @@ -119,8 +119,6 @@ struct aw_mmc_softc { uint32_t aw_intr; uint32_t aw_intr_wait; void * aw_intrhand; - int32_t aw_vdd; - int32_t aw_vccq; regulator_t aw_reg_vmmc; regulator_t aw_reg_vqmmc; unsigned int aw_clock; @@ -941,15 +939,18 @@ aw_mmc_update_clock(struct aw_mmc_softc *sc, uint32_t return (0); } -static void -aw_mmc_set_vccq(struct aw_mmc_softc *sc, int32_t vccq) +static int +aw_mmc_switch_vccq(device_t bus, device_t child) { - int uvolt; + struct aw_mmc_softc *sc; + int uvolt, err; + sc = device_get_softc(bus); + if (sc->aw_reg_vqmmc == NULL) - return; + return EOPNOTSUPP; - switch (vccq) { + switch (sc->aw_host.ios.vccq) { case vccq_180: uvolt = 1800000; break; @@ -957,15 +958,19 @@ aw_mmc_set_vccq(struct aw_mmc_softc *sc, int32_t vccq) uvolt = 3300000; break; default: - return; + return EINVAL; } - if (regulator_set_voltage(sc->aw_reg_vqmmc, - uvolt, uvolt) != 0) + err = regulator_set_voltage(sc->aw_reg_vqmmc, uvolt, uvolt); + if (err != 0) { device_printf(sc->aw_dev, "Cannot set vqmmc to %d<->%d\n", uvolt, uvolt); + return (err); + } + + return (0); } static int @@ -1020,11 +1025,6 @@ aw_mmc_update_ios(device_t bus, device_t child) break; }; - if (ios->vccq != sc->aw_vccq) { - aw_mmc_set_vccq(sc, ios->vccq); - sc->aw_vccq = ios->vccq; - } - /* Enable ddr mode if needed */ reg = AW_MMC_READ_4(sc, AW_MMC_GCTL); if (ios->timing == bus_timing_uhs_ddr50 || @@ -1141,6 +1141,7 @@ static device_method_t aw_mmc_methods[] = { DEVMETHOD(mmcbr_update_ios, aw_mmc_update_ios), DEVMETHOD(mmcbr_request, aw_mmc_request), DEVMETHOD(mmcbr_get_ro, aw_mmc_get_ro), + DEVMETHOD(mmcbr_switch_vccq, aw_mmc_switch_vccq), DEVMETHOD(mmcbr_acquire_host, aw_mmc_acquire_host), DEVMETHOD(mmcbr_release_host, aw_mmc_release_host), From owner-svn-src-head@freebsd.org Thu May 31 15:41:57 2018 Return-Path: Delivered-To: svn-src-head@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 4350EEF9CD0; Thu, 31 May 2018 15:41:57 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E8A846DA05; Thu, 31 May 2018 15:41:56 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB3981C205; Thu, 31 May 2018 15:41:56 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VFfuWY060379; Thu, 31 May 2018 15:41:56 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VFfuiW060378; Thu, 31 May 2018 15:41:56 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201805311541.w4VFfuiW060378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 31 May 2018 15:41:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334436 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 334436 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 15:41:57 -0000 Author: manu Date: Thu May 31 15:41:56 2018 New Revision: 334436 URL: https://svnweb.freebsd.org/changeset/base/334436 Log: aw_mmc: Get max-frequency from the dtb If a max-frequency is supplied in the dtb use it, otherwise fallback to a default one of 52Mhz. Modified: head/sys/arm/allwinner/aw_mmc.c Modified: head/sys/arm/allwinner/aw_mmc.c ============================================================================== --- head/sys/arm/allwinner/aw_mmc.c Thu May 31 15:41:00 2018 (r334435) +++ head/sys/arm/allwinner/aw_mmc.c Thu May 31 15:41:56 2018 (r334436) @@ -182,7 +182,7 @@ aw_mmc_attach(device_t dev) struct aw_mmc_softc *sc; struct sysctl_ctx_list *ctx; struct sysctl_oid_list *tree; - uint32_t bus_width; + uint32_t bus_width, max_freq; phandle_t node; int error; @@ -277,7 +277,12 @@ aw_mmc_attach(device_t dev) } sc->aw_host.f_min = 400000; - sc->aw_host.f_max = 52000000; + + if (OF_getencprop(node, "max-frequency", &max_freq, + sizeof(uint32_t)) <= 0) + max_freq = 52000000; + sc->aw_host.f_max = max_freq; + sc->aw_host.host_ocr = MMC_OCR_320_330 | MMC_OCR_330_340; sc->aw_host.caps = MMC_CAP_HSPEED | MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | MMC_CAP_UHS_SDR50 | From owner-svn-src-head@freebsd.org Thu May 31 17:16:08 2018 Return-Path: Delivered-To: svn-src-head@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 8B0D0F767BA; Thu, 31 May 2018 17:16:08 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 722FB739C1; Thu, 31 May 2018 17:16:07 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 6FF9A42761F; Fri, 1 Jun 2018 03:15:59 +1000 (AEST) Date: Fri, 1 Jun 2018 03:15:58 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Mateusz Guzik cc: Bruce Evans , Mateusz Guzik , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334419 - head/sys/amd64/amd64 In-Reply-To: Message-ID: <20180601014718.D3606@besplex.bde.org> References: <201805310956.w4V9u2rL084194@repo.freebsd.org> <20180531201225.L2478@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=cIaQihWN c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=TZ2egrA8934hvDS3BXcA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 17:16:08 -0000 On Thu, 31 May 2018, Mateusz Guzik wrote: > On Thu, May 31, 2018 at 09:19:58PM +1000, Bruce Evans wrote: >> On Thu, 31 May 2018, Mateusz Guzik wrote: >> >>> Log: >>> amd64: switch pagecopy from non-temporal stores to rep movsq >> >> As for pagezero, this pessimizes for machines with slow movsq and/or > caches >> (mostly older machines). > > Can you give examples of such machines? I tested with old yellers like > Nehalem and Westmere, no loss. Original Athlon64, and Turion2 on a 2006 laptop. I already mentioned Turion64, and my commit to fix the loss of nontemporal pagezero on amd64 gives timing info for both in a mixed-up way (only the Athlon has PC3200). sse2_pagezero was actually connected at the time, but only to idlezero and that was removed soon after. Nontemporal stores are clearly best for idlezero, but doing anything in idle is not so good since it might wasted power or steal resources from a shared core or increase latency... It was good on the Turion2 in 2007. Turion2 doesn't have a shared core and or many Cx states so it uses almost as much power zeroing pages as idling. >>> The copied data is accessed in part soon after and it results with > additional >>> cache misses during a -j 1 buildkernel WITHOUT_CTF=yes KERNFAST=1, as > measured >>> with pmc stat. >> >> Of course it causes more cache misses later, but for large data going > through >> slow caches is much slower so the cache misses later cost less. > > The note was predominantly for people who would want to defend nt stores > claiming it prevents evicting cached data by data being copied and then > mostly not accessed. I read it more carefully and can interpret it to say the opposite of what you want. Since a new system gets no benefit in real time, the only significant differences are probably tiny power savings on new systems and slower runtimes on older systems. However, I saw tiny improvements in real time for makeworld with pagecopy = bcopy on Haswell. Well below 1%, while improvements for pagezero = bzero were closer to 1%. I now have better statistics generation and analysis and recently spent a lot of time trying to verify scheduler improvements of about 1%. >> It is negatively useful to write this in asm. This is now just memcpy() >> and the asm version of that is fast enough, though movsq takes too long >> to start up. This memcpy() might be inlined and then it would be >> insignificantly faster than the function call. __builtin_memcpy() won't >> actually inline it, since its size is large and compilers know that they >> don't understand memory. > > It is true that currently it can be the current memcpy with almost no loss. > > However, even on a kernel with #define memcpy __builtin_memcpy, there > are plenty of calls with very small sizes. See the list here (taken > during buildkernel): > > https://people.freebsd.org/~mjg/bufsizes.txt > > In particular you can find a lot of < 64 entries. But pagecopy is 4K. That is still too small to amortize string instruction overhead for Haswell in the cached case -- see my old mail -- by not much is to be gained by using a specialized version since the cached case is very fast. > Spinning up rep stosb for such sizes even with ERMS turns out to be > pessimal even on Skylake. In other words, the primitive will need to get > special casing for small-sized callers. Known big-size callers should be > moved to something else. As such, pointing pagecopy at the primitive is > imo a bad idea. That is with most current implementations of ERMS. I expect the startup overhead will be small after a couple more generations of CPUs. Then optimizations to not use string optimizations will be as silly as 30-year old optimizations to use them. Or my 20 year old optimizations to use the FPU for bcopy, bzero, copyin and copyout, but not pagezero or pagecopy. This optimization was good for just 1 generation of CPUs (Pentium1). i386 still has a silly 20 year old i686_pagezero which is still used on all i386's that don't have SSE2 (not many of these now). This would have been good for just 1 or 2 generations of CPUs (PentiumPro and maybe Celeron) if it were written correctly. It is intended to avoid writing zeros to cache lines that are already zero, as was good on PentiumPro. But it actually zeros almost everything after finding a nonzero byte. Thus it is a pessimization even on PentiumPro unless many pages passed to it are already all zero. Bruce From owner-svn-src-head@freebsd.org Thu May 31 19:36:26 2018 Return-Path: Delivered-To: svn-src-head@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 2B511FD19EF; Thu, 31 May 2018 19:36:26 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CDE2679B5C; Thu, 31 May 2018 19:36:25 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94BB71E88D; Thu, 31 May 2018 19:36:25 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VJaPEH077140; Thu, 31 May 2018 19:36:25 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VJaPDo077138; Thu, 31 May 2018 19:36:25 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201805311936.w4VJaPDo077138@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 31 May 2018 19:36:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334443 - head/sbin/dhclient X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sbin/dhclient X-SVN-Commit-Revision: 334443 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 19:36:26 -0000 Author: cem Date: Thu May 31 19:36:24 2018 New Revision: 334443 URL: https://svnweb.freebsd.org/changeset/base/334443 Log: dhclient(8): allow to supersede interface-mtu option In some cases broken DHCP servers might send invalid MTU value, so allow to use 'supersede' in dhclient.conf to override this. When superseded value is 0, MTU value is not updated at all. PR: 206721 Submitted by: novel@ Reported by: MFC after: 37 minutes (if you care about 11, please MFC to 11.2) Relnotes: yes (potentially surprising behavior change w/ broken dhcpd mtu) Differential Revision: https://reviews.freebsd.org/D15484 Modified: head/sbin/dhclient/dhclient.c head/sbin/dhclient/dhclient.conf.5 Modified: head/sbin/dhclient/dhclient.c ============================================================================== --- head/sbin/dhclient/dhclient.c Thu May 31 16:48:08 2018 (r334442) +++ head/sbin/dhclient/dhclient.c Thu May 31 19:36:24 2018 (r334443) @@ -849,11 +849,23 @@ bind_lease(struct interface_info *ip) opt = &ip->client->new->options[DHO_INTERFACE_MTU]; if (opt->len == sizeof(u_int16_t)) { - u_int16_t mtu = be16dec(opt->data); - if (mtu < MIN_MTU) - warning("mtu size %u < %d: ignored", (unsigned)mtu, MIN_MTU); + u_int16_t mtu = 0; + bool supersede = (ip->client->config->default_actions[DHO_INTERFACE_MTU] == + ACTION_SUPERSEDE); + + if (supersede) + mtu = getUShort(ip->client->config->defaults[DHO_INTERFACE_MTU].data); else + mtu = be16dec(opt->data); + + if (mtu < MIN_MTU) { + /* Treat 0 like a user intentionally doesn't want to change MTU and, + * therefore, warning is not needed */ + if (!supersede || mtu != 0) + warning("mtu size %u < %d: ignored", (unsigned)mtu, MIN_MTU); + } else { interface_set_mtu_unpriv(privfd, mtu); + } } /* Write out the new lease. */ Modified: head/sbin/dhclient/dhclient.conf.5 ============================================================================== --- head/sbin/dhclient/dhclient.conf.5 Thu May 31 16:48:08 2018 (r334442) +++ head/sbin/dhclient/dhclient.conf.5 Thu May 31 19:36:24 2018 (r334443) @@ -38,7 +38,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 1, 1997 +.Dd May 31, 2018 .Dt DHCLIENT.CONF 5 .Os .Sh NAME @@ -227,6 +227,14 @@ rather than any value supplied by the server, these va in the .Ic supersede statement. +.Pp +Some options values have special meaning: +.Bl -tag -width indent +.It Ar interface-mtu +Any server-supplied interface MTU is ignored by the client if a +.Ic supersede +zero value is configured. +.El .It Xo .Ic prepend No { Op Ar option declaration .Oo , Ar ... option declaration Oc } From owner-svn-src-head@freebsd.org Thu May 31 20:22:49 2018 Return-Path: Delivered-To: svn-src-head@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 4A3BCFDCFEA; Thu, 31 May 2018 20:22:49 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F0CC57CBF9; Thu, 31 May 2018 20:22:48 +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 D1BB91F0F0; Thu, 31 May 2018 20:22:48 +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 w4VKMm4N004300; Thu, 31 May 2018 20:22:48 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VKMlYf004294; Thu, 31 May 2018 20:22:47 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201805312022.w4VKMlYf004294@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 31 May 2018 20:22:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334445 - in head: lib/msun/amd64 lib/msun/i387 lib/msun/tests lib/msun/x86 sys/amd64/include sys/i386/include X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: lib/msun/amd64 lib/msun/i387 lib/msun/tests lib/msun/x86 sys/amd64/include sys/i386/include X-SVN-Commit-Revision: 334445 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 20:22:49 -0000 Author: dim Date: Thu May 31 20:22:47 2018 New Revision: 334445 URL: https://svnweb.freebsd.org/changeset/base/334445 Log: Resolve conflicts between macros in fenv.h and ieeefp.h This is a follow-up to r321483, which disabled -Wmacro-redefined for some lib/msun tests. If an application included both fenv.h and ieeefp.h, several macros such as __fldcw(), __fldenv() were defined in both headers, with slightly different arguments, leading to conflicts. Fix this by putting all the common macros in the machine-specific versions of ieeefp.h. Where needed, update the arguments in places where the macros are invoked. This also slightly reduces the differences between the amd64 and i386 versions of ieeefp.h. Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D15633 Modified: head/lib/msun/amd64/fenv.c head/lib/msun/i387/fenv.c head/lib/msun/tests/Makefile head/lib/msun/x86/fenv.h head/sys/amd64/include/ieeefp.h head/sys/i386/include/ieeefp.h Modified: head/lib/msun/amd64/fenv.c ============================================================================== --- head/lib/msun/amd64/fenv.c Thu May 31 20:01:58 2018 (r334444) +++ head/lib/msun/amd64/fenv.c Thu May 31 20:22:47 2018 (r334445) @@ -60,12 +60,12 @@ fesetexceptflag(const fexcept_t *flagp, int excepts) __fnstenv(&env.__x87); env.__x87.__status &= ~excepts; env.__x87.__status |= *flagp & excepts; - __fldenv(env.__x87); + __fldenv(&env.__x87); __stmxcsr(&env.__mxcsr); env.__mxcsr &= ~excepts; env.__mxcsr |= *flagp & excepts; - __ldmxcsr(env.__mxcsr); + __ldmxcsr(&env.__mxcsr); return (0); } @@ -94,7 +94,7 @@ fegetenv(fenv_t *envp) * fnstenv masks all exceptions, so we need to restore the * control word to avoid this side effect. */ - __fldcw(envp->__x87.__control); + __fldcw(&envp->__x87.__control); return (0); } @@ -109,7 +109,7 @@ feholdexcept(fenv_t *envp) envp->__mxcsr = mxcsr; mxcsr &= ~FE_ALL_EXCEPT; mxcsr |= FE_ALL_EXCEPT << _SSE_EMASK_SHIFT; - __ldmxcsr(mxcsr); + __ldmxcsr(&mxcsr); return (0); } @@ -139,9 +139,9 @@ __feenableexcept(int mask) __stmxcsr(&mxcsr); omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT; control &= ~mask; - __fldcw(control); + __fldcw(&control); mxcsr &= ~(mask << _SSE_EMASK_SHIFT); - __ldmxcsr(mxcsr); + __ldmxcsr(&mxcsr); return (omask); } @@ -156,9 +156,9 @@ __fedisableexcept(int mask) __stmxcsr(&mxcsr); omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT; control |= mask; - __fldcw(control); + __fldcw(&control); mxcsr |= mask << _SSE_EMASK_SHIFT; - __ldmxcsr(mxcsr); + __ldmxcsr(&mxcsr); return (omask); } Modified: head/lib/msun/i387/fenv.c ============================================================================== --- head/lib/msun/i387/fenv.c Thu May 31 20:01:58 2018 (r334444) +++ head/lib/msun/i387/fenv.c Thu May 31 20:22:47 2018 (r334445) @@ -103,13 +103,13 @@ fesetexceptflag(const fexcept_t *flagp, int excepts) __fnstenv(&env); env.__status &= ~excepts; env.__status |= *flagp & excepts; - __fldenv(env); + __fldenv(&env); if (__HAS_SSE()) { __stmxcsr(&mxcsr); mxcsr &= ~excepts; mxcsr |= *flagp & excepts; - __ldmxcsr(mxcsr); + __ldmxcsr(&mxcsr); } return (0); @@ -139,7 +139,7 @@ fegetenv(fenv_t *envp) * fnstenv masks all exceptions, so we need to restore * the old control word to avoid this side effect. */ - __fldcw(envp->__control); + __fldcw(&envp->__control); if (__HAS_SSE()) { __stmxcsr(&mxcsr); __set_mxcsr(*envp, mxcsr); @@ -159,7 +159,7 @@ feholdexcept(fenv_t *envp) __set_mxcsr(*envp, mxcsr); mxcsr &= ~FE_ALL_EXCEPT; mxcsr |= FE_ALL_EXCEPT << _SSE_EMASK_SHIFT; - __ldmxcsr(mxcsr); + __ldmxcsr(&mxcsr); } return (0); } @@ -196,10 +196,10 @@ __feenableexcept(int mask) mxcsr = 0; omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT; control &= ~mask; - __fldcw(control); + __fldcw(&control); if (__HAS_SSE()) { mxcsr &= ~(mask << _SSE_EMASK_SHIFT); - __ldmxcsr(mxcsr); + __ldmxcsr(&mxcsr); } return (omask); } @@ -218,10 +218,10 @@ __fedisableexcept(int mask) mxcsr = 0; omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT; control |= mask; - __fldcw(control); + __fldcw(&control); if (__HAS_SSE()) { mxcsr |= mask << _SSE_EMASK_SHIFT; - __ldmxcsr(mxcsr); + __ldmxcsr(&mxcsr); } return (omask); } Modified: head/lib/msun/tests/Makefile ============================================================================== --- head/lib/msun/tests/Makefile Thu May 31 20:01:58 2018 (r334444) +++ head/lib/msun/tests/Makefile Thu May 31 20:22:47 2018 (r334445) @@ -84,10 +84,6 @@ SRCS.ilogb2_test= ilogb_test.c LIBADD+= m -.if ${MACHINE_CPUARCH} == "i386" -# XXX: __fldcw macro mismatch between fenv.h and ieeefp.h . -CWARNFLAGS.clang+= -Wno-error=macro-redefined -.endif WARNS?= 1 # Copied from lib/msun/Makefile Modified: head/lib/msun/x86/fenv.h ============================================================================== --- head/lib/msun/x86/fenv.h Thu May 31 20:01:58 2018 (r334444) +++ head/lib/msun/x86/fenv.h Thu May 31 20:22:47 2018 (r334445) @@ -33,6 +33,7 @@ #include #include +#include #ifndef __fenv_static #define __fenv_static static @@ -97,18 +98,10 @@ __BEGIN_DECLS extern const fenv_t __fe_dfl_env; #define FE_DFL_ENV (&__fe_dfl_env) -#define __fldcw(__cw) __asm __volatile("fldcw %0" : : "m" (__cw)) -#define __fldenv(__env) __asm __volatile("fldenv %0" : : "m" (__env)) #define __fldenvx(__env) __asm __volatile("fldenv %0" : : "m" (__env) \ : "st", "st(1)", "st(2)", "st(3)", "st(4)", \ "st(5)", "st(6)", "st(7)") -#define __fnclex() __asm __volatile("fnclex") -#define __fnstenv(__env) __asm __volatile("fnstenv %0" : "=m" (*(__env))) -#define __fnstcw(__cw) __asm __volatile("fnstcw %0" : "=m" (*(__cw))) -#define __fnstsw(__sw) __asm __volatile("fnstsw %0" : "=am" (*(__sw))) #define __fwait() __asm __volatile("fwait") -#define __ldmxcsr(__csr) __asm __volatile("ldmxcsr %0" : : "m" (__csr)) -#define __stmxcsr(__csr) __asm __volatile("stmxcsr %0" : "=m" (*(__csr))) int fegetenv(fenv_t *__envp); int feholdexcept(fenv_t *__envp); @@ -183,12 +176,12 @@ feclearexcept(int __excepts) } else { __fnstenv(&__env); __env.__status &= ~__excepts; - __fldenv(__env); + __fldenv(&__env); } if (__HAS_SSE()) { __stmxcsr(&__mxcsr); __mxcsr &= ~__excepts; - __ldmxcsr(__mxcsr); + __ldmxcsr(&__mxcsr); } return (0); } @@ -234,13 +227,13 @@ fesetround(int __round) __fnstcw(&__control); __control &= ~_ROUND_MASK; __control |= __round; - __fldcw(__control); + __fldcw(&__control); if (__HAS_SSE()) { __stmxcsr(&__mxcsr); __mxcsr &= ~(_ROUND_MASK << _SSE_ROUND_SHIFT); __mxcsr |= __round << _SSE_ROUND_SHIFT; - __ldmxcsr(__mxcsr); + __ldmxcsr(&__mxcsr); } return (0); @@ -264,7 +257,7 @@ fesetenv(const fenv_t *__envp) */ __fldenvx(__env); if (__HAS_SSE()) - __ldmxcsr(__mxcsr); + __ldmxcsr(&__mxcsr); return (0); } @@ -280,11 +273,11 @@ feclearexcept(int __excepts) } else { __fnstenv(&__env.__x87); __env.__x87.__status &= ~__excepts; - __fldenv(__env.__x87); + __fldenv(&__env.__x87); } __stmxcsr(&__env.__mxcsr); __env.__mxcsr &= ~__excepts; - __ldmxcsr(__env.__mxcsr); + __ldmxcsr(&__env.__mxcsr); return (0); } @@ -323,12 +316,12 @@ fesetround(int __round) __fnstcw(&__control); __control &= ~_ROUND_MASK; __control |= __round; - __fldcw(__control); + __fldcw(&__control); __stmxcsr(&__mxcsr); __mxcsr &= ~(_ROUND_MASK << _SSE_ROUND_SHIFT); __mxcsr |= __round << _SSE_ROUND_SHIFT; - __ldmxcsr(__mxcsr); + __ldmxcsr(&__mxcsr); return (0); } @@ -346,7 +339,7 @@ fesetenv(const fenv_t *__envp) * inlined, so we need to be more careful. */ __fldenvx(__envp->__x87); - __ldmxcsr(__envp->__mxcsr); + __ldmxcsr(&__envp->__mxcsr); return (0); } Modified: head/sys/amd64/include/ieeefp.h ============================================================================== --- head/sys/amd64/include/ieeefp.h Thu May 31 20:01:58 2018 (r334444) +++ head/sys/amd64/include/ieeefp.h Thu May 31 20:22:47 2018 (r334445) @@ -130,6 +130,7 @@ typedef enum { #define __fldcw(addr) __asm __volatile("fldcw %0" : : "m" (*(addr))) #define __fldenv(addr) __asm __volatile("fldenv %0" : : "m" (*(addr))) +#define __fnclex() __asm __volatile("fnclex") #define __fnstcw(addr) __asm __volatile("fnstcw %0" : "=m" (*(addr))) #define __fnstenv(addr) __asm __volatile("fnstenv %0" : "=m" (*(addr))) #define __fnstsw(addr) __asm __volatile("fnstsw %0" : "=m" (*(addr))) Modified: head/sys/i386/include/ieeefp.h ============================================================================== --- head/sys/i386/include/ieeefp.h Thu May 31 20:01:58 2018 (r334444) +++ head/sys/i386/include/ieeefp.h Thu May 31 20:22:47 2018 (r334445) @@ -116,6 +116,8 @@ typedef enum { #define __fnstcw(addr) __asm __volatile("fnstcw %0" : "=m" (*(addr))) #define __fnstenv(addr) __asm __volatile("fnstenv %0" : "=m" (*(addr))) #define __fnstsw(addr) __asm __volatile("fnstsw %0" : "=m" (*(addr))) +#define __ldmxcsr(addr) __asm __volatile("ldmxcsr %0" : : "m" (*(addr))) +#define __stmxcsr(addr) __asm __volatile("stmxcsr %0" : "=m" (*(addr))) /* * Load the control word. Be careful not to trap if there is a currently From owner-svn-src-head@freebsd.org Thu May 31 21:31:11 2018 Return-Path: Delivered-To: svn-src-head@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 C5151EFE9B1; Thu, 31 May 2018 21:31:10 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9906C80D85; Thu, 31 May 2018 21:31:10 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B7D31FAB2; Thu, 31 May 2018 21:31:10 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VLVAUk038648; Thu, 31 May 2018 21:31:10 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VLV9Q2038641; Thu, 31 May 2018 21:31:09 GMT (envelope-from np@FreeBSD.org) Message-Id: <201805312131.w4VLV9Q2038641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 31 May 2018 21:31:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334447 - in head/sys: conf dev/cxgbe modules/cxgbe/if_cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys: conf dev/cxgbe modules/cxgbe/if_cxgbe X-SVN-Commit-Revision: 334447 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 21:31:11 -0000 Author: np Date: Thu May 31 21:31:08 2018 New Revision: 334447 URL: https://svnweb.freebsd.org/changeset/base/334447 Log: cxgbe(4): Add code to deal with the chip's source MAC table (aka SMT). Submitted by: Krishnamraju Eraparaju @ Chelsio Sponsored by: Chelsio Communications Added: head/sys/dev/cxgbe/t4_smt.c (contents, props changed) head/sys/dev/cxgbe/t4_smt.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_main.c head/sys/modules/cxgbe/if_cxgbe/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu May 31 21:22:09 2018 (r334446) +++ head/sys/conf/files Thu May 31 21:31:08 2018 (r334447) @@ -1409,6 +1409,8 @@ dev/cxgbe/t4_sched.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/t4_sge.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" +dev/cxgbe/t4_smt.c optional cxgbe pci \ + compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/t4_l2t.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/t4_tracer.c optional cxgbe pci \ Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Thu May 31 21:22:09 2018 (r334446) +++ head/sys/dev/cxgbe/adapter.h Thu May 31 21:31:08 2018 (r334447) @@ -824,6 +824,7 @@ struct adapter { void *iscsi_ulp_softc; /* (struct cxgbei_data *) */ void *ccr_softc; /* (struct ccr_softc *) */ struct l2t_data *l2t; /* L2 table */ + struct smt_data *smt; /* Source MAC Table */ struct tid_info tids; uint8_t doorbells; Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu May 31 21:22:09 2018 (r334446) +++ head/sys/dev/cxgbe/t4_main.c Thu May 31 21:31:08 2018 (r334447) @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); #include "t4_l2t.h" #include "t4_mp_ring.h" #include "t4_if.h" +#include "t4_smt.h" /* T4 bus driver interface */ static int t4_probe(device_t); @@ -1105,6 +1106,7 @@ t4_attach(device_t dev) M_ZERO | M_WAITOK); t4_init_l2t(sc, M_WAITOK); + t4_init_smt(sc, M_WAITOK); t4_init_tx_sched(sc); #ifdef RATELIMIT t4_init_etid_table(sc); @@ -1379,6 +1381,8 @@ t4_detach_common(device_t dev) if (sc->l2t) t4_free_l2t(sc->l2t); + if (sc->smt) + t4_free_smt(sc->smt); #ifdef RATELIMIT t4_free_etid_table(sc); #endif @@ -5680,6 +5684,10 @@ t4_sysctls(struct adapter *sc) CTLTYPE_STRING | CTLFLAG_RD, sc, 0, sysctl_l2t, "A", "hardware L2 table"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "smt", + CTLTYPE_STRING | CTLFLAG_RD, sc, 0, + sysctl_smt, "A", "hardware source MAC table"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "lb_stats", CTLTYPE_STRING | CTLFLAG_RD, sc, 0, sysctl_lb_stats, "A", "loopback statistics"); @@ -10173,6 +10181,8 @@ mod_event(module_t mod, int cmd, void *arg) t4_del_hashfilter_rpl, CPL_COOKIE_HASHFILTER); t4_register_cpl_handler(CPL_TRACE_PKT, t4_trace_pkt); t4_register_cpl_handler(CPL_T5_TRACE_PKT, t5_trace_pkt); + t4_register_cpl_handler(CPL_SMT_WRITE_RPL, + do_smt_write_rpl); sx_init(&t4_list_lock, "T4/T5 adapters"); SLIST_INIT(&t4_list); #ifdef TCP_OFFLOAD Added: head/sys/dev/cxgbe/t4_smt.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/cxgbe/t4_smt.c Thu May 31 21:31:08 2018 (r334447) @@ -0,0 +1,346 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Chelsio Communications, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#include +__FBSDID("$FreeBSD$"); + +#include "opt_inet.h" +#include "opt_inet6.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "common/common.h" +#include "common/t4_msg.h" +#include "t4_smt.h" + +/* + * Module locking notes: There is a RW lock protecting the SMAC table as a + * whole plus a spinlock per SMT entry. Entry lookups and allocations happen + * under the protection of the table lock, individual entry changes happen + * while holding that entry's spinlock. The table lock nests outside the + * entry locks. Allocations of new entries take the table lock as writers so + * no other lookups can happen while allocating new entries. Entry updates + * take the table lock as readers so multiple entries can be updated in + * parallel. An SMT entry can be dropped by decrementing its reference count + * and therefore can happen in parallel with entry allocation but no entry + * can change state or increment its ref count during allocation as both of + * these perform lookups. + * + * Note: We do not take references to ifnets in this module because both + * the TOE and the sockets already hold references to the interfaces and the + * lifetime of an SMT entry is fully contained in the lifetime of the TOE. + */ + +/* + * Allocate a free SMT entry. Must be called with smt_data.lock held. + */ +struct smt_entry * +t4_find_or_alloc_sme(struct smt_data *s, uint8_t *smac) +{ + struct smt_entry *end, *e; + struct smt_entry *first_free = NULL; + + rw_assert(&s->lock, RA_WLOCKED); + for (e = &s->smtab[0], end = &s->smtab[s->smt_size]; e != end; ++e) { + if (atomic_load_acq_int(&e->refcnt) == 0) { + if (!first_free) + first_free = e; + } else { + if (e->state == SMT_STATE_SWITCHING) { + /* + * This entry is actually in use. See if we can + * re-use it? + */ + if (memcmp(e->smac, smac, ETHER_ADDR_LEN) == 0) + goto found_reuse; + } + } + } + if (first_free) { + e = first_free; + goto found; + } + return NULL; + +found: + e->state = SMT_STATE_UNUSED; +found_reuse: + atomic_add_int(&e->refcnt, 1); + return e; +} + +/* + * Write an SMT entry. Must be called with the entry locked. + */ +int +t4_write_sme(struct smt_entry *e) +{ + struct smt_data *s; + struct sge_wrq *wrq; + struct adapter *sc; + struct wrq_cookie cookie; + struct cpl_smt_write_req *req; + struct cpl_t6_smt_write_req *t6req; + u8 row; + + mtx_assert(&e->lock, MA_OWNED); + + MPASS(e->wrq != NULL); + wrq = e->wrq; + sc = wrq->adapter; + MPASS(wrq->adapter != NULL); + s = sc->smt; + + + if (chip_id(sc) <= CHELSIO_T5) { + /* Source MAC Table (SMT) contains 256 SMAC entries + * organized in 128 rows of 2 entries each. + */ + req = start_wrq_wr(wrq, howmany(sizeof(*req), 16), &cookie); + if (req == NULL) + return (ENOMEM); + INIT_TP_WR(req, 0); + /* Each row contains an SMAC pair. + * LSB selects the SMAC entry within a row + */ + row = (e->idx >> 1); + if (e->idx & 1) { + req->pfvf1 = 0x0; + memcpy(req->src_mac1, e->smac, ETHER_ADDR_LEN); + /* fill pfvf0/src_mac0 with entry + * at prev index from smt-tab. + */ + req->pfvf0 = 0x0; + memcpy(req->src_mac0, s->smtab[e->idx - 1].smac, + ETHER_ADDR_LEN); + } else { + req->pfvf0 = 0x0; + memcpy(req->src_mac0, e->smac, ETHER_ADDR_LEN); + /* fill pfvf1/src_mac1 with entry + * at next index from smt-tab + */ + req->pfvf1 = 0x0; + memcpy(req->src_mac1, s->smtab[e->idx + 1].smac, + ETHER_ADDR_LEN); + } + } else { + /* Source MAC Table (SMT) contains 256 SMAC entries */ + t6req = start_wrq_wr(wrq, howmany(sizeof(*t6req), 16), &cookie); + if (t6req == NULL) + return (ENOMEM); + INIT_TP_WR(t6req, 0); + req = (struct cpl_smt_write_req *)t6req; + + /* fill pfvf0/src_mac0 from smt-tab */ + req->pfvf0 = 0x0; + memcpy(req->src_mac0, s->smtab[e->idx].smac, ETHER_ADDR_LEN); + row = e->idx; + } + OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SMT_WRITE_REQ, e->idx | + V_TID_QID(e->iqid))); + req->params = htonl(V_SMTW_NORPL(0) | + V_SMTW_IDX(row) | + V_SMTW_OVLAN_IDX(0)); + + commit_wrq_wr(wrq, req, &cookie); + + return (0); +} + +/* + * Allocate an SMT entry for use by a switching rule. + */ +struct smt_entry * +t4_smt_alloc_switching(struct smt_data *s, uint8_t *smac) +{ + struct smt_entry *e; + + MPASS(s != NULL); + rw_wlock(&s->lock); + e = t4_find_or_alloc_sme(s, smac); + rw_wunlock(&s->lock); + return e; +} + +/* + * Sets/updates the contents of a switching SMT entry that has been allocated + * with an earlier call to @t4_smt_alloc_switching. + */ +int +t4_smt_set_switching(struct adapter *sc, struct smt_entry *e, uint16_t pfvf, + uint8_t *smac) +{ + int rc = 0; + + if (atomic_load_acq_int(&e->refcnt) == 1) { + /* Setup the entry for the first time */ + mtx_lock(&e->lock); + e->wrq = &sc->sge.mgmtq; + e->iqid = sc->sge.fwq.abs_id; + e->pfvf = pfvf; + e->state = SMT_STATE_SWITCHING; + memcpy(e->smac, smac, ETHER_ADDR_LEN); + rc = t4_write_sme(e); + mtx_unlock(&e->lock); + } + + return (rc); +} + +int +t4_init_smt(struct adapter *sc, int flags) +{ + int i, smt_size; + struct smt_data *s; + + smt_size = SMT_SIZE; + s = malloc(sizeof(*s) + smt_size * sizeof (struct smt_entry), M_CXGBE, + M_ZERO | flags); + if (!s) + return (ENOMEM); + + s->smt_size = smt_size; + rw_init(&s->lock, "SMT"); + + for (i = 0; i < smt_size; i++) { + struct smt_entry *e = &s->smtab[i]; + + e->idx = i; + e->state = SMT_STATE_UNUSED; + mtx_init(&e->lock, "SMT_E", NULL, MTX_DEF); + atomic_store_rel_int(&e->refcnt, 0); + } + + sc->smt = s; + + return (0); +} + +int +t4_free_smt(struct smt_data *s) +{ + int i; + + for (i = 0; i < s->smt_size; i++) + mtx_destroy(&s->smtab[i].lock); + rw_destroy(&s->lock); + free(s, M_CXGBE); + + return (0); +} + +int +do_smt_write_rpl(struct sge_iq *iq, const struct rss_header *rss, + struct mbuf *m) +{ + struct adapter *sc = iq->adapter; + const struct cpl_smt_write_rpl *rpl = (const void *)(rss + 1); + unsigned int tid = GET_TID(rpl); + unsigned int smtidx = G_TID_TID(tid); + + if (__predict_false(rpl->status != CPL_ERR_NONE)) { + struct smt_entry *e = &sc->smt->smtab[smtidx]; + log(LOG_ERR, + "Unexpected SMT_WRITE_RPL (%u) for entry at hw_idx %u\n", + rpl->status, smtidx); + mtx_lock(&e->lock); + e->state = SMT_STATE_ERROR; + mtx_unlock(&e->lock); + return (EINVAL); + } + + return (0); +} + +#ifdef SBUF_DRAIN +static char +smt_state(const struct smt_entry *e) +{ + switch (e->state) { + case SMT_STATE_SWITCHING: return 'X'; + case SMT_STATE_ERROR: return 'E'; + default: return 'U'; + } +} + +int +sysctl_smt(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + struct smt_data *smt = sc->smt; + struct smt_entry *e; + struct sbuf *sb; + int rc, i, header = 0; + + if (smt == NULL) + return (ENXIO); + + rc = sysctl_wire_old_buffer(req, 0); + if (rc != 0) + return (rc); + + sb = sbuf_new_for_sysctl(NULL, NULL, SMT_SIZE, req); + if (sb == NULL) + return (ENOMEM); + + e = &smt->smtab[0]; + for (i = 0; i < smt->smt_size; i++, e++) { + mtx_lock(&e->lock); + if (e->state == SMT_STATE_UNUSED) + goto skip; + + if (header == 0) { + sbuf_printf(sb, " Idx " + "Ethernet address State Users"); + header = 1; + } + sbuf_printf(sb, "\n%4u %02x:%02x:%02x:%02x:%02x:%02x " + "%c %5u", + e->idx, e->smac[0], e->smac[1], e->smac[2], + e->smac[3], e->smac[4], e->smac[5], + smt_state(e), atomic_load_acq_int(&e->refcnt)); +skip: + mtx_unlock(&e->lock); + } + + rc = sbuf_finish(sb); + sbuf_delete(sb); + + return (rc); +} +#endif Added: head/sys/dev/cxgbe/t4_smt.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/cxgbe/t4_smt.h Thu May 31 21:31:08 2018 (r334447) @@ -0,0 +1,92 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Chelsio Communications, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + * + */ + +#ifndef __T4_SMT_H +#define __T4_SMT_H + +/* identifies sync vs async SMT_WRITE_REQs */ +#define S_SYNC_WR 12 +#define V_SYNC_WR(x) ((x) << S_SYNC_WR) +#define F_SYNC_WR V_SYNC_WR(1) + +enum { SMT_SIZE = 256 }; /* # of SMT entries */ + +enum { + SMT_STATE_SWITCHING, /* entry is being used by a switching filter */ + SMT_STATE_UNUSED, /* entry not in use */ + SMT_STATE_ERROR /* entry is in error state */ +}; + +struct smt_entry { + uint16_t state; /* entry state */ + uint16_t idx; /* entry index */ + uint32_t iqid; /* iqid for reply to write_sme */ + struct sge_wrq *wrq; /* queue to use for write_sme */ + uint16_t pfvf; /* pfvf number */ + volatile int refcnt; /* entry reference count */ + uint8_t smac[ETHER_ADDR_LEN]; /* source MAC address */ + struct mtx lock; +}; + +struct smt_data { + struct rwlock lock; + u_int smt_size; + struct smt_entry smtab[]; +}; + + +int t4_init_smt(struct adapter *, int); +int t4_free_smt(struct smt_data *); +struct smt_entry *t4_find_or_alloc_sme(struct smt_data *, uint8_t *); +struct smt_entry *t4_smt_alloc_switching(struct smt_data *, uint8_t *); +int t4_smt_set_switching(struct adapter *, struct smt_entry *, + uint16_t, uint8_t *); +int t4_write_sme(struct smt_entry *); +int do_smt_write_rpl(struct sge_iq *, const struct rss_header *, struct mbuf *); + +static inline void +t4_smt_release(struct smt_entry *e) +{ + MPASS(e != NULL); + if (atomic_fetchadd_int(&e->refcnt, -1) == 1) { + mtx_lock(&e->lock); + e->state = SMT_STATE_UNUSED; + mtx_unlock(&e->lock); + } + +} + + +#ifdef SBUF_DRAIN +int sysctl_smt(SYSCTL_HANDLER_ARGS); +#endif + +#endif /* __T4_SMT_H */ Modified: head/sys/modules/cxgbe/if_cxgbe/Makefile ============================================================================== --- head/sys/modules/cxgbe/if_cxgbe/Makefile Thu May 31 21:22:09 2018 (r334446) +++ head/sys/modules/cxgbe/if_cxgbe/Makefile Thu May 31 21:31:08 2018 (r334447) @@ -25,6 +25,7 @@ SRCS+= t4_mp_ring.c SRCS+= t4_netmap.c SRCS+= t4_sched.c SRCS+= t4_sge.c +SRCS+= t4_smt.c SRCS+= t4_tracer.c SRCS+= cudbg_common.c SRCS+= cudbg_flash_utils.c From owner-svn-src-head@freebsd.org Thu May 31 21:53:09 2018 Return-Path: Delivered-To: svn-src-head@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 0F0D7F73391; Thu, 31 May 2018 21:53:09 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D93B982339; Thu, 31 May 2018 21:53:08 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BAB761FF55; Thu, 31 May 2018 21:53:08 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VLr8ut050321; Thu, 31 May 2018 21:53:08 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VLr7QY050316; Thu, 31 May 2018 21:53:07 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805312153.w4VLr7QY050316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Thu, 31 May 2018 21:53:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334450 - in head/sys: conf dev/random net sys X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: in head/sys: conf dev/random net sys X-SVN-Commit-Revision: 334450 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 21:53:09 -0000 Author: mmacy Date: Thu May 31 21:53:07 2018 New Revision: 334450 URL: https://svnweb.freebsd.org/changeset/base/334450 Log: Reduce overhead of entropy collection - move harvest mask check inline - move harvest mask to frequently_read out of actively modified cache line - disable ether_input collection and describe its limitations in NOTES Typically entropy collection in ether_input was stirring zero in to the entropy pool while at the same time greatly reducing max pps. This indicates that perhaps we should more closely scrutinize how much entropy we're getting from a given source as well as what our actual entropy collection needs are for seeding Yarrow. Reviewed by: cem, gallatin, delphij Approved by: secteam Differential Revision: https://reviews.freebsd.org/D15526 Modified: head/sys/conf/NOTES head/sys/conf/options head/sys/dev/random/random_harvestq.c head/sys/net/if_ethersubr.c head/sys/sys/random.h Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Thu May 31 21:42:45 2018 (r334449) +++ head/sys/conf/NOTES Thu May 31 21:53:07 2018 (r334450) @@ -2993,6 +2993,26 @@ options MAXFILES=999 # situations the value of doing this is dubious at best. options RANDOM_ENABLE_UMA # slab allocator +# Select this to allow high-rate but potentially expensive +# harvesting of of the m_next pointer in the mbuf. Note that +# the m_next pointer is NULL except when receiving > 4K +# jumbo frames or sustained bursts by way of LRO. Thus in +# the common case it is stirring zero in to the entropy +# pool. In cases where it is not NULL it is pointing to one +# of a small (in the thousands to 10s of thousands) number +# of 256 byte aligned mbufs. Hence it is, even in the best +# case, a poor source of entropy. And in the absence of actual +# runtime analysis of entropy collection may mislead the user in +# to believe that substantially more entropy is being collected +# than in fact is - leading to a different class of security +# risk. In high packet rate situations ethernet entropy +# collection is also very expensive, possibly leading to as +# much as a 50% drop in packets received. +# This option is present to maintain backwards compatibility +# if desired, however it cannot be recommended for use in any +# environment. +options RANDOM_ENABLE_ETHER # ether_input + # Module to enable execution of application via emulators like QEMU options IMAGACT_BINMISC Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Thu May 31 21:42:45 2018 (r334449) +++ head/sys/conf/options Thu May 31 21:53:07 2018 (r334450) @@ -982,6 +982,7 @@ RANDOM_LOADABLE opt_global.h # This turns on high-rate and potentially expensive harvesting in # the uma slab allocator. RANDOM_ENABLE_UMA opt_global.h +RANDOM_ENABLE_ETHER opt_global.h # BHND(4) driver BHND_LOGLEVEL opt_global.h Modified: head/sys/dev/random/random_harvestq.c ============================================================================== --- head/sys/dev/random/random_harvestq.c Thu May 31 21:42:45 2018 (r334449) +++ head/sys/dev/random/random_harvestq.c Thu May 31 21:53:07 2018 (r334450) @@ -80,6 +80,12 @@ static struct sysctl_ctx_list random_clist; /* 1 to let the kernel thread run, 0 to terminate, -1 to mark completion */ volatile int random_kthread_control; + +/* Allow the sysadmin to select the broad category of + * entropy types to harvest. + */ +__read_frequently u_int hc_source_mask; + /* * Put all the harvest queue context stuff in one place. * this make is a bit easier to lock and protect. @@ -93,10 +99,6 @@ static struct harvest_context { u_int hc_destination[ENTROPYSOURCE]; /* The context of the kernel thread processing harvested entropy */ struct proc *hc_kthread_proc; - /* Allow the sysadmin to select the broad category of - * entropy types to harvest. - */ - u_int hc_source_mask; /* * Lockless ring buffer holding entropy events * If ring.in == ring.out, @@ -248,7 +250,7 @@ random_check_uint_harvestmask(SYSCTL_HANDLER_ARGS) int error; u_int value, orig_value; - orig_value = value = harvest_context.hc_source_mask; + orig_value = value = hc_source_mask; error = sysctl_handle_int(oidp, &value, 0, req); if (error != 0 || req->newptr == NULL) return (error); @@ -259,7 +261,7 @@ random_check_uint_harvestmask(SYSCTL_HANDLER_ARGS) /* * Disallow userspace modification of pure entropy sources. */ - harvest_context.hc_source_mask = (value & ~RANDOM_HARVEST_PURE_MASK) | + hc_source_mask = (value & ~RANDOM_HARVEST_PURE_MASK) | (orig_value & RANDOM_HARVEST_PURE_MASK); return (0); } @@ -275,7 +277,7 @@ random_print_harvestmask(SYSCTL_HANDLER_ARGS) if (error == 0) { sbuf_new_for_sysctl(&sbuf, NULL, 128, req); for (i = ENTROPYSOURCE - 1; i >= 0; i--) - sbuf_cat(&sbuf, (harvest_context.hc_source_mask & (1 << i)) ? "1" : "0"); + sbuf_cat(&sbuf, (hc_source_mask & (1 << i)) ? "1" : "0"); error = sbuf_finish(&sbuf); sbuf_delete(&sbuf); } @@ -322,13 +324,13 @@ random_print_harvestmask_symbolic(SYSCTL_HANDLER_ARGS) sbuf_new_for_sysctl(&sbuf, NULL, 128, req); for (i = ENTROPYSOURCE - 1; i >= 0; i--) { if (i >= RANDOM_PURE_START && - (harvest_context.hc_source_mask & (1 << i)) == 0) + (hc_source_mask & (1 << i)) == 0) continue; if (!first) sbuf_cat(&sbuf, ","); - sbuf_cat(&sbuf, !(harvest_context.hc_source_mask & (1 << i)) ? "[" : ""); + sbuf_cat(&sbuf, !(hc_source_mask & (1 << i)) ? "[" : ""); sbuf_cat(&sbuf, random_source_descr[i]); - sbuf_cat(&sbuf, !(harvest_context.hc_source_mask & (1 << i)) ? "]" : ""); + sbuf_cat(&sbuf, !(hc_source_mask & (1 << i)) ? "]" : ""); first = false; } error = sbuf_finish(&sbuf); @@ -347,7 +349,7 @@ random_harvestq_init(void *unused __unused) SYSCTL_STATIC_CHILDREN(_kern_random), OID_AUTO, "harvest", CTLFLAG_RW, 0, "Entropy Device Parameters"); - harvest_context.hc_source_mask = RANDOM_HARVEST_EVERYTHING_MASK; + hc_source_mask = RANDOM_HARVEST_EVERYTHING_MASK; SYSCTL_ADD_PROC(&random_clist, SYSCTL_CHILDREN(random_sys_o), OID_AUTO, "mask", CTLTYPE_UINT | CTLFLAG_RW, @@ -448,14 +450,13 @@ SYSUNINIT(random_device_h_init, SI_SUB_RANDOM, SI_ORDE * read which can be quite expensive. */ void -random_harvest_queue(const void *entropy, u_int size, u_int bits, enum random_entropy_source origin) +random_harvest_queue_(const void *entropy, u_int size, u_int bits, + enum random_entropy_source origin) { struct harvest_event *event; u_int ring_in; KASSERT(origin >= RANDOM_START && origin < ENTROPYSOURCE, ("%s: origin %d invalid\n", __func__, origin)); - if (!(harvest_context.hc_source_mask & (1 << origin))) - return; RANDOM_HARVEST_LOCK(); ring_in = (harvest_context.hc_entropy_ring.in + 1)%RANDOM_RING_MAX; if (ring_in != harvest_context.hc_entropy_ring.out) { @@ -486,14 +487,10 @@ random_harvest_queue(const void *entropy, u_int size, * This is the right place for high-rate harvested data. */ void -random_harvest_fast(const void *entropy, u_int size, u_int bits, enum random_entropy_source origin) +random_harvest_fast_(const void *entropy, u_int size, u_int bits) { u_int pos; - KASSERT(origin >= RANDOM_START && origin < ENTROPYSOURCE, ("%s: origin %d invalid\n", __func__, origin)); - /* XXX: FIX!! The above KASSERT is BS. Right now we ignore most structure and just accumulate the supplied data */ - if (!(harvest_context.hc_source_mask & (1 << origin))) - return; pos = harvest_context.hc_entropy_fast_accumulator.pos; harvest_context.hc_entropy_fast_accumulator.buf[pos] ^= jenkins_hash(entropy, size, (uint32_t)get_cyclecount()); harvest_context.hc_entropy_fast_accumulator.pos = (pos + 1)%RANDOM_ACCUM_MAX; @@ -506,13 +503,11 @@ random_harvest_fast(const void *entropy, u_int size, u * (e.g.) booting when initial entropy is being gathered. */ void -random_harvest_direct(const void *entropy, u_int size, u_int bits, enum random_entropy_source origin) +random_harvest_direct_(const void *entropy, u_int size, u_int bits, enum random_entropy_source origin) { struct harvest_event event; KASSERT(origin >= RANDOM_START && origin < ENTROPYSOURCE, ("%s: origin %d invalid\n", __func__, origin)); - if (!(harvest_context.hc_source_mask & (1 << origin))) - return; size = MIN(size, sizeof(event.he_entropy)); event.he_somecounter = (uint32_t)get_cyclecount(); event.he_size = size; @@ -528,14 +523,14 @@ void random_harvest_register_source(enum random_entropy_source source) { - harvest_context.hc_source_mask |= (1 << source); + hc_source_mask |= (1 << source); } void random_harvest_deregister_source(enum random_entropy_source source) { - harvest_context.hc_source_mask &= ~(1 << source); + hc_source_mask &= ~(1 << source); } MODULE_VERSION(random_harvestq, 1); Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Thu May 31 21:42:45 2018 (r334449) +++ head/sys/net/if_ethersubr.c Thu May 31 21:53:07 2018 (r334450) @@ -513,7 +513,7 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m } eh = mtod(m, struct ether_header *); etype = ntohs(eh->ether_type); - random_harvest_queue(m, sizeof(*m), 2, RANDOM_NET_ETHER); + random_harvest_queue_ether(m, sizeof(*m), 2); CURVNET_SET_QUIET(ifp->if_vnet); Modified: head/sys/sys/random.h ============================================================================== --- head/sys/sys/random.h Thu May 31 21:42:45 2018 (r334449) +++ head/sys/sys/random.h Thu May 31 21:53:07 2018 (r334450) @@ -106,9 +106,38 @@ enum random_entropy_source { #define RANDOM_CACHED_SKIP_START 256 #if defined(DEV_RANDOM) -void random_harvest_queue(const void *, u_int, u_int, enum random_entropy_source); -void random_harvest_fast(const void *, u_int, u_int, enum random_entropy_source); -void random_harvest_direct(const void *, u_int, u_int, enum random_entropy_source); +extern u_int hc_source_mask; +void random_harvest_queue_(const void *, u_int, u_int, enum random_entropy_source); +void random_harvest_fast_(const void *, u_int, u_int); +void random_harvest_direct_(const void *, u_int, u_int, enum random_entropy_source); + +static __inline void +random_harvest_queue(const void *entropy, u_int size, u_int bits, + enum random_entropy_source origin) +{ + + if (hc_source_mask & (1 << origin)) + random_harvest_queue_(entropy, size, bits, origin); +} + +static __inline void +random_harvest_fast(const void *entropy, u_int size, u_int bits, + enum random_entropy_source origin) +{ + + if (hc_source_mask & (1 << origin)) + random_harvest_fast_(entropy, size, bits); +} + +static __inline void +random_harvest_direct(const void *entropy, u_int size, u_int bits, + enum random_entropy_source origin) +{ + + if (hc_source_mask & (1 << origin)) + random_harvest_direct_(entropy, size, bits, origin); +} + void random_harvest_register_source(enum random_entropy_source); void random_harvest_deregister_source(enum random_entropy_source); #else @@ -124,6 +153,13 @@ void random_harvest_deregister_source(enum random_entr #else /* !defined(RANDOM_ENABLE_UMA) */ #define random_harvest_fast_uma(a, b, c, d) do {} while (0) #endif /* defined(RANDOM_ENABLE_UMA) */ + +#if defined(RANDOM_ENABLE_ETHER) +#define random_harvest_queue_ether(a, b, c) random_harvest_queue(a, b, c, RANDOM_NET_ETHER) +#else /* !defined(RANDOM_ENABLE_ETHER) */ +#define random_harvest_queue_ether(a, b, c) do {} while (0) +#endif /* defined(RANDOM_ENABLE_ETHER) */ + #endif /* _KERNEL */ From owner-svn-src-head@freebsd.org Thu May 31 21:56:58 2018 Return-Path: Delivered-To: svn-src-head@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 654D9F73E33; Thu, 31 May 2018 21:56:58 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 177BB827C1; Thu, 31 May 2018 21:56:58 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE2A11FF6D; Thu, 31 May 2018 21:56:57 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VLuv2R050595; Thu, 31 May 2018 21:56:57 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VLuvBF050594; Thu, 31 May 2018 21:56:57 GMT (envelope-from np@FreeBSD.org) Message-Id: <201805312156.w4VLuvBF050594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 31 May 2018 21:56:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334452 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 334452 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 21:56:58 -0000 Author: np Date: Thu May 31 21:56:57 2018 New Revision: 334452 URL: https://svnweb.freebsd.org/changeset/base/334452 Log: cxgbe(4): Add support for SMAC-rewriting filters. Submitted by: Krishnamraju Eraparaju @ Chelsio Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_filter.c Modified: head/sys/dev/cxgbe/t4_filter.c ============================================================================== --- head/sys/dev/cxgbe/t4_filter.c Thu May 31 21:54:55 2018 (r334451) +++ head/sys/dev/cxgbe/t4_filter.c Thu May 31 21:56:57 2018 (r334452) @@ -50,14 +50,15 @@ __FBSDID("$FreeBSD$"); #include "common/t4_regs_values.h" #include "common/t4_tcb.h" #include "t4_l2t.h" +#include "t4_smt.h" struct filter_entry { uint32_t valid:1; /* filter allocated and valid */ uint32_t locked:1; /* filter is administratively locked or busy */ uint32_t pending:1; /* filter action is pending firmware reply */ - uint32_t smtidx:8; /* Source MAC Table index for smac */ int tid; /* tid of the filter TCB */ struct l2t_entry *l2te; /* L2 table entry for DMAC rewrite */ + struct smt_entry *smt; /* SMT entry for SMAC rewrite */ struct t4_filter_specification fs; }; @@ -65,7 +66,7 @@ struct filter_entry { static void free_filter_resources(struct filter_entry *); static int get_hashfilter(struct adapter *, struct t4_filter *); static int set_hashfilter(struct adapter *, struct t4_filter *, uint64_t, - struct l2t_entry *); + struct l2t_entry *, struct smt_entry *); static int del_hashfilter(struct adapter *, struct t4_filter *); static int configure_hashfilter_tcb(struct adapter *, struct filter_entry *); @@ -321,7 +322,7 @@ get_filter(struct adapter *sc, struct t4_filter *t) MPASS(f->tid == sc->tids.ftid_base + i); t->idx = i; t->l2tidx = f->l2te ? f->l2te->idx : 0; - t->smtidx = f->smtidx; + t->smtidx = f->smt ? f->smt->idx : 0; if (f->fs.hitcnts) t->hits = get_filter_hits(sc, f->tid); else @@ -338,7 +339,8 @@ done: } static int -set_tcamfilter(struct adapter *sc, struct t4_filter *t, struct l2t_entry *l2te) +set_tcamfilter(struct adapter *sc, struct t4_filter *t, struct l2t_entry *l2te, + struct smt_entry *smt) { struct filter_entry *f; struct fw_filter2_wr *fwr; @@ -383,6 +385,8 @@ set_tcamfilter(struct adapter *sc, struct t4_filter *t if (rc != 0) { if (l2te) t4_l2t_release(l2te); + if (smt) + t4_smt_release(smt); return (rc); } @@ -393,6 +397,7 @@ set_tcamfilter(struct adapter *sc, struct t4_filter *t f->tid = sc->tids.ftid_base + t->idx; f->fs = t->fs; f->l2te = l2te; + f->smt = smt; if (t->fs.val.pfvf_vld || t->fs.val.ovlan_vld) vnic_vld = 1; @@ -468,10 +473,8 @@ set_tcamfilter(struct adapter *sc, struct t4_filter *t fwr->lpm = htobe16(f->fs.mask.dport); fwr->fp = htobe16(f->fs.val.sport); fwr->fpm = htobe16(f->fs.mask.sport); - if (f->fs.newsmac) { - /* XXX: need to use SMT idx instead */ - bcopy(f->fs.smac, fwr->sma, sizeof (fwr->sma)); - } + /* sma = 0 tells the fw to use SMAC_SEL for source MAC address */ + bzero(fwr->sma, sizeof (fwr->sma)); if (sc->params.filter2_wr_support) { fwr->filter_type_swapmac = V_FW_FILTER2_WR_SWAPMAC(f->fs.swapmac); @@ -585,6 +588,7 @@ set_filter(struct adapter *sc, struct t4_filter *t) { struct tid_info *ti = &sc->tids; struct l2t_entry *l2te; + struct smt_entry *smt; uint64_t ftuple; int rc; @@ -690,22 +694,36 @@ done: l2te = t4_l2t_alloc_switching(sc->l2t); if (__predict_false(l2te == NULL)) return (EAGAIN); - if (t4_l2t_set_switching(sc, l2te, t->fs.vlan, t->fs.eport, - t->fs.dmac)) { + rc = t4_l2t_set_switching(sc, l2te, t->fs.vlan, t->fs.eport, + t->fs.dmac); + if (rc) { t4_l2t_release(l2te); return (ENOMEM); } } + smt = NULL; if (t->fs.newsmac) { - /* XXX: alloc SMT */ - return (ENOTSUP); + /* This filter needs an SMT entry; allocate one. */ + smt = t4_smt_alloc_switching(sc->smt, t->fs.smac); + if (__predict_false(smt == NULL)) { + if (l2te != NULL) + t4_l2t_release(l2te); + return (EAGAIN); + } + rc = t4_smt_set_switching(sc, smt, 0x0, t->fs.smac); + if (rc) { + t4_smt_release(smt); + if (l2te != NULL) + t4_l2t_release(l2te); + return (rc); + } } if (t->fs.hash) - return (set_hashfilter(sc, t, ftuple, l2te)); + return (set_hashfilter(sc, t, ftuple, l2te, smt)); else - return (set_tcamfilter(sc, t, l2te)); + return (set_tcamfilter(sc, t, l2te, smt)); } @@ -799,8 +817,47 @@ free_filter_resources(struct filter_entry *f) t4_l2t_release(f->l2te); f->l2te = NULL; } + if (f->smt) { + t4_smt_release(f->smt); + f->smt = NULL; + } } +static int +set_tcb_field(struct adapter *sc, u_int tid, uint16_t word, uint64_t mask, + uint64_t val, int no_reply) +{ + struct wrq_cookie cookie; + struct cpl_set_tcb_field *req; + + req = start_wrq_wr(&sc->sge.mgmtq, howmany(sizeof(*req), 16), &cookie); + if (req == NULL) + return (ENOMEM); + bzero(req, sizeof(*req)); + INIT_TP_WR_MIT_CPL(req, CPL_SET_TCB_FIELD, tid); + if (no_reply == 0) { + req->reply_ctrl = htobe16(V_QUEUENO(sc->sge.fwq.abs_id) | + V_NO_REPLY(0)); + } else + req->reply_ctrl = htobe16(V_NO_REPLY(1)); + req->word_cookie = htobe16(V_WORD(word) | V_COOKIE(CPL_COOKIE_HASHFILTER)); + req->mask = htobe64(mask); + req->val = htobe64(val); + commit_wrq_wr(&sc->sge.mgmtq, req, &cookie); + + return (0); +} + +/* Set one of the t_flags bits in the TCB. */ +static inline int +set_tcb_tflag(struct adapter *sc, int tid, u_int bit_pos, u_int val, + u_int no_reply) +{ + + return (set_tcb_field(sc, tid, W_TCB_T_FLAGS, 1ULL << bit_pos, + (uint64_t)val << bit_pos, no_reply)); +} + int t4_filter_rpl(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) { @@ -826,7 +883,14 @@ t4_filter_rpl(struct sge_iq *iq, const struct rss_head case FW_FILTER_WR_FLT_ADDED: /* set-filter succeeded */ f->valid = 1; - f->smtidx = (be64toh(rpl->oldval) >> 24) & 0xff; + if (f->fs.newsmac) { + MPASS(f->smt != NULL); + set_tcb_tflag(sc, f->tid, S_TF_CCTRL_CWR, 1, 1); + set_tcb_field(sc, f->tid, W_TCB_SMAC_SEL, + V_TCB_SMAC_SEL(M_TCB_SMAC_SEL), + V_TCB_SMAC_SEL(f->smt->idx), 1); + /* XXX: wait for reply to TCB update before !pending */ + } break; case FW_FILTER_WR_FLT_DELETED: /* del-filter succeeded */ @@ -995,7 +1059,7 @@ get_hashfilter(struct adapter *sc, struct t4_filter *t if (f != NULL && f->valid) { t->idx = i; t->l2tidx = f->l2te ? f->l2te->idx : 0; - t->smtidx = f->smtidx; + t->smtidx = f->smt ? f->smt->idx : 0; if (f->fs.hitcnts) t->hits = get_filter_hits(sc, t->idx); else @@ -1126,7 +1190,7 @@ act_open_cpl_len16(struct adapter *sc, int isipv6) static int set_hashfilter(struct adapter *sc, struct t4_filter *t, uint64_t ftuple, - struct l2t_entry *l2te) + struct l2t_entry *l2te, struct smt_entry *smt) { void *wr; struct wrq_cookie cookie; @@ -1150,16 +1214,21 @@ set_hashfilter(struct adapter *sc, struct t4_filter *t if (__predict_false(f == NULL)) { if (l2te) t4_l2t_release(l2te); + if (smt) + t4_smt_release(smt); rc = ENOMEM; goto done; } f->fs = t->fs; f->l2te = l2te; + f->smt = smt; atid = alloc_atid(sc, f); if (__predict_false(atid) == -1) { if (l2te) t4_l2t_release(l2te); + if (smt) + t4_smt_release(smt); free(f, M_CXGBE); rc = EAGAIN; goto done; @@ -1172,6 +1241,8 @@ set_hashfilter(struct adapter *sc, struct t4_filter *t free_atid(sc, atid); if (l2te) t4_l2t_release(l2te); + if (smt) + t4_smt_release(smt); free(f, M_CXGBE); rc = ENOMEM; goto done; @@ -1396,41 +1467,6 @@ done: return (rc); } -static int -set_tcb_field(struct adapter *sc, u_int tid, uint16_t word, uint64_t mask, - uint64_t val, int no_reply) -{ - struct wrq_cookie cookie; - struct cpl_set_tcb_field *req; - - req = start_wrq_wr(&sc->sge.mgmtq, howmany(sizeof(*req), 16), &cookie); - if (req == NULL) - return (ENOMEM); - bzero(req, sizeof(*req)); - INIT_TP_WR_MIT_CPL(req, CPL_SET_TCB_FIELD, tid); - if (no_reply == 0) { - req->reply_ctrl = htobe16(V_QUEUENO(sc->sge.fwq.abs_id) | - V_NO_REPLY(0)); - } else - req->reply_ctrl = htobe16(V_NO_REPLY(1)); - req->word_cookie = htobe16(V_WORD(word) | V_COOKIE(CPL_COOKIE_HASHFILTER)); - req->mask = htobe64(mask); - req->val = htobe64(val); - commit_wrq_wr(&sc->sge.mgmtq, req, &cookie); - - return (0); -} - -/* Set one of the t_flags bits in the TCB. */ -static inline int -set_tcb_tflag(struct adapter *sc, int tid, u_int bit_pos, u_int val, - u_int no_reply) -{ - - return (set_tcb_field(sc, tid, W_TCB_T_FLAGS, 1ULL << bit_pos, - (uint64_t)val << bit_pos, no_reply)); -} - #define WORD_MASK 0xffffffff static void set_nat_params(struct adapter *sc, struct filter_entry *f, const bool dip, @@ -1525,9 +1561,10 @@ configure_hashfilter_tcb(struct adapter *sc, struct fi } if (f->fs.newsmac) { + MPASS(f->smt != NULL); set_tcb_tflag(sc, f->tid, S_TF_CCTRL_CWR, 1, 1); set_tcb_field(sc, f->tid, W_TCB_SMAC_SEL, - V_TCB_SMAC_SEL(M_TCB_SMAC_SEL), V_TCB_SMAC_SEL(f->smtidx), + V_TCB_SMAC_SEL(M_TCB_SMAC_SEL), V_TCB_SMAC_SEL(f->smt->idx), 1); updated++; } From owner-svn-src-head@freebsd.org Thu May 31 22:26:52 2018 Return-Path: Delivered-To: svn-src-head@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 DB232F789B0; Thu, 31 May 2018 22:26:51 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 898D983E6E; Thu, 31 May 2018 22:26:51 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A9152043B; Thu, 31 May 2018 22:26:51 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VMQptJ065919; Thu, 31 May 2018 22:26:51 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VMQp92065918; Thu, 31 May 2018 22:26:51 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805312226.w4VMQp92065918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Thu, 31 May 2018 22:26:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334454 - head/lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/lib/libpmc X-SVN-Commit-Revision: 334454 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 22:26:52 -0000 Author: mmacy Date: Thu May 31 22:26:50 2018 New Revision: 334454 URL: https://svnweb.freebsd.org/changeset/base/334454 Log: libpmc: add pmu support for uncore events Modified: head/lib/libpmc/libpmc_pmu_util.c (contents, props changed) Modified: head/lib/libpmc/libpmc_pmu_util.c ============================================================================== --- head/lib/libpmc/libpmc_pmu_util.c Thu May 31 22:20:31 2018 (r334453) +++ head/lib/libpmc/libpmc_pmu_util.c Thu May 31 22:26:50 2018 (r334454) @@ -63,6 +63,18 @@ static struct pmu_alias pmu_alias_table[] = { {NULL, NULL}, }; +#ifdef notyet +static struct pmc_event_alias core2_aliases_without_iaf[] = { + EV_ALIAS("branches", "iap-br-inst-retired.any"), + EV_ALIAS("branch-mispredicts", "iap-br-inst-retired.mispred"), + EV_ALIAS("cycles", "tsc-tsc"), + EV_ALIAS("ic-misses", "iap-l1i-misses"), + EV_ALIAS("instructions", "iap-inst-retired.any_p"), + EV_ALIAS("interrupts", "iap-hw-int-rcv"), + EV_ALIAS("unhalted-cycles", "iap-cpu-clk-unhalted.core_p"), + EV_ALIAS(NULL, NULL) +}; +#endif static const char *fixed_mode_cntrs[] = { "inst_retired.any", "cpu_clk_unhalted.thread", @@ -300,7 +312,6 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc int idx, isfixed; iap = &pm->pm_md.pm_iap; - iaf = &pm->pm_md.pm_iaf; isfixed = 0; bzero(iap, sizeof(*iap)); event_name = pmu_alias_get(event_name); @@ -318,6 +329,8 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc if (strcmp(fixed_mode_cntrs[idx], event_name) == 0) isfixed = 1; if (isfixed) { + iaf = &pm->pm_md.pm_iaf; + pm->pm_class = PMC_CLASS_IAF; if (strcasestr(pe->desc, "retired") != NULL) pm->pm_ev = PMC_EV_IAF_INSTR_RETIRED_ANY; else if (strcasestr(pe->desc, "core") != NULL || @@ -330,11 +343,14 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc iaf->pm_iaf_flags |= IAF_ANY; if (pm->pm_caps & PMC_CAP_INTERRUPT) iaf->pm_iaf_flags |= IAF_PMI; - pm->pm_class = PMC_CLASS_IAF; return (0); + } else if (strcasestr(event_name, "UNC_") == event_name || + strcasestr(event_name, "uncore") != NULL) { + pm->pm_class = PMC_CLASS_UCP; + } else { + pm->pm_caps |= PMC_CAP_QUALIFIER; + pm->pm_class = PMC_CLASS_IAP; } - pm->pm_caps |= PMC_CAP_QUALIFIER; - pm->pm_class = PMC_CLASS_IAP; pm->pm_ev = idx; iap->pm_iap_config |= IAP_EVSEL(ped.ped_event); iap->pm_iap_config |= IAP_UMASK(ped.ped_umask); From owner-svn-src-head@freebsd.org Thu May 31 22:26:59 2018 Return-Path: Delivered-To: svn-src-head@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 34C36F78A34; Thu, 31 May 2018 22:26:59 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4699F83F4B; Thu, 31 May 2018 22:26:57 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18AD12043C; Thu, 31 May 2018 22:26:57 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VMQuAS065978; Thu, 31 May 2018 22:26:56 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VMQuts065974; Thu, 31 May 2018 22:26:56 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805312226.w4VMQuts065974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Thu, 31 May 2018 22:26:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334455 - in head: . lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: in head: . lib/libpmc X-SVN-Commit-Revision: 334455 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 22:26:59 -0000 Author: mmacy Date: Thu May 31 22:26:55 2018 New Revision: 334455 URL: https://svnweb.freebsd.org/changeset/base/334455 Log: libpmc/pmu: enable for i386 as well Modified: head/Makefile.inc1 head/Makefile.libcompat head/lib/libpmc/Makefile head/lib/libpmc/libpmc_pmu_util.c (contents, props changed) Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu May 31 22:26:50 2018 (r334454) +++ head/Makefile.inc1 Thu May 31 22:26:55 2018 (r334455) @@ -2030,7 +2030,7 @@ _tcsh=bin/csh _libmagic=lib/libmagic .endif -.if ${TARGET_ARCH} == "amd64" +.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" _jevents=lib/libpmc/pmu-events .endif Modified: head/Makefile.libcompat ============================================================================== --- head/Makefile.libcompat Thu May 31 22:26:50 2018 (r334454) +++ head/Makefile.libcompat Thu May 31 22:26:55 2018 (r334455) @@ -192,7 +192,7 @@ build${libcompat}: .PHONY DIRPRFX=${_dir}/ ${_t} .endfor .endfor -.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic +.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic lib/libpmc/pmu-events ${_+_}cd ${.CURDIR}/${_dir}; \ WORLDTMP=${WORLDTMP} \ MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ Modified: head/lib/libpmc/Makefile ============================================================================== --- head/lib/libpmc/Makefile Thu May 31 22:26:50 2018 (r334454) +++ head/lib/libpmc/Makefile Thu May 31 22:26:55 2018 (r334455) @@ -8,13 +8,13 @@ INCS= pmc.h pmclog.h CFLAGS+= -I${.CURDIR} -.if ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" -.if ${MACHINE_CPUARCH} == "aarch64" +.if ${MACHINE_ARCH} == "aarch64" EVENT_ARCH="arm64" -.elif ${MACHINE_CPUARCH} == "amd64" +.elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" EVENT_ARCH="x86" -.elif ${MACHINE_CPUARCH} == "powerpc" +.elif ${MACHINE_ARCH} == "powerpc" EVENT_ARCH="powerpc" .endif Modified: head/lib/libpmc/libpmc_pmu_util.c ============================================================================== --- head/lib/libpmc/libpmc_pmu_util.c Thu May 31 22:26:50 2018 (r334454) +++ head/lib/libpmc/libpmc_pmu_util.c Thu May 31 22:26:55 2018 (r334455) @@ -40,7 +40,7 @@ #include #include "pmu-events/pmu-events.h" -#if defined(__amd64__) +#if defined(__amd64__) || defined(__i386__) struct pmu_alias { const char *pa_alias; const char *pa_name; From owner-svn-src-head@freebsd.org Thu May 31 22:41:08 2018 Return-Path: Delivered-To: svn-src-head@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 499AAF7AD44; Thu, 31 May 2018 22:41:08 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F118784A47; Thu, 31 May 2018 22:41:07 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1F4E2060D; Thu, 31 May 2018 22:41:07 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VMf7XI071834; Thu, 31 May 2018 22:41:07 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VMf7Dr071833; Thu, 31 May 2018 22:41:07 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805312241.w4VMf7Dr071833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Thu, 31 May 2018 22:41:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334456 - in head: lib/libpmc sys/amd64/include sys/conf sys/dev/hwpmc sys/i386/include sys/modules/hwpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: in head: lib/libpmc sys/amd64/include sys/conf sys/dev/hwpmc sys/i386/include sys/modules/hwpmc X-SVN-Commit-Revision: 334456 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 22:41:08 -0000 Author: mmacy Date: Thu May 31 22:41:07 2018 New Revision: 334456 URL: https://svnweb.freebsd.org/changeset/base/334456 Log: hwpmc: remove unused pre-table driven bits for intel Intel now provides comprehensive tables for all performance counters and the various valid configuration permutations as text .json files. Libpmc has been converted to use these and hwpmc_core has been greatly simplified by moving to passthrough of the table values. The one gotcha is that said tables don't support pentium pro and and pentium IV. There's very few users of hwpmc on _amd64_ kernels on new hardware. It is unlikely that anyone is doing low level optimization on 15 year old Intel hardware. Nonetheless, if someone feels strongly enough to populate the corresponding tables for p4 and ppro I will reinstate the files in to the build. Code for the K8 counters and !x86 architectures remains unchanged. Deleted: head/sys/dev/hwpmc/hwpmc_pentium.c head/sys/dev/hwpmc/hwpmc_pentium.h head/sys/dev/hwpmc/hwpmc_piv.c head/sys/dev/hwpmc/hwpmc_piv.h head/sys/dev/hwpmc/hwpmc_ppro.c head/sys/dev/hwpmc/hwpmc_ppro.h Modified: head/lib/libpmc/libpmc.c head/sys/amd64/include/pmc_mdep.h head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/dev/hwpmc/hwpmc_core.c head/sys/dev/hwpmc/hwpmc_intel.c head/sys/dev/hwpmc/hwpmc_uncore.c head/sys/dev/hwpmc/hwpmc_uncore.h head/sys/dev/hwpmc/pmc_events.h head/sys/i386/include/pmc_mdep.h head/sys/modules/hwpmc/Makefile Modified: head/lib/libpmc/libpmc.c ============================================================================== --- head/lib/libpmc/libpmc.c Thu May 31 22:26:55 2018 (r334455) +++ head/lib/libpmc/libpmc.c Thu May 31 22:41:07 2018 (r334456) @@ -48,30 +48,10 @@ __FBSDID("$FreeBSD$"); #include "libpmcinternal.h" /* Function prototypes */ -#if defined(__i386__) -static int k7_allocate_pmc(enum pmc_event _pe, char *_ctrspec, - struct pmc_op_pmcallocate *_pmc_config); -#endif #if defined(__amd64__) || defined(__i386__) -static int iaf_allocate_pmc(enum pmc_event _pe, char *_ctrspec, - struct pmc_op_pmcallocate *_pmc_config); -static int iap_allocate_pmc(enum pmc_event _pe, char *_ctrspec, - struct pmc_op_pmcallocate *_pmc_config); -static int ucf_allocate_pmc(enum pmc_event _pe, char *_ctrspec, - struct pmc_op_pmcallocate *_pmc_config); -static int ucp_allocate_pmc(enum pmc_event _pe, char *_ctrspec, - struct pmc_op_pmcallocate *_pmc_config); static int k8_allocate_pmc(enum pmc_event _pe, char *_ctrspec, struct pmc_op_pmcallocate *_pmc_config); -static int p4_allocate_pmc(enum pmc_event _pe, char *_ctrspec, - struct pmc_op_pmcallocate *_pmc_config); #endif -#if defined(__i386__) -static int p5_allocate_pmc(enum pmc_event _pe, char *_ctrspec, - struct pmc_op_pmcallocate *_pmc_config); -static int p6_allocate_pmc(enum pmc_event _pe, char *_ctrspec, - struct pmc_op_pmcallocate *_pmc_config); -#endif #if defined(__amd64__) || defined(__i386__) static int tsc_allocate_pmc(enum pmc_event _pe, char *_ctrspec, struct pmc_op_pmcallocate *_pmc_config); @@ -157,18 +137,13 @@ struct pmc_class_descr { } PMC_CLASSDEP_TABLE(iaf, IAF); -PMC_CLASSDEP_TABLE(k7, K7); PMC_CLASSDEP_TABLE(k8, K8); -PMC_CLASSDEP_TABLE(p4, P4); -PMC_CLASSDEP_TABLE(p5, P5); -PMC_CLASSDEP_TABLE(p6, P6); PMC_CLASSDEP_TABLE(xscale, XSCALE); PMC_CLASSDEP_TABLE(armv7, ARMV7); PMC_CLASSDEP_TABLE(armv8, ARMV8); PMC_CLASSDEP_TABLE(mips24k, MIPS24K); PMC_CLASSDEP_TABLE(mips74k, MIPS74K); PMC_CLASSDEP_TABLE(octeon, OCTEON); -PMC_CLASSDEP_TABLE(ucf, UCF); PMC_CLASSDEP_TABLE(ppc7450, PPC7450); PMC_CLASSDEP_TABLE(ppc970, PPC970); PMC_CLASSDEP_TABLE(e500, E500); @@ -178,122 +153,6 @@ static struct pmc_event_descr soft_event_table[PMC_EV_ #undef __PMC_EV_ALIAS #define __PMC_EV_ALIAS(N,CODE) { N, PMC_EV_##CODE }, -static const struct pmc_event_descr atom_event_table[] = -{ - __PMC_EV_ALIAS_ATOM() -}; - -static const struct pmc_event_descr atom_silvermont_event_table[] = -{ - __PMC_EV_ALIAS_ATOM_SILVERMONT() -}; - -static const struct pmc_event_descr core_event_table[] = -{ - __PMC_EV_ALIAS_CORE() -}; - - -static const struct pmc_event_descr core2_event_table[] = -{ - __PMC_EV_ALIAS_CORE2() -}; - -static const struct pmc_event_descr corei7_event_table[] = -{ - __PMC_EV_ALIAS_COREI7() -}; - -static const struct pmc_event_descr nehalem_ex_event_table[] = -{ - __PMC_EV_ALIAS_COREI7() -}; - -static const struct pmc_event_descr haswell_event_table[] = -{ - __PMC_EV_ALIAS_HASWELL() -}; - -static const struct pmc_event_descr haswell_xeon_event_table[] = -{ - __PMC_EV_ALIAS_HASWELL_XEON() -}; - -static const struct pmc_event_descr broadwell_event_table[] = -{ - __PMC_EV_ALIAS_BROADWELL() -}; - -static const struct pmc_event_descr broadwell_xeon_event_table[] = -{ - __PMC_EV_ALIAS_BROADWELL_XEON() -}; - -static const struct pmc_event_descr skylake_event_table[] = -{ - __PMC_EV_ALIAS_SKYLAKE() -}; - -static const struct pmc_event_descr skylake_xeon_event_table[] = -{ - __PMC_EV_ALIAS_SKYLAKE_XEON() -}; - -static const struct pmc_event_descr ivybridge_event_table[] = -{ - __PMC_EV_ALIAS_IVYBRIDGE() -}; - -static const struct pmc_event_descr ivybridge_xeon_event_table[] = -{ - __PMC_EV_ALIAS_IVYBRIDGE_XEON() -}; - -static const struct pmc_event_descr sandybridge_event_table[] = -{ - __PMC_EV_ALIAS_SANDYBRIDGE() -}; - -static const struct pmc_event_descr sandybridge_xeon_event_table[] = -{ - __PMC_EV_ALIAS_SANDYBRIDGE_XEON() -}; - -static const struct pmc_event_descr westmere_event_table[] = -{ - __PMC_EV_ALIAS_WESTMERE() -}; - -static const struct pmc_event_descr westmere_ex_event_table[] = -{ - __PMC_EV_ALIAS_WESTMERE() -}; - -static const struct pmc_event_descr corei7uc_event_table[] = -{ - __PMC_EV_ALIAS_COREI7UC() -}; - -static const struct pmc_event_descr haswelluc_event_table[] = -{ - __PMC_EV_ALIAS_HASWELLUC() -}; - -static const struct pmc_event_descr broadwelluc_event_table[] = -{ - __PMC_EV_ALIAS_BROADWELLUC() -}; - -static const struct pmc_event_descr sandybridgeuc_event_table[] = -{ - __PMC_EV_ALIAS_SANDYBRIDGEUC() -}; - -static const struct pmc_event_descr westmereuc_event_table[] = -{ - __PMC_EV_ALIAS_WESTMEREUC() -}; - static const struct pmc_event_descr cortex_a8_event_table[] = { __PMC_EV_ALIAS_ARMV7_CORTEX_A8() @@ -324,29 +183,7 @@ static const struct pmc_event_descr cortex_a57_event_t PMC_CLASS_##C, __VA_ARGS__ \ } -PMC_MDEP_TABLE(atom, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); -PMC_MDEP_TABLE(atom_silvermont, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); -PMC_MDEP_TABLE(core, IAP, PMC_CLASS_SOFT, PMC_CLASS_TSC); -PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); -PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); -PMC_MDEP_TABLE(nehalem_ex, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); -PMC_MDEP_TABLE(haswell, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); -PMC_MDEP_TABLE(haswell_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); -PMC_MDEP_TABLE(broadwell, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); -PMC_MDEP_TABLE(broadwell_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); -PMC_MDEP_TABLE(skylake, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); -PMC_MDEP_TABLE(skylake_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); -PMC_MDEP_TABLE(ivybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); -PMC_MDEP_TABLE(ivybridge_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); -PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); -PMC_MDEP_TABLE(sandybridge_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); -PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); -PMC_MDEP_TABLE(westmere_ex, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); -PMC_MDEP_TABLE(k7, K7, PMC_CLASS_SOFT, PMC_CLASS_TSC); PMC_MDEP_TABLE(k8, K8, PMC_CLASS_SOFT, PMC_CLASS_TSC); -PMC_MDEP_TABLE(p4, P4, PMC_CLASS_SOFT, PMC_CLASS_TSC); -PMC_MDEP_TABLE(p5, P5, PMC_CLASS_SOFT, PMC_CLASS_TSC); -PMC_MDEP_TABLE(p6, P6, PMC_CLASS_SOFT, PMC_CLASS_TSC); PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_SOFT, PMC_CLASS_XSCALE); PMC_MDEP_TABLE(cortex_a8, ARMV7, PMC_CLASS_SOFT, PMC_CLASS_ARMV7); PMC_MDEP_TABLE(cortex_a9, ARMV7, PMC_CLASS_SOFT, PMC_CLASS_ARMV7); @@ -379,43 +216,8 @@ static const struct pmc_class_descr NAME##_class_table } #if defined(__i386__) || defined(__amd64__) -PMC_CLASS_TABLE_DESC(iaf, IAF, iaf, iaf); -PMC_CLASS_TABLE_DESC(atom, IAP, atom, iap); -PMC_CLASS_TABLE_DESC(atom_silvermont, IAP, atom_silvermont, iap); -PMC_CLASS_TABLE_DESC(core, IAP, core, iap); -PMC_CLASS_TABLE_DESC(core2, IAP, core2, iap); -PMC_CLASS_TABLE_DESC(corei7, IAP, corei7, iap); -PMC_CLASS_TABLE_DESC(nehalem_ex, IAP, nehalem_ex, iap); -PMC_CLASS_TABLE_DESC(haswell, IAP, haswell, iap); -PMC_CLASS_TABLE_DESC(haswell_xeon, IAP, haswell_xeon, iap); -PMC_CLASS_TABLE_DESC(broadwell, IAP, broadwell, iap); -PMC_CLASS_TABLE_DESC(broadwell_xeon, IAP, broadwell_xeon, iap); -PMC_CLASS_TABLE_DESC(skylake, IAP, skylake, iap); -PMC_CLASS_TABLE_DESC(skylake_xeon, IAP, skylake_xeon, iap); -PMC_CLASS_TABLE_DESC(ivybridge, IAP, ivybridge, iap); -PMC_CLASS_TABLE_DESC(ivybridge_xeon, IAP, ivybridge_xeon, iap); -PMC_CLASS_TABLE_DESC(sandybridge, IAP, sandybridge, iap); -PMC_CLASS_TABLE_DESC(sandybridge_xeon, IAP, sandybridge_xeon, iap); -PMC_CLASS_TABLE_DESC(westmere, IAP, westmere, iap); -PMC_CLASS_TABLE_DESC(westmere_ex, IAP, westmere_ex, iap); -PMC_CLASS_TABLE_DESC(ucf, UCF, ucf, ucf); -PMC_CLASS_TABLE_DESC(corei7uc, UCP, corei7uc, ucp); -PMC_CLASS_TABLE_DESC(haswelluc, UCP, haswelluc, ucp); -PMC_CLASS_TABLE_DESC(broadwelluc, UCP, broadwelluc, ucp); -PMC_CLASS_TABLE_DESC(sandybridgeuc, UCP, sandybridgeuc, ucp); -PMC_CLASS_TABLE_DESC(westmereuc, UCP, westmereuc, ucp); -#endif -#if defined(__i386__) -PMC_CLASS_TABLE_DESC(k7, K7, k7, k7); -#endif -#if defined(__i386__) || defined(__amd64__) PMC_CLASS_TABLE_DESC(k8, K8, k8, k8); -PMC_CLASS_TABLE_DESC(p4, P4, p4, p4); #endif -#if defined(__i386__) -PMC_CLASS_TABLE_DESC(p5, P5, p5, p5); -PMC_CLASS_TABLE_DESC(p6, P6, p6, p6); -#endif #if defined(__i386__) || defined(__amd64__) PMC_CLASS_TABLE_DESC(tsc, TSC, tsc, tsc); #endif @@ -556,616 +358,10 @@ pmc_parse_mask(const struct pmc_masks *pmask, char *p, #define KWPREFIXMATCH(p,kw) (strncasecmp((p), (kw), sizeof((kw)) - 1) == 0) #define EV_ALIAS(N,S) { .pm_alias = N, .pm_spec = S } -#if defined(__i386__) - -/* - * AMD K7 (Athlon) CPUs. - */ - -static struct pmc_event_alias k7_aliases[] = { - EV_ALIAS("branches", "k7-retired-branches"), - EV_ALIAS("branch-mispredicts", "k7-retired-branches-mispredicted"), - EV_ALIAS("cycles", "tsc"), - EV_ALIAS("dc-misses", "k7-dc-misses"), - EV_ALIAS("ic-misses", "k7-ic-misses"), - EV_ALIAS("instructions", "k7-retired-instructions"), - EV_ALIAS("interrupts", "k7-hardware-interrupts"), - EV_ALIAS(NULL, NULL) -}; - -#define K7_KW_COUNT "count" -#define K7_KW_EDGE "edge" -#define K7_KW_INV "inv" -#define K7_KW_OS "os" -#define K7_KW_UNITMASK "unitmask" -#define K7_KW_USR "usr" - -static int -k7_allocate_pmc(enum pmc_event pe, char *ctrspec, - struct pmc_op_pmcallocate *pmc_config) -{ - char *e, *p, *q; - int c, has_unitmask; - uint32_t count, unitmask; - - pmc_config->pm_md.pm_amd.pm_amd_config = 0; - pmc_config->pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE); - - if (pe == PMC_EV_K7_DC_REFILLS_FROM_L2 || - pe == PMC_EV_K7_DC_REFILLS_FROM_SYSTEM || - pe == PMC_EV_K7_DC_WRITEBACKS) { - has_unitmask = 1; - unitmask = AMD_PMC_UNITMASK_MOESI; - } else - unitmask = has_unitmask = 0; - - while ((p = strsep(&ctrspec, ",")) != NULL) { - if (KWPREFIXMATCH(p, K7_KW_COUNT "=")) { - q = strchr(p, '='); - if (*++q == '\0') /* skip '=' */ - return (-1); - - count = strtol(q, &e, 0); - if (e == q || *e != '\0') - return (-1); - - pmc_config->pm_caps |= PMC_CAP_THRESHOLD; - pmc_config->pm_md.pm_amd.pm_amd_config |= - AMD_PMC_TO_COUNTER(count); - - } else if (KWMATCH(p, K7_KW_EDGE)) { - pmc_config->pm_caps |= PMC_CAP_EDGE; - } else if (KWMATCH(p, K7_KW_INV)) { - pmc_config->pm_caps |= PMC_CAP_INVERT; - } else if (KWMATCH(p, K7_KW_OS)) { - pmc_config->pm_caps |= PMC_CAP_SYSTEM; - } else if (KWPREFIXMATCH(p, K7_KW_UNITMASK "=")) { - if (has_unitmask == 0) - return (-1); - unitmask = 0; - q = strchr(p, '='); - if (*++q == '\0') /* skip '=' */ - return (-1); - - while ((c = tolower(*q++)) != 0) - if (c == 'm') - unitmask |= AMD_PMC_UNITMASK_M; - else if (c == 'o') - unitmask |= AMD_PMC_UNITMASK_O; - else if (c == 'e') - unitmask |= AMD_PMC_UNITMASK_E; - else if (c == 's') - unitmask |= AMD_PMC_UNITMASK_S; - else if (c == 'i') - unitmask |= AMD_PMC_UNITMASK_I; - else if (c == '+') - continue; - else - return (-1); - - if (unitmask == 0) - return (-1); - - } else if (KWMATCH(p, K7_KW_USR)) { - pmc_config->pm_caps |= PMC_CAP_USER; - } else - return (-1); - } - - if (has_unitmask) { - pmc_config->pm_caps |= PMC_CAP_QUALIFIER; - pmc_config->pm_md.pm_amd.pm_amd_config |= - AMD_PMC_TO_UNITMASK(unitmask); - } - - return (0); - -} - -#endif - #if defined(__amd64__) || defined(__i386__) - /* - * Intel Core (Family 6, Model E) PMCs. - */ - -static struct pmc_event_alias core_aliases[] = { - EV_ALIAS("branches", "iap-br-instr-ret"), - EV_ALIAS("branch-mispredicts", "iap-br-mispred-ret"), - EV_ALIAS("cycles", "tsc-tsc"), - EV_ALIAS("ic-misses", "iap-icache-misses"), - EV_ALIAS("instructions", "iap-instr-ret"), - EV_ALIAS("interrupts", "iap-core-hw-int-rx"), - EV_ALIAS("unhalted-cycles", "iap-unhalted-core-cycles"), - EV_ALIAS(NULL, NULL) -}; - -/* - * Intel Core2 (Family 6, Model F), Core2Extreme (Family 6, Model 17H) - * and Atom (Family 6, model 1CH) PMCs. - * - * We map aliases to events on the fixed-function counters if these - * are present. Note that not all CPUs in this family contain fixed-function - * counters. - */ - -static struct pmc_event_alias core2_aliases[] = { - EV_ALIAS("branches", "iap-br-inst-retired.any"), - EV_ALIAS("branch-mispredicts", "iap-br-inst-retired.mispred"), - EV_ALIAS("cycles", "tsc-tsc"), - EV_ALIAS("ic-misses", "iap-l1i-misses"), - EV_ALIAS("instructions", "iaf-instr-retired.any"), - EV_ALIAS("interrupts", "iap-hw-int-rcv"), - EV_ALIAS("unhalted-cycles", "iaf-cpu-clk-unhalted.core"), - EV_ALIAS(NULL, NULL) -}; - -static struct pmc_event_alias core2_aliases_without_iaf[] = { - EV_ALIAS("branches", "iap-br-inst-retired.any"), - EV_ALIAS("branch-mispredicts", "iap-br-inst-retired.mispred"), - EV_ALIAS("cycles", "tsc-tsc"), - EV_ALIAS("ic-misses", "iap-l1i-misses"), - EV_ALIAS("instructions", "iap-inst-retired.any_p"), - EV_ALIAS("interrupts", "iap-hw-int-rcv"), - EV_ALIAS("unhalted-cycles", "iap-cpu-clk-unhalted.core_p"), - EV_ALIAS(NULL, NULL) -}; - -#define atom_aliases core2_aliases -#define atom_aliases_without_iaf core2_aliases_without_iaf -#define atom_silvermont_aliases core2_aliases -#define atom_silvermont_aliases_without_iaf core2_aliases_without_iaf -#define corei7_aliases core2_aliases -#define corei7_aliases_without_iaf core2_aliases_without_iaf -#define nehalem_ex_aliases core2_aliases -#define nehalem_ex_aliases_without_iaf core2_aliases_without_iaf -#define haswell_aliases core2_aliases -#define haswell_aliases_without_iaf core2_aliases_without_iaf -#define haswell_xeon_aliases core2_aliases -#define haswell_xeon_aliases_without_iaf core2_aliases_without_iaf -#define broadwell_aliases core2_aliases -#define broadwell_aliases_without_iaf core2_aliases_without_iaf -#define broadwell_xeon_aliases core2_aliases -#define broadwell_xeon_aliases_without_iaf core2_aliases_without_iaf -#define skylake_aliases core2_aliases -#define skylake_aliases_without_iaf core2_aliases_without_iaf -#define skylake_xeon_aliases core2_aliases -#define skylake_xeon_aliases_without_iaf core2_aliases_without_iaf -#define ivybridge_aliases core2_aliases -#define ivybridge_aliases_without_iaf core2_aliases_without_iaf -#define ivybridge_xeon_aliases core2_aliases -#define ivybridge_xeon_aliases_without_iaf core2_aliases_without_iaf -#define sandybridge_aliases core2_aliases -#define sandybridge_aliases_without_iaf core2_aliases_without_iaf -#define sandybridge_xeon_aliases core2_aliases -#define sandybridge_xeon_aliases_without_iaf core2_aliases_without_iaf -#define westmere_aliases core2_aliases -#define westmere_aliases_without_iaf core2_aliases_without_iaf -#define westmere_ex_aliases core2_aliases -#define westmere_ex_aliases_without_iaf core2_aliases_without_iaf - -#define IAF_KW_OS "os" -#define IAF_KW_USR "usr" -#define IAF_KW_ANYTHREAD "anythread" - -/* - * Parse an event specifier for Intel fixed function counters. - */ -static int -iaf_allocate_pmc(enum pmc_event pe, char *ctrspec, - struct pmc_op_pmcallocate *pmc_config) -{ - char *p; - - (void) pe; - - pmc_config->pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE); - pmc_config->pm_md.pm_iaf.pm_iaf_flags = 0; - - while ((p = strsep(&ctrspec, ",")) != NULL) { - if (KWMATCH(p, IAF_KW_OS)) - pmc_config->pm_caps |= PMC_CAP_SYSTEM; - else if (KWMATCH(p, IAF_KW_USR)) - pmc_config->pm_caps |= PMC_CAP_USER; - else if (KWMATCH(p, IAF_KW_ANYTHREAD)) - pmc_config->pm_md.pm_iaf.pm_iaf_flags |= IAF_ANY; - else - return (-1); - } - - return (0); -} - -/* - * Core/Core2 support. - */ - -#define IAP_KW_AGENT "agent" -#define IAP_KW_ANYTHREAD "anythread" -#define IAP_KW_CACHESTATE "cachestate" -#define IAP_KW_CMASK "cmask" -#define IAP_KW_CORE "core" -#define IAP_KW_EDGE "edge" -#define IAP_KW_INV "inv" -#define IAP_KW_OS "os" -#define IAP_KW_PREFETCH "prefetch" -#define IAP_KW_SNOOPRESPONSE "snoopresponse" -#define IAP_KW_SNOOPTYPE "snooptype" -#define IAP_KW_TRANSITION "trans" -#define IAP_KW_USR "usr" -#define IAP_KW_RSP "rsp" - -static struct pmc_masks iap_core_mask[] = { - PMCMASK(all, (0x3 << 14)), - PMCMASK(this, (0x1 << 14)), - NULLMASK -}; - -static struct pmc_masks iap_agent_mask[] = { - PMCMASK(this, 0), - PMCMASK(any, (0x1 << 13)), - NULLMASK -}; - -static struct pmc_masks iap_prefetch_mask[] = { - PMCMASK(both, (0x3 << 12)), - PMCMASK(only, (0x1 << 12)), - PMCMASK(exclude, 0), - NULLMASK -}; - -static struct pmc_masks iap_cachestate_mask[] = { - PMCMASK(i, (1 << 8)), - PMCMASK(s, (1 << 9)), - PMCMASK(e, (1 << 10)), - PMCMASK(m, (1 << 11)), - NULLMASK -}; - -static struct pmc_masks iap_snoopresponse_mask[] = { - PMCMASK(clean, (1 << 8)), - PMCMASK(hit, (1 << 9)), - PMCMASK(hitm, (1 << 11)), - NULLMASK -}; - -static struct pmc_masks iap_snooptype_mask[] = { - PMCMASK(cmp2s, (1 << 8)), - PMCMASK(cmp2i, (1 << 9)), - NULLMASK -}; - -static struct pmc_masks iap_transition_mask[] = { - PMCMASK(any, 0x00), - PMCMASK(frequency, 0x10), - NULLMASK -}; - -static struct pmc_masks iap_rsp_mask_i7_wm[] = { - PMCMASK(DMND_DATA_RD, (1 << 0)), - PMCMASK(DMND_RFO, (1 << 1)), - PMCMASK(DMND_IFETCH, (1 << 2)), - PMCMASK(WB, (1 << 3)), - PMCMASK(PF_DATA_RD, (1 << 4)), - PMCMASK(PF_RFO, (1 << 5)), - PMCMASK(PF_IFETCH, (1 << 6)), - PMCMASK(OTHER, (1 << 7)), - PMCMASK(UNCORE_HIT, (1 << 8)), - PMCMASK(OTHER_CORE_HIT_SNP, (1 << 9)), - PMCMASK(OTHER_CORE_HITM, (1 << 10)), - PMCMASK(REMOTE_CACHE_FWD, (1 << 12)), - PMCMASK(REMOTE_DRAM, (1 << 13)), - PMCMASK(LOCAL_DRAM, (1 << 14)), - PMCMASK(NON_DRAM, (1 << 15)), - NULLMASK -}; - -static struct pmc_masks iap_rsp_mask_sb_sbx_ib[] = { - PMCMASK(REQ_DMND_DATA_RD, (1ULL << 0)), - PMCMASK(REQ_DMND_RFO, (1ULL << 1)), - PMCMASK(REQ_DMND_IFETCH, (1ULL << 2)), - PMCMASK(REQ_WB, (1ULL << 3)), - PMCMASK(REQ_PF_DATA_RD, (1ULL << 4)), - PMCMASK(REQ_PF_RFO, (1ULL << 5)), - PMCMASK(REQ_PF_IFETCH, (1ULL << 6)), - PMCMASK(REQ_PF_LLC_DATA_RD, (1ULL << 7)), - PMCMASK(REQ_PF_LLC_RFO, (1ULL << 8)), - PMCMASK(REQ_PF_LLC_IFETCH, (1ULL << 9)), - PMCMASK(REQ_BUS_LOCKS, (1ULL << 10)), - PMCMASK(REQ_STRM_ST, (1ULL << 11)), - PMCMASK(REQ_OTHER, (1ULL << 15)), - PMCMASK(RES_ANY, (1ULL << 16)), - PMCMASK(RES_SUPPLIER_SUPP, (1ULL << 17)), - PMCMASK(RES_SUPPLIER_LLC_HITM, (1ULL << 18)), - PMCMASK(RES_SUPPLIER_LLC_HITE, (1ULL << 19)), - PMCMASK(RES_SUPPLIER_LLC_HITS, (1ULL << 20)), - PMCMASK(RES_SUPPLIER_LLC_HITF, (1ULL << 21)), - PMCMASK(RES_SUPPLIER_LOCAL, (1ULL << 22)), - PMCMASK(RES_SNOOP_SNP_NONE, (1ULL << 31)), - PMCMASK(RES_SNOOP_SNP_NO_NEEDED,(1ULL << 32)), - PMCMASK(RES_SNOOP_SNP_MISS, (1ULL << 33)), - PMCMASK(RES_SNOOP_HIT_NO_FWD, (1ULL << 34)), - PMCMASK(RES_SNOOP_HIT_FWD, (1ULL << 35)), - PMCMASK(RES_SNOOP_HITM, (1ULL << 36)), - PMCMASK(RES_NON_DRAM, (1ULL << 37)), - NULLMASK -}; - -/* Broadwell is defined to use the same mask as Haswell */ -static struct pmc_masks iap_rsp_mask_haswell[] = { - PMCMASK(REQ_DMND_DATA_RD, (1ULL << 0)), - PMCMASK(REQ_DMND_RFO, (1ULL << 1)), - PMCMASK(REQ_DMND_IFETCH, (1ULL << 2)), - PMCMASK(REQ_PF_DATA_RD, (1ULL << 4)), - PMCMASK(REQ_PF_RFO, (1ULL << 5)), - PMCMASK(REQ_PF_IFETCH, (1ULL << 6)), - PMCMASK(REQ_OTHER, (1ULL << 15)), - PMCMASK(RES_ANY, (1ULL << 16)), - PMCMASK(RES_SUPPLIER_SUPP, (1ULL << 17)), - PMCMASK(RES_SUPPLIER_LLC_HITM, (1ULL << 18)), - PMCMASK(RES_SUPPLIER_LLC_HITE, (1ULL << 19)), - PMCMASK(RES_SUPPLIER_LLC_HITS, (1ULL << 20)), - PMCMASK(RES_SUPPLIER_LLC_HITF, (1ULL << 21)), - PMCMASK(RES_SUPPLIER_LOCAL, (1ULL << 22)), - /* - * For processor type 06_45H 22 is L4_HIT_LOCAL_L4 - * and 23, 24 and 25 are also defined. - */ - PMCMASK(RES_SNOOP_SNP_NONE, (1ULL << 31)), - PMCMASK(RES_SNOOP_SNP_NO_NEEDED,(1ULL << 32)), - PMCMASK(RES_SNOOP_SNP_MISS, (1ULL << 33)), - PMCMASK(RES_SNOOP_HIT_NO_FWD, (1ULL << 34)), - PMCMASK(RES_SNOOP_HIT_FWD, (1ULL << 35)), - PMCMASK(RES_SNOOP_HITM, (1ULL << 36)), - PMCMASK(RES_NON_DRAM, (1ULL << 37)), - NULLMASK -}; - -static struct pmc_masks iap_rsp_mask_skylake[] = { - PMCMASK(REQ_DMND_DATA_RD, (1ULL << 0)), - PMCMASK(REQ_DMND_RFO, (1ULL << 1)), - PMCMASK(REQ_DMND_IFETCH, (1ULL << 2)), - PMCMASK(REQ_PF_DATA_RD, (1ULL << 7)), - PMCMASK(REQ_PF_RFO, (1ULL << 8)), - PMCMASK(REQ_STRM_ST, (1ULL << 11)), - PMCMASK(REQ_OTHER, (1ULL << 15)), - PMCMASK(RES_ANY, (1ULL << 16)), - PMCMASK(RES_SUPPLIER_SUPP, (1ULL << 17)), - PMCMASK(RES_SUPPLIER_LLC_HITM, (1ULL << 18)), - PMCMASK(RES_SUPPLIER_LLC_HITE, (1ULL << 19)), - PMCMASK(RES_SUPPLIER_LLC_HITS, (1ULL << 20)), - PMCMASK(RES_SUPPLIER_L4_HIT, (1ULL << 22)), - PMCMASK(RES_SUPPLIER_DRAM, (1ULL << 26)), - PMCMASK(RES_SUPPLIER_SPL_HIT, (1ULL << 30)), - PMCMASK(RES_SNOOP_SNP_NONE, (1ULL << 31)), - PMCMASK(RES_SNOOP_SNP_NO_NEEDED,(1ULL << 32)), - PMCMASK(RES_SNOOP_SNP_MISS, (1ULL << 33)), - PMCMASK(RES_SNOOP_HIT_NO_FWD, (1ULL << 34)), - PMCMASK(RES_SNOOP_HIT_FWD, (1ULL << 35)), - PMCMASK(RES_SNOOP_HITM, (1ULL << 36)), - PMCMASK(RES_NON_DRAM, (1ULL << 37)), - NULLMASK -}; - - -static int -iap_allocate_pmc(enum pmc_event pe, char *ctrspec, - struct pmc_op_pmcallocate *pmc_config) -{ - char *e, *p, *q; - uint64_t cachestate, evmask, rsp; - int count, n; - - pmc_config->pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE | - PMC_CAP_QUALIFIER); - pmc_config->pm_md.pm_iap.pm_iap_config = 0; - - cachestate = evmask = rsp = 0; - - /* Parse additional modifiers if present */ - while ((p = strsep(&ctrspec, ",")) != NULL) { - - n = 0; - if (KWPREFIXMATCH(p, IAP_KW_CMASK "=")) { - q = strchr(p, '='); - if (*++q == '\0') /* skip '=' */ - return (-1); - count = strtol(q, &e, 0); - if (e == q || *e != '\0') - return (-1); - pmc_config->pm_caps |= PMC_CAP_THRESHOLD; - pmc_config->pm_md.pm_iap.pm_iap_config |= - IAP_CMASK(count); - } else if (KWMATCH(p, IAP_KW_EDGE)) { - pmc_config->pm_caps |= PMC_CAP_EDGE; - } else if (KWMATCH(p, IAP_KW_INV)) { - pmc_config->pm_caps |= PMC_CAP_INVERT; - } else if (KWMATCH(p, IAP_KW_OS)) { - pmc_config->pm_caps |= PMC_CAP_SYSTEM; - } else if (KWMATCH(p, IAP_KW_USR)) { - pmc_config->pm_caps |= PMC_CAP_USER; - } else if (KWMATCH(p, IAP_KW_ANYTHREAD)) { - pmc_config->pm_md.pm_iap.pm_iap_config |= IAP_ANY; - } else if (KWPREFIXMATCH(p, IAP_KW_CORE "=")) { - n = pmc_parse_mask(iap_core_mask, p, &evmask); - if (n != 1) - return (-1); - } else if (KWPREFIXMATCH(p, IAP_KW_AGENT "=")) { - n = pmc_parse_mask(iap_agent_mask, p, &evmask); - if (n != 1) - return (-1); - } else if (KWPREFIXMATCH(p, IAP_KW_PREFETCH "=")) { - n = pmc_parse_mask(iap_prefetch_mask, p, &evmask); - if (n != 1) - return (-1); - } else if (KWPREFIXMATCH(p, IAP_KW_CACHESTATE "=")) { - n = pmc_parse_mask(iap_cachestate_mask, p, &cachestate); - } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_CORE && - KWPREFIXMATCH(p, IAP_KW_TRANSITION "=")) { - n = pmc_parse_mask(iap_transition_mask, p, &evmask); - if (n != 1) - return (-1); - } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_ATOM || - cpu_info.pm_cputype == PMC_CPU_INTEL_ATOM_SILVERMONT || - cpu_info.pm_cputype == PMC_CPU_INTEL_CORE2 || - cpu_info.pm_cputype == PMC_CPU_INTEL_CORE2EXTREME) { - if (KWPREFIXMATCH(p, IAP_KW_SNOOPRESPONSE "=")) { - n = pmc_parse_mask(iap_snoopresponse_mask, p, - &evmask); - } else if (KWPREFIXMATCH(p, IAP_KW_SNOOPTYPE "=")) { - n = pmc_parse_mask(iap_snooptype_mask, p, - &evmask); - } else - return (-1); - } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_COREI7 || - cpu_info.pm_cputype == PMC_CPU_INTEL_WESTMERE || - cpu_info.pm_cputype == PMC_CPU_INTEL_NEHALEM_EX || - cpu_info.pm_cputype == PMC_CPU_INTEL_WESTMERE_EX) { - if (KWPREFIXMATCH(p, IAP_KW_RSP "=")) { - n = pmc_parse_mask(iap_rsp_mask_i7_wm, p, &rsp); - } else - return (-1); - } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_SANDYBRIDGE || - cpu_info.pm_cputype == PMC_CPU_INTEL_SANDYBRIDGE_XEON || - cpu_info.pm_cputype == PMC_CPU_INTEL_IVYBRIDGE || - cpu_info.pm_cputype == PMC_CPU_INTEL_IVYBRIDGE_XEON ) { - if (KWPREFIXMATCH(p, IAP_KW_RSP "=")) { - n = pmc_parse_mask(iap_rsp_mask_sb_sbx_ib, p, &rsp); - } else - return (-1); - } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_HASWELL || - cpu_info.pm_cputype == PMC_CPU_INTEL_HASWELL_XEON) { - if (KWPREFIXMATCH(p, IAP_KW_RSP "=")) { - n = pmc_parse_mask(iap_rsp_mask_haswell, p, &rsp); - } else - return (-1); - } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_BROADWELL || - cpu_info.pm_cputype == PMC_CPU_INTEL_BROADWELL_XEON) { - /* Broadwell is defined to use same mask as haswell */ - if (KWPREFIXMATCH(p, IAP_KW_RSP "=")) { - n = pmc_parse_mask(iap_rsp_mask_haswell, p, &rsp); - } else - return (-1); - - } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_SKYLAKE || - cpu_info.pm_cputype == PMC_CPU_INTEL_SKYLAKE_XEON) { - if (KWPREFIXMATCH(p, IAP_KW_RSP "=")) { - n = pmc_parse_mask(iap_rsp_mask_skylake, p, &rsp); - } else - return (-1); - - } else - return (-1); - - if (n < 0) /* Parsing failed. */ - return (-1); - } - - pmc_config->pm_md.pm_iap.pm_iap_config |= evmask; - - /* - * If the event requires a 'cachestate' qualifier but was not - * specified by the user, use a sensible default. - */ - switch (pe) { - case PMC_EV_IAP_EVENT_28H: /* Core, Core2, Atom */ - case PMC_EV_IAP_EVENT_29H: /* Core, Core2, Atom */ - case PMC_EV_IAP_EVENT_2AH: /* Core, Core2, Atom */ - case PMC_EV_IAP_EVENT_2BH: /* Atom, Core2 */ - case PMC_EV_IAP_EVENT_2EH: /* Core, Core2, Atom */ - case PMC_EV_IAP_EVENT_30H: /* Core, Core2, Atom */ - case PMC_EV_IAP_EVENT_32H: /* Core */ - case PMC_EV_IAP_EVENT_40H: /* Core */ - case PMC_EV_IAP_EVENT_41H: /* Core */ - case PMC_EV_IAP_EVENT_42H: /* Core, Core2, Atom */ - if (cachestate == 0) - cachestate = (0xF << 8); - break; - case PMC_EV_IAP_EVENT_77H: /* Atom */ - /* IAP_EVENT_77H only accepts a cachestate qualifier on the - * Atom processor - */ - if(cpu_info.pm_cputype == PMC_CPU_INTEL_ATOM && cachestate == 0) - cachestate = (0xF << 8); - break; - default: - break; - } - - pmc_config->pm_md.pm_iap.pm_iap_config |= cachestate; - pmc_config->pm_md.pm_iap.pm_iap_rsp = rsp; - - return (0); -} - -/* - * Intel Uncore. - */ - -static int -ucf_allocate_pmc(enum pmc_event pe, char *ctrspec, - struct pmc_op_pmcallocate *pmc_config) -{ - (void) pe; - (void) ctrspec; - - pmc_config->pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE); - pmc_config->pm_md.pm_ucf.pm_ucf_flags = 0; - - return (0); -} - -#define UCP_KW_CMASK "cmask" -#define UCP_KW_EDGE "edge" -#define UCP_KW_INV "inv" - -static int -ucp_allocate_pmc(enum pmc_event pe, char *ctrspec, - struct pmc_op_pmcallocate *pmc_config) -{ - char *e, *p, *q; - int count, n; - - (void) pe; - - pmc_config->pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE | - PMC_CAP_QUALIFIER); - pmc_config->pm_md.pm_ucp.pm_ucp_config = 0; - - /* Parse additional modifiers if present */ - while ((p = strsep(&ctrspec, ",")) != NULL) { - - n = 0; - if (KWPREFIXMATCH(p, UCP_KW_CMASK "=")) { - q = strchr(p, '='); - if (*++q == '\0') /* skip '=' */ - return (-1); - count = strtol(q, &e, 0); - if (e == q || *e != '\0') - return (-1); - pmc_config->pm_caps |= PMC_CAP_THRESHOLD; - pmc_config->pm_md.pm_ucp.pm_ucp_config |= - UCP_CMASK(count); - } else if (KWMATCH(p, UCP_KW_EDGE)) { - pmc_config->pm_caps |= PMC_CAP_EDGE; - } else if (KWMATCH(p, UCP_KW_INV)) { - pmc_config->pm_caps |= PMC_CAP_INVERT; - } else - return (-1); - - if (n < 0) /* Parsing failed. */ - return (-1); - } - - return (0); -} - -/* * AMD K8 PMCs. * - * These are very similar to AMD K7 PMCs, but support more kinds of - * events. */ static struct pmc_event_alias k8_aliases[] = { @@ -1520,962 +716,6 @@ k8_allocate_pmc(enum pmc_event pe, char *ctrspec, #endif -#if defined(__amd64__) || defined(__i386__) - -/* - * Intel P4 PMCs - */ - -static struct pmc_event_alias p4_aliases[] = { - EV_ALIAS("branches", "p4-branch-retired,mask=mmtp+mmtm"), - EV_ALIAS("branch-mispredicts", "p4-mispred-branch-retired"), - EV_ALIAS("cycles", "tsc"), - EV_ALIAS("instructions", - "p4-instr-retired,mask=nbogusntag+nbogustag"), - EV_ALIAS("unhalted-cycles", "p4-global-power-events"), - EV_ALIAS(NULL, NULL) -}; - -#define P4_KW_ACTIVE "active" -#define P4_KW_ACTIVE_ANY "any" -#define P4_KW_ACTIVE_BOTH "both" -#define P4_KW_ACTIVE_NONE "none" -#define P4_KW_ACTIVE_SINGLE "single" -#define P4_KW_BUSREQTYPE "busreqtype" -#define P4_KW_CASCADE "cascade" -#define P4_KW_EDGE "edge" -#define P4_KW_INV "complement" -#define P4_KW_OS "os" -#define P4_KW_MASK "mask" -#define P4_KW_PRECISE "precise" -#define P4_KW_TAG "tag" -#define P4_KW_THRESHOLD "threshold" -#define P4_KW_USR "usr" - -#define __P4MASK(N,V) PMCMASK(N, (1 << (V))) - -static const struct pmc_masks p4_mask_tcdm[] = { /* tc deliver mode */ - __P4MASK(dd, 0), - __P4MASK(db, 1), - __P4MASK(di, 2), - __P4MASK(bd, 3), - __P4MASK(bb, 4), - __P4MASK(bi, 5), - __P4MASK(id, 6), - __P4MASK(ib, 7), - NULLMASK -}; - -static const struct pmc_masks p4_mask_bfr[] = { /* bpu fetch request */ - __P4MASK(tcmiss, 0), - NULLMASK, -}; - -static const struct pmc_masks p4_mask_ir[] = { /* itlb reference */ - __P4MASK(hit, 0), - __P4MASK(miss, 1), - __P4MASK(hit-uc, 2), - NULLMASK -}; - -static const struct pmc_masks p4_mask_memcan[] = { /* memory cancel */ - __P4MASK(st-rb-full, 2), - __P4MASK(64k-conf, 3), - NULLMASK -}; - -static const struct pmc_masks p4_mask_memcomp[] = { /* memory complete */ - __P4MASK(lsc, 0), - __P4MASK(ssc, 1), - NULLMASK -}; - -static const struct pmc_masks p4_mask_lpr[] = { /* load port replay */ - __P4MASK(split-ld, 1), - NULLMASK -}; - -static const struct pmc_masks p4_mask_spr[] = { /* store port replay */ - __P4MASK(split-st, 1), - NULLMASK -}; - -static const struct pmc_masks p4_mask_mlr[] = { /* mob load replay */ - __P4MASK(no-sta, 1), - __P4MASK(no-std, 3), - __P4MASK(partial-data, 4), - __P4MASK(unalgn-addr, 5), - NULLMASK -}; - -static const struct pmc_masks p4_mask_pwt[] = { /* page walk type */ - __P4MASK(dtmiss, 0), - __P4MASK(itmiss, 1), - NULLMASK -}; - -static const struct pmc_masks p4_mask_bcr[] = { /* bsq cache reference */ - __P4MASK(rd-2ndl-hits, 0), - __P4MASK(rd-2ndl-hite, 1), - __P4MASK(rd-2ndl-hitm, 2), - __P4MASK(rd-3rdl-hits, 3), - __P4MASK(rd-3rdl-hite, 4), - __P4MASK(rd-3rdl-hitm, 5), - __P4MASK(rd-2ndl-miss, 8), - __P4MASK(rd-3rdl-miss, 9), - __P4MASK(wr-2ndl-miss, 10), - NULLMASK -}; - -static const struct pmc_masks p4_mask_ia[] = { /* ioq allocation */ - __P4MASK(all-read, 5), - __P4MASK(all-write, 6), - __P4MASK(mem-uc, 7), - __P4MASK(mem-wc, 8), - __P4MASK(mem-wt, 9), - __P4MASK(mem-wp, 10), - __P4MASK(mem-wb, 11), - __P4MASK(own, 13), - __P4MASK(other, 14), - __P4MASK(prefetch, 15), - NULLMASK -}; - -static const struct pmc_masks p4_mask_iae[] = { /* ioq active entries */ - __P4MASK(all-read, 5), - __P4MASK(all-write, 6), - __P4MASK(mem-uc, 7), - __P4MASK(mem-wc, 8), - __P4MASK(mem-wt, 9), - __P4MASK(mem-wp, 10), - __P4MASK(mem-wb, 11), - __P4MASK(own, 13), *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Jun 1 00:45:44 2018 Return-Path: Delivered-To: svn-src-head@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 4BF97EF334F; Fri, 1 Jun 2018 00:45:44 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F224F6A55F; Fri, 1 Jun 2018 00:45:43 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D347121AA8; Fri, 1 Jun 2018 00:45:43 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w510jhqY036296; Fri, 1 Jun 2018 00:45:43 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w510jhR4036295; Fri, 1 Jun 2018 00:45:43 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201806010045.w510jhR4036295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Fri, 1 Jun 2018 00:45:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334462 - head/lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/lib/libpmc X-SVN-Commit-Revision: 334462 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 00:45:44 -0000 Author: mmacy Date: Fri Jun 1 00:45:43 2018 New Revision: 334462 URL: https://svnweb.freebsd.org/changeset/base/334462 Log: libpmc/pmu: update aliases table Modified: head/lib/libpmc/libpmc_pmu_util.c (contents, props changed) Modified: head/lib/libpmc/libpmc_pmu_util.c ============================================================================== --- head/lib/libpmc/libpmc_pmu_util.c Fri Jun 1 00:30:55 2018 (r334461) +++ head/lib/libpmc/libpmc_pmu_util.c Fri Jun 1 00:45:43 2018 (r334462) @@ -60,21 +60,15 @@ static struct pmu_alias pmu_alias_table[] = { {"BRANCH-INSTRUCTION-RETIRED", "BR_INST_RETIRED.ALL_BRANCHES"}, {"BRANCH_MISSES_RETIRED", "BR_MISP_RETIRED.ALL_BRANCHES"}, {"BRANCH-MISSES-RETIRED", "BR_MISP_RETIRED.ALL_BRANCHES"}, + {"cycles", "tsc-tsc"}, + {"instructions", "inst-retired.any_p"}, + {"branch-mispredicts", "br_misp_retired.all_branches" }, + {"branches", "br_inst_retired.all_branches" }, + {"interrupts", "hw_interrupts.received"}, + {"ic-misses", "frontend_retired.l1i_miss"}, {NULL, NULL}, }; -#ifdef notyet -static struct pmc_event_alias core2_aliases_without_iaf[] = { - EV_ALIAS("branches", "iap-br-inst-retired.any"), - EV_ALIAS("branch-mispredicts", "iap-br-inst-retired.mispred"), - EV_ALIAS("cycles", "tsc-tsc"), - EV_ALIAS("ic-misses", "iap-l1i-misses"), - EV_ALIAS("instructions", "iap-inst-retired.any_p"), - EV_ALIAS("interrupts", "iap-hw-int-rcv"), - EV_ALIAS("unhalted-cycles", "iap-cpu-clk-unhalted.core_p"), - EV_ALIAS(NULL, NULL) -}; -#endif static const char *fixed_mode_cntrs[] = { "inst_retired.any", "cpu_clk_unhalted.thread", From owner-svn-src-head@freebsd.org Fri Jun 1 00:45:52 2018 Return-Path: Delivered-To: svn-src-head@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 A7FB9EF33C2; Fri, 1 Jun 2018 00:45:52 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BFEAA6A603; Fri, 1 Jun 2018 00:45:49 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A1B921AA9; Fri, 1 Jun 2018 00:45:49 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w510jnKh036350; Fri, 1 Jun 2018 00:45:49 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w510jnmN036349; Fri, 1 Jun 2018 00:45:49 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201806010045.w510jnmN036349@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Fri, 1 Jun 2018 00:45:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334463 - head/lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/lib/libpmc X-SVN-Commit-Revision: 334463 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 00:45:52 -0000 Author: mmacy Date: Fri Jun 1 00:45:48 2018 New Revision: 334463 URL: https://svnweb.freebsd.org/changeset/base/334463 Log: libpmc: Intel doesn't require runtime counter table init Modified: head/lib/libpmc/libpmc.c Modified: head/lib/libpmc/libpmc.c ============================================================================== --- head/lib/libpmc/libpmc.c Fri Jun 1 00:45:43 2018 (r334462) +++ head/lib/libpmc/libpmc.c Fri Jun 1 00:45:48 2018 (r334463) @@ -1534,6 +1534,9 @@ pmc_init(void) * about. This shouldn't happen since the abi version check * should have caught this. */ +#if defined(__amd64__) || defined(__i386__) + break; +#endif errno = ENXIO; return (pmc_syscall = -1); } From owner-svn-src-head@freebsd.org Fri Jun 1 00:45:56 2018 Return-Path: Delivered-To: svn-src-head@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 D6F48EF33EE; Fri, 1 Jun 2018 00:45:55 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DF0446A650; Fri, 1 Jun 2018 00:45:54 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C1C0521AAA; Fri, 1 Jun 2018 00:45:54 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w510jssW036406; Fri, 1 Jun 2018 00:45:54 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w510jsgX036403; Fri, 1 Jun 2018 00:45:54 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201806010045.w510jsgX036403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Fri, 1 Jun 2018 00:45:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334464 - in head: lib/libpmc usr.sbin/pmcstat X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: in head: lib/libpmc usr.sbin/pmcstat X-SVN-Commit-Revision: 334464 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 00:45:56 -0000 Author: mmacy Date: Fri Jun 1 00:45:53 2018 New Revision: 334464 URL: https://svnweb.freebsd.org/changeset/base/334464 Log: libpmc: allow substring for list and add function for printing event details Modified: head/lib/libpmc/libpmc_pmu_util.c (contents, props changed) head/lib/libpmc/pmc.h head/usr.sbin/pmcstat/pmcstat.c Modified: head/lib/libpmc/libpmc_pmu_util.c ============================================================================== --- head/lib/libpmc/libpmc_pmu_util.c Fri Jun 1 00:45:48 2018 (r334463) +++ head/lib/libpmc/libpmc_pmu_util.c Fri Jun 1 00:45:53 2018 (r334464) @@ -235,7 +235,7 @@ pmc_pmu_enabled(void) } void -pmc_pmu_print_counters(void) +pmc_pmu_print_counters(const char *event_name) { const struct pmu_events_map *pme; const struct pmu_event *pe; @@ -253,6 +253,8 @@ pmc_pmu_print_counters(void) for (pe = pme->table; pe->name || pe->desc || pe->event; pe++) { if (pe->name == NULL) continue; + if (event_name != NULL && strcasestr(pe->name, event_name) == NULL) + continue; printf("\t%s\n", pe->name); if (do_debug) pmu_parse_event(&ped, pe->event); @@ -296,6 +298,43 @@ pmc_pmu_print_counter_desc_long(const char *ev) } } +void +pmc_pmu_print_counter_full(const char *ev) +{ + const struct pmu_events_map *pme; + const struct pmu_event *pe; + + if ((pme = pmu_events_map_get()) == NULL) + return; + for (pe = pme->table; pe->name || pe->desc || pe->event; pe++) { + if (pe->name == NULL) + continue; + if (strcasestr(pe->name, ev) == NULL) + continue; + printf("name: %s\n", pe->name); + if (pe->long_desc != NULL) + printf("desc: %s\n", pe->long_desc); + else if (pe->desc != NULL) + printf("desc: %s\n", pe->desc); + if (pe->event != NULL) + printf("event: %s\n", pe->event); + if (pe->topic != NULL) + printf("topic: %s\n", pe->topic); + if (pe->pmu != NULL) + printf("pmu: %s\n", pe->pmu); + if (pe->unit != NULL) + printf("unit: %s\n", pe->unit); + if (pe->perpkg != NULL) + printf("perpkg: %s\n", pe->perpkg); + if (pe->metric_expr != NULL) + printf("metric_expr: %s\n", pe->metric_expr); + if (pe->metric_name != NULL) + printf("metric_name: %s\n", pe->metric_name); + if (pe->metric_group != NULL) + printf("metric_group: %s\n", pe->metric_group); + } +} + int pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) { @@ -394,7 +433,7 @@ pmc_pmu_sample_rate_get(const char *event_name __unuse } void -pmc_pmu_print_counters(void) +pmc_pmu_print_counters(const char *event_name __unused) { } @@ -406,6 +445,12 @@ pmc_pmu_print_counter_desc(const char *e __unused) void pmc_pmu_print_counter_desc_long(const char *e __unused) { +} + +void +pmc_pmu_print_counter_full(const char *e __unused) +{ + } int Modified: head/lib/libpmc/pmc.h ============================================================================== --- head/lib/libpmc/pmc.h Fri Jun 1 00:45:48 2018 (r334463) +++ head/lib/libpmc/pmc.h Fri Jun 1 00:45:53 2018 (r334464) @@ -114,9 +114,10 @@ int pmc_event_names_of_class(enum pmc_class _cl, const int *_nevents); int pmc_pmu_enabled(void); -void pmc_pmu_print_counters(void); +void pmc_pmu_print_counters(const char *); void pmc_pmu_print_counter_desc(const char *); void pmc_pmu_print_counter_desc_long(const char *); +void pmc_pmu_print_counter_full(const char *); uint64_t pmc_pmu_sample_rate_get(const char *); int pmc_pmu_pmcallocate(const char *, struct pmc_op_pmcallocate *); const char *pmc_pmu_event_get_by_idx(int idx); Modified: head/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- head/usr.sbin/pmcstat/pmcstat.c Fri Jun 1 00:45:48 2018 (r334463) +++ head/usr.sbin/pmcstat/pmcstat.c Fri Jun 1 00:45:53 2018 (r334464) @@ -820,7 +820,7 @@ main(int argc, char **argv) pmc_pmu_enabled() == 0) errx(EX_USAGE, "pmu features not supported on host or hwpmc not loaded"); if (do_listcounters) { - pmc_pmu_print_counters(); + pmc_pmu_print_counters(NULL); } else if (do_descr) { pmc_pmu_print_counter_desc(event); } else if (do_long_descr) { From owner-svn-src-head@freebsd.org Fri Jun 1 00:46:02 2018 Return-Path: Delivered-To: svn-src-head@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 D3C84EF3464; Fri, 1 Jun 2018 00:46:01 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C8396A74A; Fri, 1 Jun 2018 00:46:01 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A92D21AAB; Fri, 1 Jun 2018 00:46:00 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w510k032036463; Fri, 1 Jun 2018 00:46:00 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w510jx4i036457; Fri, 1 Jun 2018 00:45:59 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201806010045.w510jx4i036457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Fri, 1 Jun 2018 00:45:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334465 - head/usr.sbin/pmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/usr.sbin/pmc X-SVN-Commit-Revision: 334465 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 00:46:02 -0000 Author: mmacy Date: Fri Jun 1 00:45:59 2018 New Revision: 334465 URL: https://svnweb.freebsd.org/changeset/base/334465 Log: pmc: add list-events command Added: head/usr.sbin/pmc/cmd_pmc_list.c - copied, changed from r334464, head/usr.sbin/pmc/pmc.c Modified: head/usr.sbin/pmc/Makefile (contents, props changed) head/usr.sbin/pmc/cmd_pmc.h (contents, props changed) head/usr.sbin/pmc/pmc.c (contents, props changed) Modified: head/usr.sbin/pmc/Makefile ============================================================================== --- head/usr.sbin/pmc/Makefile Fri Jun 1 00:45:53 2018 (r334464) +++ head/usr.sbin/pmc/Makefile Fri Jun 1 00:45:59 2018 (r334465) @@ -7,6 +7,7 @@ MAN= LIBADD= kvm pmc m ncursesw pmcstat elf -SRCS= pmc.c pmc_util.c cmd_pmc_stat.c +SRCS= pmc.c pmc_util.c cmd_pmc_stat.c \ + cmd_pmc_list.c .include Modified: head/usr.sbin/pmc/cmd_pmc.h ============================================================================== --- head/usr.sbin/pmc/cmd_pmc.h Fri Jun 1 00:45:53 2018 (r334464) +++ head/usr.sbin/pmc/cmd_pmc.h Fri Jun 1 00:45:59 2018 (r334465) @@ -42,6 +42,7 @@ typedef int (*cmd_disp_t)(int, char **); int cmd_pmc_stat(int, char **); int cmd_pmc_stat_system(int, char **); +int cmd_pmc_list_events(int, char **); int pmc_util_get_pid(struct pmcstat_args *); void pmc_util_start_pmcs(struct pmcstat_args *); Copied and modified: head/usr.sbin/pmc/cmd_pmc_list.c (from r334464, head/usr.sbin/pmc/pmc.c) ============================================================================== --- head/usr.sbin/pmc/pmc.c Fri Jun 1 00:45:53 2018 (r334464, copy source) +++ head/usr.sbin/pmc/cmd_pmc_list.c Fri Jun 1 00:45:59 2018 (r334465) @@ -24,91 +24,105 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD$ - * */ -#include -#include +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include #include -#include -#include +#include +#include +#include +#include + +#include +#include #include +#include +#include +#include +#include +#include #include -#include +#include +#include #include #include -#include +#include +#include +#include +#include +#include +#include +#include #include #include #include #include "cmd_pmc.h" -int pmc_displayheight = DEFAULT_DISPLAY_HEIGHT; -int pmc_displaywidth = DEFAULT_DISPLAY_WIDTH; -int pmc_kq; -struct pmcstat_args pmc_args; -struct pmcstat_pmcs pmcstat_pmcs = LIST_HEAD_INITIALIZER(pmcstat_pmcs); - -struct pmcstat_image_hash_list pmcstat_image_hash[PMCSTAT_NHASH]; - -struct pmcstat_process_hash_list pmcstat_process_hash[PMCSTAT_NHASH]; - -struct cmd_handler { - const char *ch_name; - cmd_disp_t ch_fn; +static struct option longopts[] = { + {"long-desc", no_argument, NULL, 'U'}, + {"desc", no_argument, NULL, 'u'}, + {"full", no_argument, NULL, 'f'}, + {NULL, 0, NULL, 0} }; -static struct cmd_handler disp_table[] = { - {"stat", cmd_pmc_stat}, - {"stat-system", cmd_pmc_stat_system}, - {NULL, NULL} -}; - static void usage(void) { errx(EX_USAGE, - "\t pmc management utility\n" - "\t stat run program and print stats\n" - "\t stat-system run program and print system wide stats for duration of execution\n" + "\t list events\n" + "\t -u, desc -- short description of event\n" + "\t -U, long-desc -- long description of event\n" + "\t -f, full -- full event details\n" ); } -static cmd_disp_t -disp_lookup(char *name) -{ - struct cmd_handler *hnd; - - for (hnd = disp_table; hnd->ch_name != NULL; hnd++) - if (strcmp(hnd->ch_name, name) == 0) - return (hnd->ch_fn); - return (NULL); -} - int -main(int argc, char **argv) +cmd_pmc_list_events(int argc, char **argv) { - cmd_disp_t disp; + int do_long_descr, do_descr, do_full; + int option; - pmc_args.pa_printfile = stderr; - STAILQ_INIT(&pmc_args.pa_events); - SLIST_INIT(&pmc_args.pa_targets); - if (argc == 1) + do_long_descr = do_descr = do_full = 0; + while ((option = getopt_long(argc, argv, "Uuf", longopts, NULL)) != -1) { + switch (option) { + case 'U': + do_long_descr = 1; + break; + case 'u': + do_descr = 1; + break; + case 'f': + do_full = 1; + break; + case '?': + default: + usage(); + } + } + argc -= optind; + argv += optind; + if ((do_long_descr | do_descr | do_full) && argc == 0) { + warnx("event or event substring required when option provided\n"); usage(); - if ((disp = disp_lookup(argv[1])) == NULL) - usage(); - argc--; - argv++; + } + if (do_full) + pmc_pmu_print_counter_full(argc ? argv[0] : NULL); + else if (do_long_descr) + pmc_pmu_print_counter_desc_long(argv[0]); + else if (do_descr) + pmc_pmu_print_counter_desc(argv[0]); + else + pmc_pmu_print_counters(argv[0]); - /* Allocate a kqueue */ - if ((pmc_kq = kqueue()) < 0) - err(EX_OSERR, "ERROR: Cannot allocate kqueue"); - if (pmc_init() < 0) - err(EX_UNAVAILABLE, - "ERROR: Initialization of the pmc(3) library failed" - ); - return (disp(argc, argv)); + return (0); } Modified: head/usr.sbin/pmc/pmc.c ============================================================================== --- head/usr.sbin/pmc/pmc.c Fri Jun 1 00:45:53 2018 (r334464) +++ head/usr.sbin/pmc/pmc.c Fri Jun 1 00:45:59 2018 (r334465) @@ -64,6 +64,7 @@ struct cmd_handler { static struct cmd_handler disp_table[] = { {"stat", cmd_pmc_stat}, {"stat-system", cmd_pmc_stat_system}, + {"list-events", cmd_pmc_list_events}, {NULL, NULL} }; @@ -73,7 +74,8 @@ usage(void) errx(EX_USAGE, "\t pmc management utility\n" "\t stat run program and print stats\n" - "\t stat-system run program and print system wide stats for duration of execution\n" + "\t stat-system run program and print system wide stats for duration of execution\n" + "\t list-events list PMC events available on host\n" ); } From owner-svn-src-head@freebsd.org Fri Jun 1 00:49:21 2018 Return-Path: Delivered-To: svn-src-head@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 9DA47EF3D3F; Fri, 1 Jun 2018 00:49:21 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 513816ABDE; Fri, 1 Jun 2018 00:49:21 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DF1521AAD; Fri, 1 Jun 2018 00:49:21 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w510nL8r036626; Fri, 1 Jun 2018 00:49:21 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w510nLZQ036625; Fri, 1 Jun 2018 00:49:21 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201806010049.w510nLZQ036625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Fri, 1 Jun 2018 00:49:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334466 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 334466 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 00:49:21 -0000 Author: mmacy Date: Fri Jun 1 00:49:20 2018 New Revision: 334466 URL: https://svnweb.freebsd.org/changeset/base/334466 Log: Update FreeBSD_version to reflect removal of in-kernel pmc tables for Intel Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Fri Jun 1 00:45:59 2018 (r334465) +++ head/sys/sys/param.h Fri Jun 1 00:49:20 2018 (r334466) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200065 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200066 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Fri Jun 1 01:05:36 2018 Return-Path: Delivered-To: svn-src-head@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 815F5EF9572; Fri, 1 Jun 2018 01:05:36 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2EB886B7FC; Fri, 1 Jun 2018 01:05:36 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CF9121DEA; Fri, 1 Jun 2018 01:05:36 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5115Zht046312; Fri, 1 Jun 2018 01:05:35 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5115YZT046306; Fri, 1 Jun 2018 01:05:34 GMT (envelope-from np@FreeBSD.org) Message-Id: <201806010105.w5115YZT046306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 1 Jun 2018 01:05:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334467 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 334467 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 01:05:36 -0000 Author: np Date: Fri Jun 1 01:05:34 2018 New Revision: 334467 URL: https://svnweb.freebsd.org/changeset/base/334467 Log: cxgbe(4): Retire an old check. Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_l2t.c head/sys/dev/cxgbe/t4_l2t.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_smt.c head/sys/dev/cxgbe/t4_smt.h Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Fri Jun 1 00:49:20 2018 (r334466) +++ head/sys/dev/cxgbe/adapter.h Fri Jun 1 01:05:34 2018 (r334467) @@ -81,11 +81,6 @@ prefetch(void *x) #define CTLTYPE_U64 CTLTYPE_QUAD #endif -#if (__FreeBSD_version >= 900030) || \ - ((__FreeBSD_version >= 802507) && (__FreeBSD_version < 900000)) -#define SBUF_DRAIN 1 -#endif - struct adapter; typedef struct adapter adapter_t; Modified: head/sys/dev/cxgbe/t4_l2t.c ============================================================================== --- head/sys/dev/cxgbe/t4_l2t.c Fri Jun 1 00:49:20 2018 (r334466) +++ head/sys/dev/cxgbe/t4_l2t.c Fri Jun 1 01:05:34 2018 (r334467) @@ -257,7 +257,6 @@ do_l2t_write_rpl(struct sge_iq *iq, const struct rss_h return (0); } -#ifdef SBUF_DRAIN static inline unsigned int vlan_prio(const struct l2t_entry *e) { @@ -335,4 +334,3 @@ skip: return (rc); } -#endif Modified: head/sys/dev/cxgbe/t4_l2t.h ============================================================================== --- head/sys/dev/cxgbe/t4_l2t.h Fri Jun 1 00:49:20 2018 (r334466) +++ head/sys/dev/cxgbe/t4_l2t.h Fri Jun 1 01:05:34 2018 (r334467) @@ -106,9 +106,6 @@ t4_l2t_release(struct l2t_entry *e) atomic_add_int(&d->nfree, 1); } - -#ifdef SBUF_DRAIN int sysctl_l2t(SYSCTL_HANDLER_ARGS); -#endif #endif /* __T4_L2T_H */ Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Fri Jun 1 00:49:20 2018 (r334466) +++ head/sys/dev/cxgbe/t4_main.c Fri Jun 1 01:05:34 2018 (r334467) @@ -559,7 +559,6 @@ static int sysctl_fec(SYSCTL_HANDLER_ARGS); static int sysctl_autoneg(SYSCTL_HANDLER_ARGS); static int sysctl_handle_t4_reg64(SYSCTL_HANDLER_ARGS); static int sysctl_temperature(SYSCTL_HANDLER_ARGS); -#ifdef SBUF_DRAIN static int sysctl_cctrl(SYSCTL_HANDLER_ARGS); static int sysctl_cim_ibq_obq(SYSCTL_HANDLER_ARGS); static int sysctl_cim_la(SYSCTL_HANDLER_ARGS); @@ -589,7 +588,6 @@ static int sysctl_tx_rate(SYSCTL_HANDLER_ARGS); static int sysctl_ulprx_la(SYSCTL_HANDLER_ARGS); static int sysctl_wcwr_stats(SYSCTL_HANDLER_ARGS); static int sysctl_tc_params(SYSCTL_HANDLER_ARGS); -#endif #ifdef TCP_OFFLOAD static int sysctl_tls_rx_ports(SYSCTL_HANDLER_ARGS); static int sysctl_tp_tick(SYSCTL_HANDLER_ARGS); @@ -5572,7 +5570,6 @@ t4_sysctls(struct adapter *sc) SYSCTL_ADD_INT(ctx, children, OID_AUTO, "core_vdd", CTLFLAG_RD, &sc->params.core_vdd, 0, "core Vdd (in mV)"); -#ifdef SBUF_DRAIN /* * dev.t4nex.X.misc. Marked CTLFLAG_SKIP to avoid information overload. */ @@ -5746,7 +5743,6 @@ t4_sysctls(struct adapter *sc) CTLTYPE_STRING | CTLFLAG_RD, sc, 0, sysctl_wcwr_stats, "A", "write combined work requests"); } -#endif #ifdef TCP_OFFLOAD if (is_offload(sc)) { @@ -6030,11 +6026,9 @@ cxgbe_sysctls(struct port_info *pi) &tc->flags, 0, "flags"); SYSCTL_ADD_UINT(ctx, children2, OID_AUTO, "refcount", CTLFLAG_RD, &tc->refcount, 0, "references to this class"); -#ifdef SBUF_DRAIN SYSCTL_ADD_PROC(ctx, children2, OID_AUTO, "params", CTLTYPE_STRING | CTLFLAG_RD, sc, (pi->port_id << 16) | i, sysctl_tc_params, "A", "traffic class parameters"); -#endif } /* @@ -6632,7 +6626,6 @@ sysctl_temperature(SYSCTL_HANDLER_ARGS) return (rc); } -#ifdef SBUF_DRAIN static int sysctl_cctrl(SYSCTL_HANDLER_ARGS) { @@ -8641,7 +8634,6 @@ done: return (rc); } -#endif #ifdef TCP_OFFLOAD static int Modified: head/sys/dev/cxgbe/t4_smt.c ============================================================================== --- head/sys/dev/cxgbe/t4_smt.c Fri Jun 1 00:49:20 2018 (r334466) +++ head/sys/dev/cxgbe/t4_smt.c Fri Jun 1 01:05:34 2018 (r334467) @@ -287,7 +287,6 @@ do_smt_write_rpl(struct sge_iq *iq, const struct rss_h return (0); } -#ifdef SBUF_DRAIN static char smt_state(const struct smt_entry *e) { @@ -343,4 +342,3 @@ skip: return (rc); } -#endif Modified: head/sys/dev/cxgbe/t4_smt.h ============================================================================== --- head/sys/dev/cxgbe/t4_smt.h Fri Jun 1 00:49:20 2018 (r334466) +++ head/sys/dev/cxgbe/t4_smt.h Fri Jun 1 01:05:34 2018 (r334467) @@ -84,9 +84,6 @@ t4_smt_release(struct smt_entry *e) } - -#ifdef SBUF_DRAIN int sysctl_smt(SYSCTL_HANDLER_ARGS); -#endif #endif /* __T4_SMT_H */ From owner-svn-src-head@freebsd.org Fri Jun 1 01:37:09 2018 Return-Path: Delivered-To: svn-src-head@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 31142EFDADD; Fri, 1 Jun 2018 01:37:09 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DA3FA6D180; Fri, 1 Jun 2018 01:37:08 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB457222C7; Fri, 1 Jun 2018 01:37:08 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w511b8jc061337; Fri, 1 Jun 2018 01:37:08 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w511b759061332; Fri, 1 Jun 2018 01:37:07 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201806010137.w511b759061332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 1 Jun 2018 01:37:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334471 - head/tests/sys/audit X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/tests/sys/audit X-SVN-Commit-Revision: 334471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 01:37:09 -0000 Author: asomers Date: Fri Jun 1 01:37:07 2018 New Revision: 334471 URL: https://svnweb.freebsd.org/changeset/base/334471 Log: audit(4): Add tests for the fr class of syscalls readlink and readlinkat are the only syscalls in this class. open and openat are as well, but they'll be handled in a different file. Also, tidy up the copyright headers of recently added files in this area. Submitted by: aniketp MFC after: 2 weeks Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15636 Added: head/tests/sys/audit/file-read.c (contents, props changed) Modified: head/tests/sys/audit/Makefile head/tests/sys/audit/file-create.c head/tests/sys/audit/utils.c head/tests/sys/audit/utils.h Modified: head/tests/sys/audit/Makefile ============================================================================== --- head/tests/sys/audit/Makefile Fri Jun 1 01:35:54 2018 (r334470) +++ head/tests/sys/audit/Makefile Fri Jun 1 01:37:07 2018 (r334471) @@ -3,9 +3,12 @@ TESTSDIR= ${TESTSBASE}/sys/audit ATF_TESTS_C= file-create +ATF_TESTS_C+= file-read SRCS.file-create+= file-create.c SRCS.file-create+= utils.c +SRCS.file-read+= file-read.c +SRCS.file-read+= utils.c TEST_METADATA+= timeout="30" TEST_METADATA+= required_user="root" Modified: head/tests/sys/audit/file-create.c ============================================================================== --- head/tests/sys/audit/file-create.c Fri Jun 1 01:35:54 2018 (r334470) +++ head/tests/sys/audit/file-create.c Fri Jun 1 01:37:07 2018 (r334471) @@ -1,6 +1,5 @@ /*- * Copyright 2018 Aniket Pandey - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Added: head/tests/sys/audit/file-read.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/audit/file-read.c Fri Jun 1 01:37:07 2018 (r334471) @@ -0,0 +1,136 @@ +/*- + * Copyright 2018 Aniket Pandey + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + +#include "utils.h" + +static struct pollfd fds[1]; +static char buff[1024]; +static const char *path = "fileforaudit"; +static const char *successreg = "fileforaudit.*return,success"; +static const char *failurereg = "fileforaudit.*return,failure"; + + +ATF_TC_WITH_CLEANUP(readlink_success); +ATF_TC_HEAD(readlink_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "readlink(2) call"); +} + +ATF_TC_BODY(readlink_success, tc) +{ + memset(buff, 0, sizeof(buff)); + ATF_REQUIRE_EQ(0, symlink("symlink", path)); + FILE *pipefd = setup(fds, "fr"); + ATF_REQUIRE(readlink(path, buff, sizeof(buff)-1) != -1); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(readlink_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(readlink_failure); +ATF_TC_HEAD(readlink_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "readlink(2) call"); +} + +ATF_TC_BODY(readlink_failure, tc) +{ + memset(buff, 0, sizeof(buff)); + FILE *pipefd = setup(fds, "fr"); + /* Failure reason: symbolic link does not exist */ + ATF_REQUIRE_EQ(-1, readlink(path, buff, sizeof(buff)-1)); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(readlink_failure, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(readlinkat_success); +ATF_TC_HEAD(readlinkat_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "readlinkat(2) call"); +} + +ATF_TC_BODY(readlinkat_success, tc) +{ + memset(buff, 0, sizeof(buff)); + ATF_REQUIRE_EQ(0, symlink("symlink", path)); + FILE *pipefd = setup(fds, "fr"); + ATF_REQUIRE(readlinkat(AT_FDCWD, path, buff, sizeof(buff)-1) != -1); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(readlinkat_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(readlinkat_failure); +ATF_TC_HEAD(readlinkat_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "readlinkat(2) call"); +} + +ATF_TC_BODY(readlinkat_failure, tc) +{ + memset(buff, 0, sizeof(buff)); + FILE *pipefd = setup(fds, "fr"); + /* Failure reason: symbolic link does not exist */ + ATF_REQUIRE_EQ(-1, readlinkat(AT_FDCWD, path, buff, sizeof(buff)-1)); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(readlinkat_failure, tc) +{ + cleanup(); +} + + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, readlink_success); + ATF_TP_ADD_TC(tp, readlink_failure); + ATF_TP_ADD_TC(tp, readlinkat_success); + ATF_TP_ADD_TC(tp, readlinkat_failure); + + return (atf_no_error()); +} Modified: head/tests/sys/audit/utils.c ============================================================================== --- head/tests/sys/audit/utils.c Fri Jun 1 01:35:54 2018 (r334470) +++ head/tests/sys/audit/utils.c Fri Jun 1 01:37:07 2018 (r334471) @@ -1,6 +1,5 @@ /*- * Copyright 2018 Aniket Pandey - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/tests/sys/audit/utils.h ============================================================================== --- head/tests/sys/audit/utils.h Fri Jun 1 01:35:54 2018 (r334470) +++ head/tests/sys/audit/utils.h Fri Jun 1 01:37:07 2018 (r334471) @@ -1,6 +1,5 @@ /*- * Copyright 2018 Aniket Pandey - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-svn-src-head@freebsd.org Fri Jun 1 04:14:18 2018 Return-Path: Delivered-To: svn-src-head@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 1F061FD0DCC; Fri, 1 Jun 2018 04:14:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C806C74596; Fri, 1 Jun 2018 04:14:16 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A546023CF3; Fri, 1 Jun 2018 04:14:16 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w514EGna041747; Fri, 1 Jun 2018 04:14:16 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w514EGrt041746; Fri, 1 Jun 2018 04:14:16 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806010414.w514EGrt041746@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Fri, 1 Jun 2018 04:14:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334472 - head/usr.sbin/service X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.sbin/service X-SVN-Commit-Revision: 334472 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 04:14:18 -0000 Author: eadler Date: Fri Jun 1 04:14:16 2018 New Revision: 334472 URL: https://svnweb.freebsd.org/changeset/base/334472 Log: service(1): Improve manual page * Sort options.. * Fix some typos. * Use one Bd macro for code blocks instead of a bunch of Dl macros. * Improve formatting. * Clarify 'jail' argument PR: 228552 Submitted by: 0mp MFC After: 3 weeks Modified: head/usr.sbin/service/service.8 Modified: head/usr.sbin/service/service.8 ============================================================================== --- head/usr.sbin/service/service.8 Fri Jun 1 01:37:07 2018 (r334471) +++ head/usr.sbin/service/service.8 Fri Jun 1 04:14:16 2018 (r334472) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 15, 2018 +.Dd May 31, 2018 .Dt SERVICE 8 .Os .Sh NAME @@ -32,19 +32,24 @@ .Nd "control (start/stop/etc.) or list system services" .Sh SYNOPSIS .Nm -.Op Fl j Ao jail name or id Ac +.Op Fl j Ar jail .Fl e .Nm -.Op Fl j Ao jail name or id Ac +.Op Fl j Ar jail .Fl R .Nm -.Op Fl j Ao jail name or id Ac +.Op Fl j Ar jail .Op Fl v -.Fl l | r +.Fl l .Nm -.Op Fl j Ao jail name or id Ac +.Op Fl j Ar jail .Op Fl v -.Ar start|stop|etc. +.Fl r +.Nm +.Op Fl j Ar jail +.Op Fl v +.Ar script +.Ar command .Sh DESCRIPTION The .Nm @@ -52,14 +57,16 @@ command is an easy interface to the rc.d system. Its primary purpose is to start and stop services provided by the rc.d scripts. When used for this purpose it will set the same restricted -environment that is in use at boot time (see below). +environment that is in use at boot time +.Po +see +.Sx ENVIRONMENT +.Pc . It can also be used to list the scripts using various criteria. .Pp The options are as follows: .Bl -tag -width F1 -.It Fl j Ao jail name or id Ac -Perform the given actions under the named jail. .It Fl e List services that are enabled. The list of scripts to check is compiled using @@ -70,8 +77,11 @@ then that list of scripts is checked for an .Qq rcvar assignment. If present the script is checked to see if it is enabled. -.It Fl R -Restart all enabled local services. +.It Fl j Ar jail +Perform the given actions under the named jail. +The +.Ar jail +argument can be either a jail ID or a jail name. .It Fl l List all files in .Pa /etc/rc.d @@ -88,8 +98,10 @@ Generate the as in .Fl e above, but list all of the files, not just what is enabled. +.It Fl R +Restart all enabled local services. .It Fl v -Be slightly more verbose +Be slightly more verbose. .El .Sh ENVIRONMENT When used to run rc.d scripts the @@ -111,21 +123,24 @@ at boot time. The following are examples of typical usage of the .Nm command: +.Bd -literal -offset -ident +service named status +service -j dns named status +service -rv +.Ed .Pp -.Dl "service named status" -.Dl "service -j dns named status" -.Dl "service -rv" -.Pp The following programmable completion entry can be use in .Xr bash 1 for the names of the rc.d scripts: -.Dl "_service () {" -.Dl " local cur" -.Dl " cur=${COMP_WORDS[COMP_CWORD]}" -.Dl " COMPREPLY=( $( compgen -W '$( service -l )' -- $cur ) )" -.Dl " return 0" -.Dl "}" -.Dl "complete -F _service service" +.Bd -literal -offset -ident +_service () { + local cur + cur=${COMP_WORDS[COMP_CWORD]} + COMPREPLY=( $( compgen -W '$( service -l )' -- $cur ) ) + return 0 +} +complete -F _service service +.Ed .Sh SEE ALSO .Xr bash 1 Pq Pa ports/shells/bash , .Xr rc.conf 5 , From owner-svn-src-head@freebsd.org Fri Jun 1 05:51:42 2018 Return-Path: Delivered-To: svn-src-head@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 EDFA8EF3749; Fri, 1 Jun 2018 05:51:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E0767D1CC; Fri, 1 Jun 2018 05:51:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 66CD424C58; Fri, 1 Jun 2018 05:51:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w515pfYj090928; Fri, 1 Jun 2018 05:51:41 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w515pfoB090926; Fri, 1 Jun 2018 05:51:41 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806010551.w515pfoB090926@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Fri, 1 Jun 2018 05:51:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334474 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334474 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 05:51:42 -0000 Author: eadler Date: Fri Jun 1 05:51:40 2018 New Revision: 334474 URL: https://svnweb.freebsd.org/changeset/base/334474 Log: top(1): Display of TID when using 'H' flag Some users prefer seeing the TID when viewing individual threads. This makes sense as the PID will be the same for multiple entries. An attempt was made to include both, but there is insufficient room. As such, using the TID. While here, rename the header variables to be more understandable. Discussed with: mmacy Reported on: 2009-10-07 Modified: head/usr.bin/top/machine.c head/usr.bin/top/top.1 Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Fri Jun 1 05:48:28 2018 (r334473) +++ head/usr.bin/top/machine.c Fri Jun 1 05:51:40 2018 (r334474) @@ -97,18 +97,18 @@ static char io_header[] = #define io_Proc_format \ "%5d%*s %-*.*s %6ld %6ld %6ld %6ld %6ld %6ld %6.2f%% %.*s" -static char smp_header_thr[] = +static char smp_header_thr_and_pid[] = " PID%*s %-*.*s THR PRI NICE SIZE RES%*s STATE C TIME %7s COMMAND"; -static char smp_header[] = - " PID%*s %-*.*s " "PRI NICE SIZE RES%*s STATE C TIME %7s COMMAND"; +static char smp_header_tid_only[] = + " THR%*s %-*.*s " "PRI NICE SIZE RES%*s STATE C TIME %7s COMMAND"; #define smp_Proc_format \ "%5d%*s %-*.*s %s%3d %4s%7s %6s%*.*s %-6.6s %2d%7s %6.2f%% %.*s" -static char up_header_thr[] = +static char up_header_thr_and_pid[] = " PID%*s %-*.*s THR PRI NICE SIZE RES%*s STATE TIME %7s COMMAND"; -static char up_header[] = - " PID%*s %-*.*s " "PRI NICE SIZE RES%*s STATE TIME %7s COMMAND"; +static char up_header_tid_only[] = + " THR%*s %-*.*s " "PRI NICE SIZE RES%*s STATE TIME %7s COMMAND"; #define up_Proc_format \ "%5d%*s %-*.*s %s%3d %4s%7s %6s%*.*s %-6.6s%.0d%7s %6.2f%% %.*s" @@ -436,8 +436,8 @@ format_header(char *uname_field) * separate lines). */ prehead = smpmode ? - (ps.thread ? smp_header : smp_header_thr) : - (ps.thread ? up_header : up_header_thr); + (ps.thread ? smp_header_tid_only : smp_header_thr_and_pid) : + (ps.thread ? up_header_tid_only : up_header_thr_and_pid); snprintf(Header, sizeof(Header), prehead, jidlength, ps.jail ? " JID" : "", namelength, namelength, uname_field, @@ -1145,7 +1145,7 @@ format_next_process(caddr_t xhandle, char *(*get_useri (int)(sizeof(thr_buf) - 2), pp->ki_numthreads); snprintf(fmt, sizeof(fmt), proc_fmt, - pp->ki_pid, + (ps.thread) ? pp->ki_tid : pp->ki_pid, jidlength, jid_buf, namelength, namelength, (*get_userid)(pp->ki_ruid), thr_buf, Modified: head/usr.bin/top/top.1 ============================================================================== --- head/usr.bin/top/top.1 Fri Jun 1 05:48:28 2018 (r334473) +++ head/usr.bin/top/top.1 Fri Jun 1 05:51:40 2018 (r334474) @@ -331,6 +331,7 @@ command. .TP .B H Toggle the display of threads. +Also toggles the display of PID or TID. .TP .B i (or From owner-svn-src-head@freebsd.org Fri Jun 1 05:54:08 2018 Return-Path: Delivered-To: svn-src-head@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 08228EF3E0A for ; Fri, 1 Jun 2018 05:54:08 +0000 (UTC) (envelope-from eadler@freebsd.org) Received: from smtp.freebsd.org (unknown [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46E837D765 for ; Fri, 1 Jun 2018 05:54:07 +0000 (UTC) (envelope-from eadler@freebsd.org) Received: from mail-yw0-f169.google.com (mail-yw0-f169.google.com [209.85.161.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) (Authenticated sender: eadler) by smtp.freebsd.org (Postfix) with ESMTPSA id 0B507164CB for ; Fri, 1 Jun 2018 05:54:07 +0000 (UTC) (envelope-from eadler@freebsd.org) Received: by mail-yw0-f169.google.com with SMTP id v197-v6so6638238ywc.13 for ; Thu, 31 May 2018 22:54:07 -0700 (PDT) X-Gm-Message-State: ALKqPwdVYK/V1GePM21tt63oYIVdQ4LZJkIxAuTsUi/lT1hJ6ImsLbSy OL9A75+xqRuOnK1eqv/BwdU8m91651fkV2PFPpPQBA== X-Google-Smtp-Source: ADUXVKJu0uB7xsXfEjoLiKWL9MXttrgyLv3Qj25HdxR1cU3nmpw9C7LXbhp4CInuRgSfsTYBaKwK4HLcvux+bW8PD0w= X-Received: by 2002:a81:af1d:: with SMTP id n29-v6mr5188070ywh.113.1527832446486; Thu, 31 May 2018 22:54:06 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:ef50:0:0:0:0:0 with HTTP; Thu, 31 May 2018 22:53:35 -0700 (PDT) In-Reply-To: <201806010551.w515pfoB090926@repo.freebsd.org> References: <201806010551.w515pfoB090926@repo.freebsd.org> From: Eitan Adler Date: Thu, 31 May 2018 22:53:35 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r334474 - head/usr.bin/top To: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 05:54:08 -0000 On 31 May 2018 at 22:51, Eitan Adler wrote: > Author: eadler > Date: Fri Jun 1 05:51:40 2018 > New Revision: 334474 > URL: https://svnweb.freebsd.org/changeset/base/334474 > > Log: > top(1): Display of TID when using 'H' flag > > Some users prefer seeing the TID when viewing individual threads. This > makes sense as the PID will be the same for multiple entries. An attempt > was made to include both, but there is insufficient room. As such, using > the TID. > > While here, rename the header variables to be more understandable. > > Discussed with: mmacy > Reported on: 2009-10-07 PR: 139389 -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams From owner-svn-src-head@freebsd.org Fri Jun 1 08:54:53 2018 Return-Path: Delivered-To: svn-src-head@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 1E918F71418; Fri, 1 Jun 2018 08:54:53 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AD1F86BC55; Fri, 1 Jun 2018 08:54:52 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8884126A25; Fri, 1 Jun 2018 08:54:52 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w518sqmp081322; Fri, 1 Jun 2018 08:54:52 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w518spmY081318; Fri, 1 Jun 2018 08:54:51 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <201806010854.w518spmY081318@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Fri, 1 Jun 2018 08:54:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334475 - in head/usr.bin/indent: . tests X-SVN-Group: head X-SVN-Commit-Author: pstef X-SVN-Commit-Paths: in head/usr.bin/indent: . tests X-SVN-Commit-Revision: 334475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 08:54:53 -0000 Author: pstef Date: Fri Jun 1 08:54:51 2018 New Revision: 334475 URL: https://svnweb.freebsd.org/changeset/base/334475 Log: indent(1): identifiers inside parentheses are not declarations Also make lparen position calculation consider tab stops. This improves function pointer typedef formatting. Added: head/usr.bin/indent/tests/parens.0 (contents, props changed) head/usr.bin/indent/tests/parens.0.pro (contents, props changed) head/usr.bin/indent/tests/parens.0.stdout (contents, props changed) Modified: head/usr.bin/indent/indent.c head/usr.bin/indent/tests/Makefile Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Fri Jun 1 05:51:40 2018 (r334474) +++ head/usr.bin/indent/indent.c Fri Jun 1 08:54:51 2018 (r334475) @@ -552,7 +552,7 @@ check_type: *e_code++ = ' '; ps.want_blank = false; if (ps.in_decl && !ps.block_init && !ps.dumped_decl_indent && - !is_procname) { + !is_procname && ps.paren_level == 0) { /* function pointer declarations */ if (troff) { sprintf(e_code, "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, token); @@ -565,7 +565,7 @@ check_type: } if (!troff) *e_code++ = token[0]; - ps.paren_indents[ps.p_l_follow - 1] = e_code - s_code; + ps.paren_indents[ps.p_l_follow - 1] = count_spaces_until(1, s_code, e_code) - 1; if (sp_sw && ps.p_l_follow == 1 && extra_expression_indent && ps.paren_indents[0] < 2 * ps.ind_size) ps.paren_indents[0] = 2 * ps.ind_size; @@ -620,7 +620,7 @@ check_type: case unary_op: /* this could be any unary operation */ if (!ps.dumped_decl_indent && ps.in_decl && !is_procname && - !ps.block_init) { + !ps.block_init && ps.paren_level == 0) { /* pointer declarations */ if (troff) { if (ps.want_blank) @@ -755,7 +755,7 @@ check_type: ps.just_saw_decl--; if (ps.in_decl && s_code == e_code && !ps.block_init && - !ps.dumped_decl_indent) { + !ps.dumped_decl_indent && ps.paren_level == 0) { /* indent stray semicolons in declarations */ indent_declaration(dec_ind - 1, tabs_to_var); ps.dumped_decl_indent = true; @@ -977,7 +977,7 @@ check_type: if (ps.in_decl) { /* if we are in a declaration, we must indent * identifier */ if (type_code != funcname || !procnames_start_line) { - if (!ps.block_init && !ps.dumped_decl_indent) { + if (!ps.block_init && !ps.dumped_decl_indent && ps.paren_level == 0) { if (troff) { if (ps.want_blank) *e_code++ = ' '; @@ -1049,7 +1049,7 @@ check_type: * if comma does not start the * line */ if (ps.in_decl && is_procname == 0 && !ps.block_init && - !ps.dumped_decl_indent) { + !ps.dumped_decl_indent && ps.paren_level == 0) { /* indent leading commas and not the actual identifiers */ indent_declaration(dec_ind - 1, tabs_to_var); ps.dumped_decl_indent = true; Modified: head/usr.bin/indent/tests/Makefile ============================================================================== --- head/usr.bin/indent/tests/Makefile Fri Jun 1 05:51:40 2018 (r334474) +++ head/usr.bin/indent/tests/Makefile Fri Jun 1 08:54:51 2018 (r334475) @@ -23,6 +23,9 @@ ${PACKAGE}FILES+= nsac.0.stdout ${PACKAGE}FILES+= nsac.0.pro ${PACKAGE}FILES+= offsetof.0 ${PACKAGE}FILES+= offsetof.0.stdout +${PACKAGE}FILES+= parens.0 +${PACKAGE}FILES+= parens.0.stdout +${PACKAGE}FILES+= parens.0.pro ${PACKAGE}FILES+= sac.0 ${PACKAGE}FILES+= sac.0.stdout ${PACKAGE}FILES+= sac.0.pro Added: head/usr.bin/indent/tests/parens.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/indent/tests/parens.0 Fri Jun 1 08:54:51 2018 (r334475) @@ -0,0 +1,24 @@ +/* $FreeBSD$ */ +typedef void (*xxxxxxxxxxx) (int, + char); + +typedef char (*xxxxxxxxxxxxxxxxxxxxxxxxxxxx) (int *, + unsigned *, + char, + float *); + +void +test(void) +{ + char chars[secondf(firstf(B), + *here)]; + + float xxx = yyyyyyyyyyyyyy(zzzzzzzzzzzzz(p1, + (p2), + p3)); + + if (1) { + char *xxx = firstf(secondf2(p1, + p2)); + } +} Added: head/usr.bin/indent/tests/parens.0.pro ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/indent/tests/parens.0.pro Fri Jun 1 08:54:51 2018 (r334475) @@ -0,0 +1,2 @@ +/* $FreeBSD$ */ +-ts4 -i4 -di12 Added: head/usr.bin/indent/tests/parens.0.stdout ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/indent/tests/parens.0.stdout Fri Jun 1 08:54:51 2018 (r334475) @@ -0,0 +1,24 @@ +/* $FreeBSD$ */ +typedef void (*xxxxxxxxxxx) (int, + char); + +typedef char (*xxxxxxxxxxxxxxxxxxxxxxxxxxxx) (int *, + unsigned *, + char, + float *); + +void +test(void) +{ + char chars[secondf(firstf(B), + *here)]; + + float xxx = yyyyyyyyyyyyyy(zzzzzzzzzzzzz(p1, + (p2), + p3)); + + if (1) { + char *xxx = firstf(secondf2(p1, + p2)); + } +} From owner-svn-src-head@freebsd.org Fri Jun 1 09:29:11 2018 Return-Path: Delivered-To: svn-src-head@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 B3624F7A4EF; Fri, 1 Jun 2018 09:29:11 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mx0.gentlemail.de (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]) (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 0A80D6DACD; Fri, 1 Jun 2018 09:29:10 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mh0.gentlemail.de (ezra.dcm1.omnilan.net [78.138.80.135]) by mx0.gentlemail.de (8.14.5/8.14.5) with ESMTP id w519T76h071080; Fri, 1 Jun 2018 11:29:07 +0200 (CEST) (envelope-from freebsd@omnilan.de) Received: from titan.inop.mo1.omnilan.net (s1.omnilan.de [217.91.127.234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mh0.gentlemail.de (Postfix) with ESMTPSA id 6AF96F68; Fri, 1 Jun 2018 11:29:07 +0200 (CEST) Subject: Re: svn commit: r333174 - head/sys/amd64/vmm/io To: Peter Grehan , rgrimes@freebsd.org Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org References: <201805021819.w42IJ1uJ032637@pdx.rh.CN85.dnsmgr.net> <5d7b4e28-8a4f-60b4-3c48-1dc001af0546@freebsd.org> From: Harry Schmalzbauer Organization: OmniLAN Message-ID: <1c56a6a7-b62e-2a02-24a5-a7f3ef2f9b5e@omnilan.de> Date: Fri, 1 Jun 2018 11:29:06 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <5d7b4e28-8a4f-60b4-3c48-1dc001af0546@freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Greylist: ACL 130 matched, not delayed by milter-greylist-4.2.7 (mx0.gentlemail.de [78.138.80.130]); Fri, 01 Jun 2018 11:29:07 +0200 (CEST) X-Milter: Spamilter (Reciever: mx0.gentlemail.de; Sender-ip: 78.138.80.135; Sender-helo: mh0.gentlemail.de; ) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 09:29:11 -0000 Am 02.05.2018 um 20:20 schrieb Peter Grehan: >> That places the MFC right before the optional 11.2 Beta3, I would rather >> see this "low risk" change merged before May 11th, the code freeze >> date and Beta1, if it is desired in 11.2, for maximal test exposure. > >  Sure, that can be done. Hope it's not too late to do so and somebody doing MFCs can take care of this one? Thanks, -harry From owner-svn-src-head@freebsd.org Fri Jun 1 09:17:21 2018 Return-Path: Delivered-To: svn-src-head@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 6AEB0F77284; Fri, 1 Jun 2018 09:17:21 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1995C6CF71; Fri, 1 Jun 2018 09:17:21 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF0BB26D46; Fri, 1 Jun 2018 09:17:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w519HKm8091178; Fri, 1 Jun 2018 09:17:20 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w519HKp4091177; Fri, 1 Jun 2018 09:17:20 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201806010917.w519HKp4091177@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 1 Jun 2018 09:17:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334476 - head/sys/dev/usb/template X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/dev/usb/template X-SVN-Commit-Revision: 334476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 09:17:21 -0000 Author: trasz Date: Fri Jun 1 09:17:20 2018 New Revision: 334476 URL: https://svnweb.freebsd.org/changeset/base/334476 Log: Set bDeviceClass properly for composite device (template 8). There should be no functional change. PR: 203289 Reviewed by: hselasky@ MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/usb/template/usb_template_serialnet.c Modified: head/sys/dev/usb/template/usb_template_serialnet.c ============================================================================== --- head/sys/dev/usb/template/usb_template_serialnet.c Fri Jun 1 08:54:51 2018 (r334475) +++ head/sys/dev/usb/template/usb_template_serialnet.c Fri Jun 1 09:17:20 2018 (r334476) @@ -342,7 +342,7 @@ struct usb_temp_device_desc usb_template_serialnet = { .idVendor = SERIALNET_DEFAULT_VENDOR_ID, .idProduct = SERIALNET_DEFAULT_PRODUCT_ID, .bcdDevice = 0x0100, - .bDeviceClass = UDCLASS_COMM, + .bDeviceClass = UDCLASS_IN_INTERFACE, .bDeviceSubClass = 0, .bDeviceProtocol = 0, .iManufacturer = SERIALNET_MANUFACTURER_INDEX, From owner-svn-src-head@freebsd.org Fri Jun 1 09:32:44 2018 Return-Path: Delivered-To: svn-src-head@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 1B4B8F7B483; Fri, 1 Jun 2018 09:32:44 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC0586DFE2; Fri, 1 Jun 2018 09:32:43 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D3CD2707F; Fri, 1 Jun 2018 09:32:43 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w519WhW5001356; Fri, 1 Jun 2018 09:32:43 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w519WhXD001354; Fri, 1 Jun 2018 09:32:43 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <201806010932.w519WhXD001354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Fri, 1 Jun 2018 09:32:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334477 - in head/usr.bin/indent: . tests X-SVN-Group: head X-SVN-Commit-Author: pstef X-SVN-Commit-Paths: in head/usr.bin/indent: . tests X-SVN-Commit-Revision: 334477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 09:32:44 -0000 Author: pstef Date: Fri Jun 1 09:32:42 2018 New Revision: 334477 URL: https://svnweb.freebsd.org/changeset/base/334477 Log: indent(1): consider tab characters when forcing a newline after a comma Modified: head/usr.bin/indent/indent.c head/usr.bin/indent/tests/declarations.0 head/usr.bin/indent/tests/declarations.0.stdout Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Fri Jun 1 09:17:20 2018 (r334476) +++ head/usr.bin/indent/indent.c Fri Jun 1 09:32:42 2018 (r334477) @@ -1058,7 +1058,9 @@ check_type: if (ps.p_l_follow == 0) { if (ps.block_init_level <= 0) ps.block_init = 0; - if (break_comma && (!ps.leave_comma || compute_code_target() + (e_code - s_code) > max_col - tabsize)) + if (break_comma && (!ps.leave_comma || + count_spaces_until(compute_code_target(), s_code, e_code) > + max_col - tabsize)) force_nl = true; } break; Modified: head/usr.bin/indent/tests/declarations.0 ============================================================================== --- head/usr.bin/indent/tests/declarations.0 Fri Jun 1 09:17:20 2018 (r334476) +++ head/usr.bin/indent/tests/declarations.0 Fri Jun 1 09:32:42 2018 (r334477) @@ -44,6 +44,7 @@ void t2 (char *x, int y) ,n ,o ; + int chars[ /* push the comma beyond column 74 .... */ ], x; } const int int_minimum_size = Modified: head/usr.bin/indent/tests/declarations.0.stdout ============================================================================== --- head/usr.bin/indent/tests/declarations.0.stdout Fri Jun 1 09:17:20 2018 (r334476) +++ head/usr.bin/indent/tests/declarations.0.stdout Fri Jun 1 09:32:42 2018 (r334477) @@ -36,6 +36,8 @@ t2(char *x, int y) ,n ,o ; + int chars[ /* push the comma beyond column 74 .... */ ], + x; } const int int_minimum_size = From owner-svn-src-head@freebsd.org Fri Jun 1 09:58:46 2018 Return-Path: Delivered-To: svn-src-head@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 01ED4FCABF1; Fri, 1 Jun 2018 09:58:46 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A9F6B6F9D7; Fri, 1 Jun 2018 09:58:45 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 86EF7273BF; Fri, 1 Jun 2018 09:58:45 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w519wjcu011619; Fri, 1 Jun 2018 09:58:45 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w519wj6X011617; Fri, 1 Jun 2018 09:58:45 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <201806010958.w519wj6X011617@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Fri, 1 Jun 2018 09:58:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334480 - in head/usr.bin/indent: . tests X-SVN-Group: head X-SVN-Commit-Author: pstef X-SVN-Commit-Paths: in head/usr.bin/indent: . tests X-SVN-Commit-Revision: 334480 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 09:58:46 -0000 Author: pstef Date: Fri Jun 1 09:58:44 2018 New Revision: 334480 URL: https://svnweb.freebsd.org/changeset/base/334480 Log: indent(1): don't add unneeded space to function pointer declarations If the current token is an opening parenthesis, it's either a function call (or sizeof or offsetof) or a declaration. The former doesn't need a space before the parenthesis. Modified: head/usr.bin/indent/indent.c head/usr.bin/indent/tests/declarations.0.stdout Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Fri Jun 1 09:44:23 2018 (r334479) +++ head/usr.bin/indent/indent.c Fri Jun 1 09:58:44 2018 (r334480) @@ -542,15 +542,6 @@ check_type: nitems(ps.paren_indents)); ps.p_l_follow--; } - if (ps.want_blank && *token != '[' && - ((ps.last_token != ident && ps.last_token != funcname) || - proc_calls_space || - /* offsetof (1) is never allowed a space; sizeof (2) gets - * one iff -bs; all other keywords (>2) always get a space - * before lparen */ - ps.keyword + Bill_Shannon > 2)) - *e_code++ = ' '; - ps.want_blank = false; if (ps.in_decl && !ps.block_init && !ps.dumped_decl_indent && !is_procname && ps.paren_level == 0) { /* function pointer declarations */ @@ -563,6 +554,14 @@ check_type: } ps.dumped_decl_indent = true; } + else if (ps.want_blank && *token != '[' && + ((ps.last_token != ident && ps.last_token != funcname) || + /* offsetof (1) is never allowed a space; sizeof (2) gets + * one iff -bs; all other keywords (>2) always get a space + * before lparen */ + ps.keyword + Bill_Shannon > 2)) + *e_code++ = ' '; + ps.want_blank = false; if (!troff) *e_code++ = token[0]; ps.paren_indents[ps.p_l_follow - 1] = count_spaces_until(1, s_code, e_code) - 1; Modified: head/usr.bin/indent/tests/declarations.0.stdout ============================================================================== --- head/usr.bin/indent/tests/declarations.0.stdout Fri Jun 1 09:44:23 2018 (r334479) +++ head/usr.bin/indent/tests/declarations.0.stdout Fri Jun 1 09:58:44 2018 (r334480) @@ -32,7 +32,7 @@ t2(char *x, int y) int a, b, c; int *d, *e, *f; - int (*g) (), (*h) (), (*i) (); + int (*g) (), (*h) (), (*i) (); int j, k, l; int m ,n From owner-svn-src-head@freebsd.org Fri Jun 1 09:44:24 2018 Return-Path: Delivered-To: svn-src-head@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 2AD64F7E00E; Fri, 1 Jun 2018 09:44:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CCF2E6E9EA; Fri, 1 Jun 2018 09:44:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD69227212; Fri, 1 Jun 2018 09:44:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w519iNkZ006376; Fri, 1 Jun 2018 09:44:23 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w519iNkT006375; Fri, 1 Jun 2018 09:44:23 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201806010944.w519iNkT006375@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 1 Jun 2018 09:44:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334479 - head/sys/dev/acpica X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/acpica X-SVN-Commit-Revision: 334479 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 09:44:24 -0000 Author: avg Date: Fri Jun 1 09:44:23 2018 New Revision: 334479 URL: https://svnweb.freebsd.org/changeset/base/334479 Log: call AcpiLeaveSleepStatePrep after re-enabling interrupts I want to do this change because this call (actually, AcpiHwLegacyWakePrep) does a memory allocation and ACPI namespace evaluation. Although it is not very likely to run into any trouble, it is still not safe to make those calls with interrupts disabled. witness(4) and malloc(9) do not currently check for a context with interrupts disabled via intr_disable and we lack a facility for doing that. So, those unsafe operations fly under the radar. But if intr_disable in acpi_EnterSleepState was replaced with spinlock_enter (which it probably should be), then witness and malloc would immediately complain. Also, AcpiLeaveSleepStatePrep is documented as called when interrupts are enabled. It used to require disabled interrupts, but that requirement was changed a long time ago when support for _BFS and _GTS was removed from ACPICA. The ACPI wakeup sequence is very sensitive to changes. I consider this change to be correct, but there can be fallouts from it. What AcpiHwLegacyWakePrep essentially does is writing a value corresponding to S0 into SLP_TYPx bits of PM1 Control Register(s). According to ACPI specifications that write should be a NOP as SLP_EN bit is not set. But I see in some chipset specifications that they allow to ignore SLP_EN altogether and to act on a change of SLP_TYPx alone. Also, there are a couple of accesses to ACPI hardware before the new location of the call to AcpiLeaveSleepStatePrep. One is to clear the power button status and the other is to enable SCI. So, the move may affect the interaction between then OS and ACPI platform. I have not seen any regressions on my test system, but it's a desktop. MFC after: 5 weeks Modified: head/sys/dev/acpica/acpi.c Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Fri Jun 1 09:41:15 2018 (r334478) +++ head/sys/dev/acpica/acpi.c Fri Jun 1 09:44:23 2018 (r334479) @@ -2977,8 +2977,6 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state) if (sleep_result == 1 && state != ACPI_STATE_S4) AcpiWriteBitRegister(ACPI_BITREG_SCI_ENABLE, ACPI_ENABLE_EVENT); - AcpiLeaveSleepStatePrep(state); - if (sleep_result == 1 && state == ACPI_STATE_S3) { /* * Prevent mis-interpretation of the wakeup by power button @@ -3007,6 +3005,8 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state) /* call acpi_wakeup_machdep() again with interrupt enabled */ acpi_wakeup_machdep(sc, state, sleep_result, 1); + AcpiLeaveSleepStatePrep(state); + if (sleep_result == -1) goto backout; @@ -3015,8 +3015,8 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state) AcpiEnable(); } else { status = AcpiEnterSleepState(state); - AcpiLeaveSleepStatePrep(state); intr_restore(intr); + AcpiLeaveSleepStatePrep(state); if (ACPI_FAILURE(status)) { device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n", AcpiFormatException(status)); From owner-svn-src-head@freebsd.org Fri Jun 1 09:41:17 2018 Return-Path: Delivered-To: svn-src-head@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 EA49EF7D137; Fri, 1 Jun 2018 09:41:16 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9BBC26E693; Fri, 1 Jun 2018 09:41:16 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 65D83271A2; Fri, 1 Jun 2018 09:41:16 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w519fGB7003336; Fri, 1 Jun 2018 09:41:16 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w519fFYP003330; Fri, 1 Jun 2018 09:41:15 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <201806010941.w519fFYP003330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Fri, 1 Jun 2018 09:41:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334478 - in head/usr.bin/indent: . tests X-SVN-Group: head X-SVN-Commit-Author: pstef X-SVN-Commit-Paths: in head/usr.bin/indent: . tests X-SVN-Commit-Revision: 334478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 09:41:17 -0000 Author: pstef Date: Fri Jun 1 09:41:15 2018 New Revision: 334478 URL: https://svnweb.freebsd.org/changeset/base/334478 Log: indent(1): don't indent typedef declarations as object declarations Modified: head/usr.bin/indent/indent.c head/usr.bin/indent/indent_codes.h head/usr.bin/indent/lexi.c head/usr.bin/indent/tests/declarations.0 head/usr.bin/indent/tests/declarations.0.stdout Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Fri Jun 1 09:32:42 2018 (r334477) +++ head/usr.bin/indent/indent.c Fri Jun 1 09:41:15 2018 (r334478) @@ -937,6 +937,7 @@ check_type: } goto copy_id; /* move the token into line */ + case type_def: case storage: prefix_blankline_requested = 0; goto copy_id; @@ -955,7 +956,7 @@ check_type: } ps.in_or_st = true; /* this might be a structure or initialization * declaration */ - ps.in_decl = ps.decl_on_line = true; + ps.in_decl = ps.decl_on_line = ps.last_token != type_def; if ( /* !ps.in_or_st && */ ps.dec_nest <= 0) ps.just_saw_decl = 2; prefix_blankline_requested = 0; Modified: head/usr.bin/indent/indent_codes.h ============================================================================== --- head/usr.bin/indent/indent_codes.h Fri Jun 1 09:32:42 2018 (r334477) +++ head/usr.bin/indent/indent_codes.h Fri Jun 1 09:41:15 2018 (r334478) @@ -73,3 +73,5 @@ #define strpfx 33 #define storage 34 #define funcname 35 +#define type_def 36 + Modified: head/usr.bin/indent/lexi.c ============================================================================== --- head/usr.bin/indent/lexi.c Fri Jun 1 09:32:42 2018 (r334477) +++ head/usr.bin/indent/lexi.c Fri Jun 1 09:41:15 2018 (r334478) @@ -100,7 +100,7 @@ struct templ specials[] = {"static", 10}, {"struct", 3}, {"switch", 7}, - {"typedef", 10}, + {"typedef", 11}, {"union", 3}, {"unsigned", 4}, {"void", 4}, @@ -349,6 +349,9 @@ lexi(void) case 10: /* storage class specifier */ return (storage); + + case 11: /* typedef */ + return (type_def); default: /* all others are treated like any other * identifier */ Modified: head/usr.bin/indent/tests/declarations.0 ============================================================================== --- head/usr.bin/indent/tests/declarations.0 Fri Jun 1 09:32:42 2018 (r334477) +++ head/usr.bin/indent/tests/declarations.0 Fri Jun 1 09:41:15 2018 (r334478) @@ -1,6 +1,8 @@ /* $FreeBSD$ */ /* See r303570 */ +typedef void (*voidptr) (int *); + static const struct { double x; Modified: head/usr.bin/indent/tests/declarations.0.stdout ============================================================================== --- head/usr.bin/indent/tests/declarations.0.stdout Fri Jun 1 09:32:42 2018 (r334477) +++ head/usr.bin/indent/tests/declarations.0.stdout Fri Jun 1 09:41:15 2018 (r334478) @@ -1,6 +1,8 @@ /* $FreeBSD$ */ /* See r303570 */ +typedef void (*voidptr) (int *); + static const struct { double x; double y, z; From owner-svn-src-head@freebsd.org Fri Jun 1 11:15:00 2018 Return-Path: Delivered-To: svn-src-head@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 CB6F4F7189C; Fri, 1 Jun 2018 11:15:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7FEC57569A; Fri, 1 Jun 2018 11:15:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5CFC8280BD; Fri, 1 Jun 2018 11:15:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51BF02R051986; Fri, 1 Jun 2018 11:15:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51BF0Vr051985; Fri, 1 Jun 2018 11:15:00 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201806011115.w51BF0Vr051985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 1 Jun 2018 11:15:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334481 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 334481 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 11:15:01 -0000 Author: hselasky Date: Fri Jun 1 11:14:59 2018 New Revision: 334481 URL: https://svnweb.freebsd.org/changeset/base/334481 Log: Add more GFP macro definitions in the LinuxKPI. Submitted by: Johannes Lundberg MFC after: 1 week Sponsored by: Mellanox Technologies Sponsored by: Limelight Networks Modified: head/sys/compat/linuxkpi/common/include/linux/gfp.h Modified: head/sys/compat/linuxkpi/common/include/linux/gfp.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/gfp.h Fri Jun 1 09:58:44 2018 (r334480) +++ head/sys/compat/linuxkpi/common/include/linux/gfp.h Fri Jun 1 11:14:59 2018 (r334481) @@ -49,6 +49,9 @@ #define __GFP_NORETRY 0 #define __GFP_RECLAIM 0 #define __GFP_RECLAIMABLE 0 +#define __GFP_RETRY_MAYFAIL 0 +#define __GFP_MOVABLE 0 +#define __GFP_COMP 0 #define __GFP_IO 0 #define __GFP_NO_KSWAPD 0 @@ -56,6 +59,7 @@ #define __GFP_DMA32 (1U << 24) /* LinuxKPI only */ #define __GFP_BITS_SHIFT 25 #define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1) +#define __GFP_NOFAIL M_WAITOK #define GFP_NOWAIT M_NOWAIT #define GFP_ATOMIC (M_NOWAIT | M_USE_RESERVE) @@ -68,6 +72,7 @@ #define GFP_DMA32 __GFP_DMA32 #define GFP_TEMPORARY M_NOWAIT #define GFP_NATIVE_MASK (M_NOWAIT | M_WAITOK | M_USE_RESERVE | M_ZERO) +#define GFP_TRANSHUGE 0 CTASSERT((__GFP_DMA32 & GFP_NATIVE_MASK) == 0); CTASSERT((__GFP_BITS_MASK & GFP_NATIVE_MASK) == GFP_NATIVE_MASK); From owner-svn-src-head@freebsd.org Fri Jun 1 11:33:16 2018 Return-Path: Delivered-To: svn-src-head@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 C1309F74499; Fri, 1 Jun 2018 11:33:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 67CAF763A3; Fri, 1 Jun 2018 11:33:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48F8D283DE; Fri, 1 Jun 2018 11:33:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51BXFpI061460; Fri, 1 Jun 2018 11:33:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51BXEHH061458; Fri, 1 Jun 2018 11:33:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201806011133.w51BXEHH061458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 1 Jun 2018 11:33:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334482 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 334482 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 11:33:16 -0000 Author: hselasky Date: Fri Jun 1 11:33:14 2018 New Revision: 334482 URL: https://svnweb.freebsd.org/changeset/base/334482 Log: Improve high resolution timer support in the LinuxKPI. Submitted by: Johannes Lundberg MFC after: 1 week Sponsored by: Mellanox Technologies Sponsored by: Limelight Networks Modified: head/sys/compat/linuxkpi/common/include/linux/hrtimer.h head/sys/compat/linuxkpi/common/src/linux_hrtimer.c Modified: head/sys/compat/linuxkpi/common/include/linux/hrtimer.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/hrtimer.h Fri Jun 1 11:14:59 2018 (r334481) +++ head/sys/compat/linuxkpi/common/include/linux/hrtimer.h Fri Jun 1 11:33:14 2018 (r334482) @@ -36,6 +36,7 @@ enum hrtimer_mode { HRTIMER_MODE_REL, + HRTIMER_MODE_REL_PINNED = HRTIMER_MODE_REL, }; enum hrtimer_restart { @@ -47,31 +48,42 @@ struct hrtimer { enum hrtimer_restart (*function)(struct hrtimer *); struct mtx mtx; struct callout callout; + s64 expires; /* relative time in nanoseconds */ + s64 precision; /* in nanoseconds */ }; #define hrtimer_active(hrtimer) linux_hrtimer_active(hrtimer) #define hrtimer_cancel(hrtimer) linux_hrtimer_cancel(hrtimer) + #define hrtimer_init(hrtimer, clock, mode) do { \ CTASSERT((clock) == CLOCK_MONOTONIC); \ CTASSERT((mode) == HRTIMER_MODE_REL); \ linux_hrtimer_init(hrtimer); \ } while (0) + #define hrtimer_set_expires(hrtimer, time) \ linux_hrtimer_set_expires(hrtimer, time) + #define hrtimer_start(hrtimer, time, mode) do { \ CTASSERT((mode) == HRTIMER_MODE_REL); \ linux_hrtimer_start(hrtimer, time); \ } while (0) + #define hrtimer_start_range_ns(hrtimer, time, prec, mode) do { \ CTASSERT((mode) == HRTIMER_MODE_REL); \ linux_hrtimer_start_range_ns(hrtimer, time, prec); \ } while (0) +#define hrtimer_forward_now(hrtimer, interval) do { \ + linux_hrtimer_forward_now(hrtimer, interval); \ +} while (0) + bool linux_hrtimer_active(struct hrtimer *); int linux_hrtimer_cancel(struct hrtimer *); void linux_hrtimer_init(struct hrtimer *); void linux_hrtimer_set_expires(struct hrtimer *, ktime_t); void linux_hrtimer_start(struct hrtimer *, ktime_t); void linux_hrtimer_start_range_ns(struct hrtimer *, ktime_t, int64_t); +void linux_hrtimer_forward_now(struct hrtimer *, ktime_t); #endif /* _LINUX_HRTIMER_H_ */ Modified: head/sys/compat/linuxkpi/common/src/linux_hrtimer.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_hrtimer.c Fri Jun 1 11:14:59 2018 (r334481) +++ head/sys/compat/linuxkpi/common/src/linux_hrtimer.c Fri Jun 1 11:33:14 2018 (r334482) @@ -44,8 +44,13 @@ hrtimer_call_handler(void *arg) hrtimer = arg; ret = hrtimer->function(hrtimer); - MPASS(ret == HRTIMER_NORESTART); - callout_deactivate(&hrtimer->callout); + + if (ret == HRTIMER_RESTART) { + callout_schedule_sbt(&hrtimer->callout, + nstosbt(hrtimer->expires), nstosbt(hrtimer->precision), 0); + } else { + callout_deactivate(&hrtimer->callout); + } } bool @@ -56,6 +61,7 @@ linux_hrtimer_active(struct hrtimer *hrtimer) mtx_lock(&hrtimer->mtx); ret = callout_active(&hrtimer->callout); mtx_unlock(&hrtimer->mtx); + return (ret); } @@ -74,15 +80,16 @@ void linux_hrtimer_init(struct hrtimer *hrtimer) { - hrtimer->function = NULL; - mtx_init(&hrtimer->mtx, "hrtimer", NULL, MTX_DEF | MTX_RECURSE); + memset(hrtimer, 0, sizeof(*hrtimer)); + mtx_init(&hrtimer->mtx, "hrtimer", NULL, + MTX_DEF | MTX_RECURSE | MTX_NOWITNESS); callout_init_mtx(&hrtimer->callout, &hrtimer->mtx, 0); } void -linux_hrtimer_set_expires(struct hrtimer *hrtimer __unused, - ktime_t time __unused) +linux_hrtimer_set_expires(struct hrtimer *hrtimer, ktime_t time) { + hrtimer->expires = ktime_to_ns(time); } void @@ -93,11 +100,24 @@ linux_hrtimer_start(struct hrtimer *hrtimer, ktime_t t } void -linux_hrtimer_start_range_ns(struct hrtimer *hrtimer, ktime_t time, int64_t nsec) +linux_hrtimer_start_range_ns(struct hrtimer *hrtimer, ktime_t time, + int64_t nsec) { mtx_lock(&hrtimer->mtx); - callout_reset_sbt(&hrtimer->callout, nstosbt(time), nstosbt(nsec), - hrtimer_call_handler, hrtimer, 0); + hrtimer->precision = nsec; + callout_reset_sbt(&hrtimer->callout, nstosbt(ktime_to_ns(time)), + nstosbt(nsec), hrtimer_call_handler, hrtimer, 0); mtx_unlock(&hrtimer->mtx); } + +void +linux_hrtimer_forward_now(struct hrtimer *hrtimer, ktime_t interval) +{ + + mtx_lock(&hrtimer->mtx); + callout_reset_sbt(&hrtimer->callout, nstosbt(ktime_to_ns(interval)), + nstosbt(hrtimer->precision), hrtimer_call_handler, hrtimer, 0); + mtx_unlock(&hrtimer->mtx); +} + From owner-svn-src-head@freebsd.org Fri Jun 1 11:42:10 2018 Return-Path: Delivered-To: svn-src-head@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 89197F75A3A; Fri, 1 Jun 2018 11:42:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A5AB76BF1; Fri, 1 Jun 2018 11:42:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B8A428574; Fri, 1 Jun 2018 11:42:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51Bg9PI066027; Fri, 1 Jun 2018 11:42:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51Bg90u066026; Fri, 1 Jun 2018 11:42:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201806011142.w51Bg90u066026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 1 Jun 2018 11:42:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334483 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 334483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 11:42:10 -0000 Author: hselasky Date: Fri Jun 1 11:42:09 2018 New Revision: 334483 URL: https://svnweb.freebsd.org/changeset/base/334483 Log: Implement radix_tree_iter_delete() in the LinuxKPI. Submitted by: Johannes Lundberg MFC after: 1 week Sponsored by: Mellanox Technologies Sponsored by: Limelight Networks Modified: head/sys/compat/linuxkpi/common/include/linux/radix-tree.h head/sys/compat/linuxkpi/common/src/linux_radix.c Modified: head/sys/compat/linuxkpi/common/include/linux/radix-tree.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/radix-tree.h Fri Jun 1 11:33:14 2018 (r334482) +++ head/sys/compat/linuxkpi/common/include/linux/radix-tree.h Fri Jun 1 11:42:09 2018 (r334483) @@ -79,5 +79,6 @@ void *radix_tree_lookup(struct radix_tree_root *, unsi void *radix_tree_delete(struct radix_tree_root *, unsigned long); int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); bool radix_tree_iter_find(struct radix_tree_root *, struct radix_tree_iter *, void ***); +void radix_tree_iter_delete(struct radix_tree_root *, struct radix_tree_iter *, void **); #endif /* _LINUX_RADIX_TREE_H_ */ Modified: head/sys/compat/linuxkpi/common/src/linux_radix.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_radix.c Fri Jun 1 11:33:14 2018 (r334482) +++ head/sys/compat/linuxkpi/common/src/linux_radix.c Fri Jun 1 11:42:09 2018 (r334483) @@ -162,6 +162,13 @@ out: return (item); } +void +radix_tree_iter_delete(struct radix_tree_root *root, + struct radix_tree_iter *iter, void **slot) +{ + radix_tree_delete(root, iter->index); +} + int radix_tree_insert(struct radix_tree_root *root, unsigned long index, void *item) { From owner-svn-src-head@freebsd.org Fri Jun 1 12:09:08 2018 Return-Path: Delivered-To: svn-src-head@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 B2C8DF7A2A0; Fri, 1 Jun 2018 12:09:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 611977818F; Fri, 1 Jun 2018 12:09:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23B4C288D2; Fri, 1 Jun 2018 12:09:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51C974s077307; Fri, 1 Jun 2018 12:09:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51C97qh077306; Fri, 1 Jun 2018 12:09:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201806011209.w51C97qh077306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 1 Jun 2018 12:09:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334484 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 334484 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 12:09:09 -0000 Author: hselasky Date: Fri Jun 1 12:09:07 2018 New Revision: 334484 URL: https://svnweb.freebsd.org/changeset/base/334484 Log: Implement the __sg_alloc_table_from_pages() function based on the existing sg_alloc_table_from_pages() function in the LinuxKPI. This basically allow segments to have a limit, max_segment. Submitted by: Johannes Lundberg MFC after: 1 week Sponsored by: Mellanox Technologies Sponsored by: Limelight Networks Modified: head/sys/compat/linuxkpi/common/include/linux/scatterlist.h Modified: head/sys/compat/linuxkpi/common/include/linux/scatterlist.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/scatterlist.h Fri Jun 1 11:42:09 2018 (r334483) +++ head/sys/compat/linuxkpi/common/include/linux/scatterlist.h Fri Jun 1 12:09:07 2018 (r334484) @@ -64,6 +64,8 @@ struct sg_page_iter { } internal; }; +#define SCATTERLIST_MAX_SEGMENT (-1U & ~(PAGE_SIZE - 1)) + #define SG_MAX_SINGLE_ALLOC (PAGE_SIZE / sizeof(struct scatterlist)) #define SG_MAGIC 0x87654321UL @@ -286,18 +288,26 @@ sg_alloc_table(struct sg_table *table, unsigned int ne } static inline int -sg_alloc_table_from_pages(struct sg_table *sgt, +__sg_alloc_table_from_pages(struct sg_table *sgt, struct page **pages, unsigned int count, unsigned long off, unsigned long size, - gfp_t gfp_mask) + unsigned int max_segment, gfp_t gfp_mask) { - unsigned int i, segs, cur; + unsigned int i, segs, cur, len; int rc; struct scatterlist *s; + if (__predict_false(!max_segment || offset_in_page(max_segment))) + return (-EINVAL); + + len = 0; for (segs = i = 1; i < count; ++i) { - if (page_to_pfn(pages[i]) != page_to_pfn(pages[i - 1]) + 1) + len += PAGE_SIZE; + if (len >= max_segment || + page_to_pfn(pages[i]) != page_to_pfn(pages[i - 1]) + 1) { ++segs; + len = 0; + } } if (__predict_false((rc = sg_alloc_table(sgt, segs, gfp_mask)))) return (rc); @@ -307,10 +317,13 @@ sg_alloc_table_from_pages(struct sg_table *sgt, unsigned long seg_size; unsigned int j; - for (j = cur + 1; j < count; ++j) - if (page_to_pfn(pages[j]) != + len = 0; + for (j = cur + 1; j < count; ++j) { + len += PAGE_SIZE; + if (len >= max_segment || page_to_pfn(pages[j]) != page_to_pfn(pages[j - 1]) + 1) break; + } seg_size = ((j - cur) << PAGE_SHIFT) - off; sg_set_page(s, pages[cur], min(size, seg_size), off); @@ -321,6 +334,16 @@ sg_alloc_table_from_pages(struct sg_table *sgt, return (0); } +static inline int +sg_alloc_table_from_pages(struct sg_table *sgt, + struct page **pages, unsigned int count, + unsigned long off, unsigned long size, + gfp_t gfp_mask) +{ + + return (__sg_alloc_table_from_pages(sgt, pages, count, off, size, + SCATTERLIST_MAX_SEGMENT, gfp_mask)); +} static inline int sg_nents(struct scatterlist *sg) From owner-svn-src-head@freebsd.org Fri Jun 1 12:43:14 2018 Return-Path: Delivered-To: svn-src-head@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 41C3CF7F35B; Fri, 1 Jun 2018 12:43:14 +0000 (UTC) (envelope-from leitao@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EB66E79847; Fri, 1 Jun 2018 12:43:13 +0000 (UTC) (envelope-from leitao@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD1F828F28; Fri, 1 Jun 2018 12:43:13 +0000 (UTC) (envelope-from leitao@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51ChDSB096929; Fri, 1 Jun 2018 12:43:13 GMT (envelope-from leitao@FreeBSD.org) Received: (from leitao@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51ChDNl096928; Fri, 1 Jun 2018 12:43:13 GMT (envelope-from leitao@FreeBSD.org) Message-Id: <201806011243.w51ChDNl096928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: leitao set sender to leitao@FreeBSD.org using -f From: Breno Leitao Date: Fri, 1 Jun 2018 12:43:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334485 - head/sys/powerpc/ofw X-SVN-Group: head X-SVN-Commit-Author: leitao X-SVN-Commit-Paths: head/sys/powerpc/ofw X-SVN-Commit-Revision: 334485 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 12:43:14 -0000 Author: leitao Date: Fri Jun 1 12:43:13 2018 New Revision: 334485 URL: https://svnweb.freebsd.org/changeset/base/334485 Log: powerpc64: Avoid overwriting initrd area Currently kexec loads an initrd file into the main memory but does not mark that region as reserved, thus the area is not protected. If any initrd/md file is loaded from kexec/petitboot, the region might become corarupted/overwritten since FreeBSD does not know the region is 'reserved'. This patch simply adds the initrd area as a reserved memory region. Approved by: jhibbits Differential Revision: https://reviews.freebsd.org/D15610 Modified: head/sys/powerpc/ofw/ofw_machdep.c Modified: head/sys/powerpc/ofw/ofw_machdep.c ============================================================================== --- head/sys/powerpc/ofw/ofw_machdep.c Fri Jun 1 12:09:07 2018 (r334484) +++ head/sys/powerpc/ofw/ofw_machdep.c Fri Jun 1 12:43:13 2018 (r334485) @@ -225,41 +225,19 @@ parse_ofw_memory(phandle_t node, const char *prop, str #ifdef FDT static int -excise_fdt_reserved(struct mem_region *avail, int asz) +excise_reserved_regions(struct mem_region *avail, int asz, + struct mem_region *exclude, int esz) { - struct { - uint64_t address; - uint64_t size; - } fdtmap[32]; - ssize_t fdtmapsize; - phandle_t chosen; int i, j, k; - chosen = OF_finddevice("/chosen"); - fdtmapsize = OF_getprop(chosen, "fdtmemreserv", fdtmap, sizeof(fdtmap)); - - for (j = 0; j < fdtmapsize/sizeof(fdtmap[0]); j++) { - fdtmap[j].address = be64toh(fdtmap[j].address) & ~PAGE_MASK; - fdtmap[j].size = round_page(be64toh(fdtmap[j].size)); - } - - KASSERT(j*sizeof(fdtmap[0]) < sizeof(fdtmap), - ("Exceeded number of FDT reservations")); - /* Add a virtual entry for the FDT itself */ - if (fdt != NULL) { - fdtmap[j].address = (vm_offset_t)fdt & ~PAGE_MASK; - fdtmap[j].size = round_page(fdt_totalsize(fdt)); - fdtmapsize += sizeof(fdtmap[0]); - } - for (i = 0; i < asz; i++) { - for (j = 0; j < fdtmapsize/sizeof(fdtmap[0]); j++) { + for (j = 0; j < esz; j++) { /* * Case 1: Exclusion region encloses complete * available entry. Drop it and move on. */ - if (fdtmap[j].address <= avail[i].mr_start && - fdtmap[j].address + fdtmap[j].size >= + if (exclude[j].mr_start <= avail[i].mr_start && + exclude[j].mr_start + exclude[j].mr_size >= avail[i].mr_start + avail[i].mr_size) { for (k = i+1; k < asz; k++) avail[k-1] = avail[k]; @@ -274,20 +252,20 @@ excise_fdt_reserved(struct mem_region *avail, int asz) * a new available entry with the region after * the excluded region, if any. */ - if (fdtmap[j].address >= avail[i].mr_start && - fdtmap[j].address < avail[i].mr_start + + if (exclude[j].mr_start >= avail[i].mr_start && + exclude[j].mr_start < avail[i].mr_start + avail[i].mr_size) { - if (fdtmap[j].address + fdtmap[j].size < + if (exclude[j].mr_start + exclude[j].mr_size < avail[i].mr_start + avail[i].mr_size) { avail[asz].mr_start = - fdtmap[j].address + fdtmap[j].size; + exclude[j].mr_start + exclude[j].mr_size; avail[asz].mr_size = avail[i].mr_start + avail[i].mr_size - avail[asz].mr_start; asz++; } - avail[i].mr_size = fdtmap[j].address - + avail[i].mr_size = exclude[j].mr_start - avail[i].mr_start; } @@ -297,13 +275,13 @@ excise_fdt_reserved(struct mem_region *avail, int asz) * The case of a contained exclusion zone has already * been caught in case 2. */ - if (fdtmap[j].address + fdtmap[j].size >= - avail[i].mr_start && fdtmap[j].address + - fdtmap[j].size < avail[i].mr_start + + if (exclude[j].mr_start + exclude[j].mr_size >= + avail[i].mr_start && exclude[j].mr_start + + exclude[j].mr_size < avail[i].mr_start + avail[i].mr_size) { avail[i].mr_size += avail[i].mr_start; avail[i].mr_start = - fdtmap[j].address + fdtmap[j].size; + exclude[j].mr_start + exclude[j].mr_size; avail[i].mr_size -= avail[i].mr_start; } } @@ -311,6 +289,62 @@ excise_fdt_reserved(struct mem_region *avail, int asz) return (asz); } + +static int +excise_initrd_region(struct mem_region *avail, int asz) +{ + phandle_t chosen; + uint64_t start, end; + ssize_t size; + struct mem_region initrdmap[1]; + + chosen = OF_finddevice("/chosen"); + size = OF_getprop(chosen, "linux,initrd-start", &start, sizeof(start)); + if (size <= 0) + return (asz); + + size = OF_getprop(chosen, "linux,initrd-end", &end, sizeof(end)); + if (size <= 0) + return (asz); + + initrdmap[0].mr_start = start; + initrdmap[0].mr_size = end - start; + + asz = excise_reserved_regions(avail, asz, initrdmap, 1); + + return (asz); +} + +static int +excise_fdt_reserved(struct mem_region *avail, int asz) +{ + struct mem_region fdtmap[32]; + ssize_t fdtmapsize; + phandle_t chosen; + int j, fdtentries; + + chosen = OF_finddevice("/chosen"); + fdtmapsize = OF_getprop(chosen, "fdtmemreserv", fdtmap, sizeof(fdtmap)); + + for (j = 0; j < fdtmapsize/sizeof(fdtmap[0]); j++) { + fdtmap[j].mr_start = be64toh(fdtmap[j].mr_start) & ~PAGE_MASK; + fdtmap[j].mr_size = round_page(be64toh(fdtmap[j].mr_size)); + } + + KASSERT(j*sizeof(fdtmap[0]) < sizeof(fdtmap), + ("Exceeded number of FDT reservations")); + /* Add a virtual entry for the FDT itself */ + if (fdt != NULL) { + fdtmap[j].mr_start = (vm_offset_t)fdt & ~PAGE_MASK; + fdtmap[j].mr_size = round_page(fdt_totalsize(fdt)); + fdtmapsize += sizeof(fdtmap[0]); + } + + fdtentries = fdtmapsize/sizeof(fdtmap[0]); + asz = excise_reserved_regions(avail, asz, fdtmap, fdtentries); + + return (asz); +} #endif /* @@ -364,6 +398,13 @@ ofw_mem_regions(struct mem_region *memp, int *memsz, phandle = OF_finddevice("/chosen"); if (OF_hasprop(phandle, "fdtmemreserv")) asz = excise_fdt_reserved(availp, asz); + + /* If the kernel is being loaded through kexec, initrd region is listed + * in /chosen but the region is not marked as reserved, so, we might exclude + * it here. + */ + if (OF_hasprop(phandle, "linux,initrd-start")) + asz = excise_initrd_region(availp, asz); #endif *memsz = msz; From owner-svn-src-head@freebsd.org Fri Jun 1 13:26:47 2018 Return-Path: Delivered-To: svn-src-head@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 7DA51FD294D; Fri, 1 Jun 2018 13:26:47 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B9437B6E5; Fri, 1 Jun 2018 13:26:47 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 089452958D; Fri, 1 Jun 2018 13:26:47 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51DQkrQ017911; Fri, 1 Jun 2018 13:26:46 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51DQjfh017904; Fri, 1 Jun 2018 13:26:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201806011326.w51DQjfh017904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 1 Jun 2018 13:26:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334486 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 334486 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 13:26:47 -0000 Author: emaste Date: Fri Jun 1 13:26:45 2018 New Revision: 334486 URL: https://svnweb.freebsd.org/changeset/base/334486 Log: ANSIfy sys/kern Modified: head/sys/kern/kern_descrip.c head/sys/kern/kern_exec.c head/sys/kern/subr_prof.c head/sys/kern/sys_pipe.c head/sys/kern/sysv_msg.c head/sys/kern/vfs_cluster.c head/sys/kern/vfs_vnops.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Jun 1 12:43:13 2018 (r334485) +++ head/sys/kern/kern_descrip.c Fri Jun 1 13:26:45 2018 (r334486) @@ -1148,8 +1148,7 @@ fail: * This is common code for FIOGETOWN ioctl called by fcntl(fd, F_GETOWN, arg). */ pid_t -fgetown(sigiop) - struct sigio **sigiop; +fgetown(struct sigio **sigiop) { pid_t pgid; Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Fri Jun 1 12:43:13 2018 (r334485) +++ head/sys/kern/kern_exec.c Fri Jun 1 13:26:45 2018 (r334486) @@ -978,8 +978,7 @@ exec_fail: } int -exec_map_first_page(imgp) - struct image_params *imgp; +exec_map_first_page(struct image_params *imgp) { int rv, i, after, initial_pagein; vm_page_t ma[VM_INITIAL_PAGEIN]; Modified: head/sys/kern/subr_prof.c ============================================================================== --- head/sys/kern/subr_prof.c Fri Jun 1 12:43:13 2018 (r334485) +++ head/sys/kern/subr_prof.c Fri Jun 1 13:26:45 2018 (r334486) @@ -139,8 +139,7 @@ kmupetext(uintfptr_t nhighpc) } static void -kmstartup(dummy) - void *dummy; +kmstartup(void *dummy) { char *cp; struct gmonparam *p = &_gmonparam; Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Fri Jun 1 12:43:13 2018 (r334485) +++ head/sys/kern/sys_pipe.c Fri Jun 1 13:26:45 2018 (r334486) @@ -491,9 +491,7 @@ sys_pipe2(struct thread *td, struct pipe2_args *uap) * If it fails it will return ENOMEM. */ static int -pipespace_new(cpipe, size) - struct pipe *cpipe; - int size; +pipespace_new(struct pipe *cpipe, int size) { caddr_t buffer; int error, cnt, firstseg; @@ -559,9 +557,7 @@ retry: * Wrapper for pipespace_new() that performs locking assertions. */ static int -pipespace(cpipe, size) - struct pipe *cpipe; - int size; +pipespace(struct pipe *cpipe, int size) { KASSERT(cpipe->pipe_state & PIPE_LOCKFL, @@ -573,9 +569,7 @@ pipespace(cpipe, size) * lock a pipe for I/O, blocking other access */ static __inline int -pipelock(cpipe, catch) - struct pipe *cpipe; - int catch; +pipelock(struct pipe *cpipe, int catch) { int error; @@ -596,8 +590,7 @@ pipelock(cpipe, catch) * unlock a pipe I/O lock */ static __inline void -pipeunlock(cpipe) - struct pipe *cpipe; +pipeunlock(struct pipe *cpipe) { PIPE_LOCK_ASSERT(cpipe, MA_OWNED); @@ -611,8 +604,7 @@ pipeunlock(cpipe) } void -pipeselwakeup(cpipe) - struct pipe *cpipe; +pipeselwakeup(struct pipe *cpipe) { PIPE_LOCK_ASSERT(cpipe, MA_OWNED); @@ -631,9 +623,7 @@ pipeselwakeup(cpipe) * will start out zero'd from the ctor, so we just manage the kmem. */ static void -pipe_create(pipe, backing) - struct pipe *pipe; - int backing; +pipe_create(struct pipe *pipe, int backing) { if (backing) { @@ -655,12 +645,8 @@ pipe_create(pipe, backing) /* ARGSUSED */ static int -pipe_read(fp, uio, active_cred, flags, td) - struct file *fp; - struct uio *uio; - struct ucred *active_cred; - struct thread *td; - int flags; +pipe_read(struct file *fp, struct uio *uio, struct ucred *active_cred, + int flags, struct thread *td) { struct pipe *rpipe; int error; @@ -834,9 +820,7 @@ unlocked_error: * This is similar to a physical write operation. */ static int -pipe_build_write_buffer(wpipe, uio) - struct pipe *wpipe; - struct uio *uio; +pipe_build_write_buffer(struct pipe *wpipe, struct uio *uio) { u_int size; int i; @@ -880,8 +864,7 @@ pipe_build_write_buffer(wpipe, uio) * unmap and unwire the process buffer */ static void -pipe_destroy_write_buffer(wpipe) - struct pipe *wpipe; +pipe_destroy_write_buffer(struct pipe *wpipe) { PIPE_LOCK_ASSERT(wpipe, MA_OWNED); @@ -895,8 +878,7 @@ pipe_destroy_write_buffer(wpipe) * pages can be freed without loss of data. */ static void -pipe_clone_write_buffer(wpipe) - struct pipe *wpipe; +pipe_clone_write_buffer(struct pipe *wpipe) { struct uio uio; struct iovec iov; @@ -935,9 +917,7 @@ pipe_clone_write_buffer(wpipe) * the pipe buffer. Then the direct mapping write is set-up. */ static int -pipe_direct_write(wpipe, uio) - struct pipe *wpipe; - struct uio *uio; +pipe_direct_write(struct pipe *wpipe, struct uio *uio) { int error; @@ -1036,12 +1016,8 @@ error1: #endif static int -pipe_write(fp, uio, active_cred, flags, td) - struct file *fp; - struct uio *uio; - struct ucred *active_cred; - struct thread *td; - int flags; +pipe_write(struct file *fp, struct uio *uio, struct ucred *active_cred, + int flags, struct thread *td) { int error = 0; int desiredsize; @@ -1319,11 +1295,8 @@ pipe_write(fp, uio, active_cred, flags, td) /* ARGSUSED */ static int -pipe_truncate(fp, length, active_cred, td) - struct file *fp; - off_t length; - struct ucred *active_cred; - struct thread *td; +pipe_truncate(struct file *fp, off_t length, struct ucred *active_cred, + struct thread *td) { struct pipe *cpipe; int error; @@ -1340,12 +1313,8 @@ pipe_truncate(fp, length, active_cred, td) * we implement a very minimal set of ioctls for compatibility with sockets. */ static int -pipe_ioctl(fp, cmd, data, active_cred, td) - struct file *fp; - u_long cmd; - void *data; - struct ucred *active_cred; - struct thread *td; +pipe_ioctl(struct file *fp, u_long cmd, void *data, struct ucred *active_cred, + struct thread *td) { struct pipe *mpipe = fp->f_data; int error; @@ -1416,11 +1385,8 @@ out_unlocked: } static int -pipe_poll(fp, events, active_cred, td) - struct file *fp; - int events; - struct ucred *active_cred; - struct thread *td; +pipe_poll(struct file *fp, int events, struct ucred *active_cred, + struct thread *td) { struct pipe *rpipe; struct pipe *wpipe; @@ -1492,11 +1458,8 @@ locked_error: * be a natural race. */ static int -pipe_stat(fp, ub, active_cred, td) - struct file *fp; - struct stat *ub; - struct ucred *active_cred; - struct thread *td; +pipe_stat(struct file *fp, struct stat *ub, struct ucred *active_cred, + struct thread *td) { struct pipe *pipe; int new_unr; @@ -1562,9 +1525,7 @@ pipe_stat(fp, ub, active_cred, td) /* ARGSUSED */ static int -pipe_close(fp, td) - struct file *fp; - struct thread *td; +pipe_close(struct file *fp, struct thread *td) { if (fp->f_vnode != NULL) @@ -1590,12 +1551,8 @@ pipe_chmod(struct file *fp, mode_t mode, struct ucred } static int -pipe_chown(fp, uid, gid, active_cred, td) - struct file *fp; - uid_t uid; - gid_t gid; - struct ucred *active_cred; - struct thread *td; +pipe_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred, + struct thread *td) { struct pipe *cpipe; int error; @@ -1624,8 +1581,7 @@ pipe_fill_kinfo(struct file *fp, struct kinfo_file *ki } static void -pipe_free_kmem(cpipe) - struct pipe *cpipe; +pipe_free_kmem(struct pipe *cpipe) { KASSERT(!mtx_owned(PIPE_MTX(cpipe)), @@ -1651,8 +1607,7 @@ pipe_free_kmem(cpipe) * shutdown the pipe */ static void -pipeclose(cpipe) - struct pipe *cpipe; +pipeclose(struct pipe *cpipe) { struct pipepair *pp; struct pipe *ppipe; Modified: head/sys/kern/sysv_msg.c ============================================================================== --- head/sys/kern/sysv_msg.c Fri Jun 1 12:43:13 2018 (r334485) +++ head/sys/kern/sysv_msg.c Fri Jun 1 13:26:45 2018 (r334486) @@ -386,8 +386,7 @@ DECLARE_MODULE(sysvmsg, sysvmsg_mod, SI_SUB_SYSV_MSG, MODULE_VERSION(sysvmsg, 1); static void -msg_freehdr(msghdr) - struct msg *msghdr; +msg_freehdr(struct msg *msghdr) { while (msghdr->msg_ts > 0) { short next; @@ -499,11 +498,7 @@ sys_msgctl(struct thread *td, struct msgctl_args *uap) } int -kern_msgctl(td, msqid, cmd, msqbuf) - struct thread *td; - int msqid; - int cmd; - struct msqid_ds *msqbuf; +kern_msgctl(struct thread *td, int msqid, int cmd, struct msqid_ds *msqbuf) { int rval, error, msqix; struct msqid_kernel *msqkptr; Modified: head/sys/kern/vfs_cluster.c ============================================================================== --- head/sys/kern/vfs_cluster.c Fri Jun 1 12:43:13 2018 (r334485) +++ head/sys/kern/vfs_cluster.c Fri Jun 1 13:26:45 2018 (r334486) @@ -561,8 +561,7 @@ clean_sbusy: * that we will need to shift around. */ static void -cluster_callback(bp) - struct buf *bp; +cluster_callback(struct buf *bp) { struct buf *nbp, *tbp; int error = 0; Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Fri Jun 1 12:43:13 2018 (r334485) +++ head/sys/kern/vfs_vnops.c Fri Jun 1 13:26:45 2018 (r334486) @@ -172,10 +172,7 @@ static int vn_io_fault1(struct vnode *vp, struct uio * struct vn_io_fault_args *args, struct thread *td); int -vn_open(ndp, flagp, cmode, fp) - struct nameidata *ndp; - int *flagp, cmode; - struct file *fp; +vn_open(struct nameidata *ndp, int *flagp, int cmode, struct file *fp) { struct thread *td = ndp->ni_cnd.cn_thread; @@ -622,19 +619,9 @@ vn_rdwr(enum uio_rw rw, struct vnode *vp, void *base, * core'ing the same binary, or unrelated processes scanning the directory). */ int -vn_rdwr_inchunks(rw, vp, base, len, offset, segflg, ioflg, active_cred, - file_cred, aresid, td) - enum uio_rw rw; - struct vnode *vp; - void *base; - size_t len; - off_t offset; - enum uio_seg segflg; - int ioflg; - struct ucred *active_cred; - struct ucred *file_cred; - size_t *aresid; - struct thread *td; +vn_rdwr_inchunks(enum uio_rw rw, struct vnode *vp, void *base, size_t len, + off_t offset, enum uio_seg segflg, int ioflg, struct ucred *active_cred, + struct ucred *file_cred, size_t *aresid, struct thread *td) { int error = 0; ssize_t iaresid; @@ -778,12 +765,8 @@ get_advice(struct file *fp, struct uio *uio) * File table vnode read routine. */ static int -vn_read(fp, uio, active_cred, flags, td) - struct file *fp; - struct uio *uio; - struct ucred *active_cred; - int flags; - struct thread *td; +vn_read(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, + struct thread *td) { struct vnode *vp; off_t orig_offset; @@ -837,12 +820,8 @@ vn_read(fp, uio, active_cred, flags, td) * File table vnode write routine. */ static int -vn_write(fp, uio, active_cred, flags, td) - struct file *fp; - struct uio *uio; - struct ucred *active_cred; - int flags; - struct thread *td; +vn_write(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, + struct thread *td) { struct vnode *vp; struct mount *mp; @@ -1354,11 +1333,8 @@ out1: * File table vnode stat routine. */ static int -vn_statfile(fp, sb, active_cred, td) - struct file *fp; - struct stat *sb; - struct ucred *active_cred; - struct thread *td; +vn_statfile(struct file *fp, struct stat *sb, struct ucred *active_cred, + struct thread *td) { struct vnode *vp = fp->f_vnode; int error; From owner-svn-src-head@freebsd.org Fri Jun 1 16:23:49 2018 Return-Path: Delivered-To: svn-src-head@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 CB835F79A3D; Fri, 1 Jun 2018 16:23:49 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1FFC18570E; Fri, 1 Jun 2018 16:23:48 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F88B2B2DF; Fri, 1 Jun 2018 16:23:48 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51GNm0J008656; Fri, 1 Jun 2018 16:23:48 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51GNlY6008654; Fri, 1 Jun 2018 16:23:47 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201806011623.w51GNlY6008654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 1 Jun 2018 16:23:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334487 - head/tests/sys/audit X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/tests/sys/audit X-SVN-Commit-Revision: 334487 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 16:23:50 -0000 Author: asomers Date: Fri Jun 1 16:23:47 2018 New Revision: 334487 URL: https://svnweb.freebsd.org/changeset/base/334487 Log: audit(4): Add tests for the fw class of syscalls. truncate and ftruncate are the only syscalls in this class, apart from certain variations of open and openat, which will be handled in a different file. Submitted by: aniketp MFC after: 2 weeks Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15640 Added: head/tests/sys/audit/file-write.c (contents, props changed) Modified: head/tests/sys/audit/Makefile Modified: head/tests/sys/audit/Makefile ============================================================================== --- head/tests/sys/audit/Makefile Fri Jun 1 13:26:45 2018 (r334486) +++ head/tests/sys/audit/Makefile Fri Jun 1 16:23:47 2018 (r334487) @@ -3,10 +3,13 @@ TESTSDIR= ${TESTSBASE}/sys/audit ATF_TESTS_C= file-create +ATF_TESTS_C+= file-write ATF_TESTS_C+= file-read SRCS.file-create+= file-create.c SRCS.file-create+= utils.c +SRCS.file-write+= file-write.c +SRCS.file-write+= utils.c SRCS.file-read+= file-read.c SRCS.file-read+= utils.c Added: head/tests/sys/audit/file-write.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/audit/file-write.c Fri Jun 1 16:23:47 2018 (r334487) @@ -0,0 +1,139 @@ +/*- + * Copyright 2018 Aniket Pandey + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + +#include "utils.h" + +static struct pollfd fds[1]; +static mode_t mode = 0777; +static off_t offlen = 0; +static const char *path = "fileforaudit"; +static const char *errpath = "dirdoesnotexist/fileforaudit"; +static const char *successreg = "fileforaudit.*return,success"; +static const char *failurereg = "fileforaudit.*return,failure"; + + +ATF_TC_WITH_CLEANUP(truncate_success); +ATF_TC_HEAD(truncate_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "truncate(2) call"); +} + +ATF_TC_BODY(truncate_success, tc) +{ + /* File needs to exist to call truncate(2) */ + ATF_REQUIRE(open(path, O_CREAT, mode) != -1); + FILE *pipefd = setup(fds, "fw"); + ATF_REQUIRE_EQ(0, truncate(path, offlen)); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(truncate_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(truncate_failure); +ATF_TC_HEAD(truncate_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "truncate(2) call"); +} + +ATF_TC_BODY(truncate_failure, tc) +{ + FILE *pipefd = setup(fds, "fw"); + /* Failure reason: file does not exist */ + ATF_REQUIRE_EQ(-1, truncate(errpath, offlen)); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(truncate_failure, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(ftruncate_success); +ATF_TC_HEAD(ftruncate_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "ftruncate(2) call"); +} + +ATF_TC_BODY(ftruncate_success, tc) +{ + int filedesc; + const char *regex = "ftruncate.*return,success"; + /* Valid file descriptor needs to exist to call ftruncate(2) */ + ATF_REQUIRE((filedesc = open(path, O_CREAT | O_RDWR)) != -1); + FILE *pipefd = setup(fds, "fw"); + ATF_REQUIRE_EQ(0, ftruncate(filedesc, offlen)); + check_audit(fds, regex, pipefd); +} + +ATF_TC_CLEANUP(ftruncate_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(ftruncate_failure); +ATF_TC_HEAD(ftruncate_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "ftruncate(2) call"); +} + +ATF_TC_BODY(ftruncate_failure, tc) +{ + const char *regex = "ftruncate.*return,failure"; + FILE *pipefd = setup(fds, "fw"); + /* Failure reason: bad file descriptor */ + ATF_REQUIRE_EQ(-1, ftruncate(-1, offlen)); + check_audit(fds, regex, pipefd); +} + +ATF_TC_CLEANUP(ftruncate_failure, tc) +{ + cleanup(); +} + + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, truncate_success); + ATF_TP_ADD_TC(tp, truncate_failure); + ATF_TP_ADD_TC(tp, ftruncate_success); + ATF_TP_ADD_TC(tp, ftruncate_failure); + + return (atf_no_error()); +} From owner-svn-src-head@freebsd.org Fri Jun 1 16:31:06 2018 Return-Path: Delivered-To: svn-src-head@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 16FCCF7AE48; Fri, 1 Jun 2018 16:31:06 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BED4A85D29; Fri, 1 Jun 2018 16:31:05 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A0C312B31A; Fri, 1 Jun 2018 16:31:05 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51GV5Tl009888; Fri, 1 Jun 2018 16:31:05 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51GV55n009887; Fri, 1 Jun 2018 16:31:05 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201806011631.w51GV55n009887@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 1 Jun 2018 16:31:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334488 - head/sys/powerpc/include X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/include X-SVN-Commit-Revision: 334488 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 16:31:06 -0000 Author: jhibbits Date: Fri Jun 1 16:31:05 2018 New Revision: 334488 URL: https://svnweb.freebsd.org/changeset/base/334488 Log: Unbreak 32-bit binaries on powerpc64 Recently a change was made which broke loading 32-bit binaries on powerpc64, with an assertion in ld-elf32.so.1: ld-elf32.so.1: assert failed: /usr/local/poudriere/jails/ppc64/usr/src/libexec/rtld-elf/rtld.c:390 It turns out Elf32_AuxInfo was broken for a very long time on powerpc64, as it uses long and pointers, which are both 64 bits on powerpc64, and only manifested with the recent work on auxargs. Modified: head/sys/powerpc/include/elf.h Modified: head/sys/powerpc/include/elf.h ============================================================================== --- head/sys/powerpc/include/elf.h Fri Jun 1 16:23:47 2018 (r334487) +++ head/sys/powerpc/include/elf.h Fri Jun 1 16:31:05 2018 (r334488) @@ -69,9 +69,13 @@ typedef struct { /* Auxiliary vector entry on initial stack */ int a_type; /* Entry type. */ union { +#ifdef __powerpc64__ + int a_val; /* Integer value */ +#else long a_val; /* Integer value. */ void *a_ptr; /* Address. */ void (*a_fcn)(void); /* Function pointer (not used). */ +#endif } a_un; } Elf32_Auxinfo; From owner-svn-src-head@freebsd.org Fri Jun 1 16:46:30 2018 Return-Path: Delivered-To: svn-src-head@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 A0D59F7D138; Fri, 1 Jun 2018 16:46:30 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 52AEC86810; Fri, 1 Jun 2018 16:46:30 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 309892B61C; Fri, 1 Jun 2018 16:46:30 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51GkUqX018869; Fri, 1 Jun 2018 16:46:30 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51GkUgW018868; Fri, 1 Jun 2018 16:46:30 GMT (envelope-from np@FreeBSD.org) Message-Id: <201806011646.w51GkUgW018868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 1 Jun 2018 16:46:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334489 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 334489 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 16:46:30 -0000 Author: np Date: Fri Jun 1 16:46:29 2018 New Revision: 334489 URL: https://svnweb.freebsd.org/changeset/base/334489 Log: cxgbe(4): Include full duplex mediaopt in media that can be reported as active. Always report full duplex in active media. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Fri Jun 1 16:31:05 2018 (r334488) +++ head/sys/dev/cxgbe/t4_main.c Fri Jun 1 16:46:29 2018 (r334489) @@ -2312,7 +2312,7 @@ cxgbe_media_status(struct ifnet *ifp, struct ifmediare ifmr->ifm_status |= IFM_ACTIVE; /* ifm_active */ - ifmr->ifm_active = IFM_ETHER; + ifmr->ifm_active = IFM_ETHER | IFM_FDX; ifmr->ifm_active &= ~(IFM_ETH_TXPAUSE | IFM_ETH_RXPAUSE); if (lc->fc & PAUSE_RX) ifmr->ifm_active |= IFM_ETH_RXPAUSE; @@ -4191,13 +4191,13 @@ set_current_media(struct port_info *pi, struct ifmedia IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_NONE) return; - mword = IFM_ETHER; lc = &pi->link_cfg; if (lc->requested_aneg == AUTONEG_ENABLE && lc->supported & FW_PORT_CAP_ANEG) { - ifmedia_set(ifm, mword | IFM_AUTO); + ifmedia_set(ifm, IFM_ETHER | IFM_AUTO); return; } + mword = IFM_ETHER | IFM_FDX; if (lc->requested_fc & PAUSE_TX) mword |= IFM_ETH_TXPAUSE; if (lc->requested_fc & PAUSE_RX) @@ -4251,11 +4251,11 @@ no_media: } else if (mword == IFM_UNKNOWN) unknown++; else - ifmedia_add4(ifm, IFM_ETHER | mword); + ifmedia_add4(ifm, IFM_ETHER | IFM_FDX | mword); } } if (unknown > 0) /* Add one unknown for all unknown media types. */ - ifmedia_add4(ifm, IFM_ETHER | IFM_UNKNOWN); + ifmedia_add4(ifm, IFM_ETHER | IFM_FDX | IFM_UNKNOWN); if (lc->supported & FW_PORT_CAP_ANEG) ifmedia_add(ifm, IFM_ETHER | IFM_AUTO, 0, NULL); From owner-svn-src-head@freebsd.org Fri Jun 1 16:47:40 2018 Return-Path: Delivered-To: svn-src-head@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 7A5C3F7D446; Fri, 1 Jun 2018 16:47:40 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2A9ED8699B; Fri, 1 Jun 2018 16:47:40 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D7302B61E; Fri, 1 Jun 2018 16:47:40 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51Gld5F018949; Fri, 1 Jun 2018 16:47:39 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51GldSa018948; Fri, 1 Jun 2018 16:47:39 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201806011647.w51GldSa018948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Fri, 1 Jun 2018 16:47:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334490 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 334490 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 16:47:40 -0000 Author: jtl Date: Fri Jun 1 16:47:39 2018 New Revision: 334490 URL: https://svnweb.freebsd.org/changeset/base/334490 Log: Update the sysctl(9) manpage to indicate that is required instead of . ( includes NULL, which is defined with and not .) Sponsored by: Netflix Modified: head/share/man/man9/sysctl.9 Modified: head/share/man/man9/sysctl.9 ============================================================================== --- head/share/man/man9/sysctl.9 Fri Jun 1 16:46:29 2018 (r334489) +++ head/share/man/man9/sysctl.9 Fri Jun 1 16:47:39 2018 (r334490) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 3, 2018 +.Dd June 1, 2018 .Dt SYSCTL 9 .Os .Sh NAME @@ -80,7 +80,7 @@ .Nm SYSCTL_UQUAD .Nd Dynamic and static sysctl MIB creation functions .Sh SYNOPSIS -.In sys/types.h +.In sys/param.h .In sys/sysctl.h .Fn SYSCTL_DECL name .Ft struct sysctl_oid * From owner-svn-src-head@freebsd.org Fri Jun 1 19:43:00 2018 Return-Path: Delivered-To: svn-src-head@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 09250EFE05D; Fri, 1 Jun 2018 19:43:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AF6386F23B; Fri, 1 Jun 2018 19:42:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FD482D362; Fri, 1 Jun 2018 19:42:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51Jgx5T009536; Fri, 1 Jun 2018 19:42:59 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51JgxrN009535; Fri, 1 Jun 2018 19:42:59 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201806011942.w51JgxrN009535@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 1 Jun 2018 19:42:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334491 - head/sys/dev/aac X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/aac X-SVN-Commit-Revision: 334491 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 19:43:00 -0000 Author: imp Date: Fri Jun 1 19:42:59 2018 New Revision: 334491 URL: https://svnweb.freebsd.org/changeset/base/334491 Log: Add PNP_INFO to aac Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy Sponsored by: Google, Inc. (GSoC 2018) Modified: head/sys/dev/aac/aac_pci.c Modified: head/sys/dev/aac/aac_pci.c ============================================================================== --- head/sys/dev/aac/aac_pci.c Fri Jun 1 16:47:39 2018 (r334490) +++ head/sys/dev/aac/aac_pci.c Fri Jun 1 19:42:59 2018 (r334491) @@ -493,6 +493,8 @@ static driver_t aacch_driver = { static devclass_t aacch_devclass; DRIVER_MODULE(aacch, pci, aacch_driver, aacch_devclass, NULL, NULL); +MODULE_PNP_INFO("U16:vendor;U16:device;", pci, aac, + aac_identifiers, sizeof(aac_identifiers[0]), nitems(aac_identifiers) - 1); static int aacch_probe(device_t dev) From owner-svn-src-head@freebsd.org Fri Jun 1 19:47:43 2018 Return-Path: Delivered-To: svn-src-head@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 36F93EFEC58; Fri, 1 Jun 2018 19:47:43 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E02106F5F4; Fri, 1 Jun 2018 19:47:42 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE3A82D363; Fri, 1 Jun 2018 19:47:42 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51Jlgsg009769; Fri, 1 Jun 2018 19:47:42 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51Jlf9F009761; Fri, 1 Jun 2018 19:47:41 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201806011947.w51Jlf9F009761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 1 Jun 2018 19:47:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334492 - in head/sys/fs: nfs nfsserver X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in head/sys/fs: nfs nfsserver X-SVN-Commit-Revision: 334492 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 19:47:43 -0000 Author: rmacklem Date: Fri Jun 1 19:47:41 2018 New Revision: 334492 URL: https://svnweb.freebsd.org/changeset/base/334492 Log: Add the BindConnectiontoSession operation to the NFSv4.1 server. Under some fairly unusual circumstances, the Linux NFSv4.1 client is doing a BindConnectiontoSession operation for TCP connections. It is also used by the ESXi6.5 NFSv4.1 client. This patch adds this operation to the NFSv4.1 server. Reported by: andreas.nagy@frequentis.com Tested by: andreas.nagy@frequentis.com MFC after: 2 weeks Modified: head/sys/fs/nfs/nfs.h head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfs_var.h head/sys/fs/nfs/nfsproto.h head/sys/fs/nfsserver/nfs_nfsdserv.c head/sys/fs/nfsserver/nfs_nfsdsocket.c head/sys/fs/nfsserver/nfs_nfsdstate.c Modified: head/sys/fs/nfs/nfs.h ============================================================================== --- head/sys/fs/nfs/nfs.h Fri Jun 1 19:42:59 2018 (r334491) +++ head/sys/fs/nfs/nfs.h Fri Jun 1 19:47:41 2018 (r334492) @@ -301,6 +301,7 @@ struct nfsreferral { #define LCL_ADMINREVOKED 0x00008000 #define LCL_RECLAIMCOMPLETE 0x00010000 #define LCL_NFSV41 0x00020000 +#define LCL_DONEBINDCONN 0x00040000 #define LCL_GSS LCL_KERBV /* Or of all mechs */ Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Fri Jun 1 19:42:59 2018 (r334491) +++ head/sys/fs/nfs/nfs_commonsubs.c Fri Jun 1 19:47:41 2018 (r334492) @@ -138,7 +138,7 @@ struct nfsv4_opflag nfsv4_opflag[NFSV41_NOPS] = { { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 0 }, /* Write */ { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* ReleaseLockOwner */ { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Backchannel Ctrl */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Bind Conn to Sess */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Bind Conn to Sess */ { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Exchange ID */ { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Create Session */ { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Destroy Session */ Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Fri Jun 1 19:42:59 2018 (r334491) +++ head/sys/fs/nfs/nfs_var.h Fri Jun 1 19:47:41 2018 (r334492) @@ -97,6 +97,7 @@ int nfsrv_getclient(nfsquad_t, int, struct nfsclient * nfsquad_t, uint32_t, struct nfsrv_descript *, NFSPROC_T *); int nfsrv_destroyclient(nfsquad_t, NFSPROC_T *); int nfsrv_destroysession(struct nfsrv_descript *, uint8_t *); +int nfsrv_bindconnsess(struct nfsrv_descript *, uint8_t *, int *); int nfsrv_freestateid(struct nfsrv_descript *, nfsv4stateid_t *, NFSPROC_T *); int nfsrv_teststateid(struct nfsrv_descript *, nfsv4stateid_t *, NFSPROC_T *); int nfsrv_adminrevoke(struct nfsd_clid *, NFSPROC_T *); @@ -232,6 +233,8 @@ int nfsrvd_sequence(struct nfsrv_descript *, int, int nfsrvd_reclaimcomplete(struct nfsrv_descript *, int, vnode_t, NFSPROC_T *, struct nfsexstuff *); int nfsrvd_destroyclientid(struct nfsrv_descript *, int, + vnode_t, NFSPROC_T *, struct nfsexstuff *); +int nfsrvd_bindconnsess(struct nfsrv_descript *, int, vnode_t, NFSPROC_T *, struct nfsexstuff *); int nfsrvd_destroysession(struct nfsrv_descript *, int, vnode_t, NFSPROC_T *, struct nfsexstuff *); Modified: head/sys/fs/nfs/nfsproto.h ============================================================================== --- head/sys/fs/nfs/nfsproto.h Fri Jun 1 19:42:59 2018 (r334491) +++ head/sys/fs/nfs/nfsproto.h Fri Jun 1 19:47:41 2018 (r334492) @@ -659,6 +659,15 @@ #define NFSFLEXFLAG_NO_READIO 0x00000004 #define NFSFLEXFLAG_WRITE_ONEMIRROR 0x00000008 +/* Enum values for Bind Connection to Session. */ +#define NFSCDFC4_FORE 0x1 +#define NFSCDFC4_BACK 0x2 +#define NFSCDFC4_FORE_OR_BOTH 0x3 +#define NFSCDFC4_BACK_OR_BOTH 0x7 +#define NFSCDFS4_FORE 0x1 +#define NFSCDFS4_BACK 0x2 +#define NFSCDFS4_BOTH 0x3 + /* Conversion macros */ #define vtonfsv2_mode(t,m) \ txdr_unsigned(((t) == VFIFO) ? MAKEIMODE(VCHR, (m)) : \ Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdserv.c Fri Jun 1 19:42:59 2018 (r334491) +++ head/sys/fs/nfsserver/nfs_nfsdserv.c Fri Jun 1 19:47:41 2018 (r334492) @@ -4055,6 +4055,45 @@ nfsmout: } /* + * nfsv4 bind connection to session service + */ +APPLESTATIC int +nfsrvd_bindconnsess(struct nfsrv_descript *nd, __unused int isdgram, + __unused vnode_t vp, NFSPROC_T *p, __unused struct nfsexstuff *exp) +{ + uint32_t *tl; + uint8_t sessid[NFSX_V4SESSIONID]; + int error = 0, foreaft; + + if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { + nd->nd_repstat = NFSERR_WRONGSEC; + goto nfsmout; + } + NFSM_DISSECT(tl, uint32_t *, NFSX_V4SESSIONID + 2 * NFSX_UNSIGNED); + NFSBCOPY(tl, sessid, NFSX_V4SESSIONID); + tl += (NFSX_V4SESSIONID / NFSX_UNSIGNED); + foreaft = fxdr_unsigned(int, *tl++); + if (*tl == newnfs_true) { + /* RDMA is not supported. */ + nd->nd_repstat = NFSERR_NOTSUPP; + goto nfsmout; + } + + nd->nd_repstat = nfsrv_bindconnsess(nd, sessid, &foreaft); + if (nd->nd_repstat == 0) { + NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID + 2 * + NFSX_UNSIGNED); + NFSBCOPY(sessid, tl, NFSX_V4SESSIONID); + tl += (NFSX_V4SESSIONID / NFSX_UNSIGNED); + *tl++ = txdr_unsigned(foreaft); + *tl = newnfs_false; + } +nfsmout: + NFSEXITCODE2(error, nd); + return (error); +} + +/* * nfsv4 destroy session service */ APPLESTATIC int Modified: head/sys/fs/nfsserver/nfs_nfsdsocket.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdsocket.c Fri Jun 1 19:42:59 2018 (r334491) +++ head/sys/fs/nfsserver/nfs_nfsdsocket.c Fri Jun 1 19:47:41 2018 (r334492) @@ -178,7 +178,7 @@ int (*nfsrv4_ops0[NFSV41_NOPS])(struct nfsrv_descript nfsrvd_write, nfsrvd_releaselckown, nfsrvd_notsupp, - nfsrvd_notsupp, + nfsrvd_bindconnsess, nfsrvd_exchangeid, nfsrvd_createsession, nfsrvd_destroysession, Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdstate.c Fri Jun 1 19:42:59 2018 (r334491) +++ head/sys/fs/nfsserver/nfs_nfsdstate.c Fri Jun 1 19:47:41 2018 (r334492) @@ -43,6 +43,7 @@ extern struct nfsstatsv1 nfsstatsv1; extern int nfsrv_lease; extern struct timeval nfsboottime; extern u_int32_t newnfs_true, newnfs_false; +extern int nfsd_debuglevel; NFSV4ROOTLOCKMUTEX; NFSSTATESPINLOCK; @@ -630,10 +631,11 @@ nfsrv_getclient(nfsquad_t clientid, int opflags, struc if (nsep != NULL) { /* Hold a reference on the xprt for a backchannel. */ if ((nsep->sess_crflags & NFSV4CRSESS_CONNBACKCHAN) - != 0 && clp->lc_req.nr_client == NULL) { - clp->lc_req.nr_client = (struct __rpc_client *) - clnt_bck_create(nd->nd_xprt->xp_socket, - cbprogram, NFSV4_CBVERS); + != 0) { + if (clp->lc_req.nr_client == NULL) + clp->lc_req.nr_client = (struct __rpc_client *) + clnt_bck_create(nd->nd_xprt->xp_socket, + cbprogram, NFSV4_CBVERS); if (clp->lc_req.nr_client != NULL) { SVC_ACQUIRE(nd->nd_xprt); nd->nd_xprt->xp_p2 = @@ -5900,9 +5902,18 @@ nfsrv_checksequence(struct nfsrv_descript *nd, uint32_ /* * If this session handles the backchannel, save the nd_xprt for this * RPC, since this is the one being used. + * RFC-5661 specifies that the fore channel will be implicitly + * bound by a Sequence operation. However, since some NFSv4.1 clients + * erroneously assumed that the back channel would be implicitly + * bound as well, do the implicit binding unless a + * BindConnectiontoSession has already been done on the session. */ if (sep->sess_clp->lc_req.nr_client != NULL && - (sep->sess_crflags & NFSV4CRSESS_CONNBACKCHAN) != 0) { + sep->sess_cbsess.nfsess_xprt != nd->nd_xprt && + (sep->sess_crflags & NFSV4CRSESS_CONNBACKCHAN) != 0 && + (sep->sess_clp->lc_flags & LCL_DONEBINDCONN) == 0) { + NFSD_DEBUG(2, + "nfsrv_checksequence: implicit back channel bind\n"); savxprt = sep->sess_cbsess.nfsess_xprt; SVC_ACQUIRE(nd->nd_xprt); nd->nd_xprt->xp_p2 = @@ -6032,6 +6043,80 @@ nfsrv_destroysession(struct nfsrv_descript *nd, uint8_ NFSLOCKV4ROOTMUTEX(); nfsv4_unlock(&nfsv4rootfs_lock, 1); NFSUNLOCKV4ROOTMUTEX(); + return (error); +} + +/* + * Bind a connection to a session. + * For now, only certain variants are supported, since the current session + * structure can only handle a single backchannel entry, which will be + * applied to all connections if it is set. + */ +int +nfsrv_bindconnsess(struct nfsrv_descript *nd, uint8_t *sessionid, int *foreaftp) +{ + struct nfssessionhash *shp; + struct nfsdsession *sep; + struct nfsclient *clp; + SVCXPRT *savxprt; + int error; + + error = 0; + shp = NFSSESSIONHASH(sessionid); + NFSLOCKSTATE(); + NFSLOCKSESSION(shp); + sep = nfsrv_findsession(sessionid); + if (sep != NULL) { + clp = sep->sess_clp; + if (*foreaftp == NFSCDFC4_BACK || + *foreaftp == NFSCDFC4_BACK_OR_BOTH || + *foreaftp == NFSCDFC4_FORE_OR_BOTH) { + /* Try to set up a backchannel. */ + if (clp->lc_req.nr_client == NULL) { + NFSD_DEBUG(2, "nfsrv_bindconnsess: acquire " + "backchannel\n"); + clp->lc_req.nr_client = (struct __rpc_client *) + clnt_bck_create(nd->nd_xprt->xp_socket, + sep->sess_cbprogram, NFSV4_CBVERS); + } + if (clp->lc_req.nr_client != NULL) { + NFSD_DEBUG(2, "nfsrv_bindconnsess: set up " + "backchannel\n"); + savxprt = sep->sess_cbsess.nfsess_xprt; + SVC_ACQUIRE(nd->nd_xprt); + nd->nd_xprt->xp_p2 = + clp->lc_req.nr_client->cl_private; + /* Disable idle timeout. */ + nd->nd_xprt->xp_idletimeout = 0; + sep->sess_cbsess.nfsess_xprt = nd->nd_xprt; + if (savxprt != NULL) + SVC_RELEASE(savxprt); + sep->sess_crflags |= NFSV4CRSESS_CONNBACKCHAN; + clp->lc_flags |= LCL_DONEBINDCONN; + if (*foreaftp == NFSCDFS4_BACK) + *foreaftp = NFSCDFS4_BACK; + else + *foreaftp = NFSCDFS4_BOTH; + } else if (*foreaftp != NFSCDFC4_BACK) { + NFSD_DEBUG(2, "nfsrv_bindconnsess: can't set " + "up backchannel\n"); + sep->sess_crflags &= ~NFSV4CRSESS_CONNBACKCHAN; + clp->lc_flags |= LCL_DONEBINDCONN; + *foreaftp = NFSCDFS4_FORE; + } else { + error = NFSERR_NOTSUPP; + printf("nfsrv_bindconnsess: Can't add " + "backchannel\n"); + } + } else { + NFSD_DEBUG(2, "nfsrv_bindconnsess: Set forechannel\n"); + clp->lc_flags |= LCL_DONEBINDCONN; + *foreaftp = NFSCDFS4_FORE; + } + } else + error = NFSERR_BADSESSION; + NFSUNLOCKSESSION(shp); + NFSUNLOCKSTATE(); return (error); } From owner-svn-src-head@freebsd.org Fri Jun 1 19:56:44 2018 Return-Path: Delivered-To: svn-src-head@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 D33D0F713F5; Fri, 1 Jun 2018 19:56:43 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 841D16FEFE; Fri, 1 Jun 2018 19:56:43 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B0AC2D51B; Fri, 1 Jun 2018 19:56:43 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51JuhDk014742; Fri, 1 Jun 2018 19:56:43 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51JugHh014734; Fri, 1 Jun 2018 19:56:42 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <201806011956.w51JugHh014734@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Fri, 1 Jun 2018 19:56:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334493 - in head/usr.bin/indent: . tests X-SVN-Group: head X-SVN-Commit-Author: pstef X-SVN-Commit-Paths: in head/usr.bin/indent: . tests X-SVN-Commit-Revision: 334493 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 19:56:44 -0000 Author: pstef Date: Fri Jun 1 19:56:41 2018 New Revision: 334493 URL: https://svnweb.freebsd.org/changeset/base/334493 Log: indent(1): restore working -pcs My previous indent(1) commit accidentally broke the -pcs option (which adds space between function name and opening parenthesis in function calls) by copying all but one of a few conditions in an if clause. Reinstate the condition. Add a regression test to lower the chances of breaking it again. Correct a comment with description of what the option does. Added: head/usr.bin/indent/tests/pcs.0 (contents, props changed) head/usr.bin/indent/tests/pcs.0.pro (contents, props changed) head/usr.bin/indent/tests/pcs.0.stdout (contents, props changed) Modified: head/usr.bin/indent/indent.c head/usr.bin/indent/indent_globs.h head/usr.bin/indent/tests/Makefile Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Fri Jun 1 19:47:41 2018 (r334492) +++ head/usr.bin/indent/indent.c Fri Jun 1 19:56:41 2018 (r334493) @@ -556,6 +556,7 @@ check_type: } else if (ps.want_blank && *token != '[' && ((ps.last_token != ident && ps.last_token != funcname) || + proc_calls_space || /* offsetof (1) is never allowed a space; sizeof (2) gets * one iff -bs; all other keywords (>2) always get a space * before lparen */ Modified: head/usr.bin/indent/indent_globs.h ============================================================================== --- head/usr.bin/indent/indent_globs.h Fri Jun 1 19:47:41 2018 (r334492) +++ head/usr.bin/indent/indent_globs.h Fri Jun 1 19:56:41 2018 (r334493) @@ -168,7 +168,7 @@ int procnames_start_line; /* if true, the name * the type of the procedure and its * name) */ int proc_calls_space; /* If true, procedure calls look like: - * foo(bar) rather than foo (bar) */ + * foo (bar) rather than foo(bar) */ int format_block_comments; /* true if comments beginning with * `/ * \n' are to be reformatted */ int format_col1_comments; /* If comments which start in column 1 Modified: head/usr.bin/indent/tests/Makefile ============================================================================== --- head/usr.bin/indent/tests/Makefile Fri Jun 1 19:47:41 2018 (r334492) +++ head/usr.bin/indent/tests/Makefile Fri Jun 1 19:56:41 2018 (r334493) @@ -26,6 +26,9 @@ ${PACKAGE}FILES+= offsetof.0.stdout ${PACKAGE}FILES+= parens.0 ${PACKAGE}FILES+= parens.0.stdout ${PACKAGE}FILES+= parens.0.pro +${PACKAGE}FILES+= pcs.0 +${PACKAGE}FILES+= pcs.0.stdout +${PACKAGE}FILES+= pcs.0.pro ${PACKAGE}FILES+= sac.0 ${PACKAGE}FILES+= sac.0.stdout ${PACKAGE}FILES+= sac.0.pro Added: head/usr.bin/indent/tests/pcs.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/indent/tests/pcs.0 Fri Jun 1 19:56:41 2018 (r334493) @@ -0,0 +1,7 @@ +/* $FreeBSD$ */ +#include + +int main(void) { + puts("Hello"); + return 0; +} Added: head/usr.bin/indent/tests/pcs.0.pro ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/indent/tests/pcs.0.pro Fri Jun 1 19:56:41 2018 (r334493) @@ -0,0 +1,2 @@ +/* $FreeBSD$ */ +-pcs Added: head/usr.bin/indent/tests/pcs.0.stdout ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/indent/tests/pcs.0.stdout Fri Jun 1 19:56:41 2018 (r334493) @@ -0,0 +1,9 @@ +/* $FreeBSD$ */ +#include + +int +main(void) +{ + puts ("Hello"); + return 0; +} From owner-svn-src-head@freebsd.org Fri Jun 1 19:58:20 2018 Return-Path: Delivered-To: svn-src-head@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 41879F718A6; Fri, 1 Jun 2018 19:58:20 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EA82C70149; Fri, 1 Jun 2018 19:58:19 +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 CBA992D51C; Fri, 1 Jun 2018 19:58:19 +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 w51JwJWr014842; Fri, 1 Jun 2018 19:58:19 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51JwJF8014841; Fri, 1 Jun 2018 19:58:19 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201806011958.w51JwJF8014841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 1 Jun 2018 19:58:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334494 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 334494 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 19:58:20 -0000 Author: tuexen Date: Fri Jun 1 19:58:19 2018 New Revision: 334494 URL: https://svnweb.freebsd.org/changeset/base/334494 Log: Ensure net.inet.tcp.syncache.rexmtlimit is limited by TCP_MAXRXTSHIFT. If the sysctl variable is set to a value larger than TCP_MAXRXTSHIFT+1, the array tcp_syn_backoff[] is accessed out of bounds. Discussed with: jtl@ MFC after: 3 days Sponsored by: Netflix, Inc. Modified: head/sys/netinet/tcp_syncache.c Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Fri Jun 1 19:56:41 2018 (r334493) +++ head/sys/netinet/tcp_syncache.c Fri Jun 1 19:58:19 2018 (r334494) @@ -183,8 +183,27 @@ SYSCTL_UINT(_net_inet_tcp_syncache, OID_AUTO, hashsize &VNET_NAME(tcp_syncache.hashsize), 0, "Size of TCP syncache hashtable"); -SYSCTL_UINT(_net_inet_tcp_syncache, OID_AUTO, rexmtlimit, CTLFLAG_VNET | CTLFLAG_RW, +static int +sysctl_net_inet_tcp_syncache_rexmtlimit_check(SYSCTL_HANDLER_ARGS) +{ + int error; + u_int new; + + new = V_tcp_syncache.rexmt_limit; + error = sysctl_handle_int(oidp, &new, 0, req); + if ((error == 0) && (req->newptr != NULL)) { + if (new > TCP_MAXRXTSHIFT) + error = EINVAL; + else + V_tcp_syncache.rexmt_limit = new; + } + return (error); +} + +SYSCTL_PROC(_net_inet_tcp_syncache, OID_AUTO, rexmtlimit, + CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW, &VNET_NAME(tcp_syncache.rexmt_limit), 0, + sysctl_net_inet_tcp_syncache_rexmtlimit_check, "UI", "Limit on SYN/ACK retransmissions"); VNET_DEFINE(int, tcp_sc_rst_sock_fail) = 1; From owner-svn-src-head@freebsd.org Fri Jun 1 20:45:36 2018 Return-Path: Delivered-To: svn-src-head@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 10A89F7961C; Fri, 1 Jun 2018 20:45:36 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B224472AFF; Fri, 1 Jun 2018 20:45:35 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 92DF52DD16; Fri, 1 Jun 2018 20:45:35 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51KjZD9040209; Fri, 1 Jun 2018 20:45:35 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51KjZk9040208; Fri, 1 Jun 2018 20:45:35 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <201806012045.w51KjZk9040208@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Fri, 1 Jun 2018 20:45:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334495 - head/usr.bin/indent X-SVN-Group: head X-SVN-Commit-Author: pstef X-SVN-Commit-Paths: head/usr.bin/indent X-SVN-Commit-Revision: 334495 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 20:45:36 -0000 Author: pstef Date: Fri Jun 1 20:45:35 2018 New Revision: 334495 URL: https://svnweb.freebsd.org/changeset/base/334495 Log: indent(1): improve an error message When producing a "[...] requires a parameter" error, provide the recognized name of the option instead of argument provided. Modified: head/usr.bin/indent/args.c Modified: head/usr.bin/indent/args.c ============================================================================== --- head/usr.bin/indent/args.c Fri Jun 1 19:58:19 2018 (r334494) +++ head/usr.bin/indent/args.c Fri Jun 1 20:45:35 2018 (r334495) @@ -325,7 +325,7 @@ found: case PRO_INT: if (!isdigit(*param_start)) { need_param: - errx(1, "%s: ``%s'' requires a parameter", option_source, arg - 1); + errx(1, "%s: ``%s'' requires a parameter", option_source, p->p_name); } *p->p_obj = atoi(param_start); break; From owner-svn-src-head@freebsd.org Fri Jun 1 21:24:11 2018 Return-Path: Delivered-To: svn-src-head@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 B2B6BF7F1BF; Fri, 1 Jun 2018 21:24:11 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 64978747DA; Fri, 1 Jun 2018 21:24:11 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4565F2E370; Fri, 1 Jun 2018 21:24:11 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51LOB65060502; Fri, 1 Jun 2018 21:24:11 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51LOAiQ060500; Fri, 1 Jun 2018 21:24:10 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201806012124.w51LOAiQ060500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 1 Jun 2018 21:24:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334496 - head/tests/sys/audit X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/tests/sys/audit X-SVN-Commit-Revision: 334496 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 21:24:11 -0000 Author: asomers Date: Fri Jun 1 21:24:10 2018 New Revision: 334496 URL: https://svnweb.freebsd.org/changeset/base/334496 Log: audit(4): add tests for the fd audit class The only syscalls in this class are rmdir, unlink, unlinkat, rename, and renameat. Also, set is_exclusive for all audit(4) tests, because they can start and stop auditd. Submitted by: aniketp MFC after: 2 weeks Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15647 Added: head/tests/sys/audit/file-delete.c (contents, props changed) Modified: head/tests/sys/audit/Makefile Modified: head/tests/sys/audit/Makefile ============================================================================== --- head/tests/sys/audit/Makefile Fri Jun 1 20:45:35 2018 (r334495) +++ head/tests/sys/audit/Makefile Fri Jun 1 21:24:10 2018 (r334496) @@ -3,11 +3,14 @@ TESTSDIR= ${TESTSBASE}/sys/audit ATF_TESTS_C= file-create +ATF_TESTS_C+= file-delete ATF_TESTS_C+= file-write ATF_TESTS_C+= file-read SRCS.file-create+= file-create.c SRCS.file-create+= utils.c +SRCS.file-delete+= file-delete.c +SRCS.file-delete+= utils.c SRCS.file-write+= file-write.c SRCS.file-write+= utils.c SRCS.file-read+= file-read.c @@ -15,6 +18,7 @@ SRCS.file-read+= utils.c TEST_METADATA+= timeout="30" TEST_METADATA+= required_user="root" +TEST_METADATA+= is_exclusive="true" WARNS?= 6 Added: head/tests/sys/audit/file-delete.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/audit/file-delete.c Fri Jun 1 21:24:10 2018 (r334496) @@ -0,0 +1,270 @@ +/*- + * Copyright 2018 Aniket Pandey + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include + +#include +#include +#include + +#include "utils.h" + +static struct pollfd fds[1]; +static mode_t mode = 0777; +static const char *path = "fileforaudit"; +static const char *errpath = "dirdoesnotexist/fileforaudit"; +static const char *successreg = "fileforaudit.*return,success"; +static const char *failurereg = "fileforaudit.*return,failure"; + + +ATF_TC_WITH_CLEANUP(rmdir_success); +ATF_TC_HEAD(rmdir_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "rmdir(2) call"); +} + +ATF_TC_BODY(rmdir_success, tc) +{ + ATF_REQUIRE_EQ(0, mkdir(path, mode)); + FILE *pipefd = setup(fds, "fd"); + ATF_REQUIRE_EQ(0, rmdir(path)); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(rmdir_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(rmdir_failure); +ATF_TC_HEAD(rmdir_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "rmdir(2) call"); +} + +ATF_TC_BODY(rmdir_failure, tc) +{ + FILE *pipefd = setup(fds, "fd"); + /* Failure reason: directory does not exist */ + ATF_REQUIRE_EQ(-1, rmdir(errpath)); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(rmdir_failure, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(rename_success); +ATF_TC_HEAD(rename_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "rename(2) call"); +} + +ATF_TC_BODY(rename_success, tc) +{ + ATF_REQUIRE(open(path, O_CREAT, mode) != -1); + FILE *pipefd = setup(fds, "fd"); + ATF_REQUIRE_EQ(0, rename(path, "renamed")); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(rename_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(rename_failure); +ATF_TC_HEAD(rename_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "rename(2) call"); +} + +ATF_TC_BODY(rename_failure, tc) +{ + FILE *pipefd = setup(fds, "fd"); + /* Failure reason: file does not exist */ + ATF_REQUIRE_EQ(-1, rename(path, "renamed")); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(rename_failure, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(renameat_success); +ATF_TC_HEAD(renameat_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "renameat(2) call"); +} + +ATF_TC_BODY(renameat_success, tc) +{ + ATF_REQUIRE(open(path, O_CREAT, mode) != -1); + FILE *pipefd = setup(fds, "fd"); + ATF_REQUIRE_EQ(0, renameat(AT_FDCWD, path, AT_FDCWD, "renamed")); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(renameat_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(renameat_failure); +ATF_TC_HEAD(renameat_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "renameat(2) call"); +} + +ATF_TC_BODY(renameat_failure, tc) +{ + FILE *pipefd = setup(fds, "fd"); + /* Failure reason: file does not exist */ + ATF_REQUIRE_EQ(-1, renameat(AT_FDCWD, path, AT_FDCWD, "renamed")); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(renameat_failure, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(unlink_success); +ATF_TC_HEAD(unlink_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "unlink(2) call"); +} + +ATF_TC_BODY(unlink_success, tc) +{ + ATF_REQUIRE(open(path, O_CREAT, mode) != -1); + FILE *pipefd = setup(fds, "fd"); + ATF_REQUIRE_EQ(0, unlink(path)); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(unlink_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(unlink_failure); +ATF_TC_HEAD(unlink_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "unlink(2) call"); +} + +ATF_TC_BODY(unlink_failure, tc) +{ + FILE *pipefd = setup(fds, "fd"); + /* Failure reason: file does not exist */ + ATF_REQUIRE_EQ(-1, unlink(errpath)); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(unlink_failure, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(unlinkat_success); +ATF_TC_HEAD(unlinkat_success, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " + "unlinkat(2) call"); +} + +ATF_TC_BODY(unlinkat_success, tc) +{ + ATF_REQUIRE_EQ(0, mkdir(path, mode)); + FILE *pipefd = setup(fds, "fd"); + ATF_REQUIRE_EQ(0, unlinkat(AT_FDCWD, path, AT_REMOVEDIR)); + check_audit(fds, successreg, pipefd); +} + +ATF_TC_CLEANUP(unlinkat_success, tc) +{ + cleanup(); +} + + +ATF_TC_WITH_CLEANUP(unlinkat_failure); +ATF_TC_HEAD(unlinkat_failure, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful " + "unlinkat(2) call"); +} + +ATF_TC_BODY(unlinkat_failure, tc) +{ + FILE *pipefd = setup(fds, "fd"); + /* Failure reason: directory does not exist */ + ATF_REQUIRE_EQ(-1, unlinkat(AT_FDCWD, errpath, AT_REMOVEDIR)); + check_audit(fds, failurereg, pipefd); +} + +ATF_TC_CLEANUP(unlinkat_failure, tc) +{ + cleanup(); +} + + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, rmdir_success); + ATF_TP_ADD_TC(tp, rmdir_failure); + + ATF_TP_ADD_TC(tp, rename_success); + ATF_TP_ADD_TC(tp, rename_failure); + ATF_TP_ADD_TC(tp, renameat_success); + ATF_TP_ADD_TC(tp, renameat_failure); + + ATF_TP_ADD_TC(tp, unlink_success); + ATF_TP_ADD_TC(tp, unlink_failure); + ATF_TP_ADD_TC(tp, unlinkat_success); + ATF_TP_ADD_TC(tp, unlinkat_failure); + + return (atf_no_error()); +} From owner-svn-src-head@freebsd.org Fri Jun 1 21:24:28 2018 Return-Path: Delivered-To: svn-src-head@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 E2A2CF7F24A; Fri, 1 Jun 2018 21:24:27 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9001A748EF; Fri, 1 Jun 2018 21:24:27 +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 70AC82E371; Fri, 1 Jun 2018 21:24:27 +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 w51LORbI060555; Fri, 1 Jun 2018 21:24:27 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51LORAf060554; Fri, 1 Jun 2018 21:24:27 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201806012124.w51LORAf060554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 1 Jun 2018 21:24:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334497 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 334497 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 21:24:28 -0000 Author: tuexen Date: Fri Jun 1 21:24:27 2018 New Revision: 334497 URL: https://svnweb.freebsd.org/changeset/base/334497 Log: Limit the retransmission timer for SYN-ACKs by TCPTV_REXMTMAX. Use the same logic to handle the SYN-ACK retransmission when sent from the syn cache code as when sent from the main code. MFC after: 3 days Sponsored by: Netflix, Inc. Modified: head/sys/netinet/tcp_syncache.c Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Fri Jun 1 21:24:10 2018 (r334496) +++ head/sys/netinet/tcp_syncache.c Fri Jun 1 21:24:27 2018 (r334497) @@ -415,8 +415,14 @@ syncache_drop(struct syncache *sc, struct syncache_hea static void syncache_timeout(struct syncache *sc, struct syncache_head *sch, int docallout) { - sc->sc_rxttime = ticks + - TCPTV_RTOBASE * (tcp_syn_backoff[sc->sc_rxmits]); + int rexmt; + + if (sc->sc_rxmits == 0) + rexmt = TCPTV_RTOBASE; + else + TCPT_RANGESET(rexmt, TCPTV_RTOBASE * tcp_syn_backoff[sc->sc_rxmits], + tcp_rexmit_min, TCPTV_REXMTMAX); + sc->sc_rxttime = ticks + rexmt; sc->sc_rxmits++; if (TSTMP_LT(sc->sc_rxttime, sch->sch_nextc)) { sch->sch_nextc = sc->sc_rxttime; From owner-svn-src-head@freebsd.org Fri Jun 1 21:37:21 2018 Return-Path: Delivered-To: svn-src-head@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 34E80FC9253; Fri, 1 Jun 2018 21:37:21 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D4AB8752F6; Fri, 1 Jun 2018 21:37:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACFAB2E510; Fri, 1 Jun 2018 21:37:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51LbKgl065567; Fri, 1 Jun 2018 21:37:20 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51LbK1C065566; Fri, 1 Jun 2018 21:37:20 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201806012137.w51LbK1C065566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 1 Jun 2018 21:37:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334498 - head/sys/powerpc/include X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/include X-SVN-Commit-Revision: 334498 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 21:37:21 -0000 Author: jhibbits Date: Fri Jun 1 21:37:20 2018 New Revision: 334498 URL: https://svnweb.freebsd.org/changeset/base/334498 Log: Increase powerpc64 KVA from ~7.25GB to 32GB This will let us use much more KVA for ZFS ARC where needed. This may be incresed in the future if memory requirements increase. Discussed with: nwhitehorn Modified: head/sys/powerpc/include/vmparam.h Modified: head/sys/powerpc/include/vmparam.h ============================================================================== --- head/sys/powerpc/include/vmparam.h Fri Jun 1 21:24:27 2018 (r334497) +++ head/sys/powerpc/include/vmparam.h Fri Jun 1 21:37:20 2018 (r334498) @@ -107,7 +107,7 @@ #ifdef __powerpc64__ #define VM_MIN_KERNEL_ADDRESS 0xe000000000000000UL -#define VM_MAX_KERNEL_ADDRESS 0xe0000001c7ffffffUL +#define VM_MAX_KERNEL_ADDRESS 0xe0000007ffffffffUL #define VM_MAX_SAFE_KERNEL_ADDRESS VM_MAX_KERNEL_ADDRESS #endif From owner-svn-src-head@freebsd.org Fri Jun 1 21:37:43 2018 Return-Path: Delivered-To: svn-src-head@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 A5CEFFC9378; Fri, 1 Jun 2018 21:37:43 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5810F75442; Fri, 1 Jun 2018 21:37:43 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 391812E511; Fri, 1 Jun 2018 21:37:43 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51LbhdS065623; Fri, 1 Jun 2018 21:37:43 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51Lbhvc065622; Fri, 1 Jun 2018 21:37:43 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201806012137.w51Lbhvc065622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Fri, 1 Jun 2018 21:37:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334499 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 334499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 21:37:43 -0000 Author: alc Date: Fri Jun 1 21:37:42 2018 New Revision: 334499 URL: https://svnweb.freebsd.org/changeset/base/334499 Log: Only a small subset of mmap(2)'s flags should be used in combination with the flag MAP_GUARD. Rather than enumerating the flags that are not allowed, enumerate the flags that are allowed. The list of allowed flags is much shorter and less likely to change. (As an aside, one of the previously enumerated flags, MAP_PREFAULT, was not even a legal flag for mmap(2). However, because of an earlier check within kern_mmap(), this misuse of MAP_PREFAULT was harmless.) Reviewed by: kib MFC after: 10 days Modified: head/sys/vm/vm_mmap.c Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Fri Jun 1 21:37:20 2018 (r334498) +++ head/sys/vm/vm_mmap.c Fri Jun 1 21:37:42 2018 (r334499) @@ -241,8 +241,8 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t s (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) != 0) return (EINVAL); if ((flags & MAP_GUARD) != 0 && (prot != PROT_NONE || fd != -1 || - pos != 0 || (flags & (MAP_SHARED | MAP_PRIVATE | MAP_PREFAULT | - MAP_PREFAULT_READ | MAP_ANON | MAP_STACK)) != 0)) + pos != 0 || (flags & ~(MAP_FIXED | MAP_GUARD | MAP_EXCL | + MAP_32BIT | MAP_ALIGNMENT_MASK)) != 0)) return (EINVAL); /* From owner-svn-src-head@freebsd.org Fri Jun 1 22:09:28 2018 Return-Path: Delivered-To: svn-src-head@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 B9C36FD3097; Fri, 1 Jun 2018 22:09:28 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 681A376C43; Fri, 1 Jun 2018 22:09:28 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44F232E9E7; Fri, 1 Jun 2018 22:09:28 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51M9ScU081193; Fri, 1 Jun 2018 22:09:28 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51M9RBR081191; Fri, 1 Jun 2018 22:09:27 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201806012209.w51M9RBR081191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 1 Jun 2018 22:09:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334500 - in head/lib/libc: amd64/gen i386/gen X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head/lib/libc: amd64/gen i386/gen X-SVN-Commit-Revision: 334500 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 22:09:28 -0000 Author: brooks Date: Fri Jun 1 22:09:27 2018 New Revision: 334500 URL: https://svnweb.freebsd.org/changeset/base/334500 Log: Remove support for SYS_sys_exit in favor of SYS_exit. SYS_exit has been defined in the repo since 1994 except for a brief window when SYS_sys_exit was defined in 2000. Modified: head/lib/libc/amd64/gen/rfork_thread.S head/lib/libc/i386/gen/rfork_thread.S Modified: head/lib/libc/amd64/gen/rfork_thread.S ============================================================================== --- head/lib/libc/amd64/gen/rfork_thread.S Fri Jun 1 21:37:42 2018 (r334499) +++ head/lib/libc/amd64/gen/rfork_thread.S Fri Jun 1 22:09:27 2018 (r334500) @@ -80,11 +80,7 @@ ENTRY(rfork_thread) /* * Exit system call */ -#ifdef SYS_exit movq $SYS_exit, %rax -#else - movq $SYS_sys_exit, %rax -#endif KERNCALL /* Modified: head/lib/libc/i386/gen/rfork_thread.S ============================================================================== --- head/lib/libc/i386/gen/rfork_thread.S Fri Jun 1 21:37:42 2018 (r334499) +++ head/lib/libc/i386/gen/rfork_thread.S Fri Jun 1 22:09:27 2018 (r334500) @@ -98,11 +98,7 @@ ENTRY(rfork_thread) */ pushl %eax pushl $0 -#ifdef SYS_exit movl $SYS_exit, %eax -#else - movl $SYS_sys_exit, %eax -#endif KERNCALL /* From owner-svn-src-head@freebsd.org Fri Jun 1 22:35:00 2018 Return-Path: Delivered-To: svn-src-head@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 6D7A8FDB6A1; Fri, 1 Jun 2018 22:35:00 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1DA8C7812C; Fri, 1 Jun 2018 22:35:00 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F233A2EEB9; Fri, 1 Jun 2018 22:34:59 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51MYxRf097185; Fri, 1 Jun 2018 22:34:59 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51MYxCF097184; Fri, 1 Jun 2018 22:34:59 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201806012234.w51MYxCF097184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 1 Jun 2018 22:34:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334501 - head/usr.bin/touch X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/usr.bin/touch X-SVN-Commit-Revision: 334501 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 22:35:00 -0000 Author: cem Date: Fri Jun 1 22:34:59 2018 New Revision: 334501 URL: https://svnweb.freebsd.org/changeset/base/334501 Log: touch.1: Update to conform to POSIX 2004 POSIX borrowed the "double leap second" bug from C89. Double leap seconds can never happen. This mistake was present in at least POSIX 1997 and fixed by POSIX 2004. I can't find a copy of 2001 online to determine if the bug was present in that revision. While here, remove duplicate language between -d and -t. A few other minor enhancements and an igor (lint) bugfix. Further reading: 2018 POSIX (documents -d): http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html 2004 POSIX (documents SS from 0-60): http://pubs.opengroup.org/onlinepubs/009695399/utilities/touch.html 1997 POSIX/SUSv2 (historical interest, 0-61): http://pubs.opengroup.org/onlinepubs/007908799/xcu/touch.html More on this subject (start at "Unix system time and the POSIX standard") https://www.ucolick.org/~sla/leapsecs/onlinebib.html And: https://marc.info/?l=openbsd-tech&m=92682843416159&w=2 Reported by: Vishal Sahu Sponsored by: Dell EMC Isilon Modified: head/usr.bin/touch/touch.1 Modified: head/usr.bin/touch/touch.1 ============================================================================== --- head/usr.bin/touch/touch.1 Fri Jun 1 22:09:27 2018 (r334500) +++ head/usr.bin/touch/touch.1 Fri Jun 1 22:34:59 2018 (r334501) @@ -31,7 +31,7 @@ .\" @(#)touch.1 8.3 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd March 8, 2015 +.Dd June 1, 2018 .Dt TOUCH 1 .Os .Sh NAME @@ -53,7 +53,8 @@ If any file does not exist, it is created with default .Pp By default, .Nm -changes both modification and access times. The +changes both modification and access times. +The .Fl a and .Fl m @@ -113,39 +114,36 @@ The utility does not treat this as an error. No error messages are displayed and the exit value is not affected. .It Fl d -Change the access and modification times to the specified time instead +Change the access and modification times to the specified date time instead of the current time of day. The argument is of the form .Dq YYYY-MM-DDThh:mm:SS[.frac][tz] where the letters represent the following: .Bl -tag -width Ds -compact -offset indent .It Ar YYYY -The year. -.It Ar MM -The month of the year, from 01 to 12. -.It Ar DD -The day of the month, from 01 to 31. +At least four decimal digits representing the year. +.It Ar MM , Ar DD , Ar hh , Ar mm , Ar SS +As with +.Fl t +time. .It Ar T The letter .Li T -or a space. -.It Ar hh -The hour of the day, from 00 to 23. -.It Ar mm -The minute of the hour, from 00 to 59. -.It Ar SS -The second of the minute, from 00 to 61. +or a space is the time designator. .It Ar .frac -An optional fraction, -consisting of a period or a comma followed by one or more digits. -The number of significant digits depends on the kernel configuration and -the filesystem, and may be zero. +An optional fraction, consisting of a period or a comma followed by one or +more digits. +The number of significant digits depends on the kernel configuration and the +filesystem, and may be zero. .It Ar tz An optional letter .Li Z indicating the time is in .Tn UTC . Otherwise, the time is assumed to be in local time. +Local time is affected by the value of the +.Ev TZ +environment variable. .El .It Fl h If the file is a symbolic link, change the times of the link @@ -196,7 +194,7 @@ The hour of the day, from 00 to 23. .It Ar mm The minute of the hour, from 00 to 59. .It Ar SS -The second of the minute, from 00 to 61. +The second of the minute, from 00 to 60. .El .Pp If the From owner-svn-src-head@freebsd.org Fri Jun 1 22:38:00 2018 Return-Path: Delivered-To: svn-src-head@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 792EFFDBD77; Fri, 1 Jun 2018 22:38:00 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2E26E783F3; Fri, 1 Jun 2018 22:38:00 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B5A42EEBF; Fri, 1 Jun 2018 22:38:00 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51Mbxsp097343; Fri, 1 Jun 2018 22:37:59 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51MbxJm097341; Fri, 1 Jun 2018 22:37:59 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201806012237.w51MbxJm097341@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 1 Jun 2018 22:37:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334502 - in head: bin/date usr.bin/at usr.bin/last X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: bin/date usr.bin/at usr.bin/last X-SVN-Commit-Revision: 334502 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 22:38:00 -0000 Author: cem Date: Fri Jun 1 22:37:59 2018 New Revision: 334502 URL: https://svnweb.freebsd.org/changeset/base/334502 Log: Update other man pages to match leap second reality Missed these in r334501; see justification there: https://svnweb.freebsd.org/base?view=revision&revision=334501 Sponsored by: Dell EMC Isilon Modified: head/bin/date/date.1 head/usr.bin/at/at.man head/usr.bin/last/last.1 Modified: head/bin/date/date.1 ============================================================================== --- head/bin/date/date.1 Fri Jun 1 22:34:59 2018 (r334501) +++ head/bin/date/date.1 Fri Jun 1 22:37:59 2018 (r334502) @@ -32,7 +32,7 @@ .\" @(#)date.1 8.3 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd May 7, 2015 +.Dd June 1, 2018 .Dt DATE 1 .Os .Sh NAME @@ -296,8 +296,8 @@ Hour, a number from 0 to 23. .It Ar MM Minutes, a number from 0 to 59. .It Ar ss -Seconds, a number from 0 to 61 -(59 plus a maximum of two leap seconds). +Seconds, a number from 0 to 60 +(59 plus a potential leap second). .El .Pp Everything but the minutes is optional. Modified: head/usr.bin/at/at.man ============================================================================== --- head/usr.bin/at/at.man Fri Jun 1 22:34:59 2018 (r334501) +++ head/usr.bin/at/at.man Fri Jun 1 22:37:59 2018 (r334502) @@ -294,7 +294,7 @@ The hour of the day, from 0 to 23. .It Ar mm The minute of the hour, from 0 to 59. .It Ar SS -The second of the minute, from 0 to 61. +The second of the minute, from 0 to 60. .El .Pp If the Modified: head/usr.bin/last/last.1 ============================================================================== --- head/usr.bin/last/last.1 Fri Jun 1 22:34:59 2018 (r334501) +++ head/usr.bin/last/last.1 Fri Jun 1 22:37:59 2018 (r334502) @@ -28,7 +28,7 @@ .\" @(#)last.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 6, 2015 +.Dd June 1, 2018 .Dt LAST 1 .Os .Sh NAME @@ -121,7 +121,7 @@ Hour of the day, from 0 to 23. .It Ar mm Minute of the hour, from 0 to 59. .It Ar SS -Second of the minute, from 0 to 61. +Second of the minute, from 0 to 60. .El .Pp If the From owner-svn-src-head@freebsd.org Fri Jun 1 22:57:21 2018 Return-Path: Delivered-To: svn-src-head@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 1555DFDEE06; Fri, 1 Jun 2018 22:57:21 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B399E7A108; Fri, 1 Jun 2018 22:57:20 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 85F842F1ED; Fri, 1 Jun 2018 22:57:20 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51MvKEQ009019; Fri, 1 Jun 2018 22:57:20 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51MvKq5009018; Fri, 1 Jun 2018 22:57:20 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201806012257.w51MvKq5009018@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 1 Jun 2018 22:57:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334503 - head/usr.bin/at X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/usr.bin/at X-SVN-Commit-Revision: 334503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 22:57:21 -0000 Author: cem Date: Fri Jun 1 22:57:19 2018 New Revision: 334503 URL: https://svnweb.freebsd.org/changeset/base/334503 Log: at.man: Bump .Dd missed in r334502 Sponsored by: Dell EMC Isilon Modified: head/usr.bin/at/at.man Modified: head/usr.bin/at/at.man ============================================================================== --- head/usr.bin/at/at.man Fri Jun 1 22:37:59 2018 (r334502) +++ head/usr.bin/at/at.man Fri Jun 1 22:57:19 2018 (r334503) @@ -1,5 +1,5 @@ .\" $FreeBSD$ -.Dd January 13, 2002 +.Dd June 1, 2018 .Dt "AT" 1 .Os .Sh NAME From owner-svn-src-head@freebsd.org Fri Jun 1 23:40:44 2018 Return-Path: Delivered-To: svn-src-head@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 C6F5DEFAECD; Fri, 1 Jun 2018 23:40:44 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74F0D7C358; Fri, 1 Jun 2018 23:40:44 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 560222F873; Fri, 1 Jun 2018 23:40:44 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51Neicf031334; Fri, 1 Jun 2018 23:40:44 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51Nein2031333; Fri, 1 Jun 2018 23:40:44 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201806012340.w51Nein2031333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 1 Jun 2018 23:40:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334504 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 334504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 23:40:45 -0000 Author: markj Date: Fri Jun 1 23:40:43 2018 New Revision: 334504 URL: https://svnweb.freebsd.org/changeset/base/334504 Log: Remove an inaccuracy from mincore.2. Super pages are supported on non-x86 architectures, so just remove the incorrect note. While here, change terminology to be consistent with mmap.2. MFC after: 1 week Modified: head/lib/libc/sys/mincore.2 Modified: head/lib/libc/sys/mincore.2 ============================================================================== --- head/lib/libc/sys/mincore.2 Fri Jun 1 22:57:19 2018 (r334503) +++ head/lib/libc/sys/mincore.2 Fri Jun 1 23:40:43 2018 (r334504) @@ -28,7 +28,7 @@ .\" @(#)mincore.2 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd January 17, 2003 +.Dd June 1, 2018 .Dt MINCORE 2 .Os .Sh NAME @@ -73,7 +73,9 @@ Page has been referenced. .It Dv MINCORE_MODIFIED_OTHER Page has been modified. .It Dv MINCORE_SUPER -Page is part of a "super" page. (only i386 & amd64) +Page is part of a large +.Pq Dq super +page. .El .Pp The information returned by From owner-svn-src-head@freebsd.org Fri Jun 1 23:42:11 2018 Return-Path: Delivered-To: svn-src-head@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 7434FEFB3D0; Fri, 1 Jun 2018 23:42:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2A0877C74A; Fri, 1 Jun 2018 23:42:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B3D42F9CD; Fri, 1 Jun 2018 23:42:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51NgAbT034307; Fri, 1 Jun 2018 23:42:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51NgAwu034306; Fri, 1 Jun 2018 23:42:10 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201806012342.w51NgAwu034306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 1 Jun 2018 23:42:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334505 - in head/lib/libc: aarch64 riscv X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/lib/libc: aarch64 riscv X-SVN-Commit-Revision: 334505 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 23:42:11 -0000 Author: markj Date: Fri Jun 1 23:42:10 2018 New Revision: 334505 URL: https://svnweb.freebsd.org/changeset/base/334505 Log: Don't export _end on arm64 and riscv. These platforms don't support brk() and sbrk(), which are the reason for exporting _end in the first place. MFC after: 1 week Modified: head/lib/libc/aarch64/Symbol.map head/lib/libc/riscv/Symbol.map Modified: head/lib/libc/aarch64/Symbol.map ============================================================================== --- head/lib/libc/aarch64/Symbol.map Fri Jun 1 23:40:43 2018 (r334504) +++ head/lib/libc/aarch64/Symbol.map Fri Jun 1 23:42:10 2018 (r334505) @@ -33,6 +33,5 @@ FBSD_1.0 { FBSDprivate_1.0 { _set_tp; - _end; __makecontext; }; Modified: head/lib/libc/riscv/Symbol.map ============================================================================== --- head/lib/libc/riscv/Symbol.map Fri Jun 1 23:40:43 2018 (r334504) +++ head/lib/libc/riscv/Symbol.map Fri Jun 1 23:42:10 2018 (r334505) @@ -33,6 +33,5 @@ FBSD_1.0 { FBSDprivate_1.0 { _set_tp; - _end; __makecontext; }; From owner-svn-src-head@freebsd.org Fri Jun 1 23:49:33 2018 Return-Path: Delivered-To: svn-src-head@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 4A8C3EFC55A; Fri, 1 Jun 2018 23:49:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E71257CCA9; Fri, 1 Jun 2018 23:49:32 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C04DF2F9EF; Fri, 1 Jun 2018 23:49:32 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w51NnWAJ035399; Fri, 1 Jun 2018 23:49:32 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51NnWsv035398; Fri, 1 Jun 2018 23:49:32 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201806012349.w51NnWsv035398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 1 Jun 2018 23:49:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334506 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 334506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 23:49:33 -0000 Author: markj Date: Fri Jun 1 23:49:32 2018 New Revision: 334506 URL: https://svnweb.freebsd.org/changeset/base/334506 Log: Avoid completing I/O when dumping core after a panic. Filesystem or pager completion callbacks are generally non-functional after a panic and may trigger deadlocks if invoked in this context (e.g., by attempting to destroying a buffer mapping). To avoid this situation, short-circuit I/O completion in biodone(). Reviewed by: imp Discussed with: mav MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D15592 Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Fri Jun 1 23:42:10 2018 (r334505) +++ head/sys/kern/vfs_bio.c Fri Jun 1 23:49:32 2018 (r334506) @@ -4310,6 +4310,8 @@ allocbuf(struct buf *bp, int size) extern int inflight_transient_maps; +static struct bio_queue nondump_bios; + void biodone(struct bio *bp) { @@ -4318,6 +4320,17 @@ biodone(struct bio *bp) vm_offset_t start, end; biotrack(bp, __func__); + + /* + * Avoid completing I/O when dumping after a panic since that may + * result in a deadlock in the filesystem or pager code. Note that + * this doesn't affect dumps that were started manually since we aim + * to keep the system usable after it has been resumed. + */ + if (__predict_false(dumping && SCHEDULER_STOPPED())) { + TAILQ_INSERT_HEAD(&nondump_bios, bp, bio_queue); + return; + } if ((bp->bio_flags & BIO_TRANSIENT_MAPPING) != 0) { bp->bio_flags &= ~BIO_TRANSIENT_MAPPING; bp->bio_flags |= BIO_UNMAPPED; From owner-svn-src-head@freebsd.org Fri Jun 1 23:50:52 2018 Return-Path: Delivered-To: svn-src-head@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 0E4A4EFC7D9; Fri, 1 Jun 2018 23:50:52 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B61907CE8F; Fri, 1 Jun 2018 23:50:51 +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 97BD62FA0B; Fri, 1 Jun 2018 23:50:51 +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 w51NopZa038410; Fri, 1 Jun 2018 23:50:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w51NopD6038409; Fri, 1 Jun 2018 23:50:51 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201806012350.w51NopD6038409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 1 Jun 2018 23:50:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334507 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 334507 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 23:50:52 -0000 Author: kib Date: Fri Jun 1 23:50:51 2018 New Revision: 334507 URL: https://svnweb.freebsd.org/changeset/base/334507 Log: Only check for MAP_32BIT when available. Reported by: mmacy Sponsored by: The FreeBSD Foundation MFC after: 10 days Modified: head/sys/vm/vm_mmap.c Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Fri Jun 1 23:49:32 2018 (r334506) +++ head/sys/vm/vm_mmap.c Fri Jun 1 23:50:51 2018 (r334507) @@ -242,7 +242,10 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t s return (EINVAL); if ((flags & MAP_GUARD) != 0 && (prot != PROT_NONE || fd != -1 || pos != 0 || (flags & ~(MAP_FIXED | MAP_GUARD | MAP_EXCL | - MAP_32BIT | MAP_ALIGNMENT_MASK)) != 0)) +#ifdef MAP_32BIT + MAP_32BIT | +#endif + MAP_ALIGNMENT_MASK)) != 0)) return (EINVAL); /* From owner-svn-src-head@freebsd.org Sat Jun 2 00:01:08 2018 Return-Path: Delivered-To: svn-src-head@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 6FD59EFE03C; Sat, 2 Jun 2018 00:01:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 227697D708; Sat, 2 Jun 2018 00:01:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 032A02FBB6; Sat, 2 Jun 2018 00:01:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w52017FP044136; Sat, 2 Jun 2018 00:01:07 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w52017mQ044135; Sat, 2 Jun 2018 00:01:07 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201806020001.w52017mQ044135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 2 Jun 2018 00:01:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334508 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 334508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 00:01:08 -0000 Author: markj Date: Sat Jun 2 00:01:07 2018 New Revision: 334508 URL: https://svnweb.freebsd.org/changeset/base/334508 Log: Remove the "pass" variable from the page daemon control loop. It serves little purpose after r308474 and r329882. As a side effect, the removal fixes a bug in r329882 which caused the page daemon to periodically invoke lowmem handlers even in the absence of memory pressure. Reviewed by: jeff Differential Revision: https://reviews.freebsd.org/D15491 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Fri Jun 1 23:50:51 2018 (r334507) +++ head/sys/vm/vm_pageout.c Sat Jun 2 00:01:07 2018 (r334508) @@ -1352,7 +1352,7 @@ vm_pageout_reinsert_inactive(struct scan_state *ss, st * target. */ static int -vm_pageout_scan_inactive(struct vm_domain *vmd, int pass, int shortage, +vm_pageout_scan_inactive(struct vm_domain *vmd, int shortage, int *addl_shortage) { struct scan_state ss; @@ -1366,25 +1366,6 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int pa bool obj_locked; /* - * If we need to reclaim memory ask kernel caches to return - * some. We rate limit to avoid thrashing. - */ - if (vmd == VM_DOMAIN(0) && pass > 0 && - (time_uptime - lowmem_uptime) >= lowmem_period) { - /* - * Decrease registered cache sizes. - */ - SDT_PROBE0(vm, , , vm__lowmem_scan); - EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_PAGES); - /* - * We do this explicitly after the caches have been - * drained above. - */ - uma_reclaim(); - lowmem_uptime = time_uptime; - } - - /* * The addl_page_shortage is an estimate of the number of temporarily * stuck pages in the inactive queue. In other words, the * number of pages from the inactive count that should be @@ -1393,16 +1374,13 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int pa addl_page_shortage = 0; /* - * Calculate the number of pages that we want to free. This number - * can be negative if many pages are freed between the wakeup call to - * the page daemon and this calculation. + * vmd_pageout_deficit counts the number of pages requested in + * allocations that failed because of a free page shortage. We assume + * that the allocations will be reattempted and thus include the deficit + * in our scan target. */ - if (pass > 0) { - deficit = atomic_readandclear_int(&vmd->vmd_pageout_deficit); - page_shortage = shortage + deficit; - } else - page_shortage = deficit = 0; - starting_page_shortage = page_shortage; + deficit = atomic_readandclear_int(&vmd->vmd_pageout_deficit); + starting_page_shortage = page_shortage = shortage + deficit; mtx = NULL; obj_locked = false; @@ -1638,8 +1616,7 @@ reinsert: /* * Reclaim pages by swapping out idle processes, if configured to do so. */ - if (pass > 0) - vm_swapout_run_idle(); + vm_swapout_run_idle(); /* * See the description of addl_page_shortage above. @@ -1870,15 +1847,35 @@ vm_pageout_oom(int shortage) } static void +vm_pageout_lowmem(struct vm_domain *vmd) +{ + + if (vmd == VM_DOMAIN(0) && + time_uptime - lowmem_uptime >= lowmem_period) { + /* + * Decrease registered cache sizes. + */ + SDT_PROBE0(vm, , , vm__lowmem_scan); + EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_PAGES); + + /* + * We do this explicitly after the caches have been + * drained above. + */ + uma_reclaim(); + lowmem_uptime = time_uptime; + } +} + +static void vm_pageout_worker(void *arg) { struct vm_domain *vmd; - int addl_shortage, domain, pass, shortage; + int addl_shortage, domain, shortage; bool target_met; domain = (uintptr_t)arg; vmd = VM_DOMAIN(domain); - pass = 0; shortage = 0; target_met = true; @@ -1896,6 +1893,7 @@ vm_pageout_worker(void *arg) */ while (TRUE) { vm_domain_pageout_lock(vmd); + /* * We need to clear wanted before we check the limits. This * prevents races with wakers who will check wanted after they @@ -1908,12 +1906,12 @@ vm_pageout_worker(void *arg) */ if (vm_paging_needed(vmd, vmd->vmd_free_count)) { /* - * Yes, the scan failed to free enough pages. If - * we have performed a level >= 1 (page reclamation) - * scan, then sleep a bit and try again. + * Yes. If the scan failed to produce enough free + * pages, sleep uninterruptibly for some time in the + * hope that the laundry thread will clean some pages. */ vm_domain_pageout_unlock(vmd); - if (pass > 1) + if (!target_met) pause("pwait", hz / VM_INACT_SCAN_RATE); } else { /* @@ -1934,10 +1932,12 @@ vm_pageout_worker(void *arg) * this interval, and scan the inactive queue. */ shortage = pidctrl_daemon(&vmd->vmd_pid, vmd->vmd_free_count); - if (shortage > 0 && pass == 0) - pass = 1; - target_met = vm_pageout_scan_inactive(vmd, pass, shortage, - &addl_shortage); + if (shortage > 0) { + vm_pageout_lowmem(vmd); + target_met = vm_pageout_scan_inactive(vmd, shortage, + &addl_shortage); + } else + addl_shortage = 0; /* * Scan the active queue. A positive value for shortage @@ -1946,13 +1946,6 @@ vm_pageout_worker(void *arg) */ shortage = vm_pageout_active_target(vmd) + addl_shortage; vm_pageout_scan_active(vmd, shortage); - - /* - * If the target was not met we must increase the pass to - * more aggressively reclaim. - */ - if (!target_met) - pass++; } } From owner-svn-src-head@freebsd.org Sat Jun 2 00:02:17 2018 Return-Path: Delivered-To: svn-src-head@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 A0F00EFE417; Sat, 2 Jun 2018 00:02:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 50CED7DA98; Sat, 2 Jun 2018 00:02:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31C922FD1E; Sat, 2 Jun 2018 00:02:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5202Gnw045003; Sat, 2 Jun 2018 00:02:16 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5202FWX044996; Sat, 2 Jun 2018 00:02:15 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806020002.w5202FWX044996@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 2 Jun 2018 00:02:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334509 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334509 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 00:02:18 -0000 Author: eadler Date: Sat Jun 2 00:02:15 2018 New Revision: 334509 URL: https://svnweb.freebsd.org/changeset/base/334509 Log: top(1): ansify, style(9). and nits - Prefer using ansi prototypes rather than C prototypes - Keep type on separate line from name of function - Try to keep things const where possible. This will help get to WARNS=6 - switch to "bool" where it makes sense Modified: head/usr.bin/top/commands.c head/usr.bin/top/display.c head/usr.bin/top/machine.h head/usr.bin/top/screen.c head/usr.bin/top/top.c head/usr.bin/top/username.c head/usr.bin/top/username.h head/usr.bin/top/utils.c Modified: head/usr.bin/top/commands.c ============================================================================== --- head/usr.bin/top/commands.c Sat Jun 2 00:01:07 2018 (r334508) +++ head/usr.bin/top/commands.c Sat Jun 2 00:02:15 2018 (r334509) @@ -53,8 +53,7 @@ static int str_addarg(char *str, int len, char *arg, i */ void -show_help() - +show_help(void) { printf("Top version FreeBSD, %s\n", copyright); fputs("\n\n\ @@ -198,7 +197,7 @@ static char err_listem[] = #define STRMAX 80 -char *err_string() +char *err_string(void) { struct errs *errp; int cnt = 0; @@ -281,13 +280,7 @@ str_adderr(char *str, int len, int err) */ static int -str_addarg(str, len, arg, first) - -char *str; -int len; -char *arg; -int first; - +str_addarg(char str[], int len, char arg[], int first) { int arglen; @@ -334,8 +327,7 @@ err_compar(const void *p1, const void *p2) */ int -error_count() - +error_count(void) { return(errcnt); } @@ -345,8 +337,7 @@ error_count() */ void -show_errors() - +show_errors(void) { int cnt = 0; struct errs *errp = errs; Modified: head/usr.bin/top/display.c ============================================================================== --- head/usr.bin/top/display.c Sat Jun 2 00:01:07 2018 (r334508) +++ head/usr.bin/top/display.c Sat Jun 2 00:02:15 2018 (r334509) @@ -52,9 +52,6 @@ FILE *debug; #endif -/* imported from screen.c */ -extern int overstrike; - static int lmpid = 0; static int last_hi = 0; /* used in u_process and u_endscreen */ static int lastline = 0; @@ -123,8 +120,8 @@ int y_procs = 7; int y_cpustates = 2; int Header_lines = 7; -int display_resize() - +int +display_resize(void) { int lines; @@ -162,10 +159,7 @@ int display_resize() return(smart_terminal ? lines : Largest); } -int display_updatecpus(statics) - -struct statics *statics; - +int display_updatecpus(struct statics *statics) { int *lp; int lines; @@ -194,10 +188,7 @@ struct statics *statics; return(lines); } -int display_init(statics) - -struct statics *statics; - +int display_init(struct statics * statics) { int lines; char **pp; @@ -249,11 +240,7 @@ struct statics *statics; } void -i_loadave(mpid, avenrun) - -int mpid; -double *avenrun; - +i_loadave(int mpid, double avenrun[]) { int i; @@ -278,11 +265,7 @@ double *avenrun; } void -u_loadave(mpid, avenrun) - -int mpid; -double *avenrun; - +u_loadave(int mpid, double *avenrun) { int i; @@ -318,10 +301,7 @@ double *avenrun; } void -i_timeofday(tod) - -time_t *tod; - +i_timeofday(time_t *tod) { /* * Display the current time. @@ -364,11 +344,7 @@ static char procstates_buffer[MAX_COLS]; */ void -i_procstates(total, brkdn) - -int total; -int *brkdn; - +i_procstates(int total, int *brkdn) { int i; @@ -392,11 +368,7 @@ int *brkdn; } void -u_procstates(total, brkdn) - -int total; -int *brkdn; - +u_procstates(int total, int *brkdn) { static char new[MAX_COLS]; int i; @@ -441,10 +413,7 @@ int *brkdn; } void -i_cpustates(states) - -int *states; - +i_cpustates(int *states) { int i = 0; int value; @@ -487,10 +456,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) { } void -u_cpustates(states) - -int *states; - +u_cpustates(int *states) { int value; char **names; @@ -540,8 +506,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) { } void -z_cpustates() - +z_cpustates(void) { int i = 0; char **names; @@ -633,10 +598,7 @@ i_arc(int *stats) } void -u_arc(stats) - -int *stats; - +u_arc(int *stats) { static char new[MAX_COLS]; @@ -672,10 +634,7 @@ i_carc(int *stats) } void -u_carc(stats) - -int *stats; - +u_carc(int *stats) { static char new[MAX_COLS]; @@ -737,7 +696,7 @@ static int msglen = 0; on the screen (even when next_msg doesn't contain that message). */ void -i_message() +i_message(void) { while (lastline < y_message) @@ -759,8 +718,7 @@ i_message() } void -u_message() - +u_message(void) { i_message(); } @@ -773,10 +731,7 @@ static int header_length; */ char * -trim_header(text) - -char *text; - +trim_header(char *text) { char *s; int width; @@ -801,10 +756,7 @@ char *text; */ void -i_header(text) - -char *text; - +i_header(char *text) { char *s; @@ -825,12 +777,8 @@ char *text; free(s); } -/*ARGSUSED*/ void -u_header(text) - -char *text __unused; /* ignored */ - +u_header(char *text __unused) { if (header_status == ERASE) @@ -849,11 +797,7 @@ char *text __unused; /* ignored */ */ void -i_process(line, thisline) - -int line; -char *thisline; - +i_process(int line, char *thisline) { char *p; char *base; @@ -880,11 +824,7 @@ char *thisline; } void -u_process(line, newline) - -int line; -char *newline; - +u_process(int line, char *newline) { char *optr; int screen_line = line + Header_lines; @@ -928,10 +868,7 @@ char *newline; } void -u_endscreen(hi) - -int hi; - +u_endscreen(int hi) { int screen_line = hi + Header_lines; int i; @@ -1044,8 +981,7 @@ new_message(int type, char *msgfmt, ...) } void -clear_message() - +clear_message(void) { if (clear_eol(msglen) == 1) { @@ -1054,12 +990,7 @@ clear_message() } int -readline(buffer, size, numeric) - -char *buffer; -int size; -int numeric; - +readline(char *buffer, int size, int numeric) { char *ptr = buffer; char ch; @@ -1209,13 +1140,8 @@ static void summary_format(char *str, int *numbers, ch } } -static void line_update(old, new, start, line) - -char *old; -char *new; -int start; -int line; - +static void +line_update(char *old, char *new, int start, int line) { int ch; int diff; @@ -1336,10 +1262,8 @@ int line; * to the original buffer is returned. */ -char *printable(str) - -char *str; - +char * +printable(char str[]) { char *ptr; char ch; @@ -1357,11 +1281,7 @@ char *str; } void -i_uptime(bt, tod) - -struct timeval* bt; -time_t *tod; - +i_uptime(struct timeval *bt, time_t *tod) { time_t uptime; int days, hrs, mins, secs; Modified: head/usr.bin/top/machine.h ============================================================================== --- head/usr.bin/top/machine.h Sat Jun 2 00:01:07 2018 (r334508) +++ head/usr.bin/top/machine.h Sat Jun 2 00:02:15 2018 (r334509) @@ -83,7 +83,6 @@ int machine_init(struct statics *statics); int proc_owner(int pid); /* non-int routines typically used by the machine dependent module */ -char *printable(char *string); extern struct process_select ps; void * Modified: head/usr.bin/top/screen.c ============================================================================== --- head/usr.bin/top/screen.c Sat Jun 2 00:01:07 2018 (r334508) +++ head/usr.bin/top/screen.c Sat Jun 2 00:02:15 2018 (r334509) @@ -61,10 +61,7 @@ static char is_a_terminal = No; #define STDERR 2 void -init_termcap(interactive) - -int interactive; - +init_termcap(int interactive) { char *bufptr; char *PCptr; @@ -186,8 +183,7 @@ int interactive; } void -init_screen() - +init_screen(void) { /* get the old settings for safe keeping */ if (tcgetattr(STDOUT, &old_settings) != -1) @@ -221,8 +217,7 @@ init_screen() } void -end_screen() - +end_screen(void) { /* move to the lower left, clear the line and send "te" */ if (smart_terminal) @@ -241,8 +236,7 @@ end_screen() } void -reinit_screen() - +reinit_screen(void) { /* install our settings if it is a terminal */ if (is_a_terminal) @@ -258,11 +252,8 @@ reinit_screen() } void -get_screensize() - +get_screensize(void) { - - struct winsize ws; if (ioctl (1, TIOCGWINSZ, &ws) != -1) @@ -299,7 +290,7 @@ top_standout(char *msg) } void -top_clear() +top_clear(void) { if (smart_terminal) { @@ -330,8 +321,7 @@ clear_eol(int len) } void -go_home() - +go_home(void) { if (smart_terminal) { Modified: head/usr.bin/top/top.c ============================================================================== --- head/usr.bin/top/top.c Sat Jun 2 00:01:07 2018 (r334508) +++ head/usr.bin/top/top.c Sat Jun 2 00:02:15 2018 (r334509) @@ -70,15 +70,6 @@ static int max_topn; /* maximum displayable processes struct process_select ps; const char * myname = "top"; -char *username(int); - -time_t time(time_t *tloc); - -/* different routines for displaying the user's identification */ -/* (values assigned to get_userid) */ -char *username(int); -char *itoa7(int); - /* pointers to display routines */ static void (*d_loadave)(int mpid, double *avenrun) = i_loadave; static void (*d_procstates)(int total, int *brkdn) = i_procstates; @@ -1153,8 +1144,7 @@ restart: */ static void -reset_display() - +reset_display(void) { d_loadave = i_loadave; d_procstates = i_procstates; Modified: head/usr.bin/top/username.c ============================================================================== --- head/usr.bin/top/username.c Sat Jun 2 00:01:07 2018 (r334508) +++ head/usr.bin/top/username.c Sat Jun 2 00:02:15 2018 (r334509) @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -58,10 +59,7 @@ struct hash_el { static struct hash_el hash_table[Table_size]; -char *username(uid) - -int uid; - +char *username(int uid) { int hashindex; @@ -74,10 +72,7 @@ int uid; return(hash_table[hashindex].name); } -int userid(username) - -char *username; - +int userid(char username[]) { struct passwd *pwd; @@ -97,12 +92,8 @@ char *username; return(pwd->pw_uid); } -int enter_user(uid, name, wecare) - -int uid; -char *name; -int wecare; /* 1 = enter it always, 0 = nice to have */ - +/* wecare 1 = enter it always, 0 = nice to have */ +int enter_user(int uid, char name[], bool wecare) { int hashindex; Modified: head/usr.bin/top/username.h ============================================================================== --- head/usr.bin/top/username.h Sat Jun 2 00:01:07 2018 (r334508) +++ head/usr.bin/top/username.h Sat Jun 2 00:02:15 2018 (r334509) @@ -11,7 +11,9 @@ #ifndef USERNAME_H #define USERNAME_H -int enter_user(int uid, char *name, int wecare); +#include + +int enter_user(int uid, char *name, bool wecare); int get_user(int uid); void init_hash(void); char *username(int uid); Modified: head/usr.bin/top/utils.c ============================================================================== --- head/usr.bin/top/utils.c Sat Jun 2 00:01:07 2018 (r334508) +++ head/usr.bin/top/utils.c Sat Jun 2 00:02:15 2018 (r334509) @@ -59,10 +59,7 @@ atoiwi(char *str) */ _Static_assert(sizeof(int) <= 4, "buffer too small for this sized int"); -char *itoa(val) - -int val; - +char *itoa(int val) { char *ptr; static char buffer[16]; /* result is built here */ @@ -90,10 +87,7 @@ int val; * a front end to a more general routine for efficiency. */ -char *itoa7(val) - -int val; - +char *itoa7(int val) { char *ptr; static char buffer[16]; /* result is built here */ @@ -124,10 +118,7 @@ int val; * positive numbers. If val <= 0 then digits(val) == 0. */ -int digits(val) - -int val; - +int digits(int val) { int cnt = 0; @@ -155,13 +146,10 @@ strecpy(char *to, char *from) * string_index(string, array) - find string in array and return index */ -int string_index(string, array) - -char *string; -char **array; - +int +string_index(char *string, char *array[]) { - int i = 0; + size_t i = 0; while (*array != NULL) { @@ -182,11 +170,7 @@ char **array; * squat about quotes. */ -char **argparse(line, cntp) - -char *line; -int *cntp; - +char **argparse(char *line, int *cntp) { char *from; char *to; @@ -219,10 +203,10 @@ int *cntp; cnt += 3; /* allocate a char * array to hold the pointers */ - argarray = (char **)malloc(cnt * sizeof(char *)); + argarray = malloc(cnt * sizeof(char *)); /* allocate another array to hold the strings themselves */ - args = (char *)malloc(length+2); + args = malloc(length+2); /* initialization for main loop */ from = line; @@ -264,17 +248,11 @@ int *cntp; * "cnt" is size of each array and "diffs" is used for scratch space. * The array "old" is updated on each call. * The routine assumes modulo arithmetic. This function is especially - * useful on BSD mchines for calculating cpu state percentages. + * useful on for calculating cpu state percentages. */ -long percentages(cnt, out, new, old, diffs) - -int cnt; -int *out; -long *new; -long *old; -long *diffs; - +long +percentages(int cnt, int *out, long *new, long *old, long *diffs) { int i; long change; @@ -336,10 +314,8 @@ long *diffs; exceed 9999.9, we use "???". */ -char *format_time(seconds) - -long seconds; - +char * +format_time(long seconds) { static char result[10]; From owner-svn-src-head@freebsd.org Sat Jun 2 00:02:28 2018 Return-Path: Delivered-To: svn-src-head@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 5A11AEFE4B6; Sat, 2 Jun 2018 00:02:28 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E6E1C7DBA7; Sat, 2 Jun 2018 00:02:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C944A2FD2F; Sat, 2 Jun 2018 00:02:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5202R8f045050; Sat, 2 Jun 2018 00:02:27 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5202Rf7045049; Sat, 2 Jun 2018 00:02:27 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806020002.w5202Rf7045049@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 2 Jun 2018 00:02:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334510 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334510 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 00:02:28 -0000 Author: eadler Date: Sat Jun 2 00:02:27 2018 New Revision: 334510 URL: https://svnweb.freebsd.org/changeset/base/334510 Log: top(1): remove two unneeded headers Modified: head/usr.bin/top/commands.c Modified: head/usr.bin/top/commands.c ============================================================================== --- head/usr.bin/top/commands.c Sat Jun 2 00:02:15 2018 (r334509) +++ head/usr.bin/top/commands.c Sat Jun 2 00:02:27 2018 (r334510) @@ -17,7 +17,6 @@ * "top" (i.e.: changing the number of processes to display). */ -#include #include #include @@ -32,7 +31,6 @@ #include "sigdesc.h" /* generated automatically */ #include "top.h" #include "boolean.h" -#include "utils.h" #include "machine.h" static int err_compar(const void *p1, const void *p2); From owner-svn-src-head@freebsd.org Sat Jun 2 00:11:27 2018 Return-Path: Delivered-To: svn-src-head@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 AF11EEFFE6D; Sat, 2 Jun 2018 00:11:27 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5D3927E3ED; Sat, 2 Jun 2018 00:11:27 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 265B12FE7D; Sat, 2 Jun 2018 00:11:27 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w520BRYM049483; Sat, 2 Jun 2018 00:11:27 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w520BQkA049481; Sat, 2 Jun 2018 00:11:26 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201806020011.w520BQkA049481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 2 Jun 2018 00:11:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334511 - in head/sys/fs: nfs nfsclient X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in head/sys/fs: nfs nfsclient X-SVN-Commit-Revision: 334511 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 00:11:27 -0000 Author: rmacklem Date: Sat Jun 2 00:11:26 2018 New Revision: 334511 URL: https://svnweb.freebsd.org/changeset/base/334511 Log: Fix the default number of threads for Flex File layout pNFS client I/O. The intent was that the default would be based on number of CPUs, but the code disabled using taskqueue() by default. This code is only executed when mounting a NFSv4.1 server that supports the Flexible File layout for pNFS and, since such servers are rare, this change shouldn't result in a POLA violation. (The FreeBSD pNFS server is still a project and the only other one that uses Flexible File layout is being developed by Primary Data and I don't know if they have even shipped any to customers yet.) Found while testing the pNFS server. Modified: head/sys/fs/nfs/nfs_commonport.c head/sys/fs/nfsclient/nfs_clrpcops.c Modified: head/sys/fs/nfs/nfs_commonport.c ============================================================================== --- head/sys/fs/nfs/nfs_commonport.c Sat Jun 2 00:02:27 2018 (r334510) +++ head/sys/fs/nfs/nfs_commonport.c Sat Jun 2 00:11:26 2018 (r334511) @@ -90,7 +90,7 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, debuglevel, CTLFLAG_RW, 0, "Debug level for NFS client"); SYSCTL_INT(_vfs_nfs, OID_AUTO, userhashsize, CTLFLAG_RDTUN, &nfsrv_lughashsize, 0, "Size of hash tables for uid/name mapping"); -int nfs_pnfsiothreads = 0; +int nfs_pnfsiothreads = -1; SYSCTL_INT(_vfs_nfs, OID_AUTO, pnfsiothreads, CTLFLAG_RW, &nfs_pnfsiothreads, 0, "Number of pNFS mirror I/O threads"); @@ -723,6 +723,8 @@ nfs_pnfsio(task_fn_t *func, void *context) pio = (struct pnfsio *)context; if (pnfsioq == NULL) { if (nfs_pnfsiothreads == 0) + return (EPERM); + if (nfs_pnfsiothreads < 0) nfs_pnfsiothreads = mp_ncpus * 4; pnfsioq = taskqueue_create("pnfsioq", M_WAITOK, taskqueue_thread_enqueue, &pnfsioq); Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Sat Jun 2 00:02:27 2018 (r334510) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Sat Jun 2 00:11:26 2018 (r334511) @@ -6436,7 +6436,7 @@ nfsio_writedsmir(vnode_t vp, int *iomode, int *must_co drpc->p = p; drpc->inprog = 0; ret = EIO; - if (nfs_pnfsiothreads > 0) { + if (nfs_pnfsiothreads != 0) { ret = nfs_pnfsio(start_writedsmir, drpc); NFSCL_DEBUG(4, "nfsio_writedsmir: nfs_pnfsio=%d\n", ret); } @@ -6615,7 +6615,7 @@ nfsio_commitds(vnode_t vp, uint64_t offset, int cnt, s drpc->p = p; drpc->inprog = 0; ret = EIO; - if (nfs_pnfsiothreads > 0) { + if (nfs_pnfsiothreads != 0) { ret = nfs_pnfsio(start_commitds, drpc); NFSCL_DEBUG(4, "nfsio_commitds: nfs_pnfsio=%d\n", ret); } From owner-svn-src-head@freebsd.org Sat Jun 2 03:25:17 2018 Return-Path: Delivered-To: svn-src-head@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 3C166FDE0B7; Sat, 2 Jun 2018 03:25:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D353487CA1; Sat, 2 Jun 2018 03:25:16 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE2631FF0; Sat, 2 Jun 2018 03:25:16 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w523PGB5048831; Sat, 2 Jun 2018 03:25:16 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w523PFKn048824; Sat, 2 Jun 2018 03:25:15 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806020325.w523PFKn048824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 2 Jun 2018 03:25:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334514 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334514 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 03:25:17 -0000 Author: eadler Date: Sat Jun 2 03:25:15 2018 New Revision: 334514 URL: https://svnweb.freebsd.org/changeset/base/334514 Log: top(1): Use standard boolean rather than homegrown alternative Deleted: head/usr.bin/top/boolean.h Modified: head/usr.bin/top/commands.c head/usr.bin/top/display.c head/usr.bin/top/machine.c head/usr.bin/top/screen.c head/usr.bin/top/top.1 head/usr.bin/top/top.c Modified: head/usr.bin/top/commands.c ============================================================================== --- head/usr.bin/top/commands.c Sat Jun 2 02:06:48 2018 (r334513) +++ head/usr.bin/top/commands.c Sat Jun 2 03:25:15 2018 (r334514) @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -30,7 +31,6 @@ #include "commands.h" #include "sigdesc.h" /* generated automatically */ #include "top.h" -#include "boolean.h" #include "machine.h" static int err_compar(const void *p1, const void *p2); @@ -199,7 +199,7 @@ char *err_string(void) { struct errs *errp; int cnt = 0; - int first = Yes; + int first = true; int currerr = -1; int stringlen; /* characters still available in "string" */ static char string[STRMAX]; @@ -233,13 +233,13 @@ char *err_string(void) strcat(string, "; "); /* we know there's more */ } currerr = errp->errnum; - first = Yes; + first = true; } if ((stringlen = str_addarg(string, stringlen, errp->arg, first)) ==0) { return(err_listem); } - first = No; + first = false; } /* add final message */ Modified: head/usr.bin/top/display.c ============================================================================== --- head/usr.bin/top/display.c Sat Jun 2 02:06:48 2018 (r334513) +++ head/usr.bin/top/display.c Sat Jun 2 03:25:15 2018 (r334514) @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -44,7 +45,6 @@ #include "layout.h" /* defines for screen position layout */ #include "display.h" #include "top.h" -#include "boolean.h" #include "machine.h" /* we should eliminate this!!! */ #include "utils.h" @@ -1147,7 +1147,7 @@ line_update(char *old, char *new, int start, int line) int diff; int newcol = start + 1; int lastcol = start; - char cursor_on_line = No; + char cursor_on_line = false; char *current; /* compare the two strings and only rewrite what has changed */ @@ -1172,7 +1172,7 @@ line_update(char *old, char *new, int start, int line) { Move_to(start, line); } - cursor_on_line = Yes; + cursor_on_line = true; putchar(ch); *old = ch; lastcol = 1; @@ -1209,7 +1209,7 @@ line_update(char *old, char *new, int start, int line) { /* use cursor addressing */ Move_to(newcol, line); - cursor_on_line = Yes; + cursor_on_line = true; } /* remember where the cursor is */ lastcol = newcol + 1; Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Sat Jun 2 02:06:48 2018 (r334513) +++ head/usr.bin/top/machine.c Sat Jun 2 03:25:15 2018 (r334514) @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -308,7 +309,7 @@ machine_init(struct statics *statics) { int i, j, empty, pagesize; uint64_t arc_size; - boolean_t carc_en; + bool carc_en; size_t size; size = sizeof(smpmode); Modified: head/usr.bin/top/screen.c ============================================================================== --- head/usr.bin/top/screen.c Sat Jun 2 02:06:48 2018 (r334513) +++ head/usr.bin/top/screen.c Sat Jun 2 03:25:15 2018 (r334514) @@ -30,7 +30,6 @@ #include #include #include "screen.h" -#include "boolean.h" int overstrike; int screen_length; @@ -54,7 +53,7 @@ static char *terminal_end; static struct termios old_settings; static struct termios new_settings; -static char is_a_terminal = No; +static char is_a_terminal = false; #define STDIN 0 #define STDOUT 1 @@ -75,12 +74,12 @@ init_termcap(int interactive) if (!interactive) { /* pretend we have a dumb terminal */ - smart_terminal = No; + smart_terminal = false; return; } /* assume we have a smart terminal until proven otherwise */ - smart_terminal = Yes; + smart_terminal = true; /* get the terminal name */ term_name = getenv("TERM"); @@ -89,7 +88,7 @@ init_termcap(int interactive) /* patch courtesy of Sam Horrocks at telegraph.ics.uci.edu */ if (term_name == NULL) { - smart_terminal = No; + smart_terminal = false; return; } @@ -107,14 +106,14 @@ init_termcap(int interactive) } /* pretend it's dumb and proceed */ - smart_terminal = No; + smart_terminal = false; return; } /* "hardcopy" immediately indicates a very stupid terminal */ if (tgetflag("hc")) { - smart_terminal = No; + smart_terminal = false; return; } @@ -151,7 +150,7 @@ init_termcap(int interactive) if ((clear_screen = tgetstr("cl", &bufptr)) == NULL || (cursor_motion = tgetstr("cm", &bufptr)) == NULL) { - smart_terminal = No; + smart_terminal = false; return; } @@ -178,7 +177,7 @@ init_termcap(int interactive) /* if stdout is not a terminal, pretend we are a dumb terminal */ if (tcgetattr(STDOUT, &old_settings) == -1) { - smart_terminal = No; + smart_terminal = false; } } @@ -203,7 +202,7 @@ init_screen(void) ch_kill = old_settings.c_cc[VKILL]; /* remember that it really is a terminal */ - is_a_terminal = Yes; + is_a_terminal = true; /* send the termcap initialization string */ putcap(terminal_init); @@ -212,7 +211,7 @@ init_screen(void) if (!is_a_terminal) { /* not a terminal at all---consider it dumb */ - smart_terminal = No; + smart_terminal = false; } } Modified: head/usr.bin/top/top.1 ============================================================================== --- head/usr.bin/top/top.1 Sat Jun 2 02:06:48 2018 (r334513) +++ head/usr.bin/top/top.1 Sat Jun 2 03:25:15 2018 (r334514) @@ -145,7 +145,7 @@ numbers are displayed instead of the names. .TP .B \-v Write version number information to stderr then exit immediately. -No other processing takes place when this option is used. To see current +false other processing takes place when this option is used. To see current revision information while top is running, use the help command \*(lq?\*(rq. .TP .B \-w Modified: head/usr.bin/top/top.c ============================================================================== --- head/usr.bin/top/top.c Sat Jun 2 02:06:48 2018 (r334513) +++ head/usr.bin/top/top.c Sat Jun 2 03:25:15 2018 (r334514) @@ -31,7 +31,6 @@ #include "display.h" /* interface to display package */ #include "screen.h" /* interface to screen package */ #include "top.h" -#include "boolean.h" #include "machine.h" #include "utils.h" #include "username.h" @@ -52,7 +51,7 @@ static char stdoutbuf[Buffersize]; static int fmt_flags = 0; -int pcpu_stats = No; +int pcpu_stats = false; /* signal handling routines */ static sigret_t leave(int); @@ -140,7 +139,7 @@ handle_user(char *buf, size_t buflen) char *buf2 = buf; new_message(MT_standout, "Username to show (+ for all): "); - if (readline(buf, buflen, No) <= 0) + if (readline(buf, buflen, false) <= 0) { clear_message(); return rc; @@ -215,11 +214,11 @@ main(int argc, char *argv[]) int preset_argc = 0; char **av; int ac; - char dostates = No; - char do_unames = Yes; - char interactive = Maybe; + bool dostates = false; + bool do_unames = true; + char interactive = 2; char warnings = 0; - char topn_specified = No; + char topn_specified = false; char ch; char *iptr; char no_command = 1; @@ -282,16 +281,16 @@ main(int argc, char *argv[]) } /* initialize some selection options */ - ps.idle = Yes; + ps.idle = true; ps.self = -1; - ps.system = No; + ps.system = false; reset_uids(); - ps.thread = No; + ps.thread = false; ps.wcpu = 1; ps.jid = -1; - ps.jail = No; - ps.swap = No; - ps.kidle = Yes; + ps.jail = false; + ps.swap = false; + ps.kidle = true; ps.command = NULL; /* get preset options from the environment */ @@ -347,12 +346,12 @@ main(int argc, char *argv[]) break; case 'i': /* go interactive regardless */ - interactive = Yes; + interactive = 1; break; case 'n': /* batch, or non-interactive */ case 'b': - interactive = No; + interactive = 0; break; case 'a': @@ -476,7 +475,7 @@ main(int argc, char *argv[]) } else { - topn_specified = Yes; + topn_specified = true; } } @@ -563,7 +562,7 @@ main(int argc, char *argv[]) display_header(topn > 0); /* determine interactive state */ - if (interactive == Maybe) + if (interactive == 2) { interactive = smart_terminal; } @@ -641,7 +640,7 @@ restart: { putchar('\n'); } - dostates = Yes; + dostates = true; } /* display memory stats */ @@ -722,7 +721,7 @@ restart: } } - no_command = Yes; + no_command = true; if (!interactive) { sleep(delay); @@ -734,7 +733,7 @@ restart: else while (no_command) { /* assume valid command unless told otherwise */ - no_command = No; + no_command = false; /* set up arguments for select with timeout */ FD_ZERO(&readfds); @@ -814,7 +813,7 @@ restart: new_message(MT_standout, " Command not understood"); } putchar('\r'); - no_command = Yes; + no_command = true; } else { @@ -825,7 +824,7 @@ restart: new_message(MT_standout, " Command cannot be handled by this terminal"); putchar('\r'); - no_command = Yes; + no_command = true; } else switch(change) { @@ -864,7 +863,7 @@ restart: new_message(MT_standout, " Currently no errors to report."); putchar('\r'); - no_command = Yes; + no_command = true; } else { @@ -881,7 +880,7 @@ restart: case CMD_number2: new_message(MT_standout, "Number of processes to show: "); - newval = readline(tempbuf1, 8, Yes); + newval = readline(tempbuf1, 8, true); if (newval > -1) { if (newval > max_topn) @@ -895,12 +894,12 @@ restart: if (newval == 0) { /* inhibit the header */ - display_header(No); + display_header(false); } else if (newval > topn && topn == 0) { /* redraw the header */ - display_header(Yes); + display_header(true); d_header = i_header; } topn = newval; @@ -909,7 +908,7 @@ restart: case CMD_delay: /* new seconds delay */ new_message(MT_standout, "Seconds to delay: "); - if ((i = readline(tempbuf1, 8, Yes)) > -1) + if ((i = readline(tempbuf1, 8, true)) > -1) { if ((delay = i) == 0 && getuid() != 0) { @@ -924,7 +923,7 @@ restart: "Displays to show (currently %s): ", displays == -1 ? "infinite" : itoa(displays)); - if ((i = readline(tempbuf1, 10, Yes)) > 0) + if ((i = readline(tempbuf1, 10, true)) > 0) { displays = i; } @@ -937,13 +936,13 @@ restart: case CMD_kill: /* kill program */ new_message(0, "kill "); - if (readline(tempbuf2, sizeof(tempbuf2), No) > 0) + if (readline(tempbuf2, sizeof(tempbuf2), false) > 0) { if ((errmsg = kill_procs(tempbuf2)) != NULL) { new_message(MT_standout, "%s", errmsg); putchar('\r'); - no_command = Yes; + no_command = true; } } else @@ -954,13 +953,13 @@ restart: case CMD_renice: /* renice program */ new_message(0, "renice "); - if (readline(tempbuf2, sizeof(tempbuf2), No) > 0) + if (readline(tempbuf2, sizeof(tempbuf2), false) > 0) { if ((errmsg = renice_procs(tempbuf2)) != NULL) { new_message(MT_standout, "%s", errmsg); putchar('\r'); - no_command = Yes; + no_command = true; } } else @@ -988,7 +987,7 @@ restart: case CMD_user: if (handle_user(tempbuf2, sizeof(tempbuf2))) - no_command = Yes; + no_command = true; break; case CMD_thrtog: @@ -1013,7 +1012,7 @@ restart: if (++displaymode == DISP_MAX) displaymode = 0; header_text = format_header(uname_field); - display_header(Yes); + display_header(true); d_header = i_header; reset_display(); break; @@ -1026,13 +1025,13 @@ restart: case CMD_order: new_message(MT_standout, "Order to sort: "); - if (readline(tempbuf2, sizeof(tempbuf2), No) > 0) + if (readline(tempbuf2, sizeof(tempbuf2), false) > 0) { if ((i = string_index(tempbuf2, statics.order_names)) == -1) { new_message(MT_standout, " %s: unrecognized sorting order", tempbuf2); - no_command = Yes; + no_command = true; } else { @@ -1058,7 +1057,7 @@ restart: case CMD_jail: new_message(MT_standout, "Jail to show (+ for all): "); - if (readline(tempbuf2, sizeof(tempbuf2), No) > 0) + if (readline(tempbuf2, sizeof(tempbuf2), false) > 0) { if (tempbuf2[0] == '+' && tempbuf2[1] == '\0') @@ -1069,7 +1068,7 @@ restart: { new_message(MT_standout, " %s: unknown jail", tempbuf2); - no_command = Yes; + no_command = true; } else { From owner-svn-src-head@freebsd.org Sat Jun 2 03:31:15 2018 Return-Path: Delivered-To: svn-src-head@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 28EF7FDEB9E; Sat, 2 Jun 2018 03:31:15 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CEB8B6806A; Sat, 2 Jun 2018 03:31:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B179A2025; Sat, 2 Jun 2018 03:31:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w523VEVN049096; Sat, 2 Jun 2018 03:31:14 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w523VEYs049095; Sat, 2 Jun 2018 03:31:14 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806020331.w523VEYs049095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 2 Jun 2018 03:31:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334515 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334515 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 03:31:15 -0000 Author: eadler Date: Sat Jun 2 03:31:14 2018 New Revision: 334515 URL: https://svnweb.freebsd.org/changeset/base/334515 Log: top(1): avoid casting malloc Modified: head/usr.bin/top/display.c head/usr.bin/top/machine.c Modified: head/usr.bin/top/display.c ============================================================================== --- head/usr.bin/top/display.c Sat Jun 2 03:25:15 2018 (r334514) +++ head/usr.bin/top/display.c Sat Jun 2 03:31:14 2018 (r334515) @@ -147,7 +147,7 @@ display_resize(void) } /* now, allocate space for the screen buffer */ - screenbuf = (char *)malloc(lines * display_width); + screenbuf = malloc(lines * display_width); if (screenbuf == (char *)NULL) { /* oops! */ @@ -203,20 +203,20 @@ int display_init(struct statics * statics) /* save pointers and allocate space for names */ procstate_names = statics->procstate_names; num_procstates = string_count(procstate_names); - lprocstates = (int *)malloc(num_procstates * sizeof(int)); + lprocstates = malloc(num_procstates * sizeof(int)); cpustate_names = statics->cpustate_names; swap_names = statics->swap_names; num_swap = string_count(swap_names); - lswap = (int *)malloc(num_swap * sizeof(int)); + lswap = malloc(num_swap * sizeof(int)); num_cpustates = string_count(cpustate_names); - lcpustates = (int *)malloc(num_cpustates * sizeof(int) * statics->ncpus); - cpustate_columns = (int *)malloc(num_cpustates * sizeof(int)); + lcpustates = malloc(num_cpustates * sizeof(int) * statics->ncpus); + cpustate_columns = malloc(num_cpustates * sizeof(int)); memory_names = statics->memory_names; num_memory = string_count(memory_names); - lmemory = (int *)malloc(num_memory * sizeof(int)); + lmemory = malloc(num_memory * sizeof(int)); arc_names = statics->arc_names; carc_names = statics->carc_names; Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Sat Jun 2 03:25:15 2018 (r334514) +++ head/usr.bin/top/machine.c Sat Jun 2 03:31:14 2018 (r334515) @@ -990,7 +990,7 @@ format_next_process(caddr_t xhandle, char *(*get_useri break; } - cmdbuf = (char *)malloc(cmdlen + 1); + cmdbuf = malloc(cmdlen + 1); if (cmdbuf == NULL) { warn("malloc(%d)", cmdlen + 1); return NULL; @@ -1025,7 +1025,7 @@ format_next_process(caddr_t xhandle, char *(*get_useri size_t len; argbuflen = cmdlen * 4; - argbuf = (char *)malloc(argbuflen + 1); + argbuf = malloc(argbuflen + 1); if (argbuf == NULL) { warn("malloc(%zu)", argbuflen + 1); free(cmdbuf); From owner-svn-src-head@freebsd.org Sat Jun 2 03:33:03 2018 Return-Path: Delivered-To: svn-src-head@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 2EF2BFDF078; Sat, 2 Jun 2018 03:33:03 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D6E9968491; Sat, 2 Jun 2018 03:33:02 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B811E21A2; Sat, 2 Jun 2018 03:33:02 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w523X2dr053905; Sat, 2 Jun 2018 03:33:02 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w523X2MO053904; Sat, 2 Jun 2018 03:33:02 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806020333.w523X2MO053904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 2 Jun 2018 03:33:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334516 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334516 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 03:33:03 -0000 Author: eadler Date: Sat Jun 2 03:33:02 2018 New Revision: 334516 URL: https://svnweb.freebsd.org/changeset/base/334516 Log: top(1): Remove now-invalid NOTE Modified: head/usr.bin/top/top.1 Modified: head/usr.bin/top/top.1 ============================================================================== --- head/usr.bin/top/top.1 Sat Jun 2 03:31:14 2018 (r334515) +++ head/usr.bin/top/top.1 Sat Jun 2 03:33:02 2018 (r334516) @@ -1,5 +1,3 @@ -.\" NOTE: changes to the manual page for "top" should be made in the -.\" file "top.X" and NOT in the file "top.1". .\" $FreeBSD$ .nr N -1 .nr D 2 From owner-svn-src-head@freebsd.org Sat Jun 2 03:54:52 2018 Return-Path: Delivered-To: svn-src-head@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 C1EE8EF79E9; Sat, 2 Jun 2018 03:54:52 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6944869058; Sat, 2 Jun 2018 03:54:52 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B8DA24CD; Sat, 2 Jun 2018 03:54:52 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w523sqT3063890; Sat, 2 Jun 2018 03:54:52 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w523sogU063882; Sat, 2 Jun 2018 03:54:50 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806020354.w523sogU063882@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 2 Jun 2018 03:54:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334517 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334517 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 03:54:53 -0000 Author: eadler Date: Sat Jun 2 03:54:50 2018 New Revision: 334517 URL: https://svnweb.freebsd.org/changeset/base/334517 Log: top(1): Use uid_t for uid rather than 'int' Remove unneeded define while here. Modified: head/usr.bin/top/machine.c head/usr.bin/top/machine.h head/usr.bin/top/screen.c head/usr.bin/top/top.c head/usr.bin/top/username.c head/usr.bin/top/username.h head/usr.bin/top/utils.c head/usr.bin/top/utils.h Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Sat Jun 2 03:33:02 2018 (r334516) +++ head/usr.bin/top/machine.c Sat Jun 2 03:54:50 2018 (r334517) @@ -914,7 +914,7 @@ get_process_info(struct system_info *si, struct proces static char fmt[512]; /* static area where result is built */ char * -format_next_process(caddr_t xhandle, char *(*get_userid)(int), int flags) +format_next_process(caddr_t xhandle, char *(*get_userid)(uid_t), int flags) { struct kinfo_proc *pp; const struct kinfo_proc *oldp; Modified: head/usr.bin/top/machine.h ============================================================================== --- head/usr.bin/top/machine.h Sat Jun 2 03:33:02 2018 (r334516) +++ head/usr.bin/top/machine.h Sat Jun 2 03:54:50 2018 (r334517) @@ -75,7 +75,7 @@ struct process_select /* routines defined by the machine dependent module */ char *format_header(char *uname_field); -char *format_next_process(caddr_t handle, char *(*get_userid)(int), +char *format_next_process(caddr_t handle, char *(*get_userid)(uid_t), int flags); void toggle_pcpustats(void); void get_system_info(struct system_info *si); Modified: head/usr.bin/top/screen.c ============================================================================== --- head/usr.bin/top/screen.c Sat Jun 2 03:33:02 2018 (r334516) +++ head/usr.bin/top/screen.c Sat Jun 2 03:54:50 2018 (r334517) @@ -25,7 +25,6 @@ #include #include #include -#define TERMIOS #include #include #include Modified: head/usr.bin/top/top.c ============================================================================== --- head/usr.bin/top/top.c Sat Jun 2 03:33:02 2018 (r334516) +++ head/usr.bin/top/top.c Sat Jun 2 03:54:50 2018 (r334517) @@ -206,7 +206,7 @@ main(int argc, char *argv[]) int displays = 0; /* indicates unspecified */ int sel_ret = 0; time_t curr_time; - char *(*get_userid)(int) = username; + char *(*get_userid)(uid_t) = username; char *uname_field = "USERNAME"; char *header_text; char *env_top; Modified: head/usr.bin/top/username.c ============================================================================== --- head/usr.bin/top/username.c Sat Jun 2 03:33:02 2018 (r334516) +++ head/usr.bin/top/username.c Sat Jun 2 03:54:50 2018 (r334517) @@ -37,29 +37,27 @@ #include #include #include +#include #include "utils.h" #include "username.h" struct hash_el { - int uid; + uid_t uid; char name[MAXLOGNAME]; }; #define is_empty_hash(x) (hash_table[x].name[0] == 0) /* simple minded hashing function */ -/* Uid "nobody" is -2 results in hashit(-2) = -2 which is out of bounds for - the hash_table. Applied abs() function to fix. 2/16/96 tpugh -*/ -#define hashit(i) (abs(i) % Table_size) +#define hashit(i) (i % Table_size) /* K&R requires that statically declared tables be initialized to zero. */ /* We depend on that for hash_table and YOUR compiler had BETTER do it! */ static struct hash_el hash_table[Table_size]; -char *username(int uid) +char *username(uid_t uid) { int hashindex; @@ -72,7 +70,7 @@ char *username(int uid) return(hash_table[hashindex].name); } -int userid(char username[]) +uid_t userid(char username[]) { struct passwd *pwd; @@ -93,7 +91,7 @@ int userid(char username[]) } /* wecare 1 = enter it always, 0 = nice to have */ -int enter_user(int uid, char name[], bool wecare) +int enter_user(uid_t uid, char name[], bool wecare) { int hashindex; @@ -124,7 +122,7 @@ int enter_user(int uid, char name[], bool wecare) */ int -get_user(int uid) +get_user(uid_t uid) { struct passwd *pwd; Modified: head/usr.bin/top/username.h ============================================================================== --- head/usr.bin/top/username.h Sat Jun 2 03:33:02 2018 (r334516) +++ head/usr.bin/top/username.h Sat Jun 2 03:54:50 2018 (r334517) @@ -12,12 +12,13 @@ #define USERNAME_H #include +#include -int enter_user(int uid, char *name, bool wecare); -int get_user(int uid); +int enter_user(uid_t uid, char *name, bool wecare); +int get_user(uid_t uid); void init_hash(void); -char *username(int uid); -int userid(char *username); +char *username(uid_t uid); +uid_t userid(char *username); /* * "Table_size" defines the size of the hash tables used to map uid to Modified: head/usr.bin/top/utils.c ============================================================================== --- head/usr.bin/top/utils.c Sat Jun 2 03:33:02 2018 (r334516) +++ head/usr.bin/top/utils.c Sat Jun 2 03:54:50 2018 (r334517) @@ -59,7 +59,7 @@ atoiwi(char *str) */ _Static_assert(sizeof(int) <= 4, "buffer too small for this sized int"); -char *itoa(int val) +char *itoa(unsigned int val) { char *ptr; static char buffer[16]; /* result is built here */ @@ -87,7 +87,7 @@ char *itoa(int val) * a front end to a more general routine for efficiency. */ -char *itoa7(int val) +char *itoa7(unsigned int val) { char *ptr; static char buffer[16]; /* result is built here */ Modified: head/usr.bin/top/utils.h ============================================================================== --- head/usr.bin/top/utils.h Sat Jun 2 03:33:02 2018 (r334516) +++ head/usr.bin/top/utils.h Sat Jun 2 03:54:50 2018 (r334517) @@ -11,8 +11,8 @@ */ int atoiwi(char *); -char *itoa(int); -char *itoa7(int); +char *itoa(unsigned int); +char *itoa7(unsigned int); int digits(int); char *strecpy(char *, char *); char **argparse(char *, int *); From owner-svn-src-head@freebsd.org Sat Jun 2 04:08:53 2018 Return-Path: Delivered-To: svn-src-head@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 DBE77EF9672; Sat, 2 Jun 2018 04:08:53 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8C6046980E; Sat, 2 Jun 2018 04:08:53 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6D67E2665; Sat, 2 Jun 2018 04:08:53 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5248rL0068841; Sat, 2 Jun 2018 04:08:53 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5248r8u068839; Sat, 2 Jun 2018 04:08:53 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806020408.w5248r8u068839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 2 Jun 2018 04:08:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334518 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334518 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 04:08:54 -0000 Author: eadler Date: Sat Jun 2 04:08:52 2018 New Revision: 334518 URL: https://svnweb.freebsd.org/changeset/base/334518 Log: top(1): help scan-build along a bit Teach scan-build that some arrays are larger than zero, and thus not to warn. Modified: head/usr.bin/top/display.c head/usr.bin/top/machine.c Modified: head/usr.bin/top/display.c ============================================================================== --- head/usr.bin/top/display.c Sat Jun 2 03:54:50 2018 (r334517) +++ head/usr.bin/top/display.c Sat Jun 2 04:08:52 2018 (r334518) @@ -30,6 +30,7 @@ #include +#include #include #include #include @@ -203,19 +204,23 @@ int display_init(struct statics * statics) /* save pointers and allocate space for names */ procstate_names = statics->procstate_names; num_procstates = string_count(procstate_names); + assert(num_procstates > 0); lprocstates = malloc(num_procstates * sizeof(int)); cpustate_names = statics->cpustate_names; swap_names = statics->swap_names; num_swap = string_count(swap_names); + assert(num_swap > 0); lswap = malloc(num_swap * sizeof(int)); num_cpustates = string_count(cpustate_names); + assert(num_cpustates > 0); lcpustates = malloc(num_cpustates * sizeof(int) * statics->ncpus); cpustate_columns = malloc(num_cpustates * sizeof(int)); memory_names = statics->memory_names; num_memory = string_count(memory_names); + assert(num_memory > 0); lmemory = malloc(num_memory * sizeof(int)); arc_names = statics->arc_names; Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Sat Jun 2 03:54:50 2018 (r334517) +++ head/usr.bin/top/machine.c Sat Jun 2 04:08:52 2018 (r334518) @@ -401,6 +401,7 @@ machine_init(struct statics *statics) } } size = sizeof(long) * ncpus * CPUSTATES; + assert(size > 0); pcpu_cp_old = calloc(1, size); pcpu_cp_diff = calloc(1, size); pcpu_cpu_states = calloc(1, size); From owner-svn-src-head@freebsd.org Sat Jun 2 04:20:44 2018 Return-Path: Delivered-To: svn-src-head@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 0679FEFAF98; Sat, 2 Jun 2018 04:20:44 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ACCE36A4CC; Sat, 2 Jun 2018 04:20:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8DFD528A5; Sat, 2 Jun 2018 04:20:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w524KhWN074559; Sat, 2 Jun 2018 04:20:43 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w524KhMb074558; Sat, 2 Jun 2018 04:20:43 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806020420.w524KhMb074558@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 2 Jun 2018 04:20:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334519 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334519 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 04:20:44 -0000 Author: eadler Date: Sat Jun 2 04:20:42 2018 New Revision: 334519 URL: https://svnweb.freebsd.org/changeset/base/334519 Log: top(1): clean up a bit - remove unused defines - use standard defines for STDOUT - don't cast for memset - avoid using (void) cast Modified: head/usr.bin/top/machine.c head/usr.bin/top/screen.c Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Sat Jun 2 04:08:52 2018 (r334518) +++ head/usr.bin/top/machine.c Sat Jun 2 04:20:42 2018 (r334519) @@ -841,7 +841,7 @@ get_process_info(struct system_info *si, struct proces total_inblock = 0; total_oublock = 0; total_majflt = 0; - memset((char *)process_states, 0, sizeof(process_states)); + memset(process_states, 0, sizeof(process_states)); prefp = pref; for (pp = pbase, i = 0; i < nproc; pp++, i++) { Modified: head/usr.bin/top/screen.c ============================================================================== --- head/usr.bin/top/screen.c Sat Jun 2 04:08:52 2018 (r334518) +++ head/usr.bin/top/screen.c Sat Jun 2 04:20:42 2018 (r334519) @@ -20,15 +20,16 @@ * preprocessor variable "TOStop". --wnl */ -#include "top.h" - #include #include #include #include #include #include +#include + #include "screen.h" +#include "top.h" int overstrike; int screen_length; @@ -54,10 +55,6 @@ static struct termios old_settings; static struct termios new_settings; static char is_a_terminal = false; -#define STDIN 0 -#define STDOUT 1 -#define STDERR 2 - void init_termcap(int interactive) { @@ -164,7 +161,7 @@ init_termcap(int interactive) PC = (PCptr = tgetstr("pc", &bufptr)) ? *PCptr : 0; /* set convenience strings */ - (void) strncpy(home, tgoto(cursor_motion, 0, 0), sizeof(home) - 1); + strncpy(home, tgoto(cursor_motion, 0, 0), sizeof(home) - 1); home[sizeof(home) - 1] = '\0'; /* (lower_left is set in get_screensize) */ @@ -174,7 +171,7 @@ init_termcap(int interactive) get_screensize(); /* if stdout is not a terminal, pretend we are a dumb terminal */ - if (tcgetattr(STDOUT, &old_settings) == -1) + if (tcgetattr(STDOUT_FILENO, &old_settings) == -1) { smart_terminal = false; } @@ -184,7 +181,7 @@ void init_screen(void) { /* get the old settings for safe keeping */ - if (tcgetattr(STDOUT, &old_settings) != -1) + if (tcgetattr(STDOUT_FILENO, &old_settings) != -1) { /* copy the settings so we can modify them */ new_settings = old_settings; @@ -194,7 +191,7 @@ init_screen(void) new_settings.c_oflag &= ~(TAB3); new_settings.c_cc[VMIN] = 1; new_settings.c_cc[VTIME] = 0; - (void) tcsetattr(STDOUT, TCSADRAIN, &new_settings); + tcsetattr(STDOUT_FILENO, TCSADRAIN, &new_settings); /* remember the erase and kill characters */ ch_erase = old_settings.c_cc[VERASE]; @@ -229,7 +226,7 @@ end_screen(void) /* if we have settings to reset, then do so */ if (is_a_terminal) { - (void) tcsetattr(STDOUT, TCSADRAIN, &old_settings); + tcsetattr(STDOUT_FILENO, TCSADRAIN, &old_settings); } } @@ -239,7 +236,7 @@ reinit_screen(void) /* install our settings if it is a terminal */ if (is_a_terminal) { - (void) tcsetattr(STDOUT, TCSADRAIN, &new_settings); + tcsetattr(STDOUT_FILENO, TCSADRAIN, &new_settings); } /* send init string */ From owner-svn-src-head@freebsd.org Sat Jun 2 04:25:11 2018 Return-Path: Delivered-To: svn-src-head@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 15879EFB8F3; Sat, 2 Jun 2018 04:25:11 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BCFCF6A9BF; Sat, 2 Jun 2018 04:25:10 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9DF9B2A2E; Sat, 2 Jun 2018 04:25:10 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w524PASb079356; Sat, 2 Jun 2018 04:25:10 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w524P9gm079349; Sat, 2 Jun 2018 04:25:09 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201806020425.w524P9gm079349@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sat, 2 Jun 2018 04:25:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334520 - in head/sys: amd64/amd64 i386/i386 i386/include libkern X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: in head/sys: amd64/amd64 i386/i386 i386/include libkern X-SVN-Commit-Revision: 334520 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 04:25:11 -0000 Author: bde Date: Sat Jun 2 04:25:09 2018 New Revision: 334520 URL: https://svnweb.freebsd.org/changeset/base/334520 Log: Fix recent breakages of kernel profiling, mostly on i386 (high resolution kernel profiling remains broken). memmove() was broken using ALTENTRY(). ALTENTRY() is only different from ENTRY() in the profiling case, and its use in that case was sort of backwards. The backwardness magically turned memmove() into memcpy() instead of completely breaking it. Only the high resolution parts of profiling itself were broken. Use ordinary ENTRY() for memmove(). Turn bcopy() into a tail call to memmove() to reduce complications. This gives slightly different pessimizations and profiling lossage. The pessimizations are minimized by not using a frame pointer() for bcopy(). Calls to profiling functions from exception trampolines were not relocated. This caused crashes on the first exception. Fix this using function pointers. Addresses of exception handlers in trampolines were not relocated. This caused unknown offsets in the profiling data. Relocate by abusing setidt_disp as for pmc although this is slower than necessary and requires namespace pollution. pmc seems to be missing some relocations. Stack traces and lots of other things in debuggers need similar relocations. Most user addresses were misclassified as unknown kernel addresses and then ignored. Treat all unknown addresses as user. Now only user addresses in the kernel text range are significantly misclassified (as known kernel addresses). The ibrs functions didn't preserve enough registers. This is the only recent breakage on amd64. Although these functions are written in asm, in the profiling case they call profiling functions which are mostly for the C ABI, so they only have to save call-used registers. They also have to save arg and return registers in some cases and actually save them in all cases to reduce complications. They end up saving all registers except %ecx on i386 and %r10 and %r11 on amd64. Saving these is only needed for 1 caller on each of amd64 and i386. Save them there. This is slightly simpler. Remove saving %ecx in handle_ibrs_exit on i386. Both handle_ibrs_entry and handle_ibrs_exit use %ecx, but only the latter needed to or did save it. But saving it there doesn't work for the profiling case. amd64 has more automatic saving of the most common scratch registers %rax, %rcx and %rdx (its complications for %r10 are from unusual use of %r10 by SYSCALL). Thus profiling of handle_ibrs_exit_rs() was not broken, and I didn't simplify the saving by moving the saving of these registers from it to the caller. Modified: head/sys/amd64/amd64/exception.S head/sys/i386/i386/exception.s head/sys/i386/i386/prof_machdep.c head/sys/i386/i386/support.s head/sys/i386/include/asmacros.h head/sys/i386/include/profile.h head/sys/libkern/mcount.c Modified: head/sys/amd64/amd64/exception.S ============================================================================== --- head/sys/amd64/amd64/exception.S Sat Jun 2 04:20:42 2018 (r334519) +++ head/sys/amd64/amd64/exception.S Sat Jun 2 04:25:09 2018 (r334520) @@ -463,8 +463,16 @@ fast_syscall_common: movq PCPU(SCRATCH_RSP),%r11 /* %r11 already saved */ movq %r11,TF_RSP(%rsp) /* user stack pointer */ movq PCPU(SCRATCH_RAX),%rax + /* + * Save a few arg registers early to free them for use in + * handle_ibrs_entry(). %r10 is especially tricky. It is not an + * arg register, but it holds the arg register %rcx. Profiling + * preserves %rcx, but may clobber %r10. Profiling may also + * clobber %r11, but %r11 (original %eflags) has been saved. + */ movq %rax,TF_RAX(%rsp) /* syscall number */ movq %rdx,TF_RDX(%rsp) /* arg 3 */ + movq %r10,TF_RCX(%rsp) /* arg 4 */ SAVE_SEGS call handle_ibrs_entry movq PCPU(CURPCB),%r11 @@ -475,7 +483,6 @@ fast_syscall_common: movq $2,TF_ERR(%rsp) movq %rdi,TF_RDI(%rsp) /* arg 1 */ movq %rsi,TF_RSI(%rsp) /* arg 2 */ - movq %r10,TF_RCX(%rsp) /* arg 4 */ movq %r8,TF_R8(%rsp) /* arg 5 */ movq %r9,TF_R9(%rsp) /* arg 6 */ movq %rbx,TF_RBX(%rsp) /* C preserved */ Modified: head/sys/i386/i386/exception.s ============================================================================== --- head/sys/i386/i386/exception.s Sat Jun 2 04:20:42 2018 (r334519) +++ head/sys/i386/i386/exception.s Sat Jun 2 04:25:09 2018 (r334520) @@ -516,7 +516,9 @@ doreti_exit: 1: testl $SEL_RPL_MASK, TF_CS(%esp) jz doreti_popl_fs 2: movl $handle_ibrs_exit,%eax + pushl %ecx /* preserve enough call-used regs */ call *%eax + popl %ecx movl %esp, %esi movl PCPU(TRAMPSTK), %edx subl %ecx, %edx Modified: head/sys/i386/i386/prof_machdep.c ============================================================================== --- head/sys/i386/i386/prof_machdep.c Sat Jun 2 04:20:42 2018 (r334519) +++ head/sys/i386/i386/prof_machdep.c Sat Jun 2 04:25:09 2018 (r334520) @@ -117,6 +117,9 @@ __mcount: \n\ .mcount_exit: \n\ ret $0 \n\ "); + +void __mcount(void); +void (*__mcountp)(void) = __mcount; #else /* !__GNUCLIKE_ASM */ #error "this file needs to be ported to your compiler" #endif /* __GNUCLIKE_ASM */ @@ -162,6 +165,9 @@ GMON_PROF_HIRES = 4 \n\ ret $0 \n\ "); #endif /* __GNUCLIKE_ASM */ + +void __mexitcount(void); +void (*__mexitcountp)(void) = __mexitcount; /* * Return the time elapsed since the last call. The units are machine- Modified: head/sys/i386/i386/support.s ============================================================================== --- head/sys/i386/i386/support.s Sat Jun 2 04:20:42 2018 (r334519) +++ head/sys/i386/i386/support.s Sat Jun 2 04:25:09 2018 (r334520) @@ -151,18 +151,19 @@ END(fillw) * ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800 */ ENTRY(bcopy) + movl 4(%esp),%eax + movl 8(%esp),%edx + movl %eax,8(%esp) + movl %edx,4(%esp) + MEXITCOUNT + jmp memmove +END(bcopy) + +ENTRY(memmove) pushl %ebp movl %esp,%ebp pushl %esi pushl %edi - movl 8(%ebp),%esi - movl 12(%ebp),%edi - jmp 1f -ALTENTRY(memmove) - pushl %ebp - movl %esp,%ebp - pushl %esi - pushl %edi movl 8(%ebp),%edi movl 12(%ebp),%esi 1: @@ -208,7 +209,7 @@ ALTENTRY(memmove) movl 8(%ebp),%eax /* return dst for memmove */ popl %ebp ret -END(bcopy) +END(memmove) /* * Note: memcpy does not support overlapping copies @@ -463,13 +464,11 @@ END(handle_ibrs_entry) ENTRY(handle_ibrs_exit) cmpb $0,PCPU(IBPB_SET) je 1f - pushl %ecx movl $MSR_IA32_SPEC_CTRL,%ecx rdmsr andl $~(IA32_SPEC_CTRL_IBRS|IA32_SPEC_CTRL_STIBP),%eax andl $~((IA32_SPEC_CTRL_IBRS|IA32_SPEC_CTRL_STIBP)>>32),%edx wrmsr - popl %ecx movb $0,PCPU(IBPB_SET) 1: ret END(handle_ibrs_exit) Modified: head/sys/i386/include/asmacros.h ============================================================================== --- head/sys/i386/include/asmacros.h Sat Jun 2 04:20:42 2018 (r334519) +++ head/sys/i386/include/asmacros.h Sat Jun 2 04:25:09 2018 (r334520) @@ -108,11 +108,11 @@ #define CROSSJUMPTARGET(label) \ ALIGN_TEXT; __CONCAT(to,label): ; MCOUNT; jmp label #define ENTRY(name) GEN_ENTRY(name) ; 9: ; MCOUNT -#define FAKE_MCOUNT(caller) pushl caller ; call __mcount ; popl %ecx -#define MCOUNT call __mcount +#define FAKE_MCOUNT(caller) pushl caller ; call *__mcountp ; popl %ecx +#define MCOUNT call *__mcountp #define MCOUNT_LABEL(name) GEN_ENTRY(name) ; nop ; ALIGN_TEXT #ifdef GUPROF -#define MEXITCOUNT call .mexitcount +#define MEXITCOUNT call *__mexitcountp #define ret MEXITCOUNT ; NON_GPROF_RET #else #define MEXITCOUNT Modified: head/sys/i386/include/profile.h ============================================================================== --- head/sys/i386/include/profile.h Sat Jun 2 04:20:42 2018 (r334519) +++ head/sys/i386/include/profile.h Sat Jun 2 04:25:09 2018 (r334520) @@ -92,15 +92,28 @@ extern int mcount_lock; void bintr(void); void btrap(void); void eintr(void); +#if 0 +void end_exceptions(void); +void start_exceptions(void); +#else +#include /* XXX */ +#endif void user(void); -#define MCOUNT_FROMPC_USER(pc) \ - ((pc < (uintfptr_t)VM_MAXUSER_ADDRESS) ? (uintfptr_t)user : pc) +#include /* XXX for setidt_disp */ +#define MCOUNT_DETRAMP(pc) do { \ + if ((pc) >= (uintfptr_t)start_exceptions + setidt_disp && \ + (pc) < (uintfptr_t)end_exceptions + setidt_disp) \ + (pc) -= setidt_disp; \ +} while (0) + #define MCOUNT_FROMPC_INTR(pc) \ ((pc >= (uintfptr_t)btrap && pc < (uintfptr_t)eintr) ? \ ((pc >= (uintfptr_t)bintr) ? (uintfptr_t)bintr : \ (uintfptr_t)btrap) : ~0U) + +#define MCOUNT_USERPC ((uintfptr_t)user) #else /* !_KERNEL */ Modified: head/sys/libkern/mcount.c ============================================================================== --- head/sys/libkern/mcount.c Sat Jun 2 04:20:42 2018 (r334519) +++ head/sys/libkern/mcount.c Sat Jun 2 04:25:09 2018 (r334520) @@ -88,13 +88,28 @@ _MCOUNT_DECL(uintfptr_t frompc, uintfptr_t selfpc) /* #endif #ifdef _KERNEL + /* De-relocate any addresses in a (single) trampoline. */ +#ifdef MCOUNT_DETRAMP + MCOUNT_DETRAMP(frompc); + MCOUNT_DETRAMP(selfpc); +#endif /* * When we are called from an exception handler, frompc may be * a user address. Convert such frompc's to some representation * in kernel address space. */ +#ifdef MCOUNT_FROMPC_USER frompc = MCOUNT_FROMPC_USER(frompc); +#elif defined(MCOUNT_USERPC) + /* + * For separate address spaces, we can only guess that addresses + * in the range known to us are actually kernel addresses. Outside + * of this range, conerting to the user address is fail-safe. + */ + if (frompc < p->lowpc || frompc - p->lowpc >= p->textsize) + frompc = MCOUNT_USERPC; #endif +#endif /* _KERNEL */ frompci = frompc - p->lowpc; if (frompci >= p->textsize) @@ -252,6 +267,9 @@ mexitcount(uintfptr_t selfpc) uintfptr_t selfpcdiff; p = &_gmonparam; +#ifdef MCOUNT_DETRAMP + MCOUNT_DETRAMP(selfpc); +#endif selfpcdiff = selfpc - (uintfptr_t)p->lowpc; if (selfpcdiff < p->textsize) { int delta; From owner-svn-src-head@freebsd.org Sat Jun 2 04:32:59 2018 Return-Path: Delivered-To: svn-src-head@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 3F533EFC7C2; Sat, 2 Jun 2018 04:32:59 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.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 7CB7A6AFA7; Sat, 2 Jun 2018 04:32:58 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w524Ws6i084941; Fri, 1 Jun 2018 21:32:54 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w524WsNK084940; Fri, 1 Jun 2018 21:32:54 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201806020432.w524WsNK084940@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r334518 - head/usr.bin/top In-Reply-To: <201806020408.w5248r8u068839@repo.freebsd.org> To: Eitan Adler Date: Fri, 1 Jun 2018 21:32:54 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 04:32:59 -0000 > Author: eadler > Date: Sat Jun 2 04:08:52 2018 > New Revision: 334518 > URL: https://svnweb.freebsd.org/changeset/base/334518 > > Log: > top(1): help scan-build along a bit > > Teach scan-build that some arrays are larger than zero, and thus not to > warn. > > Modified: > head/usr.bin/top/display.c > head/usr.bin/top/machine.c > > Modified: head/usr.bin/top/display.c > ============================================================================== > --- head/usr.bin/top/display.c Sat Jun 2 03:54:50 2018 (r334517) > +++ head/usr.bin/top/display.c Sat Jun 2 04:08:52 2018 (r334518) > @@ -30,6 +30,7 @@ > > #include > > +#include > #include > #include > #include > @@ -203,19 +204,23 @@ int display_init(struct statics * statics) > /* save pointers and allocate space for names */ > procstate_names = statics->procstate_names; > num_procstates = string_count(procstate_names); > + assert(num_procstates > 0); > lprocstates = malloc(num_procstates * sizeof(int)); > > cpustate_names = statics->cpustate_names; > > swap_names = statics->swap_names; > num_swap = string_count(swap_names); > + assert(num_swap > 0); Isn't it valid to run without swap and then num_swap = 0? > lswap = malloc(num_swap * sizeof(int)); > num_cpustates = string_count(cpustate_names); > + assert(num_cpustates > 0); > lcpustates = malloc(num_cpustates * sizeof(int) * statics->ncpus); > cpustate_columns = malloc(num_cpustates * sizeof(int)); > > memory_names = statics->memory_names; > num_memory = string_count(memory_names); > + assert(num_memory > 0); > lmemory = malloc(num_memory * sizeof(int)); > > arc_names = statics->arc_names; > > Modified: head/usr.bin/top/machine.c > ============================================================================== > --- head/usr.bin/top/machine.c Sat Jun 2 03:54:50 2018 (r334517) > +++ head/usr.bin/top/machine.c Sat Jun 2 04:08:52 2018 (r334518) > @@ -401,6 +401,7 @@ machine_init(struct statics *statics) > } > } > size = sizeof(long) * ncpus * CPUSTATES; > + assert(size > 0); > pcpu_cp_old = calloc(1, size); > pcpu_cp_diff = calloc(1, size); > pcpu_cpu_states = calloc(1, size); > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sat Jun 2 04:37:38 2018 Return-Path: Delivered-To: svn-src-head@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 A8B96EFD0FC; Sat, 2 Jun 2018 04:37:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A16C6B273; Sat, 2 Jun 2018 04:37:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A20F2BC4; Sat, 2 Jun 2018 04:37:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w524bcft084459; Sat, 2 Jun 2018 04:37:38 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w524bbRG084456; Sat, 2 Jun 2018 04:37:37 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806020437.w524bbRG084456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 2 Jun 2018 04:37:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334521 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334521 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 04:37:38 -0000 Author: eadler Date: Sat Jun 2 04:37:37 2018 New Revision: 334521 URL: https://svnweb.freebsd.org/changeset/base/334521 Log: top(1): const poison top(1) has a number of issues with writing to const strings. Begin helping this along by marking easy cases as const. Modified: head/usr.bin/top/utils.c head/usr.bin/top/utils.h Modified: head/usr.bin/top/utils.c ============================================================================== --- head/usr.bin/top/utils.c Sat Jun 2 04:25:09 2018 (r334520) +++ head/usr.bin/top/utils.c Sat Jun 2 04:37:37 2018 (r334521) @@ -20,7 +20,7 @@ #include int -atoiwi(char *str) +atoiwi(const char *str) { int len; @@ -136,7 +136,7 @@ int digits(int val) */ char * -strecpy(char *to, char *from) +strecpy(char *to, const char *from) { while ((*to++ = *from++) != '\0'); return(--to); @@ -147,7 +147,7 @@ strecpy(char *to, char *from) */ int -string_index(char *string, char *array[]) +string_index(const char *string, char *array[]) { size_t i = 0; @@ -170,9 +170,10 @@ string_index(char *string, char *array[]) * squat about quotes. */ -char **argparse(char *line, int *cntp) +char ** +argparse(char *line, int *cntp) { - char *from; + const char *from; char *to; int cnt; int ch; Modified: head/usr.bin/top/utils.h ============================================================================== --- head/usr.bin/top/utils.h Sat Jun 2 04:25:09 2018 (r334520) +++ head/usr.bin/top/utils.h Sat Jun 2 04:37:37 2018 (r334521) @@ -10,15 +10,15 @@ * Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University */ -int atoiwi(char *); +int atoiwi(const char *); char *itoa(unsigned int); char *itoa7(unsigned int); int digits(int); -char *strecpy(char *, char *); +char *strecpy(char *, const char *); char **argparse(char *, int *); long percentages(int, int *, long *, long *, long *); char *format_time(long); char *format_k(int); char *format_k2(unsigned long long); -int string_index(char *string, char **array); +int string_index(const char *string, char *array[]); From owner-svn-src-head@freebsd.org Sat Jun 2 04:39:01 2018 Return-Path: Delivered-To: svn-src-head@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 38BD1EFD453 for ; Sat, 2 Jun 2018 04:39:01 +0000 (UTC) (envelope-from eadler@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DA63E6B437 for ; Sat, 2 Jun 2018 04:39:00 +0000 (UTC) (envelope-from eadler@freebsd.org) Received: from mail-yb0-f173.google.com (mail-yb0-f173.google.com [209.85.213.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) (Authenticated sender: eadler) by smtp.freebsd.org (Postfix) with ESMTPSA id A29041EC8C for ; Sat, 2 Jun 2018 04:39:00 +0000 (UTC) (envelope-from eadler@freebsd.org) Received: by mail-yb0-f173.google.com with SMTP id x36-v6so9411993ybi.0 for ; Fri, 01 Jun 2018 21:39:00 -0700 (PDT) X-Gm-Message-State: ALKqPwfAEG2OKejTyVmKKxNAtZ/HJQ42r8lERDE9BhinSAm9hcj+QWu1 76G7XK7wX45XzFTRqzHlWQiwWevlbvIDc4YIDjGKiQ== X-Google-Smtp-Source: ADUXVKKOv3JsGnhJ9QiXHG3UVwRCAgc/W2yueXEPKijznDDAJnhpSSk2URpRWNHT9UOsnqHSGA/BeBlKVbMe9l27GY0= X-Received: by 2002:a25:5c8a:: with SMTP id q132-v6mr7308106ybb.479.1527914340156; Fri, 01 Jun 2018 21:39:00 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:ef50:0:0:0:0:0 with HTTP; Fri, 1 Jun 2018 21:38:29 -0700 (PDT) In-Reply-To: <201806020432.w524WsNK084940@pdx.rh.CN85.dnsmgr.net> References: <201806020408.w5248r8u068839@repo.freebsd.org> <201806020432.w524WsNK084940@pdx.rh.CN85.dnsmgr.net> From: Eitan Adler Date: Fri, 1 Jun 2018 21:38:29 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r334518 - head/usr.bin/top To: "Rodney W. Grimes" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 04:39:01 -0000 On 1 June 2018 at 21:32, Rodney W. Grimes wrote: >> Author: eadler >> Date: Sat Jun 2 04:08:52 2018 >> New Revision: 334518 >> URL: https://svnweb.freebsd.org/changeset/base/334518 >> >> Log: >> top(1): help scan-build along a bit >> >> Teach scan-build that some arrays are larger than zero, and thus not to >> warn. >> >> Modified: >> head/usr.bin/top/display.c >> head/usr.bin/top/machine.c >> >> Modified: head/usr.bin/top/display.c >> swap_names = statics->swap_names; >> num_swap = string_count(swap_names); >> + assert(num_swap > 0); > > Isn't it valid to run without swap and then num_swap = 0? I explicitly tested this case. num_swap comes from swap_names which comes from swapnames which is defined as static char *swapnames[] = { "K Total, ", "K Used, ", "K Free, ", "% Inuse, ", "K In, ", "K Out", NULL }; In short: its poor naming :) -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams From owner-svn-src-head@freebsd.org Sat Jun 2 04:43:28 2018 Return-Path: Delivered-To: svn-src-head@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 33D92EFDDC7; Sat, 2 Jun 2018 04:43:28 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.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 826B36B923; Sat, 2 Jun 2018 04:43:27 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w524hPWh084997; Fri, 1 Jun 2018 21:43:25 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w524hPwO084996; Fri, 1 Jun 2018 21:43:25 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201806020443.w524hPwO084996@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r334518 - head/usr.bin/top In-Reply-To: To: Eitan Adler Date: Fri, 1 Jun 2018 21:43:25 -0700 (PDT) CC: "Rodney W. Grimes" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 04:43:28 -0000 [ Charset UTF-8 unsupported, converting... ] > On 1 June 2018 at 21:32, Rodney W. Grimes > wrote: > >> Author: eadler > >> Date: Sat Jun 2 04:08:52 2018 > >> New Revision: 334518 > >> URL: https://svnweb.freebsd.org/changeset/base/334518 > >> > >> Log: > >> top(1): help scan-build along a bit > >> > >> Teach scan-build that some arrays are larger than zero, and thus not to > >> warn. > >> > >> Modified: > >> head/usr.bin/top/display.c > >> head/usr.bin/top/machine.c > >> > >> Modified: head/usr.bin/top/display.c > >> swap_names = statics->swap_names; > >> num_swap = string_count(swap_names); > >> + assert(num_swap > 0); > > > > Isn't it valid to run without swap and then num_swap = 0? > > I explicitly tested this case. num_swap comes from swap_names which > comes from swapnames which is defined as > > static char *swapnames[] = { > "K Total, ", "K Used, ", "K Free, ", "% Inuse, ", "K In, ", "K Out", > NULL > }; > > > In short: its poor naming :) Yep, I went and dug down this path myself and was about to reply to ignore my assumption about what swap_names is and num_swap was counting. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sat Jun 2 05:48:46 2018 Return-Path: Delivered-To: svn-src-head@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 E1881F76C7A; Sat, 2 Jun 2018 05:48:45 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9201F6DDB8; Sat, 2 Jun 2018 05:48:45 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 563973AF6; Sat, 2 Jun 2018 05:48:45 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w525mjWo019164; Sat, 2 Jun 2018 05:48:45 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w525miR7019160; Sat, 2 Jun 2018 05:48:44 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201806020548.w525miR7019160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sat, 2 Jun 2018 05:48:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334522 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/include i386/i386 i386/include X-SVN-Commit-Revision: 334522 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 05:48:46 -0000 Author: bde Date: Sat Jun 2 05:48:44 2018 New Revision: 334522 URL: https://svnweb.freebsd.org/changeset/base/334522 Log: Fix high resolution kernel profiling just enough to not crash at boot time, especially for SMP. If configured, it turns itself on at boot time for calibration, so is fragile even if never otherwise used. Both types of kernel profiling were supposed to use a global spinlock in the SMP case. If hi-res profiling is configured (but not necessarily used), this was supposed to be optimized by only using it when necessary, and slightly more efficiently, in asm. But it was not done at all for mcount entry where it is necessary. This caused crashes in the SMP case when either type of profiling was enabled. For mcount exit, it only caused wrong times. The times were wrongest with an i8254 timer since using that requires exclusive access to the hardware. The i8254 timer was too slow to use here 20 years ago and is much less usable now, but it is the default for the SMP case since TSCs weren't invariant when SMP was new. Do the locking in all hi-res SMP cases for simplicity. Calibration uses special asms, and the clobber lists in these were sort of inverted. They contained the arg and return registers which are not clobbered, but on amd64 they didn't contain the residue of the call-used registers which may be clobbered (%r10 and %r11). This usually caused hangs at boot time. This usually affected even the UP case. Modified: head/sys/amd64/amd64/prof_machdep.c head/sys/amd64/include/profile.h head/sys/i386/i386/prof_machdep.c head/sys/i386/include/profile.h Modified: head/sys/amd64/amd64/prof_machdep.c ============================================================================== --- head/sys/amd64/amd64/prof_machdep.c Sat Jun 2 04:37:37 2018 (r334521) +++ head/sys/amd64/amd64/prof_machdep.c Sat Jun 2 05:48:44 2018 (r334522) @@ -56,6 +56,20 @@ static int cputime_prof_active; #endif /* GUPROF */ #ifdef __GNUCLIKE_ASM +#if defined(SMP) && defined(GUPROF) +#define MPLOCK " \n\ + movl $1,%edx \n\ +9: \n\ + xorl %eax,%eax \n\ + lock \n\ + cmpxchgl %edx,mcount_lock \n\ + jne 9b \n" +#define MPUNLOCK "movl $0,mcount_lock \n" +#else /* !(SMP && GUPROF) */ +#define MPLOCK +#define MPUNLOCK +#endif /* SMP && GUPROF */ + __asm(" \n\ GM_STATE = 0 \n\ GMON_PROF_OFF = 3 \n\ @@ -111,8 +125,10 @@ __mcount: \n\ movq 7*8(%rsp),%rsi \n\ \n\ pushfq \n\ - cli \n\ - call mcount \n\ + cli \n" + MPLOCK " \n\ + call mcount \n" + MPUNLOCK " \n\ popfq \n\ popq %r9 \n\ popq %r8 \n\ @@ -163,8 +179,10 @@ GMON_PROF_HIRES = 4 \n\ pushq %r9 \n\ movq 7*8(%rsp),%rdi \n\ pushfq \n\ - cli \n\ - call mexitcount \n\ + cli \n" + MPLOCK " \n\ + call mexitcount \n" + MPUNLOCK " \n\ popfq \n\ popq %r9 \n\ popq %r8 \n\ Modified: head/sys/amd64/include/profile.h ============================================================================== --- head/sys/amd64/include/profile.h Sat Jun 2 04:37:37 2018 (r334521) +++ head/sys/amd64/include/profile.h Sat Jun 2 05:48:44 2018 (r334522) @@ -64,11 +64,11 @@ __asm __volatile("pushq %0; call __mcount; popq %%rcx" \ : \ : "i" (label) \ - : "ax", "dx", "cx", "di", "si", "r8", "r9", "memory") + : "cx", "r10", "r11", "memory") #define MEXITCOUNT_OVERHEAD() \ __asm __volatile("call .mexitcount; 1:" \ : : \ - : "ax", "dx", "cx", "di", "si", "r8", "r9", "memory") + : "r10", "r11", "memory") #define MEXITCOUNT_OVERHEAD_GETLABEL(labelp) \ __asm __volatile("movq $1b,%0" : "=rm" (labelp)) #else Modified: head/sys/i386/i386/prof_machdep.c ============================================================================== --- head/sys/i386/i386/prof_machdep.c Sat Jun 2 04:37:37 2018 (r334521) +++ head/sys/i386/i386/prof_machdep.c Sat Jun 2 05:48:44 2018 (r334522) @@ -67,6 +67,20 @@ static int cputime_prof_active; #endif /* GUPROF */ #ifdef __GNUCLIKE_ASM +#if defined(SMP) && defined(GUPROF) +#define MPLOCK " \n\ + movl $1,%edx \n\ +9: \n\ + xorl %eax,%eax \n\ + lock \n\ + cmpxchgl %edx,mcount_lock \n\ + jne 9b \n" +#define MPUNLOCK "movl $0,mcount_lock \n" +#else /* !(SMP && GUPROF) */ +#define MPLOCK +#define MPUNLOCK +#endif /* SMP && GUPROF */ + __asm(" \n\ GM_STATE = 0 \n\ GMON_PROF_OFF = 3 \n\ @@ -110,8 +124,10 @@ __mcount: \n\ pushfl \n\ pushl %eax \n\ pushl %edx \n\ - cli \n\ - call mcount \n\ + cli \n" + MPLOCK " \n\ + call mcount \n" + MPUNLOCK " \n\ addl $8,%esp \n\ popfl \n\ .mcount_exit: \n\ @@ -155,8 +171,10 @@ GMON_PROF_HIRES = 4 \n\ movl 8(%esp),%eax \n\ pushfl \n\ pushl %eax \n\ - cli \n\ - call mexitcount \n\ + cli \n" + MPLOCK " \n\ + call mexitcount \n" + MPUNLOCK " \n\ addl $4,%esp \n\ popfl \n\ popl %eax \n\ Modified: head/sys/i386/include/profile.h ============================================================================== --- head/sys/i386/include/profile.h Sat Jun 2 04:37:37 2018 (r334521) +++ head/sys/i386/include/profile.h Sat Jun 2 05:48:44 2018 (r334522) @@ -64,11 +64,11 @@ __asm __volatile("pushl %0; call __mcount; popl %%ecx" \ : \ : "i" (label) \ - : "ax", "dx", "cx", "memory") + : "cx", "memory") #define MEXITCOUNT_OVERHEAD() \ __asm __volatile("call .mexitcount; 1:" \ : : \ - : "ax", "dx", "cx", "memory") + : "cx", "memory") #define MEXITCOUNT_OVERHEAD_GETLABEL(labelp) \ __asm __volatile("movl $1b,%0" : "=rm" (labelp)) #else From owner-svn-src-head@freebsd.org Sat Jun 2 06:40:17 2018 Return-Path: Delivered-To: svn-src-head@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 2A76EF7D8D0; Sat, 2 Jun 2018 06:40:17 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D3AF16FC97; Sat, 2 Jun 2018 06:40:16 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B0AD4435D; Sat, 2 Jun 2018 06:40:16 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w526eG9K044686; Sat, 2 Jun 2018 06:40:16 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w526eFOd044682; Sat, 2 Jun 2018 06:40:15 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201806020640.w526eFOd044682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sat, 2 Jun 2018 06:40:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334523 - in head/sys: amd64/conf conf i386/conf X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: in head/sys: amd64/conf conf i386/conf X-SVN-Commit-Revision: 334523 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 06:40:17 -0000 Author: bde Date: Sat Jun 2 06:40:15 2018 New Revision: 334523 URL: https://svnweb.freebsd.org/changeset/base/334523 Log: Finish COMPAT_AOUT support for amd64. It wasn't in any amd64 or MI file in /sys/conf, so was unavailable in configurations that don't use modules, and was not testable or notable in NOTES. Its normal configuration (not using a module) is still silently deprecated in aout(4) by not mentioning it there. Update i386 NOTES for COMPAT_AOUT. It is not i386-only, or even very MD. Sort its entry better. Finish gzip configuration (but not support) for amd64. gzip is really gzipped aout. It is currently broken even for i386 (a call to vm fails). amd64 has always attempted to configure and test it, but it depends on COMPAT_AOUT (as noted). The bug that it depends on unconfigured files was not detected since it is configured as a device. All other optional image activators are configured properly using an option. Modified: head/sys/amd64/conf/NOTES head/sys/conf/files.amd64 head/sys/conf/options.amd64 head/sys/i386/conf/NOTES Modified: head/sys/amd64/conf/NOTES ============================================================================== --- head/sys/amd64/conf/NOTES Sat Jun 2 05:48:44 2018 (r334522) +++ head/sys/amd64/conf/NOTES Sat Jun 2 06:40:15 2018 (r334523) @@ -632,6 +632,9 @@ options COMPAT_FREEBSD32 # Emulate spx device for client side of SVR3 local X interface #XXX#options SPX_HACK +# Enable (32-bit) a.out binary support +options COMPAT_AOUT + # Enable 32-bit runtime support for CloudABI binaries. options COMPAT_CLOUDABI32 Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Sat Jun 2 05:48:44 2018 (r334522) +++ head/sys/conf/files.amd64 Sat Jun 2 06:40:15 2018 (r334523) @@ -617,6 +617,8 @@ dev/isci/scil/scif_sas_timer.c optional isci isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/kern_clocksource.c standard +kern/imgact_aout.c optional compat_aout +kern/imgact_gzip.c optional gzip kern/link_elf_obj.c standard libkern/x86/crc32_sse42.c standard # Modified: head/sys/conf/options.amd64 ============================================================================== --- head/sys/conf/options.amd64 Sat Jun 2 05:48:44 2018 (r334522) +++ head/sys/conf/options.amd64 Sat Jun 2 06:40:15 2018 (r334523) @@ -14,6 +14,7 @@ PV_STATS opt_pmap.h # Options for emulators. These should only be used at config time, so # they are handled like options for static filesystems # (see src/sys/conf/options), except for broken debugging options. +COMPAT_AOUT opt_dontuse.h COMPAT_FREEBSD32 opt_global.h #IBCS2 opt_dontuse.h #COMPAT_LINUX opt_dontuse.h Modified: head/sys/i386/conf/NOTES ============================================================================== --- head/sys/i386/conf/NOTES Sat Jun 2 05:48:44 2018 (r334522) +++ head/sys/i386/conf/NOTES Sat Jun 2 06:40:15 2018 (r334523) @@ -913,14 +913,14 @@ options NKPT=31 # Emulate spx device for client side of SVR3 local X interface options SPX_HACK +# Enable (32-bit) a.out binary support +options COMPAT_AOUT + # Enable 32-bit runtime support for CloudABI binaries. options COMPAT_CLOUDABI32 # Enable Linux ABI emulation options COMPAT_LINUX - -# Enable i386 a.out binary support -options COMPAT_AOUT # Enable the linux-like proc filesystem support (requires COMPAT_LINUX # and PSEUDOFS) From owner-svn-src-head@freebsd.org Sat Jun 2 07:44:52 2018 Return-Path: Delivered-To: svn-src-head@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 332DFFD32A4; Sat, 2 Jun 2018 07:44:52 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CDB4D72AD1; Sat, 2 Jun 2018 07:44:51 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB5854EBF; Sat, 2 Jun 2018 07:44:51 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w527ipFs079749; Sat, 2 Jun 2018 07:44:51 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w527ipN4079746; Sat, 2 Jun 2018 07:44:51 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806020744.w527ipN4079746@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 2 Jun 2018 07:44:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334524 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334524 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 07:44:52 -0000 Author: eadler Date: Sat Jun 2 07:44:50 2018 New Revision: 334524 URL: https://svnweb.freebsd.org/changeset/base/334524 Log: top(1): const poison part 2 Further reduce the number of warnings emitted by gcc. Modified: head/usr.bin/top/display.c head/usr.bin/top/display.h head/usr.bin/top/machine.c Modified: head/usr.bin/top/display.c ============================================================================== --- head/usr.bin/top/display.c Sat Jun 2 06:40:15 2018 (r334523) +++ head/usr.bin/top/display.c Sat Jun 2 07:44:50 2018 (r334524) @@ -945,7 +945,7 @@ display_header(int t) } void -new_message(int type, char *msgfmt, ...) +new_message(int type, const char *msgfmt, ...) { va_list args; size_t i; Modified: head/usr.bin/top/display.h ============================================================================== --- head/usr.bin/top/display.h Sat Jun 2 06:40:15 2018 (r334523) +++ head/usr.bin/top/display.h Sat Jun 2 07:44:50 2018 (r334524) @@ -1,8 +1,6 @@ /* $FreeBSD$ */ /* constants needed for display.c */ -/* "type" argument for new_message function */ - #define MT_standout 1 #define MT_delayed 2 @@ -26,7 +24,7 @@ void i_procstates(int total, int *brkdn); void i_swap(int *stats); void i_timeofday(time_t *tod); void i_uptime(struct timeval *bt, time_t *tod); -void new_message(int type, char *msgfmt, ...); +void new_message(int type, const char *msgfmt, ...); int readline(char *buffer, int size, int numeric); char *trim_header(char *text); void u_arc(int *stats); Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Sat Jun 2 06:40:15 2018 (r334523) +++ head/usr.bin/top/machine.c Sat Jun 2 07:44:50 2018 (r334524) @@ -119,7 +119,7 @@ static char up_header_tid_only[] = /* the extra nulls in the string "run" are for adding a slash and the processor number when needed */ -static char *state_abbrev[] = { +static const char *state_abbrev[] = { "", "START", "RUN\0\0\0", "SLEEP", "STOP", "ZOMB", "WAIT", "LOCK" }; @@ -1354,8 +1354,8 @@ static int sorted_state[] = { static int compare_cpu(const void *arg1, const void *arg2) { - struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1; - struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2; + const struct kinfo_proc *p1 = *(const struct kinfo_proc * const *)arg1; + const struct kinfo_proc *p2 = *(const struct kinfo_proc * const *)arg2; ORDERKEY_PCTCPU(p1, p2); ORDERKEY_CPTICKS(p1, p2); @@ -1408,8 +1408,8 @@ int (*compares[])(const void *arg1, const void *arg2) int compare_size(const void *arg1, const void *arg2) { - struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1; - struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2; + const struct kinfo_proc *p1 = *(const struct kinfo_proc * const *)arg1; + const struct kinfo_proc *p2 = *(const struct kinfo_proc * const *)arg2; ORDERKEY_MEM(p1, p2); ORDERKEY_RSSIZE(p1, p2); @@ -1426,8 +1426,8 @@ compare_size(const void *arg1, const void *arg2) int compare_res(const void *arg1, const void *arg2) { - struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1; - struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2; + const struct kinfo_proc *p1 = *(const struct kinfo_proc * const *)arg1; + const struct kinfo_proc *p2 = *(const struct kinfo_proc * const *)arg2; ORDERKEY_RSSIZE(p1, p2); ORDERKEY_MEM(p1, p2); @@ -1444,8 +1444,8 @@ compare_res(const void *arg1, const void *arg2) int compare_time(const void *arg1, const void *arg2) { - struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1; - struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2; + const struct kinfo_proc *p1 = *(const struct kinfo_proc * const *)arg1; + const struct kinfo_proc *p2 = *(const struct kinfo_proc * const *) arg2; ORDERKEY_CPTICKS(p1, p2); ORDERKEY_PCTCPU(p1, p2); @@ -1462,8 +1462,8 @@ compare_time(const void *arg1, const void *arg2) int compare_prio(const void *arg1, const void *arg2) { - struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1; - struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2; + const struct kinfo_proc *p1 = *(const struct kinfo_proc * const *)arg1; + const struct kinfo_proc *p2 = *(const struct kinfo_proc * const *)arg2; ORDERKEY_PRIO(p1, p2); ORDERKEY_CPTICKS(p1, p2); @@ -1479,8 +1479,8 @@ compare_prio(const void *arg1, const void *arg2) static int compare_threads(const void *arg1, const void *arg2) { - struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1; - struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2; + const struct kinfo_proc *p1 = *(const struct kinfo_proc * const *)arg1; + const struct kinfo_proc *p2 = *(const struct kinfo_proc * const *)arg2; ORDERKEY_THREADS(p1, p2); ORDERKEY_PCTCPU(p1, p2); @@ -1497,8 +1497,8 @@ compare_threads(const void *arg1, const void *arg2) static int compare_jid(const void *arg1, const void *arg2) { - struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1; - struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2; + const struct kinfo_proc *p1 = *(const struct kinfo_proc * const *)arg1; + const struct kinfo_proc *p2 = *(const struct kinfo_proc * const *)arg2; ORDERKEY_JID(p1, p2); ORDERKEY_PCTCPU(p1, p2); @@ -1515,8 +1515,8 @@ compare_jid(const void *arg1, const void *arg2) static int compare_swap(const void *arg1, const void *arg2) { - struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1; - struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2; + const struct kinfo_proc *p1 = *(const struct kinfo_proc **)arg1; + const struct kinfo_proc *p2 = *(const struct kinfo_proc **)arg2; ORDERKEY_SWAP(p1, p2); ORDERKEY_PCTCPU(p1, p2); @@ -1534,8 +1534,8 @@ compare_swap(const void *arg1, const void *arg2) int compare_iototal(const void *arg1, const void *arg2) { - struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1; - struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2; + struct kinfo_proc * const p1 = *(struct kinfo_proc **)arg1; + struct kinfo_proc * const p2 = *(struct kinfo_proc **)arg2; return (get_io_total(p2) - get_io_total(p1)); } From owner-svn-src-head@freebsd.org Sat Jun 2 07:44:55 2018 Return-Path: Delivered-To: svn-src-head@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 E8E65FD32CD; Sat, 2 Jun 2018 07:44:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8BB7372AD3; Sat, 2 Jun 2018 07:44:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 68BE44EC0; Sat, 2 Jun 2018 07:44:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w527isxT079795; Sat, 2 Jun 2018 07:44:54 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w527isLN079793; Sat, 2 Jun 2018 07:44:54 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806020744.w527isLN079793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 2 Jun 2018 07:44:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334525 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334525 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 07:44:55 -0000 Author: eadler Date: Sat Jun 2 07:44:53 2018 New Revision: 334525 URL: https://svnweb.freebsd.org/changeset/base/334525 Log: top(1): remove wrapper around putchar This appears to have been written for portability which we no longer need. Modified: head/usr.bin/top/screen.c head/usr.bin/top/screen.h Modified: head/usr.bin/top/screen.c ============================================================================== --- head/usr.bin/top/screen.c Sat Jun 2 07:44:50 2018 (r334524) +++ head/usr.bin/top/screen.c Sat Jun 2 07:44:53 2018 (r334525) @@ -323,11 +323,3 @@ go_home(void) putcap(home); } } - -/* This has to be defined as a subroutine for tputs (instead of a macro) */ - -int -putstdout(int ch) -{ - return putchar(ch); -} Modified: head/usr.bin/top/screen.h ============================================================================== --- head/usr.bin/top/screen.h Sat Jun 2 07:44:50 2018 (r334524) +++ head/usr.bin/top/screen.h Sat Jun 2 07:44:53 2018 (r334525) @@ -7,7 +7,7 @@ * $FreeBSD$ */ -#define TCputs(str) tputs(str, 1, putstdout) +#define TCputs(str) tputs(str, 1, putchar) #define putcap(str) (void)((str) != NULL ? TCputs(str) : 0) #define Move_to(x, y) TCputs(tgoto(cursor_motion, x, y)) @@ -26,7 +26,6 @@ extern int screen_length; extern int screen_width; /* a function that puts a single character on stdout */ -int putstdout(int ch); int clear_eol(int len); void top_standout(char *msg); void top_clear(void); From owner-svn-src-head@freebsd.org Sat Jun 2 08:39:00 2018 Return-Path: Delivered-To: svn-src-head@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 84830FDF1C8; Sat, 2 Jun 2018 08:39:00 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 32DE3751D6; Sat, 2 Jun 2018 08:39:00 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1405F56EA; Sat, 2 Jun 2018 08:39:00 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w528cxnV005332; Sat, 2 Jun 2018 08:38:59 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w528cxgm005331; Sat, 2 Jun 2018 08:38:59 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201806020838.w528cxgm005331@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sat, 2 Jun 2018 08:38:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334526 - head/sys/dev/syscons X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: head/sys/dev/syscons X-SVN-Commit-Revision: 334526 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 08:39:00 -0000 Author: bde Date: Sat Jun 2 08:38:59 2018 New Revision: 334526 URL: https://svnweb.freebsd.org/changeset/base/334526 Log: Fix low-level locking during panics. The SCHEDULER_STOPPED() hack breaks locking generally, and mtx_trylock_*() especially. When mtx_trylock_*() returns nonzero, naive code version here trusts it to have worked. But when SCHEDULER_STOPPED() is true, mtx_trylock_*() returns 1 without doing anything. Then mtx_unlock_*() crashes especially badly attempting to unlock iff the error is detected, since mutex unlocking functions don't check SCHEDULER_STOPPED(). syscons already didn't trust mtx_trylock_spin(), but it was missing the logic to turn on sp->kdb_locked when turning off sp->mtx_locked during panics. It also used panicstr instead of SCHEDULER_LOCKED because I thought that panicstr was more fragile. They only differ for a window of lines in panic(), and in broken cases where stop_cpus_hard() in panic() didn't work. Modified: head/sys/dev/syscons/syscons.c Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Sat Jun 2 07:44:53 2018 (r334525) +++ head/sys/dev/syscons/syscons.c Sat Jun 2 08:38:59 2018 (r334526) @@ -1807,13 +1807,19 @@ sccnscrlock(sc_softc_t *sc, struct sc_cnstate *sp) * enough to ignore the protection even in the kdb_active case. */ if (kdb_active) { - sp->kdb_locked = sc->video_mtx.mtx_lock == MTX_UNOWNED || panicstr; + sp->kdb_locked = sc->video_mtx.mtx_lock == MTX_UNOWNED || + SCHEDULER_STOPPED(); sp->mtx_locked = FALSE; } else { sp->kdb_locked = FALSE; for (retries = 0; retries < 1000; retries++) { sp->mtx_locked = mtx_trylock_spin_flags(&sc->video_mtx, - MTX_QUIET) != 0 || panicstr; + MTX_QUIET) != 0; + if (SCHEDULER_STOPPED()) { + sp->kdb_locked = TRUE; + sp->mtx_locked = FALSE; + break; + } if (sp->mtx_locked) break; DELAY(1); From owner-svn-src-head@freebsd.org Sat Jun 2 08:46:10 2018 Return-Path: Delivered-To: svn-src-head@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 679E5FDFFDE; Sat, 2 Jun 2018 08:46:10 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 19A7C75806; Sat, 2 Jun 2018 08:46:10 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0094587C; Sat, 2 Jun 2018 08:46:09 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w528k9D2010238; Sat, 2 Jun 2018 08:46:09 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w528k9bm010235; Sat, 2 Jun 2018 08:46:09 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806020846.w528k9bm010235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 2 Jun 2018 08:46:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334527 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334527 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 08:46:10 -0000 Author: eadler Date: Sat Jun 2 08:46:09 2018 New Revision: 334527 URL: https://svnweb.freebsd.org/changeset/base/334527 Log: Use stpcpy instead of home grown solution Modified: head/usr.bin/top/display.c head/usr.bin/top/utils.c head/usr.bin/top/utils.h Modified: head/usr.bin/top/display.c ============================================================================== --- head/usr.bin/top/display.c Sat Jun 2 08:38:59 2018 (r334526) +++ head/usr.bin/top/display.c Sat Jun 2 08:46:09 2018 (r334527) @@ -822,7 +822,7 @@ i_process(int line, char *thisline) /* copy it in to our buffer */ base = smart_terminal ? screenbuf + lineindex(line) : screenbuf; - p = strecpy(base, thisline); + p = stpcpy(base, thisline); /* zero fill the rest of it */ bzero(p, display_width - (p - base)); @@ -861,7 +861,7 @@ u_process(int line, char *newline) fputs(newline, stdout); /* copy it in to the buffer */ - optr = strecpy(bufferline, newline); + optr = stpcpy(bufferline, newline); /* zero fill the rest of it */ bzero(optr, display_width - (optr - bufferline)); @@ -1110,30 +1110,30 @@ static void summary_format(char *str, int *numbers, ch if (thisname[0] == 'K') { /* yes: format it as a memory value */ - p = strecpy(p, format_k(num)); + p = stpcpy(p, format_k(num)); /* skip over the K, since it was included by format_k */ - p = strecpy(p, thisname+1); + p = stpcpy(p, thisname+1); } /* is this number a ratio? */ else if (thisname[0] == ':') { (void) snprintf(rbuf, sizeof(rbuf), "%.2f", (float)*(numbers - 2) / (float)num); - p = strecpy(p, rbuf); - p = strecpy(p, thisname); + p = stpcpy(p, rbuf); + p = stpcpy(p, thisname); } else { - p = strecpy(p, itoa(num)); - p = strecpy(p, thisname); + p = stpcpy(p, itoa(num)); + p = stpcpy(p, thisname); } } /* ignore negative numbers, but display corresponding string */ else if (num < 0) { - p = strecpy(p, thisname); + p = stpcpy(p, thisname); } } Modified: head/usr.bin/top/utils.c ============================================================================== --- head/usr.bin/top/utils.c Sat Jun 2 08:38:59 2018 (r334526) +++ head/usr.bin/top/utils.c Sat Jun 2 08:46:09 2018 (r334527) @@ -131,18 +131,6 @@ int digits(int val) } /* - * strecpy(to, from) - copy string "from" into "to" and return a pointer - * to the END of the string "to". - */ - -char * -strecpy(char *to, const char *from) -{ - while ((*to++ = *from++) != '\0'); - return(--to); -} - -/* * string_index(string, array) - find string in array and return index */ @@ -393,7 +381,7 @@ char *format_k(int amt) } } - p = strecpy(p, itoa(amt)); + p = stpcpy(p, itoa(amt)); *p++ = tag; *p = '\0'; @@ -423,7 +411,7 @@ format_k2(unsigned long long amt) } } - p = strecpy(p, itoa((int)amt)); + p = stpcpy(p, itoa((int)amt)); *p++ = tag; *p = '\0'; Modified: head/usr.bin/top/utils.h ============================================================================== --- head/usr.bin/top/utils.h Sat Jun 2 08:38:59 2018 (r334526) +++ head/usr.bin/top/utils.h Sat Jun 2 08:46:09 2018 (r334527) @@ -14,7 +14,6 @@ int atoiwi(const char *); char *itoa(unsigned int); char *itoa7(unsigned int); int digits(int); -char *strecpy(char *, const char *); char **argparse(char *, int *); long percentages(int, int *, long *, long *, long *); char *format_time(long); From owner-svn-src-head@freebsd.org Sat Jun 2 09:59:28 2018 Return-Path: Delivered-To: svn-src-head@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 EF97BEFF551; Sat, 2 Jun 2018 09:59:27 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A470E7867B; Sat, 2 Jun 2018 09:59:27 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8592E63F9; Sat, 2 Jun 2018 09:59:27 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w529xRls045877; Sat, 2 Jun 2018 09:59:27 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w529xRCg045876; Sat, 2 Jun 2018 09:59:27 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201806020959.w529xRCg045876@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sat, 2 Jun 2018 09:59:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334528 - head/sys/i386/include X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: head/sys/i386/include X-SVN-Commit-Revision: 334528 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 09:59:28 -0000 Author: bde Date: Sat Jun 2 09:59:27 2018 New Revision: 334528 URL: https://svnweb.freebsd.org/changeset/base/334528 Log: Oops, the last minute reduction in the clobber list for i386 MCOUNT_OVERHEAD() in r334522 was too agressive. Only mcount exit preserves %eax and %edx. Modified: head/sys/i386/include/profile.h Modified: head/sys/i386/include/profile.h ============================================================================== --- head/sys/i386/include/profile.h Sat Jun 2 08:46:09 2018 (r334527) +++ head/sys/i386/include/profile.h Sat Jun 2 09:59:27 2018 (r334528) @@ -64,7 +64,7 @@ __asm __volatile("pushl %0; call __mcount; popl %%ecx" \ : \ : "i" (label) \ - : "cx", "memory") + : "ax", "dx", "cx", "memory") #define MEXITCOUNT_OVERHEAD() \ __asm __volatile("call .mexitcount; 1:" \ : : \ From owner-svn-src-head@freebsd.org Sat Jun 2 10:36:31 2018 Return-Path: Delivered-To: svn-src-head@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 DA45BF7547B; Sat, 2 Jun 2018 10:36:31 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8D6A479D6F; Sat, 2 Jun 2018 10:36:31 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6AC686A5C; Sat, 2 Jun 2018 10:36:31 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w52AaV8m065581; Sat, 2 Jun 2018 10:36:31 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w52AaVNu065580; Sat, 2 Jun 2018 10:36:31 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201806021036.w52AaVNu065580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sat, 2 Jun 2018 10:36:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334529 - head/sys/dev/syscons X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: head/sys/dev/syscons X-SVN-Commit-Revision: 334529 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 10:36:32 -0000 Author: bde Date: Sat Jun 2 10:36:30 2018 New Revision: 334529 URL: https://svnweb.freebsd.org/changeset/base/334529 Log: Use per-CPU attributes earlier. The per-CPU ts is not initialized early, so the global kernel ts is used early, but it ony has 1 (normal) attribute. Switch this to the per-CPU attribute. The difference is most visible with EARLY_AP_STARTUP. Change to using the curcpu macro instead of PCPU_GET(cpuid) in 2 places for the above and in 1 other place in my old code in syscons. The function-like spelling is perhaps better for indicating that curcpu is volatile (unlike curthread), but for CPU attributes volatility is a feature. Modified: head/sys/dev/syscons/syscons.c Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Sat Jun 2 09:59:27 2018 (r334528) +++ head/sys/dev/syscons/syscons.c Sat Jun 2 10:36:30 2018 (r334529) @@ -2023,18 +2023,27 @@ sc_cnputc(struct consdev *cd, int c) sizeof(sc_cnputc_log)) continue; /* Console output has a per-CPU "input" state. Switch for it. */ - oldtsw = scp->tsw; - oldts = scp->ts; - ts = sc_kts[PCPU_GET(cpuid)]; + ts = sc_kts[curcpu]; if (ts != NULL) { + oldtsw = scp->tsw; + oldts = scp->ts; scp->tsw = sc_ktsw; scp->ts = ts; (*scp->tsw->te_sync)(scp); + } else { + /* Only 1 tsw early. Switch only its attr. */ + (*scp->tsw->te_default_attr)(scp, sc_kattrtab[curcpu], + SC_KERNEL_CONS_REV_ATTR); } sc_puts(scp, buf, 1); - scp->tsw = oldtsw; - scp->ts = oldts; - (*scp->tsw->te_sync)(scp); + if (ts != NULL) { + scp->tsw = oldtsw; + scp->ts = oldts; + (*scp->tsw->te_sync)(scp); + } else { + (*scp->tsw->te_default_attr)(scp, SC_KERNEL_CONS_ATTR, + SC_KERNEL_CONS_REV_ATTR); + } } s = spltty(); /* block sckbdevent and scrn_timer */ @@ -4177,7 +4186,7 @@ sc_kattr(void) { if (sc_console == NULL) return (SC_KERNEL_CONS_ATTR); /* for very early, before pcpu */ - return (sc_kattrtab[PCPU_GET(cpuid) % nitems(sc_kattrtab)]); + return (sc_kattrtab[curcpu % nitems(sc_kattrtab)]); } static void From owner-svn-src-head@freebsd.org Sat Jun 2 11:14:22 2018 Return-Path: Delivered-To: svn-src-head@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 179E2F7A451; Sat, 2 Jun 2018 11:14:22 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5FA067B7E5; Sat, 2 Jun 2018 11:14:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTP id w52BE6Pu017847; Sat, 2 Jun 2018 14:14:09 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w52BE6Pu017847 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w52BE6Ko017846; Sat, 2 Jun 2018 14:14:06 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 2 Jun 2018 14:14:06 +0300 From: Konstantin Belousov To: Eitan Adler Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334515 - head/usr.bin/top Message-ID: <20180602111406.GG3789@kib.kiev.ua> References: <201806020331.w523VEYs049095@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201806020331.w523VEYs049095@repo.freebsd.org> User-Agent: Mutt/1.10.0 (2018-05-17) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 11:14:22 -0000 On Sat, Jun 02, 2018 at 03:31:14AM +0000, Eitan Adler wrote: > Author: eadler > Date: Sat Jun 2 03:31:14 2018 > New Revision: 334515 > URL: https://svnweb.freebsd.org/changeset/base/334515 > > Log: > top(1): avoid casting malloc > > Modified: > head/usr.bin/top/display.c > head/usr.bin/top/machine.c > > Modified: head/usr.bin/top/display.c > ============================================================================== > --- head/usr.bin/top/display.c Sat Jun 2 03:25:15 2018 (r334514) > +++ head/usr.bin/top/display.c Sat Jun 2 03:31:14 2018 (r334515) > @@ -147,7 +147,7 @@ display_resize(void) > } > > /* now, allocate space for the screen buffer */ > - screenbuf = (char *)malloc(lines * display_width); > + screenbuf = malloc(lines * display_width); > if (screenbuf == (char *)NULL) > { > /* oops! */ > @@ -203,20 +203,20 @@ int display_init(struct statics * statics) > /* save pointers and allocate space for names */ > procstate_names = statics->procstate_names; > num_procstates = string_count(procstate_names); > - lprocstates = (int *)malloc(num_procstates * sizeof(int)); > + lprocstates = malloc(num_procstates * sizeof(int)); It seems that this and other changed mallocs() better be spelled as calloc(3). > > cpustate_names = statics->cpustate_names; > > swap_names = statics->swap_names; > num_swap = string_count(swap_names); > - lswap = (int *)malloc(num_swap * sizeof(int)); > + lswap = malloc(num_swap * sizeof(int)); > num_cpustates = string_count(cpustate_names); > - lcpustates = (int *)malloc(num_cpustates * sizeof(int) * statics->ncpus); > - cpustate_columns = (int *)malloc(num_cpustates * sizeof(int)); > + lcpustates = malloc(num_cpustates * sizeof(int) * statics->ncpus); > + cpustate_columns = malloc(num_cpustates * sizeof(int)); > > memory_names = statics->memory_names; > num_memory = string_count(memory_names); > - lmemory = (int *)malloc(num_memory * sizeof(int)); > + lmemory = malloc(num_memory * sizeof(int)); > > arc_names = statics->arc_names; > carc_names = statics->carc_names; > > Modified: head/usr.bin/top/machine.c > ============================================================================== > --- head/usr.bin/top/machine.c Sat Jun 2 03:25:15 2018 (r334514) > +++ head/usr.bin/top/machine.c Sat Jun 2 03:31:14 2018 (r334515) > @@ -990,7 +990,7 @@ format_next_process(caddr_t xhandle, char *(*get_useri > break; > } > > - cmdbuf = (char *)malloc(cmdlen + 1); > + cmdbuf = malloc(cmdlen + 1); > if (cmdbuf == NULL) { > warn("malloc(%d)", cmdlen + 1); > return NULL; > @@ -1025,7 +1025,7 @@ format_next_process(caddr_t xhandle, char *(*get_useri > size_t len; > > argbuflen = cmdlen * 4; > - argbuf = (char *)malloc(argbuflen + 1); > + argbuf = malloc(argbuflen + 1); > if (argbuf == NULL) { > warn("malloc(%zu)", argbuflen + 1); > free(cmdbuf); From owner-svn-src-head@freebsd.org Sat Jun 2 14:07:28 2018 Return-Path: Delivered-To: svn-src-head@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 B7B54EF8F23; Sat, 2 Jun 2018 14:07:28 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 471C4830B6; Sat, 2 Jun 2018 14:07:28 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2315D10C45; Sat, 2 Jun 2018 14:07:28 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w52E7RDq075887; Sat, 2 Jun 2018 14:07:27 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w52E7RGL075883; Sat, 2 Jun 2018 14:07:27 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201806021407.w52E7RGL075883@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sat, 2 Jun 2018 14:07:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334530 - in head: share/man/man4 sys/conf sys/dev/syscons X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: in head: share/man/man4 sys/conf sys/dev/syscons X-SVN-Commit-Revision: 334530 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 14:07:29 -0000 Author: bde Date: Sat Jun 2 14:07:27 2018 New Revision: 334530 URL: https://svnweb.freebsd.org/changeset/base/334530 Log: Improve defaults for per-CPU kernel console colors, especially with 2 or 4 CPUs. Add a compile-time option SC_KERNEL_CONS_ATTRS to control the defaults. Default to color numbers in reverse order to CPU numbers (instead of in the same order with white first and wrapping to dark grey), so that the brightest bright colors are used first. Don't use dark grey at all; replace it by dark green. Syscons has too many compile-time options, but this one is needed in in case the defaults give something like white on white, or the user really hates this feature and can't wait to turn it off in rc. MFC after: next release? Modified: head/share/man/man4/syscons.4 head/sys/conf/NOTES head/sys/conf/options head/sys/dev/syscons/syscons.c Modified: head/share/man/man4/syscons.4 ============================================================================== --- head/share/man/man4/syscons.4 Sat Jun 2 10:36:30 2018 (r334529) +++ head/share/man/man4/syscons.4 Sat Jun 2 14:07:27 2018 (r334530) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 21, 2016 +.Dd June 2, 2018 .Dt SYSCONS 4 .Os .Sh NAME @@ -53,6 +53,7 @@ .Cd "options SC_NORM_ATTR=_attribute_" .Cd "options SC_NORM_REV_ATTR=_attribute_" .Cd "options SC_KERNEL_CONS_ATTR=_attribute_" +.Cd "options SC_KERNEL_CONS_ATTRS=_attributes_" .Cd "options SC_KERNEL_CONS_REV_ATTR=_attribute_" .Cd "options SC_DFLT_FONT" .Cd "makeoptions SC_DFLT_FONT=_font_name_" @@ -341,6 +342,7 @@ above. .It Dv SC_NORM_ATTR=_attribute_ .It Dv SC_NORM_REV_ATTR=_attribute_ .It Dv SC_KERNEL_CONS_ATTR=_attribute_ +.It Dv SC_KERNEL_CONS_ATTRS=_attributes_ .It Dv SC_KERNEL_CONS_REV_ATTR=_attribute_ These options will set the default colors. Available colors are defined in @@ -348,6 +350,11 @@ Available colors are defined in See .Sx EXAMPLES below. +.Dv SC_KERNEL_CONS_ATTRS +is a character string giving a sequence of attributes in binary format. +The sequence will be repeated up to the number of CPUs. +Beware that the string must not be null, +since the kernel divides by its length. .It Dv SC_DFLT_FONT This option will specify the default font. Available fonts are: iso, iso2, koi8-r, koi8-u, cp437, cp850, cp865, @@ -538,6 +545,23 @@ The reversed message will be black on red background. .Pp .Dl "options SC_KERNEL_CONS_ATTR=(FG_LIGHTRED|BG_BLACK)" .Dl "options SC_KERNEL_CONS_REV_ATTR=(FG_BLACK|BG_RED)" +.Pp +Provided +.Dv SC_KERNEL_CONS_ATTR +is not set, or is set to its default of bright white on black, +the following line will set 4 red-ish colors +for printing kernel messages in colors depending on the CPU. +.Pp +.Dl options SC_KERNEL_CONS_ATTRS=\e"\ex0c\ex04\ex40\ex0e\e" +.Pp +The default scheme is probably better for up to 8 CPUs. +Use a long string to get unique colors for more than 8 CPUs. +.Pp +To turn off all per-CPU coloring of kernel messages, +set SC_KERNEL_CONS_ATTR to a non-default value, +or use the default in a pattern of length 1. +.Pp +.Dl options SC_KERNEL_CONS_ATTRS=\e"\ex0f\e" .Pp The following example adds the font files .Pa cp850-8x16.fnt , Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sat Jun 2 10:36:30 2018 (r334529) +++ head/sys/conf/NOTES Sat Jun 2 14:07:27 2018 (r334530) @@ -1474,6 +1474,7 @@ options SC_PIXEL_MODE # add support for the raster t options SC_NORM_ATTR=(FG_GREEN|BG_BLACK) options SC_NORM_REV_ATTR=(FG_YELLOW|BG_GREEN) options SC_KERNEL_CONS_ATTR=(FG_RED|BG_BLACK) +options SC_KERNEL_CONS_ATTRS=\"\x0c\x0d\x0e\x0f\x02\x09\x0a\x0b\" options SC_KERNEL_CONS_REV_ATTR=(FG_BLACK|BG_RED) # The following options will let you change the default behavior of Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sat Jun 2 10:36:30 2018 (r334529) +++ head/sys/conf/options Sat Jun 2 14:07:27 2018 (r334530) @@ -774,6 +774,7 @@ SC_DISABLE_KDBKEY opt_syscons.h SC_DISABLE_REBOOT opt_syscons.h SC_HISTORY_SIZE opt_syscons.h SC_KERNEL_CONS_ATTR opt_syscons.h +SC_KERNEL_CONS_ATTRS opt_syscons.h SC_KERNEL_CONS_REV_ATTR opt_syscons.h SC_MOUSE_CHAR opt_syscons.h SC_NO_CUTPASTE opt_syscons.h Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Sat Jun 2 10:36:30 2018 (r334529) +++ head/sys/dev/syscons/syscons.c Sat Jun 2 14:07:27 2018 (r334530) @@ -3153,6 +3153,17 @@ scinit(int unit, int flags) static u_char font_16[256*16]; #endif +#ifdef SC_KERNEL_CONS_ATTRS + static const u_char dflt_kattrtab[] = SC_KERNEL_CONS_ATTRS; +#elif SC_KERNEL_CONS_ATTR == FG_WHITE + static const u_char dflt_kattrtab[] = { + FG_WHITE, FG_YELLOW, FG_LIGHTMAGENTA, FG_LIGHTRED, + FG_LIGHTCYAN, FG_LIGHTGREEN, FG_LIGHTBLUE, FG_GREEN, + 0, + }; +#else + static const u_char dflt_kattrtab[] = { FG_WHITE, 0, }; +#endif sc_softc_t *sc; scr_stat *scp; video_adapter_t *adp; @@ -3163,13 +3174,8 @@ scinit(int unit, int flags) /* one time initialization */ if (init_done == COLD) { sc_get_bios_values(&bios_value); - for (i = 0; i < nitems(sc_kattrtab); i++) { -#if SC_KERNEL_CONS_ATTR == FG_WHITE - sc_kattrtab[i] = 8 + (i + FG_WHITE) % 8U; -#else - sc_kattrtab[i] = SC_KERNEL_CONS_ATTR; -#endif - } + for (i = 0; i < nitems(sc_kattrtab); i++) + sc_kattrtab[i] = dflt_kattrtab[i % (nitems(dflt_kattrtab) - 1)]; } init_done = WARM; From owner-svn-src-head@freebsd.org Sat Jun 2 15:52:20 2018 Return-Path: Delivered-To: svn-src-head@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 B83ADF79A75; Sat, 2 Jun 2018 15:52:20 +0000 (UTC) (envelope-from novel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 69A5A68BA4; Sat, 2 Jun 2018 15:52:20 +0000 (UTC) (envelope-from novel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B4FB11DF0; Sat, 2 Jun 2018 15:52:20 +0000 (UTC) (envelope-from novel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w52FqK7q031317; Sat, 2 Jun 2018 15:52:20 GMT (envelope-from novel@FreeBSD.org) Received: (from novel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w52FqIaU031309; Sat, 2 Jun 2018 15:52:18 GMT (envelope-from novel@FreeBSD.org) Message-Id: <201806021552.w52FqIaU031309@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: novel set sender to novel@FreeBSD.org using -f From: Roman Bogorodskiy Date: Sat, 2 Jun 2018 15:52:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334531 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: novel X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334531 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 15:52:21 -0000 Author: novel (ports committer) Date: Sat Jun 2 15:52:18 2018 New Revision: 334531 URL: https://svnweb.freebsd.org/changeset/base/334531 Log: top: add -p option and p command to only show a single process Allow to show only a single process specified by PID. This could be done either by running top like 'top -p PID' or using the 'p' command inside top. Reviewed by: eadler Approved by: eadler Obtained from: OpenBSD Differential Revision: https://reviews.freebsd.org/D15501 Modified: head/usr.bin/top/commands.c head/usr.bin/top/machine.c head/usr.bin/top/machine.h head/usr.bin/top/top.1 head/usr.bin/top/top.c head/usr.bin/top/top.h head/usr.bin/top/utils.c head/usr.bin/top/utils.h Modified: head/usr.bin/top/commands.c ============================================================================== --- head/usr.bin/top/commands.c Sat Jun 2 14:07:27 2018 (r334530) +++ head/usr.bin/top/commands.c Sat Jun 2 15:52:18 2018 (r334531) @@ -92,6 +92,7 @@ o - specify sort order (pri, size, res, cpu, tim o - specify sort order (vcsw, ivcsw, read, write, fault, total, jid, pid)\n", stdout); fputs("\ +p - display one process (+ selects all processes)\n\ P - toggle the displaying of per-CPU statistics\n\ r - renice a process\n\ s - change number of seconds to delay between updates\n\ Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Sat Jun 2 14:07:27 2018 (r334530) +++ head/usr.bin/top/machine.c Sat Jun 2 15:52:18 2018 (r334531) @@ -764,6 +764,7 @@ get_process_info(struct system_info *si, struct proces int show_self; int show_system; int show_uid; + int show_pid; int show_kidle; /* @@ -783,7 +784,7 @@ get_process_info(struct system_info *si, struct proces previous_pref = malloc(nproc * sizeof(*previous_pref)); if (previous_procs == NULL || previous_pref == NULL) { (void) fprintf(stderr, "top: Out of memory.\n"); - quit(23); + quit(TOP_EX_SYS_ERROR); } previous_proc_count_max = nproc; } @@ -822,7 +823,7 @@ get_process_info(struct system_info *si, struct proces } if (pref == NULL || pbase == NULL || pcpu == NULL) { (void) fprintf(stderr, "top: Out of memory.\n"); - quit(23); + quit(TOP_EX_SYS_ERROR); } /* get a pointer to the states summary array */ si->procstates = process_states; @@ -833,6 +834,7 @@ get_process_info(struct system_info *si, struct proces show_self = sel->self == -1; show_system = sel->system; show_uid = sel->uid[0] != -1; + show_pid = sel->pid != -1; show_kidle = sel->kidle; /* count up process states and get pointers to interesting procs */ @@ -894,6 +896,9 @@ get_process_info(struct system_info *si, struct proces /* skip proc. that don't belong to the selected UID */ continue; + if (show_pid && pp->ki_pid != sel->pid) + continue; + *prefp++ = pp; active_procs++; } @@ -1177,12 +1182,12 @@ getsysctl(const char *name, void *ptr, size_t len) if (sysctlbyname(name, ptr, &nlen, NULL, 0) == -1) { fprintf(stderr, "top: sysctl(%s...) failed: %s\n", name, strerror(errno)); - quit(23); + quit(TOP_EX_SYS_ERROR); } if (nlen != len) { fprintf(stderr, "top: sysctl(%s...) expected %lu, got %lu\n", name, (unsigned long)len, (unsigned long)nlen); - quit(23); + quit(TOP_EX_SYS_ERROR); } } Modified: head/usr.bin/top/machine.h ============================================================================== --- head/usr.bin/top/machine.h Sat Jun 2 14:07:27 2018 (r334530) +++ head/usr.bin/top/machine.h Sat Jun 2 15:52:18 2018 (r334531) @@ -69,6 +69,7 @@ struct process_select int jail; /* show jail ID */ int swap; /* show swap usage */ int kidle; /* show per-CPU idle threads */ + pid_t pid; /* only this pid (unless pid == -1) */ char *command; /* only this command (unless == NULL) */ }; Modified: head/usr.bin/top/top.1 ============================================================================== --- head/usr.bin/top/top.1 Sat Jun 2 14:07:27 2018 (r334530) +++ head/usr.bin/top/top.1 Sat Jun 2 15:52:18 2018 (r334531) @@ -15,6 +15,11 @@ top \- display and update information about the top cp .BI \-m io | cpu ] [ .BI \-o field +] +.br +.ti +4 +[ +.BI \-p pid ] [ .BI \-s time ] [ @@ -178,6 +183,10 @@ is the name of the column as seen in the output, but i \*(rqwrite\*(lq, \*(rqfault\*(lq, \*(rqvcsw\*(lq, \*(rqivcsw\*(lq, \*(lqjid\*(lq, \*(rqswap\*(lq or \*(rqpid\*(lq. .TP +.BI \-p pid +Show only the process +.IR pid . +.TP .BI \-J jail Show only those processes owned by .IR jail . @@ -319,6 +328,10 @@ Change the order in which the display is sorted. This available on all systems. The sort key names vary from system to system but usually include: \*(lqcpu\*(rq, \*(lqres\*(rq, \*(lqsize\*(rq, \*(lqtime\*(rq. The default is cpu. +.TP +.B p +Display a specific process (prompt for pid). +If the pid specified is simply \*(lq+\*(rq, then show all processes. .TP .B e Display a list of system errors (if any) generated by the last Modified: head/usr.bin/top/top.c ============================================================================== --- head/usr.bin/top/top.c Sat Jun 2 14:07:27 2018 (r334530) +++ head/usr.bin/top/top.c Sat Jun 2 15:52:18 2018 (r334531) @@ -226,8 +226,9 @@ main(int argc, char *argv[]) char *order_name = NULL; int order_index = 0; fd_set readfds; + char old_system = false; - static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPJwo"; + static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPJwop"; /* these defines enumerate the "strchr"s of the commands in command_chars */ #define CMD_redraw 0 #define CMD_update 1 @@ -256,7 +257,8 @@ main(int argc, char *argv[]) #define CMD_pcputog 23 #define CMD_jail 24 #define CMD_swaptog 25 -#define CMD_order 26 +#define CMD_order 26 +#define CMD_pid 27 /* set the buffer for stdout */ #ifdef DEBUG @@ -291,6 +293,7 @@ main(int argc, char *argv[]) ps.jail = false; ps.swap = false; ps.kidle = true; + ps.pid = -1; ps.command = NULL; /* get preset options from the environment */ @@ -316,7 +319,7 @@ main(int argc, char *argv[]) optind = 1; } - while ((i = getopt(ac, av, "CSIHPabijJ:nquvzs:d:U:m:o:tw")) != EOF) + while ((i = getopt(ac, av, "CSIHPabijJ:nquvzs:d:U:m:o:p:tw")) != EOF) { switch(i) { @@ -338,7 +341,8 @@ main(int argc, char *argv[]) break; case 'S': /* show system processes */ - ps.system = !ps.system; + ps.system = true; + old_system = true; break; case 'I': /* show idle processes */ @@ -371,7 +375,20 @@ main(int argc, char *argv[]) displays = i; } break; + case 'p': { + unsigned long long num; + const char *errstr; + num = strtonum(optarg, 0, INT_MAX, &errstr); + if (errstr != NULL || !find_pid(num)) { + fprintf(stderr, "%s: unknown pid\n", optarg); + exit(1); + } + ps.pid = (pid_t)num; + ps.system = true; + break; + } + case 's': if ((delay = atoi(optarg)) < 0 || (delay == 0 && getuid() != 0)) { @@ -456,8 +473,8 @@ main(int argc, char *argv[]) default: fprintf(stderr, -"Usage: %s [-abCHIijnPqStuvwz] [-d count] [-m io | cpu] [-o field] [-s time]\n" -" [-J jail] [-U username] [number]\n", +"Usage: %s [-abCHIijnPqStuvwz] [-d count] [-m io | cpu] [-o field] [-p pid]\n" +" [-s time] [-J jail] [-U username] [number]\n", myname); exit(1); } @@ -1018,6 +1035,7 @@ restart: break; case CMD_viewsys: ps.system = !ps.system; + old_system = ps.system; break; case CMD_showargs: fmt_flags ^= FMT_SHOWARGS; @@ -1116,6 +1134,36 @@ restart: header_text = format_header(uname_field); reset_display(); putchar('\r'); + break; + case CMD_pid: + new_message(MT_standout, + "Process id to show (+ for all): "); + if (readline(tempbuf2, sizeof(tempbuf2), false) > 0) { + if (tempbuf2[0] == '+' && + tempbuf2[1] == '\0') { + ps.pid = (pid_t)-1; + ps.system = old_system; + } else { + unsigned long long num; + const char *errstr; + + num = strtonum(tempbuf2, 0, INT_MAX, + &errstr); + if (errstr != NULL || !find_pid(num)) { + new_message(MT_standout, + " %s: unknown pid", + tempbuf2); + no_command = true; + } else { + if (ps.system == false) + old_system = false; + ps.pid = (pid_t)num; + ps.system = true; + } + } + putchar('\r'); + } else + clear_message(); break; default: new_message(MT_standout, " BAD CASE IN SWITCH!"); Modified: head/usr.bin/top/top.h ============================================================================== --- head/usr.bin/top/top.h Sat Jun 2 14:07:27 2018 (r334530) +++ head/usr.bin/top/top.h Sat Jun 2 15:52:18 2018 (r334531) @@ -34,6 +34,9 @@ extern int Header_lines; /* 7 */ #define NUM_AVERAGES 3 +/* Exit code for system errors */ +#define TOP_EX_SYS_ERROR 23 + enum displaymodes { DISP_CPU = 0, DISP_IO, DISP_MAX }; /* Modified: head/usr.bin/top/utils.c ============================================================================== --- head/usr.bin/top/utils.c Sat Jun 2 14:07:27 2018 (r334530) +++ head/usr.bin/top/utils.c Sat Jun 2 15:52:18 2018 (r334531) @@ -15,10 +15,19 @@ #include "top.h" #include "utils.h" +#include +#include +#include + #include #include #include +#include +#include +#include +void quit(int); + int atoiwi(const char *str) { @@ -416,4 +425,32 @@ format_k2(unsigned long long amt) *p = '\0'; return(ret); +} + +int +find_pid(pid_t pid) +{ + kvm_t *kd = NULL; + struct kinfo_proc *pbase = NULL; + int nproc; + int ret = 0; + + kd = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, NULL); + if (kd == NULL) { + fprintf(stderr, "top: kvm_open() failed.\n"); + quit(TOP_EX_SYS_ERROR); + } + + pbase = kvm_getprocs(kd, KERN_PROC_PID, pid, &nproc); + if (pbase == NULL) { + goto done; + } + + if ((nproc == 1) && (pbase->ki_pid == pid)) { + ret = 1; + } + +done: + kvm_close(kd); + return ret; } Modified: head/usr.bin/top/utils.h ============================================================================== --- head/usr.bin/top/utils.h Sat Jun 2 14:07:27 2018 (r334530) +++ head/usr.bin/top/utils.h Sat Jun 2 15:52:18 2018 (r334531) @@ -10,6 +10,8 @@ * Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University */ +#include + int atoiwi(const char *); char *itoa(unsigned int); char *itoa7(unsigned int); @@ -20,4 +22,5 @@ char *format_time(long); char *format_k(int); char *format_k2(unsigned long long); int string_index(const char *string, char *array[]); +int find_pid(pid_t pid); From owner-svn-src-head@freebsd.org Sat Jun 2 16:28:11 2018 Return-Path: Delivered-To: svn-src-head@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 CA8DEF7EE14; Sat, 2 Jun 2018 16:28:11 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7CAAF6AA80; Sat, 2 Jun 2018 16:28:11 +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 5DF41122E3; Sat, 2 Jun 2018 16:28:11 +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 w52GSBQG046926; Sat, 2 Jun 2018 16:28:11 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w52GSAec046924; Sat, 2 Jun 2018 16:28:10 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201806021628.w52GSAec046924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 2 Jun 2018 16:28:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334532 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 334532 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 16:28:12 -0000 Author: tuexen Date: Sat Jun 2 16:28:10 2018 New Revision: 334532 URL: https://svnweb.freebsd.org/changeset/base/334532 Log: Don't overflow a buffer if we receive an INIT or INIT-ACK chunk without a RANDOM parameter but with a CHUNKS or HMAC-ALGO parameter. Please note that sending this combination violates the specification. Thnanks to Ronald E. Crane for reporting the issue for the userland stack. MFC after: 3 days Modified: head/sys/netinet/sctp_auth.c head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_auth.c ============================================================================== --- head/sys/netinet/sctp_auth.c Sat Jun 2 15:52:18 2018 (r334531) +++ head/sys/netinet/sctp_auth.c Sat Jun 2 16:28:10 2018 (r334532) @@ -1504,6 +1504,8 @@ sctp_auth_get_cookie_params(struct sctp_tcb *stcb, str if (p_random != NULL) { keylen = sizeof(*p_random) + random_len; memcpy(new_key->key, p_random, keylen); + } else { + keylen = 0; } /* append in the AUTH chunks */ if (chunks != NULL) { Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sat Jun 2 15:52:18 2018 (r334531) +++ head/sys/netinet/sctp_pcb.c Sat Jun 2 16:28:10 2018 (r334532) @@ -6704,6 +6704,8 @@ next_param: if (p_random != NULL) { keylen = sizeof(*p_random) + random_len; memcpy(new_key->key, p_random, keylen); + } else { + keylen = 0; } /* append in the AUTH chunks */ if (chunks != NULL) { From owner-svn-src-head@freebsd.org Sat Jun 2 17:57:10 2018 Return-Path: Delivered-To: svn-src-head@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 CA926FDD1D3; Sat, 2 Jun 2018 17:57:10 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74B916F2F7; Sat, 2 Jun 2018 17:57:10 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 55D11131B8; Sat, 2 Jun 2018 17:57:10 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w52HvA5a092859; Sat, 2 Jun 2018 17:57:10 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w52Hv9Lh092856; Sat, 2 Jun 2018 17:57:09 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201806021757.w52Hv9Lh092856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 2 Jun 2018 17:57:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334533 - in head/sys: libkern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: libkern sys X-SVN-Commit-Revision: 334533 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 17:57:11 -0000 Author: mjg Date: Sat Jun 2 17:57:09 2018 New Revision: 334533 URL: https://svnweb.freebsd.org/changeset/base/334533 Log: libkern: tidy up memset 1. Remove special-casing of 0 as it just results in an extra function call. This is clearly pessimal. 2. Drop the inline stuff. For the most part it is much better served with __builtin_memset (coming later). 3. Move the declaration to systm.h to match other funcs. Archs are encouraged to implement the variant for their own platform so that this implementation can be dropped. Modified: head/sys/libkern/memset.c head/sys/sys/libkern.h head/sys/sys/systm.h Modified: head/sys/libkern/memset.c ============================================================================== --- head/sys/libkern/memset.c Sat Jun 2 16:28:10 2018 (r334532) +++ head/sys/libkern/memset.c Sat Jun 2 17:57:09 2018 (r334533) @@ -37,10 +37,7 @@ memset(void *b, int c, size_t len) { char *bb; - if (c == 0) - (bzero)(b, len); - else - for (bb = (char *)b; len--; ) - *bb++ = c; + for (bb = (char *)b; len--; ) + *bb++ = c; return (b); } Modified: head/sys/sys/libkern.h ============================================================================== --- head/sys/sys/libkern.h Sat Jun 2 16:28:10 2018 (r334532) +++ head/sys/sys/libkern.h Sat Jun 2 17:57:09 2018 (r334533) @@ -224,23 +224,6 @@ uint32_t armv8_crc32c(uint32_t, const unsigned char *, #endif #endif - -LIBKERN_INLINE void *memset(void *, int, size_t); -#ifdef LIBKERN_BODY -LIBKERN_INLINE void * -memset(void *b, int c, size_t len) -{ - char *bb; - - if (c == 0) - bzero(b, len); - else - for (bb = (char *)b; len--; ) - *bb++ = c; - return (b); -} -#endif - static __inline char * index(const char *p, int ch) { Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Sat Jun 2 16:28:10 2018 (r334532) +++ head/sys/sys/systm.h Sat Jun 2 17:57:09 2018 (r334533) @@ -274,6 +274,7 @@ void bzero(void * _Nonnull buf, size_t len); }) void explicit_bzero(void * _Nonnull, size_t); +void *memset(void * _Nonnull buf, int c, size_t len); void *memcpy(void * _Nonnull to, const void * _Nonnull from, size_t len); #define memcpy(to, from, len) __builtin_memcpy(to, from, len) void *memmove(void * _Nonnull dest, const void * _Nonnull src, size_t n); From owner-svn-src-head@freebsd.org Sat Jun 2 18:03:38 2018 Return-Path: Delivered-To: svn-src-head@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 4615FFDDFA4; Sat, 2 Jun 2018 18:03:38 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E36AC6FC2E; Sat, 2 Jun 2018 18:03:37 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C1E5813352; Sat, 2 Jun 2018 18:03:37 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w52I3bjo098329; Sat, 2 Jun 2018 18:03:37 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w52I3aBM098320; Sat, 2 Jun 2018 18:03:36 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201806021803.w52I3aBM098320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 2 Jun 2018 18:03:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334534 - in head/sys: dev/cx libkern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: dev/cx libkern sys X-SVN-Commit-Revision: 334534 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 18:03:38 -0000 Author: mjg Date: Sat Jun 2 18:03:35 2018 New Revision: 334534 URL: https://svnweb.freebsd.org/changeset/base/334534 Log: Use __builtin for various mem* and b* (e.g. bzero) routines. Some of the routines were using artificially limited builtin already, drop the explicit limit. The use of builtins allows quite often allows the compiler to elide the call or most zeroing to begin with. For instance, if the target object is 32 bytes in size and gets zeroed + has 16 bytes initialized, the compiler can just add code to zero out the rest. Note not all the primites have asm variants and some of the existing ones are not optimized. Maintaines are strongly encourage to take a look (regardless of this change). Modified: head/sys/dev/cx/machdep.h head/sys/libkern/bcmp.c head/sys/libkern/memcmp.c head/sys/libkern/memset.c head/sys/sys/libkern.h head/sys/sys/systm.h head/sys/sys/zutil.h Modified: head/sys/dev/cx/machdep.h ============================================================================== --- head/sys/dev/cx/machdep.h Sat Jun 2 17:57:09 2018 (r334533) +++ head/sys/dev/cx/machdep.h Sat Jun 2 18:03:35 2018 (r334534) @@ -73,7 +73,6 @@ # include # include # include -# define memset(a,b,c) bzero (a,c) # define port_t int #ifndef _SYS_CDEFS_H_ Modified: head/sys/libkern/bcmp.c ============================================================================== --- head/sys/libkern/bcmp.c Sat Jun 2 17:57:09 2018 (r334533) +++ head/sys/libkern/bcmp.c Sat Jun 2 18:03:35 2018 (r334534) @@ -44,7 +44,7 @@ typedef const unsigned long *culp; * bcmp -- vax cmpc3 instruction */ int -bcmp(const void *b1, const void *b2, size_t length) +(bcmp)(const void *b1, const void *b2, size_t length) { #if BYTE_ORDER == LITTLE_ENDIAN /* Modified: head/sys/libkern/memcmp.c ============================================================================== --- head/sys/libkern/memcmp.c Sat Jun 2 17:57:09 2018 (r334533) +++ head/sys/libkern/memcmp.c Sat Jun 2 18:03:35 2018 (r334534) @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); * Compare memory regions. */ int -memcmp(const void *s1, const void *s2, size_t n) +(memcmp)(const void *s1, const void *s2, size_t n) { if (n != 0) { const unsigned char *p1 = s1, *p2 = s2; Modified: head/sys/libkern/memset.c ============================================================================== --- head/sys/libkern/memset.c Sat Jun 2 17:57:09 2018 (r334533) +++ head/sys/libkern/memset.c Sat Jun 2 18:03:35 2018 (r334534) @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); #include void * -memset(void *b, int c, size_t len) +(memset)(void *b, int c, size_t len) { char *bb; Modified: head/sys/sys/libkern.h ============================================================================== --- head/sys/sys/libkern.h Sat Jun 2 17:57:09 2018 (r334533) +++ head/sys/sys/libkern.h Sat Jun 2 18:03:35 2018 (r334534) @@ -128,7 +128,6 @@ struct malloc_type; uint32_t arc4random(void); void arc4random_buf(void *, size_t); void arc4rand(void *, u_int, int); -int bcmp(const void *, const void *, size_t); int timingsafe_bcmp(const void *, const void *, size_t); void *bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *)); @@ -160,7 +159,6 @@ int fnmatch(const char *, const char *, int); int locc(int, char *, u_int); void *memchr(const void *s, int c, size_t n); void *memcchr(const void *s, int c, size_t n); -int memcmp(const void *b1, const void *b2, size_t len); void *memmem(const void *l, size_t l_len, const void *s, size_t s_len); void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Sat Jun 2 17:57:09 2018 (r334533) +++ head/sys/sys/systm.h Sat Jun 2 18:03:35 2018 (r334534) @@ -259,25 +259,21 @@ void hexdump(const void *ptr, int length, const char * #define ovbcopy(f, t, l) bcopy((f), (t), (l)) void bcopy(const void * _Nonnull from, void * _Nonnull to, size_t len); -#define bcopy(from, to, len) ({ \ - if (__builtin_constant_p(len) && (len) <= 64) \ - __builtin_memmove((to), (from), (len)); \ - else \ - bcopy((from), (to), (len)); \ -}) +#define bcopy(from, to, len) __builtin_memmove((to), (from), (len)) void bzero(void * _Nonnull buf, size_t len); -#define bzero(buf, len) ({ \ - if (__builtin_constant_p(len) && (len) <= 64) \ - __builtin_memset((buf), 0, (len)); \ - else \ - bzero((buf), (len)); \ -}) +#define bzero(buf, len) __builtin_memset((buf), 0, (len)) void explicit_bzero(void * _Nonnull, size_t); +int bcmp(const void *b1, const void *b2, size_t len); +#define bcmp(b1, b2, len) __builtin_memcmp((b1), (b2), (len)) void *memset(void * _Nonnull buf, int c, size_t len); +#define memset(buf, c, len) __builtin_memset((buf), (c), (len)) void *memcpy(void * _Nonnull to, const void * _Nonnull from, size_t len); -#define memcpy(to, from, len) __builtin_memcpy(to, from, len) +#define memcpy(to, from, len) __builtin_memcpy((to), (from), (len)) void *memmove(void * _Nonnull dest, const void * _Nonnull src, size_t n); +#define memmove(dest, src, n) __builtin_memmove((dest), (src), (n)) +int memcmp(const void *b1, const void *b2, size_t len); +#define memcmp(b1, b2, len) __builtin_memcmp((b1), (b2), (len)) int copystr(const void * _Nonnull __restrict kfaddr, void * _Nonnull __restrict kdaddr, size_t len, Modified: head/sys/sys/zutil.h ============================================================================== --- head/sys/sys/zutil.h Sat Jun 2 17:57:09 2018 (r334533) +++ head/sys/sys/zutil.h Sat Jun 2 18:03:35 2018 (r334534) @@ -32,8 +32,6 @@ #include #include # define HAVE_MEMCPY -# define memset(d, v, n) bzero((d), (n)) -# define memcmp bcmp #else #if defined(__KERNEL__) From owner-svn-src-head@freebsd.org Sat Jun 2 19:17:13 2018 Return-Path: Delivered-To: svn-src-head@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 0657EFD5A33; Sat, 2 Jun 2018 19:17:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A981D730C6; Sat, 2 Jun 2018 19:17:12 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A95B13EE9; Sat, 2 Jun 2018 19:17:12 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w52JHCRs034374; Sat, 2 Jun 2018 19:17:12 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w52JHBLE034369; Sat, 2 Jun 2018 19:17:11 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201806021917.w52JHBLE034369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 2 Jun 2018 19:17:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334535 - in head: lib/libc/sys sys/powerpc/include sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head: lib/libc/sys sys/powerpc/include sys/powerpc/powerpc X-SVN-Commit-Revision: 334535 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 19:17:13 -0000 Author: jhibbits Date: Sat Jun 2 19:17:11 2018 New Revision: 334535 URL: https://svnweb.freebsd.org/changeset/base/334535 Log: Added ptrace support for reading/writing powerpc VSX registers Summary: Added ptrace support for getting/setting the remaining part of the VSX registers (the part that's not already covered by FPR or VR registers). This is necessary to add support for VSX registers in debuggers. Submitted by: Luis Pires Differential Revision: https://reviews.freebsd.org/D15458 Modified: head/lib/libc/sys/ptrace.2 head/sys/powerpc/include/fpu.h head/sys/powerpc/include/ptrace.h head/sys/powerpc/powerpc/fpu.c head/sys/powerpc/powerpc/ptrace_machdep.c Modified: head/lib/libc/sys/ptrace.2 ============================================================================== --- head/lib/libc/sys/ptrace.2 Sat Jun 2 18:03:35 2018 (r334534) +++ head/lib/libc/sys/ptrace.2 Sat Jun 2 19:17:11 2018 (r334535) @@ -2,7 +2,7 @@ .\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $ .\" .\" This file is in the public domain. -.Dd May 22, 2018 +.Dd June 2, 2018 .Dt PTRACE 2 .Os .Sh NAME @@ -934,6 +934,24 @@ argument is ignored. Set the thread's .Dv ALTIVEC machine state from the buffer pointed to by +.Fa addr . +.Pp +The +.Fa data +argument is ignored. +.It Dv PT_GETVSRREGS +Return doubleword 1 of the thread's +.Dv VSX +registers VSR0-VSR31 in the buffer pointed to by +.Fa addr . +.Pp +The +.Fa data +argument is ignored. +.It Dv PT_SETVSRREGS +Set doubleword 1 of the thread's +.Dv VSX +registers VSR0-VSR31 from the buffer pointed to by .Fa addr . .Pp The Modified: head/sys/powerpc/include/fpu.h ============================================================================== --- head/sys/powerpc/include/fpu.h Sat Jun 2 18:03:35 2018 (r334534) +++ head/sys/powerpc/include/fpu.h Sat Jun 2 19:17:11 2018 (r334535) @@ -74,6 +74,7 @@ void enable_fpu(struct thread *); void save_fpu(struct thread *); +void save_fpu_nodrop(struct thread *); #endif /* _KERNEL */ Modified: head/sys/powerpc/include/ptrace.h ============================================================================== --- head/sys/powerpc/include/ptrace.h Sat Jun 2 18:03:35 2018 (r334534) +++ head/sys/powerpc/include/ptrace.h Sat Jun 2 19:17:11 2018 (r334535) @@ -39,5 +39,7 @@ #define PT_GETVRREGS (PT_FIRSTMACH + 0) #define PT_SETVRREGS (PT_FIRSTMACH + 1) +#define PT_GETVSRREGS (PT_FIRSTMACH + 2) +#define PT_SETVSRREGS (PT_FIRSTMACH + 3) #endif Modified: head/sys/powerpc/powerpc/fpu.c ============================================================================== --- head/sys/powerpc/powerpc/fpu.c Sat Jun 2 18:03:35 2018 (r334534) +++ head/sys/powerpc/powerpc/fpu.c Sat Jun 2 19:17:11 2018 (r334535) @@ -45,6 +45,60 @@ __FBSDID("$FreeBSD$"); #include #include +static void +save_fpu_int(struct thread *td) +{ + int msr; + struct pcb *pcb; + + pcb = td->td_pcb; + + /* + * Temporarily re-enable floating-point during the save + */ + msr = mfmsr(); + if (pcb->pcb_flags & PCB_VSX) + mtmsr(msr | PSL_FP | PSL_VSX); + else + mtmsr(msr | PSL_FP); + + /* + * Save the floating-point registers and FPSCR to the PCB + */ + if (pcb->pcb_flags & PCB_VSX) { + #define SFP(n) __asm ("stxvw4x " #n ", 0,%0" \ + :: "b"(&pcb->pcb_fpu.fpr[n])); + SFP(0); SFP(1); SFP(2); SFP(3); + SFP(4); SFP(5); SFP(6); SFP(7); + SFP(8); SFP(9); SFP(10); SFP(11); + SFP(12); SFP(13); SFP(14); SFP(15); + SFP(16); SFP(17); SFP(18); SFP(19); + SFP(20); SFP(21); SFP(22); SFP(23); + SFP(24); SFP(25); SFP(26); SFP(27); + SFP(28); SFP(29); SFP(30); SFP(31); + #undef SFP + } else { + #define SFP(n) __asm ("stfd " #n ", 0(%0)" \ + :: "b"(&pcb->pcb_fpu.fpr[n])); + SFP(0); SFP(1); SFP(2); SFP(3); + SFP(4); SFP(5); SFP(6); SFP(7); + SFP(8); SFP(9); SFP(10); SFP(11); + SFP(12); SFP(13); SFP(14); SFP(15); + SFP(16); SFP(17); SFP(18); SFP(19); + SFP(20); SFP(21); SFP(22); SFP(23); + SFP(24); SFP(25); SFP(26); SFP(27); + SFP(28); SFP(29); SFP(30); SFP(31); + #undef SFP + } + __asm __volatile ("mffs 0; stfd 0,0(%0)" :: "b"(&pcb->pcb_fpu.fpscr)); + + /* + * Disable floating-point again + */ + isync(); + mtmsr(msr); +} + void enable_fpu(struct thread *td) { @@ -129,57 +183,13 @@ enable_fpu(struct thread *td) void save_fpu(struct thread *td) { - int msr; struct pcb *pcb; pcb = td->td_pcb; - /* - * Temporarily re-enable floating-point during the save - */ - msr = mfmsr(); - if (pcb->pcb_flags & PCB_VSX) - mtmsr(msr | PSL_FP | PSL_VSX); - else - mtmsr(msr | PSL_FP); + save_fpu_int(td); /* - * Save the floating-point registers and FPSCR to the PCB - */ - if (pcb->pcb_flags & PCB_VSX) { - #define SFP(n) __asm ("stxvw4x " #n ", 0,%0" \ - :: "b"(&pcb->pcb_fpu.fpr[n])); - SFP(0); SFP(1); SFP(2); SFP(3); - SFP(4); SFP(5); SFP(6); SFP(7); - SFP(8); SFP(9); SFP(10); SFP(11); - SFP(12); SFP(13); SFP(14); SFP(15); - SFP(16); SFP(17); SFP(18); SFP(19); - SFP(20); SFP(21); SFP(22); SFP(23); - SFP(24); SFP(25); SFP(26); SFP(27); - SFP(28); SFP(29); SFP(30); SFP(31); - #undef SFP - } else { - #define SFP(n) __asm ("stfd " #n ", 0(%0)" \ - :: "b"(&pcb->pcb_fpu.fpr[n])); - SFP(0); SFP(1); SFP(2); SFP(3); - SFP(4); SFP(5); SFP(6); SFP(7); - SFP(8); SFP(9); SFP(10); SFP(11); - SFP(12); SFP(13); SFP(14); SFP(15); - SFP(16); SFP(17); SFP(18); SFP(19); - SFP(20); SFP(21); SFP(22); SFP(23); - SFP(24); SFP(25); SFP(26); SFP(27); - SFP(28); SFP(29); SFP(30); SFP(31); - #undef SFP - } - __asm __volatile ("mffs 0; stfd 0,0(%0)" :: "b"(&pcb->pcb_fpu.fpscr)); - - /* - * Disable floating-point again - */ - isync(); - mtmsr(msr); - - /* * Clear the current fp thread and pcb's CPU id * XXX should this be left clear to allow lazy save/restore ? */ @@ -187,3 +197,19 @@ save_fpu(struct thread *td) PCPU_SET(fputhread, NULL); } +/* + * Save fpu state without dropping ownership. This will only save state if + * the current fpu thread is `td'. + */ +void +save_fpu_nodrop(struct thread *td) +{ + struct thread *ftd; + + ftd = PCPU_GET(fputhread); + if (td != ftd) { + return; + } + + save_fpu_int(td); +} Modified: head/sys/powerpc/powerpc/ptrace_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/ptrace_machdep.c Sat Jun 2 18:03:35 2018 (r334534) +++ head/sys/powerpc/powerpc/ptrace_machdep.c Sat Jun 2 19:17:11 2018 (r334535) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -45,10 +46,14 @@ cpu_ptrace(struct thread *td, int req, void *addr, int int error; struct pcb *pcb; struct vec vec; + uint64_t vsr[32]; + uint64_t *vsr_dw1; + int vsr_idx; pcb = td->td_pcb; bzero(&vec, sizeof(vec)); + bzero(vsr, sizeof(vsr)); error = EINVAL; switch (req) { @@ -69,6 +74,43 @@ cpu_ptrace(struct thread *td, int req, void *addr, int if (error == 0) { pcb->pcb_flags |= PCB_VEC; memcpy(&pcb->pcb_vec, &vec, sizeof(vec)); + } + break; + case PT_GETVSRREGS: + if (!(cpu_features & PPC_FEATURE_HAS_VSX)) + break; + + if (pcb->pcb_flags & PCB_VSX) { + save_fpu_nodrop(td); + + /* + * Doubleword 0 of VSR0-VSR31 overlap with FPR0-FPR31 and + * VSR32-VSR63 overlap with VR0-VR31, so we only copy + * the non-overlapping data, which is doubleword 1 of VSR0-VSR31. + */ + for (vsr_idx = 0; vsr_idx < nitems(vsr); vsr_idx++) { + vsr_dw1 = (uint64_t *)&pcb->pcb_fpu.fpr[vsr_idx].vsr[2]; + vsr[vsr_idx] = *vsr_dw1; + } + } + error = copyout(&vsr, addr, sizeof(vsr)); + break; + case PT_SETVSRREGS: + if (!(cpu_features & PPC_FEATURE_HAS_VSX)) + break; + error = copyin(addr, &vsr, sizeof(vsr)); + if (error == 0) { + pcb->pcb_flags |= PCB_VSX; + + /* + * Doubleword 0 of VSR0-VSR31 overlap with FPR0-FPR31 and + * VSR32-VSR63 overlap with VR0-VR31, so we only copy + * the non-overlapping data, which is doubleword 1 of VSR0-VSR31. + */ + for (vsr_idx = 0; vsr_idx < nitems(vsr); vsr_idx++) { + vsr_dw1 = (uint64_t *)&pcb->pcb_fpu.fpr[vsr_idx].vsr[2]; + *vsr_dw1 = vsr[vsr_idx]; + } } break; From owner-svn-src-head@freebsd.org Sat Jun 2 20:14:44 2018 Return-Path: Delivered-To: svn-src-head@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 D117CFE1473; Sat, 2 Jun 2018 20:14:44 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7F81475893; Sat, 2 Jun 2018 20:14:44 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44176148CB; Sat, 2 Jun 2018 20:14:44 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w52KEiwC065186; Sat, 2 Jun 2018 20:14:44 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w52KEiga065185; Sat, 2 Jun 2018 20:14:44 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201806022014.w52KEiga065185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 2 Jun 2018 20:14:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334537 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 334537 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 20:14:45 -0000 Author: mjg Date: Sat Jun 2 20:14:43 2018 New Revision: 334537 URL: https://svnweb.freebsd.org/changeset/base/334537 Log: amd64: add a mild depessimization to rep mov/stos users Currently all the primitives are waiting for a rewrite, tidy them up in the meantime. Vast majority of cases pass sizes which are multiple of 8. Which means the following rep stosb/movb has nothing to do. Turns out testing first if there is anything to do is a big win across the board (cpus with and without ERMS, Intel and AMD) while not pessimizing the case where there is work to do. Sample results for zeroing 64 bytes (ops/second): Ryzen Threadripper 1950X 91433212 -> 147265741 Intel(R) Xeon(R) CPU X5675 @ 3.07GHz 90714044 -> 121992888 bzero and bcopy are on their way out and were not modified. Nothing in the tree uses them. Modified: head/sys/amd64/amd64/support.S Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Sat Jun 2 20:11:28 2018 (r334536) +++ head/sys/amd64/amd64/support.S Sat Jun 2 20:14:43 2018 (r334537) @@ -205,6 +205,11 @@ ENTRY(memmove) movsq movq %rdx,%rcx andq $7,%rcx /* any bytes left? */ + jne 2f + movq %r9,%rax + POP_FRAME_POINTER + ret +2: rep movsb movq %r9,%rax @@ -248,6 +253,10 @@ ENTRY(memcpy) movsq movq %rdx,%rcx andq $7,%rcx /* any bytes left? */ + jne 1f + POP_FRAME_POINTER + ret +1: rep movsb POP_FRAME_POINTER @@ -269,6 +278,11 @@ ENTRY(memset) stosq movq %rdx,%rcx andq $7,%rcx + jne 1f + movq %r9,%rax + POP_FRAME_POINTER + ret +1: rep stosb movq %r9,%rax @@ -358,6 +372,7 @@ ENTRY(copyout) movsq movb %dl,%cl andb $7,%cl + je done_copyout rep movsb @@ -406,6 +421,7 @@ ENTRY(copyin) movsq movb %al,%cl andb $7,%cl /* copy remaining bytes */ + je done_copyin rep movsb From owner-svn-src-head@freebsd.org Sat Jun 2 20:28:59 2018 Return-Path: Delivered-To: svn-src-head@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 B07FCFE2C56; Sat, 2 Jun 2018 20:28:59 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 59F6B761D7; Sat, 2 Jun 2018 20:28:59 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C0CF14A68; Sat, 2 Jun 2018 20:28:59 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w52KSxpu070518; Sat, 2 Jun 2018 20:28:59 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w52KSw8u070514; Sat, 2 Jun 2018 20:28:58 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201806022028.w52KSw8u070514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 2 Jun 2018 20:28:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334538 - in head: sys/powerpc/powerpc sys/sys usr.bin/gcore X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head: sys/powerpc/powerpc sys/sys usr.bin/gcore X-SVN-Commit-Revision: 334538 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 20:29:00 -0000 Author: jhibbits Date: Sat Jun 2 20:28:58 2018 New Revision: 334538 URL: https://svnweb.freebsd.org/changeset/base/334538 Log: Included VSX registers in powerpc core dumps Summary: Included VSX registers in powerpc core dumps (both kernel and gcore) Submitted by: Luis Pires Differential Revision: https://reviews.freebsd.org/D15512 Modified: head/sys/powerpc/powerpc/elf32_machdep.c head/sys/powerpc/powerpc/elf64_machdep.c head/sys/sys/elf_common.h head/usr.bin/gcore/elfcore.c Modified: head/sys/powerpc/powerpc/elf32_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf32_machdep.c Sat Jun 2 20:14:43 2018 (r334537) +++ head/sys/powerpc/powerpc/elf32_machdep.c Sat Jun 2 20:28:58 2018 (r334538) @@ -52,6 +52,7 @@ #include #include +#include #include #include #include @@ -171,19 +172,44 @@ elf32_dump_thread(struct thread *td, void *dst, size_t { size_t len; struct pcb *pcb; + uint64_t vshr[32]; + uint64_t *vsr_dw1; + int vsr_idx; len = 0; pcb = td->td_pcb; + if (pcb->pcb_flags & PCB_VEC) { save_vec_nodrop(td); if (dst != NULL) { len += elf32_populate_note(NT_PPC_VMX, - &pcb->pcb_vec, dst, + &pcb->pcb_vec, (char *)dst + len, sizeof(pcb->pcb_vec), NULL); } else len += elf32_populate_note(NT_PPC_VMX, NULL, NULL, sizeof(pcb->pcb_vec), NULL); } + + if (pcb->pcb_flags & PCB_VSX) { + save_fpu_nodrop(td); + if (dst != NULL) { + /* + * Doubleword 0 of VSR0-VSR31 overlap with FPR0-FPR31 and + * VSR32-VSR63 overlap with VR0-VR31, so we only copy + * the non-overlapping data, which is doubleword 1 of VSR0-VSR31. + */ + for (vsr_idx = 0; vsr_idx < nitems(vshr); vsr_idx++) { + vsr_dw1 = (uint64_t *)&pcb->pcb_fpu.fpr[vsr_idx].vsr[2]; + vshr[vsr_idx] = *vsr_dw1; + } + len += elf32_populate_note(NT_PPC_VSX, + vshr, (char *)dst + len, + sizeof(vshr), NULL); + } else + len += elf32_populate_note(NT_PPC_VSX, NULL, NULL, + sizeof(vshr), NULL); + } + *off = len; } Modified: head/sys/powerpc/powerpc/elf64_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf64_machdep.c Sat Jun 2 20:14:43 2018 (r334537) +++ head/sys/powerpc/powerpc/elf64_machdep.c Sat Jun 2 20:28:58 2018 (r334538) @@ -48,6 +48,7 @@ #include #include +#include #include #include @@ -234,19 +235,44 @@ elf64_dump_thread(struct thread *td, void *dst, size_t { size_t len; struct pcb *pcb; + uint64_t vshr[32]; + uint64_t *vsr_dw1; + int vsr_idx; len = 0; pcb = td->td_pcb; + if (pcb->pcb_flags & PCB_VEC) { save_vec_nodrop(td); if (dst != NULL) { len += elf64_populate_note(NT_PPC_VMX, - &pcb->pcb_vec, dst, + &pcb->pcb_vec, (char *)dst + len, sizeof(pcb->pcb_vec), NULL); } else len += elf64_populate_note(NT_PPC_VMX, NULL, NULL, sizeof(pcb->pcb_vec), NULL); } + + if (pcb->pcb_flags & PCB_VSX) { + save_fpu_nodrop(td); + if (dst != NULL) { + /* + * Doubleword 0 of VSR0-VSR31 overlap with FPR0-FPR31 and + * VSR32-VSR63 overlap with VR0-VR31, so we only copy + * the non-overlapping data, which is doubleword 1 of VSR0-VSR31. + */ + for (vsr_idx = 0; vsr_idx < nitems(vshr); vsr_idx++) { + vsr_dw1 = (uint64_t *)&pcb->pcb_fpu.fpr[vsr_idx].vsr[2]; + vshr[vsr_idx] = *vsr_dw1; + } + len += elf64_populate_note(NT_PPC_VSX, + vshr, (char *)dst + len, + sizeof(vshr), NULL); + } else + len += elf64_populate_note(NT_PPC_VSX, NULL, NULL, + sizeof(vshr), NULL); + } + *off = len; } Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Sat Jun 2 20:14:43 2018 (r334537) +++ head/sys/sys/elf_common.h Sat Jun 2 20:28:58 2018 (r334538) @@ -774,6 +774,7 @@ typedef struct { #define NT_PROCSTAT_AUXV 16 /* Procstat auxv data. */ #define NT_PTLWPINFO 17 /* Thread ptrace miscellaneous info. */ #define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ +#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ #define NT_X86_XSTATE 0x202 /* x86 XSAVE extended state. */ #define NT_ARM_VFP 0x400 /* ARM VFP registers */ Modified: head/usr.bin/gcore/elfcore.c ============================================================================== --- head/usr.bin/gcore/elfcore.c Sat Jun 2 20:14:43 2018 (r334537) +++ head/usr.bin/gcore/elfcore.c Sat Jun 2 20:28:58 2018 (r334538) @@ -119,6 +119,7 @@ static void *elf_note_x86_xstate(void *, size_t *); #endif #if defined(__powerpc__) static void *elf_note_powerpc_vmx(void *, size_t *); +static void *elf_note_powerpc_vsx(void *, size_t *); #endif static void *elf_note_procstat_auxv(void *, size_t *); static void *elf_note_procstat_files(void *, size_t *); @@ -381,6 +382,7 @@ elf_putnotes(pid_t pid, struct sbuf *sb, size_t *sizep #endif #if defined(__powerpc__) elf_putnote(NT_PPC_VMX, elf_note_powerpc_vmx, tids + i, sb); + elf_putnote(NT_PPC_VSX, elf_note_powerpc_vsx, tids + i, sb); #endif } @@ -802,6 +804,30 @@ elf_note_powerpc_vmx(void *arg, size_t *sizep) memcpy(vmx, &info, sizeof(*vmx)); *sizep = sizeof(*vmx); return (vmx); +} + +static void * +elf_note_powerpc_vsx(void *arg, size_t *sizep) +{ + lwpid_t tid; + char *vshr_data; + static bool has_vsx = true; + uint64_t vshr[32]; + + tid = *(lwpid_t *)arg; + if (has_vsx) { + if (ptrace(PT_GETVSRREGS, tid, (void *)vshr, + sizeof(vshr)) != 0) + has_vsx = false; + } + if (!has_vsx) { + *sizep = 0; + return (NULL); + } + vshr_data = calloc(1, sizeof(vshr)); + memcpy(vshr_data, vshr, sizeof(vshr)); + *sizep = sizeof(vshr); + return (vshr_data); } #endif From owner-svn-src-head@freebsd.org Sat Jun 2 21:40:46 2018 Return-Path: Delivered-To: svn-src-head@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 B861BFEA739; Sat, 2 Jun 2018 21:40:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 65EBB79867; Sat, 2 Jun 2018 21:40:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47D25156EF; Sat, 2 Jun 2018 21:40:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w52LekqB005620; Sat, 2 Jun 2018 21:40:46 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w52LejjF005616; Sat, 2 Jun 2018 21:40:45 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806022140.w52LejjF005616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 2 Jun 2018 21:40:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334540 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334540 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 21:40:47 -0000 Author: eadler Date: Sat Jun 2 21:40:45 2018 New Revision: 334540 URL: https://svnweb.freebsd.org/changeset/base/334540 Log: top(1): cleanup memory allocation and warnings - Prefer calloc over malloc. This is more predicable and we're not in a performance sensitive context. [1] - Remove bogus comment (obsolete from prior commit). [2] - Remove void casts and type casts of NULL - Remove redundant declaration of 'quit' - Add additional const Reported by: kib [1], vangyzen [2] Modified: head/usr.bin/top/display.c head/usr.bin/top/machine.c head/usr.bin/top/screen.c head/usr.bin/top/screen.h head/usr.bin/top/utils.c Modified: head/usr.bin/top/display.c ============================================================================== --- head/usr.bin/top/display.c Sat Jun 2 21:16:20 2018 (r334539) +++ head/usr.bin/top/display.c Sat Jun 2 21:40:45 2018 (r334540) @@ -148,8 +148,8 @@ display_resize(void) } /* now, allocate space for the screen buffer */ - screenbuf = malloc(lines * display_width); - if (screenbuf == (char *)NULL) + screenbuf = calloc(lines, display_width); + if (screenbuf == NULL) { /* oops! */ return(-1); @@ -205,23 +205,23 @@ int display_init(struct statics * statics) procstate_names = statics->procstate_names; num_procstates = string_count(procstate_names); assert(num_procstates > 0); - lprocstates = malloc(num_procstates * sizeof(int)); + lprocstates = calloc(num_procstates, sizeof(int)); cpustate_names = statics->cpustate_names; swap_names = statics->swap_names; num_swap = string_count(swap_names); assert(num_swap > 0); - lswap = malloc(num_swap * sizeof(int)); + lswap = calloc(num_swap, sizeof(int)); num_cpustates = string_count(cpustate_names); assert(num_cpustates > 0); - lcpustates = malloc(num_cpustates * sizeof(int) * statics->ncpus); - cpustate_columns = malloc(num_cpustates * sizeof(int)); + lcpustates = calloc(num_cpustates * sizeof(int), statics->ncpus); + cpustate_columns = calloc(num_cpustates, sizeof(int)); memory_names = statics->memory_names; num_memory = string_count(memory_names); assert(num_memory > 0); - lmemory = malloc(num_memory * sizeof(int)); + lmemory = calloc(num_memory, sizeof(int)); arc_names = statics->arc_names; carc_names = statics->carc_names; @@ -745,7 +745,7 @@ trim_header(char *text) width = display_width; header_length = strlen(text); if (header_length >= width) { - s = malloc((width + 1) * sizeof(char)); + s = calloc((width + 1), sizeof(char)); if (s == NULL) return (NULL); strncpy(s, text, width); Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Sat Jun 2 21:16:20 2018 (r334539) +++ head/usr.bin/top/machine.c Sat Jun 2 21:40:45 2018 (r334540) @@ -382,9 +382,9 @@ machine_init(struct statics *statics) ncpus = 0; GETSYSCTL("kern.smp.maxcpus", maxcpu); size = sizeof(long) * maxcpu * CPUSTATES; - times = malloc(size); + times = calloc(size, 1); if (times == NULL) - err(1, "malloc %zu bytes", size); + err(1, "calloc %zu bytes", size); if (sysctlbyname("kern.cp_times", times, &size, NULL, 0) == -1) err(1, "sysctlbyname kern.cp_times"); pcpu_cp_time = calloc(1, size); @@ -779,11 +779,11 @@ get_process_info(struct system_info *si, struct proces */ if (previous_proc_count_max < nproc) { free(previous_procs); - previous_procs = malloc(nproc * sizeof(*previous_procs)); + previous_procs = calloc(nproc, sizeof(*previous_procs)); free(previous_pref); - previous_pref = malloc(nproc * sizeof(*previous_pref)); + previous_pref = calloc(nproc, sizeof(*previous_pref)); if (previous_procs == NULL || previous_pref == NULL) { - (void) fprintf(stderr, "top: Out of memory.\n"); + fprintf(stderr, "top: Out of memory.\n"); quit(TOP_EX_SYS_ERROR); } previous_proc_count_max = nproc; @@ -996,9 +996,9 @@ format_next_process(caddr_t xhandle, char *(*get_useri break; } - cmdbuf = malloc(cmdlen + 1); + cmdbuf = calloc(cmdlen + 1, 1); if (cmdbuf == NULL) { - warn("malloc(%d)", cmdlen + 1); + warn("calloc(%d)", cmdlen + 1); return NULL; } @@ -1031,9 +1031,9 @@ format_next_process(caddr_t xhandle, char *(*get_useri size_t len; argbuflen = cmdlen * 4; - argbuf = malloc(argbuflen + 1); + argbuf = calloc(argbuflen + 1, 1); if (argbuf == NULL) { - warn("malloc(%zu)", argbuflen + 1); + warn("calloc(%zu)", argbuflen + 1); free(cmdbuf); return NULL; } Modified: head/usr.bin/top/screen.c ============================================================================== --- head/usr.bin/top/screen.c Sat Jun 2 21:16:20 2018 (r334539) +++ head/usr.bin/top/screen.c Sat Jun 2 21:40:45 2018 (r334540) @@ -3,7 +3,7 @@ * Version 3 * * This program may be freely redistributed, - * but this entire comment MUST remain intact. + * but this entire ceomment MUST remain intact. * * Copyright (c) 1984, 1989, William LeFebvre, Rice University * Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University @@ -270,7 +270,7 @@ get_screensize(void) } void -top_standout(char *msg) +top_standout(const char *msg) { if (smart_terminal) { Modified: head/usr.bin/top/screen.h ============================================================================== --- head/usr.bin/top/screen.h Sat Jun 2 21:16:20 2018 (r334539) +++ head/usr.bin/top/screen.h Sat Jun 2 21:40:45 2018 (r334540) @@ -25,9 +25,8 @@ extern char *clear_to_end; extern int screen_length; extern int screen_width; -/* a function that puts a single character on stdout */ int clear_eol(int len); -void top_standout(char *msg); +void top_standout(const char *msg); void top_clear(void); void go_home(void); void reinit_screen(void); Modified: head/usr.bin/top/utils.c ============================================================================== --- head/usr.bin/top/utils.c Sat Jun 2 21:16:20 2018 (r334539) +++ head/usr.bin/top/utils.c Sat Jun 2 21:40:45 2018 (r334540) @@ -26,8 +26,6 @@ #include #include -void quit(int); - int atoiwi(const char *str) { @@ -201,10 +199,10 @@ argparse(char *line, int *cntp) cnt += 3; /* allocate a char * array to hold the pointers */ - argarray = malloc(cnt * sizeof(char *)); + argarray = calloc(cnt, sizeof(char *)); /* allocate another array to hold the strings themselves */ - args = malloc(length+2); + args = calloc(length+2, 1); /* initialization for main loop */ from = line; From owner-svn-src-head@freebsd.org Sat Jun 2 22:06:29 2018 Return-Path: Delivered-To: svn-src-head@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 2051DFEDB50; Sat, 2 Jun 2018 22:06:29 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C2DF37B160; Sat, 2 Jun 2018 22:06:28 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A392D15AE8; Sat, 2 Jun 2018 22:06:28 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w52M6SvZ020832; Sat, 2 Jun 2018 22:06:28 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w52M6S98020830; Sat, 2 Jun 2018 22:06:28 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806022206.w52M6S98020830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 2 Jun 2018 22:06:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334543 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334543 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 22:06:29 -0000 Author: eadler Date: Sat Jun 2 22:06:27 2018 New Revision: 334543 URL: https://svnweb.freebsd.org/changeset/base/334543 Log: top(1): chdir to / as init; remove unneeded comment - chdir to / to allow unmounting of wd - remove warning about running top(1) as setuid. If this is a concern we should just drop privs instead. Modified: head/usr.bin/top/machine.c head/usr.bin/top/top.c Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Sat Jun 2 21:50:00 2018 (r334542) +++ head/usr.bin/top/machine.c Sat Jun 2 22:06:27 2018 (r334543) @@ -1613,11 +1613,6 @@ compare_ivcsw(const void *arg1, const void *arg2) /* * proc_owner(pid) - returns the uid that owns process "pid", or -1 if * the process does not exist. - * It is EXTREMELY IMPORTANT that this function work correctly. - * If top runs setuid root (as in SVR4), then this function - * is the only thing that stands in the way of a serious - * security problem. It validates requests for the "kill" - * and "renice" commands. */ int Modified: head/usr.bin/top/top.c ============================================================================== --- head/usr.bin/top/top.c Sat Jun 2 21:50:00 2018 (r334542) +++ head/usr.bin/top/top.c Sat Jun 2 22:06:27 2018 (r334543) @@ -260,6 +260,15 @@ main(int argc, char *argv[]) #define CMD_order 26 #define CMD_pid 27 + /* + * Since top(1) is often long running and + * doesn't typically care about where its running from + * chdir to the root to allow unmounting of its + * originall wd. Failure is alright as this is + * just a courtesy for users. + */ + chdir("/"); + /* set the buffer for stdout */ #ifdef DEBUG extern FILE *debug; From owner-svn-src-head@freebsd.org Sat Jun 2 22:12:58 2018 Return-Path: Delivered-To: svn-src-head@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 717F5FEE516; Sat, 2 Jun 2018 22:12:58 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F7127B756; Sat, 2 Jun 2018 22:12:58 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 011B215C7C; Sat, 2 Jun 2018 22:12:58 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w52MCvxS025925; Sat, 2 Jun 2018 22:12:57 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w52MCvwU025923; Sat, 2 Jun 2018 22:12:57 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806022212.w52MCvwU025923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 2 Jun 2018 22:12:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334544 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334544 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 22:12:58 -0000 Author: eadler Date: Sat Jun 2 22:12:57 2018 New Revision: 334544 URL: https://svnweb.freebsd.org/changeset/base/334544 Log: top(1): Fix two speeling errors I introduced Modified: head/usr.bin/top/screen.c head/usr.bin/top/top.c Modified: head/usr.bin/top/screen.c ============================================================================== --- head/usr.bin/top/screen.c Sat Jun 2 22:06:27 2018 (r334543) +++ head/usr.bin/top/screen.c Sat Jun 2 22:12:57 2018 (r334544) @@ -3,7 +3,7 @@ * Version 3 * * This program may be freely redistributed, - * but this entire ceomment MUST remain intact. + * but this entire comment MUST remain intact. * * Copyright (c) 1984, 1989, William LeFebvre, Rice University * Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University Modified: head/usr.bin/top/top.c ============================================================================== --- head/usr.bin/top/top.c Sat Jun 2 22:06:27 2018 (r334543) +++ head/usr.bin/top/top.c Sat Jun 2 22:12:57 2018 (r334544) @@ -264,7 +264,7 @@ main(int argc, char *argv[]) * Since top(1) is often long running and * doesn't typically care about where its running from * chdir to the root to allow unmounting of its - * originall wd. Failure is alright as this is + * original wd. Failure is alright as this is * just a courtesy for users. */ chdir("/"); From owner-svn-src-head@freebsd.org Sat Jun 2 22:20:10 2018 Return-Path: Delivered-To: svn-src-head@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 958F6FEF061; Sat, 2 Jun 2018 22:20:10 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 43B017BB5A; Sat, 2 Jun 2018 22:20:10 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20E4915C83; Sat, 2 Jun 2018 22:20:10 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w52MK9vf026248; Sat, 2 Jun 2018 22:20:09 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w52MK9TT026244; Sat, 2 Jun 2018 22:20:09 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201806022220.w52MK9TT026244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 2 Jun 2018 22:20:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334545 - in head/sys: contrib/zstd/lib/freebsd kern netinet/libalias sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: contrib/zstd/lib/freebsd kern netinet/libalias sys X-SVN-Commit-Revision: 334545 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 22:20:10 -0000 Author: mjg Date: Sat Jun 2 22:20:09 2018 New Revision: 334545 URL: https://svnweb.freebsd.org/changeset/base/334545 Log: malloc: try to use builtins for zeroing at the callsite Plenty of allocation sites pass M_ZERO and sizes which are small and known at compilation time. Handling them internally in malloc loses this information and results in avoidable calls to memset. Instead, let the compiler take the advantage of it whenever possible. Discussed with: jeff Modified: head/sys/contrib/zstd/lib/freebsd/stdlib.h head/sys/kern/kern_malloc.c head/sys/netinet/libalias/alias_mod.h head/sys/sys/malloc.h Modified: head/sys/contrib/zstd/lib/freebsd/stdlib.h ============================================================================== --- head/sys/contrib/zstd/lib/freebsd/stdlib.h Sat Jun 2 22:12:57 2018 (r334544) +++ head/sys/contrib/zstd/lib/freebsd/stdlib.h Sat Jun 2 22:20:09 2018 (r334545) @@ -35,6 +35,7 @@ MALLOC_DECLARE(M_ZSTD); +#undef malloc #define malloc(x) (malloc)((x), M_ZSTD, M_WAITOK) #define free(x) (free)((x), M_ZSTD) #define calloc(a, b) (mallocarray)((a), (b), M_ZSTD, M_WAITOK | M_ZERO) Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Sat Jun 2 22:12:57 2018 (r334544) +++ head/sys/kern/kern_malloc.c Sat Jun 2 22:20:09 2018 (r334545) @@ -549,7 +549,7 @@ malloc_dbg(caddr_t *vap, size_t *sizep, struct malloc_ * the allocation fails. */ void * -malloc(size_t size, struct malloc_type *mtp, int flags) +(malloc)(size_t size, struct malloc_type *mtp, int flags) { int indx; caddr_t va; Modified: head/sys/netinet/libalias/alias_mod.h ============================================================================== --- head/sys/netinet/libalias/alias_mod.h Sat Jun 2 22:12:57 2018 (r334544) +++ head/sys/netinet/libalias/alias_mod.h Sat Jun 2 22:20:09 2018 (r334545) @@ -41,6 +41,7 @@ MALLOC_DECLARE(M_ALIAS); /* Use kernel allocator. */ #if defined(_SYS_MALLOC_H_) +#undef malloc #define malloc(x) malloc(x, M_ALIAS, M_NOWAIT|M_ZERO) #define calloc(n, x) mallocarray((n), (x), M_ALIAS, M_NOWAIT|M_ZERO) #define free(x) free(x, M_ALIAS) Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Sat Jun 2 22:12:57 2018 (r334544) +++ head/sys/sys/malloc.h Sat Jun 2 22:20:09 2018 (r334545) @@ -38,6 +38,9 @@ #define _SYS_MALLOC_H_ #include +#ifdef _KERNEL +#include +#endif #include #include #include @@ -183,6 +186,22 @@ void free(void *addr, struct malloc_type *type); void free_domain(void *addr, struct malloc_type *type); void *malloc(size_t size, struct malloc_type *type, int flags) __malloc_like __result_use_check __alloc_size(1); +#ifdef _KERNEL +#define malloc(size, type, flags) ({ \ + void *_malloc_item; \ + size_t _size = (size); \ + if (__builtin_constant_p(size) && __builtin_constant_p(flags) &&\ + ((flags) & M_ZERO)) { \ + _malloc_item = malloc(_size, type, (flags) &~ M_ZERO); \ + if (((flags) & M_WAITOK) || _malloc_item != NULL) \ + bzero(_malloc_item, _size); \ + } else { \ + _malloc_item = malloc(_size, type, flags); \ + } \ + _malloc_item; \ +}) +#endif + void *malloc_domain(size_t size, struct malloc_type *type, int domain, int flags) __malloc_like __result_use_check __alloc_size(1); void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, From owner-svn-src-head@freebsd.org Sat Jun 2 22:37:55 2018 Return-Path: Delivered-To: svn-src-head@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 599D8FF12CE; Sat, 2 Jun 2018 22:37:55 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 061E87DFBE; Sat, 2 Jun 2018 22:37:55 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D34B216024; Sat, 2 Jun 2018 22:37:54 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w52MbsPo039098; Sat, 2 Jun 2018 22:37:54 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w52Mbrvi039092; Sat, 2 Jun 2018 22:37:53 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201806022237.w52Mbrvi039092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 2 Jun 2018 22:37:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334546 - in head/sys: amd64/amd64 kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: amd64/amd64 kern sys X-SVN-Commit-Revision: 334546 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 22:37:55 -0000 Author: mjg Date: Sat Jun 2 22:37:53 2018 New Revision: 334546 URL: https://svnweb.freebsd.org/changeset/base/334546 Log: Remove an unused argument to turnstile_unpend. PR: 228694 Submitted by: Julian Pszczołowski Modified: head/sys/amd64/amd64/pmap.c head/sys/kern/kern_mutex.c head/sys/kern/kern_rmlock.c head/sys/kern/kern_rwlock.c head/sys/kern/subr_turnstile.c head/sys/sys/turnstile.h Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sat Jun 2 22:20:09 2018 (r334545) +++ head/sys/amd64/amd64/pmap.c Sat Jun 2 22:37:53 2018 (r334546) @@ -513,7 +513,7 @@ pmap_delayed_invl_finished(void) pmap_invl_gen = invl_gen->gen; if (ts != NULL) { turnstile_broadcast(ts, TS_SHARED_QUEUE); - turnstile_unpend(ts, TS_SHARED_LOCK); + turnstile_unpend(ts); } turnstile_chain_unlock(&invl_gen_ts); } else { Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Sat Jun 2 22:20:09 2018 (r334545) +++ head/sys/kern/kern_mutex.c Sat Jun 2 22:37:53 2018 (r334546) @@ -1029,7 +1029,7 @@ __mtx_unlock_sleep(volatile uintptr_t *c, uintptr_t v) * This turnstile is now no longer associated with the mutex. We can * unlock the chain lock so a new turnstile may take it's place. */ - turnstile_unpend(ts, TS_EXCLUSIVE_LOCK); + turnstile_unpend(ts); turnstile_chain_unlock(&m->lock_object); } Modified: head/sys/kern/kern_rmlock.c ============================================================================== --- head/sys/kern/kern_rmlock.c Sat Jun 2 22:20:09 2018 (r334545) +++ head/sys/kern/kern_rmlock.c Sat Jun 2 22:37:53 2018 (r334546) @@ -494,7 +494,7 @@ _rm_unlock_hard(struct thread *td,struct rm_priotracke ts = turnstile_lookup(&rm->lock_object); turnstile_signal(ts, TS_EXCLUSIVE_QUEUE); - turnstile_unpend(ts, TS_EXCLUSIVE_LOCK); + turnstile_unpend(ts); turnstile_chain_unlock(&rm->lock_object); } else mtx_unlock_spin(&rm_spinlock); Modified: head/sys/kern/kern_rwlock.c ============================================================================== --- head/sys/kern/kern_rwlock.c Sat Jun 2 22:20:09 2018 (r334545) +++ head/sys/kern/kern_rwlock.c Sat Jun 2 22:37:53 2018 (r334546) @@ -822,7 +822,7 @@ __rw_runlock_hard(struct rwlock *rw, struct thread *td ts = turnstile_lookup(&rw->lock_object); MPASS(ts != NULL); turnstile_broadcast(ts, queue); - turnstile_unpend(ts, TS_SHARED_LOCK); + turnstile_unpend(ts); td->td_rw_rlocks--; break; } @@ -1259,7 +1259,7 @@ __rw_wunlock_hard(volatile uintptr_t *c, uintptr_t v L ts = turnstile_lookup(&rw->lock_object); MPASS(ts != NULL); turnstile_broadcast(ts, queue); - turnstile_unpend(ts, TS_EXCLUSIVE_LOCK); + turnstile_unpend(ts); turnstile_chain_unlock(&rw->lock_object); } @@ -1405,7 +1405,7 @@ __rw_downgrade_int(struct rwlock *rw LOCK_FILE_LINE_AR */ if (rwait && !wwait) { turnstile_broadcast(ts, TS_SHARED_QUEUE); - turnstile_unpend(ts, TS_EXCLUSIVE_LOCK); + turnstile_unpend(ts); } else turnstile_disown(ts); turnstile_chain_unlock(&rw->lock_object); Modified: head/sys/kern/subr_turnstile.c ============================================================================== --- head/sys/kern/subr_turnstile.c Sat Jun 2 22:20:09 2018 (r334545) +++ head/sys/kern/subr_turnstile.c Sat Jun 2 22:37:53 2018 (r334546) @@ -903,7 +903,7 @@ turnstile_broadcast(struct turnstile *ts, int queue) * chain locked. */ void -turnstile_unpend(struct turnstile *ts, int owner_type) +turnstile_unpend(struct turnstile *ts) { TAILQ_HEAD( ,thread) pending_threads; struct turnstile *nts; Modified: head/sys/sys/turnstile.h ============================================================================== --- head/sys/sys/turnstile.h Sat Jun 2 22:20:09 2018 (r334545) +++ head/sys/sys/turnstile.h Sat Jun 2 22:37:53 2018 (r334546) @@ -83,10 +83,6 @@ struct turnstile; #define TS_EXCLUSIVE_QUEUE 0 #define TS_SHARED_QUEUE 1 -/* The type of lock currently held. */ -#define TS_EXCLUSIVE_LOCK TS_EXCLUSIVE_QUEUE -#define TS_SHARED_LOCK TS_SHARED_QUEUE - void init_turnstiles(void); void turnstile_adjust(struct thread *, u_char); struct turnstile *turnstile_alloc(void); @@ -102,7 +98,7 @@ struct thread *turnstile_head(struct turnstile *, int) struct turnstile *turnstile_lookup(struct lock_object *); int turnstile_signal(struct turnstile *, int); struct turnstile *turnstile_trywait(struct lock_object *); -void turnstile_unpend(struct turnstile *, int); +void turnstile_unpend(struct turnstile *); void turnstile_wait(struct turnstile *, struct thread *, int); struct thread *turnstile_lock(struct turnstile *, struct lock_object **); void turnstile_unlock(struct turnstile *, struct lock_object *); From owner-svn-src-head@freebsd.org Sat Jun 2 22:40:17 2018 Return-Path: Delivered-To: svn-src-head@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 B370FFF169F; Sat, 2 Jun 2018 22:40:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5DDEF7E1EE; Sat, 2 Jun 2018 22:40:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B9701602B; Sat, 2 Jun 2018 22:40:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w52MeHaq039259; Sat, 2 Jun 2018 22:40:17 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w52MeHXd039258; Sat, 2 Jun 2018 22:40:17 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201806022240.w52MeHXd039258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 2 Jun 2018 22:40:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334547 - head/lib/libutil X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/lib/libutil X-SVN-Commit-Revision: 334547 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 22:40:17 -0000 Author: asomers Date: Sat Jun 2 22:40:16 2018 New Revision: 334547 URL: https://svnweb.freebsd.org/changeset/base/334547 Log: pty.3: Add a HISTORY section These functions were first added in 4.3 BSD-Reno, according to http://unix.superglobalmegacorp.com/ and the CSRG svn repository. Reviewed by: bcr, bjk MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D15652 Modified: head/lib/libutil/pty.3 Modified: head/lib/libutil/pty.3 ============================================================================== --- head/lib/libutil/pty.3 Sat Jun 2 22:37:53 2018 (r334546) +++ head/lib/libutil/pty.3 Sat Jun 2 22:40:16 2018 (r334547) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" " -.Dd November 11, 2015 +.Dd June 2, 2018 .Dt PTY 3 .Os .Sh NAME @@ -143,3 +143,18 @@ may set it to any value as described for .Xr pty 4 , .Xr termios 4 , .Xr group 5 +.Sh HISTORY +The +.Fn openpty +and +.Fn forkpty +functions first appeared in +.Bx 4.3 Reno. +.Sh BUGS +.Fn openpty +writes the slave terminal's name to +.Fa name , +but does not check that sufficient space is available. +It is advisable to use +.Xr ptsname 3 +instead. From owner-svn-src-head@freebsd.org Sat Jun 2 23:53:10 2018 Return-Path: Delivered-To: svn-src-head@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 6239CFD1A65; Sat, 2 Jun 2018 23:53:10 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.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 C4D068169C; Sat, 2 Jun 2018 23:53:09 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w52Nr1OD088637; Sat, 2 Jun 2018 16:53:01 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w52Nr1LA088636; Sat, 2 Jun 2018 16:53:01 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201806022353.w52Nr1LA088636@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r334540 - head/usr.bin/top In-Reply-To: <201806022140.w52LejjF005616@repo.freebsd.org> To: Eitan Adler Date: Sat, 2 Jun 2018 16:53:01 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 23:53:10 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: eadler > Date: Sat Jun 2 21:40:45 2018 > New Revision: 334540 > URL: https://svnweb.freebsd.org/changeset/base/334540 > > Log: > top(1): cleanup memory allocation and warnings > > - Prefer calloc over malloc. This is more predicable and we're not in a > performance sensitive context. [1] > - Remove bogus comment (obsolete from prior commit). [2] > - Remove void casts and type casts of NULL > - Remove redundant declaration of 'quit' > - Add additional const > > Reported by: kib [1], vangyzen [2] > > Modified: > head/usr.bin/top/display.c > head/usr.bin/top/machine.c > head/usr.bin/top/screen.c > head/usr.bin/top/screen.h > head/usr.bin/top/utils.c ... > > Modified: head/usr.bin/top/screen.c > ============================================================================== > --- head/usr.bin/top/screen.c Sat Jun 2 21:16:20 2018 (r334539) > +++ head/usr.bin/top/screen.c Sat Jun 2 21:40:45 2018 (r334540) > @@ -3,7 +3,7 @@ > * Version 3 > * > * This program may be freely redistributed, > - * but this entire comment MUST remain intact. > + * but this entire ceomment MUST remain intact. I know you have already fixed this spelling error, but I believe there are some other commits that actually removed either this string, or some part of "this entire" comment that is to "remain intact". Regards, -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sat Jun 2 23:56:48 2018 Return-Path: Delivered-To: svn-src-head@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 68E2AFD22DF; Sat, 2 Jun 2018 23:56:48 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.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 B67C981A71; Sat, 2 Jun 2018 23:56:47 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w52Nuj99088666; Sat, 2 Jun 2018 16:56:45 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w52NuiFK088665; Sat, 2 Jun 2018 16:56:44 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201806022356.w52NuiFK088665@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r334543 - head/usr.bin/top In-Reply-To: <201806022206.w52M6S98020830@repo.freebsd.org> To: Eitan Adler Date: Sat, 2 Jun 2018 16:56:44 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 23:56:48 -0000 > Author: eadler > Date: Sat Jun 2 22:06:27 2018 > New Revision: 334543 > URL: https://svnweb.freebsd.org/changeset/base/334543 > > Log: > top(1): chdir to / as init; remove unneeded comment > > - chdir to / to allow unmounting of wd > - remove warning about running top(1) as setuid. If this is a concern we > should just drop privs instead. > > Modified: > head/usr.bin/top/machine.c > head/usr.bin/top/top.c > > Modified: head/usr.bin/top/machine.c > ============================================================================== > --- head/usr.bin/top/machine.c Sat Jun 2 21:50:00 2018 (r334542) > +++ head/usr.bin/top/machine.c Sat Jun 2 22:06:27 2018 (r334543) > @@ -1613,11 +1613,6 @@ compare_ivcsw(const void *arg1, const void *arg2) > /* > * proc_owner(pid) - returns the uid that owns process "pid", or -1 if > * the process does not exist. > - * It is EXTREMELY IMPORTANT that this function work correctly. > - * If top runs setuid root (as in SVR4), then this function > - * is the only thing that stands in the way of a serious > - * security problem. It validates requests for the "kill" > - * and "renice" commands. > */ > > int > > Modified: head/usr.bin/top/top.c > ============================================================================== > --- head/usr.bin/top/top.c Sat Jun 2 21:50:00 2018 (r334542) > +++ head/usr.bin/top/top.c Sat Jun 2 22:06:27 2018 (r334543) > @@ -260,6 +260,15 @@ main(int argc, char *argv[]) > #define CMD_order 26 > #define CMD_pid 27 > > + /* > + * Since top(1) is often long running and > + * doesn't typically care about where its running from > + * chdir to the root to allow unmounting of its > + * originall wd. Failure is alright as this is > + * just a courtesy for users. > + */ > + chdir("/"); > + Bad side effect of doing that is it is not hard to get a "core" from top when run as a user, as it is going to try to write to /, and it probably does not have permission for that. Better might be a cd to /tmp, or /var/tmp, which are usually hard to unmount for these reasons anyway. > /* set the buffer for stdout */ > #ifdef DEBUG > extern FILE *debug; > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sat Jun 2 23:58:46 2018 Return-Path: Delivered-To: svn-src-head@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 114D9FD2930; Sat, 2 Jun 2018 23:58:46 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.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 67B1281C7E; Sat, 2 Jun 2018 23:58:45 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w52NwgZX088679; Sat, 2 Jun 2018 16:58:42 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w52NwgB1088678; Sat, 2 Jun 2018 16:58:42 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201806022358.w52NwgB1088678@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r334543 - head/usr.bin/top In-Reply-To: <201806022356.w52NuiFK088665@pdx.rh.CN85.dnsmgr.net> To: rgrimes@freebsd.org Date: Sat, 2 Jun 2018 16:58:42 -0700 (PDT) CC: Eitan Adler , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 23:58:46 -0000 > > Author: eadler > > Date: Sat Jun 2 22:06:27 2018 > > New Revision: 334543 > > URL: https://svnweb.freebsd.org/changeset/base/334543 > > > > Log: > > top(1): chdir to / as init; remove unneeded comment > > > > - chdir to / to allow unmounting of wd > > - remove warning about running top(1) as setuid. If this is a concern we > > should just drop privs instead. > > > > Modified: > > head/usr.bin/top/machine.c > > head/usr.bin/top/top.c > > > > Modified: head/usr.bin/top/machine.c > > ============================================================================== > > --- head/usr.bin/top/machine.c Sat Jun 2 21:50:00 2018 (r334542) > > +++ head/usr.bin/top/machine.c Sat Jun 2 22:06:27 2018 (r334543) > > @@ -1613,11 +1613,6 @@ compare_ivcsw(const void *arg1, const void *arg2) > > /* > > * proc_owner(pid) - returns the uid that owns process "pid", or -1 if > > * the process does not exist. > > - * It is EXTREMELY IMPORTANT that this function work correctly. > > - * If top runs setuid root (as in SVR4), then this function > > - * is the only thing that stands in the way of a serious > > - * security problem. It validates requests for the "kill" > > - * and "renice" commands. > > */ > > > > int > > > > Modified: head/usr.bin/top/top.c > > ============================================================================== > > --- head/usr.bin/top/top.c Sat Jun 2 21:50:00 2018 (r334542) > > +++ head/usr.bin/top/top.c Sat Jun 2 22:06:27 2018 (r334543) > > @@ -260,6 +260,15 @@ main(int argc, char *argv[]) > > #define CMD_order 26 > > #define CMD_pid 27 > > > > + /* > > + * Since top(1) is often long running and > > + * doesn't typically care about where its running from > > + * chdir to the root to allow unmounting of its > > + * originall wd. Failure is alright as this is > > + * just a courtesy for users. > > + */ > > + chdir("/"); > > + > > Bad side effect of doing that is it is not hard to get a "core" ^^^ now > from top when run as a user, as it is going to try to write > to /, and it probably does not have permission for that. > > Better might be a cd to /tmp, or /var/tmp, which are usually > hard to unmount for these reasons anyway. > > > /* set the buffer for stdout */ > > #ifdef DEBUG > > extern FILE *debug; > > > > > > -- > Rod Grimes rgrimes@freebsd.org > > -- Rod Grimes rgrimes@freebsd.org