From owner-svn-src-head@freebsd.org Sun Oct 27 05:32:09 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 793FF15FE05; Sun, 27 Oct 2019 05:32:09 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4716152cdcz4LhJ; Sun, 27 Oct 2019 05:32:09 +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 3E7501CA43; Sun, 27 Oct 2019 05:32:09 +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 x9R5W9bY083554; Sun, 27 Oct 2019 05:32:09 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9R5W8GS083551; Sun, 27 Oct 2019 05:32:08 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910270532.x9R5W8GS083551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 27 Oct 2019 05:32:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354126 - in head: etc/mtree lib/libexecinfo lib/libexecinfo/tests X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: etc/mtree lib/libexecinfo lib/libexecinfo/tests X-SVN-Commit-Revision: 354126 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Oct 2019 05:32:09 -0000 Author: cem Date: Sun Oct 27 05:32:08 2019 New Revision: 354126 URL: https://svnweb.freebsd.org/changeset/base/354126 Log: libexecinfo: Integrate NetBSD test into FreeBSD Added: head/lib/libexecinfo/tests/ head/lib/libexecinfo/tests/Makefile (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/lib/libexecinfo/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Sun Oct 27 04:10:49 2019 (r354125) +++ head/etc/mtree/BSD.tests.dist Sun Oct 27 05:32:08 2019 (r354126) @@ -384,6 +384,8 @@ .. libdevdctl .. + libexecinfo + .. libkvm .. libmp Modified: head/lib/libexecinfo/Makefile ============================================================================== --- head/lib/libexecinfo/Makefile Sun Oct 27 04:10:49 2019 (r354125) +++ head/lib/libexecinfo/Makefile Sun Oct 27 05:32:08 2019 (r354126) @@ -1,12 +1,13 @@ # $FreeBSD$ PACKAGE=lib${LIB} -LIBEXECINFO= ${SRCTOP}/contrib/libexecinfo +.include + LIB= execinfo SHLIB_MAJOR= 1 -.PATH: ${LIBEXECINFO} +.PATH: ${SRCTOP}/contrib/libexecinfo INCS= execinfo.h SRCS= backtrace.c symtab.c unwind.c @@ -20,5 +21,8 @@ MLINKS+= backtrace.3 backtrace_symbols.3 MLINKS+= backtrace.3 backtrace_symbols_fmt.3 MLINKS+= backtrace.3 backtrace_symbols_fd.3 MLINKS+= backtrace.3 backtrace_symbols_fd_fmt.3 + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Added: head/lib/libexecinfo/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libexecinfo/tests/Makefile Sun Oct 27 05:32:08 2019 (r354126) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +PACKAGE= tests + +TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libexecinfo + +.include + +NETBSD_ATF_TESTS_C+= backtrace_test + +LIBADD.backtrace_test+= execinfo + +.include + +.include From owner-svn-src-head@freebsd.org Sun Oct 27 08:35:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D99BD167464; Sun, 27 Oct 2019 08:35:29 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 471B4d5PGTz4TV9; Sun, 27 Oct 2019 08:35:29 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CA931EA30; Sun, 27 Oct 2019 08:35:29 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9R8ZTMc090604; Sun, 27 Oct 2019 08:35:29 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9R8ZT0e090602; Sun, 27 Oct 2019 08:35:29 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201910270835.x9R8ZT0e090602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 27 Oct 2019 08:35:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354127 - head/sys/cddl/boot/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/sys/cddl/boot/zfs X-SVN-Commit-Revision: 354127 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Oct 2019 08:35:29 -0000 Author: tsoome Date: Sun Oct 27 08:35:29 2019 New Revision: 354127 URL: https://svnweb.freebsd.org/changeset/base/354127 Log: loader: zio_checksum_verify should check byteswap We do have both native and byteswap checksum callbacks in place but the selection is not wired. MFC after: 1 week Modified: head/sys/cddl/boot/zfs/zfsimpl.h head/sys/cddl/boot/zfs/zfssubr.c Modified: head/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- head/sys/cddl/boot/zfs/zfsimpl.h Sun Oct 27 05:32:08 2019 (r354126) +++ head/sys/cddl/boot/zfs/zfsimpl.h Sun Oct 27 08:35:29 2019 (r354127) @@ -442,6 +442,13 @@ _NOTE(CONSTCOND) } while (0) ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \ } +#if BYTE_ORDER == _BIG_ENDIAN +#define ZFS_HOST_BYTEORDER (0ULL) +#else +#define ZFS_HOST_BYTEORDER (1ULL) +#endif + +#define BP_SHOULD_BYTESWAP(bp) (BP_GET_BYTEORDER(bp) != ZFS_HOST_BYTEORDER) #define BPE_NUM_WORDS 14 #define BPE_PAYLOAD_SIZE (BPE_NUM_WORDS * sizeof (uint64_t)) #define BPE_IS_PAYLOADWORD(bp, wp) \ Modified: head/sys/cddl/boot/zfs/zfssubr.c ============================================================================== --- head/sys/cddl/boot/zfs/zfssubr.c Sun Oct 27 05:32:08 2019 (r354126) +++ head/sys/cddl/boot/zfs/zfssubr.c Sun Oct 27 08:35:29 2019 (r354127) @@ -318,8 +318,9 @@ zio_checksum_verify(const spa_t *spa, const blkptr_t * byteswap_uint64_array(&expected_cksum, sizeof (zio_cksum_t)); } else { + byteswap = BP_SHOULD_BYTESWAP(bp); expected_cksum = bp->blk_cksum; - ci->ci_func[0](data, size, ctx, &actual_cksum); + ci->ci_func[byteswap](data, size, ctx, &actual_cksum); } if (!ZIO_CHECKSUM_EQUAL(actual_cksum, expected_cksum)) { From owner-svn-src-head@freebsd.org Sun Oct 27 16:59:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D544F17EA17; Sun, 27 Oct 2019 16:59:34 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 471PGG5KX8z3Q6W; Sun, 27 Oct 2019 16:59:34 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id A987114C8B; Sun, 27 Oct 2019 16:59:34 +0000 (UTC) Date: Sun, 27 Oct 2019 16:59:34 +0000 From: Alexey Dokuchaev To: Dimitry Andric Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Enji Cooper Subject: Re: svn commit: r353937 - in head/share: man/man5 mk Message-ID: <20191027165934.GA54960@FreeBSD.org> References: <201910231702.x9NH2jQv045130@repo.freebsd.org> <2B855247-5097-442D-8D4A-77D68D2F6186@gmail.com> <20191024124910.GA93913@FreeBSD.org> <67F6BDD3-B633-4C85-AE85-9B075FF0E49E@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <67F6BDD3-B633-4C85-AE85-9B075FF0E49E@FreeBSD.org> User-Agent: Mutt/1.11.4 (2019-03-13) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Oct 2019 16:59:34 -0000 On Sat, Oct 26, 2019 at 04:34:14PM +0200, Dimitry Andric wrote: > > On 24 Oct 2019, at 14:49, Alexey Dokuchaev wrote: > > What are the benefits of the new order? > > The advantages and disadvantages of dynamic linking are a contentious > and almost religious issue, so I hope you don't mind that I will not go > into this. OK. :-) > > What about those of us who cannot use BEs, VMs, and other "cloudy" > > tech because, well, they might not work as well and reliably as one > > might think? > > There are many possibilities, such as making backups, using > WITHOUT_SHARED_TOOLCHAIN (and hoping that you can compile/link your way > out of a botched installation), or even using NO_SHARED. WITHOUT_SHARED_TOOLCHAIN sounds good, I hope it won't go away one day. > > Very good point. [about regressed performance] > > But if you take this point to its logical conclusion, then you should > link everything statically, and never use dynamic linking at all. :) Toolchain is special: many people prefer (or have to) build their ports and stuff; even those who prefer binary packages may need to test their ports in a tinderbox or p*re. In other words, I don't mind Firefox being dynalinked because I launch it once a month, contrary to the compiler. > I only tested -j24 on a 32-core system, but I could probably repeat the > experiment with lower and higher -j values: [...] > > So ~2.3% difference in real time, which is not too bad I think. Well, I'd say it's acceptable. :-/ > There are probably opportunities to improve the performance of the > dynamic linker, which would be beneficial to every program in the > system. Now that's a good point; I look forward to it! Thanks for replying, ./danfe From owner-svn-src-head@freebsd.org Sun Oct 27 17:03:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B2FE17ECB5; Sun, 27 Oct 2019 17:03:57 +0000 (UTC) (envelope-from SRS0=VToT=YU=vega.codepro.be=kp@codepro.be) Received: from mercury.codepro.be (mercury.codepro.be [IPv6:2001:4b98:dc0:41:216:3eff:fe31:eda8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "monitoring.codepro.be", Issuer "Let's Encrypt Authority X3" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 471PMK1pM9z3QV7; Sun, 27 Oct 2019 17:03:56 +0000 (UTC) (envelope-from SRS0=VToT=YU=vega.codepro.be=kp@codepro.be) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) by mercury.codepro.be (Postfix) with ESMTPS id C98719048D; Sun, 27 Oct 2019 17:02:21 +0000 (UTC) Received: from vega.codepro.be (unknown [172.16.1.3]) by venus.codepro.be (Postfix) with ESMTP id 5A85623381; Sun, 27 Oct 2019 18:03:54 +0100 (CET) Received: by vega.codepro.be (Postfix, from userid 1001) id 550A6538FE; Sun, 27 Oct 2019 18:03:54 +0100 (CET) Date: Sun, 27 Oct 2019 18:03:54 +0100 From: Kristof Provost To: "Bjoern A. Zeeb" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354121 - in head/tests/sys/netpfil: common pf Message-ID: <20191027170354.GA10284@vega.codepro.be> References: <201910262119.x9QLJtF2086963@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201910262119.x9QLJtF2086963@repo.freebsd.org> X-Checked-By-NSA: Probably User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 471PMK1pM9z3QV7 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.990,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Oct 2019 17:03:57 -0000 On 2019-10-26 21:19:55 (+0000), Bjoern A. Zeeb wrote: > Author: bz > Date: Sat Oct 26 21:19:55 2019 > New Revision: 354121 > URL: https://svnweb.freebsd.org/changeset/base/354121 > > Log: > Upgrade (scapy) py2 tests to work on py3. > > In order to move python2 out of the test framework to avoid py2 vs. py3 > confusions upgrade the remaining test cases using scapy to work with py3. > That means only one version of scapy needs to be installed in the CI system. > It also gives a path forward for testing i386 issues observed in the CI > system with some of these tests. > > Fixes are: > - Use default python from environment (which is 3.x these days). > - properly ident some lines as common for the rest of the file to avoid > errors. > - cast the calculated offset to an int as the division result is considered > a float which is not accepted input. > - when comparing payload to a magic number make sure we always add the > payload properly to the packet and do not try to compare string in > the result but convert the data payload back into an integer. > - fix print formating. > > Discussed with: lwhsu, kp (taking it off his todo :) Thank you! Kristof From owner-svn-src-head@freebsd.org Sun Oct 27 18:27:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B7BFA1A1F8B; Sun, 27 Oct 2019 18:27:25 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 471RCd4SQRz40VW; Sun, 27 Oct 2019 18:27:25 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C22B25329; Sun, 27 Oct 2019 18:27:25 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9RIRPoM042137; Sun, 27 Oct 2019 18:27:25 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9RIRPeW042136; Sun, 27 Oct 2019 18:27:25 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201910271827.x9RIRPeW042136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 27 Oct 2019 18:27:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354129 - head/libexec/rc X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/libexec/rc X-SVN-Commit-Revision: 354129 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Oct 2019 18:27:25 -0000 Author: cy Date: Sun Oct 27 18:27:25 2019 New Revision: 354129 URL: https://svnweb.freebsd.org/changeset/base/354129 Log: Remove trailing tab. MFC after: 3 days Modified: head/libexec/rc/rc.subr Modified: head/libexec/rc/rc.subr ============================================================================== --- head/libexec/rc/rc.subr Sun Oct 27 09:28:33 2019 (r354128) +++ head/libexec/rc/rc.subr Sun Oct 27 18:27:25 2019 (r354129) @@ -1281,7 +1281,7 @@ $command $rc_flags $command_args" ${PROTECT} -p ${pid} ;; esac - fi + fi ;; esac From owner-svn-src-head@freebsd.org Sun Oct 27 21:07:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F334E1A70C3; Sun, 27 Oct 2019 21:07:50 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 471Vmk6DDyz48ZV; Sun, 27 Oct 2019 21:07:50 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4342270CF; Sun, 27 Oct 2019 21:07:50 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9RL7oYr037380; Sun, 27 Oct 2019 21:07:50 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9RL7o7P037379; Sun, 27 Oct 2019 21:07:50 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201910272107.x9RL7o7P037379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Sun, 27 Oct 2019 21:07:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354130 - head/tests/sys/netpfil/common X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/tests/sys/netpfil/common X-SVN-Commit-Revision: 354130 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Oct 2019 21:07:51 -0000 Author: lwhsu Date: Sun Oct 27 21:07:50 2019 New Revision: 354130 URL: https://svnweb.freebsd.org/changeset/base/354130 Log: Follow r354121 to fix some python3 errors in sys.netpfil.* stderr: Traceback (most recent call last): File "/usr/tests/sys/netpfil/common/pft_ping.py", line 135, in main() File "/usr/tests/sys/netpfil/common/pft_ping.py", line 124, in main ping(args.sendif[0], args.to[0], args) File "/usr/tests/sys/netpfil/common/pft_ping.py", line 74, in ping raw = sp.raw(str(PAYLOAD_MAGIC)) File "/usr/local/lib/python3.6/site-packages/scapy/compat.py", line 52, in raw return bytes(x) TypeError: string argument without an encoding MFC with: r354121 Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/netpfil/common/pft_ping.py Modified: head/tests/sys/netpfil/common/pft_ping.py ============================================================================== --- head/tests/sys/netpfil/common/pft_ping.py Sun Oct 27 18:27:25 2019 (r354129) +++ head/tests/sys/netpfil/common/pft_ping.py Sun Oct 27 21:07:50 2019 (r354130) @@ -5,7 +5,7 @@ import scapy.all as sp import sys from sniffer import Sniffer -PAYLOAD_MAGIC = 0x42c0ffee +PAYLOAD_MAGIC = bytes.fromhex('42c0ffee') def check_ping_request(args, packet): if args.ip6: @@ -34,7 +34,7 @@ def check_ping4_request(args, packet): raw = packet.getlayer(sp.Raw) if not raw: return False - if int(raw.load) != PAYLOAD_MAGIC: + if raw.load != PAYLOAD_MAGIC: return False # Wait to check expectations until we've established this is the packet we @@ -62,7 +62,7 @@ def check_ping6_request(args, packet): icmp = packet.getlayer(sp.ICMPv6EchoRequest) if not icmp: return False - if int(icmp.data) != PAYLOAD_MAGIC: + if icmp.data != PAYLOAD_MAGIC: return False return True @@ -71,7 +71,7 @@ def ping(send_if, dst_ip, args): ether = sp.Ether() ip = sp.IP(dst=dst_ip) icmp = sp.ICMP(type='echo-request') - raw = sp.raw(str(PAYLOAD_MAGIC)) + raw = sp.raw(PAYLOAD_MAGIC) if args.send_tos: ip.tos = int(args.send_tos[0]) @@ -82,7 +82,7 @@ def ping(send_if, dst_ip, args): def ping6(send_if, dst_ip, args): ether = sp.Ether() ip6 = sp.IPv6(dst=dst_ip) - icmp = sp.ICMPv6EchoRequest(data=sp.raw(str(PAYLOAD_MAGIC))) + icmp = sp.ICMPv6EchoRequest(data=sp.raw(PAYLOAD_MAGIC)) req = ether / ip6 / icmp sp.sendp(req, iface=send_if, verbose=False) From owner-svn-src-head@freebsd.org Mon Oct 28 10:50:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7ACCC17DCED; Mon, 28 Oct 2019 10:50:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 471s262L4Wz3JJf; Mon, 28 Oct 2019 10:50:38 +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 3372C8632; Mon, 28 Oct 2019 10:50:38 +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 x9SAobch019733; Mon, 28 Oct 2019 10:50:37 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9SAobaC019732; Mon, 28 Oct 2019 10:50:37 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910281050.x9SAobaC019732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 28 Oct 2019 10:50:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354132 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 354132 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2019 10:50:38 -0000 Author: kib Date: Mon Oct 28 10:50:37 2019 New Revision: 354132 URL: https://svnweb.freebsd.org/changeset/base/354132 Log: Fix reset of the kernel stack pointer in TSS for !PTI case on pmap activation after r354095. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Oct 28 01:44:31 2019 (r354131) +++ head/sys/amd64/amd64/pmap.c Mon Oct 28 10:50:37 2019 (r354132) @@ -8650,7 +8650,7 @@ pmap_activate_sw_pti_post(struct thread *td, pmap_t pm { PCPU_GET(tssp)->tss_rsp0 = pmap->pm_ucr3 != PMAP_NO_CR3 ? - PCPU_GET(pti_rsp0) : (uintptr_t)td->td_pcb; + PCPU_GET(pti_rsp0) : (uintptr_t)td->td_md.md_stack_base; } static void inline From owner-svn-src-head@freebsd.org Mon Oct 28 17:12:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 902011A7DB9; Mon, 28 Oct 2019 17:12:46 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4721W23BmCz4J5t; Mon, 28 Oct 2019 17:12:46 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52887CC73; Mon, 28 Oct 2019 17:12:46 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9SHCkIN054302; Mon, 28 Oct 2019 17:12:46 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9SHCk2o054301; Mon, 28 Oct 2019 17:12:46 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910281712.x9SHCk2o054301@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 28 Oct 2019 17:12:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354135 - head/contrib/netbsd-tests/lib/libexecinfo X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/contrib/netbsd-tests/lib/libexecinfo X-SVN-Commit-Revision: 354135 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2019 17:12:46 -0000 Author: cem Date: Mon Oct 28 17:12:45 2019 New Revision: 354135 URL: https://svnweb.freebsd.org/changeset/base/354135 Log: Remove bogus requirement from libexecinfo test The bogus requirement was causing CI infrastructure (which does not mount procfs) to skip the test. Procfs has not been needed by libexecinfo on FreeBSD (nor NetBSD) for years. Both now use a sysctl to obtain the path to the current process image. X-MFC-With: r354126 Modified: head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Modified: head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c ============================================================================== --- head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Mon Oct 28 13:06:01 2019 (r354134) +++ head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Mon Oct 28 17:12:45 2019 (r354135) @@ -147,7 +147,6 @@ ATF_TC(backtrace_fmt_basic); ATF_TC_HEAD(backtrace_fmt_basic, tc) { atf_tc_set_md_var(tc, "descr", "Test backtrace_fmt(3)"); - atf_tc_set_md_var(tc, "require.files", "/proc/self"); } ATF_TC_BODY(backtrace_fmt_basic, tc) From owner-svn-src-head@freebsd.org Mon Oct 28 19:00:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 09A8115A372; Mon, 28 Oct 2019 19:00:28 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4723vH674Zz4NVL; Mon, 28 Oct 2019 19:00:27 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6DBCDEAC; Mon, 28 Oct 2019 19:00:27 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9SJ0Rwq013395; Mon, 28 Oct 2019 19:00:27 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9SJ0ROC013394; Mon, 28 Oct 2019 19:00:27 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201910281900.x9SJ0ROC013394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Mon, 28 Oct 2019 19:00:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354137 - head/sys/dev/netmap X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/sys/dev/netmap X-SVN-Commit-Revision: 354137 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2019 19:00:28 -0000 Author: vmaffione Date: Mon Oct 28 19:00:27 2019 New Revision: 354137 URL: https://svnweb.freebsd.org/changeset/base/354137 Log: netmap: enter NET_EPOCH on generic txsync After r353292, netmap generic adapter on if_vlan interfaces panics on asserting the NET_EPOCH. In more detail, this happens when nm_os_generic_xmit_frame() is called, that is in the generic txsync routine. Fix the issue by entering the NET_EPOCH during the generic txsync. We amortize the cost of entering/exiting over a whole batch of transmissions. PR: 241489 Reported by: Aleksandr Fedorov Modified: head/sys/dev/netmap/netmap_generic.c Modified: head/sys/dev/netmap/netmap_generic.c ============================================================================== --- head/sys/dev/netmap/netmap_generic.c Mon Oct 28 18:37:32 2019 (r354136) +++ head/sys/dev/netmap/netmap_generic.c Mon Oct 28 19:00:27 2019 (r354137) @@ -669,7 +669,12 @@ generic_netmap_txsync(struct netmap_kring *kring, int if (nm_i != head) { /* we have new packets to send */ struct nm_os_gen_arg a; u_int event = -1; +#ifdef __FreeBSD__ + struct epoch_tracker et; + NET_EPOCH_ENTER(et); +#endif + if (gna->txqdisc && nm_kr_txempty(kring)) { /* In txqdisc mode, we ask for a delayed notification, * but only when cur == hwtail, which means that the @@ -776,6 +781,10 @@ generic_netmap_txsync(struct netmap_kring *kring, int /* Update hwcur to the next slot to transmit. Here nm_i * is not necessarily head, we could break early. */ kring->nr_hwcur = nm_i; + +#ifdef __FreeBSD__ + NET_EPOCH_EXIT(et); +#endif } /* From owner-svn-src-head@freebsd.org Mon Oct 28 20:45:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6225615C958; Mon, 28 Oct 2019 20:45:30 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4726DV21mQz4TQg; Mon, 28 Oct 2019 20:45:30 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 28B91F24F; Mon, 28 Oct 2019 20:45:30 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9SKjUpA077837; Mon, 28 Oct 2019 20:45:30 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9SKjTpO077834; Mon, 28 Oct 2019 20:45:29 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201910282045.x9SKjTpO077834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Mon, 28 Oct 2019 20:45:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354138 - in head: . tools/build X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in head: . tools/build X-SVN-Commit-Revision: 354138 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2019 20:45:30 -0000 Author: sjg Date: Mon Oct 28 20:45:29 2019 New Revision: 354138 URL: https://svnweb.freebsd.org/changeset/base/354138 Log: Building head on stable/11 requires libzstd Add lib/libzstd to _elftoolchain_libs tools/build/Makefile needs to create the install dir for libzstd Since this would make the line too long, rework to use a list in one per line format (easier to add in future) and dispense with the .for loop Reviewed by: emaste bapt Differential Revision: https://reviews.freebsd.org/D220134 Modified: head/Makefile.inc1 head/tools/build/Makefile Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Oct 28 19:00:27 2019 (r354137) +++ head/Makefile.inc1 Mon Oct 28 20:45:29 2019 (r354138) @@ -1697,7 +1697,7 @@ buildkernel: .MAKE .PHONY @echo "--------------------------------------------------------------" @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" @echo "--------------------------------------------------------------" - + .endfor @seconds=$$(($$(date '+%s') - ${_BUILDKERNEL_START})); \ echo -n ">>> Kernel(s) ${BUILDKERNELS} built in $$seconds seconds, "; \ @@ -2159,7 +2159,7 @@ _bootstrap_tools_links+=m4 lex # r339083 libelf: correct mips64el test to use ELF header # r348347 Add missing powerpc64 relocation support to libdwarf .if ${BOOTSTRAPPING} < 1300030 -_elftoolchain_libs= lib/libelf lib/libdwarf +_elftoolchain_libs= lib/libelf lib/libdwarf lib/libzstd ${_bt}-lib/libelf: ${_bt_m4_depend} ${_bt}-lib/libdwarf: ${_bt_m4_depend} .endif @@ -2360,7 +2360,6 @@ ${_bt}-link-${_tool}: .PHONY .MAKE fi ${_bt}-links: ${_bt}-link-${_tool} .endfor - bootstrap-tools: ${_bt}-links .PHONY Modified: head/tools/build/Makefile ============================================================================== --- head/tools/build/Makefile Mon Oct 28 19:00:27 2019 (r354137) +++ head/tools/build/Makefile Mon Oct 28 20:45:29 2019 (r354138) @@ -120,10 +120,17 @@ host-symlinks: # Create all the directories that are needed during the legacy, bootstrap-tools # and cross-tools stages. We do this here using mkdir since mtree may not exist # yet (this happens if we are crossbuilding from Linux/Mac). +INSTALLDIR_LIST= \ + bin \ + lib/casper \ + lib/geom \ + usr/include/casper \ + usr/include/private/zstd \ + usr/lib \ + installdirs: -.for _dir in bin usr/lib usr/include usr/include/casper lib/geom lib/casper - mkdir -p "${DESTDIR}/${_dir}" -.endfor + mkdir -p ${INSTALLDIR_LIST:S,^,${DESTDIR}/,} + # Link usr/bin, sbin, and usr/sbin to bin so that it doesn't matter whether a # bootstrap tool was added to WORLTMP with a symlink or by building it in the # bootstrap-tools phase. We could also overrride BINDIR when building bootstrap From owner-svn-src-head@freebsd.org Mon Oct 28 21:22:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFEF215D3BF; Mon, 28 Oct 2019 21:22:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47273W46hDz4WVh; Mon, 28 Oct 2019 21:22:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 70E04F9AC; Mon, 28 Oct 2019 21:22:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9SLMlLu002265; Mon, 28 Oct 2019 21:22:47 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9SLMlX7002263; Mon, 28 Oct 2019 21:22:47 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201910282122.x9SLMlX7002263@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 Oct 2019 21:22:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354139 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 354139 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2019 21:22:47 -0000 Author: trasz Date: Mon Oct 28 21:22:46 2019 New Revision: 354139 URL: https://svnweb.freebsd.org/changeset/base/354139 Log: Document the fact that Linux binaries depend on pty(4). The source part of the review will be addressed in a different way. Reviewed by: emaste, brooks MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21492 Modified: head/share/man/man4/linux.4 head/share/man/man4/pty.4 Modified: head/share/man/man4/linux.4 ============================================================================== --- head/share/man/man4/linux.4 Mon Oct 28 20:45:29 2019 (r354138) +++ head/share/man/man4/linux.4 Mon Oct 28 21:22:46 2019 (r354139) @@ -139,6 +139,7 @@ limited Linux system file system .El .Sh SEE ALSO .Xr brandelf 1 , +.Xr pty 4 , .Xr elf 5 , .Xr fdescfs 5 , .Xr linprocfs 5 , Modified: head/share/man/man4/pty.4 ============================================================================== --- head/share/man/man4/pty.4 Mon Oct 28 20:45:29 2019 (r354138) +++ head/share/man/man4/pty.4 Mon Oct 28 21:22:46 2019 (r354139) @@ -27,19 +27,21 @@ .\" .\" $FreeBSD$ .\" -.Dd August 20, 2008 +.Dd October 28, 2019 .Dt PTY 4 .Os .Sh NAME .Nm pty -.Nd BSD-style and System V-style compatibility pseudo-terminal driver +.Nd old-style compatibility pseudo-terminal driver .Sh SYNOPSIS .Cd "device pty" .Sh DESCRIPTION The .Nm driver provides support for the traditional BSD naming scheme that was -used for accessing pseudo-terminals. +used for accessing pseudo-terminals before it was replaced by +.Xr pts 4 . +This traditional naming is still used in Linux. When the device .Pa /dev/ptyXX is being opened, a new terminal shall be created with the @@ -59,7 +61,8 @@ interface. It is only provided for compatibility with older C libraries that tried to open such devices when .Xr posix_openpt 2 -was being called. +was being called, +and for running Linux binaries. .Sh FILES The BSD-style compatibility pseudo-terminal driver uses the following device names: From owner-svn-src-head@freebsd.org Mon Oct 28 21:48:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C787315DAD7; Mon, 28 Oct 2019 21:48:21 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4727d14lhHz4XQH; Mon, 28 Oct 2019 21:48:21 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82B6AFD72; Mon, 28 Oct 2019 21:48:21 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9SLmLvc013892; Mon, 28 Oct 2019 21:48:21 GMT (envelope-from jlh@FreeBSD.org) Received: (from jlh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9SLmLkM013891; Mon, 28 Oct 2019 21:48:21 GMT (envelope-from jlh@FreeBSD.org) Message-Id: <201910282148.x9SLmLkM013891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jlh set sender to jlh@FreeBSD.org using -f From: Jeremie Le Hen Date: Mon, 28 Oct 2019 21:48:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354140 - head/usr.bin/fstat X-SVN-Group: head X-SVN-Commit-Author: jlh X-SVN-Commit-Paths: head/usr.bin/fstat X-SVN-Commit-Revision: 354140 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2019 21:48:21 -0000 Author: jlh Date: Mon Oct 28 21:48:20 2019 New Revision: 354140 URL: https://svnweb.freebsd.org/changeset/base/354140 Log: Grammar fix. Reported by: imp Differential Revision: https://reviews.freebsd.org/D21880 Modified: head/usr.bin/fstat/fstat.1 Modified: head/usr.bin/fstat/fstat.1 ============================================================================== --- head/usr.bin/fstat/fstat.1 Mon Oct 28 21:22:46 2019 (r354139) +++ head/usr.bin/fstat/fstat.1 Mon Oct 28 21:48:20 2019 (r354140) @@ -215,7 +215,7 @@ When the .Fl s flag is used, socket endpoint information is shown after the address of the socket. -For internet sockets the local and remote address are shown, separated with +For internet sockets the local and remote addresses are shown, separated with a double arrow (``<->''). For unix/local sockets either the local or remote address is shown, depending on which one is available. From owner-svn-src-head@freebsd.org Mon Oct 28 23:31:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4813215FBF4; Mon, 28 Oct 2019 23:31:23 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4729vv19Bhz4dL9; Mon, 28 Oct 2019 23:31:23 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CC8D19074; Mon, 28 Oct 2019 23:31:23 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9SNVMNh075824; Mon, 28 Oct 2019 23:31:22 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9SNVMk9075822; Mon, 28 Oct 2019 23:31:22 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201910282331.x9SNVMk9075822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Mon, 28 Oct 2019 23:31:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354143 - head/sys/dev/sound/pci/hda X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sys/dev/sound/pci/hda X-SVN-Commit-Revision: 354143 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2019 23:31:23 -0000 Author: scottl Date: Mon Oct 28 23:31:22 2019 New Revision: 354143 URL: https://svnweb.freebsd.org/changeset/base/354143 Log: Add device IDs for the next generation of Intel HDA audio. MFC after: 3 days Modified: head/sys/dev/sound/pci/hda/hdac.c head/sys/dev/sound/pci/hda/hdac.h head/sys/dev/sound/pci/hda/hdacc.c Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Mon Oct 28 22:54:36 2019 (r354142) +++ head/sys/dev/sound/pci/hda/hdac.c Mon Oct 28 23:31:22 2019 (r354143) @@ -103,6 +103,10 @@ static const struct { { HDA_INTEL_KBLKH, "Intel Kaby Lake-H", 0, 0 }, { HDA_INTEL_CFLK, "Intel Coffee Lake", 0, 0 }, { HDA_INTEL_CNLK, "Intel Cannon Lake", 0, 0 }, + { HDA_INTEL_ICLK, "Intel Ice Lake", 0, 0 }, + { HDA_INTEL_CMLKLP, "Intel Comet Lake-LP", 0, 0 }, + { HDA_INTEL_CMLKH, "Intel Comet Lake-H", 0, 0 }, + { HDA_INTEL_GMLK, "Intel Gemini Lake", 0, 0 }, { HDA_INTEL_82801F, "Intel 82801F", 0, 0 }, { HDA_INTEL_63XXESB, "Intel 631x/632xESB", 0, 0 }, { HDA_INTEL_82801G, "Intel 82801G", 0, 0 }, Modified: head/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.h Mon Oct 28 22:54:36 2019 (r354142) +++ head/sys/dev/sound/pci/hda/hdac.h Mon Oct 28 23:31:22 2019 (r354143) @@ -78,6 +78,10 @@ #define HDA_INTEL_KBLKH HDA_MODEL_CONSTRUCT(INTEL, 0xa2f0) #define HDA_INTEL_CFLK HDA_MODEL_CONSTRUCT(INTEL, 0xa348) #define HDA_INTEL_CNLK HDA_MODEL_CONSTRUCT(INTEL, 0x9dc8) +#define HDA_INTEL_ICLK HDA_MODEL_CONSTRUCT(INTEL, 0x34c8) +#define HDA_INTEL_CMLKLP HDA_MODEL_CONSTRUCT(INTEL, 0x02c8) +#define HDA_INTEL_CMLKH HDA_MODEL_CONSTRUCT(INTEL, 0x06c8) +#define HDA_INTEL_GMLK HDA_MODEL_CONSTRUCT(INTEL, 0x3198) #define HDA_INTEL_ALL HDA_MODEL_CONSTRUCT(INTEL, 0xffff) /* Nvidia */ @@ -684,6 +688,7 @@ /* INTEL */ #define HDA_CODEC_INTELIP HDA_CODEC_CONSTRUCT(INTEL, 0x0054) +#define HDA_CODEC_INTELGMLK HDA_CODEC_CONSTRUCT(INTEL, 0x2800) #define HDA_CODEC_INTELBL HDA_CODEC_CONSTRUCT(INTEL, 0x2801) #define HDA_CODEC_INTELCA HDA_CODEC_CONSTRUCT(INTEL, 0x2802) #define HDA_CODEC_INTELEL HDA_CODEC_CONSTRUCT(INTEL, 0x2803) @@ -693,7 +698,11 @@ #define HDA_CODEC_INTELHSW HDA_CODEC_CONSTRUCT(INTEL, 0x2807) #define HDA_CODEC_INTELBDW HDA_CODEC_CONSTRUCT(INTEL, 0x2808) #define HDA_CODEC_INTELSKLK HDA_CODEC_CONSTRUCT(INTEL, 0x2809) +#define HDA_CODEC_INTELBXTN HDA_CODEC_CONSTRUCT(INTEL, 0x280a) #define HDA_CODEC_INTELKBLK HDA_CODEC_CONSTRUCT(INTEL, 0x280b) +#define HDA_CODEC_INTELCNLK HDA_CODEC_CONSTRUCT(INTEL, 0x280c) +#define HDA_CODEC_INTELGMLK1 HDA_CODEC_CONSTRUCT(INTEL, 0x280d) +#define HDA_CODEC_INTELICLK HDA_CODEC_CONSTRUCT(INTEL, 0x280f) #define HDA_CODEC_INTELCL HDA_CODEC_CONSTRUCT(INTEL, 0x29fb) #define HDA_CODEC_INTELXXXX HDA_CODEC_CONSTRUCT(INTEL, 0xffff) Modified: head/sys/dev/sound/pci/hda/hdacc.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdacc.c Mon Oct 28 22:54:36 2019 (r354142) +++ head/sys/dev/sound/pci/hda/hdacc.c Mon Oct 28 23:31:22 2019 (r354143) @@ -370,6 +370,11 @@ static const struct { { HDA_CODEC_INTELSKLK, 0, "Intel Skylake" }, { HDA_CODEC_INTELKBLK, 0, "Intel Kaby Lake" }, { HDA_CODEC_INTELCL, 0, "Intel Crestline" }, + { HDA_CODEC_INTELBXTN, 0, "Intel Broxton" }, + { HDA_CODEC_INTELCNLK, 0, "Intel Cannonlake" }, + { HDA_CODEC_INTELGMLK, 0, "Intel Geminilake" }, + { HDA_CODEC_INTELGMLK1, 0, "Intel Geminilake" }, + { HDA_CODEC_INTELICLK, 0, "Intel Icelake" }, { HDA_CODEC_SII1390, 0, "Silicon Image SiI1390" }, { HDA_CODEC_SII1392, 0, "Silicon Image SiI1392" }, /* Unknown CODECs */ From owner-svn-src-head@freebsd.org Tue Oct 29 04:28:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2016117596D; Tue, 29 Oct 2019 04:28:25 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 472JVc6npdz4051; Tue, 29 Oct 2019 04:28:24 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC3A61C6D0; Tue, 29 Oct 2019 04:28:24 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9T4SOkl050253; Tue, 29 Oct 2019 04:28:24 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9T4SO5I050252; Tue, 29 Oct 2019 04:28:24 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201910290428.x9T4SO5I050252@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 29 Oct 2019 04:28:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354144 - head/contrib/netbsd-tests/lib/libexecinfo X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/contrib/netbsd-tests/lib/libexecinfo X-SVN-Commit-Revision: 354144 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2019 04:28:25 -0000 Author: lwhsu Date: Tue Oct 29 04:28:24 2019 New Revision: 354144 URL: https://svnweb.freebsd.org/changeset/base/354144 Log: Temporarily disable failing case in CI: - lib.libexecinfo.backtrace_test.backtrace_fmt_basic PR: 241562 Sponsored by: The FreeBSD Foundation Modified: head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Modified: head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c ============================================================================== --- head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Mon Oct 28 23:31:22 2019 (r354143) +++ head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Tue Oct 29 04:28:24 2019 (r354144) @@ -151,6 +151,9 @@ ATF_TC_HEAD(backtrace_fmt_basic, tc) ATF_TC_BODY(backtrace_fmt_basic, tc) { + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_skip("https://bugs.freebsd.org/241562"); + myfunc(12); if (prevent_inline) From owner-svn-src-head@freebsd.org Tue Oct 29 07:04:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 321D017C3C8; Tue, 29 Oct 2019 07:04:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 472MyS0XtXz49QG; Tue, 29 Oct 2019 07:04:16 +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 "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id BBDD81AED4; Tue, 29 Oct 2019 07:04:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::3185:9ec5:f0ef:c62] (unknown [IPv6:2001:470:7a58:0:3185:9ec5:f0ef:c62]) (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 8F3384D3D9; Tue, 29 Oct 2019 08:04:13 +0100 (CET) From: Dimitry Andric Message-Id: <0938D185-8BF4-45CD-925E-328F03695518@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_6E4C7B7A-7B2C-477B-85D1-D57CA08D0830"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r353937 - in head/share: man/man5 mk Date: Tue, 29 Oct 2019 08:04:07 +0100 In-Reply-To: <20191027165934.GA54960@FreeBSD.org> Cc: svn-src-head , svn-src-all , src-committers , Enji Cooper To: Alexey Dokuchaev References: <201910231702.x9NH2jQv045130@repo.freebsd.org> <2B855247-5097-442D-8D4A-77D68D2F6186@gmail.com> <20191024124910.GA93913@FreeBSD.org> <67F6BDD3-B633-4C85-AE85-9B075FF0E49E@FreeBSD.org> <20191027165934.GA54960@FreeBSD.org> X-Mailer: Apple Mail (2.3445.104.11) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2019 07:04:16 -0000 --Apple-Mail=_6E4C7B7A-7B2C-477B-85D1-D57CA08D0830 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 27 Oct 2019, at 17:59, Alexey Dokuchaev wrote: > > On Sat, Oct 26, 2019 at 04:34:14PM +0200, Dimitry Andric wrote: ... >> I only tested -j24 on a 32-core system, but I could probably repeat the >> experiment with lower and higher -j values: [...] >> >> So ~2.3% difference in real time, which is not too bad I think. > > Well, I'd say it's acceptable. :-/ I also tested at low (-j4) and high (-j32) levels. It turns out that at low -j levels, the difference is less pronounced, just ~1.1% in real time. And at high -j levels, it is more pronounced, ~4.3% in real time. Note also that at high -j levels, the difference in system time seems to get more influence, e.g. at low -j the difference is ~4.5%, while at high -j the difference is ~7.2%. I guess it is because dynamic linking uses more syscalls. At -j4: Results for real time: --------------------------------------------------------------------------- x j4-static-real.txt + j4-dynamic-real.txt N Min Max Median Avg Stddev x 7 5508.58 5548.05 5533.25 5530.2829 12.323855 + 7 5514.68 5660.1 5591.25 5593.5143 59.98042 Difference at 95.0% confidence 63.2314 +/- 50.4309 1.14337% +/- 0.912329% (Student's t, pooled s = 43.2985) Results for user time: --------------------------------------------------------------------------- x j4-static-user.txt + j4-dynamic-user.txt N Min Max Median Avg Stddev x 7 19525.34 19607.74 19593.1 19582.78 29.037717 + 7 20178.84 20348.11 20214.28 20235.057 57.31409 Difference at 95.0% confidence 652.277 +/- 52.9155 3.33087% +/- 0.272077% (Student's t, pooled s = 45.4318) Results for system time: --------------------------------------------------------------------------- x j4-static-sys.txt + j4-dynamic-sys.txt N Min Max Median Avg Stddev x 7 1622.63 1634.98 1629.87 1629.1229 4.7234017 + 7 1672.25 1722.23 1704.49 1703.1729 15.724862 Difference at 95.0% confidence 74.05 +/- 13.5224 4.54539% +/- 0.833228% (Student's t, pooled s = 11.6099) At -j32: Results for real time: --------------------------------------------------------------------------- x j32-static-real.txt + j32-dynamic-real.txt N Min Max Median Avg Stddev x 7 1689.19 1735.36 1707.32 1707.8471 16.500078 + 7 1754.98 1812.57 1777.96 1781.6329 19.554159 Difference at 95.0% confidence 73.7857 +/- 21.0718 4.32039% +/- 1.25627% (Student's t, pooled s = 18.0917) Results for user time: --------------------------------------------------------------------------- x j32-static-user.txt + j32-dynamic-user.txt N Min Max Median Avg Stddev x 7 38545.36 38802.6 38609.87 38641.009 105.11904 + 7 39430.93 39924.98 39856.91 39769.979 185.3612 Difference at 95.0% confidence 1128.97 +/- 175.5 2.92169% +/- 0.457446% (Student's t, pooled s = 150.68) Results for system time: --------------------------------------------------------------------------- x j32-static-sys.txt + j32-dynamic-sys.txt N Min Max Median Avg Stddev x 7 2752.81 2809.97 2781.46 2781.4986 21.86523 + 7 2906.22 3151.93 2932.59 2981.5757 103.79842 Difference at 95.0% confidence 200.077 +/- 87.3629 7.19314% +/- 3.15079% (Student's t, pooled s = 75.0073) -Dimitry --Apple-Mail=_6E4C7B7A-7B2C-477B-85D1-D57CA08D0830 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 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXbfkZwAKCRCwXqMKLiCW o+dQAJ9VqY02eR4RPIMEH0SVVSrx0YuKrACgpV9MELP+FnIpZGjEFHYJc+/NbdI= =YAIF -----END PGP SIGNATURE----- --Apple-Mail=_6E4C7B7A-7B2C-477B-85D1-D57CA08D0830-- From owner-svn-src-head@freebsd.org Tue Oct 29 07:10:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E3DD17C736; Tue, 29 Oct 2019 07:10:18 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 472N5Q21VCz49nS; Tue, 29 Oct 2019 07:10:18 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 25038EB2F; Tue, 29 Oct 2019 07:10:18 +0000 (UTC) Date: Tue, 29 Oct 2019 07:10:18 +0000 From: Alexey Dokuchaev To: Dimitry Andric Cc: svn-src-head , svn-src-all , src-committers , Enji Cooper Subject: Re: svn commit: r353937 - in head/share: man/man5 mk Message-ID: <20191029071018.GB32637@FreeBSD.org> References: <201910231702.x9NH2jQv045130@repo.freebsd.org> <2B855247-5097-442D-8D4A-77D68D2F6186@gmail.com> <20191024124910.GA93913@FreeBSD.org> <67F6BDD3-B633-4C85-AE85-9B075FF0E49E@FreeBSD.org> <20191027165934.GA54960@FreeBSD.org> <0938D185-8BF4-45CD-925E-328F03695518@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0938D185-8BF4-45CD-925E-328F03695518@FreeBSD.org> User-Agent: Mutt/1.11.4 (2019-03-13) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2019 07:10:18 -0000 On Tue, Oct 29, 2019 at 08:04:07AM +0100, Dimitry Andric wrote: > On 27 Oct 2019, at 17:59, Alexey Dokuchaev wrote: > > > > On Sat, Oct 26, 2019 at 04:34:14PM +0200, Dimitry Andric wrote: > ... > >> I only tested -j24 on a 32-core system, but I could probably repeat the > >> experiment with lower and higher -j values: [...] > >> > >> So ~2.3% difference in real time, which is not too bad I think. > > > > Well, I'd say it's acceptable. :-/ > > I also tested at low (-j4) and high (-j32) levels. It turns out that at > low -j levels, the difference is less pronounced, just ~1.1% in real > time. And at high -j levels, it is more pronounced, ~4.3% in real time. > > Note also that at high -j levels, the difference in system time seems > to get more influence, e.g. at low -j the difference is ~4.5%, while at > high -j the difference is ~7.2%. I guess it is because dynamic linking > uses more syscalls. Yeah, it would be definitely nice if we could optimize runtime linker. Thanks for conducting these tests by the way, much appreciated, Dimitry! ./danfe From owner-svn-src-head@freebsd.org Tue Oct 29 09:47:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31D801A1D52; Tue, 29 Oct 2019 09:47:17 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 472RZY1Jfcz4K69; Tue, 29 Oct 2019 09:47:17 +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 103532015E; Tue, 29 Oct 2019 09:47:17 +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 x9T9lHfL038108; Tue, 29 Oct 2019 09:47:17 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9T9lC5i038086; Tue, 29 Oct 2019 09:47:12 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201910290947.x9T9lC5i038086@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 29 Oct 2019 09:47:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354145 - in head/tests/sys/netpfil: common pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: in head/tests/sys/netpfil: common pf X-SVN-Commit-Revision: 354145 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2019 09:47:17 -0000 Author: kp Date: Tue Oct 29 09:47:12 2019 New Revision: 354145 URL: https://svnweb.freebsd.org/changeset/base/354145 Log: netpfil tests: Add missing copyright & license statements Modified: head/tests/sys/netpfil/common/pft_ping.py head/tests/sys/netpfil/common/sniffer.py head/tests/sys/netpfil/pf/CVE-2019-5597.py head/tests/sys/netpfil/pf/CVE-2019-5598.py head/tests/sys/netpfil/pf/anchor.sh head/tests/sys/netpfil/pf/echo_inetd.conf head/tests/sys/netpfil/pf/forward.sh head/tests/sys/netpfil/pf/fragmentation.sh head/tests/sys/netpfil/pf/icmp.sh head/tests/sys/netpfil/pf/names.sh head/tests/sys/netpfil/pf/nat.sh head/tests/sys/netpfil/pf/pass_block.sh head/tests/sys/netpfil/pf/pfsync.sh head/tests/sys/netpfil/pf/rdr.sh head/tests/sys/netpfil/pf/route_to.sh head/tests/sys/netpfil/pf/set_skip.sh head/tests/sys/netpfil/pf/set_tos.sh head/tests/sys/netpfil/pf/synproxy.sh head/tests/sys/netpfil/pf/utils.subr Modified: head/tests/sys/netpfil/common/pft_ping.py ============================================================================== --- head/tests/sys/netpfil/common/pft_ping.py Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/common/pft_ping.py Tue Oct 29 09:47:12 2019 (r354145) @@ -1,4 +1,30 @@ #!/usr/bin/env python +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2017 Kristof Provost +# +# 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. +# import argparse import scapy.all as sp Modified: head/tests/sys/netpfil/common/sniffer.py ============================================================================== --- head/tests/sys/netpfil/common/sniffer.py Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/common/sniffer.py Tue Oct 29 09:47:12 2019 (r354145) @@ -1,4 +1,30 @@ # $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2017 Kristof Provost +# +# 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. +# import threading import scapy.all as sp Modified: head/tests/sys/netpfil/pf/CVE-2019-5597.py ============================================================================== --- head/tests/sys/netpfil/pf/CVE-2019-5597.py Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/pf/CVE-2019-5597.py Tue Oct 29 09:47:12 2019 (r354145) @@ -1,4 +1,29 @@ #!/usr/bin/env python +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2019 Synacktiv +# +# 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. import random import scapy.all as sp Modified: head/tests/sys/netpfil/pf/CVE-2019-5598.py ============================================================================== --- head/tests/sys/netpfil/pf/CVE-2019-5598.py Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/pf/CVE-2019-5598.py Tue Oct 29 09:47:12 2019 (r354145) @@ -1,4 +1,29 @@ #!/usr/bin/env python +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2019 Kristof Provost +# +# 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. import argparse import scapy.all as sp Modified: head/tests/sys/netpfil/pf/anchor.sh ============================================================================== --- head/tests/sys/netpfil/pf/anchor.sh Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/pf/anchor.sh Tue Oct 29 09:47:12 2019 (r354145) @@ -1,4 +1,29 @@ # $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2018 Kristof Provost +# +# 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. . $(atf_get_srcdir)/utils.subr Modified: head/tests/sys/netpfil/pf/echo_inetd.conf ============================================================================== --- head/tests/sys/netpfil/pf/echo_inetd.conf Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/pf/echo_inetd.conf Tue Oct 29 09:47:12 2019 (r354145) @@ -1,4 +1,29 @@ # $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2019 Kristof Provost +# +# 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. echo stream tcp nowait root internal echo stream tcp6 nowait root internal Modified: head/tests/sys/netpfil/pf/forward.sh ============================================================================== --- head/tests/sys/netpfil/pf/forward.sh Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/pf/forward.sh Tue Oct 29 09:47:12 2019 (r354145) @@ -1,4 +1,29 @@ # $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2017 Kristof Provost +# +# 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. . $(atf_get_srcdir)/utils.subr Modified: head/tests/sys/netpfil/pf/fragmentation.sh ============================================================================== --- head/tests/sys/netpfil/pf/fragmentation.sh Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/pf/fragmentation.sh Tue Oct 29 09:47:12 2019 (r354145) @@ -1,4 +1,29 @@ # $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2017 Kristof Provost +# +# 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. . $(atf_get_srcdir)/utils.subr Modified: head/tests/sys/netpfil/pf/icmp.sh ============================================================================== --- head/tests/sys/netpfil/pf/icmp.sh Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/pf/icmp.sh Tue Oct 29 09:47:12 2019 (r354145) @@ -1,4 +1,29 @@ # $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2019 Kristof Provost +# +# 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. . $(atf_get_srcdir)/utils.subr Modified: head/tests/sys/netpfil/pf/names.sh ============================================================================== --- head/tests/sys/netpfil/pf/names.sh Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/pf/names.sh Tue Oct 29 09:47:12 2019 (r354145) @@ -1,4 +1,29 @@ # $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2018 Kristof Provost +# +# 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. . $(atf_get_srcdir)/utils.subr Modified: head/tests/sys/netpfil/pf/nat.sh ============================================================================== --- head/tests/sys/netpfil/pf/nat.sh Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/pf/nat.sh Tue Oct 29 09:47:12 2019 (r354145) @@ -1,4 +1,29 @@ # $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2018 Kristof Provost +# +# 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. . $(atf_get_srcdir)/utils.subr Modified: head/tests/sys/netpfil/pf/pass_block.sh ============================================================================== --- head/tests/sys/netpfil/pf/pass_block.sh Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/pf/pass_block.sh Tue Oct 29 09:47:12 2019 (r354145) @@ -1,4 +1,29 @@ # $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2018 Kristof Provost +# +# 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. . $(atf_get_srcdir)/utils.subr Modified: head/tests/sys/netpfil/pf/pfsync.sh ============================================================================== --- head/tests/sys/netpfil/pf/pfsync.sh Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/pf/pfsync.sh Tue Oct 29 09:47:12 2019 (r354145) @@ -1,4 +1,29 @@ # $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2018 Orange Business Services +# +# 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. . $(atf_get_srcdir)/utils.subr Modified: head/tests/sys/netpfil/pf/rdr.sh ============================================================================== --- head/tests/sys/netpfil/pf/rdr.sh Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/pf/rdr.sh Tue Oct 29 09:47:12 2019 (r354145) @@ -1,4 +1,29 @@ # $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2018 Kristof Provost +# +# 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. . $(atf_get_srcdir)/utils.subr Modified: head/tests/sys/netpfil/pf/route_to.sh ============================================================================== --- head/tests/sys/netpfil/pf/route_to.sh Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/pf/route_to.sh Tue Oct 29 09:47:12 2019 (r354145) @@ -1,4 +1,29 @@ # $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2018 Kristof Provost +# +# 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. . $(atf_get_srcdir)/utils.subr Modified: head/tests/sys/netpfil/pf/set_skip.sh ============================================================================== --- head/tests/sys/netpfil/pf/set_skip.sh Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/pf/set_skip.sh Tue Oct 29 09:47:12 2019 (r354145) @@ -1,4 +1,29 @@ # $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2018 Kristof Provost +# +# 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. . $(atf_get_srcdir)/utils.subr Modified: head/tests/sys/netpfil/pf/set_tos.sh ============================================================================== --- head/tests/sys/netpfil/pf/set_tos.sh Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/pf/set_tos.sh Tue Oct 29 09:47:12 2019 (r354145) @@ -1,4 +1,29 @@ # $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2017 Kristof Provost +# +# 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. . $(atf_get_srcdir)/utils.subr Modified: head/tests/sys/netpfil/pf/synproxy.sh ============================================================================== --- head/tests/sys/netpfil/pf/synproxy.sh Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/pf/synproxy.sh Tue Oct 29 09:47:12 2019 (r354145) @@ -1,4 +1,29 @@ # $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2018 Kristof Provost +# +# 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. . $(atf_get_srcdir)/utils.subr Modified: head/tests/sys/netpfil/pf/utils.subr ============================================================================== --- head/tests/sys/netpfil/pf/utils.subr Tue Oct 29 04:28:24 2019 (r354144) +++ head/tests/sys/netpfil/pf/utils.subr Tue Oct 29 09:47:12 2019 (r354145) @@ -1,6 +1,30 @@ # $FreeBSD$ # Utility functions ## +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2017 Kristof Provost +# +# 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. . $(atf_get_srcdir)/../../common/vnet.subr From owner-svn-src-head@freebsd.org Tue Oct 29 16:51:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E829915C750; Tue, 29 Oct 2019 16:51:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 472czh5sCxz3Hs9; Tue, 29 Oct 2019 16:51:12 +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 9396924E04; Tue, 29 Oct 2019 16:51:12 +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 x9TGpCTs089283; Tue, 29 Oct 2019 16:51:12 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9TGpC2b089282; Tue, 29 Oct 2019 16:51:12 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910291651.x9TGpC2b089282@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 29 Oct 2019 16:51:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354146 - head/contrib/llvm/lib/TableGen X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/lib/TableGen X-SVN-Commit-Revision: 354146 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2019 16:51:13 -0000 Author: dim Date: Tue Oct 29 16:51:12 2019 New Revision: 354146 URL: https://svnweb.freebsd.org/changeset/base/354146 Log: Pull in r373338 from upstream llvm trunk (by Simon Pilgrim): Revert rL349624 : Let TableGen write output only if it changed, instead of doing so in cmake, attempt 2 Differential Revision: https://reviews.llvm.org/D55842 ----------------- As discussed on PR43385 this is causing Visual Studio msbuilds to perpetually rebuild all tablegen generated files Pull in r373664 from upstream llvm trunk (by Nico Weber): Reland r349624: Let TableGen write output only if it changed, instead of doing so in cmake Move the write-if-changed logic behind a flag and don't pass it with the MSVC generator. msbuild doesn't have a restat optimization, so not doing write-if-change there doesn't have a cost, and it should fix whatever causes PR43385. This should fix the scenario where an incremental build from before r353358 (the clang 9.0.0 upgrade) to r353358 or later fails to update the timestamp of the generated lib/clang/headers/arm_fp16.h header. After such a build, installing world from read-only source and object directories would attempt to generate the header again, leading to "clang-tblgen: error opening arm_fp16.h.d:Read-only file system". Reported by: avg, np PR: 241402 MFC after: 1 month X-MFC-With: r353358 Modified: head/contrib/llvm/lib/TableGen/Main.cpp Modified: head/contrib/llvm/lib/TableGen/Main.cpp ============================================================================== --- head/contrib/llvm/lib/TableGen/Main.cpp Tue Oct 29 09:47:12 2019 (r354145) +++ head/contrib/llvm/lib/TableGen/Main.cpp Tue Oct 29 16:51:12 2019 (r354146) @@ -49,6 +49,9 @@ static cl::list MacroNames("D", cl::desc("Name of the macro to be defined"), cl::value_desc("macro name"), cl::Prefix); +static cl::opt +WriteIfChanged("write-if-changed", cl::desc("Only write output if it changed")); + static int reportError(const char *ProgName, Twine Msg) { errs() << ProgName << ": " << Msg; errs().flush(); @@ -114,12 +117,14 @@ int llvm::TableGenMain(char *argv0, TableGenMainFn *Ma return Ret; } - // Only updates the real output file if there are any differences. - // This prevents recompilation of all the files depending on it if there - // aren't any. - if (auto ExistingOrErr = MemoryBuffer::getFile(OutputFilename)) - if (std::move(ExistingOrErr.get())->getBuffer() == Out.str()) - return 0; + if (WriteIfChanged) { + // Only updates the real output file if there are any differences. + // This prevents recompilation of all the files depending on it if there + // aren't any. + if (auto ExistingOrErr = MemoryBuffer::getFile(OutputFilename)) + if (std::move(ExistingOrErr.get())->getBuffer() == Out.str()) + return 0; + } std::error_code EC; ToolOutputFile OutFile(OutputFilename, EC, sys::fs::F_Text); From owner-svn-src-head@freebsd.org Tue Oct 29 17:19:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D9F715DC38; Tue, 29 Oct 2019 17:19:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 472dcS752Qz3Kjc; Tue, 29 Oct 2019 17:19:36 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D28C225232; Tue, 29 Oct 2019 17:19:36 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9THJatW006901; Tue, 29 Oct 2019 17:19:36 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9THJaIf006900; Tue, 29 Oct 2019 17:19:36 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910291719.x9THJaIf006900@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 29 Oct 2019 17:19:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354147 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 354147 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2019 17:19:37 -0000 Author: glebius Date: Tue Oct 29 17:19:36 2019 New Revision: 354147 URL: https://svnweb.freebsd.org/changeset/base/354147 Log: Augment macros that manipulate td_no_sleeping with assertions to check underleak and overflow of the counter. Reviewed by: kib Modified: head/sys/sys/proc.h Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Tue Oct 29 16:51:12 2019 (r354146) +++ head/sys/sys/proc.h Tue Oct 29 17:19:36 2019 (r354147) @@ -246,8 +246,7 @@ struct thread { u_char td_lend_user_pri; /* (t) Lend user pri. */ /* Cleared during fork1() */ -#define td_startzero td_epochnest - u_char td_epochnest; /* (k) Epoch nest counter. */ +#define td_startzero td_flags int td_flags; /* (t) TDF_* flags. */ int td_inhibitors; /* (t) Why can not run. */ int td_pflags; /* (k) Private thread (TDP_*) flags. */ @@ -299,7 +298,7 @@ struct thread { struct vm_map_entry *td_map_def_user; /* (k) Deferred entries. */ pid_t td_dbg_forked; /* (c) Child pid for debugger. */ u_int td_vp_reserv; /* (k) Count of reserved vnodes. */ - int td_no_sleeping; /* (k) Sleeping disabled count. */ + u_int td_no_sleeping; /* (k) Sleeping disabled count. */ void *td_su; /* (k) FFS SU private */ sbintime_t td_sleeptimo; /* (t) Sleep timeout. */ int td_rtcgen; /* (s) rtc_generation of abs. sleep */ @@ -948,9 +947,15 @@ extern pid_t pid_max; #define thread_safetoswapout(td) ((td)->td_flags & TDF_CANSWAP) /* Control whether or not it is safe for curthread to sleep. */ -#define THREAD_NO_SLEEPING() ((curthread)->td_no_sleeping++) +#define THREAD_NO_SLEEPING() do { \ + curthread->td_no_sleeping++; \ + MPASS(curthread->td_no_sleeping > 0); \ +} while (0) -#define THREAD_SLEEPING_OK() ((curthread)->td_no_sleeping--) +#define THREAD_SLEEPING_OK() do { \ + MPASS(curthread->td_no_sleeping > 0); \ + curthread->td_no_sleeping--; \ +} while (0) #define THREAD_CAN_SLEEP() ((curthread)->td_no_sleeping == 0) From owner-svn-src-head@freebsd.org Tue Oct 29 17:28:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64CDB15E18D; Tue, 29 Oct 2019 17:28:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 472dpg22NXz3L8v; Tue, 29 Oct 2019 17:28:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2600B253F0; Tue, 29 Oct 2019 17:28:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9THSR5J012455; Tue, 29 Oct 2019 17:28:27 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9THSPYL012449; Tue, 29 Oct 2019 17:28:25 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910291728.x9THSPYL012449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 29 Oct 2019 17:28:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354148 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354148 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2019 17:28:27 -0000 Author: glebius Date: Tue Oct 29 17:28:25 2019 New Revision: 354148 URL: https://svnweb.freebsd.org/changeset/base/354148 Log: Merge td_epochnest with td_no_sleeping. Epoch itself doesn't rely on the counter and it is provided merely for sleeping subsystems to check it. - In functions that sleep use THREAD_CAN_SLEEP() to assert correctness. With EPOCH_TRACE compiled print epoch info. - _sleep() was a wrong place to put the assertion for epoch, right place is sleepq_add(), as there ways to call the latter bypassing _sleep(). - Do not increase td_no_sleeping in non-preemptible epochs. The critical section would trigger all possible safeguards, no sleeping counter is extraneous. Reviewed by: kib Modified: head/sys/kern/genoffset.c head/sys/kern/kern_malloc.c head/sys/kern/kern_synch.c head/sys/kern/subr_epoch.c head/sys/kern/subr_sleepqueue.c head/sys/kern/subr_trap.c Modified: head/sys/kern/genoffset.c ============================================================================== --- head/sys/kern/genoffset.c Tue Oct 29 17:19:36 2019 (r354147) +++ head/sys/kern/genoffset.c Tue Oct 29 17:28:25 2019 (r354148) @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include OFFSYM(td_priority, thread, u_char); -OFFSYM(td_epochnest, thread, u_char); OFFSYM(td_critnest, thread, u_int); OFFSYM(td_pinned, thread, int); OFFSYM(td_owepreempt, thread, u_char); Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Tue Oct 29 17:19:36 2019 (r354147) +++ head/sys/kern/kern_malloc.c Tue Oct 29 17:28:25 2019 (r354148) @@ -523,12 +523,13 @@ malloc_dbg(caddr_t *vap, size_t *sizep, struct malloc_ if (flags & M_WAITOK) { KASSERT(curthread->td_intr_nesting_level == 0, ("malloc(M_WAITOK) in interrupt context")); + if (__predict_false(!THREAD_CAN_SLEEP())) { #ifdef EPOCH_TRACE - if (__predict_false(curthread->td_epochnest > 0)) epoch_trace_list(curthread); #endif - KASSERT(curthread->td_epochnest == 0, - ("malloc(M_WAITOK) in epoch context")); + KASSERT(1, + ("malloc(M_WAITOK) with sleeping prohibited")); + } } KASSERT(curthread->td_critnest == 0 || SCHEDULER_STOPPED(), ("malloc: called with spinlock or critical section held")); Modified: head/sys/kern/kern_synch.c ============================================================================== --- head/sys/kern/kern_synch.c Tue Oct 29 17:19:36 2019 (r354147) +++ head/sys/kern/kern_synch.c Tue Oct 29 17:28:25 2019 (r354148) @@ -151,11 +151,6 @@ _sleep(void *ident, struct lock_object *lock, int prio ("sleeping without a lock")); KASSERT(ident != NULL, ("_sleep: NULL ident")); KASSERT(TD_IS_RUNNING(td), ("_sleep: curthread not running")); -#ifdef EPOCH_TRACE - if (__predict_false(curthread->td_epochnest > 0)) - epoch_trace_list(curthread); -#endif - KASSERT(td->td_epochnest == 0, ("sleeping in an epoch section")); if (priority & PDROP) KASSERT(lock != NULL && lock != &Giant.lock_object, ("PDROP requires a non-Giant lock")); Modified: head/sys/kern/subr_epoch.c ============================================================================== --- head/sys/kern/subr_epoch.c Tue Oct 29 17:19:36 2019 (r354147) +++ head/sys/kern/subr_epoch.c Tue Oct 29 17:28:25 2019 (r354148) @@ -377,7 +377,7 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et epoch_trace_enter(td, epoch, et, file, line); #endif et->et_td = td; - td->td_epochnest++; + THREAD_NO_SLEEPING(); critical_enter(); sched_pin(); td->td_pre_epoch_prio = td->td_priority; @@ -390,13 +390,10 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et void epoch_enter(epoch_t epoch) { - struct thread *td; epoch_record_t er; MPASS(cold || epoch != NULL); INIT_CHECK(epoch); - td = curthread; - td->td_epochnest++; critical_enter(); er = epoch_currecord(epoch); ck_epoch_begin(&er->er_record, NULL); @@ -412,8 +409,7 @@ _epoch_exit_preempt(epoch_t epoch, epoch_tracker_t et td = curthread; critical_enter(); sched_unpin(); - MPASS(td->td_epochnest); - td->td_epochnest--; + THREAD_SLEEPING_OK(); er = epoch_currecord(epoch); MPASS(epoch->e_flags & EPOCH_PREEMPT); MPASS(et != NULL); @@ -435,13 +431,9 @@ _epoch_exit_preempt(epoch_t epoch, epoch_tracker_t et void epoch_exit(epoch_t epoch) { - struct thread *td; epoch_record_t er; INIT_CHECK(epoch); - td = curthread; - MPASS(td->td_epochnest); - td->td_epochnest--; er = epoch_currecord(epoch); ck_epoch_end(&er->er_record, NULL); critical_exit(); @@ -740,7 +732,7 @@ in_epoch_verbose(epoch_t epoch, int dump_onfail) epoch_record_t er; td = curthread; - if (td->td_epochnest == 0) + if (THREAD_CAN_SLEEP()) return (0); if (__predict_false((epoch) == NULL)) return (0); Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Tue Oct 29 17:19:36 2019 (r354147) +++ head/sys/kern/subr_sleepqueue.c Tue Oct 29 17:28:25 2019 (r354148) @@ -80,6 +80,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef EPOCH_TRACE +#include +#endif #include @@ -315,9 +318,14 @@ sleepq_add(void *wchan, struct lock_object *lock, cons MPASS((queue >= 0) && (queue < NR_SLEEPQS)); /* If this thread is not allowed to sleep, die a horrible death. */ - KASSERT(THREAD_CAN_SLEEP(), - ("%s: td %p to sleep on wchan %p with sleeping prohibited", - __func__, td, wchan)); + if (__predict_false(!THREAD_CAN_SLEEP())) { +#ifdef EPOCH_TRACE + epoch_trace_list(curthread); +#endif + KASSERT(1, + ("%s: td %p to sleep on wchan %p with sleeping prohibited", + __func__, td, wchan)); + } /* Look up the sleep queue associated with the wait channel 'wchan'. */ sq = sleepq_lookup(wchan); Modified: head/sys/kern/subr_trap.c ============================================================================== --- head/sys/kern/subr_trap.c Tue Oct 29 17:19:36 2019 (r354147) +++ head/sys/kern/subr_trap.c Tue Oct 29 17:28:25 2019 (r354148) @@ -166,12 +166,6 @@ userret(struct thread *td, struct trapframe *frame) WITNESS_WARN(WARN_PANIC, NULL, "userret: returning"); KASSERT(td->td_critnest == 0, ("userret: Returning in a critical section")); -#ifdef EPOCH_TRACE - if (__predict_false(curthread->td_epochnest > 0)) - epoch_trace_list(curthread); -#endif - KASSERT(td->td_epochnest == 0, - ("userret: Returning in an epoch section")); KASSERT(td->td_locks == 0, ("userret: Returning with %d locks held", td->td_locks)); KASSERT(td->td_rw_rlocks == 0, @@ -185,8 +179,12 @@ userret(struct thread *td, struct trapframe *frame) td->td_lk_slocks)); KASSERT((td->td_pflags & TDP_NOFAULTING) == 0, ("userret: Returning with pagefaults disabled")); - KASSERT(THREAD_CAN_SLEEP(), - ("userret: Returning with sleep disabled")); + if (__predict_false(!THREAD_CAN_SLEEP())) { +#ifdef EPOCH_TRACE + epoch_trace_list(curthread); +#endif + KASSERT(1, ("userret: Returning with sleep disabled")); + } KASSERT(td->td_pinned == 0 || (td->td_pflags & TDP_CALLCHAIN) != 0, ("userret: Returning with with pinned thread")); KASSERT(td->td_vp_reserv == 0, From owner-svn-src-head@freebsd.org Tue Oct 29 17:36:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1275415E781; Tue, 29 Oct 2019 17:36:07 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 472dzV6kxSz3Lgs; Tue, 29 Oct 2019 17:36:06 +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 CBEA4255B5; Tue, 29 Oct 2019 17:36:06 +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 x9THa6x4018032; Tue, 29 Oct 2019 17:36:06 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9THa6Gd018030; Tue, 29 Oct 2019 17:36:06 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910291736.x9THa6Gd018030@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 29 Oct 2019 17:36:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354149 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 354149 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2019 17:36:07 -0000 Author: glebius Date: Tue Oct 29 17:36:06 2019 New Revision: 354149 URL: https://svnweb.freebsd.org/changeset/base/354149 Log: There is a long standing problem with multicast programming for NICs and IPv6. With IPv6 we may call if_addmulti() in context of processing of an incoming packet. Usually this is interrupt context. While most of the NIC drivers are able to reprogram multicast filters without sleeping, some of them can't. An example is e1000 family of drivers. With iflib conversion the problem was somewhat hidden. Iflib processes packets in private taskqueue, so going to sleep doesn't trigger an assertion. However, the sleep would block operation of the driver and following incoming packets would fill the ring and eventually would start being dropped. Enabling epoch for the full time of a packet processing again started to trigger assertions for e1000. Fix this problem once and for all using a general taskqueue to call if_ioctl() method in all cases when if_addmulti() is called in a non sleeping context. Note that nobody cares about returned value. Reviewed by: hselasky, kib Differential Revision: https://reviews.freebsd.org/D22154 Modified: head/sys/net/if.c head/sys/net/if_var.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue Oct 29 17:28:25 2019 (r354148) +++ head/sys/net/if.c Tue Oct 29 17:36:06 2019 (r354149) @@ -271,6 +271,7 @@ static int if_getgroupmembers(struct ifgroupreq *); static void if_delgroups(struct ifnet *); static void if_attach_internal(struct ifnet *, int, struct if_clone *); static int if_detach_internal(struct ifnet *, int, struct if_clone **); +static void if_siocaddmulti(void *, int); #ifdef VIMAGE static void if_vmove(struct ifnet *, struct vnet *); #endif @@ -556,6 +557,7 @@ if_alloc_domain(u_char type, int numa_domain) IF_ADDR_LOCK_INIT(ifp); TASK_INIT(&ifp->if_linktask, 0, do_link_state_change, ifp); + TASK_INIT(&ifp->if_addmultitask, 0, if_siocaddmulti, ifp); ifp->if_afdata_initialized = 0; IF_AFDATA_LOCK_INIT(ifp); CK_STAILQ_INIT(&ifp->if_addrhead); @@ -1131,6 +1133,7 @@ if_detach_internal(struct ifnet *ifp, int vmove, struc if_delgroups(ifp); taskqueue_drain(taskqueue_swi, &ifp->if_linktask); + taskqueue_drain(taskqueue_swi, &ifp->if_addmultitask); /* * Check if this is a cloned interface or not. Must do even if @@ -3538,7 +3541,10 @@ if_addmulti(struct ifnet *ifp, struct sockaddr *sa, * interface to let them know about it. */ if (ifp->if_ioctl != NULL) { - (void) (*ifp->if_ioctl)(ifp, SIOCADDMULTI, 0); + if (THREAD_CAN_SLEEP()) + (void )(*ifp->if_ioctl)(ifp, SIOCADDMULTI, 0); + else + taskqueue_enqueue(taskqueue_swi, &ifp->if_addmultitask); } if ((llsa != NULL) && (llsa != (struct sockaddr *)&sdl)) @@ -3553,6 +3559,19 @@ free_llsa_out: unlock_out: IF_ADDR_WUNLOCK(ifp); return (error); +} + +static void +if_siocaddmulti(void *arg, int pending) +{ + struct ifnet *ifp; + + ifp = arg; +#ifdef DIAGNOSTIC + if (pending > 1) + if_printf(ifp, "%d SIOCADDMULTI coalesced\n", pending); +#endif + (void )(*ifp->if_ioctl)(ifp, SIOCADDMULTI, 0); } /* Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Tue Oct 29 17:28:25 2019 (r354148) +++ head/sys/net/if_var.h Tue Oct 29 17:36:06 2019 (r354149) @@ -317,6 +317,7 @@ struct ifnet { struct ifaltq if_snd; /* output queue (includes altq) */ struct task if_linktask; /* task for link change events */ + struct task if_addmultitask; /* task for SIOCADDMULTI */ /* Addresses of different protocol families assigned to this if. */ struct mtx if_addr_lock; /* lock to protect address lists */ From owner-svn-src-head@freebsd.org Tue Oct 29 18:24:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5AE08160284; Tue, 29 Oct 2019 18:24:37 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 472g3T1Qtrz3Pn3; Tue, 29 Oct 2019 18:24:37 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 142AD25F1D; Tue, 29 Oct 2019 18:24:37 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9TIOaZp047899; Tue, 29 Oct 2019 18:24:36 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9TIOagq047897; Tue, 29 Oct 2019 18:24:36 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910291824.x9TIOagq047897@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 29 Oct 2019 18:24:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354151 - in head: contrib/netbsd-tests/lib/libexecinfo lib/libexecinfo/tests X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: contrib/netbsd-tests/lib/libexecinfo lib/libexecinfo/tests X-SVN-Commit-Revision: 354151 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2019 18:24:37 -0000 Author: cem Date: Tue Oct 29 18:24:36 2019 New Revision: 354151 URL: https://svnweb.freebsd.org/changeset/base/354151 Log: libexecinfo test: Don't strip installed test It turns out that a test of backtrace symbol resolution and formatting requires symbols. Another option mightt be building with -rdynamic instead, but this works for now. Re-enabled skipped CI test, as it should now pass. PR: 241562 Submitted by: lwhsu Reported by: lwhsu X-MFC-With: r354126, r354135, r354144 Modified: head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c head/lib/libexecinfo/tests/Makefile Modified: head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c ============================================================================== --- head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Tue Oct 29 18:06:00 2019 (r354150) +++ head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Tue Oct 29 18:24:36 2019 (r354151) @@ -151,9 +151,6 @@ ATF_TC_HEAD(backtrace_fmt_basic, tc) ATF_TC_BODY(backtrace_fmt_basic, tc) { - if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) - atf_tc_skip("https://bugs.freebsd.org/241562"); - myfunc(12); if (prevent_inline) Modified: head/lib/libexecinfo/tests/Makefile ============================================================================== --- head/lib/libexecinfo/tests/Makefile Tue Oct 29 18:06:00 2019 (r354150) +++ head/lib/libexecinfo/tests/Makefile Tue Oct 29 18:24:36 2019 (r354151) @@ -6,6 +6,12 @@ TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libexecinf .include +# Perhaps not surprisingly, the backtrace symbol test needs symbols. Leave +# them in: +STRIP= +# It could probably be made to work without symbols by checking pointer values +# instead, but part of the tested functionality is the symbol resolution logic, +# so that doesn't seem useful. NETBSD_ATF_TESTS_C+= backtrace_test LIBADD.backtrace_test+= execinfo From owner-svn-src-head@freebsd.org Tue Oct 29 18:36:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8E38160A16; Tue, 29 Oct 2019 18:36:16 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 472gJw5q4lz3Qb4; Tue, 29 Oct 2019 18:36:16 +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 AC2A9260E7; Tue, 29 Oct 2019 18:36:16 +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 x9TIaGgG053904; Tue, 29 Oct 2019 18:36:16 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9TIaGw4053903; Tue, 29 Oct 2019 18:36:16 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910291836.x9TIaGw4053903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 29 Oct 2019 18:36:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354152 - head/sys/arm64/rockchip X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm64/rockchip X-SVN-Commit-Revision: 354152 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2019 18:36:17 -0000 Author: manu Date: Tue Oct 29 18:36:16 2019 New Revision: 354152 URL: https://svnweb.freebsd.org/changeset/base/354152 Log: arm64: rockchip: typec_phy: Rename timeout to retry Declare retry in the function scope. Rename it to retry as there is a timeout function which was causing to code to compile. Reported by: jhibbits MFC after: 1 month X-MFC-WITH: r354089 Modified: head/sys/arm64/rockchip/rk_typec_phy.c Modified: head/sys/arm64/rockchip/rk_typec_phy.c ============================================================================== --- head/sys/arm64/rockchip/rk_typec_phy.c Tue Oct 29 18:24:36 2019 (r354151) +++ head/sys/arm64/rockchip/rk_typec_phy.c Tue Oct 29 18:36:16 2019 (r354152) @@ -191,7 +191,7 @@ rk_typec_phy_enable(struct phynode *phynode, bool enab device_t dev; intptr_t phy; uint32_t reg; - int err; + int err, retry; dev = phynode_get_device(phynode); phy = phynode_get_id(phynode); @@ -271,13 +271,13 @@ rk_typec_phy_enable(struct phynode *phynode, bool enab hwreset_deassert(sc->rst_uphy); - for (int timeout = 10000; timeout > 0; timeout--) { + for (retry = 10000; retry > 0; retry--) { reg = RK_TYPEC_PHY_READ(sc, PMA_CMN_CTRL1); if (reg & PMA_CMN_CTRL1_READY) break; DELAY(10); } - if (timeout == 0) { + if (retry == 0) { device_printf(sc->dev, "Timeout waiting for PMA\n"); return (ENXIO); } From owner-svn-src-head@freebsd.org Tue Oct 29 20:28:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C47EE16356A; Tue, 29 Oct 2019 20:28:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 472jnv4Wt3z4234; Tue, 29 Oct 2019 20:28:03 +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 7FF75274EF; Tue, 29 Oct 2019 20:28:03 +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 x9TKS3iB019089; Tue, 29 Oct 2019 20:28:03 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9TKS3KN019088; Tue, 29 Oct 2019 20:28:03 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201910292028.x9TKS3KN019088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 29 Oct 2019 20:28:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354154 - head/usr.bin/vmstat X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/usr.bin/vmstat X-SVN-Commit-Revision: 354154 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2019 20:28:03 -0000 Author: trasz Date: Tue Oct 29 20:28:02 2019 New Revision: 354154 URL: https://svnweb.freebsd.org/changeset/base/354154 Log: Fix column title alignment. MFC after: 2 weeks Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Tue Oct 29 19:36:21 2019 (r354153) +++ head/usr.bin/vmstat/vmstat.c Tue Oct 29 20:28:02 2019 (r354154) @@ -867,11 +867,11 @@ printhdr(int maxid, u_long cpumask) num_shown = MIN(num_selected, maxshowdevs); if (hflag) - xo_emit("{T:procs} {T:memory} {T:/page%*s}", 19, ""); + xo_emit("{T:procs} {T:memory} {T:/page%*s}", 19, ""); else - xo_emit("{T:procs} {T:memory} {T:/page%*s}", 19, ""); + xo_emit("{T:procs} {T:memory} {T:/page%*s}", 19, ""); if (num_shown > 1) - xo_emit(" {T:/disks %*s}", num_shown * 4 - 7, ""); + xo_emit(" {T:/disks %*s}", num_shown * 4 - 7, ""); else if (num_shown == 1) xo_emit(" {T:disks}"); xo_emit(" {T:faults} "); From owner-svn-src-head@freebsd.org Tue Oct 29 20:38:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88E87163C3F; Tue, 29 Oct 2019 20:38:00 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 472k1N3BCsz42fw; Tue, 29 Oct 2019 20:38:00 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 51C2A276C2; Tue, 29 Oct 2019 20:38:00 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9TKc0Rw025023; Tue, 29 Oct 2019 20:38:00 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9TKbx9c025017; Tue, 29 Oct 2019 20:37:59 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201910292037.x9TKbx9c025017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 29 Oct 2019 20:37:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354155 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354155 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2019 20:38:00 -0000 Author: jeff Date: Tue Oct 29 20:37:59 2019 New Revision: 354155 URL: https://svnweb.freebsd.org/changeset/base/354155 Log: Drop the object lock in vfs_bio and cluster where it is now safe to do so. Recent changes to busy/valid/dirty have enabled page based synchronization and the object lock is no longer required in many cases. Reviewed by: kib Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D21597 Modified: head/sys/kern/vfs_bio.c head/sys/kern/vfs_cluster.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Tue Oct 29 20:28:02 2019 (r354154) +++ head/sys/kern/vfs_bio.c Tue Oct 29 20:37:59 2019 (r354155) @@ -162,7 +162,7 @@ static void vfs_page_set_valid(struct buf *bp, vm_ooff static void vfs_page_set_validclean(struct buf *bp, vm_ooffset_t off, vm_page_t m); static void vfs_clean_pages_dirty_buf(struct buf *bp); -static void vfs_setdirty_locked_object(struct buf *bp); +static void vfs_setdirty_range(struct buf *bp); static void vfs_vmio_invalidate(struct buf *bp); static void vfs_vmio_truncate(struct buf *bp, int npages); static void vfs_vmio_extend(struct buf *bp, int npages, int size); @@ -955,8 +955,6 @@ vfs_buf_test_cache(struct buf *bp, vm_ooffset_t foff, vm_offset_t size, vm_page_t m) { - VM_OBJECT_ASSERT_LOCKED(m->object); - /* * This function and its results are protected by higher level * synchronization requiring vnode and buf locks to page in and @@ -2865,7 +2863,6 @@ vfs_vmio_iodone(struct buf *bp) bogus = false; iosize = bp->b_bcount - bp->b_resid; - VM_OBJECT_WLOCK(obj); for (i = 0; i < bp->b_npages; i++) { resid = ((foff + PAGE_SIZE) & ~(off_t)PAGE_MASK) - foff; if (resid > iosize) @@ -2876,7 +2873,10 @@ vfs_vmio_iodone(struct buf *bp) */ m = bp->b_pages[i]; if (m == bogus_page) { - bogus = true; + if (bogus == false) { + bogus = true; + VM_OBJECT_RLOCK(obj); + } m = vm_page_lookup(obj, OFF_TO_IDX(foff)); if (m == NULL) panic("biodone: page disappeared!"); @@ -2900,8 +2900,9 @@ vfs_vmio_iodone(struct buf *bp) foff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; iosize -= resid; } + if (bogus) + VM_OBJECT_RUNLOCK(obj); vm_object_pip_wakeupn(obj, bp->b_npages); - VM_OBJECT_WUNLOCK(obj); if (bogus && buf_mapped(bp)) { BUF_CHECK_MAPPED(bp); pmap_qenter(trunc_page((vm_offset_t)bp->b_data), @@ -3029,7 +3030,6 @@ vfs_vmio_extend(struct buf *bp, int desiredpages, int * are not valid for the range covered by the buffer. */ obj = bp->b_bufobj->bo_object; - VM_OBJECT_WLOCK(obj); if (bp->b_npages < desiredpages) { /* * We must allocate system pages since blocking @@ -3041,11 +3041,13 @@ vfs_vmio_extend(struct buf *bp, int desiredpages, int * deadlocks once allocbuf() is called after * pages are vfs_busy_pages(). */ + VM_OBJECT_WLOCK(obj); (void)vm_page_grab_pages(obj, OFF_TO_IDX(bp->b_offset) + bp->b_npages, VM_ALLOC_SYSTEM | VM_ALLOC_IGN_SBUSY | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED, &bp->b_pages[bp->b_npages], desiredpages - bp->b_npages); + VM_OBJECT_WUNLOCK(obj); bp->b_npages = desiredpages; } @@ -3076,7 +3078,6 @@ vfs_vmio_extend(struct buf *bp, int desiredpages, int toff += tinc; tinc = PAGE_SIZE; } - VM_OBJECT_WUNLOCK(obj); /* * Step 3, fixup the KVA pmap. @@ -3656,9 +3657,8 @@ vfs_clean_pages_dirty_buf(struct buf *bp) KASSERT(bp->b_offset != NOOFFSET, ("vfs_clean_pages_dirty_buf: no buffer offset")); - VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); vfs_busy_pages_acquire(bp); - vfs_setdirty_locked_object(bp); + vfs_setdirty_range(bp); for (i = 0; i < bp->b_npages; i++) { noff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; eoff = noff; @@ -3670,69 +3670,57 @@ vfs_clean_pages_dirty_buf(struct buf *bp) foff = noff; } vfs_busy_pages_release(bp); - VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); } static void -vfs_setdirty_locked_object(struct buf *bp) +vfs_setdirty_range(struct buf *bp) { - vm_object_t object; + vm_offset_t boffset; + vm_offset_t eoffset; int i; - object = bp->b_bufobj->bo_object; - VM_OBJECT_ASSERT_WLOCKED(object); + /* + * test the pages to see if they have been modified directly + * by users through the VM system. + */ + for (i = 0; i < bp->b_npages; i++) + vm_page_test_dirty(bp->b_pages[i]); /* - * We qualify the scan for modified pages on whether the - * object has been flushed yet. + * Calculate the encompassing dirty range, boffset and eoffset, + * (eoffset - boffset) bytes. */ - if ((object->flags & OBJ_MIGHTBEDIRTY) != 0) { - vm_offset_t boffset; - vm_offset_t eoffset; - /* - * test the pages to see if they have been modified directly - * by users through the VM system. - */ - for (i = 0; i < bp->b_npages; i++) - vm_page_test_dirty(bp->b_pages[i]); + for (i = 0; i < bp->b_npages; i++) { + if (bp->b_pages[i]->dirty) + break; + } + boffset = (i << PAGE_SHIFT) - (bp->b_offset & PAGE_MASK); - /* - * Calculate the encompassing dirty range, boffset and eoffset, - * (eoffset - boffset) bytes. - */ - - for (i = 0; i < bp->b_npages; i++) { - if (bp->b_pages[i]->dirty) - break; + for (i = bp->b_npages - 1; i >= 0; --i) { + if (bp->b_pages[i]->dirty) { + break; } - boffset = (i << PAGE_SHIFT) - (bp->b_offset & PAGE_MASK); + } + eoffset = ((i + 1) << PAGE_SHIFT) - (bp->b_offset & PAGE_MASK); - for (i = bp->b_npages - 1; i >= 0; --i) { - if (bp->b_pages[i]->dirty) { - break; - } - } - eoffset = ((i + 1) << PAGE_SHIFT) - (bp->b_offset & PAGE_MASK); + /* + * Fit it to the buffer. + */ - /* - * Fit it to the buffer. - */ + if (eoffset > bp->b_bcount) + eoffset = bp->b_bcount; - if (eoffset > bp->b_bcount) - eoffset = bp->b_bcount; + /* + * If we have a good dirty range, merge with the existing + * dirty range. + */ - /* - * If we have a good dirty range, merge with the existing - * dirty range. - */ - - if (boffset < eoffset) { - if (bp->b_dirtyoff > boffset) - bp->b_dirtyoff = boffset; - if (bp->b_dirtyend < eoffset) - bp->b_dirtyend = eoffset; - } + if (boffset < eoffset) { + if (bp->b_dirtyoff > boffset) + bp->b_dirtyoff = boffset; + if (bp->b_dirtyend < eoffset) + bp->b_dirtyend = eoffset; } } @@ -4472,16 +4460,21 @@ vfs_unbusy_pages(struct buf *bp) int i; vm_object_t obj; vm_page_t m; + bool bogus; runningbufwakeup(bp); if (!(bp->b_flags & B_VMIO)) return; obj = bp->b_bufobj->bo_object; - VM_OBJECT_WLOCK(obj); + bogus = false; for (i = 0; i < bp->b_npages; i++) { m = bp->b_pages[i]; if (m == bogus_page) { + if (bogus == false) { + bogus = true; + VM_OBJECT_RLOCK(obj); + } m = vm_page_lookup(obj, OFF_TO_IDX(bp->b_offset) + i); if (!m) panic("vfs_unbusy_pages: page missing\n"); @@ -4495,8 +4488,9 @@ vfs_unbusy_pages(struct buf *bp) } vm_page_sunbusy(m); } + if (bogus) + VM_OBJECT_RUNLOCK(obj); vm_object_pip_wakeupn(obj, bp->b_npages); - VM_OBJECT_WUNLOCK(obj); } /* @@ -4573,7 +4567,6 @@ vfs_busy_pages_acquire(struct buf *bp) { int i; - VM_OBJECT_ASSERT_WLOCKED(bp->b_bufobj->bo_object); for (i = 0; i < bp->b_npages; i++) vm_page_busy_acquire(bp->b_pages[i], VM_ALLOC_SBUSY); } @@ -4583,7 +4576,6 @@ vfs_busy_pages_release(struct buf *bp) { int i; - VM_OBJECT_ASSERT_WLOCKED(bp->b_bufobj->bo_object); for (i = 0; i < bp->b_npages; i++) vm_page_sunbusy(bp->b_pages[i]); } @@ -4616,13 +4608,12 @@ vfs_busy_pages(struct buf *bp, int clear_modify) foff = bp->b_offset; KASSERT(bp->b_offset != NOOFFSET, ("vfs_busy_pages: no buffer offset")); - VM_OBJECT_WLOCK(obj); if ((bp->b_flags & B_CLUSTER) == 0) { vm_object_pip_add(obj, bp->b_npages); vfs_busy_pages_acquire(bp); } if (bp->b_bufsize != 0) - vfs_setdirty_locked_object(bp); + vfs_setdirty_range(bp); bogus = false; for (i = 0; i < bp->b_npages; i++) { m = bp->b_pages[i]; @@ -4653,7 +4644,6 @@ vfs_busy_pages(struct buf *bp, int clear_modify) } foff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; } - VM_OBJECT_WUNLOCK(obj); if (bogus && buf_mapped(bp)) { BUF_CHECK_MAPPED(bp); pmap_qenter(trunc_page((vm_offset_t)bp->b_data), @@ -4686,8 +4676,6 @@ vfs_bio_set_valid(struct buf *bp, int base, int size) base += (bp->b_offset & PAGE_MASK); n = PAGE_SIZE - (base & PAGE_MASK); - VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); - /* * Busy may not be strictly necessary here because the pages are * unlikely to be fully valid and the vnode lock will synchronize @@ -4705,7 +4693,6 @@ vfs_bio_set_valid(struct buf *bp, int base, int size) n = PAGE_SIZE; } vfs_busy_pages_release(bp); - VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); } /* @@ -4731,22 +4718,7 @@ vfs_bio_clrbuf(struct buf *bp) } bp->b_flags &= ~B_INVAL; bp->b_ioflags &= ~BIO_ERROR; - VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); vfs_busy_pages_acquire(bp); - if ((bp->b_npages == 1) && (bp->b_bufsize < PAGE_SIZE) && - (bp->b_offset & PAGE_MASK) == 0) { - if (bp->b_pages[0] == bogus_page) - goto unlock; - mask = (1 << (bp->b_bufsize / DEV_BSIZE)) - 1; - VM_OBJECT_ASSERT_WLOCKED(bp->b_pages[0]->object); - if ((bp->b_pages[0]->valid & mask) == mask) - goto unlock; - if ((bp->b_pages[0]->valid & mask) == 0) { - pmap_zero_page_area(bp->b_pages[0], 0, bp->b_bufsize); - bp->b_pages[0]->valid |= mask; - goto unlock; - } - } sa = bp->b_offset & PAGE_MASK; slide = 0; for (i = 0; i < bp->b_npages; i++, sa = 0) { @@ -4758,7 +4730,6 @@ vfs_bio_clrbuf(struct buf *bp) continue; j = sa / DEV_BSIZE; mask = ((1 << ((ea - sa) / DEV_BSIZE)) - 1) << j; - VM_OBJECT_ASSERT_WLOCKED(bp->b_pages[i]->object); if ((bp->b_pages[i]->valid & mask) == mask) continue; if ((bp->b_pages[i]->valid & mask) == 0) @@ -4771,11 +4742,10 @@ vfs_bio_clrbuf(struct buf *bp) } } } - bp->b_pages[i]->valid |= mask; + vm_page_set_valid_range(bp->b_pages[i], j * DEV_BSIZE, + roundup2(ea - sa, DEV_BSIZE)); } -unlock: vfs_busy_pages_release(bp); - VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); bp->b_resid = 0; } @@ -5186,11 +5156,9 @@ vfs_bio_getpages(struct vnode *vp, vm_page_t *ma, int br_flags = (mp != NULL && (mp->mnt_kern_flag & MNTK_UNMAPPED_BUFS) != 0) ? GB_UNMAPPED : 0; - VM_OBJECT_WLOCK(object); again: for (i = 0; i < count; i++) vm_page_busy_downgrade(ma[i]); - VM_OBJECT_WUNLOCK(object); lbnp = -1; for (i = 0; i < count; i++) { @@ -5249,11 +5217,9 @@ again: vm_page_all_valid(m) || i == count - 1, ("buf %d %p invalid", i, m)); if (i == count - 1 && lpart) { - VM_OBJECT_WLOCK(object); if (!vm_page_none_valid(m) && !vm_page_all_valid(m)) vm_page_zero_invalid(m, TRUE); - VM_OBJECT_WUNLOCK(object); } next_page:; } @@ -5281,9 +5247,9 @@ end_pages: if (!vm_page_all_valid(ma[i])) redo = true; } + VM_OBJECT_WUNLOCK(object); if (redo && error == 0) goto again; - VM_OBJECT_WUNLOCK(object); return (error != 0 ? VM_PAGER_ERROR : VM_PAGER_OK); } Modified: head/sys/kern/vfs_cluster.c ============================================================================== --- head/sys/kern/vfs_cluster.c Tue Oct 29 20:28:02 2019 (r354154) +++ head/sys/kern/vfs_cluster.c Tue Oct 29 20:37:59 2019 (r354155) @@ -417,11 +417,9 @@ cluster_rbuild(struct vnode *vp, u_quad_t filesize, da inc = btodb(size); for (bn = blkno, i = 0; i < run; ++i, bn += inc) { if (i == 0) { - VM_OBJECT_WLOCK(tbp->b_bufobj->bo_object); vm_object_pip_add(tbp->b_bufobj->bo_object, tbp->b_npages); vfs_busy_pages_acquire(tbp); - VM_OBJECT_WUNLOCK(tbp->b_bufobj->bo_object); } else { if ((bp->b_npages * PAGE_SIZE) + round_page(size) > vp->v_mount->mnt_iosize_max) { @@ -458,13 +456,11 @@ cluster_rbuild(struct vnode *vp, u_quad_t filesize, da */ off = tbp->b_offset; tsize = size; - VM_OBJECT_WLOCK(tbp->b_bufobj->bo_object); for (j = 0; tsize > 0; j++) { toff = off & PAGE_MASK; tinc = tsize; if (toff + tinc > PAGE_SIZE) tinc = PAGE_SIZE - toff; - VM_OBJECT_ASSERT_WLOCKED(tbp->b_pages[j]->object); if (vm_page_trysbusy(tbp->b_pages[j]) == 0) break; if ((tbp->b_pages[j]->valid & @@ -482,11 +478,9 @@ clean_sbusy: j); for (k = 0; k < j; k++) vm_page_sunbusy(tbp->b_pages[k]); - VM_OBJECT_WUNLOCK(tbp->b_bufobj->bo_object); bqrelse(tbp); break; } - VM_OBJECT_WUNLOCK(tbp->b_bufobj->bo_object); /* * Set a read-ahead mark as appropriate @@ -506,7 +500,6 @@ clean_sbusy: if (tbp->b_blkno == tbp->b_lblkno) { tbp->b_blkno = bn; } else if (tbp->b_blkno != bn) { - VM_OBJECT_WLOCK(tbp->b_bufobj->bo_object); goto clean_sbusy; } } @@ -517,9 +510,9 @@ clean_sbusy: BUF_KERNPROC(tbp); TAILQ_INSERT_TAIL(&bp->b_cluster.cluster_head, tbp, b_cluster.cluster_entry); - VM_OBJECT_WLOCK(tbp->b_bufobj->bo_object); for (j = 0; j < tbp->b_npages; j += 1) { vm_page_t m; + m = tbp->b_pages[j]; if ((bp->b_npages == 0) || (bp->b_pages[bp->b_npages-1] != m)) { @@ -529,7 +522,7 @@ clean_sbusy: if (vm_page_all_valid(m)) tbp->b_pages[j] = bogus_page; } - VM_OBJECT_WUNLOCK(tbp->b_bufobj->bo_object); + /* * Don't inherit tbp->b_bufsize as it may be larger due to * a non-page-aligned size. Instead just aggregate using @@ -547,13 +540,10 @@ clean_sbusy: * Fully valid pages in the cluster are already good and do not need * to be re-read from disk. Replace the page with bogus_page */ - VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); for (j = 0; j < bp->b_npages; j++) { - VM_OBJECT_ASSERT_WLOCKED(bp->b_pages[j]->object); if (vm_page_all_valid(bp->b_pages[j])) bp->b_pages[j] = bogus_page; } - VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); if (bp->b_bufsize > bp->b_kvasize) panic("cluster_rbuild: b_bufsize(%ld) > b_kvasize(%d)\n", bp->b_bufsize, bp->b_kvasize); @@ -988,7 +978,6 @@ cluster_wbuild(struct vnode *vp, long size, daddr_t st if (tbp->b_flags & B_VMIO) { vm_page_t m; - VM_OBJECT_WLOCK(tbp->b_bufobj->bo_object); if (i == 0) { vfs_busy_pages_acquire(tbp); } else { /* if not first buffer */ @@ -998,8 +987,6 @@ cluster_wbuild(struct vnode *vp, long size, daddr_t st for (j--; j >= 0; j--) vm_page_sunbusy( tbp->b_pages[j]); - VM_OBJECT_WUNLOCK( - tbp->b_object); bqrelse(tbp); goto finishcluster; } @@ -1015,7 +1002,6 @@ cluster_wbuild(struct vnode *vp, long size, daddr_t st bp->b_npages++; } } - VM_OBJECT_WUNLOCK(tbp->b_bufobj->bo_object); } bp->b_bcount += size; bp->b_bufsize += size; From owner-svn-src-head@freebsd.org Tue Oct 29 20:46:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A1EAA164112; Tue, 29 Oct 2019 20:46:26 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 472kC63W8Tz438Y; Tue, 29 Oct 2019 20:46:26 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5732727896; Tue, 29 Oct 2019 20:46:26 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9TKkQA5030973; Tue, 29 Oct 2019 20:46:26 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9TKkQZc030972; Tue, 29 Oct 2019 20:46:26 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201910292046.x9TKkQZc030972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 29 Oct 2019 20:46:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354156 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354156 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2019 20:46:26 -0000 Author: jeff Date: Tue Oct 29 20:46:25 2019 New Revision: 354156 URL: https://svnweb.freebsd.org/changeset/base/354156 Log: Drop the object lock earlier in fault and don't relock it after pmap_enter(). Recent changes in object and page locking have enabled more lock pushdown. Reviewed by: kib Tested by: pho Differential Revision: https://reviews.freebsd.org/D22036 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Tue Oct 29 20:37:59 2019 (r354155) +++ head/sys/vm/vm_fault.c Tue Oct 29 20:46:25 2019 (r354156) @@ -184,11 +184,10 @@ unlock_vp(struct faultstate *fs) } static void -unlock_and_deallocate(struct faultstate *fs) +fault_deallocate(struct faultstate *fs) { vm_object_pip_wakeup(fs->object); - VM_OBJECT_WUNLOCK(fs->object); if (fs->object != fs->first_object) { VM_OBJECT_WLOCK(fs->first_object); vm_page_free(fs->first_m); @@ -202,6 +201,14 @@ unlock_and_deallocate(struct faultstate *fs) } static void +unlock_and_deallocate(struct faultstate *fs) +{ + + VM_OBJECT_WUNLOCK(fs->object); + fault_deallocate(fs); +} + +static void vm_fault_dirty(vm_map_entry_t entry, vm_page_t m, vm_prot_t prot, vm_prot_t fault_type, int fault_flags, bool set_wd) { @@ -1261,10 +1268,12 @@ readrest: fs.object, OFF_TO_IDX( fs.first_object->backing_object_offset)); #endif + VM_OBJECT_WUNLOCK(fs.object); fs.first_m = fs.m; fs.m = NULL; VM_CNT_INC(v_cow_optim); } else { + VM_OBJECT_WUNLOCK(fs.object); /* * Oh, well, lets copy it. */ @@ -1285,7 +1294,6 @@ readrest: * conditional */ vm_object_pip_wakeup(fs.object); - VM_OBJECT_WUNLOCK(fs.object); /* * We only try to prefault read-only mappings to the @@ -1405,7 +1413,6 @@ readrest: vm_fault_prefault(&fs, vaddr, faultcount > 0 ? behind : PFBAK, faultcount > 0 ? ahead : PFFOR, false); - VM_OBJECT_WLOCK(fs.object); /* * If the page is not wired down, then put it where the pageout daemon @@ -1427,7 +1434,7 @@ readrest: /* * Unlock everything, and return */ - unlock_and_deallocate(&fs); + fault_deallocate(&fs); if (hardfault) { VM_CNT_INC(v_io_faults); curthread->td_ru.ru_majflt++; From owner-svn-src-head@freebsd.org Tue Oct 29 20:58:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 19631164478; Tue, 29 Oct 2019 20:58:48 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 472kTM6vzcz43jl; Tue, 29 Oct 2019 20:58:47 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC47927A5C; Tue, 29 Oct 2019 20:58:47 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9TKwlWS036661; Tue, 29 Oct 2019 20:58:47 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9TKwkvE036657; Tue, 29 Oct 2019 20:58:46 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201910292058.x9TKwkvE036657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 29 Oct 2019 20:58:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354157 - in head/sys: sys vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: sys vm X-SVN-Commit-Revision: 354157 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2019 20:58:48 -0000 Author: jeff Date: Tue Oct 29 20:58:46 2019 New Revision: 354157 URL: https://svnweb.freebsd.org/changeset/base/354157 Log: Use atomics and a shared object lock to protect the object reference count. Certain consumers still need to guarantee a stable reference so we can not switch entirely to atomics yet. Exclusive lock holders can still modify and examine the refcount without using the ref api. Reviewed by: kib Tested by: pho Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D21598 Modified: head/sys/sys/refcount.h head/sys/vm/vm_object.c head/sys/vm/vm_object.h head/sys/vm/vnode_pager.c Modified: head/sys/sys/refcount.h ============================================================================== --- head/sys/sys/refcount.h Tue Oct 29 20:46:25 2019 (r354156) +++ head/sys/sys/refcount.h Tue Oct 29 20:58:46 2019 (r354157) @@ -175,4 +175,22 @@ refcount_release_if_not_last(volatile u_int *count) } } +static __inline __result_use_check bool +refcount_release_if_gt(volatile u_int *count, u_int n) +{ + u_int old; + + KASSERT(n > 0, + ("refcount_release_if_gt: Use refcount_release for final ref")); + old = *count; + for (;;) { + if (REFCOUNT_COUNT(old) <= n) + return (false); + if (__predict_false(REFCOUNT_SATURATED(old))) + return (true); + if (atomic_fcmpset_int(count, &old, old - 1)) + return (true); + } +} + #endif /* ! __SYS_REFCOUNT_H__ */ Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Tue Oct 29 20:46:25 2019 (r354156) +++ head/sys/vm/vm_object.c Tue Oct 29 20:58:46 2019 (r354157) @@ -224,8 +224,8 @@ vm_object_zinit(void *mem, int size, int flags) /* These are true for any object that has been freed */ object->type = OBJT_DEAD; - object->ref_count = 0; vm_radix_init(&object->rtree); + refcount_init(&object->ref_count, 0); refcount_init(&object->paging_in_progress, 0); refcount_init(&object->busy, 0); object->resident_page_count = 0; @@ -282,7 +282,7 @@ _vm_object_allocate(objtype_t type, vm_pindex_t size, object->size = size; object->domain.dr_policy = NULL; object->generation = 1; - object->ref_count = 1; + refcount_init(&object->ref_count, 1); object->memattr = VM_MEMATTR_DEFAULT; object->cred = NULL; object->charge = 0; @@ -444,9 +444,9 @@ vm_object_reference(vm_object_t object) { if (object == NULL) return; - VM_OBJECT_WLOCK(object); + VM_OBJECT_RLOCK(object); vm_object_reference_locked(object); - VM_OBJECT_WUNLOCK(object); + VM_OBJECT_RUNLOCK(object); } /* @@ -461,8 +461,8 @@ vm_object_reference_locked(vm_object_t object) { struct vnode *vp; - VM_OBJECT_ASSERT_WLOCKED(object); - object->ref_count++; + VM_OBJECT_ASSERT_LOCKED(object); + refcount_acquire(&object->ref_count); if (object->type == OBJT_VNODE) { vp = object->handle; vref(vp); @@ -477,24 +477,16 @@ vm_object_vndeallocate(vm_object_t object) { struct vnode *vp = (struct vnode *) object->handle; - VM_OBJECT_ASSERT_WLOCKED(object); KASSERT(object->type == OBJT_VNODE, ("vm_object_vndeallocate: not a vnode object")); KASSERT(vp != NULL, ("vm_object_vndeallocate: missing vp")); -#ifdef INVARIANTS - if (object->ref_count == 0) { - vn_printf(vp, "vm_object_vndeallocate "); - panic("vm_object_vndeallocate: bad object reference count"); - } -#endif - if (!umtx_shm_vnobj_persistent && object->ref_count == 1) + if (refcount_release(&object->ref_count) && + !umtx_shm_vnobj_persistent) umtx_shm_object_terminated(object); - object->ref_count--; - + VM_OBJECT_RUNLOCK(object); /* vrele may need the vnode lock. */ - VM_OBJECT_WUNLOCK(object); vrele(vp); } @@ -513,24 +505,32 @@ void vm_object_deallocate(vm_object_t object) { vm_object_t temp; + bool released; while (object != NULL) { - VM_OBJECT_WLOCK(object); + VM_OBJECT_RLOCK(object); if (object->type == OBJT_VNODE) { vm_object_vndeallocate(object); return; } - KASSERT(object->ref_count != 0, - ("vm_object_deallocate: object deallocated too many times: %d", object->type)); - /* * If the reference count goes to 0 we start calling - * vm_object_terminate() on the object chain. - * A ref count of 1 may be a special case depending on the - * shadow count being 0 or 1. + * vm_object_terminate() on the object chain. A ref count + * of 1 may be a special case depending on the shadow count + * being 0 or 1. These cases require a write lock on the + * object. */ - object->ref_count--; + released = refcount_release_if_gt(&object->ref_count, 2); + VM_OBJECT_RUNLOCK(object); + if (released) + return; + + VM_OBJECT_WLOCK(object); + KASSERT(object->ref_count != 0, + ("vm_object_deallocate: object deallocated too many times: %d", object->type)); + + refcount_release(&object->ref_count); if (object->ref_count > 1) { VM_OBJECT_WUNLOCK(object); return; @@ -558,7 +558,7 @@ vm_object_deallocate(vm_object_t object) /* * Avoid a potential deadlock. */ - object->ref_count++; + refcount_acquire(&object->ref_count); VM_OBJECT_WUNLOCK(object); /* * More likely than not the thread @@ -580,7 +580,7 @@ vm_object_deallocate(vm_object_t object) (robject->type == OBJT_DEFAULT || robject->type == OBJT_SWAP)) { - robject->ref_count++; + refcount_acquire(&robject->ref_count); retry: if (REFCOUNT_COUNT(robject->paging_in_progress) > 0) { VM_OBJECT_WUNLOCK(object); @@ -1223,15 +1223,15 @@ vm_object_shadow( * Don't create the new object if the old object isn't shared. */ if (source != NULL) { - VM_OBJECT_WLOCK(source); + VM_OBJECT_RLOCK(source); if (source->ref_count == 1 && source->handle == NULL && (source->type == OBJT_DEFAULT || source->type == OBJT_SWAP)) { - VM_OBJECT_WUNLOCK(source); + VM_OBJECT_RUNLOCK(source); return; } - VM_OBJECT_WUNLOCK(source); + VM_OBJECT_RUNLOCK(source); } /* @@ -1822,7 +1822,7 @@ vm_object_collapse(vm_object_t object) * Drop the reference count on backing_object. Since * its ref_count was at least 2, it will not vanish. */ - backing_object->ref_count--; + refcount_release(&backing_object->ref_count); VM_OBJECT_WUNLOCK(backing_object); counter_u64_add(object_bypasses, 1); } Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Tue Oct 29 20:46:25 2019 (r354156) +++ head/sys/vm/vm_object.h Tue Oct 29 20:58:46 2019 (r354157) @@ -106,7 +106,7 @@ struct vm_object { vm_pindex_t size; /* Object size */ struct domainset_ref domain; /* NUMA policy. */ int generation; /* generation ID */ - int ref_count; /* How many refs?? */ + volatile u_int ref_count; /* How many refs?? */ int shadow_count; /* how many objects that this is a shadow for */ vm_memattr_t memattr; /* default memory attribute for pages */ objtype_t type; /* type of pager */ Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Tue Oct 29 20:46:25 2019 (r354156) +++ head/sys/vm/vnode_pager.c Tue Oct 29 20:58:46 2019 (r354157) @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -172,9 +173,9 @@ vnode_create_vobject(struct vnode *vp, off_t isize, st * Dereference the reference we just created. This assumes * that the object is associated with the vp. */ - VM_OBJECT_WLOCK(object); - object->ref_count--; - VM_OBJECT_WUNLOCK(object); + VM_OBJECT_RLOCK(object); + refcount_release(&object->ref_count); + VM_OBJECT_RUNLOCK(object); vrele(vp); KASSERT(vp->v_object != NULL, ("vnode_create_vobject: NULL object")); @@ -285,7 +286,7 @@ retry: KASSERT(object->ref_count == 1, ("leaked ref %p %d", object, object->ref_count)); object->type = OBJT_DEAD; - object->ref_count = 0; + refcount_init(&object->ref_count, 0); VM_OBJECT_WUNLOCK(object); vm_object_destroy(object); goto retry; @@ -294,7 +295,7 @@ retry: VI_UNLOCK(vp); } else { VM_OBJECT_WLOCK(object); - object->ref_count++; + refcount_acquire(&object->ref_count); #if VM_NRESERVLEVEL > 0 vm_object_color(object, 0); #endif From owner-svn-src-head@freebsd.org Tue Oct 29 21:06:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D37D71647C3; Tue, 29 Oct 2019 21:06:37 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 472kfP5w1Nz44DL; Tue, 29 Oct 2019 21:06:37 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9085627C1E; Tue, 29 Oct 2019 21:06:37 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9TL6bR4042615; Tue, 29 Oct 2019 21:06:37 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9TL6Zk8042602; Tue, 29 Oct 2019 21:06:35 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201910292106.x9TL6Zk8042602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 29 Oct 2019 21:06:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354158 - in head/sys: fs/nfsclient fs/nfsserver fs/tmpfs kern ufs/ffs vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: fs/nfsclient fs/nfsserver fs/tmpfs kern ufs/ffs vm X-SVN-Commit-Revision: 354158 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2019 21:06:37 -0000 Author: jeff Date: Tue Oct 29 21:06:34 2019 New Revision: 354158 URL: https://svnweb.freebsd.org/changeset/base/354158 Log: Replace OBJ_MIGHTBEDIRTY with a system using atomics. Remove the TMPFS_DIRTY flag and use the same system. This enables further fault locking improvements by allowing more faults to proceed with a shared lock. Reviewed by: kib Tested by: pho Differential Revision: https://reviews.freebsd.org/D22116 Modified: head/sys/fs/nfsclient/nfs_clvnops.c head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/tmpfs/tmpfs_subr.c head/sys/fs/tmpfs/tmpfs_vfsops.c head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/kern/vfs_subr.c head/sys/ufs/ffs/ffs_rawread.c head/sys/vm/vm_fault.c head/sys/vm/vm_object.c head/sys/vm/vm_object.h head/sys/vm/vm_page.c Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Tue Oct 29 20:58:46 2019 (r354157) +++ head/sys/fs/nfsclient/nfs_clvnops.c Tue Oct 29 21:06:34 2019 (r354158) @@ -715,7 +715,7 @@ nfs_open(struct vop_open_args *ap) */ if (vp->v_writecount <= -1) { if ((obj = vp->v_object) != NULL && - (obj->flags & OBJ_MIGHTBEDIRTY) != 0) { + vm_object_mightbedirty(obj)) { VM_OBJECT_WLOCK(obj); vm_object_page_clean(obj, 0, 0, OBJPC_SYNC); VM_OBJECT_WUNLOCK(obj); Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Tue Oct 29 20:58:46 2019 (r354157) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Tue Oct 29 21:06:34 2019 (r354158) @@ -1498,8 +1498,7 @@ nfsvno_fsync(struct vnode *vp, u_int64_t off, int cnt, /* * Give up and do the whole thing */ - if (vp->v_object && - (vp->v_object->flags & OBJ_MIGHTBEDIRTY)) { + if (vp->v_object && vm_object_mightbedirty(vp->v_object)) { VM_OBJECT_WLOCK(vp->v_object); vm_object_page_clean(vp->v_object, 0, 0, OBJPC_SYNC); VM_OBJECT_WUNLOCK(vp->v_object); @@ -1529,8 +1528,7 @@ nfsvno_fsync(struct vnode *vp, u_int64_t off, int cnt, } lblkno = off / iosize; - if (vp->v_object && - (vp->v_object->flags & OBJ_MIGHTBEDIRTY)) { + if (vp->v_object && vm_object_mightbedirty(vp->v_object)) { VM_OBJECT_WLOCK(vp->v_object); vm_object_page_clean(vp->v_object, off, off + cnt, OBJPC_SYNC); Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Tue Oct 29 20:58:46 2019 (r354157) +++ head/sys/fs/tmpfs/tmpfs_subr.c Tue Oct 29 21:06:34 2019 (r354158) @@ -1477,10 +1477,10 @@ tmpfs_check_mtime(struct vnode *vp) KASSERT((obj->flags & (OBJ_TMPFS_NODE | OBJ_TMPFS)) == (OBJ_TMPFS_NODE | OBJ_TMPFS), ("non-tmpfs obj")); /* unlocked read */ - if ((obj->flags & OBJ_TMPFS_DIRTY) != 0) { + if (obj->generation != obj->cleangeneration) { VM_OBJECT_WLOCK(obj); - if ((obj->flags & OBJ_TMPFS_DIRTY) != 0) { - obj->flags &= ~OBJ_TMPFS_DIRTY; + if (obj->generation != obj->cleangeneration) { + obj->cleangeneration = obj->generation; node = VP_TO_TMPFS_NODE(vp); node->tn_status |= TMPFS_NODE_MODIFIED | TMPFS_NODE_CHANGED; Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vfsops.c Tue Oct 29 20:58:46 2019 (r354157) +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Tue Oct 29 21:06:34 2019 (r354158) @@ -172,7 +172,7 @@ tmpfs_update_mtime(struct mount *mp, bool lazy) * For non-lazy case, we must flush all pending * metadata changes now. */ - if (!lazy || (obj->flags & OBJ_TMPFS_DIRTY) != 0) { + if (!lazy || obj->generation != obj->cleangeneration) { if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, curthread) != 0) continue; Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Tue Oct 29 20:58:46 2019 (r354157) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Tue Oct 29 21:06:34 2019 (r354158) @@ -1323,7 +1323,7 @@ tmpfs_need_inactive(struct vop_need_inactive_args *ap) goto need; if (vp->v_type == VREG) { obj = vp->v_object; - if ((obj->flags & OBJ_TMPFS_DIRTY) != 0) + if (obj->generation != obj->cleangeneration) goto need; } return (0); Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Tue Oct 29 20:58:46 2019 (r354157) +++ head/sys/kern/vfs_subr.c Tue Oct 29 21:06:34 2019 (r354158) @@ -3346,7 +3346,7 @@ vinactive(struct vnode *vp, struct thread *td) * pending I/O and dirty pages in the object. */ if ((obj = vp->v_object) != NULL && (vp->v_vflag & VV_NOSYNC) == 0 && - (obj->flags & OBJ_MIGHTBEDIRTY) != 0) { + vm_object_mightbedirty(obj)) { VM_OBJECT_WLOCK(obj); vm_object_page_clean(obj, 0, 0, 0); VM_OBJECT_WUNLOCK(obj); @@ -4406,7 +4406,7 @@ vfs_msync(struct mount *mp, int flags) MNT_VNODE_FOREACH_ACTIVE(vp, mp, mvp) { obj = vp->v_object; - if (obj != NULL && (obj->flags & OBJ_MIGHTBEDIRTY) != 0 && + if (obj != NULL && vm_object_mightbedirty(obj) && (flags == MNT_WAIT || VOP_ISLOCKED(vp) == 0)) { if (!vget(vp, LK_EXCLUSIVE | LK_RETRY | LK_INTERLOCK, @@ -4696,7 +4696,7 @@ vn_need_pageq_flush(struct vnode *vp) MPASS(mtx_owned(VI_MTX(vp))); need = 0; if ((obj = vp->v_object) != NULL && (vp->v_vflag & VV_NOSYNC) == 0 && - (obj->flags & OBJ_MIGHTBEDIRTY) != 0) + vm_object_mightbedirty(obj)) need = 1; return (need); } Modified: head/sys/ufs/ffs/ffs_rawread.c ============================================================================== --- head/sys/ufs/ffs/ffs_rawread.c Tue Oct 29 20:58:46 2019 (r354157) +++ head/sys/ufs/ffs/ffs_rawread.c Tue Oct 29 21:06:34 2019 (r354158) @@ -109,7 +109,7 @@ ffs_rawread_sync(struct vnode *vp) if (bo->bo_numoutput > 0 || bo->bo_dirty.bv_cnt > 0 || ((obj = vp->v_object) != NULL && - (obj->flags & OBJ_MIGHTBEDIRTY) != 0)) { + vm_object_mightbedirty(obj))) { VI_UNLOCK(vp); BO_UNLOCK(bo); @@ -140,7 +140,7 @@ ffs_rawread_sync(struct vnode *vp) } /* Attempt to msync mmap() regions to clean dirty mmap */ if ((obj = vp->v_object) != NULL && - (obj->flags & OBJ_MIGHTBEDIRTY) != 0) { + vm_object_mightbedirty(obj)) { VI_UNLOCK(vp); VM_OBJECT_WLOCK(obj); vm_object_page_clean(obj, 0, 0, OBJPC_SYNC); Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Tue Oct 29 20:58:46 2019 (r354157) +++ head/sys/vm/vm_fault.c Tue Oct 29 21:06:34 2019 (r354158) @@ -210,7 +210,7 @@ unlock_and_deallocate(struct faultstate *fs) static void vm_fault_dirty(vm_map_entry_t entry, vm_page_t m, vm_prot_t prot, - vm_prot_t fault_type, int fault_flags, bool set_wd) + vm_prot_t fault_type, int fault_flags, bool excl) { bool need_dirty; @@ -226,11 +226,11 @@ vm_fault_dirty(vm_map_entry_t entry, vm_page_t m, vm_p (fault_flags & VM_FAULT_WIRE) == 0) || (fault_flags & VM_FAULT_DIRTY) != 0; - if (set_wd) - vm_object_set_writeable_dirty(m->object); - else + vm_object_set_writeable_dirty(m->object); + + if (!excl) /* - * If two callers of vm_fault_dirty() with set_wd == + * If two callers of vm_fault_dirty() with excl == * FALSE, one for the map entry with MAP_ENTRY_NOSYNC * flag set, other with flag clear, race, it is * possible for the no-NOSYNC thread to see m->dirty @@ -267,7 +267,7 @@ vm_fault_dirty(vm_map_entry_t entry, vm_page_t m, vm_p */ if (need_dirty) vm_page_dirty(m); - if (!set_wd) + if (!excl) vm_page_unlock(m); else if (need_dirty) vm_pager_page_unswapped(m); @@ -758,29 +758,17 @@ RetryFault_oom: /* * Try to avoid lock contention on the top-level object through * special-case handling of some types of page faults, specifically, - * those that are both (1) mapping an existing page from the top- - * level object and (2) not having to mark that object as containing - * dirty pages. Under these conditions, a read lock on the top-level - * object suffices, allowing multiple page faults of a similar type to - * run in parallel on the same top-level object. + * those that are mapping an existing page from the top-level object. + * Under this condition, a read lock on the object suffices, allowing + * multiple page faults of a similar type to run in parallel. */ if (fs.vp == NULL /* avoid locked vnode leak */ && - (fault_flags & (VM_FAULT_WIRE | VM_FAULT_DIRTY)) == 0 && - /* avoid calling vm_object_set_writeable_dirty() */ - ((prot & VM_PROT_WRITE) == 0 || - (fs.first_object->type != OBJT_VNODE && - (fs.first_object->flags & OBJ_TMPFS_NODE) == 0) || - (fs.first_object->flags & OBJ_MIGHTBEDIRTY) != 0)) { + (fault_flags & (VM_FAULT_WIRE | VM_FAULT_DIRTY)) == 0) { VM_OBJECT_RLOCK(fs.first_object); - if ((prot & VM_PROT_WRITE) == 0 || - (fs.first_object->type != OBJT_VNODE && - (fs.first_object->flags & OBJ_TMPFS_NODE) == 0) || - (fs.first_object->flags & OBJ_MIGHTBEDIRTY) != 0) { - rv = vm_fault_soft_fast(&fs, vaddr, prot, fault_type, - fault_flags, wired, m_hold); - if (rv == KERN_SUCCESS) - return (rv); - } + rv = vm_fault_soft_fast(&fs, vaddr, prot, fault_type, + fault_flags, wired, m_hold); + if (rv == KERN_SUCCESS) + return (rv); if (!VM_OBJECT_TRYUPGRADE(fs.first_object)) { VM_OBJECT_RUNLOCK(fs.first_object); VM_OBJECT_WLOCK(fs.first_object); Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Tue Oct 29 20:58:46 2019 (r354157) +++ head/sys/vm/vm_object.c Tue Oct 29 21:06:34 2019 (r354158) @@ -112,10 +112,10 @@ SYSCTL_INT(_vm, OID_AUTO, old_msync, CTLFLAG_RW, &old_ "Use old (insecure) msync behavior"); static int vm_object_page_collect_flush(vm_object_t object, vm_page_t p, - int pagerflags, int flags, boolean_t *clearobjflags, + int pagerflags, int flags, boolean_t *allclean, boolean_t *eio); static boolean_t vm_object_page_remove_write(vm_page_t p, int flags, - boolean_t *clearobjflags); + boolean_t *allclean); static void vm_object_qcollapse(vm_object_t object); static void vm_object_vndeallocate(vm_object_t object); @@ -282,6 +282,7 @@ _vm_object_allocate(objtype_t type, vm_pindex_t size, object->size = size; object->domain.dr_policy = NULL; object->generation = 1; + object->cleangeneration = 1; refcount_init(&object->ref_count, 1); object->memattr = VM_MEMATTR_DEFAULT; object->cred = NULL; @@ -769,7 +770,7 @@ vm_object_terminate(vm_object_t object) * page should be flushed, and FALSE otherwise. */ static boolean_t -vm_object_page_remove_write(vm_page_t p, int flags, boolean_t *clearobjflags) +vm_object_page_remove_write(vm_page_t p, int flags, boolean_t *allclean) { vm_page_assert_busied(p); @@ -780,7 +781,7 @@ vm_object_page_remove_write(vm_page_t p, int flags, bo * cleared in this case so we do not have to set them. */ if ((flags & OBJPC_NOSYNC) != 0 && (p->aflags & PGA_NOSYNC) != 0) { - *clearobjflags = FALSE; + *allclean = FALSE; return (FALSE); } else { pmap_remove_write(p); @@ -813,16 +814,11 @@ vm_object_page_clean(vm_object_t object, vm_ooffset_t vm_page_t np, p; vm_pindex_t pi, tend, tstart; int curgeneration, n, pagerflags; - boolean_t clearobjflags, eio, res; + boolean_t eio, res, allclean; VM_OBJECT_ASSERT_WLOCKED(object); - /* - * The OBJ_MIGHTBEDIRTY flag is only set for OBJT_VNODE - * objects. The check below prevents the function from - * operating on non-vnode objects. - */ - if ((object->flags & OBJ_MIGHTBEDIRTY) == 0 || + if (object->type != OBJT_VNODE || !vm_object_mightbedirty(object) || object->resident_page_count == 0) return (TRUE); @@ -832,7 +828,7 @@ vm_object_page_clean(vm_object_t object, vm_ooffset_t tstart = OFF_TO_IDX(start); tend = (end == 0) ? object->size : OFF_TO_IDX(end + PAGE_MASK); - clearobjflags = tstart == 0 && tend >= object->size; + allclean = tstart == 0 && tend >= object->size; res = TRUE; rescan: @@ -846,32 +842,26 @@ rescan: if (vm_page_none_valid(p)) continue; if (vm_page_busy_acquire(p, VM_ALLOC_WAITFAIL) == 0) { - if (object->generation != curgeneration) { - if ((flags & OBJPC_SYNC) != 0) - goto rescan; - else - clearobjflags = FALSE; - } + if (object->generation != curgeneration && + (flags & OBJPC_SYNC) != 0) + goto rescan; np = vm_page_find_least(object, pi); continue; } - if (!vm_object_page_remove_write(p, flags, &clearobjflags)) { + if (!vm_object_page_remove_write(p, flags, &allclean)) { vm_page_xunbusy(p); continue; } n = vm_object_page_collect_flush(object, p, pagerflags, - flags, &clearobjflags, &eio); + flags, &allclean, &eio); if (eio) { res = FALSE; - clearobjflags = FALSE; + allclean = FALSE; } - if (object->generation != curgeneration) { - if ((flags & OBJPC_SYNC) != 0) - goto rescan; - else - clearobjflags = FALSE; - } + if (object->generation != curgeneration && + (flags & OBJPC_SYNC) != 0) + goto rescan; /* * If the VOP_PUTPAGES() did a truncated write, so @@ -887,7 +877,7 @@ rescan: */ if (n == 0) { n = 1; - clearobjflags = FALSE; + allclean = FALSE; } np = vm_page_find_least(object, pi + n); } @@ -895,14 +885,14 @@ rescan: VOP_FSYNC(vp, (pagerflags & VM_PAGER_PUT_SYNC) ? MNT_WAIT : 0); #endif - if (clearobjflags) - vm_object_clear_flag(object, OBJ_MIGHTBEDIRTY); + if (allclean) + object->cleangeneration = curgeneration; return (res); } static int vm_object_page_collect_flush(vm_object_t object, vm_page_t p, int pagerflags, - int flags, boolean_t *clearobjflags, boolean_t *eio) + int flags, boolean_t *allclean, boolean_t *eio) { vm_page_t ma[vm_pageout_page_count], p_first, tp; int count, i, mreq, runlen; @@ -918,7 +908,7 @@ vm_object_page_collect_flush(vm_object_t object, vm_pa tp = vm_page_next(tp); if (tp == NULL || vm_page_tryxbusy(tp) == 0) break; - if (!vm_object_page_remove_write(tp, flags, clearobjflags)) { + if (!vm_object_page_remove_write(tp, flags, allclean)) { vm_page_xunbusy(tp); break; } @@ -928,7 +918,7 @@ vm_object_page_collect_flush(vm_object_t object, vm_pa tp = vm_page_prev(p_first); if (tp == NULL || vm_page_tryxbusy(tp) == 0) break; - if (!vm_object_page_remove_write(tp, flags, clearobjflags)) { + if (!vm_object_page_remove_write(tp, flags, allclean)) { vm_page_xunbusy(tp); break; } @@ -993,7 +983,7 @@ vm_object_sync(vm_object_t object, vm_ooffset_t offset * I/O. */ if (object->type == OBJT_VNODE && - (object->flags & OBJ_MIGHTBEDIRTY) != 0 && + vm_object_mightbedirty(object) != 0 && ((vp = object->handle)->v_vflag & VV_NOSYNC) == 0) { VM_OBJECT_WUNLOCK(object); (void) vn_start_write(vp, &mp, V_WAIT); @@ -2130,18 +2120,13 @@ void vm_object_set_writeable_dirty(vm_object_t object) { - VM_OBJECT_ASSERT_WLOCKED(object); - if (object->type != OBJT_VNODE) { - if ((object->flags & OBJ_TMPFS_NODE) != 0) { - KASSERT(object->type == OBJT_SWAP, ("non-swap tmpfs")); - vm_object_set_flag(object, OBJ_TMPFS_DIRTY); - } + VM_OBJECT_ASSERT_LOCKED(object); + + /* Only set for vnodes & tmpfs */ + if (object->type != OBJT_VNODE && + (object->flags & OBJ_TMPFS_NODE) == 0) return; - } - object->generation++; - if ((object->flags & OBJ_MIGHTBEDIRTY) != 0) - return; - vm_object_set_flag(object, OBJ_MIGHTBEDIRTY); + atomic_add_int(&object->generation, 1); } /* Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Tue Oct 29 20:58:46 2019 (r354157) +++ head/sys/vm/vm_object.h Tue Oct 29 21:06:34 2019 (r354158) @@ -105,7 +105,8 @@ struct vm_object { struct vm_radix rtree; /* root of the resident page radix trie*/ vm_pindex_t size; /* Object size */ struct domainset_ref domain; /* NUMA policy. */ - int generation; /* generation ID */ + volatile int generation; /* generation ID */ + int cleangeneration; /* Generation at clean time */ volatile u_int ref_count; /* How many refs?? */ int shadow_count; /* how many objects that this is a shadow for */ vm_memattr_t memattr; /* default memory attribute for pages */ @@ -188,9 +189,7 @@ struct vm_object { #define OBJ_UMTXDEAD 0x0020 /* umtx pshared was terminated */ #define OBJ_SIZEVNLOCK 0x0040 /* lock vnode to check obj size */ #define OBJ_PG_DTOR 0x0080 /* dont reset object, leave that for dtor */ -#define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty, only for vnode */ #define OBJ_TMPFS_NODE 0x0200 /* object belongs to tmpfs VREG node */ -#define OBJ_TMPFS_DIRTY 0x0400 /* dirty tmpfs obj */ #define OBJ_COLORED 0x1000 /* pg_color is defined */ #define OBJ_ONEMAPPING 0x2000 /* One USE (a single, non-forked) mapping flag */ #define OBJ_TMPFS 0x8000 /* has tmpfs vnode allocated */ @@ -307,6 +306,14 @@ vm_object_reserv(vm_object_t object) return (true); } return (false); +} + +static __inline bool +vm_object_mightbedirty(vm_object_t object) +{ + + return (object->type == OBJT_VNODE && + object->generation != object->cleangeneration); } void vm_object_clear_flag(vm_object_t object, u_short bits); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue Oct 29 20:58:46 2019 (r354157) +++ head/sys/vm/vm_page.c Tue Oct 29 21:06:34 2019 (r354158) @@ -1521,7 +1521,7 @@ vm_page_insert_radixdone(vm_page_t m, vm_object_t obje /* * Since we are inserting a new and possibly dirty page, - * update the object's OBJ_MIGHTBEDIRTY flag. + * update the object's generation count. */ if (pmap_page_is_write_mapped(m)) vm_object_set_writeable_dirty(object); @@ -1691,7 +1691,8 @@ vm_page_replace(vm_page_t mnew, vm_object_t object, vm /* * The object's resident_page_count does not change because we have - * swapped one page for another, but OBJ_MIGHTBEDIRTY. + * swapped one page for another, but the generation count should + * change if the page is dirty. */ if (pmap_page_is_write_mapped(mnew)) vm_object_set_writeable_dirty(object); From owner-svn-src-head@freebsd.org Tue Oct 29 21:25:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C2D90164F28; Tue, 29 Oct 2019 21:25:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 472l3z4HMCz4595; Tue, 29 Oct 2019 21:25:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 775A527FCF; Tue, 29 Oct 2019 21:25:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9TLPJ8i054806; Tue, 29 Oct 2019 21:25:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9TLPJ1g054805; Tue, 29 Oct 2019 21:25:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201910292125.x9TLPJ1g054805@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 29 Oct 2019 21:25:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354159 - head/sys/cddl/contrib/opensolaris/uts/common/zmod X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/zmod X-SVN-Commit-Revision: 354159 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2019 21:25:19 -0000 Author: mav Date: Tue Oct 29 21:25:19 2019 New Revision: 354159 URL: https://svnweb.freebsd.org/changeset/base/354159 Log: FreeBSD'fy ZFS zlib zalloc/zfree callbacks. The previous code came from OpenSolaris, which in my understanding require allocation size to be known to free memory. To store that size previous code allocated additional 8 byte header. But I have noticed that zlib with present settings allocates 64KB context buffers for each call, that could be efficiently cached by UMA, but addition of those 8 bytes makes them fall back to physical RAM allocations, that cause huge overhead and lock congestion on small blocks. Since FreeBSD's free() does not have the size argument, switching to it solves the problem, increasing write speed to ZVOLs with 4KB block size and GZIP compression on my 40-threads test system from ~60MB/s to ~600MB/s. MFC after: 1 week Sponsored by: iXsystems, Inc. Modified: head/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c Tue Oct 29 21:06:34 2019 (r354158) +++ head/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c Tue Oct 29 21:25:19 2019 (r354159) @@ -27,45 +27,28 @@ #include #include #include -#include +#include #include #include #include -struct zchdr { - uint_t zch_magic; - uint_t zch_size; -}; - -#define ZCH_MAGIC 0x3cc13cc1 - /*ARGSUSED*/ static void * zfs_zcalloc(void *opaque, uint_t items, uint_t size) { - size_t nbytes = sizeof (struct zchdr) + items * size; - struct zchdr *z = kobj_zalloc(nbytes, KM_NOWAIT|KM_TMP); + void *ptr; - if (z == NULL) - return (NULL); - - z->zch_magic = ZCH_MAGIC; - z->zch_size = nbytes; - - return (z + 1); + ptr = malloc((size_t)items * size, M_SOLARIS, M_NOWAIT); + return ptr; } /*ARGSUSED*/ static void zfs_zcfree(void *opaque, void *ptr) { - struct zchdr *z = ((struct zchdr *)ptr) - 1; - if (z->zch_magic != ZCH_MAGIC) - panic("zcfree region corrupt: hdr=%p ptr=%p", (void *)z, ptr); - - kobj_free(z, z->zch_size); + free(ptr, M_SOLARIS); } /* From owner-svn-src-head@freebsd.org Wed Oct 30 01:41:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E87D173740; Wed, 30 Oct 2019 01:41:15 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 472rlH37xXz4HGj; Wed, 30 Oct 2019 01:41:15 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F55E2D58; Wed, 30 Oct 2019 01:41:15 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9U1fF7D005429; Wed, 30 Oct 2019 01:41:15 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9U1fEPA005427; Wed, 30 Oct 2019 01:41:14 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910300141.x9U1fEPA005427@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 30 Oct 2019 01:41:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354162 - in head/sys/x86: include x86 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys/x86: include x86 X-SVN-Commit-Revision: 354162 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 01:41:15 -0000 Author: cem Date: Wed Oct 30 01:41:14 2019 New Revision: 354162 URL: https://svnweb.freebsd.org/changeset/base/354162 Log: amd64: Define and decode new AMD64 feature bits These are documented in revisions 3.32 of the public AMD64 Vol. 2 and revision 3.28 of Vol. 3, published October and September 2019, respectively. Modified: head/sys/x86/include/specialreg.h head/sys/x86/x86/identcpu.c Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Wed Oct 30 01:35:00 2019 (r354161) +++ head/sys/x86/include/specialreg.h Wed Oct 30 01:41:14 2019 (r354162) @@ -71,6 +71,7 @@ #define CR4_PCE 0x00000100 /* Performance monitoring counter enable */ #define CR4_FXSR 0x00000200 /* Fast FPU save/restore used by OS */ #define CR4_XMM 0x00000400 /* enable SIMD/MMX2 to use except 16 */ +#define CR4_UMIP 0x00000800 /* User Mode Instruction Prevention */ #define CR4_VMXE 0x00002000 /* enable VMX operation (Intel-specific) */ #define CR4_FSGSBASE 0x00010000 /* Enable FS/GS BASE accessing instructions */ #define CR4_PCIDE 0x00020000 /* Enable Context ID */ @@ -90,6 +91,7 @@ #define EFER_LMSLE 0x000002000 /* Long Mode Segment Limit Enable */ #define EFER_FFXSR 0x000004000 /* Fast FXSAVE/FSRSTOR */ #define EFER_TCE 0x000008000 /* Translation Cache Extension */ +#define EFER_MCOMMIT 0x00020000 /* Enable MCOMMIT (AMD) */ /* * Intel Extended Features registers @@ -384,6 +386,9 @@ #define AMDFEID_CLZERO 0x00000001 #define AMDFEID_IRPERF 0x00000002 #define AMDFEID_XSAVEERPTR 0x00000004 +#define AMDFEID_RDPRU 0x00000004 +#define AMDFEID_MCOMMIT 0x00000100 +#define AMDFEID_WBNOINVD 0x00000200 #define AMDFEID_IBPB 0x00001000 #define AMDFEID_IBRS 0x00004000 #define AMDFEID_STIBP 0x00008000 Modified: head/sys/x86/x86/identcpu.c ============================================================================== --- head/sys/x86/x86/identcpu.c Wed Oct 30 01:35:00 2019 (r354161) +++ head/sys/x86/x86/identcpu.c Wed Oct 30 01:41:14 2019 (r354162) @@ -1067,6 +1067,9 @@ printcpuinfo(void) "\001CLZERO" "\002IRPerf" "\003XSaveErPtr" + "\005RDPRU" + "\011MCOMMIT" + "\012WBNOINVD" "\015IBPB" "\017IBRS" "\020STIBP" @@ -2355,7 +2358,7 @@ print_svm_info(void) "\017" "\020V_VMSAVE_VMLOAD" "\021vGIF" - "\022" + "\022GMET" /* Guest Mode Execute Trap */ "\023" "\024" "\025" From owner-svn-src-head@freebsd.org Wed Oct 30 04:00:45 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 601EE177F7C; Wed, 30 Oct 2019 04:00:45 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 472vrF1h7xz4Pj3; Wed, 30 Oct 2019 04:00:45 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1AA234980; Wed, 30 Oct 2019 04:00:45 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9U40itO086225; Wed, 30 Oct 2019 04:00:44 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9U40iSD086188; Wed, 30 Oct 2019 04:00:44 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910300400.x9U40iSD086188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 30 Oct 2019 04:00:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354167 - head/sys/x86/include X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/x86/include X-SVN-Commit-Revision: 354167 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 04:00:45 -0000 Author: cem Date: Wed Oct 30 04:00:44 2019 New Revision: 354167 URL: https://svnweb.freebsd.org/changeset/base/354167 Log: amd64: Fix typo: RDPRU bit is 0x10, not 0x04 Bit 4 != 4, of course. X-MFC-With: r354162 Modified: head/sys/x86/include/specialreg.h Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Wed Oct 30 02:33:43 2019 (r354166) +++ head/sys/x86/include/specialreg.h Wed Oct 30 04:00:44 2019 (r354167) @@ -386,7 +386,7 @@ #define AMDFEID_CLZERO 0x00000001 #define AMDFEID_IRPERF 0x00000002 #define AMDFEID_XSAVEERPTR 0x00000004 -#define AMDFEID_RDPRU 0x00000004 +#define AMDFEID_RDPRU 0x00000010 #define AMDFEID_MCOMMIT 0x00000100 #define AMDFEID_WBNOINVD 0x00000200 #define AMDFEID_IBPB 0x00001000 From owner-svn-src-head@freebsd.org Wed Oct 30 10:06:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11AD717FEDE; Wed, 30 Oct 2019 10:06:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4733yq0MBPz3Bs5; Wed, 30 Oct 2019 10:06:59 +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 C76F08ABD; Wed, 30 Oct 2019 10:06:58 +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 x9UA6wUU000491; Wed, 30 Oct 2019 10:06:58 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UA6wH6000488; Wed, 30 Oct 2019 10:06:58 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910301006.x9UA6wH6000488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 30 Oct 2019 10:06:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354170 - in head/sys: arm64/arm64 arm64/include libkern X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys: arm64/arm64 arm64/include libkern X-SVN-Commit-Revision: 354170 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 10:06:59 -0000 Author: andrew Date: Wed Oct 30 10:06:57 2019 New Revision: 354170 URL: https://svnweb.freebsd.org/changeset/base/354170 Log: Rename the macros to extract a single arm64 ID field. Because of the previous naming scheme the old ID_AA64PFR0_EL1 macro collided with a potential macro for the register of the same name. To fix this collision rename these macros. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/elf32_machdep.c head/sys/arm64/include/armreg.h head/sys/libkern/gsb_crc32.c Modified: head/sys/arm64/arm64/elf32_machdep.c ============================================================================== --- head/sys/arm64/arm64/elf32_machdep.c Wed Oct 30 08:06:22 2019 (r354169) +++ head/sys/arm64/arm64/elf32_machdep.c Wed Oct 30 10:06:57 2019 (r354170) @@ -130,7 +130,7 @@ elf32_arm_abi_supported(struct image_params *imgp) const Elf32_Ehdr *hdr; /* Check if we support AArch32 */ - if (ID_AA64PFR0_EL0(READ_SPECIALREG(id_aa64pfr0_el1)) != + if (ID_AA64PFR0_EL0_VAL(READ_SPECIALREG(id_aa64pfr0_el1)) != ID_AA64PFR0_EL0_64_32) return (FALSE); Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Wed Oct 30 08:06:22 2019 (r354169) +++ head/sys/arm64/include/armreg.h Wed Oct 30 10:06:57 2019 (r354170) @@ -178,140 +178,140 @@ /* ID_AA64DFR0_EL1 */ #define ID_AA64DFR0_DebugVer_SHIFT 0 #define ID_AA64DFR0_DebugVer_MASK (UL(0xf) << ID_AA64DFR0_DebugVer_SHIFT) -#define ID_AA64DFR0_DebugVer(x) ((x) & ID_AA64DFR0_DebugVer_MASK) +#define ID_AA64DFR0_DebugVer_VAL(x) ((x) & ID_AA64DFR0_DebugVer_MASK) #define ID_AA64DFR0_DebugVer_8 (UL(0x6) << ID_AA64DFR0_DebugVer_SHIFT) #define ID_AA64DFR0_DebugVer_8_VHE (UL(0x7) << ID_AA64DFR0_DebugVer_SHIFT) #define ID_AA64DFR0_DebugVer_8_2 (UL(0x8) << ID_AA64DFR0_DebugVer_SHIFT) #define ID_AA64DFR0_TraceVer_SHIFT 4 #define ID_AA64DFR0_TraceVer_MASK (UL(0xf) << ID_AA64DFR0_TraceVer_SHIFT) -#define ID_AA64DFR0_TraceVer(x) ((x) & ID_AA64DFR0_TraceVer_MASK) +#define ID_AA64DFR0_TraceVer_VAL(x) ((x) & ID_AA64DFR0_TraceVer_MASK) #define ID_AA64DFR0_TraceVer_NONE (UL(0x0) << ID_AA64DFR0_TraceVer_SHIFT) #define ID_AA64DFR0_TraceVer_IMPL (UL(0x1) << ID_AA64DFR0_TraceVer_SHIFT) #define ID_AA64DFR0_PMUVer_SHIFT 8 #define ID_AA64DFR0_PMUVer_MASK (UL(0xf) << ID_AA64DFR0_PMUVer_SHIFT) -#define ID_AA64DFR0_PMUVer(x) ((x) & ID_AA64DFR0_PMUVer_MASK) +#define ID_AA64DFR0_PMUVer_VAL(x) ((x) & ID_AA64DFR0_PMUVer_MASK) #define ID_AA64DFR0_PMUVer_NONE (UL(0x0) << ID_AA64DFR0_PMUVer_SHIFT) #define ID_AA64DFR0_PMUVer_3 (UL(0x1) << ID_AA64DFR0_PMUVer_SHIFT) #define ID_AA64DFR0_PMUVer_3_1 (UL(0x4) << ID_AA64DFR0_PMUVer_SHIFT) #define ID_AA64DFR0_PMUVer_IMPL (UL(0xf) << ID_AA64DFR0_PMUVer_SHIFT) #define ID_AA64DFR0_BRPs_SHIFT 12 #define ID_AA64DFR0_BRPs_MASK (UL(0xf) << ID_AA64DFR0_BRPs_SHIFT) -#define ID_AA64DFR0_BRPs(x) \ +#define ID_AA64DFR0_BRPs_VAL(x) \ ((((x) >> ID_AA64DFR0_BRPs_SHIFT) & 0xf) + 1) #define ID_AA64DFR0_WRPs_SHIFT 20 #define ID_AA64DFR0_WRPs_MASK (UL(0xf) << ID_AA64DFR0_WRPs_SHIFT) -#define ID_AA64DFR0_WRPs(x) \ +#define ID_AA64DFR0_WRPs_VAL(x) \ ((((x) >> ID_AA64DFR0_WRPs_SHIFT) & 0xf) + 1) #define ID_AA64DFR0_CTX_CMPs_SHIFT 28 #define ID_AA64DFR0_CTX_CMPs_MASK (UL(0xf) << ID_AA64DFR0_CTX_CMPs_SHIFT) -#define ID_AA64DFR0_CTX_CMPs(x) \ +#define ID_AA64DFR0_CTX_CMPs_VAL(x) \ ((((x) >> ID_AA64DFR0_CTX_CMPs_SHIFT) & 0xf) + 1) #define ID_AA64DFR0_PMSVer_SHIFT 32 #define ID_AA64DFR0_PMSVer_MASK (UL(0xf) << ID_AA64DFR0_PMSVer_SHIFT) -#define ID_AA64DFR0_PMSVer(x) ((x) & ID_AA64DFR0_PMSVer_MASK) +#define ID_AA64DFR0_PMSVer_VAL(x) ((x) & ID_AA64DFR0_PMSVer_MASK) #define ID_AA64DFR0_PMSVer_NONE (UL(0x0) << ID_AA64DFR0_PMSVer_SHIFT) #define ID_AA64DFR0_PMSVer_V1 (UL(0x1) << ID_AA64DFR0_PMSVer_SHIFT) /* ID_AA64ISAR0_EL1 */ #define ID_AA64ISAR0_AES_SHIFT 4 #define ID_AA64ISAR0_AES_MASK (UL(0xf) << ID_AA64ISAR0_AES_SHIFT) -#define ID_AA64ISAR0_AES(x) ((x) & ID_AA64ISAR0_AES_MASK) +#define ID_AA64ISAR0_AES_VAL(x) ((x) & ID_AA64ISAR0_AES_MASK) #define ID_AA64ISAR0_AES_NONE (UL(0x0) << ID_AA64ISAR0_AES_SHIFT) #define ID_AA64ISAR0_AES_BASE (UL(0x1) << ID_AA64ISAR0_AES_SHIFT) #define ID_AA64ISAR0_AES_PMULL (UL(0x2) << ID_AA64ISAR0_AES_SHIFT) #define ID_AA64ISAR0_SHA1_SHIFT 8 #define ID_AA64ISAR0_SHA1_MASK (UL(0xf) << ID_AA64ISAR0_SHA1_SHIFT) -#define ID_AA64ISAR0_SHA1(x) ((x) & ID_AA64ISAR0_SHA1_MASK) +#define ID_AA64ISAR0_SHA1_VAL(x) ((x) & ID_AA64ISAR0_SHA1_MASK) #define ID_AA64ISAR0_SHA1_NONE (UL(0x0) << ID_AA64ISAR0_SHA1_SHIFT) #define ID_AA64ISAR0_SHA1_BASE (UL(0x1) << ID_AA64ISAR0_SHA1_SHIFT) #define ID_AA64ISAR0_SHA2_SHIFT 12 #define ID_AA64ISAR0_SHA2_MASK (UL(0xf) << ID_AA64ISAR0_SHA2_SHIFT) -#define ID_AA64ISAR0_SHA2(x) ((x) & ID_AA64ISAR0_SHA2_MASK) +#define ID_AA64ISAR0_SHA2_VAL(x) ((x) & ID_AA64ISAR0_SHA2_MASK) #define ID_AA64ISAR0_SHA2_NONE (UL(0x0) << ID_AA64ISAR0_SHA2_SHIFT) #define ID_AA64ISAR0_SHA2_BASE (UL(0x1) << ID_AA64ISAR0_SHA2_SHIFT) #define ID_AA64ISAR0_SHA2_512 (UL(0x2) << ID_AA64ISAR0_SHA2_SHIFT) #define ID_AA64ISAR0_CRC32_SHIFT 16 #define ID_AA64ISAR0_CRC32_MASK (UL(0xf) << ID_AA64ISAR0_CRC32_SHIFT) -#define ID_AA64ISAR0_CRC32(x) ((x) & ID_AA64ISAR0_CRC32_MASK) +#define ID_AA64ISAR0_CRC32_VAL(x) ((x) & ID_AA64ISAR0_CRC32_MASK) #define ID_AA64ISAR0_CRC32_NONE (UL(0x0) << ID_AA64ISAR0_CRC32_SHIFT) #define ID_AA64ISAR0_CRC32_BASE (UL(0x1) << ID_AA64ISAR0_CRC32_SHIFT) #define ID_AA64ISAR0_Atomic_SHIFT 20 #define ID_AA64ISAR0_Atomic_MASK (UL(0xf) << ID_AA64ISAR0_Atomic_SHIFT) -#define ID_AA64ISAR0_Atomic(x) ((x) & ID_AA64ISAR0_Atomic_MASK) +#define ID_AA64ISAR0_Atomic_VAL(x) ((x) & ID_AA64ISAR0_Atomic_MASK) #define ID_AA64ISAR0_Atomic_NONE (UL(0x0) << ID_AA64ISAR0_Atomic_SHIFT) #define ID_AA64ISAR0_Atomic_IMPL (UL(0x2) << ID_AA64ISAR0_Atomic_SHIFT) #define ID_AA64ISAR0_RDM_SHIFT 28 #define ID_AA64ISAR0_RDM_MASK (UL(0xf) << ID_AA64ISAR0_RDM_SHIFT) -#define ID_AA64ISAR0_RDM(x) ((x) & ID_AA64ISAR0_RDM_MASK) +#define ID_AA64ISAR0_RDM_VAL(x) ((x) & ID_AA64ISAR0_RDM_MASK) #define ID_AA64ISAR0_RDM_NONE (UL(0x0) << ID_AA64ISAR0_RDM_SHIFT) #define ID_AA64ISAR0_RDM_IMPL (UL(0x1) << ID_AA64ISAR0_RDM_SHIFT) #define ID_AA64ISAR0_SHA3_SHIFT 32 #define ID_AA64ISAR0_SHA3_MASK (UL(0xf) << ID_AA64ISAR0_SHA3_SHIFT) -#define ID_AA64ISAR0_SHA3(x) ((x) & ID_AA64ISAR0_SHA3_MASK) +#define ID_AA64ISAR0_SHA3_VAL(x) ((x) & ID_AA64ISAR0_SHA3_MASK) #define ID_AA64ISAR0_SHA3_NONE (UL(0x0) << ID_AA64ISAR0_SHA3_SHIFT) #define ID_AA64ISAR0_SHA3_IMPL (UL(0x1) << ID_AA64ISAR0_SHA3_SHIFT) #define ID_AA64ISAR0_SM3_SHIFT 36 #define ID_AA64ISAR0_SM3_MASK (UL(0xf) << ID_AA64ISAR0_SM3_SHIFT) -#define ID_AA64ISAR0_SM3(x) ((x) & ID_AA64ISAR0_SM3_MASK) +#define ID_AA64ISAR0_SM3_VAL(x) ((x) & ID_AA64ISAR0_SM3_MASK) #define ID_AA64ISAR0_SM3_NONE (UL(0x0) << ID_AA64ISAR0_SM3_SHIFT) #define ID_AA64ISAR0_SM3_IMPL (UL(0x1) << ID_AA64ISAR0_SM3_SHIFT) #define ID_AA64ISAR0_SM4_SHIFT 40 #define ID_AA64ISAR0_SM4_MASK (UL(0xf) << ID_AA64ISAR0_SM4_SHIFT) -#define ID_AA64ISAR0_SM4(x) ((x) & ID_AA64ISAR0_SM4_MASK) +#define ID_AA64ISAR0_SM4_VAL(x) ((x) & ID_AA64ISAR0_SM4_MASK) #define ID_AA64ISAR0_SM4_NONE (UL(0x0) << ID_AA64ISAR0_SM4_SHIFT) #define ID_AA64ISAR0_SM4_IMPL (UL(0x1) << ID_AA64ISAR0_SM4_SHIFT) #define ID_AA64ISAR0_DP_SHIFT 44 #define ID_AA64ISAR0_DP_MASK (UL(0xf) << ID_AA64ISAR0_DP_SHIFT) -#define ID_AA64ISAR0_DP(x) ((x) & ID_AA64ISAR0_DP_MASK) +#define ID_AA64ISAR0_DP_VAL(x) ((x) & ID_AA64ISAR0_DP_MASK) #define ID_AA64ISAR0_DP_NONE (UL(0x0) << ID_AA64ISAR0_DP_SHIFT) #define ID_AA64ISAR0_DP_IMPL (UL(0x1) << ID_AA64ISAR0_DP_SHIFT) /* ID_AA64ISAR1_EL1 */ #define ID_AA64ISAR1_DPB_SHIFT 0 #define ID_AA64ISAR1_DPB_MASK (UL(0xf) << ID_AA64ISAR1_DPB_SHIFT) -#define ID_AA64ISAR1_DPB(x) ((x) & ID_AA64ISAR1_DPB_MASK) +#define ID_AA64ISAR1_DPB_VAL(x) ((x) & ID_AA64ISAR1_DPB_MASK) #define ID_AA64ISAR1_DPB_NONE (UL(0x0) << ID_AA64ISAR1_DPB_SHIFT) #define ID_AA64ISAR1_DPB_IMPL (UL(0x1) << ID_AA64ISAR1_DPB_SHIFT) #define ID_AA64ISAR1_APA_SHIFT 4 #define ID_AA64ISAR1_APA_MASK (UL(0xf) << ID_AA64ISAR1_APA_SHIFT) -#define ID_AA64ISAR1_APA(x) ((x) & ID_AA64ISAR1_APA_MASK) +#define ID_AA64ISAR1_APA_VAL(x) ((x) & ID_AA64ISAR1_APA_MASK) #define ID_AA64ISAR1_APA_NONE (UL(0x0) << ID_AA64ISAR1_APA_SHIFT) #define ID_AA64ISAR1_APA_IMPL (UL(0x1) << ID_AA64ISAR1_APA_SHIFT) #define ID_AA64ISAR1_API_SHIFT 8 #define ID_AA64ISAR1_API_MASK (UL(0xf) << ID_AA64ISAR1_API_SHIFT) -#define ID_AA64ISAR1_API(x) ((x) & ID_AA64ISAR1_API_MASK) +#define ID_AA64ISAR1_API_VAL(x) ((x) & ID_AA64ISAR1_API_MASK) #define ID_AA64ISAR1_API_NONE (UL(0x0) << ID_AA64ISAR1_API_SHIFT) #define ID_AA64ISAR1_API_IMPL (UL(0x1) << ID_AA64ISAR1_API_SHIFT) #define ID_AA64ISAR1_JSCVT_SHIFT 12 #define ID_AA64ISAR1_JSCVT_MASK (UL(0xf) << ID_AA64ISAR1_JSCVT_SHIFT) -#define ID_AA64ISAR1_JSCVT(x) ((x) & ID_AA64ISAR1_JSCVT_MASK) +#define ID_AA64ISAR1_JSCVT_VAL(x) ((x) & ID_AA64ISAR1_JSCVT_MASK) #define ID_AA64ISAR1_JSCVT_NONE (UL(0x0) << ID_AA64ISAR1_JSCVT_SHIFT) #define ID_AA64ISAR1_JSCVT_IMPL (UL(0x1) << ID_AA64ISAR1_JSCVT_SHIFT) #define ID_AA64ISAR1_FCMA_SHIFT 16 #define ID_AA64ISAR1_FCMA_MASK (UL(0xf) << ID_AA64ISAR1_FCMA_SHIFT) -#define ID_AA64ISAR1_FCMA(x) ((x) & ID_AA64ISAR1_FCMA_MASK) +#define ID_AA64ISAR1_FCMA_VAL(x) ((x) & ID_AA64ISAR1_FCMA_MASK) #define ID_AA64ISAR1_FCMA_NONE (UL(0x0) << ID_AA64ISAR1_FCMA_SHIFT) #define ID_AA64ISAR1_FCMA_IMPL (UL(0x1) << ID_AA64ISAR1_FCMA_SHIFT) #define ID_AA64ISAR1_LRCPC_SHIFT 20 #define ID_AA64ISAR1_LRCPC_MASK (UL(0xf) << ID_AA64ISAR1_LRCPC_SHIFT) -#define ID_AA64ISAR1_LRCPC(x) ((x) & ID_AA64ISAR1_LRCPC_MASK) +#define ID_AA64ISAR1_LRCPC_VAL(x) ((x) & ID_AA64ISAR1_LRCPC_MASK) #define ID_AA64ISAR1_LRCPC_NONE (UL(0x0) << ID_AA64ISAR1_LRCPC_SHIFT) #define ID_AA64ISAR1_LRCPC_IMPL (UL(0x1) << ID_AA64ISAR1_LRCPC_SHIFT) #define ID_AA64ISAR1_GPA_SHIFT 24 #define ID_AA64ISAR1_GPA_MASK (UL(0xf) << ID_AA64ISAR1_GPA_SHIFT) -#define ID_AA64ISAR1_GPA(x) ((x) & ID_AA64ISAR1_GPA_MASK) +#define ID_AA64ISAR1_GPA_VAL(x) ((x) & ID_AA64ISAR1_GPA_MASK) #define ID_AA64ISAR1_GPA_NONE (UL(0x0) << ID_AA64ISAR1_GPA_SHIFT) #define ID_AA64ISAR1_GPA_IMPL (UL(0x1) << ID_AA64ISAR1_GPA_SHIFT) #define ID_AA64ISAR1_GPI_SHIFT 28 #define ID_AA64ISAR1_GPI_MASK (UL(0xf) << ID_AA64ISAR1_GPI_SHIFT) -#define ID_AA64ISAR1_GPI(x) ((x) & ID_AA64ISAR1_GPI_MASK) +#define ID_AA64ISAR1_GPI_VAL(x) ((x) & ID_AA64ISAR1_GPI_MASK) #define ID_AA64ISAR1_GPI_NONE (UL(0x0) << ID_AA64ISAR1_GPI_SHIFT) #define ID_AA64ISAR1_GPI_IMPL (UL(0x1) << ID_AA64ISAR1_GPI_SHIFT) /* ID_AA64MMFR0_EL1 */ #define ID_AA64MMFR0_PARange_SHIFT 0 #define ID_AA64MMFR0_PARange_MASK (UL(0xf) << ID_AA64MMFR0_PARange_SHIFT) -#define ID_AA64MMFR0_PARange(x) ((x) & ID_AA64MMFR0_PARange_MASK) +#define ID_AA64MMFR0_PARange_VAL(x) ((x) & ID_AA64MMFR0_PARange_MASK) #define ID_AA64MMFR0_PARange_4G (UL(0x0) << ID_AA64MMFR0_PARange_SHIFT) #define ID_AA64MMFR0_PARange_64G (UL(0x1) << ID_AA64MMFR0_PARange_SHIFT) #define ID_AA64MMFR0_PARange_1T (UL(0x2) << ID_AA64MMFR0_PARange_SHIFT) @@ -321,82 +321,82 @@ #define ID_AA64MMFR0_PARange_4P (UL(0x6) << ID_AA64MMFR0_PARange_SHIFT) #define ID_AA64MMFR0_ASIDBits_SHIFT 4 #define ID_AA64MMFR0_ASIDBits_MASK (UL(0xf) << ID_AA64MMFR0_ASIDBits_SHIFT) -#define ID_AA64MMFR0_ASIDBits(x) ((x) & ID_AA64MMFR0_ASIDBits_MASK) +#define ID_AA64MMFR0_ASIDBits_VAL(x) ((x) & ID_AA64MMFR0_ASIDBits_MASK) #define ID_AA64MMFR0_ASIDBits_8 (UL(0x0) << ID_AA64MMFR0_ASIDBits_SHIFT) #define ID_AA64MMFR0_ASIDBits_16 (UL(0x2) << ID_AA64MMFR0_ASIDBits_SHIFT) #define ID_AA64MMFR0_BigEnd_SHIFT 8 #define ID_AA64MMFR0_BigEnd_MASK (UL(0xf) << ID_AA64MMFR0_BigEnd_SHIFT) -#define ID_AA64MMFR0_BigEnd(x) ((x) & ID_AA64MMFR0_BigEnd_MASK) +#define ID_AA64MMFR0_BigEnd_VAL(x) ((x) & ID_AA64MMFR0_BigEnd_MASK) #define ID_AA64MMFR0_BigEnd_FIXED (UL(0x0) << ID_AA64MMFR0_BigEnd_SHIFT) #define ID_AA64MMFR0_BigEnd_MIXED (UL(0x1) << ID_AA64MMFR0_BigEnd_SHIFT) #define ID_AA64MMFR0_SNSMem_SHIFT 12 #define ID_AA64MMFR0_SNSMem_MASK (UL(0xf) << ID_AA64MMFR0_SNSMem_SHIFT) -#define ID_AA64MMFR0_SNSMem(x) ((x) & ID_AA64MMFR0_SNSMem_MASK) +#define ID_AA64MMFR0_SNSMem_VAL(x) ((x) & ID_AA64MMFR0_SNSMem_MASK) #define ID_AA64MMFR0_SNSMem_NONE (UL(0x0) << ID_AA64MMFR0_SNSMem_SHIFT) #define ID_AA64MMFR0_SNSMem_DISTINCT (UL(0x1) << ID_AA64MMFR0_SNSMem_SHIFT) #define ID_AA64MMFR0_BigEndEL0_SHIFT 16 #define ID_AA64MMFR0_BigEndEL0_MASK (UL(0xf) << ID_AA64MMFR0_BigEndEL0_SHIFT) -#define ID_AA64MMFR0_BigEndEL0(x) ((x) & ID_AA64MMFR0_BigEndEL0_MASK) +#define ID_AA64MMFR0_BigEndEL0_VAL(x) ((x) & ID_AA64MMFR0_BigEndEL0_MASK) #define ID_AA64MMFR0_BigEndEL0_FIXED (UL(0x0) << ID_AA64MMFR0_BigEndEL0_SHIFT) #define ID_AA64MMFR0_BigEndEL0_MIXED (UL(0x1) << ID_AA64MMFR0_BigEndEL0_SHIFT) #define ID_AA64MMFR0_TGran16_SHIFT 20 #define ID_AA64MMFR0_TGran16_MASK (UL(0xf) << ID_AA64MMFR0_TGran16_SHIFT) -#define ID_AA64MMFR0_TGran16(x) ((x) & ID_AA64MMFR0_TGran16_MASK) +#define ID_AA64MMFR0_TGran16_VAL(x) ((x) & ID_AA64MMFR0_TGran16_MASK) #define ID_AA64MMFR0_TGran16_NONE (UL(0x0) << ID_AA64MMFR0_TGran16_SHIFT) #define ID_AA64MMFR0_TGran16_IMPL (UL(0x1) << ID_AA64MMFR0_TGran16_SHIFT) #define ID_AA64MMFR0_TGran64_SHIFT 24 #define ID_AA64MMFR0_TGran64_MASK (UL(0xf) << ID_AA64MMFR0_TGran64_SHIFT) -#define ID_AA64MMFR0_TGran64(x) ((x) & ID_AA64MMFR0_TGran64_MASK) +#define ID_AA64MMFR0_TGran64_VAL(x) ((x) & ID_AA64MMFR0_TGran64_MASK) #define ID_AA64MMFR0_TGran64_IMPL (UL(0x0) << ID_AA64MMFR0_TGran64_SHIFT) #define ID_AA64MMFR0_TGran64_NONE (UL(0xf) << ID_AA64MMFR0_TGran64_SHIFT) #define ID_AA64MMFR0_TGran4_SHIFT 28 #define ID_AA64MMFR0_TGran4_MASK (UL(0xf) << ID_AA64MMFR0_TGran4_SHIFT) -#define ID_AA64MMFR0_TGran4(x) ((x) & ID_AA64MMFR0_TGran4_MASK) +#define ID_AA64MMFR0_TGran4_VAL(x) ((x) & ID_AA64MMFR0_TGran4_MASK) #define ID_AA64MMFR0_TGran4_IMPL (UL(0x0) << ID_AA64MMFR0_TGran4_SHIFT) #define ID_AA64MMFR0_TGran4_NONE (UL(0xf) << ID_AA64MMFR0_TGran4_SHIFT) /* ID_AA64MMFR1_EL1 */ #define ID_AA64MMFR1_HAFDBS_SHIFT 0 #define ID_AA64MMFR1_HAFDBS_MASK (UL(0xf) << ID_AA64MMFR1_HAFDBS_SHIFT) -#define ID_AA64MMFR1_HAFDBS(x) ((x) & ID_AA64MMFR1_HAFDBS_MASK) +#define ID_AA64MMFR1_HAFDBS_VAL(x) ((x) & ID_AA64MMFR1_HAFDBS_MASK) #define ID_AA64MMFR1_HAFDBS_NONE (UL(0x0) << ID_AA64MMFR1_HAFDBS_SHIFT) #define ID_AA64MMFR1_HAFDBS_AF (UL(0x1) << ID_AA64MMFR1_HAFDBS_SHIFT) #define ID_AA64MMFR1_HAFDBS_AF_DBS (UL(0x2) << ID_AA64MMFR1_HAFDBS_SHIFT) #define ID_AA64MMFR1_VMIDBits_SHIFT 4 #define ID_AA64MMFR1_VMIDBits_MASK (UL(0xf) << ID_AA64MMFR1_VMIDBits_SHIFT) -#define ID_AA64MMFR1_VMIDBits(x) ((x) & ID_AA64MMFR1_VMIDBits_MASK) +#define ID_AA64MMFR1_VMIDBits_VAL(x) ((x) & ID_AA64MMFR1_VMIDBits_MASK) #define ID_AA64MMFR1_VMIDBits_8 (UL(0x0) << ID_AA64MMFR1_VMIDBits_SHIFT) #define ID_AA64MMFR1_VMIDBits_16 (UL(0x2) << ID_AA64MMFR1_VMIDBits_SHIFT) #define ID_AA64MMFR1_VH_SHIFT 8 #define ID_AA64MMFR1_VH_MASK (UL(0xf) << ID_AA64MMFR1_VH_SHIFT) -#define ID_AA64MMFR1_VH(x) ((x) & ID_AA64MMFR1_VH_MASK) +#define ID_AA64MMFR1_VH_VAL(x) ((x) & ID_AA64MMFR1_VH_MASK) #define ID_AA64MMFR1_VH_NONE (UL(0x0) << ID_AA64MMFR1_VH_SHIFT) #define ID_AA64MMFR1_VH_IMPL (UL(0x1) << ID_AA64MMFR1_VH_SHIFT) #define ID_AA64MMFR1_HPDS_SHIFT 12 #define ID_AA64MMFR1_HPDS_MASK (UL(0xf) << ID_AA64MMFR1_HPDS_SHIFT) -#define ID_AA64MMFR1_HPDS(x) ((x) & ID_AA64MMFR1_HPDS_MASK) +#define ID_AA64MMFR1_HPDS_VAL(x) ((x) & ID_AA64MMFR1_HPDS_MASK) #define ID_AA64MMFR1_HPDS_NONE (UL(0x0) << ID_AA64MMFR1_HPDS_SHIFT) #define ID_AA64MMFR1_HPDS_HPD (UL(0x1) << ID_AA64MMFR1_HPDS_SHIFT) #define ID_AA64MMFR1_HPDS_TTPBHA (UL(0x2) << ID_AA64MMFR1_HPDS_SHIFT) #define ID_AA64MMFR1_LO_SHIFT 16 #define ID_AA64MMFR1_LO_MASK (UL(0xf) << ID_AA64MMFR1_LO_SHIFT) -#define ID_AA64MMFR1_LO(x) ((x) & ID_AA64MMFR1_LO_MASK) +#define ID_AA64MMFR1_LO_VAL(x) ((x) & ID_AA64MMFR1_LO_MASK) #define ID_AA64MMFR1_LO_NONE (UL(0x0) << ID_AA64MMFR1_LO_SHIFT) #define ID_AA64MMFR1_LO_IMPL (UL(0x1) << ID_AA64MMFR1_LO_SHIFT) #define ID_AA64MMFR1_PAN_SHIFT 20 #define ID_AA64MMFR1_PAN_MASK (UL(0xf) << ID_AA64MMFR1_PAN_SHIFT) -#define ID_AA64MMFR1_PAN(x) ((x) & ID_AA64MMFR1_PAN_MASK) +#define ID_AA64MMFR1_PAN_VAL(x) ((x) & ID_AA64MMFR1_PAN_MASK) #define ID_AA64MMFR1_PAN_NONE (UL(0x0) << ID_AA64MMFR1_PAN_SHIFT) #define ID_AA64MMFR1_PAN_IMPL (UL(0x1) << ID_AA64MMFR1_PAN_SHIFT) #define ID_AA64MMFR1_PAN_ATS1E1 (UL(0x2) << ID_AA64MMFR1_PAN_SHIFT) #define ID_AA64MMFR1_SpecSEI_SHIFT 24 #define ID_AA64MMFR1_SpecSEI_MASK (UL(0xf) << ID_AA64MMFR1_SpecSEI_SHIFT) -#define ID_AA64MMFR1_SpecSEI(x) ((x) & ID_AA64MMFR1_SpecSEI_MASK) +#define ID_AA64MMFR1_SpecSEI_VAL(x) ((x) & ID_AA64MMFR1_SpecSEI_MASK) #define ID_AA64MMFR1_SpecSEI_NONE (UL(0x0) << ID_AA64MMFR1_SpecSEI_SHIFT) #define ID_AA64MMFR1_SpecSEI_IMPL (UL(0x1) << ID_AA64MMFR1_SpecSEI_SHIFT) #define ID_AA64MMFR1_XNX_SHIFT 28 #define ID_AA64MMFR1_XNX_MASK (UL(0xf) << ID_AA64MMFR1_XNX_SHIFT) -#define ID_AA64MMFR1_XNX(x) ((x) & ID_AA64MMFR1_XNX_MASK) +#define ID_AA64MMFR1_XNX_VAL(x) ((x) & ID_AA64MMFR1_XNX_MASK) #define ID_AA64MMFR1_XNX_NONE (UL(0x0) << ID_AA64MMFR1_XNX_SHIFT) #define ID_AA64MMFR1_XNX_IMPL (UL(0x1) << ID_AA64MMFR1_XNX_SHIFT) @@ -404,89 +404,89 @@ #define ID_AA64MMFR2_EL1 S3_0_C0_C7_2 #define ID_AA64MMFR2_CnP_SHIFT 0 #define ID_AA64MMFR2_CnP_MASK (UL(0xf) << ID_AA64MMFR2_CnP_SHIFT) -#define ID_AA64MMFR2_CnP(x) ((x) & ID_AA64MMFR2_CnP_MASK) +#define ID_AA64MMFR2_CnP_VAL(x) ((x) & ID_AA64MMFR2_CnP_MASK) #define ID_AA64MMFR2_CnP_NONE (UL(0x0) << ID_AA64MMFR2_CnP_SHIFT) #define ID_AA64MMFR2_CnP_IMPL (UL(0x1) << ID_AA64MMFR2_CnP_SHIFT) #define ID_AA64MMFR2_UAO_SHIFT 4 #define ID_AA64MMFR2_UAO_MASK (UL(0xf) << ID_AA64MMFR2_UAO_SHIFT) -#define ID_AA64MMFR2_UAO(x) ((x) & ID_AA64MMFR2_UAO_MASK) +#define ID_AA64MMFR2_UAO_VAL(x) ((x) & ID_AA64MMFR2_UAO_MASK) #define ID_AA64MMFR2_UAO_NONE (UL(0x0) << ID_AA64MMFR2_UAO_SHIFT) #define ID_AA64MMFR2_UAO_IMPL (UL(0x1) << ID_AA64MMFR2_UAO_SHIFT) #define ID_AA64MMFR2_LSM_SHIFT 8 #define ID_AA64MMFR2_LSM_MASK (UL(0xf) << ID_AA64MMFR2_LSM_SHIFT) -#define ID_AA64MMFR2_LSM(x) ((x) & ID_AA64MMFR2_LSM_MASK) +#define ID_AA64MMFR2_LSM_VAL(x) ((x) & ID_AA64MMFR2_LSM_MASK) #define ID_AA64MMFR2_LSM_NONE (UL(0x0) << ID_AA64MMFR2_LSM_SHIFT) #define ID_AA64MMFR2_LSM_IMPL (UL(0x1) << ID_AA64MMFR2_LSM_SHIFT) #define ID_AA64MMFR2_IESB_SHIFT 12 #define ID_AA64MMFR2_IESB_MASK (UL(0xf) << ID_AA64MMFR2_IESB_SHIFT) -#define ID_AA64MMFR2_IESB(x) ((x) & ID_AA64MMFR2_IESB_MASK) +#define ID_AA64MMFR2_IESB_VAL(x) ((x) & ID_AA64MMFR2_IESB_MASK) #define ID_AA64MMFR2_IESB_NONE (UL(0x0) << ID_AA64MMFR2_IESB_SHIFT) #define ID_AA64MMFR2_IESB_IMPL (UL(0x1) << ID_AA64MMFR2_IESB_SHIFT) #define ID_AA64MMFR2_VARange_SHIFT 16 #define ID_AA64MMFR2_VARange_MASK (UL(0xf) << ID_AA64MMFR2_VARange_SHIFT) -#define ID_AA64MMFR2_VARange(x) ((x) & ID_AA64MMFR2_VARange_MASK) +#define ID_AA64MMFR2_VARange_VAL(x) ((x) & ID_AA64MMFR2_VARange_MASK) #define ID_AA64MMFR2_VARange_48 (UL(0x0) << ID_AA64MMFR2_VARange_SHIFT) #define ID_AA64MMFR2_VARange_52 (UL(0x1) << ID_AA64MMFR2_VARange_SHIFT) #define ID_AA64MMFR2_CCIDX_SHIFT 20 #define ID_AA64MMFR2_CCIDX_MASK (UL(0xf) << ID_AA64MMFR2_CCIDX_SHIFT) -#define ID_AA64MMFR2_CCIDX(x) ((x) & ID_AA64MMFR2_CCIDX_MASK) +#define ID_AA64MMFR2_CCIDX_VAL(x) ((x) & ID_AA64MMFR2_CCIDX_MASK) #define ID_AA64MMFR2_CCIDX_32 (UL(0x0) << ID_AA64MMFR2_CCIDX_SHIFT) #define ID_AA64MMFR2_CCIDX_64 (UL(0x1) << ID_AA64MMFR2_CCIDX_SHIFT) #define ID_AA64MMFR2_NV_SHIFT 24 #define ID_AA64MMFR2_NV_MASK (UL(0xf) << ID_AA64MMFR2_NV_SHIFT) -#define ID_AA64MMFR2_NV(x) ((x) & ID_AA64MMFR2_NV_MASK) +#define ID_AA64MMFR2_NV_VAL(x) ((x) & ID_AA64MMFR2_NV_MASK) #define ID_AA64MMFR2_NV_NONE (UL(0x0) << ID_AA64MMFR2_NV_SHIFT) #define ID_AA64MMFR2_NV_IMPL (UL(0x1) << ID_AA64MMFR2_NV_SHIFT) /* ID_AA64PFR0_EL1 */ #define ID_AA64PFR0_EL0_SHIFT 0 #define ID_AA64PFR0_EL0_MASK (UL(0xf) << ID_AA64PFR0_EL0_SHIFT) -#define ID_AA64PFR0_EL0(x) ((x) & ID_AA64PFR0_EL0_MASK) +#define ID_AA64PFR0_EL0_VAL(x) ((x) & ID_AA64PFR0_EL0_MASK) #define ID_AA64PFR0_EL0_64 (UL(0x1) << ID_AA64PFR0_EL0_SHIFT) #define ID_AA64PFR0_EL0_64_32 (UL(0x2) << ID_AA64PFR0_EL0_SHIFT) #define ID_AA64PFR0_EL1_SHIFT 4 #define ID_AA64PFR0_EL1_MASK (UL(0xf) << ID_AA64PFR0_EL1_SHIFT) -#define ID_AA64PFR0_EL1(x) ((x) & ID_AA64PFR0_EL1_MASK) +#define ID_AA64PFR0_EL1_VAL(x) ((x) & ID_AA64PFR0_EL1_MASK) #define ID_AA64PFR0_EL1_64 (UL(0x1) << ID_AA64PFR0_EL1_SHIFT) #define ID_AA64PFR0_EL1_64_32 (UL(0x2) << ID_AA64PFR0_EL1_SHIFT) #define ID_AA64PFR0_EL2_SHIFT 8 #define ID_AA64PFR0_EL2_MASK (UL(0xf) << ID_AA64PFR0_EL2_SHIFT) -#define ID_AA64PFR0_EL2(x) ((x) & ID_AA64PFR0_EL2_MASK) +#define ID_AA64PFR0_EL2_VAL(x) ((x) & ID_AA64PFR0_EL2_MASK) #define ID_AA64PFR0_EL2_NONE (UL(0x0) << ID_AA64PFR0_EL2_SHIFT) #define ID_AA64PFR0_EL2_64 (UL(0x1) << ID_AA64PFR0_EL2_SHIFT) #define ID_AA64PFR0_EL2_64_32 (UL(0x2) << ID_AA64PFR0_EL2_SHIFT) #define ID_AA64PFR0_EL3_SHIFT 12 #define ID_AA64PFR0_EL3_MASK (UL(0xf) << ID_AA64PFR0_EL3_SHIFT) -#define ID_AA64PFR0_EL3(x) ((x) & ID_AA64PFR0_EL3_MASK) +#define ID_AA64PFR0_EL3_VAL(x) ((x) & ID_AA64PFR0_EL3_MASK) #define ID_AA64PFR0_EL3_NONE (UL(0x0) << ID_AA64PFR0_EL3_SHIFT) #define ID_AA64PFR0_EL3_64 (UL(0x1) << ID_AA64PFR0_EL3_SHIFT) #define ID_AA64PFR0_EL3_64_32 (UL(0x2) << ID_AA64PFR0_EL3_SHIFT) #define ID_AA64PFR0_FP_SHIFT 16 #define ID_AA64PFR0_FP_MASK (UL(0xf) << ID_AA64PFR0_FP_SHIFT) -#define ID_AA64PFR0_FP(x) ((x) & ID_AA64PFR0_FP_MASK) +#define ID_AA64PFR0_FP_VAL(x) ((x) & ID_AA64PFR0_FP_MASK) #define ID_AA64PFR0_FP_IMPL (UL(0x0) << ID_AA64PFR0_FP_SHIFT) #define ID_AA64PFR0_FP_HP (UL(0x1) << ID_AA64PFR0_FP_SHIFT) #define ID_AA64PFR0_FP_NONE (UL(0xf) << ID_AA64PFR0_FP_SHIFT) #define ID_AA64PFR0_AdvSIMD_SHIFT 20 #define ID_AA64PFR0_AdvSIMD_MASK (UL(0xf) << ID_AA64PFR0_AdvSIMD_SHIFT) -#define ID_AA64PFR0_AdvSIMD(x) ((x) & ID_AA64PFR0_AdvSIMD_MASK) +#define ID_AA64PFR0_AdvSIMD_VAL(x) ((x) & ID_AA64PFR0_AdvSIMD_MASK) #define ID_AA64PFR0_AdvSIMD_IMPL (UL(0x0) << ID_AA64PFR0_AdvSIMD_SHIFT) #define ID_AA64PFR0_AdvSIMD_HP (UL(0x1) << ID_AA64PFR0_AdvSIMD_SHIFT) #define ID_AA64PFR0_AdvSIMD_NONE (UL(0xf) << ID_AA64PFR0_AdvSIMD_SHIFT) #define ID_AA64PFR0_GIC_BITS 0x4 /* Number of bits in GIC field */ #define ID_AA64PFR0_GIC_SHIFT 24 #define ID_AA64PFR0_GIC_MASK (UL(0xf) << ID_AA64PFR0_GIC_SHIFT) -#define ID_AA64PFR0_GIC(x) ((x) & ID_AA64PFR0_GIC_MASK) +#define ID_AA64PFR0_GIC_VAL(x) ((x) & ID_AA64PFR0_GIC_MASK) #define ID_AA64PFR0_GIC_CPUIF_NONE (UL(0x0) << ID_AA64PFR0_GIC_SHIFT) #define ID_AA64PFR0_GIC_CPUIF_EN (UL(0x1) << ID_AA64PFR0_GIC_SHIFT) #define ID_AA64PFR0_RAS_SHIFT 28 #define ID_AA64PFR0_RAS_MASK (UL(0xf) << ID_AA64PFR0_RAS_SHIFT) -#define ID_AA64PFR0_RAS(x) ((x) & ID_AA64PFR0_RAS_MASK) +#define ID_AA64PFR0_RAS_VAL(x) ((x) & ID_AA64PFR0_RAS_MASK) #define ID_AA64PFR0_RAS_NONE (UL(0x0) << ID_AA64PFR0_RAS_SHIFT) #define ID_AA64PFR0_RAS_V1 (UL(0x1) << ID_AA64PFR0_RAS_SHIFT) #define ID_AA64PFR0_SVE_SHIFT 32 #define ID_AA64PFR0_SVE_MASK (UL(0xf) << ID_AA64PFR0_SVE_SHIFT) -#define ID_AA64PFR0_SVE(x) ((x) & ID_AA64PFR0_SVE_MASK) +#define ID_AA64PFR0_SVE_VAL(x) ((x) & ID_AA64PFR0_SVE_MASK) #define ID_AA64PFR0_SVE_NONE (UL(0x0) << ID_AA64PFR0_SVE_SHIFT) #define ID_AA64PFR0_SVE_IMPL (UL(0x1) << ID_AA64PFR0_SVE_SHIFT) Modified: head/sys/libkern/gsb_crc32.c ============================================================================== --- head/sys/libkern/gsb_crc32.c Wed Oct 30 08:06:22 2019 (r354169) +++ head/sys/libkern/gsb_crc32.c Wed Oct 30 10:06:57 2019 (r354170) @@ -777,7 +777,7 @@ calculate_crc32c(uint32_t crc32c, * this applies to all CPUs. */ reg = READ_SPECIALREG(id_aa64isar0_el1); - if (ID_AA64ISAR0_CRC32(reg) != ID_AA64ISAR0_CRC32_NONE) { + if (ID_AA64ISAR0_CRC32_VAL(reg) != ID_AA64ISAR0_CRC32_NONE) { return (armv8_crc32c(crc32c, buffer, length)); } else #endif From owner-svn-src-head@freebsd.org Wed Oct 30 10:13:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C98041A11E6; Wed, 30 Oct 2019 10:13:15 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47346350nYz3CMM; Wed, 30 Oct 2019 10:13:15 +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 8EFD08CA6; Wed, 30 Oct 2019 10:13:15 +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 x9UADF7W005970; Wed, 30 Oct 2019 10:13:15 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UADF97005969; Wed, 30 Oct 2019 10:13:15 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910301013.x9UADF97005969@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 30 Oct 2019 10:13:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354171 - 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: 354171 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 10:13:15 -0000 Author: andrew Date: Wed Oct 30 10:13:14 2019 New Revision: 354171 URL: https://svnweb.freebsd.org/changeset/base/354171 Log: Add two files missed in r354170 Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/identcpu.c head/sys/arm64/arm64/machdep.c Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Wed Oct 30 10:06:57 2019 (r354170) +++ head/sys/arm64/arm64/identcpu.c Wed Oct 30 10:13:14 2019 (r354171) @@ -897,25 +897,25 @@ parse_cpu_features_hwcap(u_int cpu) { u_long hwcap = 0; - if (ID_AA64ISAR0_DP(cpu_desc[cpu].id_aa64isar0) == ID_AA64ISAR0_DP_IMPL) + if (ID_AA64ISAR0_DP_VAL(cpu_desc[cpu].id_aa64isar0) == ID_AA64ISAR0_DP_IMPL) hwcap |= HWCAP_ASIMDDP; - if (ID_AA64ISAR0_SM4(cpu_desc[cpu].id_aa64isar0) == ID_AA64ISAR0_SM4_IMPL) + if (ID_AA64ISAR0_SM4_VAL(cpu_desc[cpu].id_aa64isar0) == ID_AA64ISAR0_SM4_IMPL) hwcap |= HWCAP_SM4; - if (ID_AA64ISAR0_SM3(cpu_desc[cpu].id_aa64isar0) == ID_AA64ISAR0_SM3_IMPL) + if (ID_AA64ISAR0_SM3_VAL(cpu_desc[cpu].id_aa64isar0) == ID_AA64ISAR0_SM3_IMPL) hwcap |= HWCAP_SM3; - if (ID_AA64ISAR0_RDM(cpu_desc[cpu].id_aa64isar0) == ID_AA64ISAR0_RDM_IMPL) + if (ID_AA64ISAR0_RDM_VAL(cpu_desc[cpu].id_aa64isar0) == ID_AA64ISAR0_RDM_IMPL) hwcap |= HWCAP_ASIMDRDM; - if (ID_AA64ISAR0_Atomic(cpu_desc[cpu].id_aa64isar0) == ID_AA64ISAR0_Atomic_IMPL) + if (ID_AA64ISAR0_Atomic_VAL(cpu_desc[cpu].id_aa64isar0) == ID_AA64ISAR0_Atomic_IMPL) hwcap |= HWCAP_ATOMICS; - if (ID_AA64ISAR0_CRC32(cpu_desc[cpu].id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE) + if (ID_AA64ISAR0_CRC32_VAL(cpu_desc[cpu].id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE) hwcap |= HWCAP_CRC32; - switch (ID_AA64ISAR0_SHA2(cpu_desc[cpu].id_aa64isar0)) { + switch (ID_AA64ISAR0_SHA2_VAL(cpu_desc[cpu].id_aa64isar0)) { case ID_AA64ISAR0_SHA2_BASE: hwcap |= HWCAP_SHA2; break; @@ -926,10 +926,10 @@ parse_cpu_features_hwcap(u_int cpu) break; } - if (ID_AA64ISAR0_SHA1(cpu_desc[cpu].id_aa64isar0)) + if (ID_AA64ISAR0_SHA1_VAL(cpu_desc[cpu].id_aa64isar0)) hwcap |= HWCAP_SHA1; - switch (ID_AA64ISAR0_AES(cpu_desc[cpu].id_aa64isar0)) { + switch (ID_AA64ISAR0_AES_VAL(cpu_desc[cpu].id_aa64isar0)) { case ID_AA64ISAR0_AES_BASE: hwcap |= HWCAP_AES; break; @@ -940,22 +940,22 @@ parse_cpu_features_hwcap(u_int cpu) break; } - if (ID_AA64ISAR1_LRCPC(cpu_desc[cpu].id_aa64isar1) == ID_AA64ISAR1_LRCPC_IMPL) + if (ID_AA64ISAR1_LRCPC_VAL(cpu_desc[cpu].id_aa64isar1) == ID_AA64ISAR1_LRCPC_IMPL) hwcap |= HWCAP_LRCPC; - if (ID_AA64ISAR1_FCMA(cpu_desc[cpu].id_aa64isar1) == ID_AA64ISAR1_FCMA_IMPL) + if (ID_AA64ISAR1_FCMA_VAL(cpu_desc[cpu].id_aa64isar1) == ID_AA64ISAR1_FCMA_IMPL) hwcap |= HWCAP_FCMA; - if (ID_AA64ISAR1_JSCVT(cpu_desc[cpu].id_aa64isar1) == ID_AA64ISAR1_JSCVT_IMPL) + if (ID_AA64ISAR1_JSCVT_VAL(cpu_desc[cpu].id_aa64isar1) == ID_AA64ISAR1_JSCVT_IMPL) hwcap |= HWCAP_JSCVT; - if (ID_AA64ISAR1_DPB(cpu_desc[cpu].id_aa64isar1) == ID_AA64ISAR1_DPB_IMPL) + if (ID_AA64ISAR1_DPB_VAL(cpu_desc[cpu].id_aa64isar1) == ID_AA64ISAR1_DPB_IMPL) hwcap |= HWCAP_DCPOP; - if (ID_AA64PFR0_SVE(cpu_desc[cpu].id_aa64pfr0) == ID_AA64PFR0_SVE_IMPL) + if (ID_AA64PFR0_SVE_VAL(cpu_desc[cpu].id_aa64pfr0) == ID_AA64PFR0_SVE_IMPL) hwcap |= HWCAP_SVE; - switch (ID_AA64PFR0_AdvSIMD(cpu_desc[cpu].id_aa64pfr0)) { + switch (ID_AA64PFR0_AdvSIMD_VAL(cpu_desc[cpu].id_aa64pfr0)) { case ID_AA64PFR0_AdvSIMD_IMPL: hwcap |= HWCAP_ASIMD; break; @@ -966,7 +966,7 @@ parse_cpu_features_hwcap(u_int cpu) break; } - switch (ID_AA64PFR0_FP(cpu_desc[cpu].id_aa64pfr0)) { + switch (ID_AA64PFR0_FP_VAL(cpu_desc[cpu].id_aa64pfr0)) { case ID_AA64PFR0_FP_IMPL: hwcap |= HWCAP_FP; break; Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Wed Oct 30 10:06:57 2019 (r354170) +++ head/sys/arm64/arm64/machdep.c Wed Oct 30 10:13:14 2019 (r354171) @@ -134,7 +134,7 @@ pan_setup(void) uint64_t id_aa64mfr1; id_aa64mfr1 = READ_SPECIALREG(id_aa64mmfr1_el1); - if (ID_AA64MMFR1_PAN(id_aa64mfr1) != ID_AA64MMFR1_PAN_NONE) + if (ID_AA64MMFR1_PAN_VAL(id_aa64mfr1) != ID_AA64MMFR1_PAN_NONE) has_pan = 1; } From owner-svn-src-head@freebsd.org Wed Oct 30 10:16:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8408D1A12D6; Wed, 30 Oct 2019 10:16:29 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47349n2tgqz3CWb; Wed, 30 Oct 2019 10:16:29 +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 41E848CA9; Wed, 30 Oct 2019 10:16:29 +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 x9UAGTot006310; Wed, 30 Oct 2019 10:16:29 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UAGSjI006308; Wed, 30 Oct 2019 10:16:28 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201910301016.x9UAGSjI006308@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 30 Oct 2019 10:16:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354172 - in head/sys: amd64/conf conf X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head/sys: amd64/conf conf X-SVN-Commit-Revision: 354172 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 10:16:29 -0000 Author: trasz Date: Wed Oct 30 10:16:28 2019 New Revision: 354172 URL: https://svnweb.freebsd.org/changeset/base/354172 Log: There's nothing architecture specific in "options STATS"; move it from sys/amd64/conf/NOTES to sys/conf/NOTES. Suggested by: jhb@ Sponsored by: Klara Inc, Netflix Modified: head/sys/amd64/conf/NOTES head/sys/conf/NOTES Modified: head/sys/amd64/conf/NOTES ============================================================================== --- head/sys/amd64/conf/NOTES Wed Oct 30 10:13:14 2019 (r354171) +++ head/sys/amd64/conf/NOTES Wed Oct 30 10:16:28 2019 (r354172) @@ -678,5 +678,3 @@ device ndis options LINDEBUGFS options GCOV - -options STATS Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Wed Oct 30 10:13:14 2019 (r354171) +++ head/sys/conf/NOTES Wed Oct 30 10:16:28 2019 (r354172) @@ -2896,3 +2896,6 @@ options SPIGEN_LEGACY_CDEVNAME # legacy device names # Compression supports. device zlib # gzip/zlib compression/decompression library device xz # xz_embedded LZMA de-compression library + +# Kernel support for stats(3). +options STATS From owner-svn-src-head@freebsd.org Wed Oct 30 10:41:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BF891A18A1; Wed, 30 Oct 2019 10:41:11 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4734kH0s4Nz3Dbf; Wed, 30 Oct 2019 10:41:11 +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 009DB904D; Wed, 30 Oct 2019 10:41:11 +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 x9UAfAHk021079; Wed, 30 Oct 2019 10:41:10 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UAfAuT021078; Wed, 30 Oct 2019 10:41:10 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910301041.x9UAfAuT021078@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 30 Oct 2019 10:41:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354173 - head/sys/crypto/armv8 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/crypto/armv8 X-SVN-Commit-Revision: 354173 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 10:41:11 -0000 Author: andrew Date: Wed Oct 30 10:41:10 2019 New Revision: 354173 URL: https://svnweb.freebsd.org/changeset/base/354173 Log: Fix the armv8 crypto driver after r354170. Sponsored by: DARPA, AFRL Modified: head/sys/crypto/armv8/armv8_crypto.c Modified: head/sys/crypto/armv8/armv8_crypto.c ============================================================================== --- head/sys/crypto/armv8/armv8_crypto.c Wed Oct 30 10:16:28 2019 (r354172) +++ head/sys/crypto/armv8/armv8_crypto.c Wed Oct 30 10:41:10 2019 (r354173) @@ -107,7 +107,7 @@ armv8_crypto_probe(device_t dev) reg = READ_SPECIALREG(id_aa64isar0_el1); - switch (ID_AA64ISAR0_AES(reg)) { + switch (ID_AA64ISAR0_AES_VAL(reg)) { case ID_AA64ISAR0_AES_BASE: case ID_AA64ISAR0_AES_PMULL: ret = 0; From owner-svn-src-head@freebsd.org Wed Oct 30 10:42:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C7101A1A94; Wed, 30 Oct 2019 10:42:53 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4734mF2GXVz3Dqt; Wed, 30 Oct 2019 10:42:53 +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 3115791CF; Wed, 30 Oct 2019 10:42:53 +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 x9UAgqYo025128; Wed, 30 Oct 2019 10:42:52 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UAgq8w025127; Wed, 30 Oct 2019 10:42:52 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910301042.x9UAgq8w025127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 30 Oct 2019 10:42:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354174 - 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: 354174 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 10:42:53 -0000 Author: andrew Date: Wed Oct 30 10:42:52 2019 New Revision: 354174 URL: https://svnweb.freebsd.org/changeset/base/354174 Log: Use an array of handlers in the data and instruction aborts Previously we would call data_abort on all data and instruction aborts however this is incorrect for most abort types. Move to use an array of function pointers to allow for more handlers to be easily added. Reviewed by: jhibbits Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22170 Modified: head/sys/arm64/arm64/trap.c Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Wed Oct 30 10:41:10 2019 (r354173) +++ head/sys/arm64/arm64/trap.c Wed Oct 30 10:42:52 2019 (r354174) @@ -84,6 +84,24 @@ static void print_registers(struct trapframe *frame); int (*dtrace_invop_jump_addr)(struct trapframe *); +typedef void (abort_handler)(struct thread *, struct trapframe *, uint64_t, + uint64_t, int); + +static abort_handler data_abort; + +static abort_handler *abort_handlers[] = { + [ISS_DATA_DFSC_TF_L0] = data_abort, + [ISS_DATA_DFSC_TF_L1] = data_abort, + [ISS_DATA_DFSC_TF_L2] = data_abort, + [ISS_DATA_DFSC_TF_L3] = data_abort, + [ISS_DATA_DFSC_AFF_L1] = data_abort, + [ISS_DATA_DFSC_AFF_L2] = data_abort, + [ISS_DATA_DFSC_AFF_L3] = data_abort, + [ISS_DATA_DFSC_PF_L1] = data_abort, + [ISS_DATA_DFSC_PF_L2] = data_abort, + [ISS_DATA_DFSC_PF_L3] = data_abort, +}; + static __inline void call_trapsignal(struct thread *td, int sig, int code, void *addr) { @@ -149,7 +167,7 @@ svc_handler(struct thread *td, struct trapframe *frame static void data_abort(struct thread *td, struct trapframe *frame, uint64_t esr, - uint64_t far, int lower, int exec) + uint64_t far, int lower) { struct vm_map *map; struct proc *p; @@ -212,11 +230,16 @@ data_abort(struct thread *td, struct trapframe *frame, panic("data abort in critical section or under mutex"); } - if (exec) + switch (ESR_ELx_EXCEPTION(esr)) { + case EXCP_INSN_ABORT: + case EXCP_INSN_ABORT_L: ftype = VM_PROT_EXECUTE; - else + break; + default: ftype = (esr & ISS_DATA_WnR) == 0 ? VM_PROT_READ : VM_PROT_READ | VM_PROT_WRITE; + break; + } /* Fault in the page. */ error = vm_fault_trap(map, far, ftype, VM_FAULT_NORMAL, &sig, &ucode); @@ -275,6 +298,7 @@ do_el1h_sync(struct thread *td, struct trapframe *fram struct trapframe *oframe; uint32_t exception; uint64_t esr, far; + int dfsc; /* Read the esr register to get the exception details */ esr = frame->tf_esr; @@ -318,8 +342,14 @@ do_el1h_sync(struct thread *td, struct trapframe *fram case EXCP_INSN_ABORT: case EXCP_DATA_ABORT: far = READ_SPECIALREG(far_el1); - data_abort(td, frame, esr, far, 0, - exception == EXCP_INSN_ABORT); + dfsc = esr & ISS_DATA_DFSC_MASK; + if (dfsc < nitems(abort_handlers) && + abort_handlers[dfsc] != NULL) + abort_handlers[dfsc](td, frame, esr, far, 0); + else + panic("Unhandled EL1 %s abort: %x", + exception == EXCP_INSN_ABORT ? "instruction" : + "data", dfsc); break; case EXCP_BRK: #ifdef KDTRACE_HOOKS @@ -365,6 +395,7 @@ do_el0_sync(struct thread *td, struct trapframe *frame pcpu_bp_harden bp_harden; uint32_t exception; uint64_t esr, far; + int dfsc; /* Check we have a sane environment when entering from userland */ KASSERT((uintptr_t)get_pcpu() >= VM_MIN_KERNEL_ADDRESS, @@ -416,8 +447,14 @@ do_el0_sync(struct thread *td, struct trapframe *frame case EXCP_INSN_ABORT_L: case EXCP_DATA_ABORT_L: case EXCP_DATA_ABORT: - data_abort(td, frame, esr, far, 1, - exception == EXCP_INSN_ABORT_L); + dfsc = esr & ISS_DATA_DFSC_MASK; + if (dfsc < nitems(abort_handlers) && + abort_handlers[dfsc] != NULL) + abort_handlers[dfsc](td, frame, esr, far, 1); + else + panic("Unhandled EL0 %s abort: %x", + exception == EXCP_INSN_ABORT_L ? "instruction" : + "data", dfsc); break; case EXCP_UNKNOWN: if (!undef_insn(0, frame)) From owner-svn-src-head@freebsd.org Wed Oct 30 10:51:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F84E1A1D7A; Wed, 30 Oct 2019 10:51:26 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4734y63YNMz3FHg; Wed, 30 Oct 2019 10:51:26 +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 441EF9245; Wed, 30 Oct 2019 10:51:26 +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 x9UApQ5m030389; Wed, 30 Oct 2019 10:51:26 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UApOWj030378; Wed, 30 Oct 2019 10:51:24 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910301051.x9UApOWj030378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 30 Oct 2019 10:51:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354175 - in head/sys: arm64/arm64 arm64/include conf X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys: arm64/arm64 arm64/include conf X-SVN-Commit-Revision: 354175 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 10:51:26 -0000 Author: andrew Date: Wed Oct 30 10:51:24 2019 New Revision: 354175 URL: https://svnweb.freebsd.org/changeset/base/354175 Log: Update the debug monitor handling to work after userspace has started The debug monitor register state is now stored in a struct and updated when required. Currently there is only a kernel state, however a per-process state will be added in a future change. Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22128 Modified: head/sys/arm64/arm64/db_trace.c head/sys/arm64/arm64/debug_monitor.c head/sys/arm64/arm64/exception.S head/sys/arm64/arm64/mp_machdep.c head/sys/arm64/include/debug_monitor.h head/sys/arm64/include/pcpu.h head/sys/conf/files.arm64 Modified: head/sys/arm64/arm64/db_trace.c ============================================================================== --- head/sys/arm64/arm64/db_trace.c Wed Oct 30 10:42:52 2019 (r354174) +++ head/sys/arm64/arm64/db_trace.c Wed Oct 30 10:51:24 2019 (r354175) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include + #include #include #include @@ -53,15 +54,14 @@ int db_md_clr_watchpoint(db_expr_t addr, db_expr_t size) { - return (dbg_remove_watchpoint(addr, size, DBG_FROM_EL1)); + return (dbg_remove_watchpoint(NULL, addr, size)); } int db_md_set_watchpoint(db_expr_t addr, db_expr_t size) { - return (dbg_setup_watchpoint(addr, size, DBG_FROM_EL1, - HW_BREAKPOINT_RW)); + return (dbg_setup_watchpoint(NULL, addr, size, HW_BREAKPOINT_RW)); } static void Modified: head/sys/arm64/arm64/debug_monitor.c ============================================================================== --- head/sys/arm64/arm64/debug_monitor.c Wed Oct 30 10:42:52 2019 (r354174) +++ head/sys/arm64/arm64/debug_monitor.c Wed Oct 30 10:51:24 2019 (r354175) @@ -43,8 +43,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef DDB #include #include +#endif enum dbg_t { DBG_TYPE_BREAKPOINT = 0, @@ -53,8 +55,9 @@ enum dbg_t { static int dbg_watchpoint_num; static int dbg_breakpoint_num; -static int dbg_ref_count_mde[MAXCPU]; -static int dbg_ref_count_kde[MAXCPU]; +static struct debug_monitor_state kernel_monitor = { + .dbg_flags = DBGMON_KERNEL +}; /* Watchpoints/breakpoints control register bitfields */ #define DBG_WATCH_CTRL_LEN_1 (0x1 << 5) @@ -138,6 +141,7 @@ static int dbg_ref_count_kde[MAXCPU]; WRITE_WB_REG_CASE(reg, 14, offset, val); \ WRITE_WB_REG_CASE(reg, 15, offset, val) +#ifdef DDB static uint64_t dbg_wb_read_reg(int reg, int n) { @@ -149,11 +153,12 @@ dbg_wb_read_reg(int reg, int n) SWITCH_CASES_READ_WB_REG(DBG_WB_BVR, DBG_REG_BASE_BVR, val); SWITCH_CASES_READ_WB_REG(DBG_WB_BCR, DBG_REG_BASE_BCR, val); default: - db_printf("trying to read from wrong debug register %d\n", n); + printf("trying to read from wrong debug register %d\n", n); } return val; } +#endif /* DDB */ static void dbg_wb_write_reg(int reg, int n, uint64_t val) @@ -164,17 +169,19 @@ dbg_wb_write_reg(int reg, int n, uint64_t val) SWITCH_CASES_WRITE_WB_REG(DBG_WB_BVR, DBG_REG_BASE_BVR, val); SWITCH_CASES_WRITE_WB_REG(DBG_WB_BCR, DBG_REG_BASE_BCR, val); default: - db_printf("trying to write to wrong debug register %d\n", n); + printf("trying to write to wrong debug register %d\n", n); + return; } isb(); } +#ifdef DDB void kdb_cpu_set_singlestep(void) { kdb_frame->tf_spsr |= DBG_SPSR_SS; - WRITE_SPECIALREG(MDSCR_EL1, READ_SPECIALREG(MDSCR_EL1) | + WRITE_SPECIALREG(mdscr_el1, READ_SPECIALREG(mdscr_el1) | DBG_MDSCR_SS | DBG_MDSCR_KDE); /* @@ -182,9 +189,9 @@ kdb_cpu_set_singlestep(void) * over watched instruction will trigger break exception instead of * single-step exception and locks CPU on that instruction for ever. */ - if (dbg_ref_count_mde[PCPU_GET(cpuid)] > 0) { - WRITE_SPECIALREG(MDSCR_EL1, - READ_SPECIALREG(MDSCR_EL1) & ~DBG_MDSCR_MDE); + if ((kernel_monitor.dbg_flags & DBGMON_ENABLED) != 0) { + WRITE_SPECIALREG(mdscr_el1, + READ_SPECIALREG(mdscr_el1) & ~DBG_MDSCR_MDE); } } @@ -192,18 +199,18 @@ void kdb_cpu_clear_singlestep(void) { - WRITE_SPECIALREG(MDSCR_EL1, READ_SPECIALREG(MDSCR_EL1) & + WRITE_SPECIALREG(mdscr_el1, READ_SPECIALREG(mdscr_el1) & ~(DBG_MDSCR_SS | DBG_MDSCR_KDE)); /* Restore breakpoints and watchpoints */ - if (dbg_ref_count_mde[PCPU_GET(cpuid)] > 0) { - WRITE_SPECIALREG(MDSCR_EL1, - READ_SPECIALREG(MDSCR_EL1) | DBG_MDSCR_MDE); - } + if ((kernel_monitor.dbg_flags & DBGMON_ENABLED) != 0) { + WRITE_SPECIALREG(mdscr_el1, + READ_SPECIALREG(mdscr_el1) | DBG_MDSCR_MDE); - if (dbg_ref_count_kde[PCPU_GET(cpuid)] > 0) { - WRITE_SPECIALREG(MDSCR_EL1, - READ_SPECIALREG(MDSCR_EL1) | DBG_MDSCR_KDE); + if ((kernel_monitor.dbg_flags & DBGMON_KERNEL) != 0) { + WRITE_SPECIALREG(mdscr_el1, + READ_SPECIALREG(mdscr_el1) | DBG_MDSCR_KDE); + } } } @@ -267,30 +274,30 @@ dbg_show_watchpoint(void) } } } +#endif /* DDB */ - static int -dbg_find_free_slot(enum dbg_t type) +dbg_find_free_slot(struct debug_monitor_state *monitor, enum dbg_t type) { - u_int max, reg, i; + uint64_t *reg; + u_int max, i; switch(type) { case DBG_TYPE_BREAKPOINT: max = dbg_breakpoint_num; - reg = DBG_REG_BASE_BCR; - + reg = monitor->dbg_bcr; break; case DBG_TYPE_WATCHPOINT: max = dbg_watchpoint_num; - reg = DBG_REG_BASE_WCR; + reg = monitor->dbg_wcr; break; default: - db_printf("Unsupported debug type\n"); + printf("Unsupported debug type\n"); return (i); } for (i = 0; i < max; i++) { - if ((dbg_wb_read_reg(reg, i) & DBG_WB_CTRL_E) == 0) + if ((reg[i] & DBG_WB_CTRL_E) == 0) return (i); } @@ -298,81 +305,50 @@ dbg_find_free_slot(enum dbg_t type) } static int -dbg_find_slot(enum dbg_t type, db_expr_t addr) +dbg_find_slot(struct debug_monitor_state *monitor, enum dbg_t type, + vm_offset_t addr) { - u_int max, reg_addr, reg_ctrl, i; + uint64_t *reg_addr, *reg_ctrl; + u_int max, i; switch(type) { case DBG_TYPE_BREAKPOINT: max = dbg_breakpoint_num; - reg_addr = DBG_REG_BASE_BVR; - reg_ctrl = DBG_REG_BASE_BCR; + reg_addr = monitor->dbg_bvr; + reg_ctrl = monitor->dbg_bcr; break; case DBG_TYPE_WATCHPOINT: max = dbg_watchpoint_num; - reg_addr = DBG_REG_BASE_WVR; - reg_ctrl = DBG_REG_BASE_WCR; + reg_addr = monitor->dbg_wvr; + reg_ctrl = monitor->dbg_wcr; break; default: - db_printf("Unsupported debug type\n"); + printf("Unsupported debug type\n"); return (i); } for (i = 0; i < max; i++) { - if ((dbg_wb_read_reg(reg_addr, i) == addr) && - ((dbg_wb_read_reg(reg_ctrl, i) & DBG_WB_CTRL_E) != 0)) + if (reg_addr[i] == addr && + (reg_ctrl[i] & DBG_WB_CTRL_E) != 0) return (i); } return (-1); } -static void -dbg_enable_monitor(enum dbg_el_t el) -{ - uint64_t reg_mdcr = 0; - - /* - * There is no need to have debug monitor on permanently, thus we are - * refcounting and turn it on only if any of CPU is going to use that. - */ - if (atomic_fetchadd_int(&dbg_ref_count_mde[PCPU_GET(cpuid)], 1) == 0) - reg_mdcr = DBG_MDSCR_MDE; - - if ((el == DBG_FROM_EL1) && - atomic_fetchadd_int(&dbg_ref_count_kde[PCPU_GET(cpuid)], 1) == 0) - reg_mdcr |= DBG_MDSCR_KDE; - - if (reg_mdcr) - WRITE_SPECIALREG(MDSCR_EL1, READ_SPECIALREG(MDSCR_EL1) | reg_mdcr); -} - -static void -dbg_disable_monitor(enum dbg_el_t el) -{ - uint64_t reg_mdcr = 0; - - if (atomic_fetchadd_int(&dbg_ref_count_mde[PCPU_GET(cpuid)], -1) == 1) - reg_mdcr = DBG_MDSCR_MDE; - - if ((el == DBG_FROM_EL1) && - atomic_fetchadd_int(&dbg_ref_count_kde[PCPU_GET(cpuid)], -1) == 1) - reg_mdcr |= DBG_MDSCR_KDE; - - if (reg_mdcr) - WRITE_SPECIALREG(MDSCR_EL1, READ_SPECIALREG(MDSCR_EL1) & ~reg_mdcr); -} - int -dbg_setup_watchpoint(db_expr_t addr, db_expr_t size, enum dbg_el_t el, - enum dbg_access_t access) +dbg_setup_watchpoint(struct debug_monitor_state *monitor, vm_offset_t addr, + vm_size_t size, enum dbg_access_t access) { uint64_t wcr_size, wcr_priv, wcr_access; u_int i; - i = dbg_find_free_slot(DBG_TYPE_WATCHPOINT); + if (monitor == NULL) + monitor = &kernel_monitor; + + i = dbg_find_free_slot(monitor, DBG_TYPE_WATCHPOINT); if (i == -1) { - db_printf("Can not find slot for watchpoint, max %d" + printf("Can not find slot for watchpoint, max %d" " watchpoints supported\n", dbg_watchpoint_num); return (i); } @@ -391,21 +367,14 @@ dbg_setup_watchpoint(db_expr_t addr, db_expr_t size, e wcr_size = DBG_WATCH_CTRL_LEN_8; break; default: - db_printf("Unsupported address size for watchpoint\n"); + printf("Unsupported address size for watchpoint\n"); return (-1); } - switch(el) { - case DBG_FROM_EL0: + if ((monitor->dbg_flags & DBGMON_KERNEL) == 0) wcr_priv = DBG_WB_CTRL_EL0; - break; - case DBG_FROM_EL1: + else wcr_priv = DBG_WB_CTRL_EL1; - break; - default: - db_printf("Unsupported exception level for watchpoint\n"); - return (-1); - } switch(access) { case HW_BREAKPOINT_X: @@ -421,34 +390,79 @@ dbg_setup_watchpoint(db_expr_t addr, db_expr_t size, e wcr_access = DBG_WATCH_CTRL_LOAD | DBG_WATCH_CTRL_STORE; break; default: - db_printf("Unsupported exception level for watchpoint\n"); + printf("Unsupported exception level for watchpoint\n"); return (-1); } - dbg_wb_write_reg(DBG_REG_BASE_WVR, i, addr); - dbg_wb_write_reg(DBG_REG_BASE_WCR, i, wcr_size | wcr_access | wcr_priv | - DBG_WB_CTRL_E); - dbg_enable_monitor(el); + monitor->dbg_wvr[i] = addr; + monitor->dbg_wcr[i] = wcr_size | wcr_access | wcr_priv | DBG_WB_CTRL_E; + monitor->dbg_enable_count++; + monitor->dbg_flags |= DBGMON_ENABLED; + + dbg_register_sync(monitor); return (0); } int -dbg_remove_watchpoint(db_expr_t addr, db_expr_t size, enum dbg_el_t el) +dbg_remove_watchpoint(struct debug_monitor_state *monitor, vm_offset_t addr, + vm_size_t size) { u_int i; - i = dbg_find_slot(DBG_TYPE_WATCHPOINT, addr); + if (monitor == NULL) + monitor = &kernel_monitor; + + i = dbg_find_slot(monitor, DBG_TYPE_WATCHPOINT, addr); if (i == -1) { - db_printf("Can not find watchpoint for address 0%lx\n", addr); + printf("Can not find watchpoint for address 0%lx\n", addr); return (i); } - dbg_wb_write_reg(DBG_REG_BASE_WCR, i, 0); - dbg_disable_monitor(el); + monitor->dbg_wvr[i] = 0; + monitor->dbg_wcr[i] = 0; + monitor->dbg_enable_count--; + if (monitor->dbg_enable_count == 0) + monitor->dbg_flags &= ~DBGMON_ENABLED; + + dbg_register_sync(monitor); return (0); } void +dbg_register_sync(struct debug_monitor_state *monitor) +{ + uint64_t mdscr; + int i; + + if (monitor == NULL) + monitor = &kernel_monitor; + + mdscr = READ_SPECIALREG(mdscr_el1); + if ((monitor->dbg_flags & DBGMON_ENABLED) == 0) { + mdscr &= ~(DBG_MDSCR_MDE | DBG_MDSCR_KDE); + } else { + for (i = 0; i < dbg_breakpoint_num; i++) { + dbg_wb_write_reg(DBG_REG_BASE_BCR, i, + monitor->dbg_bcr[i]); + dbg_wb_write_reg(DBG_REG_BASE_BVR, i, + monitor->dbg_bvr[i]); + } + + for (i = 0; i < dbg_watchpoint_num; i++) { + dbg_wb_write_reg(DBG_REG_BASE_WCR, i, + monitor->dbg_wcr[i]); + dbg_wb_write_reg(DBG_REG_BASE_WVR, i, + monitor->dbg_wvr[i]); + } + mdscr |= DBG_MDSCR_MDE; + if ((monitor->dbg_flags & DBGMON_KERNEL) == DBGMON_KERNEL) + mdscr |= DBG_MDSCR_KDE; + } + WRITE_SPECIALREG(mdscr_el1, mdscr); + isb(); +} + +void dbg_monitor_init(void) { u_int i; @@ -471,12 +485,12 @@ dbg_monitor_init(void) * * Reset all breakpoints and watchpoints. */ - for (i = 0; i < dbg_watchpoint_num; ++i) { + for (i = 0; i < dbg_watchpoint_num; i++) { dbg_wb_write_reg(DBG_REG_BASE_WCR, i, 0); dbg_wb_write_reg(DBG_REG_BASE_WVR, i, 0); } - for (i = 0; i < dbg_breakpoint_num; ++i) { + for (i = 0; i < dbg_breakpoint_num; i++) { dbg_wb_write_reg(DBG_REG_BASE_BCR, i, 0); dbg_wb_write_reg(DBG_REG_BASE_BVR, i, 0); } Modified: head/sys/arm64/arm64/exception.S ============================================================================== --- head/sys/arm64/arm64/exception.S Wed Oct 30 10:42:52 2019 (r354174) +++ head/sys/arm64/arm64/exception.S Wed Oct 30 10:51:24 2019 (r354175) @@ -74,15 +74,17 @@ __FBSDID("$FreeBSD$"); blr x1 1: .endif + msr daifclr, #8 /* Enable the debug exception */ .endm .macro restore_registers el .if \el == 1 - msr daifset, #2 /* - * Disable interrupts, x18 may change in the interrupt exception - * handler. For EL0 exceptions, do_ast already did this. + * Disable interrupts and debug exceptions, x18 may change in the + * interrupt exception handler. For EL0 exceptions, do_ast already + * did this. */ + msr daifset, #10 .endif .if \el == 0 /* Remove the SSBD (CVE-2018-3639) workaround if needed */ @@ -136,7 +138,7 @@ __FBSDID("$FreeBSD$"); bic x19, x19, #PSR_I 1: /* Disable interrupts */ - msr daifset, #2 + msr daifset, #10 /* Read the current thread flags */ ldr x1, [x18, #PC_CURTHREAD] /* Load curthread */ Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Wed Oct 30 10:42:52 2019 (r354174) +++ head/sys/arm64/arm64/mp_machdep.c Wed Oct 30 10:51:24 2019 (r354175) @@ -29,6 +29,7 @@ */ #include "opt_acpi.h" +#include "opt_ddb.h" #include "opt_kstack_pages.h" #include "opt_platform.h" @@ -55,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #ifdef VFP @@ -352,6 +354,10 @@ ipi_stop(void *dummy __unused) /* Wait for restart */ while (!CPU_ISSET(cpu, &started_cpus)) cpu_spinwait(); + +#ifdef DDB + dbg_register_sync(NULL); +#endif CPU_CLR_ATOMIC(cpu, &started_cpus); CPU_CLR_ATOMIC(cpu, &stopped_cpus); Modified: head/sys/arm64/include/debug_monitor.h ============================================================================== --- head/sys/arm64/include/debug_monitor.h Wed Oct 30 10:42:52 2019 (r354174) +++ head/sys/arm64/include/debug_monitor.h Wed Oct 30 10:51:24 2019 (r354175) @@ -32,13 +32,20 @@ #ifndef _MACHINE_DEBUG_MONITOR_H_ #define _MACHINE_DEBUG_MONITOR_H_ -#ifdef DDB +#ifdef _KERNEL -#include +#define DBG_BRP_MAX 16 +#define DBG_WRP_MAX 16 -enum dbg_el_t { - DBG_FROM_EL0 = 0, - DBG_FROM_EL1 = 1, +struct debug_monitor_state { + uint32_t dbg_enable_count; + uint32_t dbg_flags; +#define DBGMON_ENABLED (1 << 0) +#define DBGMON_KERNEL (1 << 1) + uint64_t dbg_bcr[DBG_BRP_MAX]; + uint64_t dbg_bvr[DBG_BRP_MAX]; + uint64_t dbg_wcr[DBG_WRP_MAX]; + uint64_t dbg_wvr[DBG_WRP_MAX]; }; enum dbg_access_t { @@ -49,15 +56,15 @@ enum dbg_access_t { }; void dbg_monitor_init(void); +void dbg_register_sync(struct debug_monitor_state *); +int dbg_setup_watchpoint(struct debug_monitor_state *, vm_offset_t, vm_size_t, + enum dbg_access_t); +int dbg_remove_watchpoint(struct debug_monitor_state *, vm_offset_t, vm_size_t); + +#ifdef DDB void dbg_show_watchpoint(void); -int dbg_setup_watchpoint(db_expr_t addr, db_expr_t size, enum dbg_el_t el, - enum dbg_access_t access); -int dbg_remove_watchpoint(db_expr_t addr, db_expr_t size, enum dbg_el_t el); -#else -static __inline void -dbg_monitor_init(void) -{ -} #endif + +#endif /* _KERNEL */ #endif /* _MACHINE_DEBUG_MONITOR_H_ */ Modified: head/sys/arm64/include/pcpu.h ============================================================================== --- head/sys/arm64/include/pcpu.h Wed Oct 30 10:42:52 2019 (r354174) +++ head/sys/arm64/include/pcpu.h Wed Oct 30 10:51:24 2019 (r354175) @@ -37,6 +37,7 @@ typedef int (*pcpu_bp_harden)(void); typedef int (*pcpu_ssbd)(int); +struct debug_monitor_state; #define PCPU_MD_FIELDS \ u_int pc_acpi_id; /* ACPI CPU id */ \ Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Wed Oct 30 10:42:52 2019 (r354174) +++ head/sys/conf/files.arm64 Wed Oct 30 10:51:24 2019 (r354175) @@ -136,7 +136,7 @@ arm64/arm64/cpufunc_asm.S standard arm64/arm64/db_disasm.c optional ddb arm64/arm64/db_interface.c optional ddb arm64/arm64/db_trace.c optional ddb -arm64/arm64/debug_monitor.c optional ddb +arm64/arm64/debug_monitor.c standard arm64/arm64/disassem.c optional ddb arm64/arm64/dump_machdep.c standard arm64/arm64/efirt_machdep.c optional efirt From owner-svn-src-head@freebsd.org Wed Oct 30 12:33:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDCB11A48C8; Wed, 30 Oct 2019 12:33:37 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4737D15c4qz3MJQ; Wed, 30 Oct 2019 12:33:37 +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 A39F2A594; Wed, 30 Oct 2019 12:33:37 +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 x9UCXbKC090523; Wed, 30 Oct 2019 12:33:37 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UCXbsx090521; Wed, 30 Oct 2019 12:33:37 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910301233.x9UCXbsx090521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 30 Oct 2019 12:33:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354176 - head/sys/arm64/include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/include X-SVN-Commit-Revision: 354176 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 12:33:37 -0000 Author: andrew Date: Wed Oct 30 12:33:36 2019 New Revision: 354176 URL: https://svnweb.freebsd.org/changeset/base/354176 Log: Move the MRS instruction decode macros to armreg.h These instructions are used to access the registers described in armreg.h, and will be used in a future change to create a per-register identification macro. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/include/armreg.h head/sys/arm64/include/undefined.h Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Wed Oct 30 10:51:24 2019 (r354175) +++ head/sys/arm64/include/armreg.h Wed Oct 30 12:33:36 2019 (r354176) @@ -35,6 +35,23 @@ #define INSN_SIZE 4 +#define MRS_MASK 0xfff00000 +#define MRS_VALUE 0xd5300000 +#define MRS_SPECIAL(insn) ((insn) & 0x000fffe0) +#define MRS_REGISTER(insn) ((insn) & 0x0000001f) +#define MRS_Op0_SHIFT 19 +#define MRS_Op0_MASK 0x00080000 +#define MRS_Op1_SHIFT 16 +#define MRS_Op1_MASK 0x00070000 +#define MRS_CRn_SHIFT 12 +#define MRS_CRn_MASK 0x0000f000 +#define MRS_CRm_SHIFT 8 +#define MRS_CRm_MASK 0x00000f00 +#define MRS_Op2_SHIFT 5 +#define MRS_Op2_MASK 0x000000e0 +#define MRS_Rt_SHIFT 0 +#define MRS_Rt_MASK 0x0000001f + #define READ_SPECIALREG(reg) \ ({ uint64_t _val; \ __asm __volatile("mrs %0, " __STRING(reg) : "=&r" (_val)); \ Modified: head/sys/arm64/include/undefined.h ============================================================================== --- head/sys/arm64/include/undefined.h Wed Oct 30 10:51:24 2019 (r354175) +++ head/sys/arm64/include/undefined.h Wed Oct 30 12:33:36 2019 (r354176) @@ -36,23 +36,6 @@ typedef int (*undef_handler_t)(vm_offset_t, uint32_t, struct trapframe *, uint32_t); -#define MRS_MASK 0xfff00000 -#define MRS_VALUE 0xd5300000 -#define MRS_SPECIAL(insn) ((insn) & 0x000fffe0) -#define MRS_REGISTER(insn) ((insn) & 0x0000001f) -#define MRS_Op0_SHIFT 19 -#define MRS_Op0_MASK 0x00080000 -#define MRS_Op1_SHIFT 16 -#define MRS_Op1_MASK 0x00070000 -#define MRS_CRn_SHIFT 12 -#define MRS_CRn_MASK 0x0000f000 -#define MRS_CRm_SHIFT 8 -#define MRS_CRm_MASK 0x00000f00 -#define MRS_Op2_SHIFT 5 -#define MRS_Op2_MASK 0x000000e0 -#define MRS_Rt_SHIFT 0 -#define MRS_Rt_MASK 0x0000001f - static inline int mrs_Op0(uint32_t insn) { From owner-svn-src-head@freebsd.org Wed Oct 30 12:47:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C8ACA1A4BDF; Wed, 30 Oct 2019 12:47:01 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4737WT4xkfz3NG8; Wed, 30 Oct 2019 12:47:01 +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 8964CA772; Wed, 30 Oct 2019 12:47:01 +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 x9UCl1so096604; Wed, 30 Oct 2019 12:47:01 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UCl01w096599; Wed, 30 Oct 2019 12:47:00 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910301247.x9UCl01w096599@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 30 Oct 2019 12:47:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354177 - in head/sys: arm64/arm64 dev/hwpmc X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys: arm64/arm64 dev/hwpmc X-SVN-Commit-Revision: 354177 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 12:47:01 -0000 Author: andrew Date: Wed Oct 30 12:47:00 2019 New Revision: 354177 URL: https://svnweb.freebsd.org/changeset/base/354177 Log: Use a lowercase name for arm64 special registers so they don't conflict with macros of the same name. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/debug_monitor.c head/sys/arm64/arm64/freebsd32_machdep.c head/sys/arm64/arm64/gic_v3_reg.h head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/trap.c head/sys/dev/hwpmc/hwpmc_arm64.c Modified: head/sys/arm64/arm64/debug_monitor.c ============================================================================== --- head/sys/arm64/arm64/debug_monitor.c Wed Oct 30 12:33:36 2019 (r354176) +++ head/sys/arm64/arm64/debug_monitor.c Wed Oct 30 12:47:00 2019 (r354177) @@ -468,8 +468,8 @@ dbg_monitor_init(void) u_int i; /* Find out many breakpoints and watchpoints we can use */ - dbg_watchpoint_num = ((READ_SPECIALREG(ID_AA64DFR0_EL1) >> 20) & 0xf) + 1; - dbg_breakpoint_num = ((READ_SPECIALREG(ID_AA64DFR0_EL1) >> 12) & 0xf) + 1; + dbg_watchpoint_num = ((READ_SPECIALREG(id_aa64dfr0_el1) >> 20) & 0xf) + 1; + dbg_breakpoint_num = ((READ_SPECIALREG(id_aa64dfr0_el1) >> 12) & 0xf) + 1; if (bootverbose && PCPU_GET(cpuid) == 0) { printf("%d watchpoints and %d breakpoints supported\n", Modified: head/sys/arm64/arm64/freebsd32_machdep.c ============================================================================== --- head/sys/arm64/arm64/freebsd32_machdep.c Wed Oct 30 12:33:36 2019 (r354176) +++ head/sys/arm64/arm64/freebsd32_machdep.c Wed Oct 30 12:47:00 2019 (r354177) @@ -72,8 +72,8 @@ freebsd32_sysarch(struct thread *td, struct freebsd32_ switch(uap->op) { case ARM_SET_TP: - WRITE_SPECIALREG(TPIDR_EL0, uap->parms); - WRITE_SPECIALREG(TPIDRRO_EL0, uap->parms); + WRITE_SPECIALREG(tpidr_el0, uap->parms); + WRITE_SPECIALREG(tpidrro_el0, uap->parms); return 0; case ARM_SYNC_ICACHE: { Modified: head/sys/arm64/arm64/gic_v3_reg.h ============================================================================== --- head/sys/arm64/arm64/gic_v3_reg.h Wed Oct 30 12:33:36 2019 (r354176) +++ head/sys/arm64/arm64/gic_v3_reg.h Wed Oct 30 12:47:00 2019 (r354177) @@ -389,7 +389,7 @@ #define gic_icc_write(reg, val) \ do { \ - WRITE_SPECIALREG(ICC_ ##reg ##_EL1, val); \ + WRITE_SPECIALREG(icc_ ##reg ##_el1, val); \ isb(); \ } while (0) @@ -397,7 +397,7 @@ do { \ ({ \ uint64_t val; \ \ - val = READ_SPECIALREG(ICC_ ##reg ##_EL1); \ + val = READ_SPECIALREG(icc_ ##reg ##_el1); \ (val); \ }) Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Wed Oct 30 12:33:36 2019 (r354176) +++ head/sys/arm64/arm64/machdep.c Wed Oct 30 12:47:00 2019 (r354177) @@ -1150,7 +1150,7 @@ dbg_init(void) { /* Clear OS lock */ - WRITE_SPECIALREG(OSLAR_EL1, 0); + WRITE_SPECIALREG(oslar_el1, 0); /* This permits DDB to use debug registers for watchpoints. */ dbg_monitor_init(); Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Wed Oct 30 12:33:36 2019 (r354176) +++ head/sys/arm64/arm64/trap.c Wed Oct 30 12:47:00 2019 (r354177) @@ -480,8 +480,8 @@ do_el0_sync(struct thread *td, struct trapframe *frame case EXCP_SOFTSTP_EL0: td->td_frame->tf_spsr &= ~PSR_SS; td->td_pcb->pcb_flags &= ~PCB_SINGLE_STEP; - WRITE_SPECIALREG(MDSCR_EL1, - READ_SPECIALREG(MDSCR_EL1) & ~DBG_MDSCR_SS); + WRITE_SPECIALREG(mdscr_el1, + READ_SPECIALREG(mdscr_el1) & ~DBG_MDSCR_SS); call_trapsignal(td, SIGTRAP, TRAP_TRACE, (void *)frame->tf_elr); userret(td, frame); Modified: head/sys/dev/hwpmc/hwpmc_arm64.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_arm64.c Wed Oct 30 12:33:36 2019 (r354176) +++ head/sys/dev/hwpmc/hwpmc_arm64.c Wed Oct 30 12:47:00 2019 (r354177) @@ -63,7 +63,7 @@ arm64_interrupt_enable(uint32_t pmc) uint32_t reg; reg = (1 << pmc); - WRITE_SPECIALREG(PMINTENSET_EL1, reg); + WRITE_SPECIALREG(pmintenset_el1, reg); isb(); } @@ -77,7 +77,7 @@ arm64_interrupt_disable(uint32_t pmc) uint32_t reg; reg = (1 << pmc); - WRITE_SPECIALREG(PMINTENCLR_EL1, reg); + WRITE_SPECIALREG(pmintenclr_el1, reg); isb(); } @@ -91,7 +91,7 @@ arm64_counter_enable(unsigned int pmc) uint32_t reg; reg = (1 << pmc); - WRITE_SPECIALREG(PMCNTENSET_EL0, reg); + WRITE_SPECIALREG(pmcntenset_el0, reg); isb(); } @@ -105,7 +105,7 @@ arm64_counter_disable(unsigned int pmc) uint32_t reg; reg = (1 << pmc); - WRITE_SPECIALREG(PMCNTENCLR_EL0, reg); + WRITE_SPECIALREG(pmcntenclr_el0, reg); isb(); } @@ -118,7 +118,7 @@ arm64_pmcr_read(void) { uint32_t reg; - reg = READ_SPECIALREG(PMCR_EL0); + reg = READ_SPECIALREG(pmcr_el0); return (reg); } @@ -127,7 +127,7 @@ static void arm64_pmcr_write(uint32_t reg) { - WRITE_SPECIALREG(PMCR_EL0, reg); + WRITE_SPECIALREG(pmcr_el0, reg); isb(); } @@ -141,11 +141,11 @@ arm64_pmcn_read(unsigned int pmc) KASSERT(pmc < arm64_npmcs, ("%s: illegal PMC number %d", __func__, pmc)); - WRITE_SPECIALREG(PMSELR_EL0, pmc); + WRITE_SPECIALREG(pmselr_el0, pmc); isb(); - return (READ_SPECIALREG(PMXEVCNTR_EL0)); + return (READ_SPECIALREG(pmxevcntr_el0)); } static void @@ -154,8 +154,8 @@ arm64_pmcn_write(unsigned int pmc, uint32_t reg) KASSERT(pmc < arm64_npmcs, ("%s: illegal PMC number %d", __func__, pmc)); - WRITE_SPECIALREG(PMSELR_EL0, pmc); - WRITE_SPECIALREG(PMXEVCNTR_EL0, reg); + WRITE_SPECIALREG(pmselr_el0, pmc); + WRITE_SPECIALREG(pmxevcntr_el0, reg); isb(); } @@ -273,8 +273,8 @@ arm64_start_pmc(int cpu, int ri) /* * Configure the event selection. */ - WRITE_SPECIALREG(PMSELR_EL0, ri); - WRITE_SPECIALREG(PMXEVTYPER_EL0, config); + WRITE_SPECIALREG(pmselr_el0, ri); + WRITE_SPECIALREG(pmxevtyper_el0, config); isb(); @@ -347,10 +347,10 @@ arm64_intr(struct trapframe *tf) /* Check if counter is overflowed */ reg = (1 << ri); - if ((READ_SPECIALREG(PMOVSCLR_EL0) & reg) == 0) + if ((READ_SPECIALREG(pmovsclr_el0) & reg) == 0) continue; /* Clear Overflow Flag */ - WRITE_SPECIALREG(PMOVSCLR_EL0, reg); + WRITE_SPECIALREG(pmovsclr_el0, reg); isb(); From owner-svn-src-head@freebsd.org Wed Oct 30 13:45:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 938C91A5F80; Wed, 30 Oct 2019 13:45: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4738q93McHz3xSs; Wed, 30 Oct 2019 13:45: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 54707B216; Wed, 30 Oct 2019 13:45: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 x9UDjfgl032527; Wed, 30 Oct 2019 13:45:41 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UDjei2032524; Wed, 30 Oct 2019 13:45:40 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910301345.x9UDjei2032524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 30 Oct 2019 13:45:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354178 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 354178 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 13:45:41 -0000 Author: andrew Date: Wed Oct 30 13:45:40 2019 New Revision: 354178 URL: https://svnweb.freebsd.org/changeset/base/354178 Log: Allow the userspace ID register fields to be read from the kernel To allow consistent values to be used in both the kernel and userspace create a function for these to be read from the kernel. They use a newly created macro with the name of the ID register to read. For now there is redundant information in the user_regs array as it still holds the CRm and Op2 values, however this will be fixed in a later change. This will be used by ptrace to allow hardware breakpoints in userspace. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/identcpu.c head/sys/arm64/include/armreg.h head/sys/arm64/include/undefined.h Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Wed Oct 30 12:47:00 2019 (r354177) +++ head/sys/arm64/arm64/identcpu.c Wed Oct 30 13:45:40 2019 (r354178) @@ -710,6 +710,7 @@ static struct mrs_field id_aa64pfr1_fields[] = { }; struct mrs_user_reg { + u_int reg; u_int CRm; u_int Op2; size_t offset; @@ -718,24 +719,28 @@ struct mrs_user_reg { static struct mrs_user_reg user_regs[] = { { /* id_aa64isar0_el1 */ + .reg = ID_AA64ISAR0_EL1, .CRm = 6, .Op2 = 0, .offset = __offsetof(struct cpu_desc, id_aa64isar0), .fields = id_aa64isar0_fields, }, { /* id_aa64isar1_el1 */ + .reg = ID_AA64ISAR1_EL1, .CRm = 6, .Op2 = 1, .offset = __offsetof(struct cpu_desc, id_aa64isar1), .fields = id_aa64isar1_fields, }, { /* id_aa64pfr0_el1 */ + .reg = ID_AA64PFR0_EL1, .CRm = 4, .Op2 = 0, .offset = __offsetof(struct cpu_desc, id_aa64pfr0), .fields = id_aa64pfr0_fields, }, { /* id_aa64dfr0_el1 */ + .reg = ID_AA64DFR0_EL1, .CRm = 5, .Op2 = 0, .offset = __offsetof(struct cpu_desc, id_aa64dfr0), @@ -816,6 +821,23 @@ user_mrs_handler(vm_offset_t va, uint32_t insn, struct frame->tf_lr = value; return (1); +} + +bool +extract_user_id_field(u_int reg, u_int field_shift, uint8_t *val) +{ + uint64_t value; + int i; + + for (i = 0; i < nitems(user_regs); i++) { + if (user_regs[i].reg == reg) { + value = CPU_DESC_FIELD(user_cpu_desc, i); + *val = value >> field_shift; + return (true); + } + } + + return (false); } static void Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Wed Oct 30 12:47:00 2019 (r354177) +++ head/sys/arm64/include/armreg.h Wed Oct 30 13:45:40 2019 (r354178) @@ -51,6 +51,10 @@ #define MRS_Op2_MASK 0x000000e0 #define MRS_Rt_SHIFT 0 #define MRS_Rt_MASK 0x0000001f +#define MRS_REG(op0, op1, crn, crm, op2) \ + (((op0) << MRS_Op0_SHIFT) | ((op1) << MRS_Op1_SHIFT) | \ + ((crn) << MRS_CRn_SHIFT) | ((crm) << MRS_CRm_SHIFT) | \ + ((op2) << MRS_Op2_SHIFT)) #define READ_SPECIALREG(reg) \ ({ uint64_t _val; \ @@ -193,6 +197,7 @@ #define ICC_SRE_EL2_EN (1U << 3) /* ID_AA64DFR0_EL1 */ +#define ID_AA64DFR0_EL1 MRS_REG(3, 0, 0, 5, 0) #define ID_AA64DFR0_DebugVer_SHIFT 0 #define ID_AA64DFR0_DebugVer_MASK (UL(0xf) << ID_AA64DFR0_DebugVer_SHIFT) #define ID_AA64DFR0_DebugVer_VAL(x) ((x) & ID_AA64DFR0_DebugVer_MASK) @@ -230,6 +235,7 @@ #define ID_AA64DFR0_PMSVer_V1 (UL(0x1) << ID_AA64DFR0_PMSVer_SHIFT) /* ID_AA64ISAR0_EL1 */ +#define ID_AA64ISAR0_EL1 MRS_REG(3, 0, 0, 6, 0) #define ID_AA64ISAR0_AES_SHIFT 4 #define ID_AA64ISAR0_AES_MASK (UL(0xf) << ID_AA64ISAR0_AES_SHIFT) #define ID_AA64ISAR0_AES_VAL(x) ((x) & ID_AA64ISAR0_AES_MASK) @@ -284,6 +290,7 @@ #define ID_AA64ISAR0_DP_IMPL (UL(0x1) << ID_AA64ISAR0_DP_SHIFT) /* ID_AA64ISAR1_EL1 */ +#define ID_AA64ISAR1_EL1 MRS_REG(3, 0, 0, 6, 1) #define ID_AA64ISAR1_DPB_SHIFT 0 #define ID_AA64ISAR1_DPB_MASK (UL(0xf) << ID_AA64ISAR1_DPB_SHIFT) #define ID_AA64ISAR1_DPB_VAL(x) ((x) & ID_AA64ISAR1_DPB_MASK) @@ -326,6 +333,7 @@ #define ID_AA64ISAR1_GPI_IMPL (UL(0x1) << ID_AA64ISAR1_GPI_SHIFT) /* ID_AA64MMFR0_EL1 */ +#define ID_AA64MMFR0_EL1 MRS_REG(3, 0, 0, 7, 0) #define ID_AA64MMFR0_PARange_SHIFT 0 #define ID_AA64MMFR0_PARange_MASK (UL(0xf) << ID_AA64MMFR0_PARange_SHIFT) #define ID_AA64MMFR0_PARange_VAL(x) ((x) & ID_AA64MMFR0_PARange_MASK) @@ -373,6 +381,7 @@ #define ID_AA64MMFR0_TGran4_NONE (UL(0xf) << ID_AA64MMFR0_TGran4_SHIFT) /* ID_AA64MMFR1_EL1 */ +#define ID_AA64MMFR1_EL1 MRS_REG(3, 0, 0, 7, 1) #define ID_AA64MMFR1_HAFDBS_SHIFT 0 #define ID_AA64MMFR1_HAFDBS_MASK (UL(0xf) << ID_AA64MMFR1_HAFDBS_SHIFT) #define ID_AA64MMFR1_HAFDBS_VAL(x) ((x) & ID_AA64MMFR1_HAFDBS_MASK) @@ -418,7 +427,7 @@ #define ID_AA64MMFR1_XNX_IMPL (UL(0x1) << ID_AA64MMFR1_XNX_SHIFT) /* ID_AA64MMFR2_EL1 */ -#define ID_AA64MMFR2_EL1 S3_0_C0_C7_2 +#define ID_AA64MMFR2_EL1 MRS_REG(3, 0, 0, 7, 2) #define ID_AA64MMFR2_CnP_SHIFT 0 #define ID_AA64MMFR2_CnP_MASK (UL(0xf) << ID_AA64MMFR2_CnP_SHIFT) #define ID_AA64MMFR2_CnP_VAL(x) ((x) & ID_AA64MMFR2_CnP_MASK) @@ -456,6 +465,7 @@ #define ID_AA64MMFR2_NV_IMPL (UL(0x1) << ID_AA64MMFR2_NV_SHIFT) /* ID_AA64PFR0_EL1 */ +#define ID_AA64PFR0_EL1 MRS_REG(3, 0, 0, 4, 0) #define ID_AA64PFR0_EL0_SHIFT 0 #define ID_AA64PFR0_EL0_MASK (UL(0xf) << ID_AA64PFR0_EL0_SHIFT) #define ID_AA64PFR0_EL0_VAL(x) ((x) & ID_AA64PFR0_EL0_MASK) Modified: head/sys/arm64/include/undefined.h ============================================================================== --- head/sys/arm64/include/undefined.h Wed Oct 30 12:47:00 2019 (r354177) +++ head/sys/arm64/include/undefined.h Wed Oct 30 13:45:40 2019 (r354178) @@ -33,6 +33,8 @@ #ifndef _MACHINE__UNDEFINED_H_ #define _MACHINE__UNDEFINED_H_ +#ifdef _KERNEL + typedef int (*undef_handler_t)(vm_offset_t, uint32_t, struct trapframe *, uint32_t); @@ -60,5 +62,8 @@ void undef_init(void); void *install_undef_handler(bool, undef_handler_t); void remove_undef_handler(void *); int undef_insn(u_int, struct trapframe *); +bool extract_user_id_field(u_int, u_int, uint8_t *); + +#endif /* _KERNEL */ #endif From owner-svn-src-head@freebsd.org Wed Oct 30 14:05:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 915DE1A63BD; Wed, 30 Oct 2019 14:05:51 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4739GR37zyz3yhQ; Wed, 30 Oct 2019 14:05:51 +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 4BE73B5C6; Wed, 30 Oct 2019 14:05:51 +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 x9UE5pA3043913; Wed, 30 Oct 2019 14:05:51 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UE5oe5043911; Wed, 30 Oct 2019 14:05:50 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910301405.x9UE5oe5043911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 30 Oct 2019 14:05:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354179 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 354179 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 14:05:51 -0000 Author: andrew Date: Wed Oct 30 14:05:50 2019 New Revision: 354179 URL: https://svnweb.freebsd.org/changeset/base/354179 Log: Allow exceptions to be masked when in userspace We may want to mask exceptions when in userspace. This was previously impossible as threads are created with all exceptions unmasked and signals expected userspace to mask any. Fix these by copying the mask state on thread creation and allow exceptions to be masked on signal return, as long as they don't change. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/vm_machdep.c head/sys/arm64/include/armreg.h Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Wed Oct 30 13:45:40 2019 (r354178) +++ head/sys/arm64/arm64/machdep.c Wed Oct 30 14:05:50 2019 (r354179) @@ -441,7 +441,8 @@ set_mcontext(struct thread *td, mcontext_t *mcp) spsr = mcp->mc_gpregs.gp_spsr; if ((spsr & PSR_M_MASK) != PSR_M_EL0t || - (spsr & (PSR_AARCH32 | PSR_F | PSR_I | PSR_A | PSR_D)) != 0) + (spsr & PSR_AARCH32) != 0 || + (spsr & PSR_DAIF) != (td->td_frame->tf_spsr & PSR_DAIF)) return (EINVAL); memcpy(tf->tf_x, mcp->mc_gpregs.gp_x, sizeof(tf->tf_x)); Modified: head/sys/arm64/arm64/vm_machdep.c ============================================================================== --- head/sys/arm64/arm64/vm_machdep.c Wed Oct 30 13:45:40 2019 (r354178) +++ head/sys/arm64/arm64/vm_machdep.c Wed Oct 30 14:05:50 2019 (r354179) @@ -98,7 +98,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t bcopy(td1->td_frame, tf, sizeof(*tf)); tf->tf_x[0] = 0; tf->tf_x[1] = 0; - tf->tf_spsr = td1->td_frame->tf_spsr & PSR_M_32; + tf->tf_spsr = td1->td_frame->tf_spsr & (PSR_M_32 | PSR_DAIF); td2->td_frame = tf; Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Wed Oct 30 13:45:40 2019 (r354178) +++ head/sys/arm64/include/armreg.h Wed Oct 30 14:05:50 2019 (r354179) @@ -608,6 +608,7 @@ #define PSR_I 0x00000080 #define PSR_A 0x00000100 #define PSR_D 0x00000200 +#define PSR_DAIF (PSR_D | PSR_A | PSR_I | PSR_F) #define PSR_IL 0x00100000 #define PSR_SS 0x00200000 #define PSR_V 0x10000000 From owner-svn-src-head@freebsd.org Wed Oct 30 15:15:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E5681A79E9; Wed, 30 Oct 2019 15:15: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473BqG1M1wz43l8; Wed, 30 Oct 2019 15:15: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 115EDC3CC; Wed, 30 Oct 2019 15:15: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 x9UFFrXc084906; Wed, 30 Oct 2019 15:15:53 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UFFrI4084905; Wed, 30 Oct 2019 15:15:53 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910301515.x9UFFrI4084905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 30 Oct 2019 15:15:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354180 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 354180 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 15:15:54 -0000 Author: avg Date: Wed Oct 30 15:15:53 2019 New Revision: 354180 URL: https://svnweb.freebsd.org/changeset/base/354180 Log: ow(4): increase regular mode recovery time, t_rec, to 15 us Previously we used the minimal value of 1 us and it was really tight. Application Note 3829 has a table describing recommended t_rec values for various bus voltages, temperature conditions and numbers of slave devices. The new value decreases the maximum possible data rate from 16.3 Kbit/s to 13.3 Kbit/s, but it allows for up to four slaves on a 3.3V bus (under room temperature). References: - Maxim Integrated Application Note 3829 Determining the Recovery Time for Multiple-Slave 1-Wire(R) Networks - Maxim Integrated Application Note 937 Book of iButton Standards Discussed with: imp (D22108) MFC after: 3 weeks Modified: head/sys/dev/ow/ow.c Modified: head/sys/dev/ow/ow.c ============================================================================== --- head/sys/dev/ow/ow.c Wed Oct 30 14:05:50 2019 (r354179) +++ head/sys/dev/ow/ow.c Wed Oct 30 15:15:53 2019 (r354180) @@ -80,7 +80,7 @@ static struct ow_timing timing_regular = { .t_low0 = 60, /* really 60 to 120 */ .t_low1 = 1, /* really 1 to 15 */ .t_release = 45, /* <= 45us */ - .t_rec = 1, /* at least 1us */ + .t_rec = 15, /* at least 1us */ .t_rdv = 15, /* 15us */ .t_rstl = 480, /* 480us or more */ .t_rsth = 480, /* 480us or more */ From owner-svn-src-head@freebsd.org Wed Oct 30 15:26:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C131C1A7D4D; Wed, 30 Oct 2019 15:26:41 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473C3j4m7nz44RL; Wed, 30 Oct 2019 15:26:41 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 826A2C58B; Wed, 30 Oct 2019 15:26:41 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9UFQfOu091116; Wed, 30 Oct 2019 15:26:41 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UFQfkm091115; Wed, 30 Oct 2019 15:26:41 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910301526.x9UFQfkm091115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 30 Oct 2019 15:26:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354181 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 354181 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 15:26:41 -0000 Author: avg Date: Wed Oct 30 15:26:41 2019 New Revision: 354181 URL: https://svnweb.freebsd.org/changeset/base/354181 Log: ow(4): protocol timings can now be changed as sysctl-s / tunables I limited potentially infinite timings by 960 us based on a footnote on page 38 of Maxim Integrated Application Note 937, Book of iButton Standards: "In order not to mask interrupt signalling by other devices on the 1–Wire bus, tRSTL + tR should always be less than 960 us." MFC after: 3 weeks Modified: head/sys/dev/ow/ow.c Modified: head/sys/dev/ow/ow.c ============================================================================== --- head/sys/dev/ow/ow.c Wed Oct 30 15:15:53 2019 (r354180) +++ head/sys/dev/ow/ow.c Wed Oct 30 15:26:41 2019 (r354181) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -75,34 +76,137 @@ static void ow_release_bus(device_t ndev, device_t pde static MALLOC_DEFINE(M_OW, "ow", "House keeping data for 1wire bus"); +static const struct ow_timing timing_regular_min = { + .t_slot = 60, + .t_low0 = 60, + .t_low1 = 1, + .t_release = 0, + .t_rec = 1, + .t_rdv = 15, /* fixed */ + .t_rstl = 480, + .t_rsth = 480, + .t_pdl = 60, + .t_pdh = 15, + .t_lowr = 1, +}; + +static const struct ow_timing timing_regular_max = { + .t_slot = 120, + .t_low0 = 120, + .t_low1 = 15, + .t_release = 45, + .t_rec = 960, /* infinity */ + .t_rdv = 15, /* fixed */ + .t_rstl = 960, /* infinity */ + .t_rsth = 960, /* infinity */ + .t_pdl = 240, /* 60us to 240us */ + .t_pdh = 60, /* 15us to 60us */ + .t_lowr = 15, /* 1us */ +}; + static struct ow_timing timing_regular = { - .t_slot = 60, /* 60 to 120 */ - .t_low0 = 60, /* really 60 to 120 */ - .t_low1 = 1, /* really 1 to 15 */ - .t_release = 45, /* <= 45us */ - .t_rec = 15, /* at least 1us */ - .t_rdv = 15, /* 15us */ - .t_rstl = 480, /* 480us or more */ - .t_rsth = 480, /* 480us or more */ - .t_pdl = 60, /* 60us to 240us */ - .t_pdh = 60, /* 15us to 60us */ - .t_lowr = 1, /* 1us */ + .t_slot = 60, /* 60 <= t < 120 */ + .t_low0 = 60, /* 60 <= t < t_slot < 120 */ + .t_low1 = 1, /* 1 <= t < 15 */ + .t_release = 45, /* 0 <= t < 45 */ + .t_rec = 15, /* 1 <= t < inf */ + .t_rdv = 15, /* t == 15 */ + .t_rstl = 480, /* 480 <= t < inf */ + .t_rsth = 480, /* 480 <= t < inf */ + .t_pdl = 60, /* 60 <= t < 240 */ + .t_pdh = 60, /* 15 <= t < 60 */ + .t_lowr = 1, /* 1 <= t < 15 */ }; /* NB: Untested */ +static const struct ow_timing timing_overdrive_min = { + .t_slot = 6, + .t_low0 = 6, + .t_low1 = 1, + .t_release = 0, + .t_rec = 1, + .t_rdv = 2, /* fixed */ + .t_rstl = 48, + .t_rsth = 48, + .t_pdl = 8, + .t_pdh = 2, + .t_lowr = 1, +}; + +static const struct ow_timing timing_overdrive_max = { + .t_slot = 16, + .t_low0 = 16, + .t_low1 = 2, + .t_release = 4, + .t_rec = 960, /* infinity */ + .t_rdv = 2, /* fixed */ + .t_rstl = 80, + .t_rsth = 960, /* infinity */ + .t_pdl = 24, + .t_pdh = 6, + .t_lowr = 2, +}; + static struct ow_timing timing_overdrive = { - .t_slot = 11, /* 6us to 16us */ - .t_low0 = 6, /* really 6 to 16 */ - .t_low1 = 1, /* really 1 to 2 */ - .t_release = 4, /* <= 4us */ - .t_rec = 1, /* at least 1us */ - .t_rdv = 2, /* 2us */ - .t_rstl = 48, /* 48us to 80us */ - .t_rsth = 48, /* 48us or more */ - .t_pdl = 8, /* 8us to 24us */ - .t_pdh = 2, /* 2us to 6us */ - .t_lowr = 1, /* 1us */ + .t_slot = 11, /* 6 <= t < 16 */ + .t_low0 = 6, /* 6 <= t < t_slot < 16 */ + .t_low1 = 1, /* 1 <= t < 2 */ + .t_release = 4, /* 0 <= t < 4 */ + .t_rec = 1, /* 1 <= t < inf */ + .t_rdv = 2, /* t == 2 */ + .t_rstl = 48, /* 48 <= t < 80 */ + .t_rsth = 48, /* 48 <= t < inf */ + .t_pdl = 8, /* 8 <= t < 24 */ + .t_pdh = 2, /* 2 <= t < 6 */ + .t_lowr = 1, /* 1 <= t < 2 */ }; + +SYSCTL_DECL(_hw); +SYSCTL_NODE(_hw, OID_AUTO, ow, CTLFLAG_RD, 0, "1-Wire protocol"); +SYSCTL_NODE(_hw_ow, OID_AUTO, regular, CTLFLAG_RD, 0, + "Regular mode timings"); +SYSCTL_NODE(_hw_ow, OID_AUTO, overdrive, CTLFLAG_RD, 0, + "Overdrive mode timings"); + +#define _OW_TIMING_SYSCTL(mode, param) \ + static int \ + sysctl_ow_timing_ ## mode ## _ ## param(SYSCTL_HANDLER_ARGS) \ + { \ + int val = timing_ ## mode.param; \ + int err; \ + err = sysctl_handle_int(oidp, &val, 0, req); \ + if (err != 0 || req->newptr == NULL) \ + return (err); \ + if (val < timing_ ## mode ## _min.param) \ + return (EINVAL); \ + else if (val >= timing_ ## mode ## _max.param) \ + return (EINVAL); \ + timing_ ## mode.param = val; \ + return (0); \ + } \ +SYSCTL_PROC(_hw_ow_ ## mode, OID_AUTO, param, \ + CTLTYPE_INT | CTLFLAG_RWTUN, 0, sizeof(int), \ + sysctl_ow_timing_ ## mode ## _ ## param, "I", \ + "1-Wire timing parameter in microseconds (-1 resets to default)") + +#define OW_TIMING_SYSCTL(param) \ + _OW_TIMING_SYSCTL(regular, param); \ + _OW_TIMING_SYSCTL(overdrive, param) + +OW_TIMING_SYSCTL(t_slot); +OW_TIMING_SYSCTL(t_low0); +OW_TIMING_SYSCTL(t_low1); +OW_TIMING_SYSCTL(t_release); +OW_TIMING_SYSCTL(t_rec); +OW_TIMING_SYSCTL(t_rdv); +OW_TIMING_SYSCTL(t_rstl); +OW_TIMING_SYSCTL(t_rsth); +OW_TIMING_SYSCTL(t_pdl); +OW_TIMING_SYSCTL(t_pdh); +OW_TIMING_SYSCTL(t_lowr); + +#undef _OW_TIMING_SYSCTL +#undef OW_TIMING_SYSCTL static void ow_send_byte(device_t lldev, struct ow_timing *t, uint8_t byte) From owner-svn-src-head@freebsd.org Wed Oct 30 15:30:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D2098158053; Wed, 30 Oct 2019 15:30:40 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473C8J5DdWz44wC; Wed, 30 Oct 2019 15:30: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 97DCFC5A1; Wed, 30 Oct 2019 15:30: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 x9UFUeY4091386; Wed, 30 Oct 2019 15:30:40 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UFUe8X091385; Wed, 30 Oct 2019 15:30:40 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201910301530.x9UFUe8X091385@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 30 Oct 2019 15:30:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354182 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 354182 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 15:30:40 -0000 Author: jhibbits Date: Wed Oct 30 15:30:40 2019 New Revision: 354182 URL: https://svnweb.freebsd.org/changeset/base/354182 Log: ARM64: Treat alignment faults as bus errors Summary: ARM64 currently treats all data abort exceptions as page faults. This can cause infinite loops on non-page fault faults, such as alignment faults. Since kernel-side alignment faults should be avoided, this adds support directly to the el0 fault handler, instead of the data_abort() handler. Test Plan: Tested on rpi3, with a misaligned ldm test. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D22133 Modified: head/sys/arm64/arm64/trap.c Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Wed Oct 30 15:26:41 2019 (r354181) +++ head/sys/arm64/arm64/trap.c Wed Oct 30 15:30:40 2019 (r354182) @@ -87,6 +87,7 @@ int (*dtrace_invop_jump_addr)(struct trapframe *); typedef void (abort_handler)(struct thread *, struct trapframe *, uint64_t, uint64_t, int); +static abort_handler align_abort; static abort_handler data_abort; static abort_handler *abort_handlers[] = { @@ -100,6 +101,7 @@ static abort_handler *abort_handlers[] = { [ISS_DATA_DFSC_PF_L1] = data_abort, [ISS_DATA_DFSC_PF_L2] = data_abort, [ISS_DATA_DFSC_PF_L3] = data_abort, + [ISS_DATA_DFSC_ALIGN] = align_abort, }; static __inline void @@ -163,6 +165,17 @@ svc_handler(struct thread *td, struct trapframe *frame call_trapsignal(td, SIGILL, ILL_ILLOPN, (void *)frame->tf_elr); userret(td, frame); } +} + +static void +align_abort(struct thread *td, struct trapframe *frame, uint64_t esr, + uint64_t far, int lower) +{ + if (!lower) + panic("Misaligned access from kernel space!"); + + call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_elr); + userret(td, frame); } static void From owner-svn-src-head@freebsd.org Wed Oct 30 15:36:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 908E51583E5; Wed, 30 Oct 2019 15:36:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473CHG3Jtxz45KW; Wed, 30 Oct 2019 15:36:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 511C2C76A; Wed, 30 Oct 2019 15:36:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9UFagx3096916; Wed, 30 Oct 2019 15:36:42 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UFagtb096915; Wed, 30 Oct 2019 15:36:42 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910301536.x9UFagtb096915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 30 Oct 2019 15:36:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354183 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 354183 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 15:36:42 -0000 Author: avg Date: Wed Oct 30 15:36:41 2019 New Revision: 354183 URL: https://svnweb.freebsd.org/changeset/base/354183 Log: ow(4): clean up stray white space MFC after: 2 weeks Modified: head/sys/dev/ow/ow.c Modified: head/sys/dev/ow/ow.c ============================================================================== --- head/sys/dev/ow/ow.c Wed Oct 30 15:30:40 2019 (r354182) +++ head/sys/dev/ow/ow.c Wed Oct 30 15:36:41 2019 (r354183) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); typedef int ow_enum_fn(device_t, device_t); typedef int ow_found_fn(device_t, romid_t); -struct ow_softc +struct ow_softc { device_t dev; /* Newbus driver back pointer */ struct mtx mtx; /* bus mutex */ @@ -212,7 +212,7 @@ static void ow_send_byte(device_t lldev, struct ow_timing *t, uint8_t byte) { int i; - + for (i = 0; i < 8; i++) if (byte & (1 << i)) OWLL_WRITE_ONE(lldev, t); @@ -226,7 +226,7 @@ ow_read_byte(device_t lldev, struct ow_timing *t, uint int i; uint8_t byte = 0; int bit; - + for (i = 0; i < 8; i++) { OWLL_READ_DATA(lldev, t, &bit); byte |= bit << i; From owner-svn-src-head@freebsd.org Wed Oct 30 17:18:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B91C015B8EA; Wed, 30 Oct 2019 17:18:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473FXM4Rd4z4H5p; Wed, 30 Oct 2019 17:18:11 +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 784C0D96D; Wed, 30 Oct 2019 17:18:11 +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 x9UHIBHl059165; Wed, 30 Oct 2019 17:18:11 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UHIBKT059164; Wed, 30 Oct 2019 17:18:11 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201910301718.x9UHIBKT059164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 30 Oct 2019 17:18:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354192 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 354192 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 17:18:11 -0000 Author: imp Date: Wed Oct 30 17:18:11 2019 New Revision: 354192 URL: https://svnweb.freebsd.org/changeset/base/354192 Log: Make hyperv keyboard work again. r351049 bogusly deleted these lines from files.amd64 but failed to add them to files.x86. Since this works on i386, add them to files.x86 rather than just adding them back to files.amd64. PR: 240734 Reported by: Michael Pro Modified: head/sys/conf/files.x86 Modified: head/sys/conf/files.x86 ============================================================================== --- head/sys/conf/files.x86 Wed Oct 30 17:06:02 2019 (r354191) +++ head/sys/conf/files.x86 Wed Oct 30 17:18:11 2019 (r354192) @@ -113,6 +113,8 @@ dev/hwpmc/hwpmc_core.c optional hwpmc dev/hwpmc/hwpmc_uncore.c optional hwpmc dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc +dev/hyperv/input/hv_kbd.c optional hyperv +dev/hyperv/input/hv_kbdc.c optional hyperv dev/hyperv/pcib/vmbus_pcib.c optional hyperv pci dev/hyperv/netvsc/hn_nvs.c optional hyperv dev/hyperv/netvsc/hn_rndis.c optional hyperv From owner-svn-src-head@freebsd.org Wed Oct 30 17:32:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB2F015C0F8; Wed, 30 Oct 2019 17:32:36 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473Fs05SWsz4J22; Wed, 30 Oct 2019 17:32:36 +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 84EE0DCFB; Wed, 30 Oct 2019 17:32:36 +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 x9UHWagJ070699; Wed, 30 Oct 2019 17:32:36 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UHWaJs070697; Wed, 30 Oct 2019 17:32:36 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910301732.x9UHWaJs070697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 30 Oct 2019 17:32:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354193 - 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: 354193 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 17:32:36 -0000 Author: andrew Date: Wed Oct 30 17:32:35 2019 New Revision: 354193 URL: https://svnweb.freebsd.org/changeset/base/354193 Log: Set the userspace execute never bit on kernel mappings. Arm64 allows us to create execute only mappings. To make sure userspace is unable to accidentally execute kernel code set the user execute never bit in the kernel page tables. MFC after: 1 week Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/locore.S head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/locore.S ============================================================================== --- head/sys/arm64/arm64/locore.S Wed Oct 30 17:18:11 2019 (r354192) +++ head/sys/arm64/arm64/locore.S Wed Oct 30 17:32:35 2019 (r354193) @@ -556,6 +556,7 @@ build_l2_block_pagetable: lsl x12, x7, #2 orr x12, x12, #L2_BLOCK orr x12, x12, #(ATTR_AF) + orr x12, x12, #(ATTR_UXN) #ifdef SMP orr x12, x12, ATTR_SH(ATTR_SH_IS) #endif Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Wed Oct 30 17:18:11 2019 (r354192) +++ head/sys/arm64/arm64/pmap.c Wed Oct 30 17:32:35 2019 (r354193) @@ -761,7 +761,7 @@ pmap_bootstrap_l3(vm_offset_t l1pt, vm_offset_t va, vm pa = pmap_early_vtophys(l1pt, l3pt); pmap_store(&l2[l2_slot], - (pa & ~Ln_TABLE_MASK) | L2_TABLE); + (pa & ~Ln_TABLE_MASK) | ATTR_UXN | L2_TABLE); l3pt += PAGE_SIZE; } @@ -1174,6 +1174,8 @@ pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_ attr = ATTR_DEFAULT | ATTR_IDX(mode) | L3_PAGE; if (mode == DEVICE_MEMORY) attr |= ATTR_XN; + else + attr |= ATTR_UXN; va = sva; while (size != 0) { @@ -1289,7 +1291,7 @@ pmap_qenter(vm_offset_t sva, vm_page_t *ma, int count) m = ma[i]; pa = VM_PAGE_TO_PHYS(m) | ATTR_DEFAULT | ATTR_AP(ATTR_AP_RW) | - ATTR_IDX(m->md.pv_memattr) | L3_PAGE; + ATTR_UXN | ATTR_IDX(m->md.pv_memattr) | L3_PAGE; if (m->md.pv_memattr == DEVICE_MEMORY) pa |= ATTR_XN; pte = pmap_l2_to_l3(pde, va); @@ -3194,6 +3196,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v new_l3 |= ATTR_SW_WIRED; if (va < VM_MAXUSER_ADDRESS) new_l3 |= ATTR_AP(ATTR_AP_USER) | ATTR_PXN; + else + new_l3 |= ATTR_UXN; if ((m->oflags & VPO_UNMANAGED) == 0) { new_l3 |= ATTR_SW_MANAGED; if ((prot & VM_PROT_WRITE) != 0) { @@ -3456,6 +3460,8 @@ pmap_enter_2mpage(pmap_t pmap, vm_offset_t va, vm_page new_l2 |= ATTR_XN; if (va < VM_MAXUSER_ADDRESS) new_l2 |= ATTR_AP(ATTR_AP_USER) | ATTR_PXN; + else + new_l2 |= ATTR_UXN; return (pmap_enter_l2(pmap, va, new_l2, PMAP_ENTER_NOSLEEP | PMAP_ENTER_NOREPLACE | PMAP_ENTER_NORECLAIM, NULL, lockp) == KERN_SUCCESS); @@ -3754,6 +3760,8 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v l3_val |= ATTR_XN; if (va < VM_MAXUSER_ADDRESS) l3_val |= ATTR_AP(ATTR_AP_USER) | ATTR_PXN; + else + l3_val |= ATTR_UXN; /* * Now validate mapping with RO protection From owner-svn-src-head@freebsd.org Wed Oct 30 17:33:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0112E15C1AC; Wed, 30 Oct 2019 17:33:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473Fsn6DP8z4J99; Wed, 30 Oct 2019 17:33:17 +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 B9EAFDCFD; Wed, 30 Oct 2019 17:33:17 +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 x9UHXHxQ070800; Wed, 30 Oct 2019 17:33:17 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UHXHN9070799; Wed, 30 Oct 2019 17:33:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910301733.x9UHXHN9070799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 30 Oct 2019 17:33:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354194 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354194 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 17:33:18 -0000 Author: kib Date: Wed Oct 30 17:33:17 2019 New Revision: 354194 URL: https://svnweb.freebsd.org/changeset/base/354194 Log: vm_page_wire_mapped: explain why failure does not affect correctness. Reviewed by: markj (previous version) Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D22196 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Oct 30 17:32:35 2019 (r354193) +++ head/sys/vm/vm_page.c Wed Oct 30 17:33:17 2019 (r354194) @@ -3763,6 +3763,9 @@ vm_page_wire(vm_page_t m) /* * Attempt to wire a mapped page following a pmap lookup of that page. * This may fail if a thread is concurrently tearing down mappings of the page. + * The transient failure is acceptable because it translates to the + * failure of the caller pmap_extract_and_hold(), which should be then + * followed by the vm_fault() fallback, see e.g. vm_fault_quick_hold_pages(). */ bool vm_page_wire_mapped(vm_page_t m) From owner-svn-src-head@freebsd.org Wed Oct 30 19:36:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 433FC15F023; Wed, 30 Oct 2019 19:36:51 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473JcM13Qtz4SX9; Wed, 30 Oct 2019 19:36:51 +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 07D3EF2D1; Wed, 30 Oct 2019 19:36:51 +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 x9UJapYI042942; Wed, 30 Oct 2019 19:36:51 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UJaohR042940; Wed, 30 Oct 2019 19:36:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910301936.x9UJaohR042940@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 30 Oct 2019 19:36:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354201 - in head/sys: contrib/dev/iwm modules/iwmfw modules/iwmfw/iwm9000fw modules/iwmfw/iwm9260fw X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: contrib/dev/iwm modules/iwmfw modules/iwmfw/iwm9000fw modules/iwmfw/iwm9260fw X-SVN-Commit-Revision: 354201 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 19:36:51 -0000 Author: markj Date: Wed Oct 30 19:36:50 2019 New Revision: 354201 URL: https://svnweb.freebsd.org/changeset/base/354201 Log: Add firmware images for Intel 9000-series wifi chips. This is in preparation for adding the corresponding support to iwm(4). Version 46 is the latest but contains unrecognized TLVs, so use version 43 for now. Obtained from: linux-firmware MFC after: 1 month Sponsored by: The FreeBSD Foundation Added: head/sys/contrib/dev/iwm/iwm-9000-43.fw.uu head/sys/contrib/dev/iwm/iwm-9260-43.fw.uu head/sys/modules/iwmfw/iwm9000fw/ head/sys/modules/iwmfw/iwm9000fw/Makefile (contents, props changed) head/sys/modules/iwmfw/iwm9260fw/ head/sys/modules/iwmfw/iwm9260fw/Makefile (contents, props changed) Modified: head/sys/modules/iwmfw/Makefile Added: head/sys/contrib/dev/iwm/iwm-9000-43.fw.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/dev/iwm/iwm-9000-43.fw.uu Wed Oct 30 19:36:50 2019 (r354201) @@ -0,0 +1,56527 @@ +begin 644 iwm-9000-43.fw +M`````$E73`IR96QE87-E+V-O````"`````````!_$^^='@````@````!```` +M(C(``!X````(`````@```-MND0$>````"`````,`````````'````!`````` +M````````````````````&P````0````"````(`````0`````8`,`,P````P` +M``````````"```"``0`S````#`````$``````(@``(```#,````,`````@`` +M````0```\`@`-P```"````"`W(``)'I&`)CF@``8'8``I'*````````````` +M`````#8````(````Q`"(`+A&1,`#```!W`@```$````!````"@````$````" +M````(````&UA8U]P97)I<&@`````````````````````````````M`$```0` +M````1J``!$:@``A&H``,1J``$$:@`!1&H``81J``($:@`"1&H``X1J``/$:@ +M`$!&H`!$1J``2$:@`%!&H`!41J``6$:@`%Q&H`!@1J``9$:@`'!&H`!T1J`` +M>$:@`'Q&H`"`1J``A$:@`(A&H`",1J``D$:@`)1&H`#`1J``Q$:@`,A&H`#, +M1J``T$:@`-1&H`#81J``W$:@`.!&H`#D1J``Z$:@`.Q&H`#P1J``]$:@`/A& +MH`#\1J```$>@``1'H``,1Z``$$>@`!1'H`!\1Z``@$>@`(1'H`"(1Z``D$>@ +M`)1'H`"81Z``H$>@`*1'H````*``#`"@`!``H``4`*``&`"@`!P`H``@`*`` +M)`"@`"P`H``P`*``-`"@`#P`H``0!*``%`2@`!@$H``@!*``*`2@`#`$H``T +M!*``.`2@`#P$H`!$!*``0`B@`%`(H`!4"*``6`B@``00H``($*``$!"@`!@0 +MH``D$*``+!"@`#`0H``T$*``/!"@`$`0H`!($*``3!"@`%`0H`!8$*``8!"@ +M`&00H`!H$*``;!"@`'`0H`",$*``&!R@`!P"2@`'PDH`"`)*``A"2@`(@DH`",)*``D"2@`)0DH`"8)*``G"2@`*`D +MH`"D)*``J"2@`*PDH`"P)*``R"2@`,PDH```):``!"6@``PEH`!():``3"6@ +M`%`EH`!4):``@"6@`(0EH`"():``C"6@`)`EH`"4):``N"6@`,`EH`#,):`` +MT"6@`/0EH```)J``#":@`$@FH`!,)J``4":@`(`FH`#`)J``Q":@`,@FH`#, +M)J```">@``0GH``()Z``#">@`&`>H`"`(*``B""@`(P@H`"0(*```#"@`!`P +MH``4,*``'#"@`"`PH``D,*``*#"@`"PPH``T,*``.#"@`$`PH`!@,*``9#"@ +M`&@PH`!P,*``@#"@`(0PH`",,*``D#"@`)@PH`"H,*``L#"@`+0PH`"\,*`` +M`#&@``0QH``(,:``##&@`!`QH``4,:``&#&@`!PQH``@,:``)#&@`"@QH``L +M,:```#R@``0\H``(/*``##R@`!`\H``4/*``&#R@`"P\H``T/*``7#R@``!$ +MH``$1*``"$2@``Q$H``01*``%$2@`!A$H``<1*``($2@`"1$H``H1*``+$2@ +M`#!$H``T1*``.$2@`#Q$H`!`1*``1$2@`$A$H`!,1*``4$2@`%1$H`!@1*`` +M9$2@`&A$H`!L1*``<$2@`'1$H`#`1*``Q$2@`,A$H`#,1*``T$2@`-1$H`#8 +M1*``W$2@`.!$H`#D1*``Z$2@`.Q$H```1:``!$6@`!!%H``41:``&$6@`!Q% +MH``@1:``)$6@`"A%H``L1:``,$6@`#1%H``X1:``1$6@`$A%H`!@1:``<$6@ +M`'1%H`!X1:``?$6@`)!%H`"81:``P$6@`,1%H`#(1:``S$6@`-!%H`#41:`` +MV$6@`-Q%H`#@1:``Z$6@`.Q%H`#P1:``E""@`!@LH``<+*``("R@`"0LH``H +M+*``+"R@`#`LH`"(+*``C"R@`)`LH`"4+*``F"R@`)PLH``4+*``#"R@``0L +MH`#$'J``P!Z@`*`>H`"$'J``Y""@`!`@H`!,'*``2!R@`!`LH```+*``""R@ +M`)A&H`"<1J``H$:@`*1&H``(1Z``0$>@`$1'H``$,*``"#"@``PPH`"H1Z`` +M5$>@`%A'H`!<1Z``8$>@`&1'H`!H1Z``;$>@`'!'H`!T1Z``L$>@`+1'H`"X +M1Z``?#"@`*`PH`"L,*``P#"@`,@PH`#,,*``T#"@`-0PH`!01Z``'#R@`"`\ +MH``D/*``*#R@`#`\H``X/*``/#R@`$`\H`!$/*``2#R@`$P\H`!0/*``5#R@ +M`%@\H`!`1:``Y$6@`/1%H`"8):``G"6@`*`EH`"D):``J"6@`*PEH`#$):`` +MR"6@`-0EH`#8):``W"6@`.`EH`#D):``Z"6@`.PEH`#P):```@````,````@ +M````<&AY7W!E&9I9F]S```````````````` +M``````````````````$```````````````@````)````(````')X9FEF;W,` +M`````````````````````````````````0``````````````"0````H````@ +M````=FER='5A;%]M96UO[`$`0````$`````!```` +M``$````````````````````````````````````````````````````````` +M`````````````````````````````````````````````````````````!VW +M:9XK6HS@1UZ7\/'_8U$+D6Y^]83_)\S\S&A<&'%>J.U()@NP@:E3%(C +MF\>"V)P$[>.?B@`#;;ZK;`B[SY%R,_"V86PL/]M18=8F]XI6Z_HIKYT_$6VL2:Z/8A@*9GRQ;R`/MZ=3POUKJ6/N +M>8]>D$V):;N`G^<\WYUZDY8L3T^QLM!:!=PDV4KFW'PU?;3BKVNA/'H$U,." +MG%&@E!^5TT3/QR8@7D$B*QF^JI]SX%PN!\3B(\R`@;OC^NIK0NYO#8]I5 +M(MOG*W;Y[;7'"9>!A?U97N@1[-$W9,F*SF:0.V*C[%D!5P9<])&PO`&]>1"# +M-G=%][D8`F.:``!@=@`"D0=P!$(#N$8'P`(8@`` +M&R4!`!LD```%)0$`!20`"`4Y`0`%8H@@P!$"``4D``@%.0$`!6*,(,`1!``% +M)``(!3D!``5BD"#`$0@`!20`"`4Y`0`%8I0@P!$0``4D``@%.0$`!6*8(,`1 +M(``%)``(!3D!``5BG"#`$4``!20`"`4Y`0`%8J`@P!$```@E```()`@.X1D$ +M#N$9"`W`$@$`&W`#``!AZ!W`$!``&S#H'<`1^`S`$@$`&W`%``!A#QP=(@0` +M'2;H'<`0`0`;,.@=P!&6#P!A```;)(``&R7D'<`1"`!?@#8"!``#`%Y0-P!(`"1LH +MB`V`@0``P!><#8"!``#`%\[N#26#APTD#PTW(FP@P!`/&S0,P!(``,T1#T0`(@H``$``0`!P!0``80(`$R/L',`1#W@3 +M(@0`RA$"``!A#W@3(@``QA$(`%@Q#W<3(N```!A"`!8;@\``&$(``=P"P``80`"7#'8'L`0"@`30``0$VX$``!A`0`( +M)```""4$#N$9!```80"`6#`"``!A`"!8,````&'H'<`0YO\3,O__$S/H'<`1 +M```!)`@``24/`6,B`0!2)`@`!VX"``!A```5)````"$.``!AZ!W`$!#X`23_ +M_P$E``$3.0\3`2+X#,`2``$3..@=P!$!`%(D>$7`$`$`$W`"``!A"`!D,>,/ +M`&'L#,`2`0`3;DP``&'.[@TE`8`-)`\--R(/7#[[ZMWN^^K=[OOJW>```````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````````````````````````````_W__?_]__W__ +M?_]__W__?P```````````````.P5```"````!````-1'@``````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````#\`/P``````/P`_```````````````````````````````` +M````````````=!6```$````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````@```````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M@````````````````````````````@```````````````````/\````````` +M`(```````/\```````````(```````````````````#_``````````"````` +M``#_```````````"````````````````````_P``````````@```````_P`` +M`````````@```````````````````/\``````````(```````/\````````` +M``(```````````````````#_``````````"```````#_```````````"```` +M````````````````_P``````````@```````_P```````````@`````````` +M`````````/\``````````(```````/\```````````(````````````````` +M``#_``````````"```````#_```````````"````````````````````_P`` +M````````@```````_P```````````@```````````````````/\````````` +M`(```````/\```````````(```````````````````#_``````````"````` +M``#_```````````"````````````````````_P``````````@```````_P`` +M`````````@```````````````````/\``````````(```````/\````````` +M``(```````````````````#_``````````"```````#_```````````"```` +M````````````````_P``````````@```````_P```````````@`````````` +M`````````/\``````````(```````/\````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````!&0```````````````````````````````````````#07`@`% +M````!````-1'@`````````````````"4"`(`!0````0```#41X`````````` +M````````-`@"``4````$````U$>``````````````````%05`@`%````!``` +M`-1'@```````````````````%P(`!0````0```#41X`````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````-#AR\@$"`P```0(#`0("!``!`P0!````!````!$````W`````0`` +M``(````#````!`````8````'````!P`````````!`````@````,````'```` +M!`````4```````````````$````````````````````````````````````! +M`````````````````````````.3X@```````````````````````````@``` +M`````````````````````````````````````````0```````$```````0`` +M```````````````````````````````!`````0`````````````````"`8@3 +M`P&($Q`!`````````````````````````````````````-#^```````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````"<8X`````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````#OOJW>[[ZMWN^^K=[OOJW>```` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````(!`P""@8. +M`0D%#0,+!P\````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````!L>@``!0```@0```#41X`````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````````"````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````!F0````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````*<``-1'@`"`(:``M""@`&P@H```,``` +M`'``````````````^$>``/A'@`"`(:``I""@`#@@H``!````!P`````````` +M````'$B``!Q(@`"`(:``J""@`#P@H``0````.```````````````0$B``$!( +M@`"`(:``K""@`'@AH`!``0``P`$`````````````9$B``&1(@`"`(:``L""@ +M`'PAH```#`````X`````````````_P```/\````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````/__``#__P`````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````!P`,``P`"``%``,``:``0`"``B````````````+`"``(``+ +M``L`"P`&@`$``@`(@``````````#`````@```````````````@$``(`````` +M```````````````````````````````````````````````````````````` +M````````````````````````````````````````_P`````````````````` +M`````````````````````````````````*"G```)````!````-1'@``\.#0P +M+"@D(!P8%!`,"`0```L'`P`[-S,O*R@$````"`@`"`@(``````````@(````"`@("`@(" +M```"`P,"``#Q\0(`!`0$!`0$````````````""Z-C3,^C8V-C8U]C6-KDUV& +M=46-C8V-C3Y5/AJ-@X.3`.H`>@`^`-0! +M]`!Z`#@`'@`0`'(`.@`>``(#!`4``.`B!`"E11@`RO0G`,KT)P`Z`0(!U0#? +M`#H!H@!U`'\`R@%*`>(`^0#*`>H`@@"9``$##P=\?'Q\9V=G9Q45&AH0$!`0 +M"A0W;FH!&@'9`.@`:@&Z`'D`B`!TT447Z**++A`8H``,&*``"!`0`A`(```0 +M&:``#!F@`!`80`80(```$"`@#8`````P``@`#0T-#0X.#@X.#P\/#P\0$!`0 +M$1$1$1(2$A(3$Q,3%!04%145%186%A<7%Q@8&!D9&AH:&QL;'!P='1T>'A\? +M("`A(2(B(R,D)"4E)B8G)R@H*2HJ*RLL+2TN+R\P,3(R,S0T-38W.#@Y.CL\ +M/3T^/T!!0D-$149'2$E*2TQ-3E!14E-45E=865M<75]@86-D9F=I:FQM;W!R +M='5W>7M\?H""A(:(BHR.D)*4EIB:G9^AHZ:HJZVPLK6WNKW`PL7(R\[1U-?: +MW>#DY^KN\?7X_/\````&``T`0`!J`(``D`"A`/\`F"6@`*@EH`"@):``Q"6@ +M`-0EH`#<):``Y"6@`.PEH`!$!=F&1`79AH(#YEE$!=F&@@/F6?/#(F6"`^99 +MPISH4((#YEG"G.A0@@/F6<*0`,`'D`)@`Y`"8`.0`F`#< +M`MP";@'<`FX!Z`%N`?0`;@'T`&X!]`"R!;(%V0*R!=D"S`/9`N8!V0+F`=D" +MY@%$`40!Y@%$`>8!L`'F`1P"Y@$<`N8!'`*(`H@"S`.(`LP#8`/,`S@$S`,X +M!,P#.`3,`\P#L@7,`[(%$`6R!50&L@54!K(%5`8&!A(&$@P2'A(>$AX``0(! +M`P8````$"`00$```*``H`#``+``L`"@`/``T`"P`+``\`#0`,``L`%0`1`!_ +M_P0GMH+Z$]FA\6*;27T!XXCN,X',=Q'+V$]A*.XS@.',=Q +M'([C.`Y>0GL)QW$8!'`*(`M`"*@.$`W4`Z@!?`=0!O@*H +M`QT$D@1\!1@&VP:>!^H`U`&^`J@#?`50!SH()`GX"C`,M@T\#PD)!04)"0T- +M!08!`@,$``"2C8R*BHJ)B(B(DHJ(AX>&AH:&AHZ)B(>&AH:%A862CHV,C(R, +MC(R,#0\%!PD+`0,H`"@`-``P`"P`+`!$`#P`5555`4MH+P%5554%XSB.`ZJJ +MJ@)Q',5)%08`,"JU(^W7%>EQ/U +MIFBY```LP6!`'^/(>>VVOM1&C=EG2W+>E-28Z+!*A6N[*L7E3Q;MQ8;7FE5F +ME!'/BA#I!@2!_O"@1'BZ)>-+\Z+^7<"`B@6M/[PA2'`$\=]CP7=UKV-","`: +MY0[];;],@108-28OP^&^HC7,B#DN5Y/R58+\1WJLR.>Z*S*5YJ#`F!G1GG^C +M9D1^5*L[@PO*C"G'TVL\*'FGXKP=%G:M.]M69$YT'A3;D@H,;$CDN%V?;KWO +M0Z;$J#FD,3?3B_(RU4.+66ZWVHP!9+'2G.!)M-CZK`?S)<^ORH[TZ4<8$-5O +MB/!O2G)<)#CQ5\=S49%!ZI8\#^%F`"1<:VF4QU\:$N-##@K`I=UH1'LM[_*C6;3HL``$"!`0&!@@( +M`````0```0("`P/_!/______`P0,#`@4%`0$0````(```````0````(````$ +M````0```0````$`````T`U`#>P.Z`Q4$FP3T!/X#'P1(!(,$VP1B!;L%N@;L +M!C@'L0=X")L)6@JA!]\'+@BF"&8)B@I+"ZL"4P.E!48&``$"`P$!`?______ +M__\```$```$"`@,#``````,.$P`7````"0`1&VIJ90#`RLK*RLK*R@,`!LH# +MRLK*R@G*`\K*$0,``@`"`@("```````@&V5`91(290!E$CLE.V5E2D4[3U17 +M.Q```````)`#<`3P!7````&!P<'!`<'!P('!P<'!P<'``<'!P$'!P< +M#!P<'!0````,#P\)``\#!@\%*P`9'R4```0'"@`3'!P0``````5`$``,D!R0') +M`&J``)!J@`"074<`!`T'`P$""`@("`@(9/=&`)CW1@#(]T8`7/=&`%3W1@"X +M]D8``P,`!`(#````"``(``@`!0````````````@!!`(#`@,````(``````$% +M````````````"`(&```"!@```@8`"``(`@8`"`(#`P,````&`P8#!@,&```# +M!@$(``@#!@`(`@,#`P`$``8`````#P`_``$````/`#\``0````\`/P`!```` +M#P`_``$````/`#\``0````(````"````!@````8````%````!0````0````$ +M`````P````,````!````````````````````T!0#`-`4`P`LUT<`9-='`+37 +M1P#0%`,`T!0#`/P4`P``%0,`U!0#`-`4`P#0%`,`T!0#`-`4`P#0%`,`T!0# +M`-`4`P#0%`,`T!0#`!````#0%`,`T!0#`-`4`P#0%`,`T!0#`-`4`P#0%`,` +MT!0#`-`4`P#0%`,`T!0#``#G$.<@YS#G0.=0YV#G<.<`[Q#O(.\P[T#O4.]@ +M[W#O`.(`XP#D`.4`Z@#K`.P`[=`4`P#0%`,`X.Y'`-`4`P#0%`,`Y.Y'`-`4 +M`P#\%`,``!4#`-04`P#0%`,`T!0#`-`4`P#0%`,`T!0#`-`4`P#0%`,`T!0# +M`-`4`P`0````T!0#`-`4`P#0%`,`T!0#`-`4`P#0%`,`T!0#`-`4`P#0%`,` +MT!0#`-`4`P````$``@`````$"``0````(#!`4&!P@``@(B`B0$1`1&!F8&:` +MB("(``````$!`0`"`0``G/\8_```9`!B````;P!C`+`$<`!M`-`'<0!O`*`/ +M<@!Q`$`?GM\?'U]?7Y^?GY_?W]_?W]_?X#_0555 +M554!`````@("(````("(B(B(```1````O%("``,```#@=`(``0```)A.`P`` +M````,+("`!@```!P@@(`#````(1]`@`<````C%P"``0```!\D@(`$P````Q8 +M`@`;````J%,"`!$```#\4@(`&````(R$`@`9````D*$"`!H```!TJP(`!P`` +M`%R)`@`#````%'@"``P```"`@`(`!````$23`@"'R`A(B,D)69G:&EJ:VQ`@````0````&```` +M`P````L````3````&P```",````K````,P```#H```!"`````0`````````$ +M````!0```````````````````````````/\```#^`0```O\```/_``$`_P$` +M`0(!`@+_`@#_`P(`_@0"``/_````````````````8"%'``H````$````U$>` +M`````````````````'0A1P`*````!````-1'@``````````````````````` +M```````````````````````````#```````````````>````'H@>B%H```!6 +M````5HA6B`(!``"J````JHBJB/X!``","@``5(Q4C*0?```````````````` +M``"\[@$`!0````0```#41X````````````#$20(``````````````````!`` +M`/8/``#8#P``I@\``&$/```)#P``G0X``"`.``"1#0``\0P``$$,``"""P`` +MM`H``-D)``#R"`````@```,'``#^!0``\00``-X#``#'`@``K`$``(X````` +M`````````````````0````$```````````````$````!`````0`````````` +M`````0``6-N``"8``7""@``!``*X^`(``0`$&&A(``$`!-Q\@``!``+0^0(` +M`0`$H"\#``$`!*SX`@````1H+(```0`"A/@"````!,3X`@`!``0T^@(``P`$ +M```````````````````````#D\0(`!0`` +M`@0```#41X``````````````````W/("``4```($````U$>````````````` +M``````$``````````@```````````````````````````````````&=%(P$% +M`````@("`@("`@("`O\"`@("`@("`@("`@("`@("`@("`@("`0("`@("`@(" +M`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`0(" +M`@("`@+_`0("`@("`@("`O\"`@("`O\"`@("`@+_`@("_____P0\``````@\ +M`````!@\`````!P\`````"`\`````"0\`````"@\`````"P\`````#`\```` +M`#0\`````#@\`````#P\`````$`\`````$0\`````$@\`````$P\`````%`\ +M`````%0\`````%@\`````%P\`````&`\`````&0\`````&@\`````'P\```` +M`'@\```````````````````````````````````````````````````````` +M```````````!`````````````````````````````````````R@```&`"@`U +M```@`````/"]>0`"````````````````````````````H`#__Q\````````` +M```````````````````````````````````````````````````````````` +M`````````0$!+Y]RB(`$!0``#@@8`C\````````#*````8`*`#4``"`````` +M_____P(```````````````````````````"@`/__'P`````````````````` +M```````````````````````````````````````````````````````````! +M`0$OGW*)@`4%```_#C\(/P````````,H```!@`H`-0``(`````#PO7D``@`` +M`````````````````````````*``__\?```````````````````````````` +M``````````````````````````````````````````````````$!`0`````` +M````"P,($@(_`````````R@``/__________```````````````````````` +M````````````````H`#__Q\`%"R@`/\#```\!*``_P,``#P,H`#_`P``$`"@ +M``\````$"*``_P,``!!%H`#_`P``!"2@`/\#````_@$!+Y]RB````0`"`P`. +M"#\````````#*```__________\````````````````````````````````` +M``````"@`/__'P`````````````````````````````````````````````` +M```````````````````````````````!`0$OGW*(```!``(`"`,2#@`````` +M``,H```!@`H`-0``(`````#PO7D``@```````````````````````````*`` +M__\?```````````````````````````````````````````````````````` +M``````````````````````$!`2^?0`"```````` +M````````````````````H`#__Q\````````````````````````````````` +M`````````````````````````````````````````````0$!O_]_$___!P`` +M/PX_"`P````````````````````````````````````````````````````` +M``!LRP$`!0````0```#41X``````````````````"0`````````````````` +M```````````````````````````````````````````````````````````` +M``````````#_```````````````````````````````````````````````` +M`````````````````````````"3@@-(5T@S2%=$3T1+1$-(1TA31@](0T1'1 +M"1$1$0[2`.`!T!+2$])0T`1#`40/T`""(($IX`;0```````````````````` +M`````````````````/3-`0`%````!````-1'@`#DS0$`[,T!`'3.`0#HS0$` +M\,T!```````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````*"92``%````!````-1'@`````````````````!$R0$`"@`` +M`@0```#41X`````````````4````U'Z``+`,@0`8```````````````!```` +M```````````````````````````!```````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````,#P\`!`$/#0\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/ +M#PX/"0\/!0H/"P\/#P\"#P\/#P\/#P\/#P\/#P\&`P\/#P\/#P\/#P\/#P\/ +M"`\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/ +M#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/ +M#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/#P\/ +M#P\/#P\/#P\/#P`,`3!`#`!S<``!,$`,`:+)(`$P0 +M`P`\H```5'$!`$P0`P!,$`,`'-P```QV`0`,=@$`#'8!``QV`0`,=@$`#'8! +M``QV`0!,$`,`3!`#`$P0`P!,$`,`8#X"`$P0`P!,$`,`'+P``$P0`P!,$`,` +M!+P``.2[``!,$`,`3!`#```````````````````````````````````````! +M`````0````$````!`````0````$````!`````0````$````!`````0`````` +M`````````````````````````0````````#AOJW>````````````````"+-' +M``8````$````U$>``````````````````"BQ1P`%```"!````-1'@`#_``$# +M!`4&!P@"```````````````````LOD<`!0```@0```#41X`````````````` +M````````````````````````````````````````````````````&$8````` +M($8`````)$8`````@$8`````A$8`````B$8`````C$8`````D$8`````E$8` +M````F$8`````G$8`````H$8`````I$8`````P$8`````Q$8`````R$8````` +MS$8`````T$8`````U$8`````V$8`````W$8`````X$8`````Y$8`````Z$8` +M````[$8`````\$8`````]$8`````^$8`````_$8`````%$8``````$<````` +M!$<`````"$<`````#$<`````0$<`````1$<`````?$<`````@$<`````A$<` +M````B$<`````D$<`````E$<`````F$<`````H$<`````I$<`````J$<````` +M!$8`````"$8`````#$8`````$$8``````$8`````9$<`````:$<`````;$<` +M````<$<`````=$<`````4$<`````5$<`````6$<`````7$<`````8$<````` +M/0"H'0````#`'0````#$'0````#('0````#,'0````#0'0````#4'0````#8 +M'0````#<'0````#@'0````#D'0````#H'0````#P'0````#T'0````!D'P`` +M``!$'P````"`'P````"$'P````"('P````",'P````"0'P````"4'P````"8 +M'P````"<'P````"@'P````"D'P````"H'P````"L'P````"P'P````#L'P`` +M``!T'@````!$'P````#P'P````#T'P````#\'P`````C```````````````` +M`````````````````.`<`````.0<`````.@<`````/0<`````!@=``````P= +M`````#`=`````)P=`````*`=`````#`>`````#0>`````#@>`````#P>```` +M`$P>`````%`>`````%0>`````%@>`````%P>`````&0>`````'@>`````'P> +M`````(P>`````)`>`````)0>`````)@>`````)P>`````*`>`````,`>```` +M`,0>`````-`>`````-0>``````0?`````-P>`````.`>`````'0?`````'@? +M`````'P?`````/@?`````"8`````````````````````````$````!\````` +M```````````````````````````````````````````````````````````` +M````````````````````````$``````````````````````````````````` +M```````0```````````````4```````````````E````Y?____G___\O```` +MW?____C___\```````````$````````````````````````````````````` +M`````````````````````````````````````````/\````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````/SP```````````````````,`````````_P`````````````` +M````````````````````````````````__\````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````(```````` +M`````````````````````````````````````````````````/__________ +M````````````````H.@!``H````$````U$>`````````````_.H!`!3L`0!, +MZP$`5.H!`$3L`0#8ZP$`J.H!``3J`0```0````$$`0$!``(!`0$#`0`"!P$! +M!`0!`04%`0(#_P(!`08"``('B!,````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````````````````````````````````````````````0(# +M!`7_________________________!@#_____```````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````````````````````@``````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````````````/____\````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````"````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````_____P`````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````````````````(`````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````#_____```````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````@``````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````/____\````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````"````````````````````````````````````````` +M```````````````````````````````````````````````````````````` *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Oct 30 19:53:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DDC015F91F; Wed, 30 Oct 2019 19:53:38 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473Jzk0QB5z4V9q; Wed, 30 Oct 2019 19:53:38 +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 E5B08F66A; Wed, 30 Oct 2019 19:53:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9UJrbH4054427; Wed, 30 Oct 2019 19:53:37 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UJrbh2054426; Wed, 30 Oct 2019 19:53:37 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201910301953.x9UJrbh2054426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 30 Oct 2019 19:53:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354203 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 354203 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 19:53:38 -0000 Author: imp Date: Wed Oct 30 19:53:37 2019 New Revision: 354203 URL: https://svnweb.freebsd.org/changeset/base/354203 Log: Remove duplicate lines. Modified: head/sys/conf/files.x86 Modified: head/sys/conf/files.x86 ============================================================================== --- head/sys/conf/files.x86 Wed Oct 30 19:37:33 2019 (r354202) +++ head/sys/conf/files.x86 Wed Oct 30 19:53:37 2019 (r354203) @@ -12,11 +12,6 @@ # limitations in config: backslash-newline doesn't work in strings, and # dependency lines other than the first are silently ignored. -# -cddl/dev/fbt/x86/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}" -cddl/dev/dtrace/x86/dis_tables.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}" -cddl/dev/dtrace/x86/instr_size.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}" -# cddl/dev/fbt/x86/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}" cddl/dev/dtrace/x86/dis_tables.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}" cddl/dev/dtrace/x86/instr_size.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}" From owner-svn-src-head@freebsd.org Wed Oct 30 19:53:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B6E815F96D; Wed, 30 Oct 2019 19:53:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473Jzv6Z7nz4VJ4; Wed, 30 Oct 2019 19:53:47 +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 C5EFAF66B; Wed, 30 Oct 2019 19:53:47 +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 x9UJrlp2054485; Wed, 30 Oct 2019 19:53:47 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UJrlXU054481; Wed, 30 Oct 2019 19:53:47 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201910301953.x9UJrlXU054481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 30 Oct 2019 19:53:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354204 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 354204 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 19:53:48 -0000 Author: imp Date: Wed Oct 30 19:53:46 2019 New Revision: 354204 URL: https://svnweb.freebsd.org/changeset/base/354204 Log: Move all the sys/dev/[a-j]* that are common to files.x86 All these device entries are common between the two files. Move them to files.x86. Also sort entries from this range into proper order in files.amd64. Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/conf/files.x86 Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Wed Oct 30 19:53:37 2019 (r354203) +++ head/sys/conf/files.amd64 Wed Oct 30 19:53:46 2019 (r354204) @@ -152,33 +152,8 @@ dev/agp/agp_amd64.c optional agp dev/agp/agp_i810.c optional agp dev/agp/agp_via.c optional agp dev/amdgpio/amdgpio.c optional amdgpio -dev/amdsbwd/amdsbwd.c optional amdsbwd -dev/amdsmn/amdsmn.c optional amdsmn | amdtemp -dev/amdtemp/amdtemp.c optional amdtemp -dev/arcmsr/arcmsr.c optional arcmsr pci -dev/asmc/asmc.c optional asmc isa -dev/atkbdc/atkbd.c optional atkbd atkbdc -dev/atkbdc/atkbd_atkbdc.c optional atkbd atkbdc -dev/atkbdc/atkbdc.c optional atkbdc -dev/atkbdc/atkbdc_isa.c optional atkbdc isa -dev/atkbdc/atkbdc_subr.c optional atkbdc -dev/atkbdc/psm.c optional psm atkbdc -dev/coretemp/coretemp.c optional coretemp -dev/cpuctl/cpuctl.c optional cpuctl -dev/dpms/dpms.c optional dpms -dev/fb/fb.c optional fb | vga -dev/fb/s3_pci.c optional s3pci -dev/fb/vesa.c optional vga vesa -dev/fb/vga.c optional vga -dev/ichwd/ichwd.c optional ichwd -dev/if_ndis/if_ndis.c optional ndis -dev/if_ndis/if_ndis_pccard.c optional ndis pccard -dev/if_ndis/if_ndis_pci.c optional ndis cardbus | ndis pci -dev/if_ndis/if_ndis_usb.c optional ndis usb -dev/imcsmb/imcsmb.c optional imcsmb -dev/imcsmb/imcsmb_pci.c optional imcsmb pci -dev/intel/spi.c optional intelspi -dev/io/iodev.c optional io +dev/hyperv/vmbus/amd64/hyperv_machdep.c optional hyperv +dev/hyperv/vmbus/amd64/vmbus_vector.S optional hyperv dev/ioat/ioat.c optional ioat pci dev/ioat/ioat_test.c optional ioat pci dev/ixl/if_ixl.c optional ixl pci \ @@ -211,10 +186,6 @@ dev/ixl/i40e_adminq.c optional ixl pci | iavf pci \ compile-with "${NORMAL_C} -I$S/dev/ixl" dev/ixl/i40e_dcb.c optional ixl pci \ compile-with "${NORMAL_C} -I$S/dev/ixl" -dev/gpio/bytgpio.c optional bytgpio -dev/gpio/chvgpio.c optional chvgpio -dev/hyperv/vmbus/amd64/hyperv_machdep.c optional hyperv -dev/hyperv/vmbus/amd64/vmbus_vector.S optional hyperv dev/nctgpio/nctgpio.c optional nctgpio dev/nfe/if_nfe.c optional nfe pci dev/ntb/if_ntb/if_ntb.c optional if_ntb @@ -225,8 +196,6 @@ dev/ntb/ntb_hw/ntb_hw_amd.c optional ntb_hw_amd | ntb_ dev/ntb/ntb_hw/ntb_hw_intel.c optional ntb_hw_intel | ntb_hw dev/ntb/ntb_hw/ntb_hw_plx.c optional ntb_hw_plx | ntb_hw dev/ntb/test/ntb_tool.c optional ntb_tool -dev/vmd/vmd.c optional vmd -dev/vmd/vmd_bus.c optional vmd_bus dev/nvram/nvram.c optional nvram isa dev/random/ivy.c optional rdrand_rng !random_loadable dev/random/nehemiah.c optional padlock_rng !random_loadable @@ -376,6 +345,8 @@ dev/vmware/vmci/vmci_kernel_if.c optional vmci dev/vmware/vmci/vmci_qpair.c optional vmci dev/vmware/vmci/vmci_queue_pair.c optional vmci dev/vmware/vmci/vmci_resource.c optional vmci +dev/vmd/vmd.c optional vmd +dev/vmd/vmd_bus.c optional vmd_bus dev/wbwd/wbwd.c optional wbwd dev/xen/pci/xen_acpi_pci.c optional xenhvm dev/xen/pci/xen_pci.c optional xenhvm Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Wed Oct 30 19:53:37 2019 (r354203) +++ head/sys/conf/files.i386 Wed Oct 30 19:53:46 2019 (r354204) @@ -100,52 +100,23 @@ dev/agp/agp_intel.c optional agp dev/agp/agp_nvidia.c optional agp dev/agp/agp_sis.c optional agp dev/agp/agp_via.c optional agp -dev/amdsbwd/amdsbwd.c optional amdsbwd -dev/amdsmn/amdsmn.c optional amdsmn | amdtemp -dev/amdtemp/amdtemp.c optional amdtemp -dev/arcmsr/arcmsr.c optional arcmsr pci -dev/asmc/asmc.c optional asmc isa -dev/atkbdc/atkbd.c optional atkbd atkbdc -dev/atkbdc/atkbd_atkbdc.c optional atkbd atkbdc -dev/atkbdc/atkbdc.c optional atkbdc -dev/atkbdc/atkbdc_isa.c optional atkbdc isa -dev/atkbdc/atkbdc_subr.c optional atkbdc -dev/atkbdc/psm.c optional psm atkbdc dev/ce/ceddk.c optional ce dev/ce/if_ce.c optional ce dev/ce/tau32-ddk.c optional ce \ compile-with "${NORMAL_C} ${NO_WCONSTANT_CONVERSION}" -dev/coretemp/coretemp.c optional coretemp dev/cp/cpddk.c optional cp dev/cp/if_cp.c optional cp -dev/cpuctl/cpuctl.c optional cpuctl dev/ctau/ctau.c optional ctau dev/ctau/ctddk.c optional ctau dev/ctau/if_ct.c optional ctau dev/cx/csigma.c optional cx dev/cx/cxddk.c optional cx dev/cx/if_cx.c optional cx -dev/dpms/dpms.c optional dpms -dev/fb/fb.c optional fb | vga -dev/fb/s3_pci.c optional s3pci -dev/fb/vesa.c optional vga vesa -dev/fb/vga.c optional vga dev/glxiic/glxiic.c optional glxiic dev/glxsb/glxsb.c optional glxsb dev/glxsb/glxsb_hash.c optional glxsb -dev/gpio/bytgpio.c optional bytgpio -dev/gpio/chvgpio.c optional chvgpio dev/hyperv/vmbus/i386/hyperv_machdep.c optional hyperv dev/hyperv/vmbus/i386/vmbus_vector.S optional hyperv -dev/ichwd/ichwd.c optional ichwd -dev/if_ndis/if_ndis.c optional ndis -dev/if_ndis/if_ndis_pccard.c optional ndis pccard -dev/if_ndis/if_ndis_pci.c optional ndis cardbus | ndis pci -dev/if_ndis/if_ndis_usb.c optional ndis usb -dev/imcsmb/imcsmb.c optional imcsmb -dev/imcsmb/imcsmb_pci.c optional imcsmb pci -dev/intel/spi.c optional intelspi -dev/io/iodev.c optional io dev/le/if_le_isa.c optional le isa dev/nctgpio/nctgpio.c optional nctgpio dev/nfe/if_nfe.c optional nfe pci Modified: head/sys/conf/files.x86 ============================================================================== --- head/sys/conf/files.x86 Wed Oct 30 19:53:37 2019 (r354203) +++ head/sys/conf/files.x86 Wed Oct 30 19:53:46 2019 (r354204) @@ -60,6 +60,17 @@ dev/acpica/acpi_pcib_acpi.c optional acpi pci dev/acpica/acpi_pcib_pci.c optional acpi pci dev/acpica/acpi_pxm.c optional acpi dev/acpica/acpi_timer.c optional acpi +dev/amdsbwd/amdsbwd.c optional amdsbwd +dev/amdsmn/amdsmn.c optional amdsmn | amdtemp +dev/amdtemp/amdtemp.c optional amdtemp +dev/arcmsr/arcmsr.c optional arcmsr pci +dev/asmc/asmc.c optional asmc isa +dev/atkbdc/atkbd.c optional atkbd atkbdc +dev/atkbdc/atkbd_atkbdc.c optional atkbd atkbdc +dev/atkbdc/atkbdc.c optional atkbdc +dev/atkbdc/atkbdc_isa.c optional atkbdc isa +dev/atkbdc/atkbdc_subr.c optional atkbdc +dev/atkbdc/psm.c optional psm atkbdc dev/bxe/bxe.c optional bxe pci dev/bxe/bxe_stats.c optional bxe pci dev/bxe/bxe_debug.c optional bxe pci @@ -68,10 +79,19 @@ dev/bxe/bxe_elink.c optional bxe pci dev/bxe/57710_init_values.c optional bxe pci dev/bxe/57711_init_values.c optional bxe pci dev/bxe/57712_init_values.c optional bxe pci +dev/coretemp/coretemp.c optional coretemp +dev/cpuctl/cpuctl.c optional cpuctl +dev/dpms/dpms.c optional dpms +dev/fb/fb.c optional fb | vga +dev/fb/s3_pci.c optional s3pci +dev/fb/vesa.c optional vga vesa +dev/fb/vga.c optional vga dev/fdc/fdc.c optional fdc dev/fdc/fdc_acpi.c optional fdc dev/fdc/fdc_isa.c optional fdc isa dev/fdc/fdc_pccard.c optional fdc pccard +dev/gpio/bytgpio.c optional bytgpio +dev/gpio/chvgpio.c optional chvgpio dev/hpt27xx/hpt27xx_os_bsd.c optional hpt27xx dev/hpt27xx/hpt27xx_osm_bsd.c optional hpt27xx dev/hpt27xx/hpt27xx_config.c optional hpt27xx @@ -130,6 +150,15 @@ dev/hyperv/vmbus/vmbus_et.c optional hyperv dev/hyperv/vmbus/vmbus_if.m optional hyperv dev/hyperv/vmbus/vmbus_res.c optional hyperv dev/hyperv/vmbus/vmbus_xact.c optional hyperv +dev/ichwd/ichwd.c optional ichwd +dev/if_ndis/if_ndis.c optional ndis +dev/if_ndis/if_ndis_pccard.c optional ndis pccard +dev/if_ndis/if_ndis_pci.c optional ndis cardbus | ndis pci +dev/if_ndis/if_ndis_usb.c optional ndis usb +dev/imcsmb/imcsmb.c optional imcsmb +dev/imcsmb/imcsmb_pci.c optional imcsmb pci +dev/intel/spi.c optional intelspi +dev/io/iodev.c optional io dev/ipmi/ipmi.c optional ipmi dev/ipmi/ipmi_acpi.c optional ipmi acpi dev/ipmi/ipmi_isa.c optional ipmi isa From owner-svn-src-head@freebsd.org Wed Oct 30 20:08:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4953B15FCF5; Wed, 30 Oct 2019 20:08:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473KJW0wy4z4Wfq; Wed, 30 Oct 2019 20:08:11 +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 04ADFF851; Wed, 30 Oct 2019 20:08:11 +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 x9UK8AuK060758; Wed, 30 Oct 2019 20:08:10 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UK8AKf060757; Wed, 30 Oct 2019 20:08:10 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201910302008.x9UK8AKf060757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 30 Oct 2019 20:08:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354205 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 354205 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 20:08:11 -0000 Author: imp Date: Wed Oct 30 20:08:10 2019 New Revision: 354205 URL: https://svnweb.freebsd.org/changeset/base/354205 Log: Remove redundant hw sysctl declaration. gcc CI complains, but clang doesn't. Modified: head/sys/dev/ow/ow.c Modified: head/sys/dev/ow/ow.c ============================================================================== --- head/sys/dev/ow/ow.c Wed Oct 30 19:53:46 2019 (r354204) +++ head/sys/dev/ow/ow.c Wed Oct 30 20:08:10 2019 (r354205) @@ -161,7 +161,6 @@ static struct ow_timing timing_overdrive = { .t_lowr = 1, /* 1 <= t < 2 */ }; -SYSCTL_DECL(_hw); SYSCTL_NODE(_hw, OID_AUTO, ow, CTLFLAG_RD, 0, "1-Wire protocol"); SYSCTL_NODE(_hw_ow, OID_AUTO, regular, CTLFLAG_RD, 0, "Regular mode timings"); From owner-svn-src-head@freebsd.org Wed Oct 30 20:43:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B6317160C21; Wed, 30 Oct 2019 20:43:27 +0000 (UTC) (envelope-from kibab@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473L5C4Qwkz4Yw3; Wed, 30 Oct 2019 20:43:27 +0000 (UTC) (envelope-from kibab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B928FF62; Wed, 30 Oct 2019 20:43:27 +0000 (UTC) (envelope-from kibab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9UKhR7a083958; Wed, 30 Oct 2019 20:43:27 GMT (envelope-from kibab@FreeBSD.org) Received: (from kibab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UKhRth083957; Wed, 30 Oct 2019 20:43:27 GMT (envelope-from kibab@FreeBSD.org) Message-Id: <201910302043.x9UKhRth083957@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kibab set sender to kibab@FreeBSD.org using -f From: Ilya Bakulin Date: Wed, 30 Oct 2019 20:43:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354206 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: kibab X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 354206 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 20:43:27 -0000 Author: kibab Date: Wed Oct 30 20:43:27 2019 New Revision: 354206 URL: https://svnweb.freebsd.org/changeset/base/354206 Log: Use the new cam_sim_alloc_dev function to properly initialize SIM Using cam_sim_alloc_dev() allows to properly set sim_dev field so that sdiob(4) can attach to the CAM device that represents SDIO card. The same change for SDHCI driver happened in r348800. Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D22192 Modified: head/sys/arm/allwinner/aw_mmc.c Modified: head/sys/arm/allwinner/aw_mmc.c ============================================================================== --- head/sys/arm/allwinner/aw_mmc.c Wed Oct 30 20:08:10 2019 (r354205) +++ head/sys/arm/allwinner/aw_mmc.c Wed Oct 30 20:43:27 2019 (r354206) @@ -526,8 +526,8 @@ aw_mmc_attach(device_t dev) } mtx_init(&sc->sim_mtx, "awmmcsim", NULL, MTX_DEF); - sc->sim = cam_sim_alloc(aw_mmc_cam_action, aw_mmc_cam_poll, - "aw_mmc_sim", sc, device_get_unit(dev), + sc->sim = cam_sim_alloc_dev(aw_mmc_cam_action, aw_mmc_cam_poll, + "aw_mmc_sim", sc, dev, &sc->sim_mtx, 1, 1, sc->devq); if (sc->sim == NULL) { @@ -1514,6 +1514,7 @@ static device_method_t aw_mmc_methods[] = { /* Bus interface */ DEVMETHOD(bus_read_ivar, aw_mmc_read_ivar), DEVMETHOD(bus_write_ivar, aw_mmc_write_ivar), + DEVMETHOD(bus_add_child, bus_generic_add_child), /* MMC bridge interface */ DEVMETHOD(mmcbr_update_ios, aw_mmc_update_ios), From owner-svn-src-head@freebsd.org Wed Oct 30 20:45:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 10F31160CEE; Wed, 30 Oct 2019 20:45:13 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473L7D6j2Jz4Z4w; Wed, 30 Oct 2019 20:45:12 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C930EFF6A; Wed, 30 Oct 2019 20:45:12 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9UKjCOW084113; Wed, 30 Oct 2019 20:45:12 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9UKjCOi084112; Wed, 30 Oct 2019 20:45:12 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201910302045.x9UKjCOi084112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Wed, 30 Oct 2019 20:45:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354207 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 354207 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2019 20:45:13 -0000 Author: erj Date: Wed Oct 30 20:45:12 2019 New Revision: 354207 URL: https://svnweb.freebsd.org/changeset/base/354207 Log: iflib: cleanup memory leaks on driver detach From Jake: The iflib stack failed to release all of the memory allocated under M_IFLIB during device detach. Specifically, the ifmp_ring, the ift_ifdi Tx DMA info, and the ifr_ifdi Rx DMA info were not being released. Release this memory so that iflib won't leak memory when a device detaches. Since we're freeing the ift_ifdi pointer during iflib_txq_destroy we need to call this only after iflib_dma_free in iflib_tx_structures_free. Additionally, also ensure that we destroy the callout mutex associated with each Tx queue when we free it. Signed-off-by: Jacob Keller Submitted by: Jacob Keller Reviewed by: erj@, gallatin@ MFC after: 1 week Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D22157 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Wed Oct 30 20:43:27 2019 (r354206) +++ head/sys/net/iflib.c Wed Oct 30 20:45:12 2019 (r354207) @@ -1725,6 +1725,14 @@ iflib_txq_destroy(iflib_txq_t txq) for (int i = 0; i < txq->ift_size; i++) iflib_txsd_destroy(ctx, txq, i); + + if (txq->ift_br != NULL) { + ifmp_ring_free(txq->ift_br); + txq->ift_br = NULL; + } + + mtx_destroy(&txq->ift_mtx); + if (txq->ift_sds.ifsd_map != NULL) { free(txq->ift_sds.ifsd_map, M_IFLIB); txq->ift_sds.ifsd_map = NULL; @@ -1745,6 +1753,9 @@ iflib_txq_destroy(iflib_txq_t txq) bus_dma_tag_destroy(txq->ift_tso_buf_tag); txq->ift_tso_buf_tag = NULL; } + if (txq->ift_ifdi != NULL) { + free(txq->ift_ifdi, M_IFLIB); + } } static void @@ -2225,6 +2236,8 @@ iflib_rx_sds_free(iflib_rxq_t rxq) } free(rxq->ifr_fl, M_IFLIB); rxq->ifr_fl = NULL; + free(rxq->ifr_ifdi, M_IFLIB); + rxq->ifr_ifdi = NULL; rxq->ifr_cq_cidx = 0; } } @@ -5658,9 +5671,9 @@ iflib_tx_structures_free(if_ctx_t ctx) int i, j; for (i = 0; i < NTXQSETS(ctx); i++, txq++) { - iflib_txq_destroy(txq); for (j = 0; j < sctx->isc_ntxqs; j++) iflib_dma_free(&txq->ift_ifdi[j]); + iflib_txq_destroy(txq); } free(ctx->ifc_txqs, M_IFLIB); ctx->ifc_txqs = NULL; From owner-svn-src-head@freebsd.org Thu Oct 31 00:35:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B8EA16710B; Thu, 31 Oct 2019 00:35:27 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473RDt6XpJz4nKm; Thu, 31 Oct 2019 00:35:26 +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 C48FE1A8E2; Thu, 31 Oct 2019 00:35:26 +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 x9V0ZQIr020185; Thu, 31 Oct 2019 00:35:26 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9V0ZQKe020184; Thu, 31 Oct 2019 00:35:26 GMT (envelope-from np@FreeBSD.org) Message-Id: <201910310035.x9V0ZQKe020184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 31 Oct 2019 00:35:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354210 - head/sys/dev/cxgbe/common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/common X-SVN-Commit-Revision: 354210 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 00:35:27 -0000 Author: np Date: Thu Oct 31 00:35:26 2019 New Revision: 354210 URL: https://svnweb.freebsd.org/changeset/base/354210 Log: cxgbe(4): Use correct size while converting lpacaps32 to native endianness. Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Wed Oct 30 21:49:34 2019 (r354209) +++ head/sys/dev/cxgbe/common/t4_hw.c Thu Oct 31 00:35:26 2019 (r354210) @@ -8548,7 +8548,7 @@ static void handle_port_info(struct port_info *pi, con lc->supported = be32_to_cpu(p->u.info32.pcaps32); lc->advertising = be32_to_cpu(p->u.info32.acaps32); - lc->lp_advertising = be16_to_cpu(p->u.info32.lpacaps32); + lc->lp_advertising = be32_to_cpu(p->u.info32.lpacaps32); lc->link_ok = (stat & F_FW_PORT_CMD_LSTATUS32) != 0; lc->link_down_rc = G_FW_PORT_CMD_LINKDNRC32(stat); From owner-svn-src-head@freebsd.org Thu Oct 31 11:31:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0094D1A4E6C; Thu, 31 Oct 2019 11:31:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473jnY6G9pz48wZ; Thu, 31 Oct 2019 11:31:13 +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 BA43A22048; Thu, 31 Oct 2019 11:31:13 +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 x9VBVD2k005044; Thu, 31 Oct 2019 11:31:13 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9VBVDBS005043; Thu, 31 Oct 2019 11:31:13 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910311131.x9VBVDBS005043@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 31 Oct 2019 11:31:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354212 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 354212 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 11:31:14 -0000 Author: avg Date: Thu Oct 31 11:31:13 2019 New Revision: 354212 URL: https://svnweb.freebsd.org/changeset/base/354212 Log: iicbb: allow longer SCL low timeout and other improvements First, SCL low timeout is set to 25 milliseconds by default as opposed to 1 millisecond before. The new value is based on the SMBus specification. The timeout can be changed on a per bus basis using dev.iicbb.N.scl_low_timeout sysctl. The driver uses DELAY to wait for high SCL up to 1 millisecond, then it switches to pause_sbt(SBT_1MS) for the rest of the timeout. While here I made a number of other changes. 'udelay' that's used for timing clock and data signals is now calculated based on the requested bus frequency (dev.iicbus.N.frequency) instead of being hardcoded to 10 microseconds. The calculations are done in such a fashion that the default bus frequency of 100000 is converted to udelay of 10 us. This is for backward compatibility. The actual frequency will be less than a quarter (I think) of the requested frequency. Also, I added detection of stuck low SCL in a few places. Previously, the code would just carry on after the SCL low timeout and that might potentially lead to misinterpreted bits. Finally, I fixed several style issues near the code that I changed. Many more are still remaining. Tested by accessing HTU21 temperature and humidity sensor in this setup: superio0: at port 0x2e-0x2f on isa0 gpio1: at GPIO ldn 0x07 on superio0 pcib0: allocated type 4 (0x220-0x226) for rid 0 of gpio1 gpiobus1: on gpio1 gpioiic0: at pins 14-15 on gpiobus1 gpioiic0: SCL pin: 14, SDA pin: 15 iicbb0: on gpioiic0 iicbus0: on iicbb0 master-only iic0: on iicbus0 Discussed with: ian, imp MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D22109 Modified: head/sys/dev/iicbus/iicbb.c Modified: head/sys/dev/iicbus/iicbb.c ============================================================================== --- head/sys/dev/iicbus/iicbb.c Thu Oct 31 09:14:50 2019 (r354211) +++ head/sys/dev/iicbus/iicbb.c Thu Oct 31 11:31:13 2019 (r354212) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #ifdef FDT @@ -68,9 +69,13 @@ __FBSDID("$FreeBSD$"); #include "iicbus_if.h" #include "iicbb_if.h" +/* Based on the SMBus specification. */ +#define DEFAULT_SCL_LOW_TIMEOUT (25 * 1000) + struct iicbb_softc { device_t iicbus; - int udelay; /* signal toggle delay in usec */ + u_int udelay; /* signal toggle delay in usec */ + u_int scl_low_timeout; }; static int iicbb_attach(device_t); @@ -86,6 +91,7 @@ static int iicbb_write(device_t, const char *, int, in static int iicbb_read(device_t, char *, int, int *, int, int); static int iicbb_reset(device_t, u_char, u_char, u_char *); static int iicbb_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs); +static void iicbb_set_speed(struct iicbb_softc *sc, u_char); #ifdef FDT static phandle_t iicbb_get_node(device_t, device_t); #endif @@ -142,9 +148,19 @@ iicbb_attach(device_t dev) sc->iicbus = device_add_child(dev, "iicbus", -1); if (!sc->iicbus) return (ENXIO); - sc->udelay = 10; /* 10 uS default */ - bus_generic_attach(dev); + sc->scl_low_timeout = DEFAULT_SCL_LOW_TIMEOUT; + + SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, + "delay", CTLFLAG_RD, &sc->udelay, + 0, "Signal change delay controlled by bus frequency, microseconds"); + + SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, + "scl_low_timeout", CTLFLAG_RWTUN, &sc->scl_low_timeout, + 0, "SCL low timeout, microseconds"); + bus_generic_attach(dev); return (0); } @@ -201,24 +217,17 @@ iicbb_print_child(device_t bus, device_t dev) return (retval); } -#define I2C_SETSDA(sc,dev,val) do { \ - IICBB_SETSDA(device_get_parent(dev), val); \ +#define I2C_GETSDA(dev) (IICBB_GETSDA(device_get_parent(dev))) +#define I2C_SETSDA(dev, x) (IICBB_SETSDA(device_get_parent(dev), x)) +#define I2C_GETSCL(dev) (IICBB_GETSCL(device_get_parent(dev))) +#define I2C_SETSCL(dev, x) (IICBB_SETSCL(device_get_parent(dev), x)) + +#define I2C_SET(sc, dev, ctrl, val) do { \ + iicbb_setscl(dev, ctrl); \ + I2C_SETSDA(dev, val); \ DELAY(sc->udelay); \ } while (0) -#define I2C_SETSCL(dev,val) do { \ - iicbb_setscl(dev, val, 100); \ - } while (0) - -#define I2C_SET(sc,dev,ctrl,data) do { \ - I2C_SETSCL(dev, ctrl); \ - I2C_SETSDA(sc, dev, data); \ - } while (0) - -#define I2C_GETSDA(dev) (IICBB_GETSDA(device_get_parent(dev))) - -#define I2C_GETSCL(dev) (IICBB_GETSCL(device_get_parent(dev))) - static int i2c_debug = 0; #define I2C_DEBUG(x) do { \ if (i2c_debug) (x); \ @@ -229,20 +238,37 @@ static int i2c_debug = 0; } while (0) static void -iicbb_setscl(device_t dev, int val, int timeout) +iicbb_setscl(device_t dev, int val) { struct iicbb_softc *sc = device_get_softc(dev); - int k = 0; + sbintime_t now, end; + int fast_timeout; - IICBB_SETSCL(device_get_parent(dev), val); + I2C_SETSCL(dev, val); DELAY(sc->udelay); - while (val && !I2C_GETSCL(dev) && k++ < timeout) { - IICBB_SETSCL(device_get_parent(dev), val); + /* Pulling low cannot fail. */ + if (!val) + return; + + /* Use DELAY for up to 1 ms, then switch to pause. */ + end = sbinuptime() + sc->scl_low_timeout * SBT_1US; + fast_timeout = MIN(sc->scl_low_timeout, 1000); + while (fast_timeout > 0) { + if (I2C_GETSCL(dev)) + return; + I2C_SETSCL(dev, 1); /* redundant ? */ DELAY(sc->udelay); + fast_timeout -= sc->udelay; } - return; + while (!I2C_GETSCL(dev)) { + now = sbinuptime(); + if (now >= end) + break; + pause_sbt("iicbb-scl-low", SBT_1MS, C_PREL(8), 0); + } + } static void @@ -290,6 +316,11 @@ iicbb_ack(device_t dev, int timeout) I2C_SET(sc,dev,0,1); I2C_SET(sc,dev,1,1); + + /* SCL must be high now. */ + if (!I2C_GETSCL(dev)) + return (IIC_ETIMEOUT); + do { noack = I2C_GETSDA(dev); if (!noack) @@ -301,14 +332,14 @@ iicbb_ack(device_t dev, int timeout) I2C_SET(sc,dev,0,1); I2C_DEBUG(printf("%c ",noack?'-':'+')); - return (noack); + return (noack ? IIC_ENOACK : 0); } static void iicbb_sendbyte(device_t dev, u_char data, int timeout) { int i; - + for (i=7; i>=0; i--) { if (data&(1<")); I2C_DEBUG(printf("\n")); + + /* SCL must be high now. */ + if (!I2C_GETSCL(dev)) + return (IIC_ETIMEOUT); return (0); } @@ -408,15 +445,13 @@ iicbb_write(device_t dev, const char *buf, int len, in iicbb_sendbyte(dev,(u_char)*buf++, timeout); /* check for ack */ - if (iicbb_ack(dev, timeout)) { - error = IIC_ENOACK; - goto error; - } - bytes ++; - len --; + error = iicbb_ack(dev, timeout); + if (error != 0) + break; + bytes++; + len--; } -error: *sent = bytes; return (error); } @@ -452,6 +487,24 @@ iicbb_transfer(device_t dev, struct iic_msg *msgs, uin IICBB_POST_XFER(device_get_parent(dev)); return (error); +} + +static void +iicbb_set_speed(struct iicbb_softc *sc, u_char speed) +{ + u_int busfreq, period; + + /* + * NB: the resulting frequency will be a quarter (even less) of the + * configured bus frequency. This is for historic reasons. The default + * bus frequency is 100 kHz. And the historic default udelay is 10 + * microseconds. The cycle of sending a bit takes four udelay-s plus + * SCL is kept low for extra two udelay-s. The actual I/O toggling also + * has an overhead. + */ + busfreq = IICBUS_GET_FREQUENCY(sc->iicbus, speed); + period = 1000000 / busfreq; /* Hz -> uS */ + sc->udelay = MAX(period, 1); } DRIVER_MODULE(iicbus, iicbb, iicbus_driver, iicbus_devclass, 0, 0); From owner-svn-src-head@freebsd.org Thu Oct 31 11:59:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0D891A58E2; Thu, 31 Oct 2019 11:59:00 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473kPc6BGTz4BLN; Thu, 31 Oct 2019 11:59:00 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6F7D22462; Thu, 31 Oct 2019 11:59:00 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9VBx0kA020964; Thu, 31 Oct 2019 11:59:00 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9VBx0AK020963; Thu, 31 Oct 2019 11:59:00 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201910311159.x9VBx0AK020963@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Thu, 31 Oct 2019 11:59:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354213 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 354213 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 11:59:01 -0000 Author: luporl Date: Thu Oct 31 11:59:00 2019 New Revision: 354213 URL: https://svnweb.freebsd.org/changeset/base/354213 Log: [PPC64] Fix trapstk overflow In some scenarios, the 4K trapstk may overflow, corrupting tmpstk. This was observed during remote debugging, with the following steps: At remote host (R): - enter kdb during boot - switch to gdb backend At local host (L): - attach gdb to R - try to read an invalid memory position At R: - a DSI trap occurs and kdb restarts (all this occurs on trapstk) - while printing the stacktrace, trapstk overflows and corrupts tmpstk Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D22200 Modified: head/sys/powerpc/aim/locore64.S Modified: head/sys/powerpc/aim/locore64.S ============================================================================== --- head/sys/powerpc/aim/locore64.S Thu Oct 31 11:31:13 2019 (r354212) +++ head/sys/powerpc/aim/locore64.S Thu Oct 31 11:59:00 2019 (r354213) @@ -66,7 +66,7 @@ TOC_ENTRY(tmpstk) TOC_ENTRY(can_wakeup) #ifdef KDB -#define TRAPSTKSZ 4096 /* 4k trap stack */ +#define TRAPSTKSZ 8192 /* 8k trap stack */ GLOBAL(trapstk) .space TRAPSTKSZ TOC_ENTRY(trapstk) From owner-svn-src-head@freebsd.org Thu Oct 31 12:03:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A6461A6578; Thu, 31 Oct 2019 12:03:49 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473kW85ldSz4CB7; Thu, 31 Oct 2019 12:03:48 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F0D622628; Thu, 31 Oct 2019 12:03:48 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9VC3ml9026676; Thu, 31 Oct 2019 12:03:48 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9VC3mN0026674; Thu, 31 Oct 2019 12:03:48 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201910311203.x9VC3mN0026674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Thu, 31 Oct 2019 12:03:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354214 - in head/sys/powerpc: include powerpc X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: in head/sys/powerpc: include powerpc X-SVN-Commit-Revision: 354214 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 12:03:49 -0000 Author: luporl Date: Thu Oct 31 12:03:47 2019 New Revision: 354214 URL: https://svnweb.freebsd.org/changeset/base/354214 Log: Fix GDB machdep code for PPC/PPC64 There was a couple issues with GDB machdep code for PPC/PPC64, the main ones being: - wrong register sizes being returned - pcb_context index was wrong (this affects all PPC variants) Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D22201 Modified: head/sys/powerpc/include/gdb_machdep.h head/sys/powerpc/powerpc/gdb_machdep.c Modified: head/sys/powerpc/include/gdb_machdep.h ============================================================================== --- head/sys/powerpc/include/gdb_machdep.h Thu Oct 31 11:59:00 2019 (r354213) +++ head/sys/powerpc/include/gdb_machdep.h Thu Oct 31 12:03:47 2019 (r354214) @@ -36,10 +36,43 @@ #define PPC_GDB_NREGS4 (70 + 1) #define PPC_GDB_NREGS8 (1 + 32) #define PPC_GDB_NREGS16 0 + #else +/* + * 0 - 32*GPR(4/8) + * 32 - 32*FPR(8) + * 64 - PC, PS (4/8) + * 66 - CR (4) + * 67 - LR, CTR (4/8) + * 69 - XER, FPSCR (4) + * 71 - 32*VR(16) + * 103 - VSCR, VRSAVE (4) + */ + +#define PPC_REGNUM_R0 0 +#define PPC_REGNUM_R31 (PPC_REGNUM_R0 + 31) +#define PPC_REGNUM_FR0 32 +#define PPC_REGNUM_FR31 (PPC_REGNUM_FR0 + 31) +#define PPC_REGNUM_PC 64 +#define PPC_REGNUM_PS 65 +#define PPC_REGNUM_CR 66 +#define PPC_REGNUM_LR 67 +#define PPC_REGNUM_CTR 68 +#define PPC_REGNUM_XER 69 +#define PPC_REGNUM_FPSCR 70 +#define PPC_REGNUM_VR0 71 +#define PPC_REGNUM_VR31 (PPC_REGNUM_VR0 + 31) + #define PPC_GDB_NREGS0 0 + +#ifdef __powerpc64__ +#define PPC_GDB_NREGS4 5 +#define PPC_GDB_NREGS8 (64 + 4) +#else #define PPC_GDB_NREGS4 (32 + 7 + 2) #define PPC_GDB_NREGS8 32 +#endif + #define PPC_GDB_NREGS16 32 #endif @@ -61,9 +94,15 @@ gdb_cpu_regsz(int regnum) if (regnum == 71 || regnum >= 73) return (8); #else - if (regnum >= 32 && regnum <= 63) +#ifdef __powerpc64__ + if ((regnum >= PPC_REGNUM_R0 && regnum <= PPC_REGNUM_PS) || + regnum == PPC_REGNUM_LR || regnum == PPC_REGNUM_CTR) return (8); - if (regnum >= 71 && regnum <= 102) +#else + if (regnum >= PPC_REGNUM_FR0 && regnum <= PPC_REGNUM_FR31) + return (8); +#endif + if (regnum >= PPC_REGNUM_VR0 && regnum <= PPC_REGNUM_VR31) return (16); #endif return (4); Modified: head/sys/powerpc/powerpc/gdb_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/gdb_machdep.c Thu Oct 31 11:59:00 2019 (r354213) +++ head/sys/powerpc/powerpc/gdb_machdep.c Thu Oct 31 12:03:47 2019 (r354214) @@ -65,8 +65,10 @@ gdb_cpu_getreg(int regnum, size_t *regsz) if (regnum == 1) return (&kdb_thrctx->pcb_sp); - if (regnum >= 14 && regnum <= 31) - return (kdb_thrctx->pcb_context + (regnum - 14)); + if (regnum == 2 && *regsz == 8) + return (&kdb_thrctx->pcb_toc); + if (regnum >= 12 && regnum <= 31) + return (kdb_thrctx->pcb_context + (regnum - 12)); if (regnum == 64) return (&kdb_thrctx->pcb_lr); From owner-svn-src-head@freebsd.org Thu Oct 31 12:51:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62DA81A77C7; Thu, 31 Oct 2019 12:51:28 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 473lZ64Cx9z4FNB; Thu, 31 Oct 2019 12:51:25 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 2c6e3ef1; Thu, 31 Oct 2019 13:51:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=lsRg2lpCu3RW3SYh6Ql1RghmbZY=; b=fSkH85xe6tRpgq6XUxAWa+SyPKZv l1UDL0s3AiCxlFRWvvcE7XJ8kvW+iVmOMwxrGZ+NkjkuqTXGSdIw+i/hq+yoZ7p8 VhfRQL2u4bQip5h4+ZDLsE6rv6LvqSQgZu8OVCnia5NWuh4YD+ZeFj1w4hF47xdU ZmSW9+EvajU7RGE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=p0nJwtUB5zeq9qYPXzSwLyH5Alz07iDwI5C+mbZfQLoP1LxoV0Zp5/xx 2KIS2j2mymKir+ouJWYWlwf7IqauCus0FHlzYm776jsB36GChIpHfXP5zrpsBPDn X2as2MXk183dBEXIHiB1jD/85AXC69xW9eYRa5+kRpnzqsDKSic= Received: from sonic.home.blih.net (ip-9.net-89-3-105.rev.numericable.fr [89.3.105.9]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 0ece2121 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Thu, 31 Oct 2019 13:51:18 +0100 (CET) Date: Thu, 31 Oct 2019 13:51:18 +0100 From: Emmanuel Vadot To: Ilya Bakulin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354206 - head/sys/arm/allwinner Message-Id: <20191031135118.4e9222bb05879d1602bf3161@bidouilliste.com> In-Reply-To: <201910302043.x9UKhRth083957@repo.freebsd.org> References: <201910302043.x9UKhRth083957@repo.freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 473lZ64Cx9z4FNB X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bidouilliste.com header.s=mail header.b=fSkH85xe; dmarc=none; spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates 212.83.177.182 as permitted sender) smtp.mailfrom=manu@bidouilliste.com X-Spamd-Result: default: False [-0.86 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mail]; NEURAL_HAM_MEDIUM(-0.37)[-0.374,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:212.83.177.182/32]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MV_CASE(0.50)[]; DMARC_NA(0.00)[bidouilliste.com]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-0.97)[-0.967,0]; DKIM_TRACE(0.00)[bidouilliste.com:+]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; IP_SCORE(0.39)[ip: (-0.61), ipnet: 212.83.160.0/19(2.44), asn: 12876(0.10), country: FR(-0.00)]; ASN(0.00)[asn:12876, ipnet:212.83.160.0/19, country:FR]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 12:51:28 -0000 On Wed, 30 Oct 2019 20:43:27 +0000 (UTC) Ilya Bakulin wrote: > Author: kibab > Date: Wed Oct 30 20:43:27 2019 > New Revision: 354206 > URL: https://svnweb.freebsd.org/changeset/base/354206 > > Log: > Use the new cam_sim_alloc_dev function to properly initialize SIM > > Using cam_sim_alloc_dev() allows to properly set sim_dev field so that > sdiob(4) can attach to the CAM device that represents SDIO card. > The same change for SDHCI driver happened in r348800. > > Approved by: imp (mentor) > Differential Revision: https://reviews.freebsd.org/D22192 > > Modified: > head/sys/arm/allwinner/aw_mmc.c > > Modified: head/sys/arm/allwinner/aw_mmc.c > ============================================================================== > --- head/sys/arm/allwinner/aw_mmc.c Wed Oct 30 20:08:10 2019 (r354205) > +++ head/sys/arm/allwinner/aw_mmc.c Wed Oct 30 20:43:27 2019 (r354206) > @@ -526,8 +526,8 @@ aw_mmc_attach(device_t dev) > } > > mtx_init(&sc->sim_mtx, "awmmcsim", NULL, MTX_DEF); > - sc->sim = cam_sim_alloc(aw_mmc_cam_action, aw_mmc_cam_poll, > - "aw_mmc_sim", sc, device_get_unit(dev), > + sc->sim = cam_sim_alloc_dev(aw_mmc_cam_action, aw_mmc_cam_poll, > + "aw_mmc_sim", sc, dev, > &sc->sim_mtx, 1, 1, sc->devq); > > if (sc->sim == NULL) { > @@ -1514,6 +1514,7 @@ static device_method_t aw_mmc_methods[] = { > /* Bus interface */ > DEVMETHOD(bus_read_ivar, aw_mmc_read_ivar), > DEVMETHOD(bus_write_ivar, aw_mmc_write_ivar), > + DEVMETHOD(bus_add_child, bus_generic_add_child), Why is this change needed ? > > /* MMC bridge interface */ > DEVMETHOD(mmcbr_update_ios, aw_mmc_update_ios), -- Emmanuel Vadot From owner-svn-src-head@freebsd.org Thu Oct 31 14:22:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7911615A33F; Thu, 31 Oct 2019 14:22:55 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473nbg2dHlz4LmY; Thu, 31 Oct 2019 14:22:55 +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 3E67D23F9A; Thu, 31 Oct 2019 14:22:55 +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 x9VEMtWt008676; Thu, 31 Oct 2019 14:22:55 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9VEMtQY008675; Thu, 31 Oct 2019 14:22:55 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910311422.x9VEMtQY008675@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 31 Oct 2019 14:22:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354215 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 354215 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 14:22:55 -0000 Author: markj Date: Thu Oct 31 14:22:54 2019 New Revision: 354215 URL: https://svnweb.freebsd.org/changeset/base/354215 Log: Fix a typo in r353895. Reported by: andrew MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/machdep.c Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Thu Oct 31 12:03:47 2019 (r354214) +++ head/sys/arm64/arm64/machdep.c Thu Oct 31 14:22:54 2019 (r354215) @@ -748,7 +748,7 @@ init_proc0(vm_offset_t kstack) thread0.td_kstack = kstack; thread0.td_kstack_pages = KSTACK_PAGES; thread0.td_pcb = (struct pcb *)(thread0.td_kstack + - thread0.td_kstack_pages * KSTACK_PAGES) - 1; + thread0.td_kstack_pages * PAGE_SIZE) - 1; thread0.td_pcb->pcb_fpflags = 0; thread0.td_pcb->pcb_fpusaved = &thread0.td_pcb->pcb_fpustate; thread0.td_pcb->pcb_vfpcpu = UINT_MAX; From owner-svn-src-head@freebsd.org Thu Oct 31 15:16:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 052C315C698; Thu, 31 Oct 2019 15:16:11 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473pn663RKz4SMm; Thu, 31 Oct 2019 15:16:10 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3249248C3; Thu, 31 Oct 2019 15:16:10 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9VFGA0T041523; Thu, 31 Oct 2019 15:16:10 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9VFGAhK041522; Thu, 31 Oct 2019 15:16:10 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201910311516.x9VFGAhK041522@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Thu, 31 Oct 2019 15:16:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354217 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 354217 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 15:16:11 -0000 Author: mw Date: Thu Oct 31 15:16:10 2019 New Revision: 354217 URL: https://svnweb.freebsd.org/changeset/base/354217 Log: Fix pmap_change_attr() on arm64 to allow KV addresses Altough in the comment above the pmap_change_attr() it was mentioned that VA could be in KV or DMAP memory space. However, pmap_change_attr_locked() was accepting only the values inside the DMAP memory range. To fix that, the condition check was changed so also the va inside the KV memory range would be accepted. The sample use case that wasn't supported is the PCI Device that has the BAR which should me mapped with the Write Combine attribute - for example BAR2 of the ENA network controller on the A1 instances on AWS. Tested on A1 AWS instance and changed ENA BAR2 mapped resource to be write-combined memory region. Differential Revision: https://reviews.freebsd.org/D22055 MFC after: 2 weeks Submitted by: Michal Krawczyk Obtained from: Semihalf Sponsored by: Amazon, Inc. Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Thu Oct 31 14:49:30 2019 (r354216) +++ head/sys/arm64/arm64/pmap.c Thu Oct 31 15:16:10 2019 (r354217) @@ -5291,7 +5291,8 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size offset = va & PAGE_MASK; size = round_page(offset + size); - if (!VIRT_IN_DMAP(base)) + if (!VIRT_IN_DMAP(base) && + !(base >= VM_MIN_KERNEL_ADDRESS && base < VM_MAX_KERNEL_ADDRESS)) return (EINVAL); for (tmpva = base; tmpva < base + size; ) { From owner-svn-src-head@freebsd.org Thu Oct 31 15:38:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E742F15D031; Thu, 31 Oct 2019 15:38:17 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473qGd5bpYz4TGs; Thu, 31 Oct 2019 15:38:17 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A43AC24C73; Thu, 31 Oct 2019 15:38:17 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9VFcHIo053036; Thu, 31 Oct 2019 15:38:17 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9VFcHPE053035; Thu, 31 Oct 2019 15:38:17 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201910311538.x9VFcHPE053035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Thu, 31 Oct 2019 15:38:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354218 - head/sys/dev/ena X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/ena X-SVN-Commit-Revision: 354218 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 15:38:18 -0000 Author: mw Date: Thu Oct 31 15:38:17 2019 New Revision: 354218 URL: https://svnweb.freebsd.org/changeset/base/354218 Log: Add WC support for arm64 in the ENA driver As the pmamp_change_attr() is public on arm64 since r351131, it can be used on the arm64 to map memory range as with the write combined attribute. It requires the driver to use generic VM_MEMATTR_WRITE_COMBINING flag instead of the x86 specific PAT_WRITE_COMBINING. Differential Revision: https://reviews.freebsd.org/D21931 Submitted by: Michal Krawczyk Obtained from: Semihalf Sponsored by: Amazon, Inc. Modified: head/sys/dev/ena/ena.c Modified: head/sys/dev/ena/ena.c ============================================================================== --- head/sys/dev/ena/ena.c Thu Oct 31 15:16:10 2019 (r354217) +++ head/sys/dev/ena/ena.c Thu Oct 31 15:38:17 2019 (r354218) @@ -3309,7 +3309,7 @@ ena_calc_io_queue_num(struct ena_adapter *adapter, static int ena_enable_wc(struct resource *res) { -#if defined(__i386) || defined(__amd64) +#if defined(__i386) || defined(__amd64) || defined(__aarch64__) vm_offset_t va; vm_size_t len; int rc; @@ -3317,7 +3317,7 @@ ena_enable_wc(struct resource *res) va = (vm_offset_t)rman_get_virtual(res); len = rman_get_size(res); /* Enable write combining */ - rc = pmap_change_attr(va, len, PAT_WRITE_COMBINING); + rc = pmap_change_attr(va, len, VM_MEMATTR_WRITE_COMBINING); if (unlikely(rc != 0)) { ena_trace(ENA_ALERT, "pmap_change_attr failed, %d\n", rc); return (rc); @@ -4352,14 +4352,6 @@ ena_attach(device_t pdev) set_default_llq_configurations(&llq_config); -#if defined(__arm__) || defined(__aarch64__) - /* - * Force LLQ disable, as the driver is not supporting WC enablement - * on the ARM architecture. Using LLQ without WC would affect - * performance in a negative way. - */ - ena_dev->supported_features &= ~(1 << ENA_ADMIN_LLQ); -#endif rc = ena_set_queues_placement_policy(pdev, ena_dev, &get_feat_ctx.llq, &llq_config); if (unlikely(rc != 0)) { From owner-svn-src-head@freebsd.org Thu Oct 31 15:39:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C21C15D0FC; Thu, 31 Oct 2019 15:39:55 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473qJW1jrgz4TQP; Thu, 31 Oct 2019 15:39:55 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E59C24C82; Thu, 31 Oct 2019 15:39:55 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9VFdt06053144; Thu, 31 Oct 2019 15:39:55 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9VFds1q053143; Thu, 31 Oct 2019 15:39:54 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201910311539.x9VFds1q053143@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Thu, 31 Oct 2019 15:39:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354219 - head/sys/dev/ena X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/ena X-SVN-Commit-Revision: 354219 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 15:39:55 -0000 Author: mw Date: Thu Oct 31 15:39:54 2019 New Revision: 354219 URL: https://svnweb.freebsd.org/changeset/base/354219 Log: Fix ENA keep-alive timeout due to prolonged reset When the ENA_FLAG_DEVICE_RUNNING flag is disabled, the AENQ handlers aren't executed. To fix that, the watchdog timestamp should be updated just before enabling the watchdog. Timer service was always being enabled, even if the device wasn't up before the reset. That shouldn't happen, as the timer service is being executed only for working interface. Differential Revision: https://reviews.freebsd.org/D21932 Submitted by: Michal Krawczyk Obtained from: Semihalf Sponsored by: Amazon, Inc. Modified: head/sys/dev/ena/ena.c Modified: head/sys/dev/ena/ena.c ============================================================================== --- head/sys/dev/ena/ena.c Thu Oct 31 15:38:17 2019 (r354218) +++ head/sys/dev/ena/ena.c Thu Oct 31 15:39:54 2019 (r354219) @@ -2350,8 +2350,14 @@ ena_up(struct ena_adapter *adapter) if_setdrvflagbits(adapter->ifp, IFF_DRV_RUNNING, IFF_DRV_OACTIVE); - callout_reset_sbt(&adapter->timer_service, SBT_1S, SBT_1S, - ena_timer_service, (void *)adapter, 0); + /* Activate timer service only if the device is running. + * If this flag is not set, it means that the driver is being + * reset and timer service will be activated afterwards. + */ + if (ENA_FLAG_ISSET(ENA_FLAG_DEVICE_RUNNING, adapter)) { + callout_reset_sbt(&adapter->timer_service, SBT_1S, + SBT_1S, ena_timer_service, (void *)adapter, 0); + } ENA_FLAG_SET_ATOMIC(ENA_FLAG_DEV_UP, adapter); @@ -4222,9 +4228,20 @@ ena_restore_device(struct ena_adapter *adapter) } } + /* Indicate that device is running again and ready to work */ ENA_FLAG_SET_ATOMIC(ENA_FLAG_DEVICE_RUNNING, adapter); - callout_reset_sbt(&adapter->timer_service, SBT_1S, SBT_1S, - ena_timer_service, (void *)adapter, 0); + + if (ENA_FLAG_ISSET(ENA_FLAG_DEV_UP_BEFORE_RESET, adapter)) { + /* + * As the AENQ handlers weren't executed during reset because + * the flag ENA_FLAG_DEVICE_RUNNING was turned off, the + * timestamp must be updated again That will prevent next reset + * caused by missing keep alive. + */ + adapter->keep_alive_timestamp = getsbinuptime(); + callout_reset_sbt(&adapter->timer_service, SBT_1S, SBT_1S, + ena_timer_service, (void *)adapter, 0); + } device_printf(dev, "Device reset completed successfully, Driver info: %s\n", ena_version); From owner-svn-src-head@freebsd.org Thu Oct 31 15:44:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E49B15D3CF; Thu, 31 Oct 2019 15:44:27 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473qPl19Jfz4TpW; Thu, 31 Oct 2019 15:44:27 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0177E24E47; Thu, 31 Oct 2019 15:44:27 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9VFiQwT058598; Thu, 31 Oct 2019 15:44:26 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9VFiQot058596; Thu, 31 Oct 2019 15:44:26 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201910311544.x9VFiQot058596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Thu, 31 Oct 2019 15:44:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354220 - in head/sys: dev/ena modules/ena X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: in head/sys: dev/ena modules/ena X-SVN-Commit-Revision: 354220 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 15:44:27 -0000 Author: mw Date: Thu Oct 31 15:44:26 2019 New Revision: 354220 URL: https://svnweb.freebsd.org/changeset/base/354220 Log: Split Rx/Tx from initialization code in ENA driver Move Rx/Tx routines to separate file. Some functions: * ena_restore_device, * ena_destroy_device, * ena_up, * ena_down, * ena_refill_rx_bufs could be reused in upcoming netmap code in the driver. To make it possible, they were moved to ena.h header. Differential Revision: https://reviews.freebsd.org/D21933 Submitted by: Rafal Kozik Obtained from: Semihalf Sponsored by: Amazon, Inc. Added: head/sys/dev/ena/ena_datapath.c (contents, props changed) head/sys/dev/ena/ena_datapath.h (contents, props changed) Modified: head/sys/dev/ena/ena.c head/sys/dev/ena/ena.h head/sys/modules/ena/Makefile Modified: head/sys/dev/ena/ena.c ============================================================================== --- head/sys/dev/ena/ena.c Thu Oct 31 15:39:54 2019 (r354219) +++ head/sys/dev/ena/ena.c Thu Oct 31 15:44:26 2019 (r354220) @@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include "ena_datapath.h" #include "ena.h" #include "ena_sysctl.h" @@ -102,7 +103,6 @@ static int ena_setup_tx_resources(struct ena_adapter * static void ena_free_tx_resources(struct ena_adapter *, int); static int ena_setup_all_tx_resources(struct ena_adapter *); static void ena_free_all_tx_resources(struct ena_adapter *); -static inline int validate_rx_req_id(struct ena_ring *, uint16_t); static int ena_setup_rx_resources(struct ena_adapter *, unsigned int); static void ena_free_rx_resources(struct ena_adapter *, unsigned int); static int ena_setup_all_rx_resources(struct ena_adapter *); @@ -111,7 +111,6 @@ static inline int ena_alloc_rx_mbuf(struct ena_adapter struct ena_rx_buffer *); static void ena_free_rx_mbuf(struct ena_adapter *, struct ena_ring *, struct ena_rx_buffer *); -static int ena_refill_rx_bufs(struct ena_ring *, uint32_t); static void ena_free_rx_bufs(struct ena_adapter *, unsigned int); static void ena_refill_all_rx_bufs(struct ena_adapter *); static void ena_free_all_rx_bufs(struct ena_adapter *); @@ -121,16 +120,6 @@ static void ena_destroy_all_tx_queues(struct ena_adapt static void ena_destroy_all_rx_queues(struct ena_adapter *); static void ena_destroy_all_io_queues(struct ena_adapter *); static int ena_create_io_queues(struct ena_adapter *); -static int ena_tx_cleanup(struct ena_ring *); -static int ena_rx_cleanup(struct ena_ring *); -static inline int validate_tx_req_id(struct ena_ring *, uint16_t); -static void ena_rx_hash_mbuf(struct ena_ring *, struct ena_com_rx_ctx *, - struct mbuf *); -static struct mbuf* ena_rx_mbuf(struct ena_ring *, struct ena_com_rx_buf_info *, - struct ena_com_rx_ctx *, uint16_t *); -static inline void ena_rx_checksum(struct ena_ring *, struct ena_com_rx_ctx *, - struct mbuf *); -static void ena_cleanup(void *arg, int pending); static int ena_handle_msix(void *); static int ena_enable_msix(struct ena_adapter *); static void ena_setup_mgmnt_intr(struct ena_adapter *); @@ -144,8 +133,6 @@ static void ena_disable_msix(struct ena_adapter *); static void ena_unmask_all_io_irqs(struct ena_adapter *); static int ena_rss_configure(struct ena_adapter *); static int ena_up_complete(struct ena_adapter *); -static int ena_up(struct ena_adapter *); -static void ena_down(struct ena_adapter *); static uint64_t ena_get_counter(if_t, ift_counter); static int ena_media_change(if_t); static void ena_media_status(if_t, struct ifmediareq *); @@ -156,15 +143,6 @@ static void ena_update_host_info(struct ena_admin_host static void ena_update_hwassist(struct ena_adapter *); static int ena_setup_ifnet(device_t, struct ena_adapter *, struct ena_com_dev_get_features_ctx *); -static void ena_tx_csum(struct ena_com_tx_ctx *, struct mbuf *); -static int ena_check_and_collapse_mbuf(struct ena_ring *tx_ring, - struct mbuf **mbuf); -static void ena_dmamap_llq(void *, bus_dma_segment_t *, int, int); -static int ena_xmit_mbuf(struct ena_ring *, struct mbuf **); -static void ena_start_xmit(struct ena_ring *); -static int ena_mq_start(if_t, struct mbuf *); -static void ena_deferred_mq_start(void *, int); -static void ena_qflush(if_t); static int ena_enable_wc(struct resource *); static int ena_set_queues_placement_policy(device_t, struct ena_com_dev *, struct ena_admin_feature_llq_desc *, struct ena_llq_configurations *); @@ -766,25 +744,6 @@ ena_free_all_tx_resources(struct ena_adapter *adapter) ena_free_tx_resources(adapter, i); } -static inline int -validate_rx_req_id(struct ena_ring *rx_ring, uint16_t req_id) -{ - if (likely(req_id < rx_ring->ring_size)) - return (0); - - device_printf(rx_ring->adapter->pdev, "Invalid rx req_id: %hu\n", - req_id); - counter_u64_add(rx_ring->rx_stats.bad_req_id, 1); - - /* Trigger device reset */ - if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, rx_ring->adapter))) { - rx_ring->adapter->reset_reason = ENA_REGS_RESET_INV_RX_REQ_ID; - ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, rx_ring->adapter); - } - - return (EFAULT); -} - /** * ena_setup_rx_resources - allocate Rx resources (Descriptors) * @adapter: network interface device structure @@ -1024,7 +983,7 @@ ena_free_rx_mbuf(struct ena_adapter *adapter, struct e * @num: number of descriptors to refill * Refills the ring with newly allocated DMA-mapped mbufs for receiving **/ -static int +int ena_refill_rx_bufs(struct ena_ring *rx_ring, uint32_t num) { struct ena_adapter *adapter = rx_ring->adapter; @@ -1227,30 +1186,6 @@ ena_destroy_all_io_queues(struct ena_adapter *adapter) ena_destroy_all_rx_queues(adapter); } -static inline int -validate_tx_req_id(struct ena_ring *tx_ring, uint16_t req_id) -{ - struct ena_adapter *adapter = tx_ring->adapter; - struct ena_tx_buffer *tx_info = NULL; - - if (likely(req_id < tx_ring->ring_size)) { - tx_info = &tx_ring->tx_buffer_info[req_id]; - if (tx_info->mbuf != NULL) - return (0); - device_printf(adapter->pdev, - "tx_info doesn't have valid mbuf\n"); - } - - device_printf(adapter->pdev, "Invalid req_id: %hu\n", req_id); - counter_u64_add(tx_ring->tx_stats.bad_req_id, 1); - - /* Trigger device reset */ - adapter->reset_reason = ENA_REGS_RESET_INV_TX_REQ_ID; - ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter); - - return (EFAULT); -} - static int ena_create_io_queues(struct ena_adapter *adapter) { @@ -1344,475 +1279,6 @@ err_tx: return (ENXIO); } -/** - * ena_tx_cleanup - clear sent packets and corresponding descriptors - * @tx_ring: ring for which we want to clean packets - * - * Once packets are sent, we ask the device in a loop for no longer used - * descriptors. We find the related mbuf chain in a map (index in an array) - * and free it, then update ring state. - * This is performed in "endless" loop, updating ring pointers every - * TX_COMMIT. The first check of free descriptor is performed before the actual - * loop, then repeated at the loop end. - **/ -static int -ena_tx_cleanup(struct ena_ring *tx_ring) -{ - struct ena_adapter *adapter; - struct ena_com_io_cq* io_cq; - uint16_t next_to_clean; - uint16_t req_id; - uint16_t ena_qid; - unsigned int total_done = 0; - int rc; - int commit = TX_COMMIT; - int budget = TX_BUDGET; - int work_done; - bool above_thresh; - - adapter = tx_ring->que->adapter; - ena_qid = ENA_IO_TXQ_IDX(tx_ring->que->id); - io_cq = &adapter->ena_dev->io_cq_queues[ena_qid]; - next_to_clean = tx_ring->next_to_clean; - - do { - struct ena_tx_buffer *tx_info; - struct mbuf *mbuf; - - rc = ena_com_tx_comp_req_id_get(io_cq, &req_id); - if (unlikely(rc != 0)) - break; - - rc = validate_tx_req_id(tx_ring, req_id); - if (unlikely(rc != 0)) - break; - - tx_info = &tx_ring->tx_buffer_info[req_id]; - - mbuf = tx_info->mbuf; - - tx_info->mbuf = NULL; - bintime_clear(&tx_info->timestamp); - - /* Map is no longer required */ - if (tx_info->head_mapped == true) { - bus_dmamap_sync(adapter->tx_buf_tag, tx_info->map_head, - BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(adapter->tx_buf_tag, - tx_info->map_head); - tx_info->head_mapped = false; - } - if (tx_info->seg_mapped == true) { - bus_dmamap_sync(adapter->tx_buf_tag, tx_info->map_seg, - BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(adapter->tx_buf_tag, - tx_info->map_seg); - tx_info->seg_mapped = false; - } - - ena_trace(ENA_DBG | ENA_TXPTH, "tx: q %d mbuf %p completed\n", - tx_ring->qid, mbuf); - - m_freem(mbuf); - - total_done += tx_info->tx_descs; - - tx_ring->free_tx_ids[next_to_clean] = req_id; - next_to_clean = ENA_TX_RING_IDX_NEXT(next_to_clean, - tx_ring->ring_size); - - if (unlikely(--commit == 0)) { - commit = TX_COMMIT; - /* update ring state every TX_COMMIT descriptor */ - tx_ring->next_to_clean = next_to_clean; - ena_com_comp_ack( - &adapter->ena_dev->io_sq_queues[ena_qid], - total_done); - ena_com_update_dev_comp_head(io_cq); - total_done = 0; - } - } while (likely(--budget)); - - work_done = TX_BUDGET - budget; - - ena_trace(ENA_DBG | ENA_TXPTH, "tx: q %d done. total pkts: %d\n", - tx_ring->qid, work_done); - - /* If there is still something to commit update ring state */ - if (likely(commit != TX_COMMIT)) { - tx_ring->next_to_clean = next_to_clean; - ena_com_comp_ack(&adapter->ena_dev->io_sq_queues[ena_qid], - total_done); - ena_com_update_dev_comp_head(io_cq); - } - - /* - * Need to make the rings circular update visible to - * ena_xmit_mbuf() before checking for tx_ring->running. - */ - mb(); - - above_thresh = ena_com_sq_have_enough_space(tx_ring->ena_com_io_sq, - ENA_TX_RESUME_THRESH); - if (unlikely(!tx_ring->running && above_thresh)) { - ENA_RING_MTX_LOCK(tx_ring); - above_thresh = - ena_com_sq_have_enough_space(tx_ring->ena_com_io_sq, - ENA_TX_RESUME_THRESH); - if (!tx_ring->running && above_thresh) { - tx_ring->running = true; - counter_u64_add(tx_ring->tx_stats.queue_wakeup, 1); - taskqueue_enqueue(tx_ring->enqueue_tq, - &tx_ring->enqueue_task); - } - ENA_RING_MTX_UNLOCK(tx_ring); - } - - return (work_done); -} - -static void -ena_rx_hash_mbuf(struct ena_ring *rx_ring, struct ena_com_rx_ctx *ena_rx_ctx, - struct mbuf *mbuf) -{ - struct ena_adapter *adapter = rx_ring->adapter; - - if (likely(ENA_FLAG_ISSET(ENA_FLAG_RSS_ACTIVE, adapter))) { - mbuf->m_pkthdr.flowid = ena_rx_ctx->hash; - - if (ena_rx_ctx->frag && - (ena_rx_ctx->l3_proto != ENA_ETH_IO_L3_PROTO_UNKNOWN)) { - M_HASHTYPE_SET(mbuf, M_HASHTYPE_OPAQUE_HASH); - return; - } - - switch (ena_rx_ctx->l3_proto) { - case ENA_ETH_IO_L3_PROTO_IPV4: - switch (ena_rx_ctx->l4_proto) { - case ENA_ETH_IO_L4_PROTO_TCP: - M_HASHTYPE_SET(mbuf, M_HASHTYPE_RSS_TCP_IPV4); - break; - case ENA_ETH_IO_L4_PROTO_UDP: - M_HASHTYPE_SET(mbuf, M_HASHTYPE_RSS_UDP_IPV4); - break; - default: - M_HASHTYPE_SET(mbuf, M_HASHTYPE_RSS_IPV4); - } - break; - case ENA_ETH_IO_L3_PROTO_IPV6: - switch (ena_rx_ctx->l4_proto) { - case ENA_ETH_IO_L4_PROTO_TCP: - M_HASHTYPE_SET(mbuf, M_HASHTYPE_RSS_TCP_IPV6); - break; - case ENA_ETH_IO_L4_PROTO_UDP: - M_HASHTYPE_SET(mbuf, M_HASHTYPE_RSS_UDP_IPV6); - break; - default: - M_HASHTYPE_SET(mbuf, M_HASHTYPE_RSS_IPV6); - } - break; - case ENA_ETH_IO_L3_PROTO_UNKNOWN: - M_HASHTYPE_SET(mbuf, M_HASHTYPE_NONE); - break; - default: - M_HASHTYPE_SET(mbuf, M_HASHTYPE_OPAQUE_HASH); - } - } else { - mbuf->m_pkthdr.flowid = rx_ring->qid; - M_HASHTYPE_SET(mbuf, M_HASHTYPE_NONE); - } -} - -/** - * ena_rx_mbuf - assemble mbuf from descriptors - * @rx_ring: ring for which we want to clean packets - * @ena_bufs: buffer info - * @ena_rx_ctx: metadata for this packet(s) - * @next_to_clean: ring pointer, will be updated only upon success - * - **/ -static struct mbuf* -ena_rx_mbuf(struct ena_ring *rx_ring, struct ena_com_rx_buf_info *ena_bufs, - struct ena_com_rx_ctx *ena_rx_ctx, uint16_t *next_to_clean) -{ - struct mbuf *mbuf; - struct ena_rx_buffer *rx_info; - struct ena_adapter *adapter; - unsigned int descs = ena_rx_ctx->descs; - int rc; - uint16_t ntc, len, req_id, buf = 0; - - ntc = *next_to_clean; - adapter = rx_ring->adapter; - - len = ena_bufs[buf].len; - req_id = ena_bufs[buf].req_id; - rc = validate_rx_req_id(rx_ring, req_id); - if (unlikely(rc != 0)) - return (NULL); - - rx_info = &rx_ring->rx_buffer_info[req_id]; - if (unlikely(rx_info->mbuf == NULL)) { - device_printf(adapter->pdev, "NULL mbuf in rx_info"); - return (NULL); - } - - ena_trace(ENA_DBG | ENA_RXPTH, "rx_info %p, mbuf %p, paddr %jx\n", - rx_info, rx_info->mbuf, (uintmax_t)rx_info->ena_buf.paddr); - - bus_dmamap_sync(adapter->rx_buf_tag, rx_info->map, - BUS_DMASYNC_POSTREAD); - mbuf = rx_info->mbuf; - mbuf->m_flags |= M_PKTHDR; - mbuf->m_pkthdr.len = len; - mbuf->m_len = len; - mbuf->m_pkthdr.rcvif = rx_ring->que->adapter->ifp; - - /* Fill mbuf with hash key and it's interpretation for optimization */ - ena_rx_hash_mbuf(rx_ring, ena_rx_ctx, mbuf); - - ena_trace(ENA_DBG | ENA_RXPTH, "rx mbuf 0x%p, flags=0x%x, len: %d\n", - mbuf, mbuf->m_flags, mbuf->m_pkthdr.len); - - /* DMA address is not needed anymore, unmap it */ - bus_dmamap_unload(rx_ring->adapter->rx_buf_tag, rx_info->map); - - rx_info->mbuf = NULL; - rx_ring->free_rx_ids[ntc] = req_id; - ntc = ENA_RX_RING_IDX_NEXT(ntc, rx_ring->ring_size); - - /* - * While we have more than 1 descriptors for one rcvd packet, append - * other mbufs to the main one - */ - while (--descs) { - ++buf; - len = ena_bufs[buf].len; - req_id = ena_bufs[buf].req_id; - rc = validate_rx_req_id(rx_ring, req_id); - if (unlikely(rc != 0)) { - /* - * If the req_id is invalid, then the device will be - * reset. In that case we must free all mbufs that - * were already gathered. - */ - m_freem(mbuf); - return (NULL); - } - rx_info = &rx_ring->rx_buffer_info[req_id]; - - if (unlikely(rx_info->mbuf == NULL)) { - device_printf(adapter->pdev, "NULL mbuf in rx_info"); - /* - * If one of the required mbufs was not allocated yet, - * we can break there. - * All earlier used descriptors will be reallocated - * later and not used mbufs can be reused. - * The next_to_clean pointer will not be updated in case - * of an error, so caller should advance it manually - * in error handling routine to keep it up to date - * with hw ring. - */ - m_freem(mbuf); - return (NULL); - } - - bus_dmamap_sync(adapter->rx_buf_tag, rx_info->map, - BUS_DMASYNC_POSTREAD); - if (unlikely(m_append(mbuf, len, rx_info->mbuf->m_data) == 0)) { - counter_u64_add(rx_ring->rx_stats.mbuf_alloc_fail, 1); - ena_trace(ENA_WARNING, "Failed to append Rx mbuf %p\n", - mbuf); - } - - ena_trace(ENA_DBG | ENA_RXPTH, - "rx mbuf updated. len %d\n", mbuf->m_pkthdr.len); - - /* Free already appended mbuf, it won't be useful anymore */ - bus_dmamap_unload(rx_ring->adapter->rx_buf_tag, rx_info->map); - m_freem(rx_info->mbuf); - rx_info->mbuf = NULL; - - rx_ring->free_rx_ids[ntc] = req_id; - ntc = ENA_RX_RING_IDX_NEXT(ntc, rx_ring->ring_size); - } - - *next_to_clean = ntc; - - return (mbuf); -} - -/** - * ena_rx_checksum - indicate in mbuf if hw indicated a good cksum - **/ -static inline void -ena_rx_checksum(struct ena_ring *rx_ring, struct ena_com_rx_ctx *ena_rx_ctx, - struct mbuf *mbuf) -{ - - /* if IP and error */ - if (unlikely((ena_rx_ctx->l3_proto == ENA_ETH_IO_L3_PROTO_IPV4) && - ena_rx_ctx->l3_csum_err)) { - /* ipv4 checksum error */ - mbuf->m_pkthdr.csum_flags = 0; - counter_u64_add(rx_ring->rx_stats.bad_csum, 1); - ena_trace(ENA_DBG, "RX IPv4 header checksum error\n"); - return; - } - - /* if TCP/UDP */ - if ((ena_rx_ctx->l4_proto == ENA_ETH_IO_L4_PROTO_TCP) || - (ena_rx_ctx->l4_proto == ENA_ETH_IO_L4_PROTO_UDP)) { - if (ena_rx_ctx->l4_csum_err) { - /* TCP/UDP checksum error */ - mbuf->m_pkthdr.csum_flags = 0; - counter_u64_add(rx_ring->rx_stats.bad_csum, 1); - ena_trace(ENA_DBG, "RX L4 checksum error\n"); - } else { - mbuf->m_pkthdr.csum_flags = CSUM_IP_CHECKED; - mbuf->m_pkthdr.csum_flags |= CSUM_IP_VALID; - } - } -} - -/** - * ena_rx_cleanup - handle rx irq - * @arg: ring for which irq is being handled - **/ -static int -ena_rx_cleanup(struct ena_ring *rx_ring) -{ - struct ena_adapter *adapter; - struct mbuf *mbuf; - struct ena_com_rx_ctx ena_rx_ctx; - struct ena_com_io_cq* io_cq; - struct ena_com_io_sq* io_sq; - if_t ifp; - uint16_t ena_qid; - uint16_t next_to_clean; - uint32_t refill_required; - uint32_t refill_threshold; - uint32_t do_if_input = 0; - unsigned int qid; - int rc, i; - int budget = RX_BUDGET; - - adapter = rx_ring->que->adapter; - ifp = adapter->ifp; - qid = rx_ring->que->id; - ena_qid = ENA_IO_RXQ_IDX(qid); - io_cq = &adapter->ena_dev->io_cq_queues[ena_qid]; - io_sq = &adapter->ena_dev->io_sq_queues[ena_qid]; - next_to_clean = rx_ring->next_to_clean; - - ena_trace(ENA_DBG, "rx: qid %d\n", qid); - - do { - ena_rx_ctx.ena_bufs = rx_ring->ena_bufs; - ena_rx_ctx.max_bufs = adapter->max_rx_sgl_size; - ena_rx_ctx.descs = 0; - bus_dmamap_sync(io_cq->cdesc_addr.mem_handle.tag, - io_cq->cdesc_addr.mem_handle.map, BUS_DMASYNC_POSTREAD); - rc = ena_com_rx_pkt(io_cq, io_sq, &ena_rx_ctx); - - if (unlikely(rc != 0)) - goto error; - - if (unlikely(ena_rx_ctx.descs == 0)) - break; - - ena_trace(ENA_DBG | ENA_RXPTH, "rx: q %d got packet from ena. " - "descs #: %d l3 proto %d l4 proto %d hash: %x\n", - rx_ring->qid, ena_rx_ctx.descs, ena_rx_ctx.l3_proto, - ena_rx_ctx.l4_proto, ena_rx_ctx.hash); - - /* Receive mbuf from the ring */ - mbuf = ena_rx_mbuf(rx_ring, rx_ring->ena_bufs, - &ena_rx_ctx, &next_to_clean); - bus_dmamap_sync(io_cq->cdesc_addr.mem_handle.tag, - io_cq->cdesc_addr.mem_handle.map, BUS_DMASYNC_PREREAD); - /* Exit if we failed to retrieve a buffer */ - if (unlikely(mbuf == NULL)) { - for (i = 0; i < ena_rx_ctx.descs; ++i) { - rx_ring->free_rx_ids[next_to_clean] = - rx_ring->ena_bufs[i].req_id; - next_to_clean = - ENA_RX_RING_IDX_NEXT(next_to_clean, - rx_ring->ring_size); - - } - break; - } - - if (((ifp->if_capenable & IFCAP_RXCSUM) != 0) || - ((ifp->if_capenable & IFCAP_RXCSUM_IPV6) != 0)) { - ena_rx_checksum(rx_ring, &ena_rx_ctx, mbuf); - } - - counter_enter(); - counter_u64_add_protected(rx_ring->rx_stats.bytes, - mbuf->m_pkthdr.len); - counter_u64_add_protected(adapter->hw_stats.rx_bytes, - mbuf->m_pkthdr.len); - counter_exit(); - /* - * LRO is only for IP/TCP packets and TCP checksum of the packet - * should be computed by hardware. - */ - do_if_input = 1; - if (((ifp->if_capenable & IFCAP_LRO) != 0) && - ((mbuf->m_pkthdr.csum_flags & CSUM_IP_VALID) != 0) && - (ena_rx_ctx.l4_proto == ENA_ETH_IO_L4_PROTO_TCP)) { - /* - * Send to the stack if: - * - LRO not enabled, or - * - no LRO resources, or - * - lro enqueue fails - */ - if ((rx_ring->lro.lro_cnt != 0) && - (tcp_lro_rx(&rx_ring->lro, mbuf, 0) == 0)) - do_if_input = 0; - } - if (do_if_input != 0) { - ena_trace(ENA_DBG | ENA_RXPTH, - "calling if_input() with mbuf %p\n", mbuf); - (*ifp->if_input)(ifp, mbuf); - } - - counter_enter(); - counter_u64_add_protected(rx_ring->rx_stats.cnt, 1); - counter_u64_add_protected(adapter->hw_stats.rx_packets, 1); - counter_exit(); - } while (--budget); - - rx_ring->next_to_clean = next_to_clean; - - refill_required = ena_com_free_desc(io_sq); - refill_threshold = min_t(int, - rx_ring->ring_size / ENA_RX_REFILL_THRESH_DIVIDER, - ENA_RX_REFILL_THRESH_PACKET); - - if (refill_required > refill_threshold) { - ena_com_update_dev_comp_head(rx_ring->ena_com_io_cq); - ena_refill_rx_bufs(rx_ring, refill_required); - } - - tcp_lro_flush_all(&rx_ring->lro); - - return (RX_BUDGET - budget); - -error: - counter_u64_add(rx_ring->rx_stats.bad_desc_num, 1); - - /* Too many desc from the device. Trigger reset */ - if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, adapter))) { - adapter->reset_reason = ENA_REGS_RESET_TOO_MANY_RX_DESCS; - ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter); - } - - return (0); -} - /********************************************************************* * * MSIX & Interrupt Service routine @@ -1833,52 +1299,6 @@ ena_intr_msix_mgmnt(void *arg) ena_com_aenq_intr_handler(adapter->ena_dev, arg); } -static void -ena_cleanup(void *arg, int pending) -{ - struct ena_que *que = arg; - struct ena_adapter *adapter = que->adapter; - if_t ifp = adapter->ifp; - struct ena_ring *tx_ring; - struct ena_ring *rx_ring; - struct ena_com_io_cq* io_cq; - struct ena_eth_io_intr_reg intr_reg; - int qid, ena_qid; - int txc, rxc, i; - - if (unlikely((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)) - return; - - ena_trace(ENA_DBG, "MSI-X TX/RX routine\n"); - - tx_ring = que->tx_ring; - rx_ring = que->rx_ring; - qid = que->id; - ena_qid = ENA_IO_TXQ_IDX(qid); - io_cq = &adapter->ena_dev->io_cq_queues[ena_qid]; - - tx_ring->first_interrupt = true; - rx_ring->first_interrupt = true; - - for (i = 0; i < CLEAN_BUDGET; ++i) { - rxc = ena_rx_cleanup(rx_ring); - txc = ena_tx_cleanup(tx_ring); - - if (unlikely((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)) - return; - - if ((txc != TX_BUDGET) && (rxc != RX_BUDGET)) - break; - } - - /* Signal that work is done and unmask interrupt */ - ena_com_update_intr_reg(&intr_reg, - RX_IRQ_INTERVAL, - TX_IRQ_INTERVAL, - true); - ena_com_unmask_intr(io_cq, &intr_reg); -} - /** * ena_handle_msix - MSIX Interrupt Handler for Tx/Rx * @arg: queue @@ -2289,7 +1709,7 @@ ena_up_complete(struct ena_adapter *adapter) return (0); } -static int +int ena_up(struct ena_adapter *adapter) { int rc = 0; @@ -2666,7 +2086,7 @@ ena_setup_ifnet(device_t pdev, struct ena_adapter *ada return (0); } -static void +void ena_down(struct ena_adapter *adapter) { int rc; @@ -2701,579 +2121,7 @@ ena_down(struct ena_adapter *adapter) } } -static void -ena_tx_csum(struct ena_com_tx_ctx *ena_tx_ctx, struct mbuf *mbuf) -{ - struct ena_com_tx_meta *ena_meta; - struct ether_vlan_header *eh; - struct mbuf *mbuf_next; - u32 mss; - bool offload; - uint16_t etype; - int ehdrlen; - struct ip *ip; - int iphlen; - struct tcphdr *th; - int offset; - - offload = false; - ena_meta = &ena_tx_ctx->ena_meta; - mss = mbuf->m_pkthdr.tso_segsz; - - if (mss != 0) - offload = true; - - if ((mbuf->m_pkthdr.csum_flags & CSUM_TSO) != 0) - offload = true; - - if ((mbuf->m_pkthdr.csum_flags & CSUM_OFFLOAD) != 0) - offload = true; - - if (!offload) { - ena_tx_ctx->meta_valid = 0; - return; - } - - /* Determine where frame payload starts. */ - eh = mtod(mbuf, struct ether_vlan_header *); - if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { - etype = ntohs(eh->evl_proto); - ehdrlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; - } else { - etype = ntohs(eh->evl_encap_proto); - ehdrlen = ETHER_HDR_LEN; - } - - mbuf_next = m_getptr(mbuf, ehdrlen, &offset); - ip = (struct ip *)(mtodo(mbuf_next, offset)); - iphlen = ip->ip_hl << 2; - - mbuf_next = m_getptr(mbuf, iphlen + ehdrlen, &offset); - th = (struct tcphdr *)(mtodo(mbuf_next, offset)); - - if ((mbuf->m_pkthdr.csum_flags & CSUM_IP) != 0) { - ena_tx_ctx->l3_csum_enable = 1; - } - if ((mbuf->m_pkthdr.csum_flags & CSUM_TSO) != 0) { - ena_tx_ctx->tso_enable = 1; - ena_meta->l4_hdr_len = (th->th_off); - } - - switch (etype) { - case ETHERTYPE_IP: - ena_tx_ctx->l3_proto = ENA_ETH_IO_L3_PROTO_IPV4; - if ((ip->ip_off & htons(IP_DF)) != 0) - ena_tx_ctx->df = 1; - break; - case ETHERTYPE_IPV6: - ena_tx_ctx->l3_proto = ENA_ETH_IO_L3_PROTO_IPV6; - - default: - break; - } - - if (ip->ip_p == IPPROTO_TCP) { - ena_tx_ctx->l4_proto = ENA_ETH_IO_L4_PROTO_TCP; - if ((mbuf->m_pkthdr.csum_flags & - (CSUM_IP_TCP | CSUM_IP6_TCP)) != 0) - ena_tx_ctx->l4_csum_enable = 1; - else - ena_tx_ctx->l4_csum_enable = 0; - } else if (ip->ip_p == IPPROTO_UDP) { - ena_tx_ctx->l4_proto = ENA_ETH_IO_L4_PROTO_UDP; - if ((mbuf->m_pkthdr.csum_flags & - (CSUM_IP_UDP | CSUM_IP6_UDP)) != 0) - ena_tx_ctx->l4_csum_enable = 1; - else - ena_tx_ctx->l4_csum_enable = 0; - } else { - ena_tx_ctx->l4_proto = ENA_ETH_IO_L4_PROTO_UNKNOWN; - ena_tx_ctx->l4_csum_enable = 0; - } - - ena_meta->mss = mss; - ena_meta->l3_hdr_len = iphlen; - ena_meta->l3_hdr_offset = ehdrlen; - ena_tx_ctx->meta_valid = 1; -} - static int -ena_check_and_collapse_mbuf(struct ena_ring *tx_ring, struct mbuf **mbuf) -{ - struct ena_adapter *adapter; - struct mbuf *collapsed_mbuf; - int num_frags; - - adapter = tx_ring->adapter; - num_frags = ena_mbuf_count(*mbuf); - - /* One segment must be reserved for configuration descriptor. */ - if (num_frags < adapter->max_tx_sgl_size) - return (0); - counter_u64_add(tx_ring->tx_stats.collapse, 1); - - collapsed_mbuf = m_collapse(*mbuf, M_NOWAIT, - adapter->max_tx_sgl_size - 1); - if (unlikely(collapsed_mbuf == NULL)) { - counter_u64_add(tx_ring->tx_stats.collapse_err, 1); - return (ENOMEM); - } - - /* If mbuf was collapsed succesfully, original mbuf is released. */ - *mbuf = collapsed_mbuf; - - return (0); -} - -static void -ena_dmamap_llq(void *arg, bus_dma_segment_t *segs, int nseg, int error) -{ - struct ena_com_buf *ena_buf = arg; - - if (unlikely(error != 0)) { - ena_buf->paddr = 0; - return; - } - - KASSERT(nseg == 1, ("Invalid num of segments for LLQ dma")); - - ena_buf->paddr = segs->ds_addr; - ena_buf->len = segs->ds_len; -} - -static int -ena_tx_map_mbuf(struct ena_ring *tx_ring, struct ena_tx_buffer *tx_info, - struct mbuf *mbuf, void **push_hdr, u16 *header_len) -{ - struct ena_adapter *adapter = tx_ring->adapter; - struct ena_com_buf *ena_buf; - bus_dma_segment_t segs[ENA_BUS_DMA_SEGS]; - uint32_t mbuf_head_len, frag_len; - uint16_t push_len = 0; - uint16_t delta = 0; - int i, rc, nsegs; - - mbuf_head_len = mbuf->m_len; - tx_info->mbuf = mbuf; - ena_buf = tx_info->bufs; - - if (tx_ring->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) { - /* - * When the device is LLQ mode, the driver will copy - * the header into the device memory space. - * the ena_com layer assumes the header is in a linear - * memory space. - * This assumption might be wrong since part of the header - * can be in the fragmented buffers. - * First check if header fits in the mbuf. If not, copy it to - * separate buffer that will be holding linearized data. - */ - push_len = min_t(uint32_t, mbuf->m_pkthdr.len, - tx_ring->tx_max_header_size); - *header_len = push_len; - /* If header is in linear space, just point into mbuf's data. */ - if (likely(push_len <= mbuf_head_len)) { - *push_hdr = mbuf->m_data; - /* - * Otherwise, copy whole portion of header from multiple mbufs - * to intermediate buffer. - */ - } else { - m_copydata(mbuf, 0, push_len, - tx_ring->push_buf_intermediate_buf); - *push_hdr = tx_ring->push_buf_intermediate_buf; - - counter_u64_add(tx_ring->tx_stats.llq_buffer_copy, 1); - delta = push_len - mbuf_head_len; - } - - ena_trace(ENA_DBG | ENA_TXPTH, - "mbuf: %p header_buf->vaddr: %p push_len: %d\n", - mbuf, *push_hdr, push_len); - - /* - * If header was in linear memory space, map for the dma rest of the data - * in the first mbuf of the mbuf chain. - */ - if (mbuf_head_len > push_len) { - rc = bus_dmamap_load(adapter->tx_buf_tag, - tx_info->map_head, - mbuf->m_data + push_len, mbuf_head_len - push_len, - ena_dmamap_llq, ena_buf, BUS_DMA_NOWAIT); - if (unlikely((rc != 0) || (ena_buf->paddr == 0))) - goto single_dma_error; - - ena_buf++; - tx_info->num_of_bufs++; - - tx_info->head_mapped = true; - } - mbuf = mbuf->m_next; - } else { - *push_hdr = NULL; - /* - * header_len is just a hint for the device. Because FreeBSD is not - * giving us information about packet header length and it is not - * guaranteed that all packet headers will be in the 1st mbuf, setting - * header_len to 0 is making the device ignore this value and resolve - * header on it's own. - */ - *header_len = 0; - } - - /* - * If header is in non linear space (delta > 0), then skip mbufs - * containing header and map the last one containing both header and the - * packet data. - * The first segment is already counted in. - * If LLQ is not supported, the loop will be skipped. - */ - while (delta > 0) { - frag_len = mbuf->m_len; - - /* - * If whole segment contains header just move to the - * next one and reduce delta. - */ - if (unlikely(delta >= frag_len)) { - delta -= frag_len; - } else { - /* - * Map rest of the packet data that was contained in - * the mbuf. - */ - rc = bus_dmamap_load(adapter->tx_buf_tag, - tx_info->map_head, mbuf->m_data + delta, - frag_len - delta, ena_dmamap_llq, ena_buf, - BUS_DMA_NOWAIT); - if (unlikely((rc != 0) || (ena_buf->paddr == 0))) - goto single_dma_error; - - ena_buf++; - tx_info->num_of_bufs++; - tx_info->head_mapped = true; - - delta = 0; - } - - mbuf = mbuf->m_next; - } - - if (mbuf == NULL) { - return (0); - } - - /* Map rest of the mbufs */ - rc = bus_dmamap_load_mbuf_sg(adapter->tx_buf_tag, tx_info->map_seg, mbuf, - segs, &nsegs, BUS_DMA_NOWAIT); - if (unlikely((rc != 0) || (nsegs == 0))) { - ena_trace(ENA_WARNING, - "dmamap load failed! err: %d nsegs: %d\n", rc, nsegs); - goto dma_error; - } - - for (i = 0; i < nsegs; i++) { - ena_buf->len = segs[i].ds_len; - ena_buf->paddr = segs[i].ds_addr; - ena_buf++; - } - tx_info->num_of_bufs += nsegs; - tx_info->seg_mapped = true; - - return (0); - -dma_error: - if (tx_info->head_mapped == true) - bus_dmamap_unload(adapter->tx_buf_tag, tx_info->map_head); -single_dma_error: - counter_u64_add(tx_ring->tx_stats.dma_mapping_err, 1); - tx_info->mbuf = NULL; - return (rc); -} - -static int -ena_xmit_mbuf(struct ena_ring *tx_ring, struct mbuf **mbuf) -{ - struct ena_adapter *adapter; - struct ena_tx_buffer *tx_info; - struct ena_com_tx_ctx ena_tx_ctx; - struct ena_com_dev *ena_dev; - struct ena_com_io_sq* io_sq; - void *push_hdr; - uint16_t next_to_use; - uint16_t req_id; - uint16_t ena_qid; - uint16_t header_len; - int rc; - int nb_hw_desc; - - ena_qid = ENA_IO_TXQ_IDX(tx_ring->que->id); - adapter = tx_ring->que->adapter; - ena_dev = adapter->ena_dev; - io_sq = &ena_dev->io_sq_queues[ena_qid]; - - rc = ena_check_and_collapse_mbuf(tx_ring, mbuf); - if (unlikely(rc != 0)) { - ena_trace(ENA_WARNING, - "Failed to collapse mbuf! err: %d\n", rc); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Oct 31 15:51:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0711F15D614; Thu, 31 Oct 2019 15:51:20 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473qYg6RgLz4V4K; Thu, 31 Oct 2019 15:51:19 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C17C524FA1; Thu, 31 Oct 2019 15:51:19 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9VFpJji060538; Thu, 31 Oct 2019 15:51:19 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9VFpIo8060532; Thu, 31 Oct 2019 15:51:18 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201910311551.x9VFpIo8060532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Thu, 31 Oct 2019 15:51:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354221 - in head/sys: contrib/ena-com dev/ena modules/ena X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: in head/sys: contrib/ena-com dev/ena modules/ena X-SVN-Commit-Revision: 354221 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 15:51:20 -0000 Author: mw Date: Thu Oct 31 15:51:18 2019 New Revision: 354221 URL: https://svnweb.freebsd.org/changeset/base/354221 Log: Introduce NETMAP support in ENA Mock implementation of NETMAP routines is located in ena_netmap.c/.h files. All code is protected under the DEV_NETMAP macro. Makefile was updated with files and flag. As ENA driver provide own implementations of (un)likely it must be undefined before including NETMAP headers. ena_netmap_attach function is called on the end of NIC attach. It fills structure with NIC configuration and callbacks. Then provides it to netmap_attach. Similarly netmap_detach is called during ena_detach. Three callbacks are used. nm_register is implemented by ena_netmap_reg. It is called when user space application open or close NIC in NETMAP mode. Current action is recognized based on onoff parameter: true means on and false off. As NICs rings need to be reconfigured ena_down and ena_up are reused. When user space application wants to receive new packets from NIC nm_rxsync is called, and when there are new packets ready for Tx nm_txsync is called. Differential Revision: https://reviews.freebsd.org/D21934 Submitted by: Rafal Kozik Michal Krawczyk Obtained from: Semihalf Sponsored by: Amazon, Inc. Added: head/sys/dev/ena/ena_netmap.c (contents, props changed) head/sys/dev/ena/ena_netmap.h (contents, props changed) Modified: head/sys/contrib/ena-com/ena_plat.h head/sys/dev/ena/ena.c head/sys/modules/ena/Makefile Modified: head/sys/contrib/ena-com/ena_plat.h ============================================================================== --- head/sys/contrib/ena-com/ena_plat.h Thu Oct 31 15:44:26 2019 (r354220) +++ head/sys/contrib/ena-com/ena_plat.h Thu Oct 31 15:51:18 2019 (r354221) @@ -103,6 +103,7 @@ extern struct ena_bus_space ebs; #define ENA_RSC (1 << 6) /* Goes with TXPTH or RXPTH, free/alloc res. */ #define ENA_IOQ (1 << 7) /* Detailed info about IO queues. */ #define ENA_ADMQ (1 << 8) /* Detailed info about admin queue. */ +#define ENA_NETMAP (1 << 9) /* Detailed info about netmap. */ extern int ena_log_level; Modified: head/sys/dev/ena/ena.c ============================================================================== --- head/sys/dev/ena/ena.c Thu Oct 31 15:44:26 2019 (r354220) +++ head/sys/dev/ena/ena.c Thu Oct 31 15:51:18 2019 (r354221) @@ -80,6 +80,10 @@ __FBSDID("$FreeBSD$"); #include "ena.h" #include "ena_sysctl.h" +#ifdef DEV_NETMAP +#include "ena_netmap.h" +#endif /* DEV_NETMAP */ + /********************************************************* * Function prototypes *********************************************************/ @@ -3317,12 +3321,24 @@ ena_attach(device_t pdev) sizeof(struct ena_hw_stats)); ena_sysctl_add_nodes(adapter); +#ifdef DEV_NETMAP + rc = ena_netmap_attach(adapter); + if (rc != 0) { + device_printf(pdev, "netmap attach failed: %d\n", rc); + goto err_detach; + } +#endif /* DEV_NETMAP */ + /* Tell the stack that the interface is not active */ if_setdrvflagbits(adapter->ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); ENA_FLAG_SET_ATOMIC(ENA_FLAG_DEVICE_RUNNING, adapter); return (0); +#ifdef DEV_NETMAP +err_detach: + ether_ifdetach(adapter->ifp); +#endif /* DEV_NETMAP */ err_msix_free: ena_com_dev_reset(adapter->ena_dev, ENA_REGS_RESET_INIT_ERR); ena_free_mgmnt_irq(adapter); @@ -3378,6 +3394,10 @@ ena_detach(device_t pdev) ena_destroy_device(adapter, true); sx_unlock(&adapter->ioctl_sx); +#ifdef DEV_NETMAP + netmap_detach(adapter->ifp); +#endif /* DEV_NETMAP */ + ena_free_all_io_rings_resources(adapter); ena_free_counters((counter_u64_t *)&adapter->hw_stats, @@ -3518,5 +3538,8 @@ MODULE_PNP_INFO("U16:vendor;U16:device", pci, ena, ena nitems(ena_vendor_info_array) - 1); MODULE_DEPEND(ena, pci, 1, 1, 1); MODULE_DEPEND(ena, ether, 1, 1, 1); +#ifdef DEV_NETMAP +MODULE_DEPEND(ena, netmap, 1, 1, 1); +#endif /* DEV_NETMAP */ /*********************************************************************/ Added: head/sys/dev/ena/ena_netmap.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/ena/ena_netmap.c Thu Oct 31 15:51:18 2019 (r354221) @@ -0,0 +1,111 @@ +/*- + * BSD LICENSE + * + * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates. + * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include +__FBSDID("$FreeBSD$"); + +#ifdef DEV_NETMAP + +#include "ena.h" +#include "ena_netmap.h" + +static int ena_netmap_reg(struct netmap_adapter *, int); +static int ena_netmap_txsync(struct netmap_kring *, int); +static int ena_netmap_rxsync(struct netmap_kring *, int); + +int +ena_netmap_attach(struct ena_adapter *adapter) +{ + struct netmap_adapter na; + + ena_trace(ENA_NETMAP, "netmap attach\n"); + + bzero(&na, sizeof(na)); + na.na_flags = NAF_MOREFRAG; + na.ifp = adapter->ifp; + na.num_tx_desc = adapter->tx_ring_size; + na.num_rx_desc = adapter->rx_ring_size; + na.num_tx_rings = adapter->num_queues; + na.num_rx_rings = adapter->num_queues; + na.rx_buf_maxsize = adapter->buf_ring_size; + na.nm_txsync = ena_netmap_txsync; + na.nm_rxsync = ena_netmap_rxsync; + na.nm_register = ena_netmap_reg; + + return (netmap_attach(&na)); +} + +static int +ena_netmap_reg(struct netmap_adapter *na, int onoff) +{ + struct ifnet *ifp = na->ifp; + struct ena_adapter* adapter = ifp->if_softc; + int rc; + + sx_xlock(&adapter->ioctl_sx); + ENA_FLAG_CLEAR_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter); + ena_down(adapter); + + if (onoff) { + ena_trace(ENA_NETMAP, "netmap on\n"); + nm_set_native_flags(na); + } else { + ena_trace(ENA_NETMAP, "netmap off\n"); + nm_clear_native_flags(na); + } + + rc = ena_up(adapter); + if (rc != 0) { + ena_trace(ENA_WARNING, "ena_up failed with rc=%d\n", rc); + adapter->reset_reason = ENA_REGS_RESET_DRIVER_INVALID_STATE; + nm_clear_native_flags(na); + ena_destroy_device(adapter, false); + ENA_FLAG_SET_ATOMIC(ENA_FLAG_DEV_UP_BEFORE_RESET, adapter); + rc = ena_restore_device(adapter); + } + sx_unlock(&adapter->ioctl_sx); + + return (rc); +} + +static int +ena_netmap_txsync(struct netmap_kring *kring, int flags) +{ + ena_trace(ENA_NETMAP, "netmap txsync\n"); + return (0); +} + +static int +ena_netmap_rxsync(struct netmap_kring *kring, int flags) +{ + ena_trace(ENA_NETMAP, "netmap rxsync\n"); + return (0); +} + +#endif /* DEV_NETMAP */ Added: head/sys/dev/ena/ena_netmap.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/ena/ena_netmap.h Thu Oct 31 15:51:18 2019 (r354221) @@ -0,0 +1,51 @@ +/*- + * BSD LICENSE + * + * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates. + * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + * + */ + +#ifndef _ENA_NETMAP_H_ +#define _ENA_NETMAP_H_ + +/* Undef (un)likely as they are defined in netmap_kern.h */ +#ifdef likely +#undef likely +#endif /* likely */ +#ifdef unlikely +#undef unlikely +#endif /* unlikely */ + +#include +#include +#include + +int ena_netmap_attach(struct ena_adapter *); + +#endif /* _ENA_NETMAP_H_ */ Modified: head/sys/modules/ena/Makefile ============================================================================== --- head/sys/modules/ena/Makefile Thu Oct 31 15:44:26 2019 (r354220) +++ head/sys/modules/ena/Makefile Thu Oct 31 15:51:18 2019 (r354221) @@ -34,7 +34,8 @@ ${SRCTOP}/sys/contrib/ena-com KMOD = if_ena -SRCS = ena.c ena_com.c ena_eth_com.c ena_sysctl.c ena_datapath.c +SRCS = ena_com.c ena_eth_com.c +SRCS += ena.c ena_sysctl.c ena_datapath.c ena_netmap.c SRCS += device_if.h bus_if.h pci_if.h CFLAGS += -I${SRCTOP}/sys/contrib From owner-svn-src-head@freebsd.org Thu Oct 31 15:57:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0599D15D982; Thu, 31 Oct 2019 15:57:46 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473qj56vrsz4VTB; Thu, 31 Oct 2019 15:57:45 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D02F725024; Thu, 31 Oct 2019 15:57:45 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9VFvjZ6065192; Thu, 31 Oct 2019 15:57:45 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9VFviVO065187; Thu, 31 Oct 2019 15:57:44 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201910311557.x9VFviVO065187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Thu, 31 Oct 2019 15:57:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354222 - head/sys/dev/ena X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/ena X-SVN-Commit-Revision: 354222 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 15:57:46 -0000 Author: mw Date: Thu Oct 31 15:57:44 2019 New Revision: 354222 URL: https://svnweb.freebsd.org/changeset/base/354222 Log: Add support for ENA NETMAP Rx Most of code used for Rx ring initialization could be reused in NETMAP. Reset of NETMAP ring and new alloc method was added. Driver decides if use kernels mbufs or NETMAPs slots based on IFCAP_NETMAP flag. It allows to reuse ena_refill_rx_bufs, which provides proper handling of Rx out of order completion. ena_netmap_alloc_rx_slot takes exactly the same arguments as ena_alloc_rx_mbuf, but instead of allocating one mbuf it takes one slot from NETMAP ring. Based on queue id proper netmap_ring is found. As NETMAP provides the "partial opening" feature not all of the rings are avaiable. Not used points to invalid ring. If there is available slot, it is taken from the ring. Its buffer is mapped to DMA and its index is stored in ena_rx_buffer field in ena_rx_buffer structure. Then ena_buf is filled with addresses and ring state is updated. Cleanup is handled by ena_netmap_free_rx_slot. It unmaps DMA and returns buffer to ring. As we could not return more bufs than we have taken and we should not override occupied slots, buf_index should be 0. It is being checked by assertion. ena_netmap_rxsync callback puts received packets back to NETMAP ring and passes them to user space by updating ring pointers. First it fills ena_netmap_ctx. Then it performs two actions: * ena_netmap_rx_frames moves received frames from NIC to NETMAP ring, * ena_netmap_rx_cleanup fills NIC ring with slots released by userspace app. In case of Rx error that could be handled by NIC driver (for example by performing reset) rx sync should return 0. ena_netmap_rx_frames first checks if NETMAP ring is in consistent state and then in the loop receives new frames. When all available frames are taken nr_hwtail is updated. Receiving one frame is handled by ena_netmap_rx_frame. If no error occurrs, each Descriptor is loaded by ena_netmap_rx_load_desc function. If packets take more than one segments NS_MOREFRAG flag must be set in all, but not last slot. In case of wrong req_id packet is removed from NETMAP ring. If packet is successful received counters are updated. Refiling of NIC ring is performed by ena_netmap_rx_cleanup function. It calculates number of available slots and call ena_refill_rx_bufs with proper number. Differential Revision: https://reviews.freebsd.org/D21935 Submitted by: Rafal Kozik Michal Krawczyk Obtained from: Semihalf Sponsored by: Amazon, Inc. Modified: head/sys/dev/ena/ena.c head/sys/dev/ena/ena.h head/sys/dev/ena/ena_datapath.c head/sys/dev/ena/ena_netmap.c head/sys/dev/ena/ena_netmap.h Modified: head/sys/dev/ena/ena.c ============================================================================== --- head/sys/dev/ena/ena.c Thu Oct 31 15:51:18 2019 (r354221) +++ head/sys/dev/ena/ena.c Thu Oct 31 15:57:44 2019 (r354222) @@ -764,6 +764,11 @@ ena_setup_rx_resources(struct ena_adapter *adapter, un size = sizeof(struct ena_rx_buffer) * rx_ring->ring_size; +#ifdef DEV_NETMAP + ena_netmap_reset_rx_ring(adapter, qid); + rx_ring->initialized = false; +#endif /* DEV_NETMAP */ + /* * Alloc extra element so in rx path * we can always prefetch rx_info + 1 @@ -1008,8 +1013,12 @@ ena_refill_rx_bufs(struct ena_ring *rx_ring, uint32_t req_id = rx_ring->free_rx_ids[next_to_use]; rx_info = &rx_ring->rx_buffer_info[req_id]; - - rc = ena_alloc_rx_mbuf(adapter, rx_ring, rx_info); +#ifdef DEV_NETMAP + if (adapter->ifp->if_capenable & IFCAP_NETMAP) + rc = ena_netmap_alloc_rx_slot(adapter, rx_ring, rx_info); + else +#endif /* DEV_NETMAP */ + rc = ena_alloc_rx_mbuf(adapter, rx_ring, rx_info); if (unlikely(rc != 0)) { ena_trace(ENA_WARNING, "failed to alloc buffer for rx queue %d\n", @@ -1054,6 +1063,14 @@ ena_free_rx_bufs(struct ena_adapter *adapter, unsigned if (rx_info->mbuf != NULL) ena_free_rx_mbuf(adapter, rx_ring, rx_info); +#ifdef DEV_NETMAP + if (((if_getflags(adapter->ifp) & IFF_DYING) == 0) && + (adapter->ifp->if_capenable & IFCAP_NETMAP)) { + if (rx_info->netmap_buf_idx != 0) + ena_netmap_free_rx_slot(adapter, rx_ring, + rx_info); + } +#endif /* DEV_NETMAP */ } } @@ -1072,10 +1089,12 @@ ena_refill_all_rx_bufs(struct ena_adapter *adapter) rx_ring = &adapter->rx_ring[i]; bufs_num = rx_ring->ring_size - 1; rc = ena_refill_rx_bufs(rx_ring, bufs_num); - if (unlikely(rc != bufs_num)) ena_trace(ENA_WARNING, "refilling Queue %d failed. " "Allocated %d buffers from: %d\n", i, rc, bufs_num); +#ifdef DEV_NETMAP + rx_ring->initialized = true; +#endif /* DEV_NETMAP */ } } Modified: head/sys/dev/ena/ena.h ============================================================================== --- head/sys/dev/ena/ena.h Thu Oct 31 15:51:18 2019 (r354221) +++ head/sys/dev/ena/ena.h Thu Oct 31 15:57:44 2019 (r354222) @@ -252,6 +252,9 @@ struct ena_rx_buffer { struct mbuf *mbuf; bus_dmamap_t map; struct ena_com_buf ena_buf; +#ifdef DEV_NETMAP + uint32_t netmap_buf_idx; +#endif /* DEV_NETMAP */ } __aligned(CACHE_LINE_SIZE); struct ena_stats_tx { @@ -351,6 +354,10 @@ struct ena_ring { /* Used for LLQ */ uint8_t *push_buf_intermediate_buf; + +#ifdef DEV_NETMAP + bool initialized; +#endif /* DEV_NETMAP */ } __aligned(CACHE_LINE_SIZE); struct ena_stats_dev { @@ -470,5 +477,25 @@ void ena_down(struct ena_adapter *); int ena_restore_device(struct ena_adapter *); void ena_destroy_device(struct ena_adapter *, bool); int ena_refill_rx_bufs(struct ena_ring *, uint32_t); +inline int validate_rx_req_id(struct ena_ring *, uint16_t); + +inline int +validate_rx_req_id(struct ena_ring *rx_ring, uint16_t req_id) +{ + if (likely(req_id < rx_ring->ring_size)) + return (0); + + device_printf(rx_ring->adapter->pdev, "Invalid rx req_id: %hu\n", + req_id); + counter_u64_add(rx_ring->rx_stats.bad_req_id, 1); + + /* Trigger device reset */ + if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, rx_ring->adapter))) { + rx_ring->adapter->reset_reason = ENA_REGS_RESET_INV_RX_REQ_ID; + ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, rx_ring->adapter); + } + + return (EFAULT); +} #endif /* !(ENA_H) */ Modified: head/sys/dev/ena/ena_datapath.c ============================================================================== --- head/sys/dev/ena/ena_datapath.c Thu Oct 31 15:51:18 2019 (r354221) +++ head/sys/dev/ena/ena_datapath.c Thu Oct 31 15:57:44 2019 (r354222) @@ -32,6 +32,9 @@ __FBSDID("$FreeBSD$"); #include "ena.h" #include "ena_datapath.h" +#ifdef DEV_NETMAP +#include "ena_netmap.h" +#endif /* DEV_NETMAP */ /********************************************************************* * Static functions prototypes @@ -40,7 +43,6 @@ __FBSDID("$FreeBSD$"); static int ena_tx_cleanup(struct ena_ring *); static int ena_rx_cleanup(struct ena_ring *); static inline int validate_tx_req_id(struct ena_ring *, uint16_t); -static inline int validate_rx_req_id(struct ena_ring *, uint16_t); static void ena_rx_hash_mbuf(struct ena_ring *, struct ena_com_rx_ctx *, struct mbuf *); static struct mbuf* ena_rx_mbuf(struct ena_ring *, struct ena_com_rx_buf_info *, @@ -206,25 +208,6 @@ validate_tx_req_id(struct ena_ring *tx_ring, uint16_t return (EFAULT); } -static inline int -validate_rx_req_id(struct ena_ring *rx_ring, uint16_t req_id) -{ - if (likely(req_id < rx_ring->ring_size)) - return (0); - - device_printf(rx_ring->adapter->pdev, "Invalid rx req_id: %hu\n", - req_id); - counter_u64_add(rx_ring->rx_stats.bad_req_id, 1); - - /* Trigger device reset */ - if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, rx_ring->adapter))) { - rx_ring->adapter->reset_reason = ENA_REGS_RESET_INV_RX_REQ_ID; - ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, rx_ring->adapter); - } - - return (EFAULT); -} - /** * ena_tx_cleanup - clear sent packets and corresponding descriptors * @tx_ring: ring for which we want to clean packets @@ -577,6 +560,9 @@ ena_rx_cleanup(struct ena_ring *rx_ring) unsigned int qid; int rc, i; int budget = RX_BUDGET; +#ifdef DEV_NETMAP + int done; +#endif /* DEV_NETMAP */ adapter = rx_ring->que->adapter; ifp = adapter->ifp; @@ -585,6 +571,11 @@ ena_rx_cleanup(struct ena_ring *rx_ring) io_cq = &adapter->ena_dev->io_cq_queues[ena_qid]; io_sq = &adapter->ena_dev->io_sq_queues[ena_qid]; next_to_clean = rx_ring->next_to_clean; + +#ifdef DEV_NETMAP + if (netmap_rx_irq(adapter->ifp, rx_ring->qid, &done) != NM_IRQ_PASS) + return (0); +#endif /* DEV_NETMAP */ ena_trace(ENA_DBG, "rx: qid %d\n", qid); Modified: head/sys/dev/ena/ena_netmap.c ============================================================================== --- head/sys/dev/ena/ena_netmap.c Thu Oct 31 15:51:18 2019 (r354221) +++ head/sys/dev/ena/ena_netmap.c Thu Oct 31 15:57:44 2019 (r354222) @@ -35,10 +35,37 @@ __FBSDID("$FreeBSD$"); #include "ena.h" #include "ena_netmap.h" +#define ENA_NETMAP_MORE_FRAMES 1 +#define ENA_NETMAP_NO_MORE_FRAMES 0 +#define ENA_MAX_FRAMES 16384 + +struct ena_netmap_ctx { + struct netmap_kring *kring; + struct ena_adapter *adapter; + struct netmap_adapter *na; + struct netmap_slot *slots; + struct ena_ring *ring; + struct ena_com_io_cq *io_cq; + struct ena_com_io_sq *io_sq; + u_int nm_i; + uint16_t nt; + uint16_t lim; +}; + +/* Netmap callbacks */ static int ena_netmap_reg(struct netmap_adapter *, int); static int ena_netmap_txsync(struct netmap_kring *, int); static int ena_netmap_rxsync(struct netmap_kring *, int); +/* Helper functions */ +static int ena_netmap_rx_frames(struct ena_netmap_ctx *); +static int ena_netmap_rx_frame(struct ena_netmap_ctx *); +static int ena_netmap_rx_load_desc(struct ena_netmap_ctx *, uint16_t, + int *); +static void ena_netmap_rx_cleanup(struct ena_netmap_ctx *); +static void ena_netmap_fill_ctx(struct netmap_kring *, + struct ena_netmap_ctx *, uint16_t); + int ena_netmap_attach(struct ena_adapter *adapter) { @@ -61,6 +88,124 @@ ena_netmap_attach(struct ena_adapter *adapter) return (netmap_attach(&na)); } +int +ena_netmap_alloc_rx_slot(struct ena_adapter *adapter, + struct ena_ring *rx_ring, struct ena_rx_buffer *rx_info) +{ + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_kring *kring; + struct netmap_ring *ring; + struct netmap_slot *slot; + void *addr; + uint64_t paddr; + int nm_i, qid, head, lim, rc; + + /* if previously allocated frag is not used */ + if (unlikely(rx_info->netmap_buf_idx != 0)) + return (0); + + qid = rx_ring->qid; + kring = na->rx_rings[qid]; + nm_i = kring->nr_hwcur; + head = kring->rhead; + + ena_trace(ENA_NETMAP | ENA_DBG, "nr_hwcur: %d, nr_hwtail: %d, " + "rhead: %d, rcur: %d, rtail: %d\n", kring->nr_hwcur, + kring->nr_hwtail, kring->rhead, kring->rcur, kring->rtail); + + if ((nm_i == head) && rx_ring->initialized) { + ena_trace(ENA_NETMAP, "No free slots in netmap ring\n"); + return (ENOMEM); + } + + ring = kring->ring; + if (ring == NULL) { + device_printf(adapter->pdev, "Rx ring %d is NULL\n", qid); + return (EFAULT); + } + slot = &ring->slot[nm_i]; + + addr = PNMB(na, slot, &paddr); + if (addr == NETMAP_BUF_BASE(na)) { + device_printf(adapter->pdev, "Bad buff in slot\n"); + return (EFAULT); + } + + rc = netmap_load_map(na, adapter->rx_buf_tag, rx_info->map, addr); + if (rc != 0) { + ena_trace(ENA_WARNING, "DMA mapping error\n"); + return (rc); + } + bus_dmamap_sync(adapter->rx_buf_tag, rx_info->map, BUS_DMASYNC_PREREAD); + + rx_info->ena_buf.paddr = paddr; + rx_info->ena_buf.len = ring->nr_buf_size; + rx_info->mbuf = NULL; + rx_info->netmap_buf_idx = slot->buf_idx; + + slot->buf_idx = 0; + + lim = kring->nkr_num_slots - 1; + kring->nr_hwcur = nm_next(nm_i, lim); + + return (0); +} + +void +ena_netmap_free_rx_slot(struct ena_adapter *adapter, + struct ena_ring *rx_ring, struct ena_rx_buffer *rx_info) +{ + struct netmap_adapter *na; + struct netmap_kring *kring; + struct netmap_slot *slot; + int nm_i, qid, lim; + + na = NA(adapter->ifp); + if (na == NULL) { + device_printf(adapter->pdev, "netmap adapter is NULL\n"); + return; + } + + if (na->rx_rings == NULL) { + device_printf(adapter->pdev, "netmap rings are NULL\n"); + return; + } + + qid = rx_ring->qid; + kring = na->rx_rings[qid]; + if (kring == NULL) { + device_printf(adapter->pdev, + "netmap kernel ring %d is NULL\n", qid); + return; + } + + lim = kring->nkr_num_slots - 1; + nm_i = nm_prev(kring->nr_hwcur, lim); + + if (kring->nr_mode != NKR_NETMAP_ON) + return; + + bus_dmamap_sync(adapter->rx_buf_tag, rx_info->map, + BUS_DMASYNC_POSTREAD); + netmap_unload_map(na, adapter->rx_buf_tag, rx_info->map); + + slot = &kring->ring->slot[nm_i]; + + ENA_ASSERT(slot->buf_idx == 0, "Overwrite slot buf\n"); + slot->buf_idx = rx_info->netmap_buf_idx; + slot->flags = NS_BUF_CHANGED; + + rx_info->netmap_buf_idx = 0; + kring->nr_hwcur = nm_i; +} + +void +ena_netmap_reset_rx_ring(struct ena_adapter *adapter, int qid) +{ + if (adapter->ifp->if_capenable & IFCAP_NETMAP) + netmap_reset(NA(adapter->ifp), NR_RX, qid, 0); +} + static int ena_netmap_reg(struct netmap_adapter *na, int onoff) { @@ -104,8 +249,192 @@ ena_netmap_txsync(struct netmap_kring *kring, int flag static int ena_netmap_rxsync(struct netmap_kring *kring, int flags) { - ena_trace(ENA_NETMAP, "netmap rxsync\n"); + struct ena_netmap_ctx ctx; + int rc; + + ena_netmap_fill_ctx(kring, &ctx, ENA_IO_RXQ_IDX(kring->ring_id)); + ctx.ring = &ctx.adapter->rx_ring[kring->ring_id]; + + if (ctx.kring->rhead > ctx.lim) { + /* Probably not needed to release slots from RX ring. */ + return (netmap_ring_reinit(ctx.kring)); + } + + if (unlikely((if_getdrvflags(ctx.na->ifp) & IFF_DRV_RUNNING) == 0)) + return (0); + + if (unlikely(!ENA_FLAG_ISSET(ENA_FLAG_LINK_UP, ctx.adapter))) + return (0); + + if ((rc = ena_netmap_rx_frames(&ctx)) != 0) + return (rc); + + ena_netmap_rx_cleanup(&ctx); + return (0); +} + +static inline int +ena_netmap_rx_frames(struct ena_netmap_ctx *ctx) +{ + int rc = 0; + int frames_counter = 0; + + ctx->nt = ctx->ring->next_to_clean; + ctx->nm_i = ctx->kring->nr_hwtail; + + while((rc = ena_netmap_rx_frame(ctx)) == ENA_NETMAP_MORE_FRAMES) { + frames_counter++; + /* In case of multiple frames, it is not an error. */ + rc = 0; + if (frames_counter > ENA_MAX_FRAMES) { + device_printf(ctx->adapter->pdev, + "Driver is stuck in the Rx loop\n"); + break; + } + }; + + ctx->kring->nr_hwtail = ctx->nm_i; + ctx->kring->nr_kflags &= ~NKR_PENDINTR; + ctx->ring->next_to_clean = ctx->nt; + + return (rc); +} + +static inline int +ena_netmap_rx_frame(struct ena_netmap_ctx *ctx) +{ + struct ena_com_rx_ctx ena_rx_ctx; + int rc, len = 0; + uint16_t buf, nm; + + ena_rx_ctx.ena_bufs = ctx->ring->ena_bufs; + ena_rx_ctx.max_bufs = ctx->adapter->max_rx_sgl_size; + bus_dmamap_sync(ctx->io_cq->cdesc_addr.mem_handle.tag, + ctx->io_cq->cdesc_addr.mem_handle.map, BUS_DMASYNC_POSTREAD); + + rc = ena_com_rx_pkt(ctx->io_cq, ctx->io_sq, &ena_rx_ctx); + if (unlikely(rc != 0)) { + ena_trace(ENA_ALERT, "Too many desc from the device.\n"); + counter_u64_add(ctx->ring->rx_stats.bad_desc_num, 1); + ctx->adapter->reset_reason = ENA_REGS_RESET_TOO_MANY_RX_DESCS; + ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, ctx->adapter); + return (rc); + } + if (unlikely(ena_rx_ctx.descs == 0)) + return (ENA_NETMAP_NO_MORE_FRAMES); + + ena_trace(ENA_NETMAP | ENA_DBG, "Rx: q %d got packet from ena. descs #:" + " %d l3 proto %d l4 proto %d hash: %x\n", ctx->ring->qid, + ena_rx_ctx.descs, ena_rx_ctx.l3_proto, ena_rx_ctx.l4_proto, + ena_rx_ctx.hash); + + for (buf = 0; buf < ena_rx_ctx.descs; buf++) + if ((rc = ena_netmap_rx_load_desc(ctx, buf, &len)) != 0) + break; + /* + * ena_netmap_rx_load_desc doesn't know the number of descriptors. + * It just set flag NS_MOREFRAG to all slots, then here flag of + * last slot is cleared. + */ + ctx->slots[nm_prev(ctx->nm_i, ctx->lim)].flags = NS_BUF_CHANGED; + + if (rc != 0) { + goto rx_clear_desc; + } + + bus_dmamap_sync(ctx->io_cq->cdesc_addr.mem_handle.tag, + ctx->io_cq->cdesc_addr.mem_handle.map, BUS_DMASYNC_PREREAD); + + counter_enter(); + counter_u64_add_protected(ctx->ring->rx_stats.bytes, len); + counter_u64_add_protected(ctx->adapter->hw_stats.rx_bytes, len); + counter_u64_add_protected(ctx->ring->rx_stats.cnt, 1); + counter_u64_add_protected(ctx->adapter->hw_stats.rx_packets, 1); + counter_exit(); + + return (ENA_NETMAP_MORE_FRAMES); + +rx_clear_desc: + nm = ctx->nm_i; + + /* Remove failed packet from ring */ + while(buf--) { + ctx->slots[nm].flags = 0; + ctx->slots[nm].len = 0; + nm = nm_prev(nm, ctx->lim); + } + + return (rc); +} + +static inline int +ena_netmap_rx_load_desc(struct ena_netmap_ctx *ctx, uint16_t buf, int *len) +{ + struct ena_rx_buffer *rx_info; + uint16_t req_id; + int rc; + + req_id = ctx->ring->ena_bufs[buf].req_id; + rc = validate_rx_req_id(ctx->ring, req_id); + if (unlikely(rc != 0)) + return (rc); + + rx_info = &ctx->ring->rx_buffer_info[req_id]; + bus_dmamap_sync(ctx->adapter->rx_buf_tag, rx_info->map, + BUS_DMASYNC_POSTREAD); + netmap_unload_map(ctx->na, ctx->adapter->rx_buf_tag, rx_info->map); + + ENA_ASSERT(ctx->slots[ctx->nm_i].buf_idx == 0, "Rx idx is not 0.\n"); + + ctx->slots[ctx->nm_i].buf_idx = rx_info->netmap_buf_idx; + rx_info->netmap_buf_idx = 0; + /* + * Set NS_MOREFRAG to all slots. + * Then ena_netmap_rx_frame clears it from last one. + */ + ctx->slots[ctx->nm_i].flags |= NS_MOREFRAG | NS_BUF_CHANGED; + ctx->slots[ctx->nm_i].len = ctx->ring->ena_bufs[buf].len; + *len += ctx->slots[ctx->nm_i].len; + ctx->ring->free_rx_ids[ctx->nt] = req_id; + ena_trace(ENA_DBG, "rx_info %p, buf_idx %d, paddr %jx, nm: %d\n", + rx_info, ctx->slots[ctx->nm_i].buf_idx, + (uintmax_t)rx_info->ena_buf.paddr, ctx->nm_i); + + ctx->nm_i = nm_next(ctx->nm_i, ctx->lim); + ctx->nt = ENA_RX_RING_IDX_NEXT(ctx->nt, ctx->ring->ring_size); + + return (0); +} + +static inline void +ena_netmap_rx_cleanup(struct ena_netmap_ctx *ctx) +{ + int refill_required; + + refill_required = ctx->kring->rhead - ctx->kring->nr_hwcur; + if (ctx->kring->nr_hwcur != ctx->kring->nr_hwtail) + refill_required -= 1; + + if (refill_required == 0) + return; + else if (refill_required < 0) + refill_required += ctx->kring->nkr_num_slots; + + ena_refill_rx_bufs(ctx->ring, refill_required); +} + +static inline void +ena_netmap_fill_ctx(struct netmap_kring *kring, struct ena_netmap_ctx *ctx, + uint16_t ena_qid) +{ + ctx->kring = kring; + ctx->na = kring->na; + ctx->adapter = ctx->na->ifp->if_softc; + ctx->lim = kring->nkr_num_slots - 1; + ctx->io_cq = &ctx->adapter->ena_dev->io_cq_queues[ena_qid]; + ctx->io_sq = &ctx->adapter->ena_dev->io_sq_queues[ena_qid]; + ctx->slots = kring->ring->slot; } #endif /* DEV_NETMAP */ Modified: head/sys/dev/ena/ena_netmap.h ============================================================================== --- head/sys/dev/ena/ena_netmap.h Thu Oct 31 15:51:18 2019 (r354221) +++ head/sys/dev/ena/ena_netmap.h Thu Oct 31 15:57:44 2019 (r354222) @@ -47,5 +47,10 @@ #include int ena_netmap_attach(struct ena_adapter *); +int ena_netmap_alloc_rx_slot(struct ena_adapter *, struct ena_ring *, + struct ena_rx_buffer *); +void ena_netmap_free_rx_slot(struct ena_adapter *, struct ena_ring *, + struct ena_rx_buffer *); +void ena_netmap_reset_rx_ring(struct ena_adapter *, int); #endif /* _ENA_NETMAP_H_ */ From owner-svn-src-head@freebsd.org Thu Oct 31 15:59:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 248D415DA79; Thu, 31 Oct 2019 15:59:31 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473ql66p54z4VdN; Thu, 31 Oct 2019 15:59:30 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4E2F25030; Thu, 31 Oct 2019 15:59:30 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9VFxUt5065310; Thu, 31 Oct 2019 15:59:30 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9VFxT8S065305; Thu, 31 Oct 2019 15:59:29 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201910311559.x9VFxT8S065305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Thu, 31 Oct 2019 15:59:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354223 - head/sys/dev/ena X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/ena X-SVN-Commit-Revision: 354223 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 15:59:31 -0000 Author: mw Date: Thu Oct 31 15:59:29 2019 New Revision: 354223 URL: https://svnweb.freebsd.org/changeset/base/354223 Log: Add support for ENA NETMAP Tx Two new tables are added to ena_tx_buffer structure: * netmap_map_seg stores DMA mapping structures, * netmap_buf_idx stores buff indexes taken from the slots. When Tx resources are being set, the new mapping structures are created and netmap Tx rings are being reset. When Tx resources are being released, used netmap bufs are unmapped from DMA and then mapping structures are destroyed. When Tx interrupt occurrs, ena_netmap_tx_irq is called. ena_netmap_txsync callback signalizes that there are new packets which should be transmitted. First, it fills ena_netmap_ctx. Then it performs two actions: * ena_netmap_tx_frames moves packets from netmap ring to NIC, * ena_netmap_tx_cleanup restores buffers from NIC and gives them back to the userspace app. 0 is returned in case of Tx error that could be handled by the driver. ena_netmap_tx_frames checks if there are packets ready for transmission. Then, for each of them, ena_netmap_tx_frame is called. If error occurs, transmitting is stopped, but if the error was cause due to HW ring being full, information about that is not propagated to the userspace app. When all packets are ready, doorbell is written to NIC and netmap ring state is updated. Parsing of one packet is done by the ena_netmap_tx_frame function. First, it checks if number of slots does not exceed NIC limit. Invalid packets are being dropped and the error is propagated to the upper layer. As each netmap buffer has equal size, which is typically greater then 2KiB, there shouldn't be any packets which contain too many slots. Then, the ena_com_tx_ctx structure is being filled. As netmap does not support any hardware offloads, ena_com_tx_meta structure is set to zero. After that, ena_netmap_map_slots maps all memory slots for DMA. If the device works in the LLQ mode, the push header is being determined by checking if the header fits within the first socket. If so, the portion of data is being copied directly from the slot. In other case, the data is copied to the intermediate buffer. First slots are treated the same as as the others, because DMA mapping has no impact on LLQ mode. Index of each netmap buffer is taken from slot and stored in netmap_buf_idx array. In case of mapping error, memory is unmapped and packets are put back to the netmap ring. ena_netmap_tx_cleanup performs out of order cleanup of sent buffers. First, req_id is taken and is validated. As validate_tx_req_id from ena.c is specific to kernels mbuf, another implementation is provided. Each req_id is cleaned up by ena_netmap_tx_clean_one function. Buffers are being unmaped from DMA and put back to netmap ring. In the end, state of netmap and NIC rings are being updated. Differential Revision: https://reviews.freebsd.org/D21936 Submitted by: Rafal Kozik Michal Krawczyk Obtained from: Semihalf Sponsored by: Amazon, Inc. Modified: head/sys/dev/ena/ena.c head/sys/dev/ena/ena.h head/sys/dev/ena/ena_datapath.c head/sys/dev/ena/ena_netmap.c head/sys/dev/ena/ena_netmap.h Modified: head/sys/dev/ena/ena.c ============================================================================== --- head/sys/dev/ena/ena.c Thu Oct 31 15:57:44 2019 (r354222) +++ head/sys/dev/ena/ena.c Thu Oct 31 15:59:29 2019 (r354223) @@ -103,6 +103,7 @@ static int ena_setup_tx_dma_tag(struct ena_adapter *); static int ena_free_tx_dma_tag(struct ena_adapter *); static int ena_setup_rx_dma_tag(struct ena_adapter *); static int ena_free_rx_dma_tag(struct ena_adapter *); +static void ena_release_all_tx_dmamap(struct ena_ring *); static int ena_setup_tx_resources(struct ena_adapter *, int); static void ena_free_tx_resources(struct ena_adapter *, int); static int ena_setup_all_tx_resources(struct ena_adapter *); @@ -531,6 +532,44 @@ ena_free_rx_dma_tag(struct ena_adapter *adapter) return (ret); } +static void +ena_release_all_tx_dmamap(struct ena_ring *tx_ring) +{ + struct ena_adapter *adapter = tx_ring->adapter; + struct ena_tx_buffer *tx_info; + bus_dma_tag_t tx_tag = adapter->tx_buf_tag;; + int i; +#ifdef DEV_NETMAP + struct ena_netmap_tx_info *nm_info; + int j; +#endif /* DEV_NETMAP */ + + for (i = 0; i < tx_ring->ring_size; ++i) { + tx_info = &tx_ring->tx_buffer_info[i]; +#ifdef DEV_NETMAP + if (adapter->ifp->if_capenable & IFCAP_NETMAP) { + nm_info = &tx_info->nm_info; + for (j = 0; j < ENA_PKT_MAX_BUFS; ++j) { + if (nm_info->map_seg[j] != NULL) { + bus_dmamap_destroy(tx_tag, + nm_info->map_seg[j]); + nm_info->map_seg[j] = NULL; + } + } + } +#endif /* DEV_NETMAP */ + if (tx_info->map_head != NULL) { + bus_dmamap_destroy(tx_tag, tx_info->map_head); + tx_info->map_head = NULL; + } + + if (tx_info->map_seg != NULL) { + bus_dmamap_destroy(tx_tag, tx_info->map_seg); + tx_info->map_seg = NULL; + } + } +} + /** * ena_setup_tx_resources - allocate Tx resources (Descriptors) * @adapter: network interface device structure @@ -544,7 +583,13 @@ ena_setup_tx_resources(struct ena_adapter *adapter, in struct ena_que *que = &adapter->que[qid]; struct ena_ring *tx_ring = que->tx_ring; int size, i, err; +#ifdef DEV_NETMAP + bus_dmamap_t *map; + int j; + ena_netmap_reset_tx_ring(adapter, qid); +#endif /* DEV_NETMAP */ + size = sizeof(struct ena_tx_buffer) * tx_ring->ring_size; tx_ring->tx_buffer_info = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); @@ -587,7 +632,7 @@ ena_setup_tx_resources(struct ena_adapter *adapter, in ena_trace(ENA_ALERT, "Unable to create Tx DMA map_head for buffer %d\n", i); - goto err_buf_info_unmap; + goto err_map_release; } tx_ring->tx_buffer_info[i].seg_mapped = false; @@ -597,9 +642,24 @@ ena_setup_tx_resources(struct ena_adapter *adapter, in ena_trace(ENA_ALERT, "Unable to create Tx DMA map_seg for buffer %d\n", i); - goto err_buf_info_head_unmap; + goto err_map_release; } tx_ring->tx_buffer_info[i].head_mapped = false; + +#ifdef DEV_NETMAP + if (adapter->ifp->if_capenable & IFCAP_NETMAP) { + map = tx_ring->tx_buffer_info[i].nm_info.map_seg; + for (j = 0; j < ENA_PKT_MAX_BUFS; j++) { + err = bus_dmamap_create(adapter->tx_buf_tag, 0, + &map[j]); + if (unlikely(err != 0)) { + ena_trace(ENA_ALERT, "Unable to create " + "Tx DMA for buffer %d %d\n", i, j); + goto err_map_release; + } + } + } +#endif /* DEV_NETMAP */ } /* Allocate taskqueues */ @@ -610,7 +670,7 @@ ena_setup_tx_resources(struct ena_adapter *adapter, in ena_trace(ENA_ALERT, "Unable to create taskqueue for enqueue task\n"); i = tx_ring->ring_size; - goto err_buf_info_unmap; + goto err_map_release; } tx_ring->running = true; @@ -620,17 +680,8 @@ ena_setup_tx_resources(struct ena_adapter *adapter, in return (0); -err_buf_info_head_unmap: - bus_dmamap_destroy(adapter->tx_buf_tag, - tx_ring->tx_buffer_info[i].map_head); -err_buf_info_unmap: - while (i--) { - bus_dmamap_destroy(adapter->tx_buf_tag, - tx_ring->tx_buffer_info[i].map_head); - bus_dmamap_destroy(adapter->tx_buf_tag, - tx_ring->tx_buffer_info[i].map_seg); - } - free(tx_ring->push_buf_intermediate_buf, M_DEVBUF); +err_map_release: + ena_release_all_tx_dmamap(tx_ring); err_tx_ids_free: free(tx_ring->free_tx_ids, M_DEVBUF); tx_ring->free_tx_ids = NULL; @@ -652,6 +703,10 @@ static void ena_free_tx_resources(struct ena_adapter *adapter, int qid) { struct ena_ring *tx_ring = &adapter->tx_ring[qid]; +#ifdef DEV_NETMAP + struct ena_netmap_tx_info *nm_info; + int j; +#endif /* DEV_NETMAP */ while (taskqueue_cancel(tx_ring->enqueue_tq, &tx_ring->enqueue_task, NULL)) @@ -686,6 +741,24 @@ ena_free_tx_resources(struct ena_adapter *adapter, int } bus_dmamap_destroy(adapter->tx_buf_tag, tx_ring->tx_buffer_info[i].map_seg); + +#ifdef DEV_NETMAP + if (adapter->ifp->if_capenable & IFCAP_NETMAP) { + nm_info = &tx_ring->tx_buffer_info[i].nm_info; + for (j = 0; j < ENA_PKT_MAX_BUFS; j++) { + if (nm_info->socket_buf_idx[j] != 0) { + bus_dmamap_sync(adapter->tx_buf_tag, + nm_info->map_seg[j], + BUS_DMASYNC_POSTWRITE); + ena_netmap_unload(adapter, + nm_info->map_seg[j]); + } + bus_dmamap_destroy(adapter->tx_buf_tag, + nm_info->map_seg[j]); + nm_info->socket_buf_idx[j] = 0; + } + } +#endif /* DEV_NETMAP */ m_freem(tx_ring->tx_buffer_info[i].mbuf); tx_ring->tx_buffer_info[i].mbuf = NULL; Modified: head/sys/dev/ena/ena.h ============================================================================== --- head/sys/dev/ena/ena.h Thu Oct 31 15:57:44 2019 (r354222) +++ head/sys/dev/ena/ena.h Thu Oct 31 15:59:29 2019 (r354223) @@ -226,6 +226,14 @@ struct ena_calc_queue_size_ctx { uint16_t max_rx_sgl_size; }; +#ifdef DEV_NETMAP +struct ena_netmap_tx_info { + uint32_t socket_buf_idx[ENA_PKT_MAX_BUFS]; + bus_dmamap_t map_seg[ENA_PKT_MAX_BUFS]; + unsigned int sockets_used; +}; +#endif + struct ena_tx_buffer { struct mbuf *mbuf; /* # of ena desc for this specific mbuf @@ -244,6 +252,10 @@ struct ena_tx_buffer { /* Used to detect missing tx packets */ struct bintime timestamp; bool print_once; + +#ifdef DEV_NETMAP + struct ena_netmap_tx_info nm_info; +#endif /* DEV_NETMAP */ struct ena_com_buf bufs[ENA_PKT_MAX_BUFS]; } __aligned(CACHE_LINE_SIZE); Modified: head/sys/dev/ena/ena_datapath.c ============================================================================== --- head/sys/dev/ena/ena_datapath.c Thu Oct 31 15:57:44 2019 (r354222) +++ head/sys/dev/ena/ena_datapath.c Thu Oct 31 15:59:29 2019 (r354223) @@ -239,6 +239,11 @@ ena_tx_cleanup(struct ena_ring *tx_ring) io_cq = &adapter->ena_dev->io_cq_queues[ena_qid]; next_to_clean = tx_ring->next_to_clean; +#ifdef DEV_NETMAP + if (netmap_tx_irq(adapter->ifp, tx_ring->qid) != NM_IRQ_PASS) + return (0); +#endif /* DEV_NETMAP */ + do { struct ena_tx_buffer *tx_info; struct mbuf *mbuf; Modified: head/sys/dev/ena/ena_netmap.c ============================================================================== --- head/sys/dev/ena/ena_netmap.c Thu Oct 31 15:57:44 2019 (r354222) +++ head/sys/dev/ena/ena_netmap.c Thu Oct 31 15:59:29 2019 (r354223) @@ -58,6 +58,23 @@ static int ena_netmap_txsync(struct netmap_kring *, in static int ena_netmap_rxsync(struct netmap_kring *, int); /* Helper functions */ +static int ena_netmap_tx_frames(struct ena_netmap_ctx *); +static int ena_netmap_tx_frame(struct ena_netmap_ctx *); +static inline uint16_t ena_netmap_count_slots(struct ena_netmap_ctx *); +static inline uint16_t ena_netmap_packet_len(struct netmap_slot *, u_int, + uint16_t); +static int ena_netmap_copy_data(struct netmap_adapter *, + struct netmap_slot *, u_int, uint16_t, uint16_t, void *); +static int ena_netmap_map_single_slot(struct netmap_adapter *, + struct netmap_slot *, bus_dma_tag_t, bus_dmamap_t, void **, uint64_t *); +static int ena_netmap_tx_map_slots(struct ena_netmap_ctx *, + struct ena_tx_buffer *, void **, uint16_t *, uint16_t *); +static void ena_netmap_unmap_last_socket_chain(struct ena_netmap_ctx *, + struct ena_tx_buffer *); +static void ena_netmap_tx_cleanup(struct ena_netmap_ctx *); +static uint16_t ena_netmap_tx_clean_one(struct ena_netmap_ctx *, + uint16_t); +static inline int validate_tx_req_id(struct ena_ring *, uint16_t); static int ena_netmap_rx_frames(struct ena_netmap_ctx *); static int ena_netmap_rx_frame(struct ena_netmap_ctx *); static int ena_netmap_rx_load_desc(struct ena_netmap_ctx *, uint16_t, @@ -206,6 +223,13 @@ ena_netmap_reset_rx_ring(struct ena_adapter *adapter, netmap_reset(NA(adapter->ifp), NR_RX, qid, 0); } +void +ena_netmap_reset_tx_ring(struct ena_adapter *adapter, int qid) +{ + if (adapter->ifp->if_capenable & IFCAP_NETMAP) + netmap_reset(NA(adapter->ifp), NR_TX, qid, 0); +} + static int ena_netmap_reg(struct netmap_adapter *na, int onoff) { @@ -242,11 +266,578 @@ ena_netmap_reg(struct netmap_adapter *na, int onoff) static int ena_netmap_txsync(struct netmap_kring *kring, int flags) { - ena_trace(ENA_NETMAP, "netmap txsync\n"); + struct ena_netmap_ctx ctx; + int rc = 0; + + ena_netmap_fill_ctx(kring, &ctx, ENA_IO_TXQ_IDX(kring->ring_id)); + ctx.ring = &ctx.adapter->tx_ring[kring->ring_id]; + + ENA_RING_MTX_LOCK(ctx.ring); + if (unlikely(!ENA_FLAG_ISSET(ENA_FLAG_DEV_UP, ctx.adapter))) + goto txsync_end; + + if (unlikely(!ENA_FLAG_ISSET(ENA_FLAG_LINK_UP, ctx.adapter))) + goto txsync_end; + + rc = ena_netmap_tx_frames(&ctx); + ena_netmap_tx_cleanup(&ctx); + +txsync_end: + ENA_RING_MTX_UNLOCK(ctx.ring); + return (rc); +} + +static int +ena_netmap_tx_frames(struct ena_netmap_ctx *ctx) +{ + struct ena_ring *tx_ring = ctx->ring; + int rc = 0; + + ctx->nm_i = ctx->kring->nr_hwcur; + ctx->nt = ctx->ring->next_to_use; + + __builtin_prefetch(&ctx->slots[ctx->nm_i]); + + while (ctx->nm_i != ctx->kring->rhead) { + if ((rc = ena_netmap_tx_frame(ctx)) != 0) { + /* + * When there is no empty space in Tx ring, error is + * still being returned. It should not be passed to the + * netmap, as application knows current ring state from + * netmap ring pointers. Returning error there could + * cause application to exit, but the Tx ring is commonly + * being full. + */ + if (rc == ENA_COM_NO_MEM) + rc = 0; + break; + } + tx_ring->acum_pkts++; + } + + /* If any packet was sent... */ + if (likely(ctx->nm_i != ctx->kring->nr_hwcur)) { + wmb(); + /* ...send the doorbell to the device. */ + ena_com_write_sq_doorbell(ctx->io_sq); + counter_u64_add(ctx->ring->tx_stats.doorbells, 1); + tx_ring->acum_pkts = 0; + + ctx->ring->next_to_use = ctx->nt; + ctx->kring->nr_hwcur = ctx->nm_i; + } + + return (rc); +} + +static int +ena_netmap_tx_frame(struct ena_netmap_ctx *ctx) +{ + struct ena_com_tx_ctx ena_tx_ctx; + struct ena_adapter *adapter; + struct ena_ring *tx_ring; + struct ena_tx_buffer *tx_info; + uint16_t req_id; + uint16_t header_len; + uint16_t packet_len; + int nb_hw_desc; + int rc; + void *push_hdr; + + adapter = ctx->adapter; + if (ena_netmap_count_slots(ctx) > adapter->max_tx_sgl_size) { + ena_trace(ENA_WARNING, "Too many slots per packet\n"); + return (EINVAL); + } + + tx_ring = ctx->ring; + + req_id = tx_ring->free_tx_ids[ctx->nt]; + tx_info = &tx_ring->tx_buffer_info[req_id]; + tx_info->num_of_bufs = 0; + tx_info->nm_info.sockets_used = 0; + + rc = ena_netmap_tx_map_slots(ctx, tx_info, &push_hdr, &header_len, + &packet_len); + if (unlikely(rc != 0)) { + device_printf(adapter->pdev, "Failed to map Tx slot\n"); + return (rc); + } + + bzero(&ena_tx_ctx, sizeof(struct ena_com_tx_ctx)); + ena_tx_ctx.ena_bufs = tx_info->bufs; + ena_tx_ctx.push_header = push_hdr; + ena_tx_ctx.num_bufs = tx_info->num_of_bufs; + ena_tx_ctx.req_id = req_id; + ena_tx_ctx.header_len = header_len; + + /* There are no any offloads, as the netmap doesn't support them */ + + if (tx_ring->acum_pkts == DB_THRESHOLD || + ena_com_is_doorbell_needed(ctx->io_sq, &ena_tx_ctx)) { + wmb(); + ena_com_write_sq_doorbell(ctx->io_sq); + counter_u64_add(tx_ring->tx_stats.doorbells, 1); + tx_ring->acum_pkts = 0; + } + + rc = ena_com_prepare_tx(ctx->io_sq, &ena_tx_ctx, &nb_hw_desc); + if (unlikely(rc != 0)) { + if (likely(rc == ENA_COM_NO_MEM)) { + ena_trace(ENA_NETMAP | ENA_DBG | ENA_TXPTH, + "Tx ring[%d] is out of space\n", tx_ring->que->id); + } else { + device_printf(adapter->pdev, + "Failed to prepare Tx bufs\n"); + } + counter_u64_add(tx_ring->tx_stats.prepare_ctx_err, 1); + + ena_netmap_unmap_last_socket_chain(ctx, tx_info); + return (rc); + } + + counter_enter(); + counter_u64_add_protected(tx_ring->tx_stats.cnt, 1); + counter_u64_add_protected(tx_ring->tx_stats.bytes, packet_len); + counter_u64_add_protected(adapter->hw_stats.tx_packets, 1); + counter_u64_add_protected(adapter->hw_stats.tx_bytes, packet_len); + counter_exit(); + + tx_info->tx_descs = nb_hw_desc; + + ctx->nt = ENA_TX_RING_IDX_NEXT(ctx->nt, ctx->ring->ring_size); + + for (unsigned int i = 0; i < tx_info->num_of_bufs; i++) + bus_dmamap_sync(adapter->tx_buf_tag, + tx_info->nm_info.map_seg[i], BUS_DMASYNC_PREWRITE); + return (0); } +static inline uint16_t +ena_netmap_count_slots(struct ena_netmap_ctx *ctx) +{ + uint16_t slots = 1; + uint16_t nm = ctx->nm_i; + + while ((ctx->slots[nm].flags & NS_MOREFRAG) != 0) { + slots++; + nm = nm_next(nm, ctx->lim); + } + + return slots; +} + +static inline uint16_t +ena_netmap_packet_len(struct netmap_slot *slots, u_int slot_index, + uint16_t limit) +{ + struct netmap_slot *nm_slot; + uint16_t packet_size = 0; + + do { + nm_slot = &slots[slot_index]; + packet_size += nm_slot->len; + slot_index = nm_next(slot_index, limit); + } while ((nm_slot->flags & NS_MOREFRAG) != 0); + + return packet_size; +} + static int +ena_netmap_copy_data(struct netmap_adapter *na, struct netmap_slot *slots, + u_int slot_index, uint16_t limit, uint16_t bytes_to_copy, void *destination) +{ + struct netmap_slot *nm_slot; + void *slot_vaddr; + uint16_t packet_size; + uint16_t data_amount; + + packet_size = 0; + do { + nm_slot = &slots[slot_index]; + slot_vaddr = NMB(na, nm_slot); + if (unlikely(slot_vaddr == NULL)) + return (EINVAL); + + data_amount = min_t(uint16_t, bytes_to_copy, nm_slot->len); + memcpy(destination, slot_vaddr, data_amount); + bytes_to_copy -= data_amount; + + slot_index = nm_next(slot_index, limit); + } while ((nm_slot->flags & NS_MOREFRAG) != 0 && bytes_to_copy > 0); + + return (0); +} + +static int +ena_netmap_map_single_slot(struct netmap_adapter *na, struct netmap_slot *slot, + bus_dma_tag_t dmatag, bus_dmamap_t dmamap, void **vaddr, uint64_t *paddr) +{ + int rc; + + *vaddr = PNMB(na, slot, paddr); + if (unlikely(vaddr == NULL)) { + ena_trace(ENA_ALERT, "Slot address is NULL\n"); + return (EINVAL); + } + + rc = netmap_load_map(na, dmatag, dmamap, *vaddr); + if (unlikely(rc != 0)) { + ena_trace(ENA_ALERT, "Failed to map slot %d for DMA\n", + slot->buf_idx); + return (EINVAL); + } + + return (0); +} + +static int +ena_netmap_tx_map_slots(struct ena_netmap_ctx *ctx, + struct ena_tx_buffer *tx_info, void **push_hdr, uint16_t *header_len, + uint16_t *packet_len) +{ + struct netmap_slot *slot; + struct ena_com_buf *ena_buf; + struct ena_adapter *adapter; + struct ena_ring *tx_ring; + struct ena_netmap_tx_info *nm_info; + bus_dmamap_t *nm_maps; + void *vaddr; + uint64_t paddr; + uint32_t *nm_buf_idx; + uint32_t slot_head_len; + uint32_t frag_len; + uint32_t remaining_len; + uint16_t push_len; + uint16_t delta; + int rc; + + adapter = ctx->adapter; + tx_ring = ctx->ring; + ena_buf = tx_info->bufs; + nm_info = &tx_info->nm_info; + nm_maps = nm_info->map_seg; + nm_buf_idx = nm_info->socket_buf_idx; + slot = &ctx->slots[ctx->nm_i]; + + slot_head_len = slot->len; + *packet_len = ena_netmap_packet_len(ctx->slots, ctx->nm_i, ctx->lim); + remaining_len = *packet_len; + delta = 0; + + __builtin_prefetch(&ctx->slots[ctx->nm_i + 1]); + if (tx_ring->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) { + /* + * When the device is in LLQ mode, the driver will copy + * the header into the device memory space. + * The ena_com layer assumes that the header is in a linear + * memory space. + * This assumption might be wrong since part of the header + * can be in the fragmented buffers. + * First, check if header fits in the first slot. If not, copy + * it to separate buffer that will be holding linearized data. + */ + push_len = min_t(uint32_t, *packet_len, + tx_ring->tx_max_header_size); + *header_len = push_len; + /* If header is in linear space, just point to socket's data. */ + if (likely(push_len <= slot_head_len)) { + *push_hdr = NMB(ctx->na, slot); + if (unlikely(push_hdr == NULL)) { + device_printf(adapter->pdev, + "Slot vaddress is NULL\n"); + return (EINVAL); + } + /* + * Otherwise, copy whole portion of header from multiple slots + * to intermediate buffer. + */ + } else { + rc = ena_netmap_copy_data(ctx->na, + ctx->slots, + ctx->nm_i, + ctx->lim, + push_len, + tx_ring->push_buf_intermediate_buf); + if (unlikely(rc)) { + device_printf(adapter->pdev, + "Failed to copy data from slots to push_buf\n"); + return (EINVAL); + } + + *push_hdr = tx_ring->push_buf_intermediate_buf; + counter_u64_add(tx_ring->tx_stats.llq_buffer_copy, 1); + + delta = push_len - slot_head_len; + } + + ena_trace(ENA_NETMAP | ENA_DBG | ENA_TXPTH, + "slot: %d header_buf->vaddr: %p push_len: %d\n", + slot->buf_idx, *push_hdr, push_len); + + /* + * If header was in linear memory space, map for the dma rest of the data + * in the first mbuf of the mbuf chain. + */ + if (slot_head_len > push_len) { + rc = ena_netmap_map_single_slot(ctx->na, + slot, + adapter->tx_buf_tag, + *nm_maps, + &vaddr, + &paddr); + if (unlikely(rc != 0)) { + device_printf(adapter->pdev, + "DMA mapping error\n"); + return (rc); + } + nm_maps++; + + ena_buf->paddr = paddr + push_len; + ena_buf->len = slot->len - push_len; + ena_buf++; + + tx_info->num_of_bufs++; + } + + remaining_len -= slot->len; + + /* Save buf idx before advancing */ + *nm_buf_idx = slot->buf_idx; + nm_buf_idx++; + slot->buf_idx = 0; + + /* Advance to the next socket */ + ctx->nm_i = nm_next(ctx->nm_i, ctx->lim); + slot = &ctx->slots[ctx->nm_i]; + nm_info->sockets_used++; + + /* + * If header is in non linear space (delta > 0), then skip mbufs + * containing header and map the last one containing both header + * and the packet data. + * The first segment is already counted in. + */ + while (delta > 0) { + __builtin_prefetch(&ctx->slots[ctx->nm_i + 1]); + frag_len = slot->len; + + /* + * If whole segment contains header just move to the + * next one and reduce delta. + */ + if (unlikely(delta >= frag_len)) { + delta -= frag_len; + } else { + /* + * Map the data and then assign it with the + * offsets + */ + rc = ena_netmap_map_single_slot(ctx->na, + slot, + adapter->tx_buf_tag, + *nm_maps, + &vaddr, + &paddr); + if (unlikely(rc != 0)) { + device_printf(adapter->pdev, + "DMA mapping error\n"); + goto error_map; + } + nm_maps++; + + ena_buf->paddr = paddr + delta; + ena_buf->len = slot->len - delta; + ena_buf++; + + tx_info->num_of_bufs++; + delta = 0; + } + + remaining_len -= slot->len; + + /* Save buf idx before advancing */ + *nm_buf_idx = slot->buf_idx; + nm_buf_idx++; + slot->buf_idx = 0; + + /* Advance to the next socket */ + ctx->nm_i = nm_next(ctx->nm_i, ctx->lim); + slot = &ctx->slots[ctx->nm_i]; + nm_info->sockets_used++; + } + } else { + *push_hdr = NULL; + /* + * header_len is just a hint for the device. Because netmap is + * not giving us any information about packet header length and + * it is not guaranteed that all packet headers will be in the + * 1st slot, setting header_len to 0 is making the device ignore + * this value and resolve header on it's own. + */ + *header_len = 0; + } + + /* Map all remaining data (regular routine for non-LLQ mode) */ + while (remaining_len > 0) { + __builtin_prefetch(&ctx->slots[ctx->nm_i + 1]); + + rc = ena_netmap_map_single_slot(ctx->na, + slot, + adapter->tx_buf_tag, + *nm_maps, + &vaddr, + &paddr); + if (unlikely(rc != 0)) { + device_printf(adapter->pdev, + "DMA mapping error\n"); + goto error_map; + } + nm_maps++; + + ena_buf->paddr = paddr; + ena_buf->len = slot->len; + ena_buf++; + + tx_info->num_of_bufs++; + + remaining_len -= slot->len; + + /* Save buf idx before advancing */ + *nm_buf_idx = slot->buf_idx; + nm_buf_idx++; + slot->buf_idx = 0; + + /* Advance to the next socket */ + ctx->nm_i = nm_next(ctx->nm_i, ctx->lim); + slot = &ctx->slots[ctx->nm_i]; + nm_info->sockets_used++; + } + + return (0); + +error_map: + ena_netmap_unmap_last_socket_chain(ctx, tx_info); + + return (rc); +} + +static void +ena_netmap_unmap_last_socket_chain(struct ena_netmap_ctx *ctx, + struct ena_tx_buffer *tx_info) +{ + struct ena_netmap_tx_info *nm_info; + int n; + + nm_info = &tx_info->nm_info; + + /** + * As the used sockets must not be equal to the buffers used in the LLQ + * mode, they must be treated separately. + * First, unmap the DMA maps. + */ + n = tx_info->num_of_bufs; + while (n--) { + netmap_unload_map(ctx->na, ctx->adapter->tx_buf_tag, + nm_info->map_seg[n]); + } + tx_info->num_of_bufs = 0; + + /* Next, retain the sockets back to the userspace */ + n = nm_info->sockets_used; + while (n--) { + ctx->slots[ctx->nm_i].buf_idx = nm_info->socket_buf_idx[n]; + ctx->slots[ctx->nm_i].flags = NS_BUF_CHANGED; + nm_info->socket_buf_idx[n] = 0; + ctx->nm_i = nm_prev(ctx->nm_i, ctx->lim); + } + nm_info->sockets_used = 0; +} + +static void +ena_netmap_tx_cleanup(struct ena_netmap_ctx *ctx) +{ + uint16_t req_id; + uint16_t total_tx_descs = 0; + + ctx->nm_i = ctx->kring->nr_hwtail; + ctx->nt = ctx->ring->next_to_clean; + + /* Reclaim buffers for completed transmissions */ + while (ena_com_tx_comp_req_id_get(ctx->io_cq, &req_id) >= 0) { + if (validate_tx_req_id(ctx->ring, req_id) != 0) + break; + total_tx_descs += ena_netmap_tx_clean_one(ctx, req_id); + } + + ctx->kring->nr_hwtail = ctx->nm_i; + + if (total_tx_descs > 0) { + /* acknowledge completion of sent packets */ + ctx->ring->next_to_clean = ctx->nt; + ena_com_comp_ack(ctx->ring->ena_com_io_sq, total_tx_descs); + ena_com_update_dev_comp_head(ctx->ring->ena_com_io_cq); + } +} + +static uint16_t +ena_netmap_tx_clean_one(struct ena_netmap_ctx *ctx, uint16_t req_id) +{ + struct ena_tx_buffer *tx_info; + struct ena_netmap_tx_info *nm_info; + int n; + + tx_info = &ctx->ring->tx_buffer_info[req_id]; + nm_info = &tx_info->nm_info; + + /** + * As the used sockets must not be equal to the buffers used in the LLQ + * mode, they must be treated separately. + * First, unmap the DMA maps. + */ + n = tx_info->num_of_bufs; + for (n = 0; n < tx_info->num_of_bufs; n++) { + netmap_unload_map(ctx->na, ctx->adapter->tx_buf_tag, + nm_info->map_seg[n]); + } + tx_info->num_of_bufs = 0; + + /* Next, retain the sockets back to the userspace */ + for (n = 0; n < nm_info->sockets_used; n++) { + ctx->nm_i = nm_next(ctx->nm_i, ctx->lim); + ENA_ASSERT(ctx->slots[ctx->nm_i].buf_idx == 0, + "Tx idx is not 0.\n"); + ctx->slots[ctx->nm_i].buf_idx = nm_info->socket_buf_idx[n]; + ctx->slots[ctx->nm_i].flags = NS_BUF_CHANGED; + nm_info->socket_buf_idx[n] = 0; + } + nm_info->sockets_used = 0; + + ctx->ring->free_tx_ids[ctx->nt] = req_id; + ctx->nt = ENA_TX_RING_IDX_NEXT(ctx->nt, ctx->lim); + + return tx_info->tx_descs; +} + +static inline int +validate_tx_req_id(struct ena_ring *tx_ring, uint16_t req_id) +{ + struct ena_adapter *adapter = tx_ring->adapter; + + if (likely(req_id < tx_ring->ring_size)) + return (0); + + ena_trace(ENA_WARNING, "Invalid req_id: %hu\n", req_id); + counter_u64_add(tx_ring->tx_stats.bad_req_id, 1); + + adapter->reset_reason = ENA_REGS_RESET_INV_TX_REQ_ID; + ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter); + + return (EFAULT); +} + +static int ena_netmap_rxsync(struct netmap_kring *kring, int flags) { struct ena_netmap_ctx ctx; @@ -435,6 +1026,14 @@ ena_netmap_fill_ctx(struct netmap_kring *kring, struct ctx->io_cq = &ctx->adapter->ena_dev->io_cq_queues[ena_qid]; ctx->io_sq = &ctx->adapter->ena_dev->io_sq_queues[ena_qid]; ctx->slots = kring->ring->slot; +} + +void +ena_netmap_unload(struct ena_adapter *adapter, bus_dmamap_t map) +{ + struct netmap_adapter *na = NA(adapter->ifp); + + netmap_unload_map(na, adapter->tx_buf_tag, map); } #endif /* DEV_NETMAP */ Modified: head/sys/dev/ena/ena_netmap.h ============================================================================== --- head/sys/dev/ena/ena_netmap.h Thu Oct 31 15:57:44 2019 (r354222) +++ head/sys/dev/ena/ena_netmap.h Thu Oct 31 15:59:29 2019 (r354223) @@ -52,5 +52,7 @@ int ena_netmap_alloc_rx_slot(struct ena_adapter *, str void ena_netmap_free_rx_slot(struct ena_adapter *, struct ena_ring *, struct ena_rx_buffer *); void ena_netmap_reset_rx_ring(struct ena_adapter *, int); +void ena_netmap_reset_tx_ring(struct ena_adapter *, int); +void ena_netmap_unload(struct ena_adapter *, bus_dmamap_t); #endif /* _ENA_NETMAP_H_ */ From owner-svn-src-head@freebsd.org Thu Oct 31 16:02:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C7A215DDD6; Thu, 31 Oct 2019 16:02:43 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473qpq2hwmz4W31; Thu, 31 Oct 2019 16:02:43 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 411672520D; Thu, 31 Oct 2019 16:02:43 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9VG2hNi070641; Thu, 31 Oct 2019 16:02:43 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9VG2gBo070638; Thu, 31 Oct 2019 16:02:42 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201910311602.x9VG2gBo070638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Thu, 31 Oct 2019 16:02:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354224 - head/sys/dev/ena X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/ena X-SVN-Commit-Revision: 354224 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 16:02:43 -0000 Author: mw Date: Thu Oct 31 16:02:42 2019 New Revision: 354224 URL: https://svnweb.freebsd.org/changeset/base/354224 Log: Add support for ENA NETMAP partial initialization In NETMAP mode not all queues need to be allocated to NETMAP. Some of them could be left to the kernel. Configuration is managed by the flags nr_mode and nr_pending_mode provided per each NETMAP kring. ENA driver checks those flags and perform proper rings initialization. Differential Revision: https://reviews.freebsd.org/D21937 Submitted by: Rafal Kozik Michal Krawczyk Obtained from: Semihalf Sponsored by: Amazon, Inc. Modified: head/sys/dev/ena/ena.c head/sys/dev/ena/ena_netmap.c head/sys/dev/ena/ena_netmap.h Modified: head/sys/dev/ena/ena.c ============================================================================== --- head/sys/dev/ena/ena.c Thu Oct 31 15:59:29 2019 (r354223) +++ head/sys/dev/ena/ena.c Thu Oct 31 16:02:42 2019 (r354224) @@ -1087,7 +1087,7 @@ ena_refill_rx_bufs(struct ena_ring *rx_ring, uint32_t req_id = rx_ring->free_rx_ids[next_to_use]; rx_info = &rx_ring->rx_buffer_info[req_id]; #ifdef DEV_NETMAP - if (adapter->ifp->if_capenable & IFCAP_NETMAP) + if (ena_rx_ring_in_netmap(adapter, rx_ring->qid)) rc = ena_netmap_alloc_rx_slot(adapter, rx_ring, rx_info); else #endif /* DEV_NETMAP */ Modified: head/sys/dev/ena/ena_netmap.c ============================================================================== --- head/sys/dev/ena/ena_netmap.c Thu Oct 31 15:59:29 2019 (r354223) +++ head/sys/dev/ena/ena_netmap.c Thu Oct 31 16:02:42 2019 (r354224) @@ -206,6 +206,8 @@ ena_netmap_free_rx_slot(struct ena_adapter *adapter, BUS_DMASYNC_POSTREAD); netmap_unload_map(na, adapter->rx_buf_tag, rx_info->map); + KASSERT(kring->ring == NULL, ("Netmap Rx ring is NULL\n")); + slot = &kring->ring->slot[nm_i]; ENA_ASSERT(slot->buf_idx == 0, "Overwrite slot buf\n"); @@ -216,18 +218,54 @@ ena_netmap_free_rx_slot(struct ena_adapter *adapter, kring->nr_hwcur = nm_i; } +static bool +ena_ring_in_netmap(struct ena_adapter *adapter, int qid, enum txrx x) +{ + struct netmap_adapter *na; + struct netmap_kring *kring; + + if (adapter->ifp->if_capenable & IFCAP_NETMAP) { + na = NA(adapter->ifp); + kring = (x == NR_RX) ? na->rx_rings[qid] : na->tx_rings[qid]; + if (kring->nr_mode == NKR_NETMAP_ON) + return true; + } + return false; +} + +bool +ena_tx_ring_in_netmap(struct ena_adapter *adapter, int qid) +{ + return ena_ring_in_netmap(adapter, qid, NR_TX); +} + +bool +ena_rx_ring_in_netmap(struct ena_adapter *adapter, int qid) +{ + return ena_ring_in_netmap(adapter, qid, NR_RX); +} + +static void +ena_netmap_reset_ring(struct ena_adapter *adapter, int qid, enum txrx x) +{ + if (!ena_ring_in_netmap(adapter, qid, x)) + return; + + netmap_reset(NA(adapter->ifp), x, qid, 0); + ena_trace(ENA_NETMAP, "%s ring %d is in netmap mode\n", + (x == NR_TX) ? "Tx" : "Rx", qid); +} + void ena_netmap_reset_rx_ring(struct ena_adapter *adapter, int qid) { - if (adapter->ifp->if_capenable & IFCAP_NETMAP) - netmap_reset(NA(adapter->ifp), NR_RX, qid, 0); + ena_netmap_reset_ring(adapter, qid, NR_RX); } void ena_netmap_reset_tx_ring(struct ena_adapter *adapter, int qid) { - if (adapter->ifp->if_capenable & IFCAP_NETMAP) - netmap_reset(NA(adapter->ifp), NR_TX, qid, 0); + ena_netmap_reset_ring(adapter, qid, NR_TX); } static int @@ -235,7 +273,9 @@ ena_netmap_reg(struct netmap_adapter *na, int onoff) { struct ifnet *ifp = na->ifp; struct ena_adapter* adapter = ifp->if_softc; - int rc; + struct netmap_kring *kring; + enum txrx t; + int rc, i; sx_xlock(&adapter->ioctl_sx); ENA_FLAG_CLEAR_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter); @@ -243,10 +283,26 @@ ena_netmap_reg(struct netmap_adapter *na, int onoff) if (onoff) { ena_trace(ENA_NETMAP, "netmap on\n"); + for_rx_tx(t) { + for (i = 0; i <= nma_get_nrings(na, t); i++) { + kring = NMR(na, t)[i]; + if (nm_kring_pending_on(kring)) { + kring->nr_mode = NKR_NETMAP_ON; + } + } + } nm_set_native_flags(na); } else { ena_trace(ENA_NETMAP, "netmap off\n"); nm_clear_native_flags(na); + for_rx_tx(t) { + for (i = 0; i <= nma_get_nrings(na, t); i++) { + kring = NMR(na, t)[i]; + if (nm_kring_pending_off(kring)) { + kring->nr_mode = NKR_NETMAP_OFF; + } + } + } } rc = ena_up(adapter); Modified: head/sys/dev/ena/ena_netmap.h ============================================================================== --- head/sys/dev/ena/ena_netmap.h Thu Oct 31 15:59:29 2019 (r354223) +++ head/sys/dev/ena/ena_netmap.h Thu Oct 31 16:02:42 2019 (r354224) @@ -51,6 +51,8 @@ int ena_netmap_alloc_rx_slot(struct ena_adapter *, str struct ena_rx_buffer *); void ena_netmap_free_rx_slot(struct ena_adapter *, struct ena_ring *, struct ena_rx_buffer *); +bool ena_rx_ring_in_netmap(struct ena_adapter *, int); +bool ena_tx_ring_in_netmap(struct ena_adapter *, int); void ena_netmap_reset_rx_ring(struct ena_adapter *, int); void ena_netmap_reset_tx_ring(struct ena_adapter *, int); void ena_netmap_unload(struct ena_adapter *, bus_dmamap_t); From owner-svn-src-head@freebsd.org Thu Oct 31 16:03:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 72F2E15DF78; Thu, 31 Oct 2019 16:03:44 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473qr02GLlz4WBL; Thu, 31 Oct 2019 16:03:44 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3103725219; Thu, 31 Oct 2019 16:03:44 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9VG3iNr070722; Thu, 31 Oct 2019 16:03:44 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9VG3ihm070721; Thu, 31 Oct 2019 16:03:44 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201910311603.x9VG3ihm070721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Thu, 31 Oct 2019 16:03:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354225 - head/sys/dev/ena X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/ena X-SVN-Commit-Revision: 354225 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 16:03:44 -0000 Author: mw Date: Thu Oct 31 16:03:43 2019 New Revision: 354225 URL: https://svnweb.freebsd.org/changeset/base/354225 Log: Update ENA version to v2.1.0 In this release the netmap support was introduced. Moreover, it is also now possible to use the LLQ mode of the driver on the arm64 AWS instances (A1 type). Differential Revision: https://reviews.freebsd.org/D21938 Submitted by: Michal Krawczyk Obtained from: Semihalf Sponsored by: Amazon, Inc. Modified: head/sys/dev/ena/ena.h Modified: head/sys/dev/ena/ena.h ============================================================================== --- head/sys/dev/ena/ena.h Thu Oct 31 16:02:42 2019 (r354224) +++ head/sys/dev/ena/ena.h Thu Oct 31 16:03:43 2019 (r354225) @@ -40,7 +40,7 @@ #include "ena-com/ena_eth_com.h" #define DRV_MODULE_VER_MAJOR 2 -#define DRV_MODULE_VER_MINOR 0 +#define DRV_MODULE_VER_MINOR 1 #define DRV_MODULE_VER_SUBMINOR 0 #define DRV_MODULE_NAME "ena" From owner-svn-src-head@freebsd.org Thu Oct 31 20:37:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6179165A0E; Thu, 31 Oct 2019 20:37:20 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473xvh5nvsz3KG8; Thu, 31 Oct 2019 20:37:20 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA92B28D; Thu, 31 Oct 2019 20:37:20 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9VKbKww031525; Thu, 31 Oct 2019 20:37:20 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9VKbK1k031523; Thu, 31 Oct 2019 20:37:20 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910312037.x9VKbK1k031523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 31 Oct 2019 20:37:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354227 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 354227 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 20:37:21 -0000 Author: brooks Date: Thu Oct 31 20:37:19 2019 New Revision: 354227 URL: https://svnweb.freebsd.org/changeset/base/354227 Log: Allow bsd.compat.mk to be reliably included outside Makefile.inc1. Replace explicit TARGET_* variables with COMPAT_* versions defined based on where the file is being included. Also, require that bsd.compat.mk be included directly. It's not going to be widely used so always loading it in bsd.prog.mk doesn't make sense. Instead users can include it directly. Reviewed by: imp, bdrewery (prior revision) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22059 Modified: head/share/mk/bsd.README head/share/mk/bsd.compat.mk head/share/mk/bsd.prog.mk Modified: head/share/mk/bsd.README ============================================================================== --- head/share/mk/bsd.README Thu Oct 31 20:29:45 2019 (r354226) +++ head/share/mk/bsd.README Thu Oct 31 20:37:19 2019 (r354227) @@ -379,10 +379,6 @@ LINKMODE Mode of links created with LINKS [${BINMODE}] MAN Manual pages. If no MAN variable is defined, "MAN=${PROG}.1" is assumed. See bsd.man.mk for more details. -NEED_COMPAT Build and link targeting a compatability ABI or fail if it - is not available. Supported values are "32", "soft", and - "any" being a wildcard. - PROG The name of the program to build. If not supplied, nothing is built. @@ -445,9 +441,6 @@ SUBDIR A list of subdirectories that should be built Each of the targets will execute the same target in the subdirectories. -WANT_COMPAT Similar to NEED_COMPAT, but build with the base ABI if - the specified ABI is not available. - The include file includes the file named "../Makefile.inc" if it exists, as well as the include file . @@ -470,6 +463,20 @@ If foo does not have a manual page at all, add the lin If foo has multiple source files, add the line: SRCS= a.c b.c c.c d.c + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +The include file, , allows programs (built with +) to be built for one the ABI(s) supported by the +top-level Makefile.libcompat. It requires that also be +included. + +NEED_COMPAT Build and link targeting a compatibility ABI or fail if it + is not available. Supported values are "32", "soft", and + "any" being a wildcard. + +WANT_COMPAT Similar to NEED_COMPAT, but build with the base ABI if + the specified ABI is not available. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Modified: head/share/mk/bsd.compat.mk ============================================================================== --- head/share/mk/bsd.compat.mk Thu Oct 31 20:29:45 2019 (r354226) +++ head/share/mk/bsd.compat.mk Thu Oct 31 20:37:19 2019 (r354227) @@ -3,14 +3,22 @@ .if !targets(__<${_this:T}>__) __<${_this:T}>__: +.if defined(_LIBCOMPAT) +COMPAT_ARCH= ${TARGET_ARCH} +COMPAT_CPUTYPE= ${TARGET_CPUTYPE} +.else +COMPAT_ARCH= ${MACHINE_ARCH} +COMPAT_CPUTYPE= ${CPUTYPE} +.endif + # ------------------------------------------------------------------- # 32 bit world -.if ${TARGET_ARCH} == "amd64" +.if ${COMPAT_ARCH} == "amd64" HAS_COMPAT=32 -.if empty(TARGET_CPUTYPE) +.if empty(COMPAT_CPUTYPE) LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 .else -LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} +LIB32CPUFLAGS= -march=${COMPAT_CPUTYPE} .endif .if (defined(WANT_COMPILER_TYPE) && ${WANT_COMPILER_TYPE} == gcc) || \ (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) @@ -24,29 +32,29 @@ LIB32WMAKEFLAGS= \ AS="${XAS} --32" \ LD="${XLD} -m elf_i386_fbsd -L${LIBCOMPATTMP}/usr/lib32" -.elif ${TARGET_ARCH} == "powerpc64" +.elif ${COMPAT_ARCH} == "powerpc64" HAS_COMPAT=32 -.if empty(TARGET_CPUTYPE) +.if empty(COMPAT_CPUTYPE) LIB32CPUFLAGS= -mcpu=powerpc .else -LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE} +LIB32CPUFLAGS= -mcpu=${COMPAT_CPUTYPE} .endif LIB32CPUFLAGS+= -m32 LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc LIB32WMAKEFLAGS= \ LD="${XLD} -m elf32ppc_fbsd" -.elif ${TARGET_ARCH:Mmips64*} != "" +.elif ${COMPAT_ARCH:Mmips64*} != "" HAS_COMPAT=32 .if (defined(WANT_COMPILER_TYPE) && ${WANT_COMPILER_TYPE} == gcc) || \ (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) -.if empty(TARGET_CPUTYPE) +.if empty(COMPAT_CPUTYPE) LIB32CPUFLAGS= -march=mips3 .else -LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} +LIB32CPUFLAGS= -march=${COMPAT_CPUTYPE} .endif .else -.if ${TARGET_ARCH:Mmips64el*} != "" +.if ${COMPAT_ARCH:Mmips64el*} != "" LIB32CPUFLAGS= -target mipsel-unknown-freebsd13.0 .else LIB32CPUFLAGS= -target mips-unknown-freebsd13.0 @@ -54,7 +62,7 @@ LIB32CPUFLAGS= -target mips-unknown-freebsd13.0 .endif LIB32CPUFLAGS+= -mabi=32 LIB32WMAKEENV= MACHINE=mips MACHINE_ARCH=mips -.if ${TARGET_ARCH:Mmips64el*} != "" +.if ${COMPAT_ARCH:Mmips64el*} != "" LIB32WMAKEFLAGS= LD="${XLD} -m elf32ltsmip_fbsd" .else LIB32WMAKEFLAGS= LD="${XLD} -m elf32btsmip_fbsd" @@ -70,11 +78,11 @@ LIB32WMAKEFLAGS+= -DCOMPAT_32BIT # ------------------------------------------------------------------- # soft-fp world -.if ${TARGET_ARCH:Marmv[67]*} != "" +.if ${COMPAT_ARCH:Marmv[67]*} != "" HAS_COMPAT=SOFT LIBSOFTCFLAGS= -DCOMPAT_SOFTFP LIBSOFTCPUFLAGS= -mfloat-abi=softfp -LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=${TARGET_ARCH} +LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=${COMPAT_ARCH} LIBSOFTWMAKEFLAGS= -DCOMPAT_SOFTFP .endif Modified: head/share/mk/bsd.prog.mk ============================================================================== --- head/share/mk/bsd.prog.mk Thu Oct 31 20:29:45 2019 (r354226) +++ head/share/mk/bsd.prog.mk Thu Oct 31 20:37:19 2019 (r354227) @@ -2,7 +2,6 @@ # $FreeBSD$ .include -# .include .include .include From owner-svn-src-head@freebsd.org Thu Oct 31 20:42:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9322A165CC6; Thu, 31 Oct 2019 20:42:37 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473y1n3Kdrz3Kdh; Thu, 31 Oct 2019 20:42:37 +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 55DCE449; Thu, 31 Oct 2019 20:42:37 +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 x9VKgbV7036900; Thu, 31 Oct 2019 20:42:37 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9VKgb8T036899; Thu, 31 Oct 2019 20:42:37 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201910312042.x9VKgb8T036899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 31 Oct 2019 20:42:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354228 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354228 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 20:42:37 -0000 Author: emaste Date: Thu Oct 31 20:42:36 2019 New Revision: 354228 URL: https://svnweb.freebsd.org/changeset/base/354228 Log: avoid kernel stack data leak in core dump thrmisc note bzero the entire thrmisc struct, not just the padding. Other core dump notes are already done this way. Reported by: Ilja Van Sprundel Reviewed by: markj MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Thu Oct 31 20:37:19 2019 (r354227) +++ head/sys/kern/imgact_elf.c Thu Oct 31 20:42:36 2019 (r354228) @@ -2229,7 +2229,7 @@ __elfN(note_thrmisc)(void *arg, struct sbuf *sb, size_ td = (struct thread *)arg; if (sb != NULL) { KASSERT(*sizep == sizeof(thrmisc), ("invalid size")); - bzero(&thrmisc._pad, sizeof(thrmisc._pad)); + bzero(&thrmisc, sizeof(thrmisc)); strcpy(thrmisc.pr_tname, td->td_name); sbuf_bcat(sb, &thrmisc, sizeof(thrmisc)); } From owner-svn-src-head@freebsd.org Thu Oct 31 21:01:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E9407166953; Thu, 31 Oct 2019 21:01:36 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473yRh5s0Mz3M0n; Thu, 31 Oct 2019 21:01:36 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC5297C9; Thu, 31 Oct 2019 21:01:36 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9VL1a5l043281; Thu, 31 Oct 2019 21:01:36 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9VL1YhC043270; Thu, 31 Oct 2019 21:01:34 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201910312101.x9VL1YhC043270@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Thu, 31 Oct 2019 21:01:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354229 - in head: share/man/man4 sys/dev/netmap sys/net tools/tools/netmap usr.sbin usr.sbin/valectl X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/netmap sys/net tools/tools/netmap usr.sbin usr.sbin/valectl X-SVN-Commit-Revision: 354229 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 21:01:37 -0000 Author: vmaffione Date: Thu Oct 31 21:01:34 2019 New Revision: 354229 URL: https://svnweb.freebsd.org/changeset/base/354229 Log: add valectl to the system commands The valectl(4) program is used to manage vale(4) switches. Add it to the system commands so that it can be used right away. This program was previously called vale-ctl, and stored in tools/tools/netmap Reviewed by: hrs, bcr, lwhsu, kevans MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22146 Added: head/usr.sbin/valectl/ head/usr.sbin/valectl/Makefile (contents, props changed) head/usr.sbin/valectl/valectl.8 - copied, changed from r354228, head/tools/tools/netmap/vale-ctl.4 head/usr.sbin/valectl/valectl.c - copied, changed from r354228, head/tools/tools/netmap/vale-ctl.c Deleted: head/tools/tools/netmap/vale-ctl.4 head/tools/tools/netmap/vale-ctl.c Modified: head/share/man/man4/netmap.4 head/sys/dev/netmap/netmap_bdg.c head/sys/net/netmap_legacy.h head/tools/tools/netmap/Makefile head/tools/tools/netmap/README head/tools/tools/netmap/lb.8 head/usr.sbin/Makefile Modified: head/share/man/man4/netmap.4 ============================================================================== --- head/share/man/man4/netmap.4 Thu Oct 31 20:42:36 2019 (r354228) +++ head/share/man/man4/netmap.4 Thu Oct 31 21:01:34 2019 (r354229) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 20, 2018 +.Dd October 26, 2019 .Dt NETMAP 4 .Os .Sh NAME @@ -1087,14 +1087,14 @@ changing port names, e.g., .Pp The following command attaches an interface and the host stack to a switch: -.Dl vale-ctl -h vale2:em0 +.Dl valectl -h vale2:em0 Other .Nm clients attached to the same switch can now communicate with the network card or the host. .Sh SEE ALSO .Xr vale 4 , -.Xr vale-ctl 4 , +.Xr valectl 8 , .Xr bridge 8 , .Xr lb 8 , .Xr nmreplay 8 , Modified: head/sys/dev/netmap/netmap_bdg.c ============================================================================== --- head/sys/dev/netmap/netmap_bdg.c Thu Oct 31 20:42:36 2019 (r354228) +++ head/sys/dev/netmap/netmap_bdg.c Thu Oct 31 21:01:34 2019 (r354229) @@ -1442,7 +1442,7 @@ put_out: /* nm_bdg_ctl callback for the bwrap. - * Called on bridge-attach and detach, as an effect of vale-ctl -[ahd]. + * Called on bridge-attach and detach, as an effect of valectl -[ahd]. * On attach, it needs to provide a fake netmap_priv_d structure and * perform a netmap_do_regif() on the bwrap. This will put both the * bwrap and the hwna in netmap mode, with the netmap rings shared Modified: head/sys/net/netmap_legacy.h ============================================================================== --- head/sys/net/netmap_legacy.h Thu Oct 31 20:42:36 2019 (r354228) +++ head/sys/net/netmap_legacy.h Thu Oct 31 21:01:34 2019 (r354229) @@ -116,13 +116,13 @@ * nr_cmd (in) if non-zero indicates a special command: * NETMAP_BDG_ATTACH and nr_name = vale*:ifname * attaches the NIC to the switch; nr_ringid specifies - * which rings to use. Used by vale-ctl -a ... + * which rings to use. Used by valectl -a ... * nr_arg1 = NETMAP_BDG_HOST also attaches the host port - * as in vale-ctl -h ... + * as in valectl -h ... * * NETMAP_BDG_DETACH and nr_name = vale*:ifname * disconnects a previously attached NIC. - * Used by vale-ctl -d ... + * Used by valectl -d ... * * NETMAP_BDG_LIST * list the configuration of VALE switches. @@ -133,10 +133,10 @@ * * NETMAP_BDG_NEWIF * create a persistent VALE port with name nr_name. - * Used by vale-ctl -n ... + * Used by valectl -n ... * * NETMAP_BDG_DELIF - * delete a persistent VALE port. Used by vale-ctl -d ... + * delete a persistent VALE port. Used by valectl -d ... * * nr_arg1, nr_arg2, nr_arg3 (in/out) command specific * Modified: head/tools/tools/netmap/Makefile ============================================================================== --- head/tools/tools/netmap/Makefile Thu Oct 31 20:42:36 2019 (r354228) +++ head/tools/tools/netmap/Makefile Thu Oct 31 21:01:34 2019 (r354229) @@ -3,7 +3,7 @@ # # For multiple programs using a single source file each, # we can just define 'progs' and create custom targets. -PROGS = pkt-gen nmreplay bridge vale-ctl lb +PROGS = pkt-gen nmreplay bridge lb CLEANFILES = $(PROGS) *.o MAN= @@ -31,9 +31,6 @@ bridge: bridge.o nmreplay: nmreplay.o $(CC) $(CFLAGS) -o nmreplay nmreplay.o $(LDFLAGS) - -vale-ctl: vale-ctl.o - $(CC) $(CFLAGS) -o vale-ctl vale-ctl.o lb: lb.o pkt_hash.o $(CC) $(CFLAGS) -o lb lb.o pkt_hash.o $(LDFLAGS) Modified: head/tools/tools/netmap/README ============================================================================== --- head/tools/tools/netmap/README Thu Oct 31 20:42:36 2019 (r354228) +++ head/tools/tools/netmap/README Thu Oct 31 21:01:34 2019 (r354229) @@ -6,8 +6,6 @@ This directory contains applications that use the netm bridge a two-port jumper wire, also using the netmap API - vale-ctl the program to control and inspect VALE switches - lb an L3/L4 load balancer nmreplay a tool to playback a pcap file to a netmap port Modified: head/tools/tools/netmap/lb.8 ============================================================================== --- head/tools/tools/netmap/lb.8 Thu Oct 31 20:42:36 2019 (r354228) +++ head/tools/tools/netmap/lb.8 Thu Oct 31 21:01:34 2019 (r354229) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 28, 2018 +.Dd October 26, 2019 .Dt LB 8 .Os .Sh NAME @@ -111,7 +111,7 @@ If .Nm does not exit cleanly the ports will not be removed. Please use -.Xr vale-ctl 4 +.Xr valectl 8 to remove any stale persistent VALE port. .Sh SEE ALSO .Xr netmap 4 , Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Thu Oct 31 20:42:36 2019 (r354228) +++ head/usr.sbin/Makefile Thu Oct 31 21:01:34 2019 (r354229) @@ -96,6 +96,7 @@ SUBDIR= adduser \ trpt \ tzsetup \ ugidfw \ + valectl \ vigr \ vipw \ wake \ Added: head/usr.sbin/valectl/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/valectl/Makefile Thu Oct 31 21:01:34 2019 (r354229) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +PROG= valectl +MAN= valectl.8 + +WARNS?= 3 + +.include Copied and modified: head/usr.sbin/valectl/valectl.8 (from r354228, head/tools/tools/netmap/vale-ctl.4) ============================================================================== --- head/tools/tools/netmap/vale-ctl.4 Thu Oct 31 20:42:36 2019 (r354228, copy source) +++ head/usr.sbin/valectl/valectl.8 Thu Oct 31 21:01:34 2019 (r354229) @@ -24,15 +24,15 @@ .\" .\" $FreeBSD$ .\" -.Dd October 24, 2018 -.Dt VALE-CTL 4 +.Dd October 26, 2019 +.Dt VALECTL 8 .Os .Sh NAME -.Nm vale-ctl +.Nm valectl .Nd manage VALE switches provided by netmap .Sh SYNOPSIS .Bk -words -.Bl -tag -width "vale-ctl" +.Bl -tag -width "valectl" .It Nm .Op Fl g Ar valeSSS:PPP .Op Fl a Ar valeSSS:interface @@ -158,6 +158,6 @@ harware netmap ports. .Sh AUTHORS .An -nosplit .Nm -has been written by +was written by .An Michio Honda at NetApp. Copied and modified: head/usr.sbin/valectl/valectl.c (from r354228, head/tools/tools/netmap/vale-ctl.c) ============================================================================== --- head/tools/tools/netmap/vale-ctl.c Thu Oct 31 20:42:36 2019 (r354228, copy source) +++ head/usr.sbin/valectl/valectl.c Thu Oct 31 21:01:34 2019 (r354229) @@ -42,10 +42,8 @@ #include /* basename */ #include /* atoi, free */ -/* XXX cut and paste from pkt-gen.c because I'm not sure whether this - * program may include nm_util.h - */ -void parse_nmr_config(const char* conf, struct nmreq *nmr) +static void +parse_nmr_config(const char* conf, struct nmreq *nmr) { char *w, *tok; int i, v; @@ -201,7 +199,7 @@ usage(int errcode) { fprintf(stderr, "Usage:\n" - "vale-ctl arguments\n" + "valectl arguments\n" "\t-g interface interface name to get info\n" "\t-d interface interface name to be detached\n" "\t-a interface interface name to be attached\n" From owner-svn-src-head@freebsd.org Thu Oct 31 22:16:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 735A01786F1; Thu, 31 Oct 2019 22:16:21 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47405x2R0Tz3Qgq; Thu, 31 Oct 2019 22:16:21 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32F0C14F6; Thu, 31 Oct 2019 22:16:21 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9VMGLwX090708; Thu, 31 Oct 2019 22:16:21 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9VMGLuN090707; Thu, 31 Oct 2019 22:16:21 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201910312216.x9VMGLuN090707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Thu, 31 Oct 2019 22:16:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354231 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 354231 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 22:16:21 -0000 Author: vmaffione Date: Thu Oct 31 22:16:20 2019 New Revision: 354231 URL: https://svnweb.freebsd.org/changeset/base/354231 Log: netmap: fix build issue in netmap_user.h The issue was a comparison of integers of different signs on 32 bit architectures. Reported by: jenkins MFC after: 1 week Modified: head/sys/net/netmap_user.h Modified: head/sys/net/netmap_user.h ============================================================================== --- head/sys/net/netmap_user.h Thu Oct 31 21:32:59 2019 (r354230) +++ head/sys/net/netmap_user.h Thu Oct 31 22:16:20 2019 (r354231) @@ -1116,7 +1116,7 @@ nm_dispatch(struct nm_desc *d, int cnt, nm_cb_t cb, u_ slot = &ring->slot[i]; d->hdr.len += slot->len; nbuf = (u_char *)NETMAP_BUF(ring, slot->buf_idx); - if (oldbuf != NULL && nbuf - oldbuf == ring->nr_buf_size && + if (oldbuf != NULL && nbuf - oldbuf == (int)ring->nr_buf_size && oldlen == ring->nr_buf_size) { d->hdr.caplen += slot->len; oldbuf = nbuf; From owner-svn-src-head@freebsd.org Thu Oct 31 22:29:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3DD5178B85; Thu, 31 Oct 2019 22:29:13 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4740Nn52jgz3R75; Thu, 31 Oct 2019 22:29:13 +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 9036116B3; Thu, 31 Oct 2019 22:29:13 +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 x9VMTDhl096453; Thu, 31 Oct 2019 22:29:13 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9VMTDDM096452; Thu, 31 Oct 2019 22:29:13 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910312229.x9VMTDDM096452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 31 Oct 2019 22:29:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354232 - head/usr.bin/truss X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/usr.bin/truss X-SVN-Commit-Revision: 354232 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2019 22:29:13 -0000 Author: brooks Date: Thu Oct 31 22:29:13 2019 New Revision: 354232 URL: https://svnweb.freebsd.org/changeset/base/354232 Log: truss: centralize pointer-constructing casts. In nearly all cases, the caller has a uintptr_t compatible argument so this eliminates a large number of casts. Add a print_pointer function to centralize printing pointers. Reviewed by: jhb Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22212 Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Thu Oct 31 22:16:20 2019 (r354231) +++ head/usr.bin/truss/syscalls.c Thu Oct 31 22:29:13 2019 (r354232) @@ -1051,12 +1051,12 @@ get_syscall(struct threadinfo *t, u_int number, u_int * Copy a fixed amount of bytes from the process. */ static int -get_struct(pid_t pid, void *offset, void *buf, int len) +get_struct(pid_t pid, uintptr_t offset, void *buf, int len) { struct ptrace_io_desc iorequest; iorequest.piod_op = PIOD_READ_D; - iorequest.piod_offs = offset; + iorequest.piod_offs = (void *)offset; iorequest.piod_addr = buf; iorequest.piod_len = len; if (ptrace(PT_IO, pid, (caddr_t)&iorequest, 0) < 0) @@ -1072,7 +1072,7 @@ get_struct(pid_t pid, void *offset, void *buf, int len * only get that much. */ static char * -get_string(pid_t pid, void *addr, int max) +get_string(pid_t pid, uintptr_t addr, int max) { struct ptrace_io_desc iorequest; char *buf, *nbuf; @@ -1093,7 +1093,7 @@ get_string(pid_t pid, void *addr, int max) return (NULL); for (;;) { iorequest.piod_op = PIOD_READ_D; - iorequest.piod_offs = (char *)addr + offset; + iorequest.piod_offs = (void *)(addr + offset); iorequest.piod_addr = buf + offset; iorequest.piod_len = size; if (ptrace(PT_IO, pid, (caddr_t)&iorequest, 0) < 0) { @@ -1183,8 +1183,16 @@ print_utrace(FILE *fp, void *utrace_addr, size_t len) } static void -print_sockaddr(FILE *fp, struct trussinfo *trussinfo, void *arg, socklen_t len) +print_pointer(FILE *fp, uintptr_t arg) { + + fprintf(fp, "%p", (void *)arg); +} + +static void +print_sockaddr(FILE *fp, struct trussinfo *trussinfo, uintptr_t arg, + socklen_t len) +{ char addr[64]; struct sockaddr_in *lsin; struct sockaddr_in6 *lsin6; @@ -1193,20 +1201,20 @@ print_sockaddr(FILE *fp, struct trussinfo *trussinfo, u_char *q; pid_t pid = trussinfo->curthread->proc->pid; - if (arg == NULL) { + if (arg == 0) { fputs("NULL", fp); return; } /* If the length is too small, just bail. */ if (len < sizeof(*sa)) { - fprintf(fp, "%p", arg); + print_pointer(fp, arg); return; } sa = calloc(1, len); if (get_struct(pid, arg, sa, len) == -1) { free(sa); - fprintf(fp, "%p", arg); + print_pointer(fp, arg); return; } @@ -1252,7 +1260,7 @@ print_sockaddr(FILE *fp, struct trussinfo *trussinfo, #define IOV_LIMIT 16 static void -print_iovec(FILE *fp, struct trussinfo *trussinfo, void *arg, int iovcnt) +print_iovec(FILE *fp, struct trussinfo *trussinfo, uintptr_t arg, int iovcnt) { struct iovec iov[IOV_LIMIT]; size_t max_string = trussinfo->strsize; @@ -1263,7 +1271,7 @@ print_iovec(FILE *fp, struct trussinfo *trussinfo, voi bool buf_truncated, iov_truncated; if (iovcnt <= 0) { - fprintf(fp, "%p", arg); + print_pointer(fp, arg); return; } if (iovcnt > IOV_LIMIT) { @@ -1273,7 +1281,7 @@ print_iovec(FILE *fp, struct trussinfo *trussinfo, voi iov_truncated = false; } if (get_struct(pid, arg, &iov, iovcnt * sizeof(struct iovec)) == -1) { - fprintf(fp, "%p", arg); + print_pointer(fp, arg); return; } @@ -1287,7 +1295,7 @@ print_iovec(FILE *fp, struct trussinfo *trussinfo, voi buf_truncated = false; } fprintf(fp, "%s{", (i > 0) ? "," : ""); - if (len && get_struct(pid, iov[i].iov_base, &tmp2, len) != -1) { + if (len && get_struct(pid, (uintptr_t)iov[i].iov_base, &tmp2, len) != -1) { tmp3 = malloc(len * 4 + 1); while (len) { if (strvisx(tmp3, tmp2, len, @@ -1301,7 +1309,7 @@ print_iovec(FILE *fp, struct trussinfo *trussinfo, voi buf_truncated ? "..." : ""); free(tmp3); } else { - fprintf(fp, "%p", iov[i].iov_base); + print_pointer(fp, (uintptr_t)iov[i].iov_base); } fprintf(fp, ",%zu}", iov[i].iov_len); } @@ -1521,8 +1529,8 @@ print_cmsgs(FILE *fp, pid_t pid, bool receive, struct return; } cmsgbuf = calloc(1, len); - if (get_struct(pid, msghdr->msg_control, cmsgbuf, len) == -1) { - fprintf(fp, "%p", msghdr->msg_control); + if (get_struct(pid, (uintptr_t)msghdr->msg_control, cmsgbuf, len) == -1) { + print_pointer(fp, (uintptr_t)msghdr->msg_control); free(cmsgbuf); return; } @@ -1602,11 +1610,11 @@ print_arg(struct syscall_args *sc, unsigned long *args case PUInt: { unsigned int val; - if (get_struct(pid, (void *)args[sc->offset], &val, + if (get_struct(pid, args[sc->offset], &val, sizeof(val)) == 0) fprintf(fp, "{ %u }", val); else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case LongHex: @@ -1629,7 +1637,7 @@ print_arg(struct syscall_args *sc, unsigned long *args /* NULL-terminated string. */ char *tmp2; - tmp2 = get_string(pid, (void*)args[sc->offset], 0); + tmp2 = get_string(pid, args[sc->offset], 0); fprintf(fp, "\"%s\"", tmp2); free(tmp2); break; @@ -1659,7 +1667,7 @@ print_arg(struct syscall_args *sc, unsigned long *args len = max_string; truncated = 1; } - if (len && get_struct(pid, (void*)args[sc->offset], &tmp2, len) + if (len && get_struct(pid, args[sc->offset], &tmp2, len) != -1) { tmp3 = malloc(len * 4 + 1); while (len) { @@ -1673,7 +1681,7 @@ print_arg(struct syscall_args *sc, unsigned long *args "..." : ""); free(tmp3); } else { - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); } break; } @@ -1697,7 +1705,7 @@ print_arg(struct syscall_args *sc, unsigned long *args (trussinfo->flags & EXECVEARGS) == 0) || ((sc->type & ARG_MASK) == ExecEnv && (trussinfo->flags & EXECVEENVS) == 0)) { - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } @@ -1708,13 +1716,13 @@ print_arg(struct syscall_args *sc, unsigned long *args */ addr = args[sc->offset]; if (addr % sizeof(char *) != 0) { - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } len = PAGE_SIZE - (addr & PAGE_MASK); - if (get_struct(pid, (void *)addr, u.buf, len) == -1) { - fprintf(fp, "0x%lx", args[sc->offset]); + if (get_struct(pid, addr, u.buf, len) == -1) { + print_pointer(fp, args[sc->offset]); break; } @@ -1722,7 +1730,7 @@ print_arg(struct syscall_args *sc, unsigned long *args first = 1; i = 0; while (u.strarray[i] != NULL) { - string = get_string(pid, u.strarray[i], 0); + string = get_string(pid, (uintptr_t)u.strarray[i], 0); fprintf(fp, "%s \"%s\"", first ? "" : ",", string); free(string); first = 0; @@ -1731,7 +1739,7 @@ print_arg(struct syscall_args *sc, unsigned long *args if (i == len / sizeof(char *)) { addr += len; len = PAGE_SIZE; - if (get_struct(pid, (void *)addr, u.buf, len) == + if (get_struct(pid, addr, u.buf, len) == -1) { fprintf(fp, ", "); break; @@ -1771,22 +1779,22 @@ print_arg(struct syscall_args *sc, unsigned long *args case PQuadHex: { uint64_t val; - if (get_struct(pid, (void *)args[sc->offset], &val, + if (get_struct(pid, args[sc->offset], &val, sizeof(val)) == 0) fprintf(fp, "{ 0x%jx }", (uintmax_t)val); else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case Ptr: - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; case Readlinkres: { char *tmp2; if (retval[0] == -1) break; - tmp2 = get_string(pid, (void*)args[sc->offset], retval[0]); + tmp2 = get_string(pid, args[sc->offset], retval[0]); fprintf(fp, "\"%s\"", tmp2); free(tmp2); break; @@ -1811,12 +1819,11 @@ print_arg(struct syscall_args *sc, unsigned long *args case Timespec: { struct timespec ts; - if (get_struct(pid, (void *)args[sc->offset], &ts, - sizeof(ts)) != -1) + if (get_struct(pid, args[sc->offset], &ts, sizeof(ts)) != -1) fprintf(fp, "{ %jd.%09ld }", (intmax_t)ts.tv_sec, ts.tv_nsec); else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case Timespec2: { @@ -1824,8 +1831,7 @@ print_arg(struct syscall_args *sc, unsigned long *args const char *sep; unsigned int i; - if (get_struct(pid, (void *)args[sc->offset], &ts, sizeof(ts)) - != -1) { + if (get_struct(pid, args[sc->offset], &ts, sizeof(ts)) != -1) { fputs("{ ", fp); sep = ""; for (i = 0; i < nitems(ts); i++) { @@ -1847,57 +1853,54 @@ print_arg(struct syscall_args *sc, unsigned long *args } fputs(" }", fp); } else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case Timeval: { struct timeval tv; - if (get_struct(pid, (void *)args[sc->offset], &tv, sizeof(tv)) - != -1) + if (get_struct(pid, args[sc->offset], &tv, sizeof(tv)) != -1) fprintf(fp, "{ %jd.%06ld }", (intmax_t)tv.tv_sec, tv.tv_usec); else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case Timeval2: { struct timeval tv[2]; - if (get_struct(pid, (void *)args[sc->offset], &tv, sizeof(tv)) - != -1) + if (get_struct(pid, args[sc->offset], &tv, sizeof(tv)) != -1) fprintf(fp, "{ %jd.%06ld, %jd.%06ld }", (intmax_t)tv[0].tv_sec, tv[0].tv_usec, (intmax_t)tv[1].tv_sec, tv[1].tv_usec); else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case Itimerval: { struct itimerval itv; - if (get_struct(pid, (void *)args[sc->offset], &itv, - sizeof(itv)) != -1) + if (get_struct(pid, args[sc->offset], &itv, sizeof(itv)) != -1) fprintf(fp, "{ %jd.%06ld, %jd.%06ld }", (intmax_t)itv.it_interval.tv_sec, itv.it_interval.tv_usec, (intmax_t)itv.it_value.tv_sec, itv.it_value.tv_usec); else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case LinuxSockArgs: { struct linux_socketcall_args largs; - if (get_struct(pid, (void *)args[sc->offset], (void *)&largs, + if (get_struct(pid, args[sc->offset], (void *)&largs, sizeof(largs)) != -1) fprintf(fp, "{ %s, 0x%lx }", lookup(linux_socketcall_ops, largs.what, 10), (long unsigned int)largs.args); else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case Pollfd: { @@ -1914,8 +1917,7 @@ print_arg(struct syscall_args *sc, unsigned long *args if ((pfd = malloc(bytes)) == NULL) err(1, "Cannot malloc %zu bytes for pollfd array", bytes); - if (get_struct(pid, (void *)args[sc->offset], pfd, bytes) - != -1) { + if (get_struct(pid, args[sc->offset], pfd, bytes) != -1) { fputs("{", fp); for (i = 0; i < numfds; i++) { fprintf(fp, " %d/%s", pfd[i].fd, @@ -1923,7 +1925,7 @@ print_arg(struct syscall_args *sc, unsigned long *args } fputs(" }", fp); } else { - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); } free(pfd); break; @@ -1942,8 +1944,7 @@ print_arg(struct syscall_args *sc, unsigned long *args if ((fds = malloc(bytes)) == NULL) err(1, "Cannot malloc %zu bytes for fd_set array", bytes); - if (get_struct(pid, (void *)args[sc->offset], fds, bytes) - != -1) { + if (get_struct(pid, args[sc->offset], fds, bytes) != -1) { fputs("{", fp); for (i = 0; i < numfds; i++) { if (FD_ISSET(i, fds)) @@ -1951,7 +1952,7 @@ print_arg(struct syscall_args *sc, unsigned long *args } fputs(" }", fp); } else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); free(fds); break; } @@ -1964,9 +1965,9 @@ print_arg(struct syscall_args *sc, unsigned long *args int i, first; sig = args[sc->offset]; - if (get_struct(pid, (void *)args[sc->offset], (void *)&ss, + if (get_struct(pid, args[sc->offset], (void *)&ss, sizeof(ss)) == -1) { - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } fputs("{ ", fp); @@ -2044,22 +2045,21 @@ print_arg(struct syscall_args *sc, unsigned long *args * the next argument contains a socklen_t by value. */ if (sc->type & OUT) { - if (get_struct(pid, (void *)args[sc->offset + 1], - &len, sizeof(len)) == -1) { - fprintf(fp, "0x%lx", args[sc->offset]); + if (get_struct(pid, args[sc->offset + 1], &len, + sizeof(len)) == -1) { + print_pointer(fp, args[sc->offset]); break; } } else len = args[sc->offset + 1]; - print_sockaddr(fp, trussinfo, (void *)args[sc->offset], len); + print_sockaddr(fp, trussinfo, args[sc->offset], len); break; } case Sigaction: { struct sigaction sa; - if (get_struct(pid, (void *)args[sc->offset], &sa, sizeof(sa)) - != -1) { + if (get_struct(pid, args[sc->offset], &sa, sizeof(sa)) != -1) { fputs("{ ", fp); if (sa.sa_handler == SIG_DFL) fputs("SIG_DFL", fp); @@ -2070,7 +2070,7 @@ print_arg(struct syscall_args *sc, unsigned long *args fprintf(fp, " %s ss_t }", xlookup_bits(sigaction_flags, sa.sa_flags)); } else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case Kevent: { @@ -2099,7 +2099,7 @@ print_arg(struct syscall_args *sc, unsigned long *args bytes); } else ke = NULL; - if (numevents >= 0 && get_struct(pid, (void *)args[sc->offset], + if (numevents >= 0 && get_struct(pid, args[sc->offset], ke, bytes) != -1) { fputc('{', fp); for (i = 0; i < numevents; i++) { @@ -2108,7 +2108,7 @@ print_arg(struct syscall_args *sc, unsigned long *args } fputs(" }", fp); } else { - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); } free(ke); break; @@ -2134,7 +2134,7 @@ print_arg(struct syscall_args *sc, unsigned long *args } else ke11 = NULL; memset(&ke, 0, sizeof(ke)); - if (numevents >= 0 && get_struct(pid, (void *)args[sc->offset], + if (numevents >= 0 && get_struct(pid, args[sc->offset], ke11, bytes) != -1) { fputc('{', fp); for (i = 0; i < numevents; i++) { @@ -2149,7 +2149,7 @@ print_arg(struct syscall_args *sc, unsigned long *args } fputs(" }", fp); } else { - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); } free(ke11); break; @@ -2157,7 +2157,7 @@ print_arg(struct syscall_args *sc, unsigned long *args case Stat: { struct stat st; - if (get_struct(pid, (void *)args[sc->offset], &st, sizeof(st)) + if (get_struct(pid, args[sc->offset], &st, sizeof(st)) != -1) { char mode[12]; @@ -2167,14 +2167,14 @@ print_arg(struct syscall_args *sc, unsigned long *args (uintmax_t)st.st_ino, (intmax_t)st.st_size, (long)st.st_blksize); } else { - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); } break; } case Stat11: { struct freebsd11_stat st; - if (get_struct(pid, (void *)args[sc->offset], &st, sizeof(st)) + if (get_struct(pid, args[sc->offset], &st, sizeof(st)) != -1) { char mode[12]; @@ -2184,7 +2184,7 @@ print_arg(struct syscall_args *sc, unsigned long *args (uintmax_t)st.st_ino, (intmax_t)st.st_size, (long)st.st_blksize); } else { - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); } break; } @@ -2192,7 +2192,7 @@ print_arg(struct syscall_args *sc, unsigned long *args unsigned int i; struct statfs buf; - if (get_struct(pid, (void *)args[sc->offset], &buf, + if (get_struct(pid, args[sc->offset], &buf, sizeof(buf)) != -1) { char fsid[17]; @@ -2208,14 +2208,14 @@ print_arg(struct syscall_args *sc, unsigned long *args "fsid=%s }", buf.f_fstypename, buf.f_mntonname, buf.f_mntfromname, fsid); } else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case Rusage: { struct rusage ru; - if (get_struct(pid, (void *)args[sc->offset], &ru, sizeof(ru)) + if (get_struct(pid, args[sc->offset], &ru, sizeof(ru)) != -1) { fprintf(fp, "{ u=%jd.%06ld,s=%jd.%06ld,in=%ld,out=%ld }", @@ -2223,24 +2223,24 @@ print_arg(struct syscall_args *sc, unsigned long *args (intmax_t)ru.ru_stime.tv_sec, ru.ru_stime.tv_usec, ru.ru_inblock, ru.ru_oublock); } else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case Rlimit: { struct rlimit rl; - if (get_struct(pid, (void *)args[sc->offset], &rl, sizeof(rl)) + if (get_struct(pid, args[sc->offset], &rl, sizeof(rl)) != -1) { fprintf(fp, "{ cur=%ju,max=%ju }", rl.rlim_cur, rl.rlim_max); } else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case ExitStatus: { int status; - if (get_struct(pid, (void *)args[sc->offset], &status, + if (get_struct(pid, args[sc->offset], &status, sizeof(status)) != -1) { fputs("{ ", fp); if (WIFCONTINUED(status)) @@ -2257,7 +2257,7 @@ print_arg(struct syscall_args *sc, unsigned long *args strsig2(WTERMSIG(status))); fputs(" }", fp); } else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case Waitoptions: @@ -2293,7 +2293,7 @@ print_arg(struct syscall_args *sc, unsigned long *args memset(name, 0, sizeof(name)); len = args[sc->offset + 1]; - if (get_struct(pid, (void *)args[sc->offset], oid, + if (get_struct(pid, args[sc->offset], oid, len * sizeof(oid[0])) != -1) { fprintf(fp, "\""); if (oid[0] == CTL_SYSCTL) { @@ -2362,11 +2362,11 @@ print_arg(struct syscall_args *sc, unsigned long *args len = args[sc->offset + 1]; utrace_addr = calloc(1, len); - if (get_struct(pid, (void *)args[sc->offset], + if (get_struct(pid, args[sc->offset], (void *)utrace_addr, len) != -1) print_utrace(fp, utrace_addr, len); else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); free(utrace_addr); break; } @@ -2381,7 +2381,7 @@ print_arg(struct syscall_args *sc, unsigned long *args ndescriptors = nitems(descriptors); truncated = true; } - if (get_struct(pid, (void *)args[sc->offset], + if (get_struct(pid, args[sc->offset], descriptors, ndescriptors * sizeof(descriptors[0])) != -1) { fprintf(fp, "{"); for (i = 0; i < ndescriptors; i++) @@ -2389,7 +2389,7 @@ print_arg(struct syscall_args *sc, unsigned long *args descriptors[i]); fprintf(fp, truncated ? ", ... }" : " }"); } else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case Pipe2: @@ -2399,9 +2399,9 @@ print_arg(struct syscall_args *sc, unsigned long *args uint32_t rights; if (sc->type & OUT) { - if (get_struct(pid, (void *)args[sc->offset], &rights, + if (get_struct(pid, args[sc->offset], &rights, sizeof(rights)) == -1) { - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } } else @@ -2483,13 +2483,13 @@ print_arg(struct syscall_args *sc, unsigned long *args case CapRights: { cap_rights_t rights; - if (get_struct(pid, (void *)args[sc->offset], &rights, + if (get_struct(pid, args[sc->offset], &rights, sizeof(rights)) != -1) { fputs("{ ", fp); sysdecode_cap_rights(fp, &rights); fputs(" }", fp); } else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case Acltype: @@ -2537,33 +2537,30 @@ print_arg(struct syscall_args *sc, unsigned long *args case Schedparam: { struct sched_param sp; - if (get_struct(pid, (void *)args[sc->offset], &sp, - sizeof(sp)) != -1) + if (get_struct(pid, args[sc->offset], &sp, sizeof(sp)) != -1) fprintf(fp, "{ %d }", sp.sched_priority); else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case PSig: { int sig; - if (get_struct(pid, (void *)args[sc->offset], &sig, - sizeof(sig)) == 0) + if (get_struct(pid, args[sc->offset], &sig, sizeof(sig)) == 0) fprintf(fp, "{ %s }", strsig2(sig)); else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case Siginfo: { siginfo_t si; - if (get_struct(pid, (void *)args[sc->offset], &si, - sizeof(si)) != -1) { + if (get_struct(pid, args[sc->offset], &si, sizeof(si)) != -1) { fprintf(fp, "{ signo=%s", strsig2(si.si_signo)); decode_siginfo(fp, &si); fprintf(fp, " }"); } else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case Iovec: @@ -2572,15 +2569,15 @@ print_arg(struct syscall_args *sc, unsigned long *args * syscall argument is the number of elements of the array. */ - print_iovec(fp, trussinfo, (void *)args[sc->offset], + print_iovec(fp, trussinfo, args[sc->offset], (int)args[sc->offset + 1]); break; case Sctpsndrcvinfo: { struct sctp_sndrcvinfo info; - if (get_struct(pid, (void *)args[sc->offset], + if (get_struct(pid, args[sc->offset], &info, sizeof(struct sctp_sndrcvinfo)) == -1) { - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } print_sctp_sndrcvinfo(fp, sc->type & OUT, &info); @@ -2589,15 +2586,15 @@ print_arg(struct syscall_args *sc, unsigned long *args case Msghdr: { struct msghdr msghdr; - if (get_struct(pid, (void *)args[sc->offset], + if (get_struct(pid, args[sc->offset], &msghdr, sizeof(struct msghdr)) == -1) { - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } fputs("{", fp); - print_sockaddr(fp, trussinfo, msghdr.msg_name, msghdr.msg_namelen); + print_sockaddr(fp, trussinfo, (uintptr_t)msghdr.msg_name, msghdr.msg_namelen); fprintf(fp, ",%d,", msghdr.msg_namelen); - print_iovec(fp, trussinfo, msghdr.msg_iov, msghdr.msg_iovlen); + print_iovec(fp, trussinfo, (uintptr_t)msghdr.msg_iov, msghdr.msg_iovlen); fprintf(fp, ",%d,", msghdr.msg_iovlen); print_cmsgs(fp, pid, sc->type & OUT, &msghdr); fprintf(fp, ",%u,", msghdr.msg_controllen); @@ -2617,25 +2614,25 @@ print_arg(struct syscall_args *sc, unsigned long *args break; case CloudABIFDStat: { cloudabi_fdstat_t fds; - if (get_struct(pid, (void *)args[sc->offset], &fds, sizeof(fds)) + if (get_struct(pid, args[sc->offset], &fds, sizeof(fds)) != -1) { fprintf(fp, "{ %s, ", xlookup(cloudabi_filetype, fds.fs_filetype)); fprintf(fp, "%s, ... }", xlookup_bits(cloudabi_fdflags, fds.fs_flags)); } else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case CloudABIFileStat: { cloudabi_filestat_t fsb; - if (get_struct(pid, (void *)args[sc->offset], &fsb, sizeof(fsb)) + if (get_struct(pid, args[sc->offset], &fsb, sizeof(fsb)) != -1) fprintf(fp, "{ %s, %ju }", xlookup(cloudabi_filetype, fsb.st_filetype), (uintmax_t)fsb.st_size); else - fprintf(fp, "0x%lx", args[sc->offset]); + print_pointer(fp, args[sc->offset]); break; } case CloudABIFileType: From owner-svn-src-head@freebsd.org Fri Nov 1 00:04:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0D7217AC75; Fri, 1 Nov 2019 00:04:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4742WC3hxtz411T; Fri, 1 Nov 2019 00:04:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id E09A5177AD; Fri, 1 Nov 2019 00:04:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r354218 - head/sys/dev/ena To: Marcin Wojtas , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910311538.x9VFcHPE053035@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <2fc49b6e-0294-cb5f-bbca-8a53f6aba036@FreeBSD.org> Date: Thu, 31 Oct 2019 17:04:49 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <201910311538.x9VFcHPE053035@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.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2019 00:04:55 -0000 On 10/31/19 8:38 AM, Marcin Wojtas wrote: > Author: mw > Date: Thu Oct 31 15:38:17 2019 > New Revision: 354218 > URL: https://svnweb.freebsd.org/changeset/base/354218 > > Log: > Add WC support for arm64 in the ENA driver > > As the pmamp_change_attr() is public on arm64 since r351131, it can be > used on the arm64 to map memory range as with the write combined > attribute. > > It requires the driver to use generic VM_MEMATTR_WRITE_COMBINING flag > instead of the x86 specific PAT_WRITE_COMBINING. > > Differential Revision: https://reviews.freebsd.org/D21931 > Submitted by: Michal Krawczyk > Obtained from: Semihalf > Sponsored by: Amazon, Inc. This isn't the right API for this, but the right API isn't ready yet on arm64. I have a patch to add bus_map_resource support on all platforms that I'm working on testing, and that will be the right way to request this in the future once it lands. -- -- John Baldwin From owner-svn-src-head@freebsd.org Fri Nov 1 01:08:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF07A17C126 for ; Fri, 1 Nov 2019 01:08:15 +0000 (UTC) (envelope-from mw@semihalf.com) Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4743wG5WRDz43dK for ; Fri, 1 Nov 2019 01:08:14 +0000 (UTC) (envelope-from mw@semihalf.com) Received: by mail-qt1-x82a.google.com with SMTP id t8so11064300qtc.6 for ; Thu, 31 Oct 2019 18:08:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nEn2m2gvkEX0H2IHDf+jBrK61vMxuTyOYeHcalb42j8=; b=UioHO9GRi2MSYQI6t15ov18TNGpEz86+0PM7G/oG5H5CMs6Vjh8K4s8xIsLYgGxlI0 IKfbDXf/3tieywq7D+q7DEsZSi+wC0KbLPe2bc45cj+1aQ1uck0gXtUNPNNjzwk/zQ4F gHztwMzvLTvErRIb44/3BqMZPq+VjKbpW9Nsu8UD7wshkx5x9emen48FQABhMTklJgTI VBzaaB6h4XkKGS6LgmH83jFzz7jGhxiN/nWQRpckVdh/jt73FGan0yGX2TsWZjeuEyFz UN2uKuKXOSzB7TAEAOHXwlb0vhHlupdKH3YeFy8QA0dg1z/XDMIupZ16Vu5m2z56vFBL SbyA== 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=nEn2m2gvkEX0H2IHDf+jBrK61vMxuTyOYeHcalb42j8=; b=RRa/HLdyMF2SIAYFxNQGzBFl1dTfiiD0wPoi9e9nVKA/3DazOu6ToR0zF1fSso+VXa Os/Z67gw7yQdwCR4nYAiCHeVecFcsN77OflWOx9OwKsKsYkdwpjYbawpoP3QIH4RB6XL oz1vp8H3HV7mL3nG2tAOGdNlX74tYv3J/H12vO+J81TFwyvE9WBYHC8dhTREoNtmzAgv KU3E4KBfLOKLaoOBbA+CF07dxuCPXoEiQvq48hHiMRXbIK/RSXRVTcQLCwWoBknWvciU /fqJ5sHnyEm5komFsYna+HcWRNtlnXKO3JVBSEc5BVneB1sazamcdFxh+7Ewtpr/cFPY VVMA== X-Gm-Message-State: APjAAAXnMIjtoiT21ALVLdFZKOmlvwQYXho+s0DOo8vV47wtp2C5f6Ej bfGmlsIi8DxM5URR8XJGDKEU+Fj7Aq4IsOxAMvlL7g== X-Google-Smtp-Source: APXvYqyqfh33n9xK1GPYz5GGEcFidNvAQ90XzZayZxxVoOLqC2RsgiBMs/rfvIsJbnnu4NMJtDLwHnIbojipyRQcJgk= X-Received: by 2002:a0c:f704:: with SMTP id w4mr7696691qvn.167.1572570492312; Thu, 31 Oct 2019 18:08:12 -0700 (PDT) MIME-Version: 1.0 References: <201910311538.x9VFcHPE053035@repo.freebsd.org> <2fc49b6e-0294-cb5f-bbca-8a53f6aba036@FreeBSD.org> In-Reply-To: <2fc49b6e-0294-cb5f-bbca-8a53f6aba036@FreeBSD.org> From: Marcin Wojtas Date: Fri, 1 Nov 2019 02:08:02 +0100 Message-ID: Subject: Re: svn commit: r354218 - head/sys/dev/ena To: John Baldwin Cc: Marcin Wojtas , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 4743wG5WRDz43dK X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=UioHO9GR; dmarc=none; spf=none (mx1.freebsd.org: domain of mw@semihalf.com has no SPF policy when checking 2607:f8b0:4864:20::82a) smtp.mailfrom=mw@semihalf.com X-Spamd-Result: default: False [-5.07 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[semihalf-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[semihalf.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[semihalf-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[a.2.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.78)[ip: (-9.40), ipnet: 2607:f8b0::/32(-2.39), asn: 15169(-2.04), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2019 01:08:15 -0000 Hi John, Sure, will be happy to test. Please let me know and cc mk@semihalf.com. Best regards, Marcin pt., 1 lis 2019 o 01:04 John Baldwin napisa=C5=82(a): > On 10/31/19 8:38 AM, Marcin Wojtas wrote: > > Author: mw > > Date: Thu Oct 31 15:38:17 2019 > > New Revision: 354218 > > URL: https://svnweb.freebsd.org/changeset/base/354218 > > > > Log: > > Add WC support for arm64 in the ENA driver > > > > As the pmamp_change_attr() is public on arm64 since r351131, it can b= e > > used on the arm64 to map memory range as with the write combined > > attribute. > > > > It requires the driver to use generic VM_MEMATTR_WRITE_COMBINING flag > > instead of the x86 specific PAT_WRITE_COMBINING. > > > > Differential Revision: https://reviews.freebsd.org/D21931 > > Submitted by: Michal Krawczyk > > Obtained from: Semihalf > > Sponsored by: Amazon, Inc. > > This isn't the right API for this, but the right API isn't ready yet on > arm64. I have a patch to add bus_map_resource support on all platforms > that I'm working on testing, and that will be the right way to request > this in the future once it lands. > > -- > -- > John Baldwin > From owner-svn-src-head@freebsd.org Fri Nov 1 02:48:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E861517F848; Fri, 1 Nov 2019 02:48:44 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47468D5vnvz49k8; Fri, 1 Nov 2019 02:48:44 +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 AAEFC4744; Fri, 1 Nov 2019 02:48:44 +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 xA12miCA048774; Fri, 1 Nov 2019 02:48:44 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA12micA048772; Fri, 1 Nov 2019 02:48:44 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201911010248.xA12micA048772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 1 Nov 2019 02:48:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354234 - head/lib/geom/eli X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/lib/geom/eli X-SVN-Commit-Revision: 354234 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2019 02:48:45 -0000 Author: asomers Date: Fri Nov 1 02:48:43 2019 New Revision: 354234 URL: https://svnweb.freebsd.org/changeset/base/354234 Log: geli: raise WARNS to 6 MFC after: 2 weeks Sponsored by: Axcient Modified: head/lib/geom/eli/Makefile head/lib/geom/eli/geom_eli.c Modified: head/lib/geom/eli/Makefile ============================================================================== --- head/lib/geom/eli/Makefile Fri Nov 1 00:00:17 2019 (r354233) +++ head/lib/geom/eli/Makefile Fri Nov 1 02:48:43 2019 (r354234) @@ -13,8 +13,6 @@ SRCS+= sha512c.c LIBADD= md crypto -WARNS?= 3 - CFLAGS+=-I${SRCTOP}/sys .include Modified: head/lib/geom/eli/geom_eli.c ============================================================================== --- head/lib/geom/eli/geom_eli.c Fri Nov 1 00:00:17 2019 (r354233) +++ head/lib/geom/eli/geom_eli.c Fri Nov 1 02:48:43 2019 (r354234) @@ -706,7 +706,7 @@ eli_init(struct gctl_req *req) unsigned char key[G_ELI_USERKEYLEN]; char backfile[MAXPATHLEN]; const char *str, *prov; - unsigned int secsize, version; + unsigned int secsize, eli_version; off_t mediasize; intmax_t val; int error, i, nargs, nparams, param; @@ -723,16 +723,16 @@ eli_init(struct gctl_req *req) strlcpy(md.md_magic, G_ELI_MAGIC, sizeof(md.md_magic)); val = gctl_get_intmax(req, "mdversion"); if (val == -1) { - version = G_ELI_VERSION; + eli_version = G_ELI_VERSION; } else if (val < 0 || val > G_ELI_VERSION) { gctl_error(req, "Invalid version specified should be between %u and %u.", G_ELI_VERSION_00, G_ELI_VERSION); return; } else { - version = val; + eli_version = val; } - md.md_version = version; + md.md_version = eli_version; md.md_flags = G_ELI_FLAG_AUTORESIZE; if (gctl_get_int(req, "boot")) md.md_flags |= G_ELI_FLAG_BOOT; @@ -747,7 +747,7 @@ eli_init(struct gctl_req *req) md.md_ealgo = CRYPTO_ALGORITHM_MIN - 1; str = gctl_get_ascii(req, "aalgo"); if (*str != '\0') { - if (version < G_ELI_VERSION_01) { + if (eli_version < G_ELI_VERSION_01) { gctl_error(req, "Data authentication is supported starting from version %u.", G_ELI_VERSION_01); @@ -779,7 +779,7 @@ eli_init(struct gctl_req *req) md.md_ealgo > CRYPTO_ALGORITHM_MAX) { str = gctl_get_ascii(req, "ealgo"); if (*str == '\0') { - if (version < G_ELI_VERSION_05) + if (eli_version < G_ELI_VERSION_05) str = "aes-cbc"; else str = GELI_ENC_ALGO; @@ -791,14 +791,14 @@ eli_init(struct gctl_req *req) return; } if (md.md_ealgo == CRYPTO_CAMELLIA_CBC && - version < G_ELI_VERSION_04) { + eli_version < G_ELI_VERSION_04) { gctl_error(req, "Camellia-CBC algorithm is supported starting from version %u.", G_ELI_VERSION_04); return; } if (md.md_ealgo == CRYPTO_AES_XTS && - version < G_ELI_VERSION_05) { + eli_version < G_ELI_VERSION_05) { gctl_error(req, "AES-XTS algorithm is supported starting from version %u.", G_ELI_VERSION_05); @@ -1904,7 +1904,7 @@ eli_version(struct gctl_req *req) { struct g_eli_metadata md; const char *name; - unsigned int version; + unsigned int eli_version; int error, i, nargs; nargs = gctl_get_int(req, "nargs"); @@ -1934,8 +1934,8 @@ eli_version(struct gctl_req *req) gctl_error(req, "Not fully done."); continue; } - version = le32dec(&md.md_version); - printf("%s: %u\n", name, version); + eli_version = le32dec(&md.md_version); + printf("%s: %u\n", name, eli_version); } } From owner-svn-src-head@freebsd.org Fri Nov 1 02:55:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1200117FE50; Fri, 1 Nov 2019 02:55: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4746JZ5Zqhz4BMl; Fri, 1 Nov 2019 02:55: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 A43EB4900; Fri, 1 Nov 2019 02:55: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 xA12twxi054499; Fri, 1 Nov 2019 02:55:58 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA12twuX054498; Fri, 1 Nov 2019 02:55:58 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911010255.xA12twuX054498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 1 Nov 2019 02:55:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354235 - 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: 354235 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2019 02:55:59 -0000 Author: jhibbits Date: Fri Nov 1 02:55:58 2019 New Revision: 354235 URL: https://svnweb.freebsd.org/changeset/base/354235 Log: powerpc/booke: Fix TLB1 entry accounting It's possible, with per-CPU mappings, for TLB1 indices to get out of sync. This presents a problem when trying to insert an entry into TLB1 of all CPUs. Currently that's done by assuming (hoping) that the TLBs are perfectly synced, and inserting to the same index for all CPUs. However, with aforementioned private mappings, this can result in overwriting mappings on the other CPUs. An example: CPU0 CPU1 3 private mappings kick off CPU 1 initialize shared mappings (3 indices low) Load kernel module, triggers 20 new mappings Sync mappings at N-3 initialize 3 private mappings. At this point, CPU 1 has all the correct mappings, while CPU 0 is missing 3 mappings that were shared across to CPU 1. When CPU 0 tries to access memory in one of the overwritten mappings, it hangs while tripping through the TLB miss handler. Device mappings are not stored in any page table. This fixes by introducing a '-1' index for tlb1_write_entry_int(), so each CPU searches for an available index private to itself. MFC after: 3 weeks Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Fri Nov 1 02:48:43 2019 (r354234) +++ head/sys/powerpc/booke/pmap.c Fri Nov 1 02:55:58 2019 (r354235) @@ -1881,7 +1881,7 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o } #ifdef SMP - void +void tlb1_ap_prep(void) { tlb_entry_t *e, tmp; @@ -3776,14 +3776,34 @@ struct tlbwrite_args { unsigned int idx; }; +static uint32_t +tlb1_find_free(void) +{ + tlb_entry_t e; + int i; + + for (i = 0; i < TLB1_ENTRIES; i++) { + tlb1_read_entry(&e, i); + if ((e.mas1 & MAS1_VALID) == 0) + return (i); + } + return (-1); +} + static void tlb1_write_entry_int(void *arg) { struct tlbwrite_args *args = arg; - uint32_t mas0; + uint32_t idx, mas0; + idx = args->idx; + if (idx == -1) { + idx = tlb1_find_free(); + if (idx == -1) + panic("No free TLB1 entries!\n"); + } /* Select entry */ - mas0 = MAS0_TLBSEL(1) | MAS0_ESEL(args->idx); + mas0 = MAS0_TLBSEL(1) | MAS0_ESEL(idx); mtspr(SPR_MAS0, mas0); mtspr(SPR_MAS1, args->e->mas1); @@ -3897,10 +3917,9 @@ tlb1_set_entry(vm_offset_t va, vm_paddr_t pa, vm_size_ uint32_t ts, tid; int tsize, index; + /* First try to update an existing entry. */ for (index = 0; index < TLB1_ENTRIES; index++) { tlb1_read_entry(&e, index); - if ((e.mas1 & MAS1_VALID) == 0) - break; /* Check if we're just updating the flags, and update them. */ if (e.phys == pa && e.virt == va && e.size == size) { e.mas2 = (va & MAS2_EPN_MASK) | flags; @@ -3908,10 +3927,6 @@ tlb1_set_entry(vm_offset_t va, vm_paddr_t pa, vm_size_ return (0); } } - if (index >= TLB1_ENTRIES) { - printf("tlb1_set_entry: TLB1 full!\n"); - return (-1); - } /* Convert size to TSIZE */ tsize = size2tsize(size); @@ -3931,13 +3946,8 @@ tlb1_set_entry(vm_offset_t va, vm_paddr_t pa, vm_size_ e.mas3 = (pa & MAS3_RPN) | MAS3_SR | MAS3_SW | MAS3_SX; e.mas7 = (pa >> 32) & MAS7_RPN; - tlb1_write_entry(&e, index); + tlb1_write_entry(&e, -1); - /* - * XXX in general TLB1 updates should be propagated between CPUs, - * since current design assumes to have the same TLB1 set-up on all - * cores. - */ return (0); } From owner-svn-src-head@freebsd.org Fri Nov 1 03:10:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDA941A1679; Fri, 1 Nov 2019 03:10:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4746dn5cLBz4CZd; Fri, 1 Nov 2019 03:10:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A39DE4B9A; Fri, 1 Nov 2019 03:10:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA13ArMb061758; Fri, 1 Nov 2019 03:10:53 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA13ArC0061756; Fri, 1 Nov 2019 03:10:53 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911010310.xA13ArC0061756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 1 Nov 2019 03:10:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354236 - head/sbin/mdmfs X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sbin/mdmfs X-SVN-Commit-Revision: 354236 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2019 03:10:53 -0000 Author: kevans Date: Fri Nov 1 03:10:53 2019 New Revision: 354236 URL: https://svnweb.freebsd.org/changeset/base/354236 Log: mdmfs(8): add -k skel option to populate fs from a skeleton mdmfs(8) lacks the ability to populate throwaway memory filesystems from an existing directory. This features permits an interesting setup where /var for instance lives on a device where wear-leveling is something you want to avoid as much as possible and nonetheless you don't want to lose your logs, ports metadata, etc. Here are the steps: 1. Copy /var to /var.bak; 2. Mount an mfs into /var using -k /var.bak at startup; 3. Synchronize /var to /var.bak weekly and on shutdown. Note that this more or less mimics OpenBSD's mount_mfs(8) -P flag. PR: 146254 Submitted by: jlh (many moons ago) MFC after: 1 week Modified: head/sbin/mdmfs/mdmfs.8 head/sbin/mdmfs/mdmfs.c Modified: head/sbin/mdmfs/mdmfs.8 ============================================================================== --- head/sbin/mdmfs/mdmfs.8 Fri Nov 1 02:55:58 2019 (r354235) +++ head/sbin/mdmfs/mdmfs.8 Fri Nov 1 03:10:53 2019 (r354236) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 9, 2017 +.Dd October 31, 2019 .Dt MDMFS 8 .Os .Sh NAME @@ -48,6 +48,7 @@ filesystem .Op Fl F Ar file .Op Fl f Ar frag-size .Op Fl i Ar bytes +.Op Fl k Ar skel .Op Fl m Ar percent-free .Op Fl O Ar optimization .Op Fl o Ar mount-options @@ -193,6 +194,11 @@ memory disk backed by The fragment size of the file system in bytes. .It Fl i Ar bytes Number of bytes per inode. +.It Fl k Ar skel +Copy the content of directory +.Ar skel +into +.Ar mount-point . .It Fl l Enable multilabel MAC on the new file system. .It Fl L Modified: head/sbin/mdmfs/mdmfs.c ============================================================================== --- head/sbin/mdmfs/mdmfs.c Fri Nov 1 02:55:58 2019 (r354235) +++ head/sbin/mdmfs/mdmfs.c Fri Nov 1 03:10:53 2019 (r354236) @@ -88,6 +88,7 @@ static void do_mount_md(const char *, const char *); static void do_mount_tmpfs(const char *, const char *); static void do_mtptsetup(const char *, struct mtpt_info *); static void do_newfs(const char *); +static void do_copy(const char *, const char *); static void extract_ugid(const char *, struct mtpt_info *); static int run(int *, const char *, ...) __printflike(2, 3); static const char *run_exitstr(int); @@ -104,7 +105,7 @@ main(int argc, char **argv) enum md_types mdtype; /* The type of our memory disk. */ bool have_mdtype, mlmac; bool detach, softdep, autounit, newfs; - const char *mtpoint, *size_arg, *unitstr; + const char *mtpoint, *size_arg, *skel, *unitstr; char *p; int ch, idx; void *set; @@ -118,6 +119,7 @@ main(int argc, char **argv) mlmac = false; newfs = true; have_mdtype = false; + skel = NULL; mdtype = MD_SWAP; mdname = MD_NAME; mdnamelen = strlen(mdname); @@ -142,7 +144,7 @@ main(int argc, char **argv) } while ((ch = getopt(argc, argv, - "a:b:Cc:Dd:E:e:F:f:hi:LlMm:NnO:o:Pp:Ss:tT:Uv:w:X")) != -1) + "a:b:Cc:Dd:E:e:F:f:hi:k:LlMm:NnO:o:Pp:Ss:tT:Uv:w:X")) != -1) switch (ch) { case 'a': argappend(&newfs_arg, "-a %s", optarg); @@ -184,6 +186,9 @@ main(int argc, char **argv) case 'i': argappend(&newfs_arg, "-i %s", optarg); break; + case 'k': + skel = optarg; + break; case 'L': loudsubs = true; break; @@ -359,6 +364,8 @@ main(int argc, char **argv) } do_mtptsetup(mtpoint, &mi); + if (skel != NULL) + do_copy(mtpoint, skel); return (0); } @@ -615,7 +622,24 @@ do_newfs(const char *args) run_exitnumber(rv)); } + /* + * Copy skel into the mountpoint. + */ +static void +do_copy(const char *mtpoint, const char *skel) +{ + int rv; + + rv = chdir(skel); + if (rv != 0) + err(1, "chdir to %s", skel); + rv = run(NULL, "/bin/pax -rw -pe . %s", mtpoint); + if (rv != 0) + errx(1, "skel copy failed"); +} + +/* * 'str' should be a user and group name similar to the last argument * to chown(1); i.e., a user, followed by a colon, followed by a * group. The user and group in 'str' may be either a [ug]id or a @@ -822,8 +846,8 @@ usage(void) fprintf(stderr, "usage: %s [-DLlMNnPStUX] [-a maxcontig] [-b block-size]\n" "\t[-c blocks-per-cylinder-group][-d max-extent-size] [-E path-mdconfig]\n" -"\t[-e maxbpg] [-F file] [-f frag-size] [-i bytes] [-m percent-free]\n" -"\t[-O optimization] [-o mount-options]\n" +"\t[-e maxbpg] [-F file] [-f frag-size] [-i bytes] [-k skel]\n" +"\t[-m percent-free] [-O optimization] [-o mount-options]\n" "\t[-p permissions] [-s size] [-v version] [-w user:group]\n" "\tmd-device mount-point\n", getprogname()); exit(1); From owner-svn-src-head@freebsd.org Fri Nov 1 03:12:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3A5C1A19F6; Fri, 1 Nov 2019 03:12:36 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4746gm4pMSz4D11; Fri, 1 Nov 2019 03:12:36 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 7CA3518D62; Fri, 1 Nov 2019 03:12:36 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f171.google.com with SMTP id 205so7986226qkk.1; Thu, 31 Oct 2019 20:12:36 -0700 (PDT) X-Gm-Message-State: APjAAAVxVGrfx+13OcEGtKM0Hj4G2vU5cGqbi+Je66csIuyKebHVV28P +W6ibk3PsqSNEXKbAjCU4rVsyxvVmSwJL7Aew4M= X-Google-Smtp-Source: APXvYqwcpyTSqefPIoAR5htHV8UE0lXxuYAZkXuCmYy/enlZvkcafZCaxKbyW6fndjBtQhv/ikRQ3VNF+HGw8fpJx20= X-Received: by 2002:ae9:ef50:: with SMTP id d77mr2648199qkg.430.1572577955910; Thu, 31 Oct 2019 20:12:35 -0700 (PDT) MIME-Version: 1.0 References: <201911010310.xA13ArC0061756@repo.freebsd.org> In-Reply-To: <201911010310.xA13ArC0061756@repo.freebsd.org> From: Kyle Evans Date: Thu, 31 Oct 2019 22:12:24 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r354236 - head/sbin/mdmfs To: Kyle Evans Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2019 03:12:36 -0000 On Thu, Oct 31, 2019 at 10:11 PM Kyle Evans wrote: > > Author: kevans > Date: Fri Nov 1 03:10:53 2019 > New Revision: 354236 > URL: https://svnweb.freebsd.org/changeset/base/354236 > > Log: > mdmfs(8): add -k skel option to populate fs from a skeleton > > mdmfs(8) lacks the ability to populate throwaway memory filesystems from an > existing directory. > > This features permits an interesting setup where /var for instance lives on > a device where wear-leveling is something you want to avoid as much as > possible and nonetheless you don't want to lose your logs, ports metadata, > etc. Here are the steps: > > 1. Copy /var to /var.bak; > 2. Mount an mfs into /var using -k /var.bak at startup; > 3. Synchronize /var to /var.bak weekly and on shutdown. > > Note that this more or less mimics OpenBSD's mount_mfs(8) -P flag. > > PR: 146254 > Submitted by: jlh (many moons ago) > MFC after: 1 week Reviewed by: bcr (manpages) Differential Revision: https://reviews.freebsd.org/D19963 From owner-svn-src-head@freebsd.org Fri Nov 1 06:54:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 307CD1AACE6; Fri, 1 Nov 2019 06:54:08 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474CbN0GTMz3MkT; Fri, 1 Nov 2019 06:54:08 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E085E74FC; Fri, 1 Nov 2019 06:54:07 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA16s7JG098378; Fri, 1 Nov 2019 06:54:07 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA16s760098377; Fri, 1 Nov 2019 06:54:07 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911010654.xA16s760098377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Fri, 1 Nov 2019 06:54:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354237 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 354237 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2019 06:54:08 -0000 Author: tsoome Date: Fri Nov 1 06:54:07 2019 New Revision: 354237 URL: https://svnweb.freebsd.org/changeset/base/354237 Log: loader: asprinf does crash arm64 due to missing NULL pointer check PCHAR macro needs to check if d is NULL. MFC after: 3 days Modified: head/stand/libsa/printf.c Modified: head/stand/libsa/printf.c ============================================================================== --- head/stand/libsa/printf.c Fri Nov 1 03:10:53 2019 (r354236) +++ head/stand/libsa/printf.c Fri Nov 1 06:54:07 2019 (r354237) @@ -247,7 +247,17 @@ ksprintn(char *nbuf, uintmax_t num, int base, int *len static int kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap) { -#define PCHAR(c) {int cc=(c); if (func) (*func)(cc, arg); else *d++ = cc; retval++; } +#define PCHAR(c) { \ + int cc = (c); \ + \ + if (func) { \ + (*func)(cc, arg); \ + } else if (d != NULL) { \ + *d++ = cc; \ + } \ + retval++; \ + } + char nbuf[MAXNBUF]; char *d; const char *p, *percent, *q; From owner-svn-src-head@freebsd.org Fri Nov 1 09:16:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E05021AE10D; Fri, 1 Nov 2019 09:16:58 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474GmB5cmZz3yBj; Fri, 1 Nov 2019 09:16:58 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A533C8DCB; Fri, 1 Nov 2019 09:16:58 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA19GwDh080544; Fri, 1 Nov 2019 09:16:58 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA19Gw86080543; Fri, 1 Nov 2019 09:16:58 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911010916.xA19Gw86080543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Fri, 1 Nov 2019 09:16:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354238 - head/contrib/netbsd-tests/lib/libexecinfo X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/contrib/netbsd-tests/lib/libexecinfo X-SVN-Commit-Revision: 354238 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2019 09:16:58 -0000 Author: lwhsu Date: Fri Nov 1 09:16:58 2019 New Revision: 354238 URL: https://svnweb.freebsd.org/changeset/base/354238 Log: Temporarily skip lib.libexecinfo.backtrace_test.backtrace_fmt_basic on i386 PR: 241562 Sponsored by: The FreeBSD Foundation Modified: head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Modified: head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c ============================================================================== --- head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Fri Nov 1 06:54:07 2019 (r354237) +++ head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Fri Nov 1 09:16:58 2019 (r354238) @@ -151,6 +151,11 @@ ATF_TC_HEAD(backtrace_fmt_basic, tc) ATF_TC_BODY(backtrace_fmt_basic, tc) { +#if defined(__i386__) + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_skip("https://bugs.freebsd.org/241562"); +#endif + myfunc(12); if (prevent_inline) From owner-svn-src-head@freebsd.org Fri Nov 1 11:28:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA78A15A191; Fri, 1 Nov 2019 11:28:43 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474KhC502dz46b0; Fri, 1 Nov 2019 11:28:43 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E859A50E; Fri, 1 Nov 2019 11:28:43 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA1BShnt057228; Fri, 1 Nov 2019 11:28:43 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA1BShOC057227; Fri, 1 Nov 2019 11:28:43 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201911011128.xA1BShOC057227@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Fri, 1 Nov 2019 11:28:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354239 - head/contrib/gdb/gdb X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/contrib/gdb/gdb X-SVN-Commit-Revision: 354239 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2019 11:28:43 -0000 Author: luporl Date: Fri Nov 1 11:28:43 2019 New Revision: 354239 URL: https://svnweb.freebsd.org/changeset/base/354239 Log: [PPC64] Fix GDB sigtramp detection Current implementation of ppcfbsd_pc_in_sigtramp() seems to take only 32-bit PowerPC in account, as on 64-bit PowerPC most kernel instruction addresses will be wrongly reported as in sigtramp. This change adds proper sigtramp detection for PPC64. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D22199 Modified: head/contrib/gdb/gdb/ppcfbsd-tdep.c Modified: head/contrib/gdb/gdb/ppcfbsd-tdep.c ============================================================================== --- head/contrib/gdb/gdb/ppcfbsd-tdep.c Fri Nov 1 09:16:58 2019 (r354238) +++ head/contrib/gdb/gdb/ppcfbsd-tdep.c Fri Nov 1 11:28:43 2019 (r354239) @@ -487,6 +487,12 @@ ppcfbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) return (pc >= 0x7fffef00U) ? 1 : 0; } +static int +ppc64_fbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) +{ + return (pc >= 0x3fffffffffffe000U && pc <= 0x3fffffffffffefffU) ? 1 : 0; +} + /* NetBSD is confused. It appears that 1.5 was using the correct SVr4 convention but, 1.6 switched to the below broken convention. For the moment use the broken convention. Ulgh!. */ @@ -518,10 +524,9 @@ ppcfbsd_init_abi (struct gdbarch_info info, /* FreeBSD doesn't support the 128-bit `long double' from the psABI. */ set_gdbarch_long_double_bit (gdbarch, 64); - set_gdbarch_pc_in_sigtramp (gdbarch, ppcfbsd_pc_in_sigtramp); - if (tdep->wordsize == 4) { + set_gdbarch_pc_in_sigtramp (gdbarch, ppcfbsd_pc_in_sigtramp); set_gdbarch_return_value (gdbarch, ppcfbsd_return_value); set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_ilp32_fetch_link_map_offsets); @@ -529,6 +534,7 @@ ppcfbsd_init_abi (struct gdbarch_info info, if (tdep->wordsize == 8) { + set_gdbarch_pc_in_sigtramp (gdbarch, ppc64_fbsd_pc_in_sigtramp); set_gdbarch_convert_from_func_ptr_addr (gdbarch, ppc64_fbsd_convert_from_func_ptr_addr); From owner-svn-src-head@freebsd.org Fri Nov 1 16:06:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 09D2917A292; Fri, 1 Nov 2019 16:06:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474RrZ6S4bz4QKW; Fri, 1 Nov 2019 16:06:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 3D5D51EAF9; Fri, 1 Nov 2019 16:06:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r354239 - head/contrib/gdb/gdb To: Leandro Lupori , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911011128.xA1BShOC057227@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Fri, 1 Nov 2019 09:06:18 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <201911011128.xA1BShOC057227@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.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2019 16:06:23 -0000 On 11/1/19 4:28 AM, Leandro Lupori wrote: > Author: luporl > Date: Fri Nov 1 11:28:43 2019 > New Revision: 354239 > URL: https://svnweb.freebsd.org/changeset/base/354239 > > Log: > [PPC64] Fix GDB sigtramp detection > > Current implementation of ppcfbsd_pc_in_sigtramp() seems to take only 32-bit > PowerPC in account, as on 64-bit PowerPC most kernel instruction addresses will > be wrongly reported as in sigtramp. > > This change adds proper sigtramp detection for PPC64. It's probably not worth fixing this in /usr/bin/gdb? At this point gdb is only installed for the kgdb in /usr/libexec on all platforms but sparc64 to serve as a fall-back for the crashinfo script in case the ports gdb isn't installed. The ports gdb should handle signal trampolines fine on ppc. It uses instruction matching patterns to detect trampolines on all supported platforms instead of static sigtramp locations. -- John Baldwin From owner-svn-src-head@freebsd.org Fri Nov 1 19:26:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 790E017F5C6; Fri, 1 Nov 2019 19:26:41 +0000 (UTC) (envelope-from luporl@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474XHj2c1fz4f7W; Fri, 1 Nov 2019 19:26:41 +0000 (UTC) (envelope-from luporl@freebsd.org) Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: luporl/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 2B941578; Fri, 1 Nov 2019 19:26:41 +0000 (UTC) (envelope-from luporl@freebsd.org) Received: by mail-io1-f52.google.com with SMTP id h9so12097370ioh.2; Fri, 01 Nov 2019 12:26:41 -0700 (PDT) X-Gm-Message-State: APjAAAUHqizQAgVjWYu9/Qj1XgVXj1C/IxY4j9LPybtPLq+iiVsmdwEn ZYCiFSQPhtEQn1Lthkce1owOmemqcnG8n8dOkPU= X-Google-Smtp-Source: APXvYqzUX6uuudz29RZn6FfALkQ0AJ7dzOlrRI4iZS61bxrIs6/kjwwgBRpjBHltwr2O6ZrTWy2egn5IWk4v7KRo2Nw= X-Received: by 2002:a6b:908a:: with SMTP id s132mr12226883iod.118.1572636400421; Fri, 01 Nov 2019 12:26:40 -0700 (PDT) MIME-Version: 1.0 References: <201911011128.xA1BShOC057227@repo.freebsd.org> In-Reply-To: From: luporl Date: Fri, 1 Nov 2019 16:26:29 -0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r354239 - head/contrib/gdb/gdb To: John Baldwin Cc: src-committers@freebsd.org, 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.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2019 19:26:41 -0000 Well, after evaluating remote kernel debugging through serial port, on amd64, I've run into several issues while using latest ports gdb/kgdb. I don't remember all of them, but were things like step/next not always working, connection being lost, and similar things. OTOH, /usr/libexec/kgdb worked fine and reliably, although older and more limited. This is probably due to some incompatibility in GDB Remote Serial Protocol, between the kernel backend and newer GDB from ports. So, that's why I chose to use /usr/libexec/kgdb while fixing/enabling remote debugging on PPC64, because it works reasonably well, and I could focus on testing/fixing other parts first. With only this change on gdb, it is now possible to use it to test some basic functionality, like remote debugger attach, backtrace and data inspection. My goal is not to fix every issue in /usr/libexec/kgdb, but just to get the basics working, to then move on and switch to ports' GDB. - Leandro On Fri, Nov 1, 2019 at 1:06 PM John Baldwin wrote: > On 11/1/19 4:28 AM, Leandro Lupori wrote: > > Author: luporl > > Date: Fri Nov 1 11:28:43 2019 > > New Revision: 354239 > > URL: https://svnweb.freebsd.org/changeset/base/354239 > > > > Log: > > [PPC64] Fix GDB sigtramp detection > > > > Current implementation of ppcfbsd_pc_in_sigtramp() seems to take only > 32-bit > > PowerPC in account, as on 64-bit PowerPC most kernel instruction > addresses will > > be wrongly reported as in sigtramp. > > > > This change adds proper sigtramp detection for PPC64. > > It's probably not worth fixing this in /usr/bin/gdb? At this point gdb is > only > installed for the kgdb in /usr/libexec on all platforms but sparc64 to > serve as > a fall-back for the crashinfo script in case the ports gdb isn't > installed. The > ports gdb should handle signal trampolines fine on ppc. It uses > instruction > matching patterns to detect trampolines on all supported platforms instead > of > static sigtramp locations. > > -- > John Baldwin > From owner-svn-src-head@freebsd.org Fri Nov 1 19:34:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2A3217FBC2; Fri, 1 Nov 2019 19:34:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474XSG4GzTz4fbH; Fri, 1 Nov 2019 19:34:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 8358C6A4; Fri, 1 Nov 2019 19:34:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r354239 - head/contrib/gdb/gdb To: luporl Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911011128.xA1BShOC057227@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Fri, 1 Nov 2019 12:34:02 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: 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.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2019 19:34:06 -0000 On 11/1/19 12:26 PM, luporl wrote: > Well, after evaluating remote kernel debugging through serial port, on > amd64, I've run into several issues while using latest ports gdb/kgdb. > I don't remember all of them, but were things like step/next not always > working, connection being lost, and similar things. > OTOH, /usr/libexec/kgdb worked fine and reliably, although older and more > limited. > This is probably due to some incompatibility in GDB Remote Serial Protocol, > between the kernel backend and newer GDB from ports. > > So, that's why I chose to use /usr/libexec/kgdb while fixing/enabling > remote debugging on PPC64, because it works reasonably well, and I could > focus on testing/fixing other parts first. > With only this change on gdb, it is now possible to use it to test some > basic functionality, like remote debugger attach, backtrace and data > inspection. > > My goal is not to fix every issue in /usr/libexec/kgdb, but just to get the > basics working, to then move on and switch to ports' GDB. What's odd about this commit is it only affects userland binaries, not the kernel, so a bit odd for kgdb, especially since the old kgdb in the tree doesn't include user support IIRC, only kernel bits (in modern gdb, kgdb is just a wrapper, and you can use 'target vmcore' from within gdb itself against a crash dump, etc.) -- John Baldwin From owner-svn-src-head@freebsd.org Fri Nov 1 19:42:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2907117FF75; Fri, 1 Nov 2019 19:42:57 +0000 (UTC) (envelope-from luporl@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474XfT0HVRz4g2C; Fri, 1 Nov 2019 19:42:57 +0000 (UTC) (envelope-from luporl@freebsd.org) Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: luporl/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id D28007DF; Fri, 1 Nov 2019 19:42:56 +0000 (UTC) (envelope-from luporl@freebsd.org) Received: by mail-io1-f45.google.com with SMTP id c6so12054874ioo.13; Fri, 01 Nov 2019 12:42:56 -0700 (PDT) X-Gm-Message-State: APjAAAW8ICd+6FKth9LYyuosQuGpySElDr5lLFgy6KWxucZ73TDpPDL+ agry5L/OC6hwXVGpvWTu3OJWCguGvGW4sZ8ISgg= X-Google-Smtp-Source: APXvYqxNiTm3fHKd1OEJ9jjxPSC7ap8y4zuytAag/uA1WBoUADlCxqw6iWgn+yVvcX6uuyVltne8hF/YZCu1j2Km02I= X-Received: by 2002:a02:1c41:: with SMTP id c62mr9208188jac.132.1572637376229; Fri, 01 Nov 2019 12:42:56 -0700 (PDT) MIME-Version: 1.0 References: <201911011128.xA1BShOC057227@repo.freebsd.org> In-Reply-To: From: luporl Date: Fri, 1 Nov 2019 16:42:45 -0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r354239 - head/contrib/gdb/gdb To: John Baldwin Cc: src-committers@freebsd.org, 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.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2019 19:42:57 -0000 The kernel parts were fixed by r354213 and r354214. I've used old kgdb to test remote debugging through serial only, not for inspecting crash dumps. On Fri, Nov 1, 2019 at 4:34 PM John Baldwin wrote: > On 11/1/19 12:26 PM, luporl wrote: > > Well, after evaluating remote kernel debugging through serial port, on > > amd64, I've run into several issues while using latest ports gdb/kgdb. > > I don't remember all of them, but were things like step/next not always > > working, connection being lost, and similar things. > > OTOH, /usr/libexec/kgdb worked fine and reliably, although older and more > > limited. > > This is probably due to some incompatibility in GDB Remote Serial > Protocol, > > between the kernel backend and newer GDB from ports. > > > > So, that's why I chose to use /usr/libexec/kgdb while fixing/enabling > > remote debugging on PPC64, because it works reasonably well, and I could > > focus on testing/fixing other parts first. > > With only this change on gdb, it is now possible to use it to test some > > basic functionality, like remote debugger attach, backtrace and data > > inspection. > > > > My goal is not to fix every issue in /usr/libexec/kgdb, but just to get > the > > basics working, to then move on and switch to ports' GDB. > > What's odd about this commit is it only affects userland binaries, not the > kernel, so a bit odd for kgdb, especially since the old kgdb in the tree > doesn't include user support IIRC, only kernel bits (in modern gdb, kgdb > is just a wrapper, and you can use 'target vmcore' from within gdb itself > against a crash dump, etc.) > > -- > John Baldwin > From owner-svn-src-head@freebsd.org Fri Nov 1 21:21:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 51BE11A364D for ; Fri, 1 Nov 2019 21:21:21 +0000 (UTC) (envelope-from ilya@bakulin.de) Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474Zr04Jkcz3HPy for ; Fri, 1 Nov 2019 21:21:20 +0000 (UTC) (envelope-from ilya@bakulin.de) Received: by mail-lf1-x134.google.com with SMTP id 195so8167949lfj.6 for ; Fri, 01 Nov 2019 14:21:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bakulin-de.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ETd2ezv4qQjF568YrqipIdIbrMabjDYsJFoQbAl3TY8=; b=WeYlZ1/NMzZCVqAos5PdqKiRv9xJuCoDcpyYN9SdBz7vsI30EIsM/WvCZwtIRyHmQH 9sJM/Lbf4XHzCNnvwccabWFTlz5VhOVePdKub0pcLH2E9lSoiDWr9wQmem4UwvtJJR0s F4dPgSdEPZlaIfqaS2sABcVJitlqGh3lq2rxyRv7lFiExU0II9OIuozo80mqKsQCgd4I QArn+sCcvb+Weps0uvmC7/CpRPX6WyUKu7pt+2dXEhAhf1tQi8c+Hedqr0vjL5Td5j+0 1VAZt/JcSO8evNZ88YxrccnTUkR+byCeIw4gbiUuCf9nh69koIHchu6Yqj6LpaJfEeQ+ UPiw== 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=ETd2ezv4qQjF568YrqipIdIbrMabjDYsJFoQbAl3TY8=; b=ETudpXhD2gbi5zDqYPwf9pZZ7hW5QLOsAesDOR5Wotm9IPBHnAr5y9mUaQp14AkQbU E0cx/bGXzmsqqkqof8kUL2upIxAcH06De6zjvJaGcwKLMxbCCfl47cmXq2Nto0nvVKM4 5l2Jx8VRiqtMcsHXFy5unVfMET9zCl7//Pkfbzb7q8KV/z0cTZzHWg0swH3CnepHaPX1 YLJ/AG5YdrzWjo3HlNe+1o8nmPFMk8MHRco3PiSfVteFuFfx6Ip1J4p5aVbBxmpsHSd0 PsBc3kdGoxgQvYfAj+qZ+I2BmqnddNX5GjPMU6bOtrF7PJzGhjizaKYHFFwgzE1XVZfg fiFw== X-Gm-Message-State: APjAAAXFQntnKhxMM6eaN8Awv5Grws6izUUYHkOF/J6QfXigu+kuhk24 RSxodlyr5YKJLp326m0gReYZ9n6H+xZAjvX35Zlvkw== X-Google-Smtp-Source: APXvYqzMF/dPMiQatg/urqeio05abpIafFxI7OHoYu3/zmexpXaRVA2hRf202j6Rj3SZ3m4c3b1EaCmrC6Us4Dz9mGQ= X-Received: by 2002:a19:6813:: with SMTP id d19mr8867874lfc.144.1572643278573; Fri, 01 Nov 2019 14:21:18 -0700 (PDT) MIME-Version: 1.0 References: <201910302043.x9UKhRth083957@repo.freebsd.org> <20191031135118.4e9222bb05879d1602bf3161@bidouilliste.com> In-Reply-To: <20191031135118.4e9222bb05879d1602bf3161@bidouilliste.com> From: Ilya Bakulin Date: Fri, 1 Nov 2019 22:21:07 +0100 Message-ID: Subject: Re: svn commit: r354206 - head/sys/arm/allwinner To: Emmanuel Vadot Cc: Ilya Bakulin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 474Zr04Jkcz3HPy X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bakulin-de.20150623.gappssmtp.com header.s=20150623 header.b=WeYlZ1/N; dmarc=none; spf=none (mx1.freebsd.org: domain of ilya@bakulin.de has no SPF policy when checking 2a00:1450:4864:20::134) smtp.mailfrom=ilya@bakulin.de X-Spamd-Result: default: False [-4.10 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[bakulin-de.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bakulin.de]; URI_COUNT_ODD(1.00)[9]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bakulin-de.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[4.3.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.80)[ip: (-9.13), ipnet: 2a00:1450::/32(-2.78), asn: 15169(-2.04), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2019 21:21:21 -0000 The first part (cam_sim_alloc -> cam_sim_alloc_dev) is necessary to properly fill cam_sim structure so that sdiob(4) can attach to the SDIO card. See https://svnweb.freebsd.org/base?view=revision&revision=r348800 for the details. The second part (new DEVMETHOD) is needed because now MMC adapter becomes a bus (like, something that has children) and without this change the kernel panics when trying to attach sdiob(4). On Thu, Oct 31, 2019 at 1:51 PM Emmanuel Vadot wrote: > On Wed, 30 Oct 2019 20:43:27 +0000 (UTC) > Ilya Bakulin wrote: > > > Author: kibab > > Date: Wed Oct 30 20:43:27 2019 > > New Revision: 354206 > > URL: https://svnweb.freebsd.org/changeset/base/354206 > > > > Log: > > Use the new cam_sim_alloc_dev function to properly initialize SIM > > > > Using cam_sim_alloc_dev() allows to properly set sim_dev field so that > > sdiob(4) can attach to the CAM device that represents SDIO card. > > The same change for SDHCI driver happened in r348800. > > > > Approved by: imp (mentor) > > Differential Revision: https://reviews.freebsd.org/D22192 > > > > Modified: > > head/sys/arm/allwinner/aw_mmc.c > > > > Modified: head/sys/arm/allwinner/aw_mmc.c > > > ============================================================================== > > --- head/sys/arm/allwinner/aw_mmc.c Wed Oct 30 20:08:10 2019 > (r354205) > > +++ head/sys/arm/allwinner/aw_mmc.c Wed Oct 30 20:43:27 2019 > (r354206) > > @@ -526,8 +526,8 @@ aw_mmc_attach(device_t dev) > > } > > > > mtx_init(&sc->sim_mtx, "awmmcsim", NULL, MTX_DEF); > > - sc->sim = cam_sim_alloc(aw_mmc_cam_action, aw_mmc_cam_poll, > > - "aw_mmc_sim", sc, device_get_unit(dev), > > + sc->sim = cam_sim_alloc_dev(aw_mmc_cam_action, aw_mmc_cam_poll, > > + "aw_mmc_sim", sc, dev, > > &sc->sim_mtx, 1, 1, sc->devq); > > > > if (sc->sim == NULL) { > > @@ -1514,6 +1514,7 @@ static device_method_t aw_mmc_methods[] = { > > /* Bus interface */ > > DEVMETHOD(bus_read_ivar, aw_mmc_read_ivar), > > DEVMETHOD(bus_write_ivar, aw_mmc_write_ivar), > > + DEVMETHOD(bus_add_child, bus_generic_add_child), > > Why is this change needed ? > > > > > /* MMC bridge interface */ > > DEVMETHOD(mmcbr_update_ios, aw_mmc_update_ios), > > > -- > Emmanuel Vadot > From owner-svn-src-head@freebsd.org Fri Nov 1 21:26:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D88371A37CC; Fri, 1 Nov 2019 21:26:44 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474ZyD5NYlz3HfP; Fri, 1 Nov 2019 21:26:44 +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 97EB919269; Fri, 1 Nov 2019 21:26:44 +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 xA1LQiul030198; Fri, 1 Nov 2019 21:26:44 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA1LQibN030196; Fri, 1 Nov 2019 21:26:44 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911012126.xA1LQibN030196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 1 Nov 2019 21:26:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354240 - in head/stand: efi/loader i386/libi386 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand: efi/loader i386/libi386 X-SVN-Commit-Revision: 354240 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2019 21:26:44 -0000 Author: imp Date: Fri Nov 1 21:26:43 2019 New Revision: 354240 URL: https://svnweb.freebsd.org/changeset/base/354240 Log: We don't support configuring serial PCI cards in EFI. Make this clearer in the source rather than obfuscaring it behind NO_PCI (nothing else declares that, so it's not making the ifdefs clearer). Modified: head/stand/efi/loader/Makefile head/stand/i386/libi386/comconsole.c Modified: head/stand/efi/loader/Makefile ============================================================================== --- head/stand/efi/loader/Makefile Fri Nov 1 11:28:43 2019 (r354239) +++ head/stand/efi/loader/Makefile Fri Nov 1 21:26:43 2019 (r354240) @@ -55,7 +55,7 @@ CFLAGS+= -I${EFISRC}/include CFLAGS+= -I${EFISRC}/include/${MACHINE} CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include CFLAGS+= -I${BOOTSRC}/i386/libi386 -CFLAGS+= -DNO_PCI -DEFI +CFLAGS+= -DEFI .if !defined(BOOT_HIDE_SERIAL_NUMBERS) # Export serial numbers, UUID, and asset tag from loader. Modified: head/stand/i386/libi386/comconsole.c ============================================================================== --- head/stand/i386/libi386/comconsole.c Fri Nov 1 11:28:43 2019 (r354239) +++ head/stand/i386/libi386/comconsole.c Fri Nov 1 21:26:43 2019 (r354240) @@ -214,7 +214,8 @@ comc_port_set(struct env_var *ev, int flags, const voi static uint32_t comc_parse_pcidev(const char *string) { -#ifdef NO_PCI +#ifdef EFI + /* We don't support PCI in EFI yet */ return (0); #else char *p, *p1; @@ -256,7 +257,8 @@ comc_parse_pcidev(const char *string) static int comc_pcidev_handle(uint32_t locator) { -#ifdef NO_PCI +#ifdef EFI + /* We don't support PCI in EFI yet */ return (CMD_ERROR); #else char intbuf[64]; From owner-svn-src-head@freebsd.org Fri Nov 1 22:49:45 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFDFF1A585C; Fri, 1 Nov 2019 22:49:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474cp14GSvz3MmK; Fri, 1 Nov 2019 22:49:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75C861A11F; Fri, 1 Nov 2019 22:49:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA1MnjRh089169; Fri, 1 Nov 2019 22:49:45 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA1Mnj0A089165; Fri, 1 Nov 2019 22:49:45 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911012249.xA1Mnj0A089165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 1 Nov 2019 22:49:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354241 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354241 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2019 22:49:45 -0000 Author: mav Date: Fri Nov 1 22:49:44 2019 New Revision: 354241 URL: https://svnweb.freebsd.org/changeset/base/354241 Log: Some more taskqueue optimizations. - Optimize enqueue for two task priority values by adding new tq_hint field, pointing to the last task inserted into the middle of the list. In case of more then two priority values it should halve average search. - Move tq_active insert/remove out of the taskqueue_run_locked loop. Instead of dirtying few shared cache lines per task introduce different mechanism to drain active tasks, based on task sequence number counter, that uses only cache lines already present in cache. Since the new mechanism does not need ordering, switch tq_active from TAILQ to LIST. - Move static and dynamic struct taskqueue fields into different cache lines. Move lock into its own cache line, so that heavy lock spinning by multiple waiting threads would not affect the running thread. - While there, correct some TQ_SLEEP() wait messages. This change fixes certain ZFS write workloads, causing huge congestion on taskqueue lock. Those workloads combine some large block writes to saturate the pool and trigger allocation throttling, which uses higher priority tasks to requeue the delayed I/Os, with many small blocks to generate deep queue of small tasks for taskqueue to sort. MFC after: 1 week Sponsored by: iXsystems, Inc. Modified: head/sys/kern/subr_gtaskqueue.c head/sys/kern/subr_taskqueue.c Modified: head/sys/kern/subr_gtaskqueue.c ============================================================================== --- head/sys/kern/subr_gtaskqueue.c Fri Nov 1 21:26:43 2019 (r354240) +++ head/sys/kern/subr_gtaskqueue.c Fri Nov 1 22:49:44 2019 (r354241) @@ -57,26 +57,26 @@ TASKQGROUP_DEFINE(softirq, mp_ncpus, 1); TASKQGROUP_DEFINE(config, 1, 1); struct gtaskqueue_busy { - struct gtask *tb_running; - TAILQ_ENTRY(gtaskqueue_busy) tb_link; + struct gtask *tb_running; + u_int tb_seq; + LIST_ENTRY(gtaskqueue_busy) tb_link; }; -static struct gtask * const TB_DRAIN_WAITER = (struct gtask *)0x1; - typedef void (*gtaskqueue_enqueue_fn)(void *context); struct gtaskqueue { STAILQ_HEAD(, gtask) tq_queue; + LIST_HEAD(, gtaskqueue_busy) tq_active; + u_int tq_seq; + int tq_callouts; + struct mtx_padalign tq_mutex; gtaskqueue_enqueue_fn tq_enqueue; void *tq_context; char *tq_name; - TAILQ_HEAD(, gtaskqueue_busy) tq_active; - struct mtx tq_mutex; struct thread **tq_threads; int tq_tcount; int tq_spin; int tq_flags; - int tq_callouts; taskqueue_callback_fn tq_callbacks[TASKQUEUE_NUM_CALLBACKS]; void *tq_cb_contexts[TASKQUEUE_NUM_CALLBACKS]; }; @@ -115,12 +115,11 @@ gtask_dump(struct gtask *gtask) #endif static __inline int -TQ_SLEEP(struct gtaskqueue *tq, void *p, struct mtx *m, int pri, const char *wm, - int t) +TQ_SLEEP(struct gtaskqueue *tq, void *p, const char *wm) { if (tq->tq_spin) - return (msleep_spin(p, m, wm, t)); - return (msleep(p, m, pri, wm, t)); + return (msleep_spin(p, (struct mtx *)&tq->tq_mutex, wm, 0)); + return (msleep(p, &tq->tq_mutex, 0, wm, 0)); } static struct gtaskqueue * @@ -144,7 +143,7 @@ _gtaskqueue_create(const char *name, int mflags, } STAILQ_INIT(&queue->tq_queue); - TAILQ_INIT(&queue->tq_active); + LIST_INIT(&queue->tq_active); queue->tq_enqueue = enqueue; queue->tq_context = context; queue->tq_name = tq_name; @@ -167,7 +166,7 @@ gtaskqueue_terminate(struct thread **pp, struct gtaskq while (tq->tq_tcount > 0 || tq->tq_callouts > 0) { wakeup(tq); - TQ_SLEEP(tq, pp, &tq->tq_mutex, PWAIT, "taskqueue_destroy", 0); + TQ_SLEEP(tq, pp, "gtq_destroy"); } } @@ -178,7 +177,7 @@ gtaskqueue_free(struct gtaskqueue *queue) TQ_LOCK(queue); queue->tq_flags &= ~TQ_FLAGS_ACTIVE; gtaskqueue_terminate(queue->tq_threads, queue); - KASSERT(TAILQ_EMPTY(&queue->tq_active), ("Tasks still running?")); + KASSERT(LIST_EMPTY(&queue->tq_active), ("Tasks still running?")); KASSERT(queue->tq_callouts == 0, ("Armed timeout tasks")); mtx_destroy(&queue->tq_mutex); free(queue->tq_threads, M_GTASKQUEUE); @@ -285,7 +284,7 @@ gtaskqueue_drain_tq_queue(struct gtaskqueue *queue) * have completed or are currently executing. */ while (t_barrier.ta_flags & TASK_ENQUEUED) - TQ_SLEEP(queue, &t_barrier, &queue->tq_mutex, PWAIT, "-", 0); + TQ_SLEEP(queue, &t_barrier, "gtq_qdrain"); } /* @@ -296,32 +295,25 @@ gtaskqueue_drain_tq_queue(struct gtaskqueue *queue) static void gtaskqueue_drain_tq_active(struct gtaskqueue *queue) { - struct gtaskqueue_busy tb_marker, *tb_first; + struct gtaskqueue_busy *tb; + u_int seq; - if (TAILQ_EMPTY(&queue->tq_active)) + if (LIST_EMPTY(&queue->tq_active)) return; /* Block taskq_terminate().*/ queue->tq_callouts++; - /* - * Wait for all currently executing taskqueue threads - * to go idle. - */ - tb_marker.tb_running = TB_DRAIN_WAITER; - TAILQ_INSERT_TAIL(&queue->tq_active, &tb_marker, tb_link); - while (TAILQ_FIRST(&queue->tq_active) != &tb_marker) - TQ_SLEEP(queue, &tb_marker, &queue->tq_mutex, PWAIT, "-", 0); - TAILQ_REMOVE(&queue->tq_active, &tb_marker, tb_link); + /* Wait for any active task with sequence from the past. */ + seq = queue->tq_seq; +restart: + LIST_FOREACH(tb, &queue->tq_active, tb_link) { + if ((int)(tb->tb_seq - seq) <= 0) { + TQ_SLEEP(queue, tb->tb_running, "gtq_adrain"); + goto restart; + } + } - /* - * Wakeup any other drain waiter that happened to queue up - * without any intervening active thread. - */ - tb_first = TAILQ_FIRST(&queue->tq_active); - if (tb_first != NULL && tb_first->tb_running == TB_DRAIN_WAITER) - wakeup(tb_first); - /* Release taskqueue_terminate(). */ queue->tq_callouts--; if ((queue->tq_flags & TQ_FLAGS_ACTIVE) == 0) @@ -352,40 +344,27 @@ static void gtaskqueue_run_locked(struct gtaskqueue *queue) { struct gtaskqueue_busy tb; - struct gtaskqueue_busy *tb_first; struct gtask *gtask; KASSERT(queue != NULL, ("tq is NULL")); TQ_ASSERT_LOCKED(queue); tb.tb_running = NULL; + LIST_INSERT_HEAD(&queue->tq_active, &tb, tb_link); - while (STAILQ_FIRST(&queue->tq_queue)) { - TAILQ_INSERT_TAIL(&queue->tq_active, &tb, tb_link); - - /* - * Carefully remove the first task from the queue and - * clear its TASK_ENQUEUED flag - */ - gtask = STAILQ_FIRST(&queue->tq_queue); - KASSERT(gtask != NULL, ("task is NULL")); + while ((gtask = STAILQ_FIRST(&queue->tq_queue)) != NULL) { STAILQ_REMOVE_HEAD(&queue->tq_queue, ta_link); gtask->ta_flags &= ~TASK_ENQUEUED; tb.tb_running = gtask; + tb.tb_seq = ++queue->tq_seq; TQ_UNLOCK(queue); KASSERT(gtask->ta_func != NULL, ("task->ta_func is NULL")); gtask->ta_func(gtask->ta_context); TQ_LOCK(queue); - tb.tb_running = NULL; wakeup(gtask); - - TAILQ_REMOVE(&queue->tq_active, &tb, tb_link); - tb_first = TAILQ_FIRST(&queue->tq_active); - if (tb_first != NULL && - tb_first->tb_running == TB_DRAIN_WAITER) - wakeup(tb_first); } + LIST_REMOVE(&tb, tb_link); } static int @@ -394,7 +373,7 @@ task_is_running(struct gtaskqueue *queue, struct gtask struct gtaskqueue_busy *tb; TQ_ASSERT_LOCKED(queue); - TAILQ_FOREACH(tb, &queue->tq_active, tb_link) { + LIST_FOREACH(tb, &queue->tq_active, tb_link) { if (tb->tb_running == gtask) return (1); } @@ -427,7 +406,7 @@ static void gtaskqueue_drain_locked(struct gtaskqueue *queue, struct gtask *gtask) { while ((gtask->ta_flags & TASK_ENQUEUED) || task_is_running(queue, gtask)) - TQ_SLEEP(queue, gtask, &queue->tq_mutex, PWAIT, "-", 0); + TQ_SLEEP(queue, gtask, "gtq_drain"); } void @@ -563,7 +542,7 @@ gtaskqueue_thread_loop(void *arg) */ if ((tq->tq_flags & TQ_FLAGS_ACTIVE) == 0) break; - TQ_SLEEP(tq, tq, &tq->tq_mutex, 0, "-", 0); + TQ_SLEEP(tq, tq, "-"); } gtaskqueue_run_locked(tq); /* @@ -589,7 +568,7 @@ gtaskqueue_thread_enqueue(void *context) tqp = context; tq = *tqp; - wakeup_one(tq); + wakeup_any(tq); } Modified: head/sys/kern/subr_taskqueue.c ============================================================================== --- head/sys/kern/subr_taskqueue.c Fri Nov 1 21:26:43 2019 (r354240) +++ head/sys/kern/subr_taskqueue.c Fri Nov 1 22:49:44 2019 (r354241) @@ -56,24 +56,25 @@ static void taskqueue_swi_enqueue(void *); static void taskqueue_swi_giant_enqueue(void *); struct taskqueue_busy { - struct task *tb_running; - TAILQ_ENTRY(taskqueue_busy) tb_link; + struct task *tb_running; + u_int tb_seq; + LIST_ENTRY(taskqueue_busy) tb_link; }; -struct task * const TB_DRAIN_WAITER = (struct task *)0x1; - struct taskqueue { STAILQ_HEAD(, task) tq_queue; + LIST_HEAD(, taskqueue_busy) tq_active; + struct task *tq_hint; + u_int tq_seq; + int tq_callouts; + struct mtx_padalign tq_mutex; taskqueue_enqueue_fn tq_enqueue; void *tq_context; char *tq_name; - TAILQ_HEAD(, taskqueue_busy) tq_active; - struct mtx tq_mutex; struct thread **tq_threads; int tq_tcount; int tq_spin; int tq_flags; - int tq_callouts; taskqueue_callback_fn tq_callbacks[TASKQUEUE_NUM_CALLBACKS]; void *tq_cb_contexts[TASKQUEUE_NUM_CALLBACKS]; }; @@ -116,12 +117,11 @@ _timeout_task_init(struct taskqueue *queue, struct tim } static __inline int -TQ_SLEEP(struct taskqueue *tq, void *p, struct mtx *m, int pri, const char *wm, - int t) +TQ_SLEEP(struct taskqueue *tq, void *p, const char *wm) { if (tq->tq_spin) - return (msleep_spin(p, m, wm, t)); - return (msleep(p, m, pri, wm, t)); + return (msleep_spin(p, (struct mtx *)&tq->tq_mutex, wm, 0)); + return (msleep(p, &tq->tq_mutex, 0, wm, 0)); } static struct taskqueue * @@ -145,7 +145,7 @@ _taskqueue_create(const char *name, int mflags, snprintf(tq_name, TASKQUEUE_NAMELEN, "%s", (name) ? name : "taskqueue"); STAILQ_INIT(&queue->tq_queue); - TAILQ_INIT(&queue->tq_active); + LIST_INIT(&queue->tq_active); queue->tq_enqueue = enqueue; queue->tq_context = context; queue->tq_name = tq_name; @@ -196,7 +196,7 @@ taskqueue_terminate(struct thread **pp, struct taskque while (tq->tq_tcount > 0 || tq->tq_callouts > 0) { wakeup(tq); - TQ_SLEEP(tq, pp, &tq->tq_mutex, PWAIT, "taskqueue_destroy", 0); + TQ_SLEEP(tq, pp, "tq_destroy"); } } @@ -207,7 +207,7 @@ taskqueue_free(struct taskqueue *queue) TQ_LOCK(queue); queue->tq_flags &= ~TQ_FLAGS_ACTIVE; taskqueue_terminate(queue->tq_threads, queue); - KASSERT(TAILQ_EMPTY(&queue->tq_active), ("Tasks still running?")); + KASSERT(LIST_EMPTY(&queue->tq_active), ("Tasks still running?")); KASSERT(queue->tq_callouts == 0, ("Armed timeout tasks")); mtx_destroy(&queue->tq_mutex); free(queue->tq_threads, M_TASKQUEUE); @@ -233,21 +233,30 @@ taskqueue_enqueue_locked(struct taskqueue *queue, stru } /* - * Optimise the case when all tasks have the same priority. + * Optimise cases when all tasks use small set of priorities. + * In case of only one priority we always insert at the end. + * In case of two tq_hint typically gives the insertion point. + * In case of more then two tq_hint should halve the search. */ prev = STAILQ_LAST(&queue->tq_queue, task, ta_link); if (!prev || prev->ta_priority >= task->ta_priority) { STAILQ_INSERT_TAIL(&queue->tq_queue, task, ta_link); } else { - prev = NULL; - for (ins = STAILQ_FIRST(&queue->tq_queue); ins; - prev = ins, ins = STAILQ_NEXT(ins, ta_link)) + prev = queue->tq_hint; + if (prev && prev->ta_priority >= task->ta_priority) { + ins = STAILQ_NEXT(prev, ta_link); + } else { + prev = NULL; + ins = STAILQ_FIRST(&queue->tq_queue); + } + for (; ins; prev = ins, ins = STAILQ_NEXT(ins, ta_link)) if (ins->ta_priority < task->ta_priority) break; - if (prev) + if (prev) { STAILQ_INSERT_AFTER(&queue->tq_queue, prev, task, ta_link); - else + queue->tq_hint = task; + } else STAILQ_INSERT_HEAD(&queue->tq_queue, task, ta_link); } @@ -364,6 +373,7 @@ taskqueue_drain_tq_queue(struct taskqueue *queue) */ TASK_INIT(&t_barrier, USHRT_MAX, taskqueue_task_nop_fn, &t_barrier); STAILQ_INSERT_TAIL(&queue->tq_queue, &t_barrier, ta_link); + queue->tq_hint = &t_barrier; t_barrier.ta_pending = 1; /* @@ -371,7 +381,7 @@ taskqueue_drain_tq_queue(struct taskqueue *queue) * have completed or are currently executing. */ while (t_barrier.ta_pending != 0) - TQ_SLEEP(queue, &t_barrier, &queue->tq_mutex, PWAIT, "-", 0); + TQ_SLEEP(queue, &t_barrier, "tq_qdrain"); return (1); } @@ -383,32 +393,25 @@ taskqueue_drain_tq_queue(struct taskqueue *queue) static int taskqueue_drain_tq_active(struct taskqueue *queue) { - struct taskqueue_busy tb_marker, *tb_first; + struct taskqueue_busy *tb; + u_int seq; - if (TAILQ_EMPTY(&queue->tq_active)) + if (LIST_EMPTY(&queue->tq_active)) return (0); /* Block taskq_terminate().*/ queue->tq_callouts++; - /* - * Wait for all currently executing taskqueue threads - * to go idle. - */ - tb_marker.tb_running = TB_DRAIN_WAITER; - TAILQ_INSERT_TAIL(&queue->tq_active, &tb_marker, tb_link); - while (TAILQ_FIRST(&queue->tq_active) != &tb_marker) - TQ_SLEEP(queue, &tb_marker, &queue->tq_mutex, PWAIT, "-", 0); - TAILQ_REMOVE(&queue->tq_active, &tb_marker, tb_link); + /* Wait for any active task with sequence from the past. */ + seq = queue->tq_seq; +restart: + LIST_FOREACH(tb, &queue->tq_active, tb_link) { + if ((int)(tb->tb_seq - seq) <= 0) { + TQ_SLEEP(queue, tb->tb_running, "tq_adrain"); + goto restart; + } + } - /* - * Wakeup any other drain waiter that happened to queue up - * without any intervening active thread. - */ - tb_first = TAILQ_FIRST(&queue->tq_active); - if (tb_first != NULL && tb_first->tb_running == TB_DRAIN_WAITER) - wakeup(tb_first); - /* Release taskqueue_terminate(). */ queue->tq_callouts--; if ((queue->tq_flags & TQ_FLAGS_ACTIVE) == 0) @@ -440,42 +443,31 @@ static void taskqueue_run_locked(struct taskqueue *queue) { struct taskqueue_busy tb; - struct taskqueue_busy *tb_first; struct task *task; int pending; KASSERT(queue != NULL, ("tq is NULL")); TQ_ASSERT_LOCKED(queue); tb.tb_running = NULL; + LIST_INSERT_HEAD(&queue->tq_active, &tb, tb_link); - while (STAILQ_FIRST(&queue->tq_queue)) { - TAILQ_INSERT_TAIL(&queue->tq_active, &tb, tb_link); - - /* - * Carefully remove the first task from the queue and - * zero its pending count. - */ - task = STAILQ_FIRST(&queue->tq_queue); - KASSERT(task != NULL, ("task is NULL")); + while ((task = STAILQ_FIRST(&queue->tq_queue)) != NULL) { STAILQ_REMOVE_HEAD(&queue->tq_queue, ta_link); + if (queue->tq_hint == task) + queue->tq_hint = NULL; pending = task->ta_pending; task->ta_pending = 0; tb.tb_running = task; + tb.tb_seq = ++queue->tq_seq; TQ_UNLOCK(queue); KASSERT(task->ta_func != NULL, ("task->ta_func is NULL")); task->ta_func(task->ta_context, pending); TQ_LOCK(queue); - tb.tb_running = NULL; wakeup(task); - - TAILQ_REMOVE(&queue->tq_active, &tb, tb_link); - tb_first = TAILQ_FIRST(&queue->tq_active); - if (tb_first != NULL && - tb_first->tb_running == TB_DRAIN_WAITER) - wakeup(tb_first); } + LIST_REMOVE(&tb, tb_link); } void @@ -493,7 +485,7 @@ task_is_running(struct taskqueue *queue, struct task * struct taskqueue_busy *tb; TQ_ASSERT_LOCKED(queue); - TAILQ_FOREACH(tb, &queue->tq_active, tb_link) { + LIST_FOREACH(tb, &queue->tq_active, tb_link) { if (tb->tb_running == task) return (1); } @@ -522,8 +514,11 @@ taskqueue_cancel_locked(struct taskqueue *queue, struc u_int *pendp) { - if (task->ta_pending > 0) + if (task->ta_pending > 0) { STAILQ_REMOVE(&queue->tq_queue, task, task, ta_link); + if (queue->tq_hint == task) + queue->tq_hint = NULL; + } if (pendp != NULL) *pendp = task->ta_pending; task->ta_pending = 0; @@ -572,7 +567,7 @@ taskqueue_drain(struct taskqueue *queue, struct task * TQ_LOCK(queue); while (task->ta_pending != 0 || task_is_running(queue, task)) - TQ_SLEEP(queue, task, &queue->tq_mutex, PWAIT, "-", 0); + TQ_SLEEP(queue, task, "tq_drain"); TQ_UNLOCK(queue); } @@ -791,7 +786,7 @@ taskqueue_thread_loop(void *arg) */ if ((tq->tq_flags & TQ_FLAGS_ACTIVE) == 0) break; - TQ_SLEEP(tq, tq, &tq->tq_mutex, 0, "-", 0); + TQ_SLEEP(tq, tq, "-"); } taskqueue_run_locked(tq); /* From owner-svn-src-head@freebsd.org Sat Nov 2 02:05:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 80C6C15C60F; Sat, 2 Nov 2019 02:05:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474j7V2rSZz428W; Sat, 2 Nov 2019 02:05:10 +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 449B01C529; Sat, 2 Nov 2019 02:05:10 +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 xA225ADW016330; Sat, 2 Nov 2019 02:05:10 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA225AAZ016329; Sat, 2 Nov 2019 02:05:10 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911020205.xA225AAZ016329@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 2 Nov 2019 02:05:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354242 - head/sys/dev/ena X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/ena X-SVN-Commit-Revision: 354242 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 02:05:10 -0000 Author: imp Date: Sat Nov 2 02:05:09 2019 New Revision: 354242 URL: https://svnweb.freebsd.org/changeset/base/354242 Log: Make valdiate_rx_req_id static inline because it uses other static inline functions. gcc complains about this, most likely due to the subtle differences between inline and static inline functions defined in headers. Modified: head/sys/dev/ena/ena.h Modified: head/sys/dev/ena/ena.h ============================================================================== --- head/sys/dev/ena/ena.h Fri Nov 1 22:49:44 2019 (r354241) +++ head/sys/dev/ena/ena.h Sat Nov 2 02:05:09 2019 (r354242) @@ -489,9 +489,8 @@ void ena_down(struct ena_adapter *); int ena_restore_device(struct ena_adapter *); void ena_destroy_device(struct ena_adapter *, bool); int ena_refill_rx_bufs(struct ena_ring *, uint32_t); -inline int validate_rx_req_id(struct ena_ring *, uint16_t); -inline int +static inline int validate_rx_req_id(struct ena_ring *rx_ring, uint16_t req_id) { if (likely(req_id < rx_ring->ring_size)) From owner-svn-src-head@freebsd.org Sat Nov 2 02:24:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3DE6E15CF33; Sat, 2 Nov 2019 02:24:54 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474jZG0w0dz42s5; Sat, 2 Nov 2019 02:24:54 +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 F25731C8A6; Sat, 2 Nov 2019 02:24:53 +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 xA22Orpb028220; Sat, 2 Nov 2019 02:24:53 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA22OrFi028219; Sat, 2 Nov 2019 02:24:53 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911020224.xA22OrFi028219@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 2 Nov 2019 02:24:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354243 - head/sys/powerpc/mpc85xx X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/mpc85xx X-SVN-Commit-Revision: 354243 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 02:24:54 -0000 Author: jhibbits Date: Sat Nov 2 02:24:53 2019 New Revision: 354243 URL: https://svnweb.freebsd.org/changeset/base/354243 Log: powerpc/mpc85xx: Set description for the MPC85xx RC bridge Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx_pcib.c Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx_pcib.c ============================================================================== --- head/sys/powerpc/mpc85xx/pci_mpc85xx_pcib.c Sat Nov 2 02:05:09 2019 (r354242) +++ head/sys/powerpc/mpc85xx/pci_mpc85xx_pcib.c Sat Nov 2 02:24:53 2019 (r354243) @@ -92,6 +92,8 @@ fsl_pcib_rc_probe(device_t dev) if (pci_get_subclass(dev) != PCIS_PROCESSOR_POWERPC) return (ENXIO); + device_set_desc(dev, "MPC85xx Root Complex bridge"); + return (BUS_PROBE_DEFAULT); } From owner-svn-src-head@freebsd.org Sat Nov 2 03:09:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3843B15E954; Sat, 2 Nov 2019 03:09:18 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474kYV0ksQz45FZ; Sat, 2 Nov 2019 03:09:18 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1A721D084; Sat, 2 Nov 2019 03:09:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA239HgZ053135; Sat, 2 Nov 2019 03:09:17 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA239HH2053134; Sat, 2 Nov 2019 03:09:17 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911020309.xA239HH2053134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Sat, 2 Nov 2019 03:09:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354244 - head/sys/netgraph X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netgraph X-SVN-Commit-Revision: 354244 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 03:09:18 -0000 Author: glebius Date: Sat Nov 2 03:09:17 2019 New Revision: 354244 URL: https://svnweb.freebsd.org/changeset/base/354244 Log: Fix regression from r353026. Pointer was increased instead of value pointed to. PR: 241646 Submitted by: Aleksandr Fedorov Modified: head/sys/netgraph/ng_bridge.c Modified: head/sys/netgraph/ng_bridge.c ============================================================================== --- head/sys/netgraph/ng_bridge.c Sat Nov 2 02:24:53 2019 (r354243) +++ head/sys/netgraph/ng_bridge.c Sat Nov 2 03:09:17 2019 (r354244) @@ -977,7 +977,7 @@ ng_bridge_unmute(hook_p hook, void *arg) ng_bridge_nodename(node), NG_HOOK_NAME(hook)); } } - counter++; + (*counter)++; return (1); } From owner-svn-src-head@freebsd.org Sat Nov 2 03:38:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DF9615FC51; Sat, 2 Nov 2019 03:38:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474lBc0TvKz477M; Sat, 2 Nov 2019 03:38:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E84281D602; Sat, 2 Nov 2019 03:37:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA23bxLo070873; Sat, 2 Nov 2019 03:37:59 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA23bw40070867; Sat, 2 Nov 2019 03:37:58 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911020337.xA23bw40070867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 2 Nov 2019 03:37:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354245 - in head/stand: . common liblua lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/stand: . common liblua lua X-SVN-Commit-Revision: 354245 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 03:38:00 -0000 Author: kevans Date: Sat Nov 2 03:37:58 2019 New Revision: 354245 URL: https://svnweb.freebsd.org/changeset/base/354245 Log: stand: consolidate knowledge of lua path Multiple places coordinate to 'know' where lua scripts are installed. Knock this down to being formally defined (and overridable) in exactly one spot, defs.mk, and spread the knowledge to loaders and liblua alike. A future commit will expose this to lua as loader.lua_path, so it can build absolute paths to lua scripts as needed. MFC after: 1 week Modified: head/stand/common/interp_lua.c head/stand/defs.mk head/stand/liblua/Makefile head/stand/liblua/luaconf.h head/stand/loader.mk head/stand/lua/Makefile Modified: head/stand/common/interp_lua.c ============================================================================== --- head/stand/common/interp_lua.c Sat Nov 2 03:09:17 2019 (r354244) +++ head/stand/common/interp_lua.c Sat Nov 2 03:37:58 2019 (r354245) @@ -60,6 +60,8 @@ static struct interp_lua_softc lua_softc; #define LDBG(...) #endif +#define LOADER_LUA LUA_PATH "/loader.lua" + INTERP_DEFINE("lua"); static void * @@ -120,7 +122,7 @@ interp_init(void) lua_pop(luap, 1); /* remove lib */ } - filename = "/boot/lua/loader.lua"; + filename = LOADER_LUA; if (interp_include(filename) != 0) { const char *errstr = lua_tostring(luap, -1); errstr = errstr == NULL ? "unknown" : errstr; Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Sat Nov 2 03:09:17 2019 (r354244) +++ head/stand/defs.mk Sat Nov 2 03:37:58 2019 (r354245) @@ -40,6 +40,9 @@ BOOTOBJ= ${OBJTOP}/stand # BINDIR is where we install BINDIR?= /boot +# LUAPATH is where we search for and install lua scripts. +LUAPATH?= /boot/lua + LIBSA= ${BOOTOBJ}/libsa/libsa.a .if ${MACHINE} == "i386" LIBSA32= ${LIBSA} Modified: head/stand/liblua/Makefile ============================================================================== --- head/stand/liblua/Makefile Sat Nov 2 03:09:17 2019 (r354244) +++ head/stand/liblua/Makefile Sat Nov 2 03:37:58 2019 (r354245) @@ -27,7 +27,7 @@ SRCS+= lerrno.c lfs.c lstd.c lutils.c WARNS= 3 -CFLAGS+= -DLUA_PATH_DEFAULT=\"/boot/lua/\?.lua\" +CFLAGS+= -DLUA_PATH=\"${LUAPATH}\" -DLUA_PATH_DEFAULT=\"${LUAPATH}/\?.lua\" CFLAGS+= -ffreestanding -nostdlib -DLUA_USE_POSIX CFLAGS+= -fno-stack-protector -D__BSD_VISIBLE CFLAGS+= -I${BOOTSRC}/include -I${LIBLUASRC} -I${LUASRC} -I${LDRSRC} Modified: head/stand/liblua/luaconf.h ============================================================================== --- head/stand/liblua/luaconf.h Sat Nov 2 03:09:17 2019 (r354244) +++ head/stand/liblua/luaconf.h Sat Nov 2 03:37:58 2019 (r354245) @@ -202,7 +202,7 @@ #else /* }{ */ -#define LUA_ROOT "/boot/lua/" LUA_VDIR "/" +#define LUA_ROOT LUA_PATH "/" LUA_VDIR "/" #define LUA_LDIR LUA_ROOT "share/" #define LUA_CDIR LUA_ROOT "lib/" #ifndef LUA_PATH_DEFAULT Modified: head/stand/loader.mk ============================================================================== --- head/stand/loader.mk Sat Nov 2 03:09:17 2019 (r354244) +++ head/stand/loader.mk Sat Nov 2 03:37:58 2019 (r354245) @@ -62,6 +62,7 @@ SRCS+= interp_lua.c .include "${BOOTSRC}/lua.mk" LDR_INTERP= ${LIBLUA} LDR_INTERP32= ${LIBLUA32} +CFLAGS+= -DLUA_PATH=\"${LUAPATH}\" .elif ${LOADER_INTERP} == "4th" SRCS+= interp_forth.c .include "${BOOTSRC}/ficl.mk" Modified: head/stand/lua/Makefile ============================================================================== --- head/stand/lua/Makefile Sat Nov 2 03:09:17 2019 (r354244) +++ head/stand/lua/Makefile Sat Nov 2 03:37:58 2019 (r354245) @@ -12,7 +12,7 @@ MAN= cli.lua.8 \ password.lua.8 \ screen.lua.8 -FILESDIR= /boot/lua +FILESDIR= ${LUAPATH} FILES= cli.lua \ color.lua \ config.lua \ From owner-svn-src-head@freebsd.org Sat Nov 2 03:41:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8091015FF5B; Sat, 2 Nov 2019 03:41:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474lGg2rwGz47Y9; Sat, 2 Nov 2019 03:41:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 462F61D658; Sat, 2 Nov 2019 03:41:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA23fVbo074261; Sat, 2 Nov 2019 03:41:31 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA23fVsW074260; Sat, 2 Nov 2019 03:41:31 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911020341.xA23fVsW074260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 2 Nov 2019 03:41:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354246 - head/stand/liblua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/liblua X-SVN-Commit-Revision: 354246 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 03:41:31 -0000 Author: kevans Date: Sat Nov 2 03:41:30 2019 New Revision: 354246 URL: https://svnweb.freebsd.org/changeset/base/354246 Log: liblua: add loader.lua_path As described previously, loader.lua_path is absolute path where scripts are installed. A future commit will use this to build paths for dofile in try_include, rather than the current pcall/require setup that makes it more difficult to coordinate loader aborts from local.lua -- we do not need the flexibility of require(), and local.lua is in-fact not a 'module-like' file as we will not be referencing anything from it. Modified: head/stand/liblua/lutils.c Modified: head/stand/liblua/lutils.c ============================================================================== --- head/stand/liblua/lutils.c Sat Nov 2 03:37:58 2019 (r354245) +++ head/stand/liblua/lutils.c Sat Nov 2 03:41:30 2019 (r354246) @@ -384,6 +384,8 @@ luaopen_loader(lua_State *L) lua_setfield(L, -2, "machine"); lua_pushstring(L, MACHINE_ARCH); lua_setfield(L, -2, "machine_arch"); + lua_pushstring(L, LUA_PATH); + lua_setfield(L, -2, "lua_path"); /* Set global printc to loader.printc */ lua_register(L, "printc", lua_printc); return 1; From owner-svn-src-head@freebsd.org Sat Nov 2 04:01:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA3C816066B; Sat, 2 Nov 2019 04:01:39 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474ljv4yzmz48Hj; Sat, 2 Nov 2019 04:01:39 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74FAB1D9F3; Sat, 2 Nov 2019 04:01:39 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA241du6088287; Sat, 2 Nov 2019 04:01:39 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA241dtl088286; Sat, 2 Nov 2019 04:01:39 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911020401.xA241dtl088286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 2 Nov 2019 04:01:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354247 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 354247 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 04:01:39 -0000 Author: kevans Date: Sat Nov 2 04:01:39 2019 New Revision: 354247 URL: https://svnweb.freebsd.org/changeset/base/354247 Log: lualoader: rewrite try_include using lfs + dofile Actual modules get require()'d in, rather than try_include(). All instances of try_include should be provided with proper hooks/API in the rest of loader to do the work they need to do, since we can't rely on them to exist. Convert this now to lfs + dofile since we won't really be treating them as modules. lfs is required because dofile will properly throw an error if the file doesn't exist, which is not in the spirit of 'optionally included'. Getting out of the pcall game allows us to provide a loader.exit() style call that backs out to the common bits of loader (autoboot sequence unless disabled with a loader.setenv("autoboot_delay", "NO")). The most ideal way identified so far to implement loader.exit() is to throw a special abort-style error that indicates to the caller in interp_lua that we've not actually errored out, just continue execution. Otherwise, we have to hack in logic to bubble up and return from loader.lua without continuing further, which gets kind of ugly depending on the context in which we're aborting. A compat shim is provided temporarily in case the executing loader doesn't yet have loader.lua_path, which was just added in r354246. Modified: head/stand/lua/core.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Sat Nov 2 03:41:30 2019 (r354246) +++ head/stand/lua/core.lua Sat Nov 2 04:01:39 2019 (r354247) @@ -69,12 +69,28 @@ end -- try_include will return the loaded module on success, or false and the error -- message on failure. function try_include(module) - local status, ret = pcall(require, module) - -- ret is the module if we succeeded. - if status then - return ret + if module:sub(1, 1) ~= "/" then + local lua_path = loader.lua_paths + -- XXX Temporary compat shim; this should be removed once the + -- loader.lua_path export has sufficiently spread. + if lua_path == nil then + lua_path = "/boot/lua" + end + module = lua_path .. "/" .. module + -- We only attempt to append an extension if an absolute path + -- wasn't specified. This assumes that the caller either wants + -- to treat this like it would require() and specify just the + -- base filename, or they know what they're doing as they've + -- specified an absolute path and we shouldn't impede. + if module:match(".lua$") == nil then + module = module .. ".lua" + end end - return false, ret + if lfs.attributes(module, "mode") ~= "file" then + return + end + + return dofile(module) end -- Module exports From owner-svn-src-head@freebsd.org Sat Nov 2 09:50:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 789FE17D202; Sat, 2 Nov 2019 09:50:37 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474vSY3Nj5z4Qdj; Sat, 2 Nov 2019 09:50:37 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 587B321879; Sat, 2 Nov 2019 09:50:37 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA29ob1I089333; Sat, 2 Nov 2019 09:50:37 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA29oaKU089330; Sat, 2 Nov 2019 09:50:36 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911020950.xA29oaKU089330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sat, 2 Nov 2019 09:50:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354249 - in head/stand/efi: include libefi loader X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in head/stand/efi: include libefi loader X-SVN-Commit-Revision: 354249 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 09:50:37 -0000 Author: tsoome Date: Sat Nov 2 09:50:36 2019 New Revision: 354249 URL: https://svnweb.freebsd.org/changeset/base/354249 Log: loader: fall back to term_emu on efi console with serial backend In case of efi console having serial backend (video + serial or only serial), we need to stick with old emulator till we can draw console. Eventually we would need to get console terminal emulator to be removed from serial console because the serial link already has the terminal. However, we need to implement comconsole on all efi platforms first, then we need the ability to draw console, so we do not have to use SimpleTextOutput protocol (which will write both on video and serial in case of multiplexed ComOut). Differential Revision: https://reviews.freebsd.org/D22161 Modified: head/stand/efi/include/efilib.h head/stand/efi/libefi/Makefile head/stand/efi/libefi/efi_console.c head/stand/efi/loader/main.c Modified: head/stand/efi/include/efilib.h ============================================================================== --- head/stand/efi/include/efilib.h Sat Nov 2 09:22:20 2019 (r354248) +++ head/stand/efi/include/efilib.h Sat Nov 2 09:50:36 2019 (r354249) @@ -106,6 +106,7 @@ EFI_STATUS errno_to_efi_status(int errno); void efi_time_init(void); void efi_time_fini(void); +int parse_uefi_con_out(void); bool efi_cons_update_mode(void); EFI_STATUS efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE* Xsystab); Modified: head/stand/efi/libefi/Makefile ============================================================================== --- head/stand/efi/libefi/Makefile Sat Nov 2 09:22:20 2019 (r354248) +++ head/stand/efi/libefi/Makefile Sat Nov 2 09:50:36 2019 (r354249) @@ -61,4 +61,9 @@ CFLAGS+= -I${LDRSRC} # Handle FreeBSD specific %b and %D printf format specifiers CFLAGS+= ${FORMAT_EXTENSIONS} +# Do not use TERM_EMU on arm and arm64 as it doesn't behave well with serial console +.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "aarch64" +CFLAGS+= -DTERM_EMU +.endif + .include Modified: head/stand/efi/libefi/efi_console.c ============================================================================== --- head/stand/efi/libefi/efi_console.c Sat Nov 2 09:22:20 2019 (r354248) +++ head/stand/efi/libefi/efi_console.c Sat Nov 2 09:50:36 2019 (r354249) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "bootstrap.h" @@ -38,6 +39,26 @@ static SIMPLE_TEXT_OUTPUT_INTERFACE *conout; static SIMPLE_INPUT_INTERFACE *conin; static EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *coninex; +static int mode; /* Does ConOut have serial console? */ + +static uint32_t utf8_left; +static uint32_t utf8_partial; +#ifdef TERM_EMU +#define DEFAULT_FGCOLOR EFI_LIGHTGRAY +#define DEFAULT_BGCOLOR EFI_BLACK + +#define MAXARGS 8 +static int args[MAXARGS], argc; +static int fg_c, bg_c, curx, cury; +static int esc; + +void get_pos(int *x, int *y); +void curs_move(int *_x, int *_y, int x, int y); +static void CL(int); +void HO(void); +void end_term(void); +#endif + static tf_bell_t efi_cons_bell; static tf_cursor_t efi_text_cursor; static tf_putchar_t efi_text_putchar; @@ -447,6 +468,340 @@ efi_set_colors(struct env_var *ev, int flags, const vo return (CMD_OK); } +#ifdef TERM_EMU +/* Get cursor position. */ +void +get_pos(int *x, int *y) +{ + *x = conout->Mode->CursorColumn; + *y = conout->Mode->CursorRow; +} + +/* Move cursor to x rows and y cols (0-based). */ +void +curs_move(int *_x, int *_y, int x, int y) +{ + conout->SetCursorPosition(conout, x, y); + if (_x != NULL) + *_x = conout->Mode->CursorColumn; + if (_y != NULL) + *_y = conout->Mode->CursorRow; +} + +/* Clear internal state of the terminal emulation code. */ +void +end_term(void) +{ + esc = 0; + argc = -1; +} +#endif + +static void +efi_cons_rawputchar(int c) +{ + int i; + UINTN x, y; + conout->QueryMode(conout, conout->Mode->Mode, &x, &y); + + if (c == '\t') { + int n; + + n = 8 - ((conout->Mode->CursorColumn + 8) % 8); + for (i = 0; i < n; i++) + efi_cons_rawputchar(' '); + } else { +#ifndef TERM_EMU + if (c == '\n') + efi_cons_efiputchar('\r'); + efi_cons_efiputchar(c); +#else + switch (c) { + case '\r': + curx = 0; + efi_cons_efiputchar('\r'); + return; + case '\n': + efi_cons_efiputchar('\n'); + efi_cons_efiputchar('\r'); + cury++; + if (cury >= y) + cury--; + curx = 0; + return; + case '\b': + if (curx > 0) { + efi_cons_efiputchar('\b'); + curx--; + } + return; + default: + efi_cons_efiputchar(c); + curx++; + if (curx > x-1) { + curx = 0; + cury++; + } + if (cury > y-1) { + curx = 0; + cury--; + } + } +#endif + } + conout->EnableCursor(conout, TRUE); +} + +#ifdef TERM_EMU +/* Gracefully exit ESC-sequence processing in case of misunderstanding. */ +static void +bail_out(int c) +{ + char buf[16], *ch; + int i; + + if (esc) { + efi_cons_rawputchar('\033'); + if (esc != '\033') + efi_cons_rawputchar(esc); + for (i = 0; i <= argc; ++i) { + sprintf(buf, "%d", args[i]); + ch = buf; + while (*ch) + efi_cons_rawputchar(*ch++); + } + } + efi_cons_rawputchar(c); + end_term(); +} + +/* Clear display from current position to end of screen. */ +static void +CD(void) +{ + int i; + UINTN x, y; + + get_pos(&curx, &cury); + if (curx == 0 && cury == 0) { + conout->ClearScreen(conout); + end_term(); + return; + } + + conout->QueryMode(conout, conout->Mode->Mode, &x, &y); + CL(0); /* clear current line from cursor to end */ + for (i = cury + 1; i < y-1; i++) { + curs_move(NULL, NULL, 0, i); + CL(0); + } + curs_move(NULL, NULL, curx, cury); + end_term(); +} + +/* + * Absolute cursor move to args[0] rows and args[1] columns + * (the coordinates are 1-based). + */ +static void +CM(void) +{ + if (args[0] > 0) + args[0]--; + if (args[1] > 0) + args[1]--; + curs_move(&curx, &cury, args[1], args[0]); + end_term(); +} + +/* Home cursor (left top corner), also called from mode command. */ +void +HO(void) +{ + argc = 1; + args[0] = args[1] = 1; + CM(); +} + +/* Clear line from current position to end of line */ +static void +CL(int direction) +{ + int i, len; + UINTN x, y; + CHAR16 *line; + + conout->QueryMode(conout, conout->Mode->Mode, &x, &y); + switch (direction) { + case 0: /* from cursor to end */ + len = x - curx + 1; + break; + case 1: /* from beginning to cursor */ + len = curx; + break; + case 2: /* entire line */ + len = x; + break; + default: /* NOTREACHED */ + __unreachable(); + } + + if (cury == y - 1) + len--; + + line = malloc(len * sizeof (CHAR16)); + if (line == NULL) { + printf("out of memory\n"); + return; + } + for (i = 0; i < len; i++) + line[i] = ' '; + line[len-1] = 0; + + if (direction != 0) + curs_move(NULL, NULL, 0, cury); + + conout->OutputString(conout, line); + /* restore cursor position */ + curs_move(NULL, NULL, curx, cury); + free(line); + end_term(); +} + +static void +get_arg(int c) +{ + if (argc < 0) + argc = 0; + args[argc] *= 10; + args[argc] += c - '0'; +} +#endif + +/* Emulate basic capabilities of cons25 terminal */ +static void +efi_term_emu(int c) +{ +#ifdef TERM_EMU + static int ansi_col[] = { + 0, 4, 2, 6, 1, 5, 3, 7 + }; + int t, i; + EFI_STATUS status; + + switch (esc) { + case 0: + switch (c) { + case '\033': + esc = c; + break; + default: + efi_cons_rawputchar(c); + break; + } + break; + case '\033': + switch (c) { + case '[': + esc = c; + args[0] = 0; + argc = -1; + break; + default: + bail_out(c); + break; + } + break; + case '[': + switch (c) { + case ';': + if (argc < 0) + argc = 0; + else if (argc + 1 >= MAXARGS) + bail_out(c); + else + args[++argc] = 0; + break; + case 'H': /* ho = \E[H */ + if (argc < 0) + HO(); + else if (argc == 1) + CM(); + else + bail_out(c); + break; + case 'J': /* cd = \E[J */ + if (argc < 0) + CD(); + else + bail_out(c); + break; + case 'm': + if (argc < 0) { + fg_c = DEFAULT_FGCOLOR; + bg_c = DEFAULT_BGCOLOR; + } + for (i = 0; i <= argc; ++i) { + switch (args[i]) { + case 0: /* back to normal */ + fg_c = DEFAULT_FGCOLOR; + bg_c = DEFAULT_BGCOLOR; + break; + case 1: /* bold */ + fg_c |= 0x8; + break; + case 4: /* underline */ + case 5: /* blink */ + bg_c |= 0x8; + break; + case 7: /* reverse */ + t = fg_c; + fg_c = bg_c; + bg_c = t; + break; + case 22: /* normal intensity */ + fg_c &= ~0x8; + break; + case 24: /* not underline */ + case 25: /* not blinking */ + bg_c &= ~0x8; + break; + case 30: case 31: case 32: case 33: + case 34: case 35: case 36: case 37: + fg_c = ansi_col[args[i] - 30]; + break; + case 39: /* normal */ + fg_c = DEFAULT_FGCOLOR; + break; + case 40: case 41: case 42: case 43: + case 44: case 45: case 46: case 47: + bg_c = ansi_col[args[i] - 40]; + break; + case 49: /* normal */ + bg_c = DEFAULT_BGCOLOR; + break; + } + } + conout->SetAttribute(conout, EFI_TEXT_ATTR(fg_c, bg_c)); + end_term(); + break; + default: + if (isdigit(c)) + get_arg(c); + else + bail_out(c); + break; + } + break; + default: + bail_out(c); + break; + } +#else + efi_cons_rawputchar(c); +#endif +} + bool efi_cons_update_mode(void) { @@ -461,35 +816,58 @@ efi_cons_update_mode(void) rows = 24; } - if (buffer != NULL) { - if (tp.tp_row == rows && tp.tp_col == cols) - return (true); - free(buffer); - } else { - teken_init(&teken, &tf, NULL); - } + /* + * When we have serial port listed in ConOut, use pre-teken emulator, + * if built with. + * The problem is, we can not output text on efi and comconsole when + * efi also has comconsole bound. But then again, we need to have + * terminal emulator for efi text mode to support the menu. + * While teken is too expensive to be used on serial console, the + * pre-teken emulator is light enough to be used on serial console. + */ + mode = parse_uefi_con_out(); + if ((mode & RB_SERIAL) == 0) { + if (buffer != NULL) { + if (tp.tp_row == rows && tp.tp_col == cols) + return (true); + free(buffer); + } else { + teken_init(&teken, &tf, NULL); + } - tp.tp_row = rows; - tp.tp_col = cols; - buffer = malloc(rows * cols * sizeof(*buffer)); - if (buffer == NULL) - return (false); + tp.tp_row = rows; + tp.tp_col = cols; + buffer = malloc(rows * cols * sizeof(*buffer)); + if (buffer == NULL) + return (false); - teken_set_winsize(&teken, &tp); - a = teken_get_defattr(&teken); + teken_set_winsize(&teken, &tp); + a = teken_get_defattr(&teken); - snprintf(env, sizeof(env), "%d", a->ta_fgcolor); - env_setenv("teken.fg_color", EV_VOLATILE, env, efi_set_colors, - env_nounset); - snprintf(env, sizeof(env), "%d", a->ta_bgcolor); - env_setenv("teken.bg_color", EV_VOLATILE, env, efi_set_colors, - env_nounset); + snprintf(env, sizeof(env), "%d", a->ta_fgcolor); + env_setenv("teken.fg_color", EV_VOLATILE, env, efi_set_colors, + env_nounset); + snprintf(env, sizeof(env), "%d", a->ta_bgcolor); + env_setenv("teken.bg_color", EV_VOLATILE, env, efi_set_colors, + env_nounset); - for (int row = 0; row < rows; row++) - for (int col = 0; col < cols; col++) { - buffer[col + row * tp.tp_col].c = ' '; - buffer[col + row * tp.tp_col].a = *a; + for (int row = 0; row < rows; row++) { + for (int col = 0; col < cols; col++) { + buffer[col + row * tp.tp_col].c = ' '; + buffer[col + row * tp.tp_col].a = *a; + } } + } else { +#ifdef TERM_EMU + conout->SetAttribute(conout, EFI_TEXT_ATTR(DEFAULT_FGCOLOR, + DEFAULT_BGCOLOR)); + end_term(); + get_pos(&curx, &cury); + curs_move(&curx, &cury, curx, cury); + fg_c = DEFAULT_FGCOLOR; + bg_c = DEFAULT_BGCOLOR; +#endif + } snprintf(env, sizeof (env), "%u", (unsigned)rows); setenv("LINES", env, 1); @@ -522,10 +900,108 @@ efi_cons_init(int arg) return (1); } +static void +input_partial(void) +{ + unsigned i; + uint32_t c; + + if (utf8_left == 0) + return; + + for (i = 0; i < sizeof(utf8_partial); i++) { + c = (utf8_partial >> (24 - (i << 3))) & 0xff; + if (c != 0) + efi_term_emu(c); + } + utf8_left = 0; + utf8_partial = 0; +} + +static void +input_byte(uint8_t c) +{ + if ((c & 0x80) == 0x00) { + /* One-byte sequence. */ + input_partial(); + efi_term_emu(c); + return; + } + if ((c & 0xe0) == 0xc0) { + /* Two-byte sequence. */ + input_partial(); + utf8_left = 1; + utf8_partial = c; + return; + } + if ((c & 0xf0) == 0xe0) { + /* Three-byte sequence. */ + input_partial(); + utf8_left = 2; + utf8_partial = c; + return; + } + if ((c & 0xf8) == 0xf0) { + /* Four-byte sequence. */ + input_partial(); + utf8_left = 3; + utf8_partial = c; + return; + } + if ((c & 0xc0) == 0x80) { + /* Invalid state? */ + if (utf8_left == 0) { + efi_term_emu(c); + return; + } + utf8_left--; + utf8_partial = (utf8_partial << 8) | c; + if (utf8_left == 0) { + uint32_t v, u; + uint8_t b; + + v = 0; + u = utf8_partial; + b = (u >> 24) & 0xff; + if (b != 0) { /* Four-byte sequence */ + v = b & 0x07; + b = (u >> 16) & 0xff; + v = (v << 6) | (b & 0x3f); + b = (u >> 8) & 0xff; + v = (v << 6) | (b & 0x3f); + b = u & 0xff; + v = (v << 6) | (b & 0x3f); + } else if ((b = (u >> 16) & 0xff) != 0) { + v = b & 0x0f; /* Three-byte sequence */ + b = (u >> 8) & 0xff; + v = (v << 6) | (b & 0x3f); + b = u & 0xff; + v = (v << 6) | (b & 0x3f); + } else if ((b = (u >> 8) & 0xff) != 0) { + v = b & 0x1f; /* Two-byte sequence */ + b = u & 0xff; + v = (v << 6) | (b & 0x3f); + } + /* Send unicode char directly to console. */ + efi_cons_efiputchar(v); + utf8_partial = 0; + } + return; + } + /* Anything left is illegal in UTF-8 sequence. */ + input_partial(); + efi_term_emu(c); +} + void efi_cons_putchar(int c) { unsigned char ch = c; + + if ((mode & RB_SERIAL) != 0) { + input_byte(ch); + return; + } if (buffer != NULL) teken_input(&teken, &ch, sizeof (ch)); Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Sat Nov 2 09:22:20 2019 (r354248) +++ head/stand/efi/loader/main.c Sat Nov 2 09:50:36 2019 (r354249) @@ -688,7 +688,7 @@ setenv_int(const char *key, int val) * ACPI name space to map the UID for the serial port to a port. The * latter is especially hard. */ -static int +int parse_uefi_con_out(void) { int how, rv; From owner-svn-src-head@freebsd.org Sat Nov 2 10:14:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A32A17DD8C; Sat, 2 Nov 2019 10:14:16 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474vzq6Ts4z4Rmw; Sat, 2 Nov 2019 10:14:15 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C205521E0B; Sat, 2 Nov 2019 10:14:15 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA2AEF0B006799; Sat, 2 Nov 2019 10:14:15 GMT (envelope-from phk@FreeBSD.org) Received: (from phk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA2AEFeY006798; Sat, 2 Nov 2019 10:14:15 GMT (envelope-from phk@FreeBSD.org) Message-Id: <201911021014.xA2AEFeY006798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phk set sender to phk@FreeBSD.org using -f From: Poul-Henning Kamp Date: Sat, 2 Nov 2019 10:14:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354250 - head/tools/tools/gensnmpdef X-SVN-Group: head X-SVN-Commit-Author: phk X-SVN-Commit-Paths: head/tools/tools/gensnmpdef X-SVN-Commit-Revision: 354250 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 10:14:16 -0000 Author: phk Date: Sat Nov 2 10:14:15 2019 New Revision: 354250 URL: https://svnweb.freebsd.org/changeset/base/354250 Log: Mention that ports/net-mgmt/libsmi is required Modified: head/tools/tools/gensnmpdef/Makefile Modified: head/tools/tools/gensnmpdef/Makefile ============================================================================== --- head/tools/tools/gensnmpdef/Makefile Sat Nov 2 09:50:36 2019 (r354249) +++ head/tools/tools/gensnmpdef/Makefile Sat Nov 2 10:14:15 2019 (r354250) @@ -1,4 +1,6 @@ # $FreeBSD$ +# +# NB: Install ports/net-mgmt/libsmi .PATH: ${SRCTOP}/contrib/bsnmp/gensnmpdef From owner-svn-src-head@freebsd.org Sat Nov 2 10:15:35 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 10A3417DE6E; Sat, 2 Nov 2019 10:15:35 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474w1L6kncz4RwD; Sat, 2 Nov 2019 10:15:34 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA99E21E11; Sat, 2 Nov 2019 10:15:34 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA2AFYO0006912; Sat, 2 Nov 2019 10:15:34 GMT (envelope-from phk@FreeBSD.org) Received: (from phk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA2AFY8t006911; Sat, 2 Nov 2019 10:15:34 GMT (envelope-from phk@FreeBSD.org) Message-Id: <201911021015.xA2AFY8t006911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phk set sender to phk@FreeBSD.org using -f From: Poul-Henning Kamp Date: Sat, 2 Nov 2019 10:15:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354251 - head/tools/tools/nanobsd X-SVN-Group: head X-SVN-Commit-Author: phk X-SVN-Commit-Paths: head/tools/tools/nanobsd X-SVN-Commit-Revision: 354251 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 10:15:35 -0000 Author: phk Date: Sat Nov 2 10:15:34 2019 New Revision: 354251 URL: https://svnweb.freebsd.org/changeset/base/354251 Log: If /usr/obj is a symlink, cpio(1) needs persuation to DTRT. Modified: head/tools/tools/nanobsd/defaults.sh Modified: head/tools/tools/nanobsd/defaults.sh ============================================================================== --- head/tools/tools/nanobsd/defaults.sh Sat Nov 2 10:14:15 2019 (r354250) +++ head/tools/tools/nanobsd/defaults.sh Sat Nov 2 10:15:34 2019 (r354251) @@ -193,6 +193,9 @@ NANO_DATADIR="" SRCCONF=/dev/null SRC_ENV_CONF=/dev/null +# Comment this out if /usr/obj is a symlink +# CPIO_SYMLINK=--insecure + ####################################################################### # # The functions which do the real work. @@ -523,7 +526,7 @@ setup_nanobsd ( ) ( if [ -d usr/local/etc ] ; then ( cd usr/local/etc - find . -print | cpio -dumpl ../../../etc/local + find . -print | cpio ${CPIO_SYMLINK} -dumpl ../../../etc/local cd .. rm -xrf etc ) @@ -542,7 +545,7 @@ setup_nanobsd ( ) ( # we use hard links so we have them both places. # the files in /$d will be hidden by the mount. mkdir -p conf/base/$d conf/default/$d - find $d -print | cpio -dumpl conf/base/ + find $d -print | cpio ${CPIO_SYMLINK} -dumpl conf/base/ done echo "$NANO_RAM_ETCSIZE" > conf/base/etc/md_size @@ -623,7 +626,7 @@ populate_slice ( ) ( if [ -n "${dir}" -a -d "${dir}" ]; then echo "Populating ${lbl} from ${dir}" cd "${dir}" - find . -print | grep -Ev '/(CVS|\.svn|\.hg|\.git)/' | cpio -dumpv ${mnt} + find . -print | grep -Ev '/(CVS|\.svn|\.hg|\.git)/' | cpio ${CPIO_SYMLINK} -dumpv ${mnt} fi df -i ${mnt} nano_umount ${mnt} @@ -731,7 +734,7 @@ cust_allow_ssh_root ( ) ( cust_install_files ( ) ( cd "${NANO_TOOLS}/Files" - find . -print | grep -Ev '/(CVS|\.svn|\.hg|\.git)/' | cpio -Ldumpv ${NANO_WORLDDIR} + find . -print | grep -Ev '/(CVS|\.svn|\.hg|\.git)/' | cpio ${CPIO_SYMLINK} -Ldumpv ${NANO_WORLDDIR} if [ -n "${NANO_CUST_FILES_MTREE}" -a -f ${NANO_CUST_FILES_MTREE} ]; then CR "mtree -eiU -p /" <${NANO_CUST_FILES_MTREE} From owner-svn-src-head@freebsd.org Sat Nov 2 10:53:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCDEA17F0B9; Sat, 2 Nov 2019 10:53:23 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474wrz4gSmz4TjP; Sat, 2 Nov 2019 10:53:23 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 845742254B; Sat, 2 Nov 2019 10:53:23 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA2ArNcj030348; Sat, 2 Nov 2019 10:53:23 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA2ArNHj030347; Sat, 2 Nov 2019 10:53:23 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911021053.xA2ArNHj030347@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sat, 2 Nov 2019 10:53:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354252 - head/stand/i386/libi386 X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/i386/libi386 X-SVN-Commit-Revision: 354252 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 10:53:23 -0000 Author: tsoome Date: Sat Nov 2 10:53:23 2019 New Revision: 354252 URL: https://svnweb.freebsd.org/changeset/base/354252 Log: loader: libi386/comconsole.c cstyle cleanup Only cstyle, no functional changes. Modified: head/stand/i386/libi386/comconsole.c Modified: head/stand/i386/libi386/comconsole.c ============================================================================== --- head/stand/i386/libi386/comconsole.c Sat Nov 2 10:15:34 2019 (r354251) +++ head/stand/i386/libi386/comconsole.c Sat Nov 2 10:53:23 2019 (r354252) @@ -67,144 +67,144 @@ static int comc_port = COMPORT; static uint32_t comc_locator; struct console comconsole = { - "comconsole", - "serial port", - 0, - comc_probe, - comc_init, - comc_putchar, - comc_getchar, - comc_ischar + .c_name = "comconsole", + .c_desc = "serial port", + .c_flags = 0, + .c_probe = comc_probe, + .c_init = comc_init, + .c_out = comc_putchar, + .c_in = comc_getchar, + .c_ready = comc_ischar }; static void comc_probe(struct console *cp) { - char intbuf[16]; - char *cons, *env; - int speed, port; - uint32_t locator; + char intbuf[16]; + char *cons, *env; + int speed, port; + uint32_t locator; - if (comc_curspeed == 0) { - comc_curspeed = COMSPEED; - /* - * Assume that the speed was set by an earlier boot loader if - * comconsole is already the preferred console. - */ - cons = getenv("console"); - if ((cons != NULL && strcmp(cons, comconsole.c_name) == 0) || - getenv("boot_multicons") != NULL) { - comc_curspeed = comc_getspeed(); - } + if (comc_curspeed == 0) { + comc_curspeed = COMSPEED; + /* + * Assume that the speed was set by an earlier boot loader if + * comconsole is already the preferred console. + */ + cons = getenv("console"); + if ((cons != NULL && strcmp(cons, comconsole.c_name) == 0) || + getenv("boot_multicons") != NULL) { + comc_curspeed = comc_getspeed(); + } - env = getenv("comconsole_speed"); - if (env != NULL) { - speed = comc_parseint(env); - if (speed > 0) - comc_curspeed = speed; - } + env = getenv("comconsole_speed"); + if (env != NULL) { + speed = comc_parseint(env); + if (speed > 0) + comc_curspeed = speed; + } - sprintf(intbuf, "%d", comc_curspeed); - unsetenv("comconsole_speed"); - env_setenv("comconsole_speed", EV_VOLATILE, intbuf, comc_speed_set, - env_nounset); + sprintf(intbuf, "%d", comc_curspeed); + unsetenv("comconsole_speed"); + env_setenv("comconsole_speed", EV_VOLATILE, intbuf, + comc_speed_set, env_nounset); - env = getenv("comconsole_port"); - if (env != NULL) { - port = comc_parseint(env); - if (port > 0) - comc_port = port; - } + env = getenv("comconsole_port"); + if (env != NULL) { + port = comc_parseint(env); + if (port > 0) + comc_port = port; + } - sprintf(intbuf, "%d", comc_port); - unsetenv("comconsole_port"); - env_setenv("comconsole_port", EV_VOLATILE, intbuf, comc_port_set, - env_nounset); + sprintf(intbuf, "%d", comc_port); + unsetenv("comconsole_port"); + env_setenv("comconsole_port", EV_VOLATILE, intbuf, + comc_port_set, env_nounset); - env = getenv("comconsole_pcidev"); - if (env != NULL) { - locator = comc_parse_pcidev(env); - if (locator != 0) - comc_pcidev_handle(locator); - } + env = getenv("comconsole_pcidev"); + if (env != NULL) { + locator = comc_parse_pcidev(env); + if (locator != 0) + comc_pcidev_handle(locator); + } - unsetenv("comconsole_pcidev"); - env_setenv("comconsole_pcidev", EV_VOLATILE, env, comc_pcidev_set, - env_nounset); - } - comc_setup(comc_curspeed, comc_port); + unsetenv("comconsole_pcidev"); + env_setenv("comconsole_pcidev", EV_VOLATILE, env, + comc_pcidev_set, env_nounset); + } + comc_setup(comc_curspeed, comc_port); } static int comc_init(int arg) { - comc_setup(comc_curspeed, comc_port); + comc_setup(comc_curspeed, comc_port); - if ((comconsole.c_flags & (C_PRESENTIN | C_PRESENTOUT)) == - (C_PRESENTIN | C_PRESENTOUT)) - return (CMD_OK); - return (CMD_ERROR); + if ((comconsole.c_flags & (C_PRESENTIN | C_PRESENTOUT)) == + (C_PRESENTIN | C_PRESENTOUT)) + return (CMD_OK); + return (CMD_ERROR); } static void comc_putchar(int c) { - int wait; + int wait; - for (wait = COMC_TXWAIT; wait > 0; wait--) - if (inb(comc_port + com_lsr) & LSR_TXRDY) { - outb(comc_port + com_data, (u_char)c); - break; - } + for (wait = COMC_TXWAIT; wait > 0; wait--) + if (inb(comc_port + com_lsr) & LSR_TXRDY) { + outb(comc_port + com_data, (u_char)c); + break; + } } static int comc_getchar(void) { - return (comc_ischar() ? inb(comc_port + com_data) : -1); + return (comc_ischar() ? inb(comc_port + com_data) : -1); } static int comc_ischar(void) { - return (inb(comc_port + com_lsr) & LSR_RXRDY); + return (inb(comc_port + com_lsr) & LSR_RXRDY); } static int comc_speed_set(struct env_var *ev, int flags, const void *value) { - int speed; + int speed; - if (value == NULL || (speed = comc_parseint(value)) <= 0) { - printf("Invalid speed\n"); - return (CMD_ERROR); - } + if (value == NULL || (speed = comc_parseint(value)) <= 0) { + printf("Invalid speed\n"); + return (CMD_ERROR); + } - if (comc_curspeed != speed) - comc_setup(speed, comc_port); + if (comc_curspeed != speed) + comc_setup(speed, comc_port); - env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); + env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); - return (CMD_OK); + return (CMD_OK); } static int comc_port_set(struct env_var *ev, int flags, const void *value) { - int port; + int port; - if (value == NULL || (port = comc_parseint(value)) <= 0) { - printf("Invalid port\n"); - return (CMD_ERROR); - } + if (value == NULL || (port = comc_parseint(value)) <= 0) { + printf("Invalid port\n"); + return (CMD_ERROR); + } - if (comc_port != port) - comc_setup(comc_curspeed, port); + if (comc_port != port) + comc_setup(comc_curspeed, port); - env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); + env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); - return (CMD_OK); + return (CMD_OK); } /* @@ -320,46 +320,46 @@ comc_pcidev_set(struct env_var *ev, int flags, const v static void comc_setup(int speed, int port) { - static int TRY_COUNT = 1000000; - char intbuf[64]; - int tries; + static int TRY_COUNT = 1000000; + char intbuf[64]; + int tries; - unsetenv("hw.uart.console"); - comc_curspeed = speed; - comc_port = port; - if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) == 0) - return; + unsetenv("hw.uart.console"); + comc_curspeed = speed; + comc_port = port; + if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) == 0) + return; - outb(comc_port + com_cfcr, CFCR_DLAB | COMC_FMT); - outb(comc_port + com_dlbl, COMC_BPS(speed) & 0xff); - outb(comc_port + com_dlbh, COMC_BPS(speed) >> 8); - outb(comc_port + com_cfcr, COMC_FMT); - outb(comc_port + com_mcr, MCR_RTS | MCR_DTR); + outb(comc_port + com_cfcr, CFCR_DLAB | COMC_FMT); + outb(comc_port + com_dlbl, COMC_BPS(speed) & 0xff); + outb(comc_port + com_dlbh, COMC_BPS(speed) >> 8); + outb(comc_port + com_cfcr, COMC_FMT); + outb(comc_port + com_mcr, MCR_RTS | MCR_DTR); - tries = 0; - do - inb(comc_port + com_data); - while (inb(comc_port + com_lsr) & LSR_RXRDY && ++tries < TRY_COUNT); + tries = 0; + do + inb(comc_port + com_data); + while (inb(comc_port + com_lsr) & LSR_RXRDY && ++tries < TRY_COUNT); - if (tries < TRY_COUNT) { - comconsole.c_flags |= (C_PRESENTIN | C_PRESENTOUT); - sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed); - env_setenv("hw.uart.console", EV_VOLATILE, intbuf, NULL, NULL); - } else - comconsole.c_flags &= ~(C_PRESENTIN | C_PRESENTOUT); + if (tries < TRY_COUNT) { + comconsole.c_flags |= (C_PRESENTIN | C_PRESENTOUT); + sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed); + env_setenv("hw.uart.console", EV_VOLATILE, intbuf, NULL, NULL); + } else + comconsole.c_flags &= ~(C_PRESENTIN | C_PRESENTOUT); } static int comc_parseint(const char *speedstr) { - char *p; - int speed; + char *p; + int speed; - speed = strtol(speedstr, &p, 0); - if (p == speedstr || *p != '\0' || speed <= 0) - return (-1); + speed = strtol(speedstr, &p, 0); + if (p == speedstr || *p != '\0' || speed <= 0) + return (-1); - return (speed); + return (speed); } static int From owner-svn-src-head@freebsd.org Sat Nov 2 12:28:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACC1B1A39BB; Sat, 2 Nov 2019 12:28:07 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474yyH4wXyz4bnC; Sat, 2 Nov 2019 12:28:07 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BFE0235D9; Sat, 2 Nov 2019 12:28:07 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA2CS7pw085539; Sat, 2 Nov 2019 12:28:07 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA2CS5mr085528; Sat, 2 Nov 2019 12:28:05 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911021228.xA2CS5mr085528@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sat, 2 Nov 2019 12:28:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354253 - in head: cddl/lib/libzpool stand/efi/boot1 stand/i386/gptzfsboot stand/i386/zfsboot stand/libsa stand/libsa/zfs sys/cddl/boot/zfs sys/cddl/contrib/opensolaris/common/lz4 sys/c... X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in head: cddl/lib/libzpool stand/efi/boot1 stand/i386/gptzfsboot stand/i386/zfsboot stand/libsa stand/libsa/zfs sys/cddl/boot/zfs sys/cddl/contrib/opensolaris/common/lz4 sys/cddl/contrib/opensolaris/u... X-SVN-Commit-Revision: 354253 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 12:28:07 -0000 Author: tsoome Date: Sat Nov 2 12:28:04 2019 New Revision: 354253 URL: https://svnweb.freebsd.org/changeset/base/354253 Log: Remove duplicate lz4 implementations Port illumos change: https://www.illumos.org/issues/11667 Move lz4.c out of zfs tree to opensolaris/common/lz4, adjust it to be usable from kernel/stand/userland builds, so we can use just one single source. Add lz4.h to declare lz4_compress() and lz4_decompress(). MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D22037 Added: head/sys/cddl/contrib/opensolaris/common/lz4/ head/sys/cddl/contrib/opensolaris/common/lz4/lz4.c - copied, changed from r354252, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c head/sys/cddl/contrib/opensolaris/common/lz4/lz4.h (contents, props changed) Deleted: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c Modified: head/cddl/lib/libzpool/Makefile head/stand/efi/boot1/Makefile head/stand/i386/gptzfsboot/Makefile head/stand/i386/zfsboot/Makefile head/stand/libsa/Makefile head/stand/libsa/zfs/Makefile.inc head/sys/cddl/boot/zfs/zfssubr.c head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files head/sys/modules/zfs/Makefile Modified: head/cddl/lib/libzpool/Makefile ============================================================================== --- head/cddl/lib/libzpool/Makefile Sat Nov 2 10:53:23 2019 (r354252) +++ head/cddl/lib/libzpool/Makefile Sat Nov 2 12:28:04 2019 (r354253) @@ -8,6 +8,8 @@ .PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua # ZFS_SHARED_SRCS .PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs +# LZ4_COMMON_SRCS +.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 # KERNEL_SRCS .PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common # LIST_SRCS @@ -32,6 +34,7 @@ LIB= zpool ZFS_COMMON_SRCS= ${ZFS_COMMON_OBJS:C/.o$/.c/} trim_map.c ZFS_SHARED_SRCS= ${ZFS_SHARED_OBJS:C/.o$/.c/} +LZ4_COMMON_SRCS= lz4.c LUA_SRCS= ${LUA_OBJS:C/.o$/.c/} KERNEL_SRCS= kernel.c taskq.c util.c LIST_SRCS= list.c @@ -39,7 +42,7 @@ UNICODE_SRCS= u8_textprep.c LIBCMDUTILS_SRCS=nicenum.c SRCS= ${ZFS_COMMON_SRCS} ${ZFS_SHARED_SRCS} ${LUA_SRCS} \ - ${KERNEL_SRCS} ${LIST_SRCS} ${ATOMIC_SRCS} \ + ${LZ4_COMMON_SRCS} ${KERNEL_SRCS} ${LIST_SRCS} ${ATOMIC_SRCS} \ ${UNICODE_SRCS} ${LIBCMDUTILS_SRCS} WARNS?= 0 @@ -50,6 +53,7 @@ CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libz CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs +CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair Modified: head/stand/efi/boot1/Makefile ============================================================================== --- head/stand/efi/boot1/Makefile Sat Nov 2 10:53:23 2019 (r354252) +++ head/stand/efi/boot1/Makefile Sat Nov 2 12:28:04 2019 (r354253) @@ -37,6 +37,7 @@ CFLAGS.zfs_module.c+= -I${ZFSSRC} CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/boot/zfs CFLAGS.zfs_module.c+= -I${SYSDIR}/crypto/skein CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common +CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/contrib/opensolaris/common/lz4 CFLAGS+= -DEFI_ZFS_BOOT .endif Modified: head/stand/i386/gptzfsboot/Makefile ============================================================================== --- head/stand/i386/gptzfsboot/Makefile Sat Nov 2 10:53:23 2019 (r354252) +++ head/stand/i386/gptzfsboot/Makefile Sat Nov 2 12:28:04 2019 (r354253) @@ -29,6 +29,7 @@ CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \ -I${SYSDIR}/crypto/skein \ -I${SYSDIR}/cddl/boot/zfs \ -I${SYSDIR}/cddl/contrib/opensolaris/uts/common \ + -I${SYSDIR}/cddl/contrib/opensolaris/common/lz4 \ -I${BOOTSRC}/i386/btx/lib \ -I${BOOTSRC}/i386/boot2 \ -Wall -Waggregate-return -Wbad-function-cast \ Modified: head/stand/i386/zfsboot/Makefile ============================================================================== --- head/stand/i386/zfsboot/Makefile Sat Nov 2 10:53:23 2019 (r354252) +++ head/stand/i386/zfsboot/Makefile Sat Nov 2 12:28:04 2019 (r354253) @@ -28,6 +28,7 @@ CFLAGS+=-DBOOTPROG=\"zfsboot\" \ -I${SYSDIR}/crypto/skein \ -I${SYSDIR}/cddl/boot/zfs \ -I${SYSDIR}/cddl/contrib/opensolaris/uts/common \ + -I${SYSDIR}/cddl/contrib/opensolaris/common/lz4 \ -I${BOOTSRC}/i386/boot2 \ -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ Modified: head/stand/libsa/Makefile ============================================================================== --- head/stand/libsa/Makefile Sat Nov 2 10:53:23 2019 (r354252) +++ head/stand/libsa/Makefile Sat Nov 2 12:28:04 2019 (r354253) @@ -102,6 +102,11 @@ CFLAGS+=-DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib SRCS+= adler32.c crc32.c SRCS+= infback.c inffast.c inflate.c inftrees.c zutil.c +# lz4 decompression functionality +.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 +SRCS+= lz4.c +CFLAGS.lz4.c+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 + # Create a subset of includes that are safe, as well as adjusting those that aren't # The lists may drive people nuts, but they are explicitly opt-in FAKE_DIRS=xlocale arpa Modified: head/stand/libsa/zfs/Makefile.inc ============================================================================== --- head/stand/libsa/zfs/Makefile.inc Sat Nov 2 10:53:23 2019 (r354252) +++ head/stand/libsa/zfs/Makefile.inc Sat Nov 2 12:28:04 2019 (r354253) @@ -12,4 +12,6 @@ CFLAGS+= -I${SYSDIR}/cddl/boot/zfs CFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common CFLAGS+= -I${SYSDIR}/crypto/skein +CFLAGS.zfs.c+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 + CFLAGS+= -Wformat -Wall Modified: head/sys/cddl/boot/zfs/zfssubr.c ============================================================================== --- head/sys/cddl/boot/zfs/zfssubr.c Sat Nov 2 10:53:23 2019 (r354252) +++ head/sys/cddl/boot/zfs/zfssubr.c Sat Nov 2 12:28:04 2019 (r354253) @@ -26,6 +26,8 @@ #include __FBSDID("$FreeBSD$"); +#include + static uint64_t zfs_crc64_table[256]; #define ECKSUM 666 @@ -161,7 +163,6 @@ typedef struct zio_compress_info { #include "lzjb.c" #include "zle.c" -#include "lz4.c" /* * Compression vectors. Copied and modified: head/sys/cddl/contrib/opensolaris/common/lz4/lz4.c (from r354252, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c) ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c Sat Nov 2 10:53:23 2019 (r354252, copy source) +++ head/sys/cddl/contrib/opensolaris/common/lz4/lz4.c Sat Nov 2 12:28:04 2019 (r354253) @@ -35,11 +35,29 @@ * Copyright (c) 2016 by Delphix. All rights reserved. */ +#if defined(_KERNEL) #include +#elif defined(_STANDALONE) +#include +#include +#include +#include +#include +#define ASSERT assert +#else +#include +#include +#include +#include +#include + +#define ASSERT assert +#endif +#include + static int real_LZ4_compress(const char *source, char *dest, int isize, int osize); -static int LZ4_compressBound(int isize); static int LZ4_uncompress_unknownOutputSize(const char *source, char *dest, int isize, int maxOutputSize); static int LZ4_compressCtx(void *ctx, const char *source, char *dest, @@ -47,11 +65,13 @@ static int LZ4_compressCtx(void *ctx, const char *sour static int LZ4_compress64kCtx(void *ctx, const char *source, char *dest, int isize, int osize); +#if defined(_KERNEL) static kmem_cache_t *lz4_ctx_cache; +#endif -/*ARGSUSED*/ size_t -lz4_compress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n) +lz4_compress(void *s_start, void *d_start, size_t s_len, size_t d_len, + int n __unused) { uint32_t bufsiz; char *dest = d_start; @@ -71,17 +91,25 @@ lz4_compress(void *s_start, void *d_start, size_t s_le * added to the compressed buffer and which, if unhandled, would * confuse the hell out of our decompression function. */ - *(uint32_t *)dest = BE_32(bufsiz); +#if defined(_KERNEL) + *(uint32_t *)(void *)dest = BE_32(bufsiz); +#else + *(uint32_t *)(void *)dest = htonl(bufsiz); +#endif return (bufsiz + sizeof (bufsiz)); } -/*ARGSUSED*/ int -lz4_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n) +lz4_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, + int n __unused) { const char *src = s_start; - uint32_t bufsiz = BE_IN32(src); +#if defined(_KERNEL) + uint32_t bufsiz = BE_IN32(s_start); +#else + uint32_t bufsiz = htonl(*(uint32_t *)s_start); +#endif /* invalid compressed buffer size encoded at start */ if (bufsiz + sizeof (bufsiz) > s_len) @@ -105,20 +133,10 @@ lz4_decompress(void *s_start, void *d_start, size_t s_ * or 0 if the compression fails (if LZ4_COMPRESSMIN is set). * note : destination buffer must be already allocated. * destination buffer must be sized to handle worst cases - * situations (input data not compressible) worst case size - * evaluation is provided by function LZ4_compressBound(). + * situations (input data not compressible). * * Advanced Functions * - * LZ4_compressBound() : - * Provides the maximum size that LZ4 may output in a "worst case" - * scenario (input data not compressible) primarily useful for memory - * allocation of output buffer. - * - * isize : is the input size. Max supported value is ~1.9GB - * return : maximum output size in a "worst case" scenario - * note : this function is limited by "int" range (2^31-1) - * * LZ4_uncompress_unknownOutputSize() : * isize : is the input size, therefore the compressed size * maxOutputSize : is the size of the destination buffer (which must be @@ -292,9 +310,9 @@ typedef struct _U64_S { #pragma pack() #endif -#define A64(x) (((U64_S *)(x))->v) -#define A32(x) (((U32_S *)(x))->v) -#define A16(x) (((U16_S *)(x))->v) +#define A64(x) (((U64_S *)(__DECONST(void *, x)))->v) +#define A32(x) (((U32_S *)(__DECONST(void *, x)))->v) +#define A16(x) (((U16_S *)(__DECONST(void *, x)))->v) /* * Constants @@ -456,14 +474,6 @@ LZ4_NbCommonBytes(register U32 val) #endif -/* Public functions */ - -static int -LZ4_compressBound(int isize) -{ - return (isize + (isize / 255) + 16); -} - /* Compression functions */ /*ARGSUSED*/ @@ -478,7 +488,7 @@ LZ4_compressCtx(void *ctx, const char *source, char *d HTYPE HashTable[HASHTABLESIZE] = { 0 }; #endif - const BYTE *ip = (BYTE *) source; + const BYTE *ip = (const BYTE *) source; INITBASE(base); const BYTE *anchor = ip; const BYTE *const iend = ip + isize; @@ -527,7 +537,7 @@ LZ4_compressCtx(void *ctx, const char *source, char *d } while ((ref < ip - MAX_DISTANCE) || (A32(ref) != A32(ip))); /* Catch up */ - while ((ip > anchor) && (ref > (BYTE *) source) && + while ((ip > anchor) && (ref > (const BYTE *) source) && unlikely(ip[-1] == ref[-1])) { ip--; ref--; @@ -673,7 +683,7 @@ LZ4_compress64kCtx(void *ctx, const char *source, char U16 HashTable[HASH64KTABLESIZE] = { 0 }; #endif - const BYTE *ip = (BYTE *) source; + const BYTE *ip = (const BYTE *) source; const BYTE *anchor = ip; const BYTE *const base = ip; const BYTE *const iend = ip + isize; @@ -720,7 +730,7 @@ LZ4_compress64kCtx(void *ctx, const char *source, char } while (A32(ref) != A32(ip)); /* Catch up */ - while ((ip > anchor) && (ref > (BYTE *) source) && + while ((ip > anchor) && (ref > (const BYTE *) source) && (ip[-1] == ref[-1])) { ip--; ref--; @@ -847,7 +857,11 @@ static int real_LZ4_compress(const char *source, char *dest, int isize, int osize) { #if HEAPMODE +#if defined(_KERNEL) void *ctx = kmem_cache_alloc(lz4_ctx_cache, KM_NOSLEEP); +#else + void *ctx = malloc(sizeof(struct refTables)); +#endif int result; /* @@ -863,7 +877,11 @@ real_LZ4_compress(const char *source, char *dest, int else result = LZ4_compressCtx(ctx, source, dest, isize, osize); +#if defined(_KERNEL) kmem_cache_free(lz4_ctx_cache, ctx); +#else + free(ctx); +#endif return (result); #else if (isize < (int)LZ4_64KLIMIT) @@ -876,7 +894,7 @@ real_LZ4_compress(const char *source, char *dest, int /* * Note: The decoding function LZ4_uncompress_unknownOutputSize() is safe - * against "buffer overflow" attack type. They will never write nor + * against "buffer overflow" attack type. It will never write nor * read outside of the provided output buffers. * LZ4_uncompress_unknownOutputSize() also insures that it will never * read outside of the input buffer. A corrupted input will produce @@ -1010,9 +1028,10 @@ LZ4_uncompress_unknownOutputSize(const char *source, c /* write overflow error detected */ _output_error: - return (int)(-(((char *)ip) - source)); + return (int)(-(((const char *)ip) - source)); } +#if defined(_KERNEL) extern void lz4_init(void) { @@ -1031,3 +1050,4 @@ lz4_fini(void) kmem_cache_destroy(lz4_ctx_cache); #endif } +#endif /* _KERNEL */ Added: head/sys/cddl/contrib/opensolaris/common/lz4/lz4.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/common/lz4/lz4.h Sat Nov 2 12:28:04 2019 (r354253) @@ -0,0 +1,50 @@ +/* + * LZ4 - Fast LZ compression algorithm + * Header File + * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You can contact the author at : + * - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html + * - LZ4 source repository : http://code.google.com/p/lz4/ + */ + +#ifndef _LZ4_H +#define _LZ4_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern size_t lz4_compress(void *, void *, size_t, size_t, int); +extern int lz4_decompress(void *, void *, size_t, size_t, int); + +#ifdef __cplusplus +} +#endif + +#endif /* _LZ4_H */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Sat Nov 2 10:53:23 2019 (r354252) +++ head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Sat Nov 2 12:28:04 2019 (r354253) @@ -98,7 +98,6 @@ ZFS_COMMON_OBJS += \ dsl_scan.o \ zfeature.o \ gzip.o \ - lz4.o \ lzjb.o \ metaslab.o \ multilist.o \ Modified: head/sys/modules/zfs/Makefile ============================================================================== --- head/sys/modules/zfs/Makefile Sat Nov 2 10:53:23 2019 (r354252) +++ head/sys/modules/zfs/Makefile Sat Nov 2 12:28:04 2019 (r354253) @@ -18,6 +18,8 @@ SRCS+= opensolaris_nvpair_alloc_fixed.c SRCS+= opensolaris_fnvpair.c .PATH: ${SYSDIR}/cddl/contrib/opensolaris/common/unicode SRCS+= u8_textprep.c +.PATH: ${SUNW}/common/lz4 +SRCS+= lz4.c .PATH: ${SYSDIR}/cddl/compat/opensolaris/kern SRCS+= opensolaris_acl.c @@ -84,6 +86,7 @@ CFLAGS+=-I${SUNW}/uts/common/zmod CFLAGS+=-I${SUNW}/uts/common CFLAGS+=-I${SYSDIR} CFLAGS+=-I${SUNW}/common/zfs +CFLAGS+=-I${SUNW}/common/lz4 CFLAGS+=-I${SUNW}/common CFLAGS+=-DBUILDING_ZFS CFLAGS.gcc+=-fms-extensions From owner-svn-src-head@freebsd.org Sat Nov 2 15:08:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3B6051A85CC; Sat, 2 Nov 2019 15:08:20 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4752W80sBKz3Hmr; Sat, 2 Nov 2019 15:08:20 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D67E7252A5; Sat, 2 Nov 2019 15:08:19 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA2F8Jmx082083; Sat, 2 Nov 2019 15:08:19 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA2F8Jvw082082; Sat, 2 Nov 2019 15:08:19 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911021508.xA2F8Jvw082082@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sat, 2 Nov 2019 15:08:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354254 - head/sys/cddl/boot/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/sys/cddl/boot/zfs X-SVN-Commit-Revision: 354254 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 15:08:20 -0000 Author: tsoome Date: Sat Nov 2 15:08:19 2019 New Revision: 354254 URL: https://svnweb.freebsd.org/changeset/base/354254 Log: r354253 did miss lz4.c from sys/cddl/boot/zfs. Deleted: head/sys/cddl/boot/zfs/lz4.c From owner-svn-src-head@freebsd.org Sat Nov 2 16:59:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64EC41AC1D2; Sat, 2 Nov 2019 16:59:54 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4754zt21s1z3QBH; Sat, 2 Nov 2019 16:59:54 +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 0CF7F26620; Sat, 2 Nov 2019 16:59:54 +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 xA2Gxr5S048602; Sat, 2 Nov 2019 16:59:53 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA2Gxrh1048600; Sat, 2 Nov 2019 16:59:53 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911021659.xA2Gxrh1048600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 2 Nov 2019 16:59:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354255 - in head/lib: libc/gen msun/src X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/lib: libc/gen msun/src X-SVN-Commit-Revision: 354255 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 16:59:54 -0000 Author: dim Date: Sat Nov 2 16:59:53 2019 New Revision: 354255 URL: https://svnweb.freebsd.org/changeset/base/354255 Log: Add __isnan()/__isnanf() aliases for compatibility with glibc and CUDA Even though clang comes with a number of internal CUDA wrapper headers, compiling sample CUDA programs will result in errors similar to: In file included from :1: In file included from /usr/lib/clang/9.0.0/include/__clang_cuda_runtime_wrapper.h:204: /usr/home/arr/cuda/var/cuda-repo-10-0-local-10.0.130-410.48/usr/local/cuda-10.0//include/crt/math_functions.hpp:2910:7: error: no matching function for call to '__isnan' if (__isnan(a)) { ^~~~~~~ /usr/lib/clang/9.0.0/include/__clang_cuda_device_functions.h:460:16: note: candidate function not viable: call to __device__ function from __host__ function __DEVICE__ int __isnan(double __a) { return __nv_isnand(__a); } ^ CUDA expects __isnan() and __isnanf() declarations to be available, which are glibc specific extensions, equivalent to the regular isnan() and isnanf(). To provide these, define __isnan() and __isnanf() as aliases of the already existing static inline functions __inline_isnan() and __inline_isnanf() from math.h. Reported by: arrowd PR: 241550 MFC after: 1 week Modified: head/lib/libc/gen/isnan.c head/lib/msun/src/math.h head/lib/msun/src/s_isnan.c Modified: head/lib/libc/gen/isnan.c ============================================================================== --- head/lib/libc/gen/isnan.c Sat Nov 2 15:08:19 2019 (r354254) +++ head/lib/libc/gen/isnan.c Sat Nov 2 16:59:53 2019 (r354255) @@ -43,6 +43,13 @@ */ #ifdef PIC +/* + * Because math.h defines __isnan and __isnanf as aliases for compatibility with + * glibc and CUDA, we have to undefine them here to avoid redefinition errors. + */ +#undef __isnan +#undef __isnanf + __weak_reference(__isnan, isnan); __weak_reference(__isnanf, isnanf); Modified: head/lib/msun/src/math.h ============================================================================== --- head/lib/msun/src/math.h Sat Nov 2 15:08:19 2019 (r354254) +++ head/lib/msun/src/math.h Sat Nov 2 16:59:53 2019 (r354255) @@ -215,6 +215,12 @@ __inline_isnanl(__const long double __x) } /* + * Define the following aliases, for compatibility with glibc and CUDA. + */ +#define __isnan __inline_isnan +#define __isnanf __inline_isnanf + +/* * Version 2 of the Single UNIX Specification (UNIX98) defined isnan() and * isinf() as functions taking double. C99, and the subsequent POSIX revisions * (SUSv3, POSIX.1-2001, define it as a macro that accepts any real floating Modified: head/lib/msun/src/s_isnan.c ============================================================================== --- head/lib/msun/src/s_isnan.c Sat Nov 2 15:08:19 2019 (r354254) +++ head/lib/msun/src/s_isnan.c Sat Nov 2 16:59:53 2019 (r354255) @@ -45,6 +45,12 @@ isnan(double d) } #endif /* !PIC */ +/* + * Because math.h defines __isnanf as an alias for compatibility with glibc and + * CUDA, we have to undefine it here to avoid redefinition errors. + */ +#undef __isnanf + int __isnanf(float f) { From owner-svn-src-head@freebsd.org Sat Nov 2 18:23:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B0791AEF18; Sat, 2 Nov 2019 18:23:00 +0000 (UTC) (envelope-from mack@macktronics.com) Received: from mail.macktronics.com (coco.macktronics.com [209.181.253.65]) (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 4756qk6pMKz42SS; Sat, 2 Nov 2019 18:22:58 +0000 (UTC) (envelope-from mack@macktronics.com) Received: from olive.macktronics.com (unknown [209.181.253.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.macktronics.com (Postfix) with ESMTPS id AC50D14EC5; Sat, 2 Nov 2019 13:22:52 -0500 (CDT) Date: Sat, 2 Nov 2019 13:22:52 -0500 (CDT) From: Dan Mack X-X-Sender: mack@localhost.local To: Toomas Soome cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354254 - head/sys/cddl/boot/zfs In-Reply-To: <201911021508.xA2F8Jvw082082@repo.freebsd.org> Message-ID: References: <201911021508.xA2F8Jvw082082@repo.freebsd.org> User-Agent: Alpine 2.20 (GSO 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Rspamd-Queue-Id: 4756qk6pMKz42SS X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=none) header.from=macktronics.com; spf=pass (mx1.freebsd.org: domain of mack@macktronics.com designates 209.181.253.65 as permitted sender) smtp.mailfrom=mack@macktronics.com X-Spamd-Result: default: False [-2.75 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.93)[-0.934,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.181.253.64/29]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(-0.01)[asn: 209(-0.01), country: US(-0.05)]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; DMARC_POLICY_ALLOW(-0.50)[macktronics.com,none]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:209, ipnet:209.180.0.0/15, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 18:23:00 -0000 I'm still getting a build failure on r354254: --- all_subdir_rescue --- ld: error: undefined symbol: lz4_init >>> referenced by spa_misc.c:2066 (/usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c:2066) >>> spa_misc.o:(spa_init) in archive /usr/obj/usr/src/amd64.amd64/tmp/usr/lib/libzpool.a ld: error: undefined symbol: lz4_fini >>> referenced by spa_misc.c:2096 (/usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c:2096) >>> spa_misc.o:(spa_fini) in archive /usr/obj/usr/src/amd64.amd64/tmp/usr/lib/libzpool.a --- all_subdir_lib --- root@k2:/usr/src # svnlite info . Path: . Working Copy Root Path: /usr/src URL: https://svn.freebsd.org/base/head Relative URL: ^/head Repository Root: https://svn.freebsd.org/base Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f Revision: 354254 Node Kind: directory Schedule: normal Last Changed Author: tsoome Last Changed Rev: 354254 On Sat, 2 Nov 2019, Toomas Soome wrote: > Author: tsoome > Date: Sat Nov 2 15:08:19 2019 > New Revision: 354254 > URL: https://svnweb.freebsd.org/changeset/base/354254 > > Log: > r354253 did miss lz4.c from sys/cddl/boot/zfs. > > Deleted: > head/sys/cddl/boot/zfs/lz4.c > _______________________________________________ > 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 Sat Nov 2 19:12:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 493181607A9; Sat, 2 Nov 2019 19:12:50 +0000 (UTC) (envelope-from freebsd@bdragon.rtk0.net) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (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 4757xF3dHrz44X7; Sat, 2 Nov 2019 19:12:49 +0000 (UTC) (envelope-from freebsd@bdragon.rtk0.net) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 3675A46E; Sat, 2 Nov 2019 15:12:47 -0400 (EDT) Received: from imap1 ([10.202.2.51]) by compute5.internal (MEProxy); Sat, 02 Nov 2019 15:12:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=T6hAS+ OosLmsAG5/egEOvdUXH8atEM7a8m/EFN8b6QY=; b=gDjr9ilA+M1Qky3+WH+D/t dEyrNRrk1k1o6l1HDHn9ex4A4pIGaVii6wGSIVgM67/XIy6RWS0QwhsP4afPIuc9 j2Cf+6bJINNgtC4nMfLhZSVvkJPSLn2wRL0PxjllBvz0LTMIu+3aN0q/xcondLgr Qi4p1XYL5+grs+odOw4Q21xILFjwr4Te7OKirF1XzGKVKWiuhFSbJnXZvvpJH1BI TShPLagYY5E6Cpz396bg9f75W4gMJzX467mfioPhOJoghlJdmc5pswm1BlhHovZe g2q9CmuVEGdkLOK1l//tmP3YFFD0MMyjRxv9ubNKKziybo2q042KdMCppJT9RVOQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedruddtledguddvtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfuehr rghnughonhcuuegvrhhgrhgvnhdfuceofhhrvggvsghsugessggurhgrghhonhdrrhhtkh dtrdhnvghtqeenucfrrghrrghmpehmrghilhhfrhhomhepfhhrvggvsghsugessggurhgr ghhonhdrrhhtkhdtrdhnvghtnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 295B2C200A4; Sat, 2 Nov 2019 15:12:46 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-509-ge3ec61c-fmstable-20191030v1 Mime-Version: 1.0 Message-Id: <48906cfb-b903-47b5-9c38-4f3c76e20f2e@www.fastmail.com> In-Reply-To: References: <201911021508.xA2F8Jvw082082@repo.freebsd.org> Date: Sat, 02 Nov 2019 14:12:23 -0500 From: "Brandon Bergren" To: "Dan Mack" , "Toomas Soome" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354254 - head/sys/cddl/boot/zfs Content-Type: text/plain X-Rspamd-Queue-Id: 4757xF3dHrz44X7 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=gDjr9ilA; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@bdragon.rtk0.net has no SPF policy when checking 64.147.123.20) smtp.mailfrom=freebsd@bdragon.rtk0.net X-Spamd-Result: default: False [-4.87 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; R_DKIM_ALLOW(-0.20)[messagingengine.com:s=fm1]; XM_UA_NO_VERSION(0.01)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; IP_SCORE(-3.48)[ip: (-9.77), ipnet: 64.147.123.0/24(-4.91), asn: 11403(-2.68), country: US(-0.05)]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[rtk0.net]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[messagingengine.com:+]; R_SPF_NA(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[20.123.147.64.list.dnswl.org : 127.0.5.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:11403, ipnet:64.147.123.0/24, country:US]; RCVD_TLS_LAST(0.00)[]; MID_RHS_WWW(0.50)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 19:12:50 -0000 sys/conf/files also contains a reference to cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c still. This breaks building zfs into the kernel (which builds kernels that are explicitly nonredistributable because of the licence incompatibility, but is useful for having root-on-zfs in circumstances like powerpc64 powernv where there is no native FreeBSD loader at the moment) From owner-svn-src-head@freebsd.org Sat Nov 2 19:22:35 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9DA36160CCD; Sat, 2 Nov 2019 19:22:35 +0000 (UTC) (envelope-from freebsd@bdragon.rtk0.net) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (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 47588V5HFyz453v; Sat, 2 Nov 2019 19:22:34 +0000 (UTC) (envelope-from freebsd@bdragon.rtk0.net) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 342983AC; Sat, 2 Nov 2019 15:22:33 -0400 (EDT) Received: from imap1 ([10.202.2.51]) by compute5.internal (MEProxy); Sat, 02 Nov 2019 15:22:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=BKs1Sy +DY91cGCD4kBWY3WEUA8ZbvTEQeIOquL2jDmA=; b=UyJy8ZKd+0aPtK3W4Lu9YR zOtd2SDR0PJhkpw8HcByQU4S37U7Nfp2VmUIR9M/93ksYZpOKnwZ8ziqxrcBZdIJ s9XEM6Xkf72OUh1rjOcJChgMOzXqlxwT5CekMiQHSNfuDRRvWX3ymyn9trczV8o/ A35NCadmz89z9s98uup4AFbAlS7NMH0YdwM9DlgBbsoQLy7WExZ0OBg7OOTlLSHW /jg+GLcNC2LNpOxqmxfw5iECLbgr0bMOvmooj6UzTanls8fiEDKZzHLEOnicNQA/ Mfz4DJPrfSF4M2Y2xYC42TM1kC/Qkd/3QsMfKoDNmNRci7gaghWhopRKFscC+6bA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedruddtledguddvvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfuehr rghnughonhcuuegvrhhgrhgvnhdfuceofhhrvggvsghsugessggurhgrghhonhdrrhhtkh dtrdhnvghtqeenucffohhmrghinhepphhrvgdrmhhknecurfgrrhgrmhepmhgrihhlfhhr ohhmpehfrhgvvggsshgusegsughrrghgohhnrdhrthhktddrnhgvthenucevlhhushhtvg hrufhiiigvpedt X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 5557AC200A4; Sat, 2 Nov 2019 15:22:32 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-509-ge3ec61c-fmstable-20191030v1 Mime-Version: 1.0 Message-Id: <81a05d10-a562-4469-b8d8-5403399e80b5@www.fastmail.com> In-Reply-To: <48906cfb-b903-47b5-9c38-4f3c76e20f2e@www.fastmail.com> References: <201911021508.xA2F8Jvw082082@repo.freebsd.org> <48906cfb-b903-47b5-9c38-4f3c76e20f2e@www.fastmail.com> Date: Sat, 02 Nov 2019 14:22:12 -0500 From: "Brandon Bergren" To: "Dan Mack" , "Toomas Soome" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354254 - head/sys/cddl/boot/zfs Content-Type: text/plain X-Rspamd-Queue-Id: 47588V5HFyz453v X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=UyJy8ZKd; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@bdragon.rtk0.net has no SPF policy when checking 64.147.123.20) smtp.mailfrom=freebsd@bdragon.rtk0.net X-Spamd-Result: default: False [-4.87 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[messagingengine.com:s=fm1]; XM_UA_NO_VERSION(0.01)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; IP_SCORE(-3.48)[ip: (-9.76), ipnet: 64.147.123.0/24(-4.91), asn: 11403(-2.68), country: US(-0.05)]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[rtk0.net]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[messagingengine.com:+]; R_SPF_NA(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[20.123.147.64.list.dnswl.org : 127.0.5.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:11403, ipnet:64.147.123.0/24, country:US]; RCVD_TLS_LAST(0.00)[]; MID_RHS_WWW(0.50)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 19:22:35 -0000 On Sat, Nov 2, 2019, at 2:12 PM, Brandon Bergren wrote: > sys/conf/files also contains a reference to > cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c still. This breaks > building zfs into the kernel (which builds kernels that are explicitly > nonredistributable because of the licence incompatibility, but is > useful for having root-on-zfs in circumstances like powerpc64 powernv > where there is no native FreeBSD loader at the moment) > Additionally, it looks like sys/cddl/contrib/opensolaris/common/lz4 was never added to ZFS_CFLAGS in sys/conf/kern.pre.mk From owner-svn-src-head@freebsd.org Sat Nov 2 19:33:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 540621614B5; Sat, 2 Nov 2019 19:33:03 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4758Nb1cjjz45Xk; Sat, 2 Nov 2019 19:33:03 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C22A2E9; Sat, 2 Nov 2019 19:33:03 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA2JX2Z2044289; Sat, 2 Nov 2019 19:33:02 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA2JX2sK044288; Sat, 2 Nov 2019 19:33:02 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201911021933.xA2JX2sK044288@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Sat, 2 Nov 2019 19:33:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354259 - head/sys/riscv/conf X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/conf X-SVN-Commit-Revision: 354259 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 19:33:03 -0000 Author: mhorne Date: Sat Nov 2 19:33:02 2019 New Revision: 354259 URL: https://svnweb.freebsd.org/changeset/base/354259 Log: RISC-V: Remove EARLY_AP_STARTUP from GENERIC This option is causing boot to fail for the Hifive Unleashed and older versions of QEMU (3.1.1). Remove it from the GENERIC config for now. Reported by: br MFC after: 1 week Modified: head/sys/riscv/conf/GENERIC Modified: head/sys/riscv/conf/GENERIC ============================================================================== --- head/sys/riscv/conf/GENERIC Sat Nov 2 18:00:16 2019 (r354258) +++ head/sys/riscv/conf/GENERIC Sat Nov 2 19:33:02 2019 (r354259) @@ -71,7 +71,6 @@ options RACCT # Resource accounting framework options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default options RCTL # Resource limits options SMP -options EARLY_AP_STARTUP options INTRNG # RISC-V SBI console From owner-svn-src-head@freebsd.org Sat Nov 2 20:46:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA165163F83; Sat, 2 Nov 2019 20:46:46 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475B1f50kYz49f3; Sat, 2 Nov 2019 20:46:46 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7089AF8C; Sat, 2 Nov 2019 20:46:46 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA2KkkU2086272; Sat, 2 Nov 2019 20:46:46 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA2KkkqD086270; Sat, 2 Nov 2019 20:46:46 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911022046.xA2KkkqD086270@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sat, 2 Nov 2019 20:46:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354264 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 354264 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 20:46:46 -0000 Author: tsoome Date: Sat Nov 2 20:46:45 2019 New Revision: 354264 URL: https://svnweb.freebsd.org/changeset/base/354264 Log: r354253 did miss the updates to sys/conf/files and sys/conf/kern.pre.mk Reported by: Brandon Bergren Modified: head/sys/conf/files head/sys/conf/kern.pre.mk Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Nov 2 19:52:22 2019 (r354263) +++ head/sys/conf/files Sat Nov 2 20:46:45 2019 (r354264) @@ -152,6 +152,7 @@ cddl/compat/opensolaris/kern/opensolaris_vm.c optio cddl/compat/opensolaris/kern/opensolaris_zone.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/acl/acl_common.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/avl/avl.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/lz4/lz4.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/opensolaris_fnvpair.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair_alloc_fixed.c optional zfs compile-with "${ZFS_C}" @@ -202,7 +203,6 @@ cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/gzip.c optional zfs compile-with "${ZFS_C}" -cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c optional zfs compile-with "${ZFS_C}" Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Sat Nov 2 19:52:22 2019 (r354263) +++ head/sys/conf/kern.pre.mk Sat Nov 2 20:46:45 2019 (r354264) @@ -197,6 +197,7 @@ CDDL_C= ${CC} -c ${CDDL_CFLAGS} ${WERROR} ${PROF} ${. ZFS_CFLAGS= -DBUILDING_ZFS -I$S/cddl/contrib/opensolaris/uts/common/fs/zfs ZFS_CFLAGS+= -I$S/cddl/contrib/opensolaris/uts/common/fs/zfs/lua ZFS_CFLAGS+= -I$S/cddl/contrib/opensolaris/uts/common/zmod +ZFS_CFLAGS+= -I$S/cddl/contrib/opensolaris/common/lz4 ZFS_CFLAGS+= -I$S/cddl/contrib/opensolaris/common/zfs ZFS_CFLAGS+= ${CDDL_CFLAGS} ZFS_ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${ZFS_CFLAGS} From owner-svn-src-head@freebsd.org Sat Nov 2 21:02:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 802DC164D18; Sat, 2 Nov 2019 21:02:55 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475BNH2nBxz4C5D; Sat, 2 Nov 2019 21:02:55 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43053135E; Sat, 2 Nov 2019 21:02:55 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA2L2tXO098043; Sat, 2 Nov 2019 21:02:55 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA2L2sQq098040; Sat, 2 Nov 2019 21:02:54 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911022102.xA2L2sQq098040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sat, 2 Nov 2019 21:02:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354265 - in head: cddl/lib/libzpool sys/cddl/contrib/opensolaris/common/lz4 X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in head: cddl/lib/libzpool sys/cddl/contrib/opensolaris/common/lz4 X-SVN-Commit-Revision: 354265 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 21:02:55 -0000 Author: tsoome Date: Sat Nov 2 21:02:54 2019 New Revision: 354265 URL: https://svnweb.freebsd.org/changeset/base/354265 Log: r354253 did miss the fact that libzpool is built as fake kernel We build libzpool as kernel like, use _FAKE_KERNEL check to include kernel api in libzpool. Added: head/sys/cddl/contrib/opensolaris/common/lz4/lz4.c - copied, changed from r354249, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c head/sys/cddl/contrib/opensolaris/common/lz4/lz4.h (contents, props changed) Replaced: head/sys/cddl/contrib/opensolaris/common/lz4/ Modified: head/cddl/lib/libzpool/Makefile Modified: head/cddl/lib/libzpool/Makefile ============================================================================== --- head/cddl/lib/libzpool/Makefile Sat Nov 2 20:46:45 2019 (r354264) +++ head/cddl/lib/libzpool/Makefile Sat Nov 2 21:02:54 2019 (r354265) @@ -65,6 +65,8 @@ CFLAGS+= -DWANTS_MUTEX_OWNED CFLAGS+= -I${SRCTOP}/lib/libpthread/thread CFLAGS+= -I${SRCTOP}/lib/libpthread/sys CFLAGS+= -I${SRCTOP}/lib/libthr/arch/${MACHINE_CPUARCH}/include +CFLAGS.lz4.o+= -D_FAKE_KERNEL +CFLAGS.lz4.pico+= -D_FAKE_KERNEL CFLAGS.gcc+= -fms-extensions LIBADD= md pthread z nvpair avl umem Copied and modified: head/sys/cddl/contrib/opensolaris/common/lz4/lz4.c (from r354249, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c) ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c Sat Nov 2 09:50:36 2019 (r354249, copy source) +++ head/sys/cddl/contrib/opensolaris/common/lz4/lz4.c Sat Nov 2 21:02:54 2019 (r354265) @@ -35,11 +35,29 @@ * Copyright (c) 2016 by Delphix. All rights reserved. */ +#if defined(_KERNEL) || defined(_FAKE_KERNEL) #include +#elif defined(_STANDALONE) +#include +#include +#include +#include +#include +#define ASSERT assert +#else +#include +#include +#include +#include +#include + +#define ASSERT assert +#endif +#include + static int real_LZ4_compress(const char *source, char *dest, int isize, int osize); -static int LZ4_compressBound(int isize); static int LZ4_uncompress_unknownOutputSize(const char *source, char *dest, int isize, int maxOutputSize); static int LZ4_compressCtx(void *ctx, const char *source, char *dest, @@ -47,11 +65,13 @@ static int LZ4_compressCtx(void *ctx, const char *sour static int LZ4_compress64kCtx(void *ctx, const char *source, char *dest, int isize, int osize); +#if defined(_KERNEL) || defined(_FAKE_KERNEL) static kmem_cache_t *lz4_ctx_cache; +#endif -/*ARGSUSED*/ size_t -lz4_compress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n) +lz4_compress(void *s_start, void *d_start, size_t s_len, size_t d_len, + int n __unused) { uint32_t bufsiz; char *dest = d_start; @@ -71,17 +91,25 @@ lz4_compress(void *s_start, void *d_start, size_t s_le * added to the compressed buffer and which, if unhandled, would * confuse the hell out of our decompression function. */ - *(uint32_t *)dest = BE_32(bufsiz); +#if defined(_KERNEL) || defined(_FAKE_KERNEL) + *(uint32_t *)(void *)dest = BE_32(bufsiz); +#else + *(uint32_t *)(void *)dest = htonl(bufsiz); +#endif return (bufsiz + sizeof (bufsiz)); } -/*ARGSUSED*/ int -lz4_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n) +lz4_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, + int n __unused) { const char *src = s_start; - uint32_t bufsiz = BE_IN32(src); +#if defined(_KERNEL) || defined(_FAKE_KERNEL) + uint32_t bufsiz = BE_IN32(s_start); +#else + uint32_t bufsiz = htonl(*(uint32_t *)s_start); +#endif /* invalid compressed buffer size encoded at start */ if (bufsiz + sizeof (bufsiz) > s_len) @@ -105,20 +133,10 @@ lz4_decompress(void *s_start, void *d_start, size_t s_ * or 0 if the compression fails (if LZ4_COMPRESSMIN is set). * note : destination buffer must be already allocated. * destination buffer must be sized to handle worst cases - * situations (input data not compressible) worst case size - * evaluation is provided by function LZ4_compressBound(). + * situations (input data not compressible). * * Advanced Functions * - * LZ4_compressBound() : - * Provides the maximum size that LZ4 may output in a "worst case" - * scenario (input data not compressible) primarily useful for memory - * allocation of output buffer. - * - * isize : is the input size. Max supported value is ~1.9GB - * return : maximum output size in a "worst case" scenario - * note : this function is limited by "int" range (2^31-1) - * * LZ4_uncompress_unknownOutputSize() : * isize : is the input size, therefore the compressed size * maxOutputSize : is the size of the destination buffer (which must be @@ -292,9 +310,9 @@ typedef struct _U64_S { #pragma pack() #endif -#define A64(x) (((U64_S *)(x))->v) -#define A32(x) (((U32_S *)(x))->v) -#define A16(x) (((U16_S *)(x))->v) +#define A64(x) (((U64_S *)(__DECONST(void *, x)))->v) +#define A32(x) (((U32_S *)(__DECONST(void *, x)))->v) +#define A16(x) (((U16_S *)(__DECONST(void *, x)))->v) /* * Constants @@ -456,14 +474,6 @@ LZ4_NbCommonBytes(register U32 val) #endif -/* Public functions */ - -static int -LZ4_compressBound(int isize) -{ - return (isize + (isize / 255) + 16); -} - /* Compression functions */ /*ARGSUSED*/ @@ -478,7 +488,7 @@ LZ4_compressCtx(void *ctx, const char *source, char *d HTYPE HashTable[HASHTABLESIZE] = { 0 }; #endif - const BYTE *ip = (BYTE *) source; + const BYTE *ip = (const BYTE *) source; INITBASE(base); const BYTE *anchor = ip; const BYTE *const iend = ip + isize; @@ -527,7 +537,7 @@ LZ4_compressCtx(void *ctx, const char *source, char *d } while ((ref < ip - MAX_DISTANCE) || (A32(ref) != A32(ip))); /* Catch up */ - while ((ip > anchor) && (ref > (BYTE *) source) && + while ((ip > anchor) && (ref > (const BYTE *) source) && unlikely(ip[-1] == ref[-1])) { ip--; ref--; @@ -673,7 +683,7 @@ LZ4_compress64kCtx(void *ctx, const char *source, char U16 HashTable[HASH64KTABLESIZE] = { 0 }; #endif - const BYTE *ip = (BYTE *) source; + const BYTE *ip = (const BYTE *) source; const BYTE *anchor = ip; const BYTE *const base = ip; const BYTE *const iend = ip + isize; @@ -720,7 +730,7 @@ LZ4_compress64kCtx(void *ctx, const char *source, char } while (A32(ref) != A32(ip)); /* Catch up */ - while ((ip > anchor) && (ref > (BYTE *) source) && + while ((ip > anchor) && (ref > (const BYTE *) source) && (ip[-1] == ref[-1])) { ip--; ref--; @@ -847,7 +857,11 @@ static int real_LZ4_compress(const char *source, char *dest, int isize, int osize) { #if HEAPMODE +#if defined(_KERNEL) || defined(_FAKE_KERNEL) void *ctx = kmem_cache_alloc(lz4_ctx_cache, KM_NOSLEEP); +#else + void *ctx = malloc(sizeof(struct refTables)); +#endif int result; /* @@ -863,7 +877,11 @@ real_LZ4_compress(const char *source, char *dest, int else result = LZ4_compressCtx(ctx, source, dest, isize, osize); +#if defined(_KERNEL) || defined(_FAKE_KERNEL) kmem_cache_free(lz4_ctx_cache, ctx); +#else + free(ctx); +#endif return (result); #else if (isize < (int)LZ4_64KLIMIT) @@ -876,7 +894,7 @@ real_LZ4_compress(const char *source, char *dest, int /* * Note: The decoding function LZ4_uncompress_unknownOutputSize() is safe - * against "buffer overflow" attack type. They will never write nor + * against "buffer overflow" attack type. It will never write nor * read outside of the provided output buffers. * LZ4_uncompress_unknownOutputSize() also insures that it will never * read outside of the input buffer. A corrupted input will produce @@ -1010,9 +1028,10 @@ LZ4_uncompress_unknownOutputSize(const char *source, c /* write overflow error detected */ _output_error: - return (int)(-(((char *)ip) - source)); + return (int)(-(((const char *)ip) - source)); } +#if defined(_KERNEL) || defined(_FAKE_KERNEL) extern void lz4_init(void) { @@ -1031,3 +1050,4 @@ lz4_fini(void) kmem_cache_destroy(lz4_ctx_cache); #endif } +#endif /* _KERNEL || _FAKE_KERNEL */ Added: head/sys/cddl/contrib/opensolaris/common/lz4/lz4.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/common/lz4/lz4.h Sat Nov 2 21:02:54 2019 (r354265) @@ -0,0 +1,50 @@ +/* + * LZ4 - Fast LZ compression algorithm + * Header File + * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You can contact the author at : + * - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html + * - LZ4 source repository : http://code.google.com/p/lz4/ + */ + +#ifndef _LZ4_H +#define _LZ4_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern size_t lz4_compress(void *, void *, size_t, size_t, int); +extern int lz4_decompress(void *, void *, size_t, size_t, int); + +#ifdef __cplusplus +} +#endif + +#endif /* _LZ4_H */ From owner-svn-src-head@freebsd.org Sat Nov 2 21:15:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B82D165745; Sat, 2 Nov 2019 21:15:58 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475BgL1xXsz4DN9; Sat, 2 Nov 2019 21:15:58 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21C60152C; Sat, 2 Nov 2019 21:15:58 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA2LFweo004305; Sat, 2 Nov 2019 21:15:58 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA2LFuWi004298; Sat, 2 Nov 2019 21:15:56 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <201911022115.xA2LFuWi004298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Sat, 2 Nov 2019 21:15:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354266 - in head/sys: conf powerpc/booke powerpc/conf/dpaa powerpc/include powerpc/mpc85xx powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: in head/sys: conf powerpc/booke powerpc/conf/dpaa powerpc/include powerpc/mpc85xx powerpc/powerpc X-SVN-Commit-Revision: 354266 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 21:15:58 -0000 Author: bdragon Date: Sat Nov 2 21:15:56 2019 New Revision: 354266 URL: https://svnweb.freebsd.org/changeset/base/354266 Log: Add support for building Book-E kernels with clang/lld. This involved several changes: * Since lld does not like text relocations, replace SMP boot page text relocs in booke/locore.S with position-independent math, and track the virtual base in the SMP boot page header. * As some SPRs are interpreted differently on clang due to the way it handles platform-specific SPRs, switch m*dear and m*esr mnemonics out for regular m*spr. Add both forms of SPR_DEAR to spr.h so the correct encoding is selected. * Change some hardcoded 32 bit things in the boot page to be pointer-sized, and fix alignment. * Fix 64-bit build of booke/pmap.c when enabling pmap debugging. Additionally, I took the opportunity to document how the SMP boot page works. Approved by: jhibbits (mentor) Differential Revision: https://reviews.freebsd.org/D21999 Modified: head/sys/conf/Makefile.powerpc head/sys/powerpc/booke/locore.S head/sys/powerpc/booke/pmap.c head/sys/powerpc/booke/trap_subr.S head/sys/powerpc/conf/dpaa/config.dpaa head/sys/powerpc/include/spr.h head/sys/powerpc/mpc85xx/platform_mpc85xx.c head/sys/powerpc/powerpc/pmap_dispatch.c Modified: head/sys/conf/Makefile.powerpc ============================================================================== --- head/sys/conf/Makefile.powerpc Sat Nov 2 21:02:54 2019 (r354265) +++ head/sys/conf/Makefile.powerpc Sat Nov 2 21:15:56 2019 (r354266) @@ -42,6 +42,20 @@ CFLAGS+= -mabi=spe -D__SPE__ CFLAGS+= -msoft-float CFLAGS.gcc+= -Wa,-many +# Apply compiler-specific DPAA exceptions. +.if "${COMPILER_TYPE}" == "clang" +DPAAWARNFLAGS += \ + -Wno-error=parentheses-equality \ + -Wno-error=self-assign \ + -Wno-error=incompatible-pointer-types-discards-qualifiers \ + -Wno-error=non-literal-null-conversion \ + -Wno-error=enum-conversion +.elif "${COMPILER_TYPE}" == "gcc" && ${COMPILER_VERSION} >= 50200 +DPAAWARNFLAGS += \ + -Wno-error=redundant-decls \ + -Wno-error=int-in-bool-context +.endif + # Build position-independent kernel CFLAGS+= -fPIC LDFLAGS+= -pie Modified: head/sys/powerpc/booke/locore.S ============================================================================== --- head/sys/powerpc/booke/locore.S Sat Nov 2 21:02:54 2019 (r354265) +++ head/sys/powerpc/booke/locore.S Sat Nov 2 21:15:56 2019 (r354266) @@ -39,6 +39,10 @@ #include #include +#ifdef _CALL_ELF +.abiversion _CALL_ELF +#endif + #define TMPSTACKSZ 16384 #ifdef __powerpc64__ @@ -76,6 +80,12 @@ #define WORD_SIZE 4 #endif +#ifdef __powerpc64__ + /* Placate lld by creating a kboot stub. */ + .section ".text.kboot", "x", @progbits + b __start +#endif + .text .globl btext btext: @@ -309,6 +319,9 @@ done_mapping: 1: mflr %r3 ld %r1,0(%r3) add %r1,%r1,%r3 +/* + * Relocate kernel + */ bl 1f .llong _DYNAMIC-. 1: mflr %r3 @@ -379,16 +392,63 @@ done_mapping: .globl __boot_page .align 12 __boot_page: - bl 1f + /* + * The boot page is a special page of memory used during AP bringup. + * Before the AP comes out of reset, the physical 4K page holding this + * code is arranged to be mapped at 0xfffff000 by use of + * platform-dependent registers. + * + * Alternatively, this page may be executed using an ePAPR-standardized + * method -- writing to the address specified in "cpu-release-addr". + * + * In either case, execution begins at the last instruction of the + * page, which is a branch back to the start of the page. + * + * The code in the page must do initial MMU setup and normalize the + * TLBs for regular operation in the correct address space before + * reading outside the page. + * + * This implementation accomplishes this by: + * 1) Wiping TLB0 and all TLB1 entries but the one currently in use. + * 2) Establishing a temporary 4K TLB1 mapping in AS=1, and switching + * to it with rfi. This entry must NOT be in TLB1 slot 0. + * (This is needed to give the code freedom to clean up AS=0.) + * 3) Removing the initial TLB1 entry, leaving us with a single valid + * TLB1 entry, NOT in slot 0. + * 4) Installing an AS0 entry in TLB1 slot 0 mapping the 64MB kernel + * segment at its final virtual address. A second rfi is done to + * switch to the final address space. At this point we can finally + * access the rest of the kernel segment safely. + * 5) The temporary TLB1 AS=1 entry is removed, finally leaving us in + * a consistent (but minimal) state. + * 6) Set up TOC, stack, and pcpu registers. + * 7) Now that we can finally call C code, call pmap_boostrap_ap(), + * which finishes copying in the shared TLB1 entries. + * + * At this point, the MMU is fully set up, and we can proceed with + * running the actual AP bootstrap code. + * + * Pieces of this code are also used for UP kernel, but in this case + * the sections specific to boot page functionality are dropped by + * the preprocessor. + */ +#ifdef __powerpc64__ + nop /* PPC64 alignment word. 64-bit target. */ +#endif + bl 1f /* 32-bit target. */ .globl bp_trace bp_trace: - .long 0 + ADDR(0) /* Trace pointer (%r31). */ .globl bp_kernload bp_kernload: - .long 0 + ADDR(0) /* Kern phys. load address. */ + .globl bp_virtaddr +bp_virtaddr: + ADDR(0) /* Virt. address of __boot_page. */ + /* * Initial configuration */ @@ -444,7 +504,7 @@ bp_kernload: mfmsr %r3 ori %r3, %r3, (PSL_IS | PSL_DS) #ifdef __powerpc64__ - oris %r3, %r3, PSL_CM@h + oris %r3, %r3, PSL_CM@h /* Ensure we're in 64-bit after RFI */ #endif bl 3f 3: mflr %r4 @@ -461,7 +521,7 @@ bp_kernload: bl tlb1_inval_entry /* - * Setup final mapping in TLB1[1] and switch to it + * Setup final mapping in TLB1[0] and switch to it */ /* Final kernel mapping, map in 64 MB of RAM */ lis %r3, MAS0_TLBSEL1@h /* Select TLB1 */ @@ -481,31 +541,19 @@ bp_kernload: isync /* Retrieve kernel load [physical] address from bp_kernload */ +5: + mflr %r3 #ifdef __powerpc64__ - b 0f - .align 3 -0: - nop -#endif - bl 5f - ADDR(bp_kernload) - ADDR(__boot_page) -5: mflr %r3 -#ifdef __powerpc64__ - ld %r4, 0(%r3) - ld %r5, 8(%r3) - clrrdi %r3, %r3, 12 + clrrdi %r3, %r3, PAGE_SHIFT /* trunc_page(%r3) */ #else - lwz %r4, 0(%r3) - lwz %r5, 4(%r3) - rlwinm %r3, %r3, 0, 0, 19 + clrrwi %r3, %r3, PAGE_SHIFT /* trunc_page(%r3) */ #endif - sub %r4, %r4, %r5 /* offset of bp_kernload within __boot_page */ - lwzx %r3, %r4, %r3 + LOAD %r4, (bp_kernload - __boot_page)(%r3) + LOAD %r5, (bp_virtaddr - __boot_page)(%r3) /* Set RPN and protection */ - ori %r3, %r3, (MAS3_SX | MAS3_SW | MAS3_SR)@l - mtspr SPR_MAS3, %r3 + ori %r4, %r4, (MAS3_SX | MAS3_SW | MAS3_SR)@l + mtspr SPR_MAS3, %r4 isync li %r4, 0 mtspr SPR_MAS7, %r4 @@ -518,8 +566,8 @@ bp_kernload: bl 6f 6: mflr %r3 rlwinm %r3, %r3, 0, 0xfff /* Offset from boot page start */ - add %r3, %r3, %r5 /* Make this virtual address */ - addi %r3, %r3, (7f - 6b) + add %r3, %r3, %r5 /* Make this a virtual address */ + addi %r3, %r3, (7f - 6b) /* And figure out return address. */ #ifdef __powerpc64__ lis %r4, PSL_CM@h /* Note AS=0 */ #else @@ -758,6 +806,11 @@ __boot_page_padding: */ .space 4092 - (__boot_page_padding - __boot_page) b __boot_page + /* + * This is the end of the boot page. + * During AP startup, the previous instruction is at 0xfffffffc + * virtual (i.e. the reset vector.) + */ #endif /* SMP */ /************************************************************************/ @@ -881,6 +934,7 @@ ENTRY(bpred_enable) * created. */ ENTRY(get_spr) + /* Note: The spr number is patched at runtime */ mfspr %r3, 0 blr @@ -900,7 +954,9 @@ tmpstackbound: .space 10240 /* XXX: this really should not be necessary */ #ifdef __powerpc64__ TOC_ENTRY(tmpstack) +#ifdef SMP TOC_ENTRY(bp_kernload) +#endif #endif /* Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Sat Nov 2 21:02:54 2019 (r354265) +++ head/sys/powerpc/booke/pmap.c Sat Nov 2 21:15:56 2019 (r354266) @@ -1674,7 +1674,7 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o /* 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(" kernload = 0x%09jx\n", (uintmax_t)kernload); debugf(" kernstart = 0x%"PRI0ptrX"\n", kernstart); debugf(" kernsize = 0x%"PRI0ptrX"\n", kernsize); @@ -1859,9 +1859,9 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o thread0.td_kstack = kstack0; thread0.td_kstack_pages = kstack_pages; - debugf("kstack_sz = 0x%08x\n", kstack0_sz); - debugf("kstack0_phys at 0x%09llx - 0x%09llx\n", - kstack0_phys, kstack0_phys + kstack0_sz); + debugf("kstack_sz = 0x%08jx\n", (uintmax_t)kstack0_sz); + debugf("kstack0_phys at 0x%09jx - 0x%09jx\n", + (uintmax_t)kstack0_phys, (uintmax_t)kstack0_phys + kstack0_sz); debugf("kstack0 at 0x%"PRI0ptrX" - 0x%"PRI0ptrX"\n", kstack0, kstack0 + kstack0_sz); @@ -4003,7 +4003,7 @@ tlb1_mapin_region(vm_offset_t va, vm_paddr_t pa, vm_si for (idx = 0; idx < nents; idx++) { pgsz = pgs[idx]; - debugf("%u: %llx -> %jx, size=%jx\n", idx, pa, + debugf("%u: %jx -> %jx, size=%jx\n", idx, (uintmax_t)pa, (uintmax_t)va, (uintmax_t)pgsz); tlb1_set_entry(va, pa, pgsz, _TLB_ENTRY_SHARED | _TLB_ENTRY_MEM); Modified: head/sys/powerpc/booke/trap_subr.S ============================================================================== --- head/sys/powerpc/booke/trap_subr.S Sat Nov 2 21:02:54 2019 (r354265) +++ head/sys/powerpc/booke/trap_subr.S Sat Nov 2 21:15:56 2019 (r354266) @@ -120,8 +120,8 @@ GET_CPUINFO(%r1); /* Per-cpu structure */ \ STORE %r30, (savearea+CPUSAVE_R30)(%r1); \ STORE %r31, (savearea+CPUSAVE_R31)(%r1); \ - mfdear %r30; \ - mfesr %r31; \ + mfspr %r30, SPR_DEAR; \ + mfspr %r31, SPR_ESR; \ STORE %r30, (savearea+CPUSAVE_BOOKE_DEAR)(%r1); \ STORE %r31, (savearea+CPUSAVE_BOOKE_ESR)(%r1); \ mfspr %r30, isrr0; \ @@ -143,8 +143,8 @@ GET_CPUINFO(%r1); /* Per-cpu structure */ \ STORE %r30, (savearea+CPUSAVE_R30)(%r1); \ STORE %r31, (savearea+CPUSAVE_R31)(%r1); \ - mfdear %r30; \ - mfesr %r31; \ + mfspr %r30, SPR_DEAR; \ + mfspr %r31, SPR_ESR; \ STORE %r30, (savearea+CPUSAVE_BOOKE_DEAR)(%r1); \ STORE %r31, (savearea+CPUSAVE_BOOKE_ESR)(%r1); \ mfspr %r30, isrr0; \ @@ -375,9 +375,9 @@ rlwinm outr, inr, 6, 23, 25; /* 4 x TLBSAVE_LEN */ #endif #define TLB_PROLOG \ - mtsprg4 %r1; /* Save SP */ \ - mtsprg5 %r28; \ - mtsprg6 %r29; \ + mtspr SPR_SPRG4, %r1; /* Save SP */ \ + mtspr SPR_SPRG5, %r28; \ + mtspr SPR_SPRG6, %r29; \ /* calculate TLB nesting level and TLBSAVE instance address */ \ GET_CPUINFO(%r1); /* Per-cpu structure */ \ LOAD %r28, PC_BOOKE_TLB_LEVEL(%r1); \ @@ -388,8 +388,8 @@ add %r1, %r1, %r29; /* current TLBSAVE ptr */ \ \ /* save R20-31 */ \ - mfsprg5 %r28; \ - mfsprg6 %r29; \ + mfspr %r28, SPR_SPRG5; \ + mfspr %r29, SPR_SPRG6; \ TLB_SAVE_REGS(%r1); \ /* save LR, CR */ \ mflr %r30; \ @@ -402,7 +402,7 @@ STORE %r30, (TLBSAVE_BOOKE_SRR0)(%r1); /* save SRR0 */ \ STORE %r31, (TLBSAVE_BOOKE_SRR1)(%r1); /* save SRR1 */ \ isync; \ - mfsprg4 %r1 + mfspr %r1, SPR_SPRG4 /* * restores LR, CR, SRR0-1, R20-31 from the TLBSAVE area @@ -410,7 +410,7 @@ * same notes as for the TLB_PROLOG */ #define TLB_RESTORE \ - mtsprg4 %r1; /* Save SP */ \ + mtspr SPR_SPRG4, %r1; /* Save SP */ \ GET_CPUINFO(%r1); /* Per-cpu structure */ \ /* calculate TLB nesting level and TLBSAVE instance addr */ \ LOAD %r28, PC_BOOKE_TLB_LEVEL(%r1); \ @@ -432,7 +432,7 @@ mtsrr1 %r31; \ /* restore R20-31 */ \ TLB_RESTORE_REGS(%r1); \ - mfsprg4 %r1 + mfspr %r1, SPR_SPRG4 #ifdef SMP #define TLB_LOCK \ @@ -693,7 +693,7 @@ INTERRUPT(int_data_tlb_error) TLB_PROLOG TLB_LOCK - mfdear %r31 + mfspr %r31, SPR_DEAR /* * Save MAS0-MAS2 registers. There might be another tlb miss during @@ -1052,8 +1052,8 @@ ASENTRY_NOPROF(breakpoint) mflr %r31 mtsrr0 %r31 - mfdear %r30 - mfesr %r31 + mfspr %r30, SPR_DEAR + mfspr %r31, SPR_ESR STORE %r30, (PC_DBSAVE+CPUSAVE_BOOKE_DEAR)(%r3) STORE %r31, (PC_DBSAVE+CPUSAVE_BOOKE_ESR)(%r3) Modified: head/sys/powerpc/conf/dpaa/config.dpaa ============================================================================== --- head/sys/powerpc/conf/dpaa/config.dpaa Sat Nov 2 21:02:54 2019 (r354265) +++ head/sys/powerpc/conf/dpaa/config.dpaa Sat Nov 2 21:15:56 2019 (r354266) @@ -2,7 +2,7 @@ files "dpaa/files.dpaa" -makeoptions DPAA_COMPILE_CMD="${LINUXKPI_C} \ +makeoptions DPAA_COMPILE_CMD="${LINUXKPI_C} ${DPAAWARNFLAGS} \ -Wno-cast-qual -Wno-unused-function -Wno-init-self -fms-extensions \ -include $S/contrib/ncsw/build/dflags.h \ -Wno-error=missing-prototypes \ Modified: head/sys/powerpc/include/spr.h ============================================================================== --- head/sys/powerpc/include/spr.h Sat Nov 2 21:02:54 2019 (r354265) +++ head/sys/powerpc/include/spr.h Sat Nov 2 21:15:56 2019 (r354266) @@ -504,7 +504,11 @@ #define SPR_HASH2 0x3d3 /* .68 Secondary Hash Address Register */ #define SPR_IMISS 0x3d4 /* .68 Instruction TLB Miss Address Register */ #define SPR_TLBMISS 0x3d4 /* .6. TLB Miss Address Register */ +#if defined(BOOKE_PPC4XX) #define SPR_DEAR 0x3d5 /* 4.. Data Error Address Register */ +#else +#define SPR_DEAR 0x03d /* ..8 Data Exception Address Register */ +#endif #define SPR_ICMP 0x3d5 /* .68 Instruction TLB Compare Register */ #define SPR_PTEHI 0x3d5 /* .6. Instruction TLB Compare Register */ #define SPR_EVPR 0x3d6 /* 4.. Exception Vector Prefix Register */ Modified: head/sys/powerpc/mpc85xx/platform_mpc85xx.c ============================================================================== --- head/sys/powerpc/mpc85xx/platform_mpc85xx.c Sat Nov 2 21:02:54 2019 (r354265) +++ head/sys/powerpc/mpc85xx/platform_mpc85xx.c Sat Nov 2 21:15:56 2019 (r354266) @@ -68,7 +68,8 @@ __FBSDID("$FreeBSD$"); extern void *ap_pcpu; extern vm_paddr_t kernload; /* Kernel physical load address */ extern uint8_t __boot_page[]; /* Boot page body */ -extern uint32_t bp_kernload; +extern vm_paddr_t bp_kernload; /* Boot page copy of kernload */ +extern vm_offset_t bp_virtaddr; /* Virtual address of boot page */ extern vm_offset_t __startkernel; struct cpu_release { @@ -354,11 +355,13 @@ mpc85xx_smp_start_cpu_epapr(platform_t plat, struct pc pmap_kenter(rel_page, rel_pa & ~PAGE_MASK); rel = (struct cpu_release *)rel_va; bptr = pmap_kextract((uintptr_t)__boot_page); + cpu_flush_dcache(__DEVOLATILE(struct cpu_release *,rel), sizeof(*rel)); - rel->pir = pc->pc_cpuid; __asm __volatile("sync"); - rel->entry_h = (bptr >> 32); - rel->entry_l = bptr; __asm __volatile("sync"); + rel->pir = pc->pc_cpuid; __asm __volatile("sync" ::: "memory"); + rel->entry_h = (bptr >> 32); __asm __volatile("sync" ::: "memory"); cpu_flush_dcache(__DEVOLATILE(struct cpu_release *,rel), sizeof(*rel)); + rel->entry_l = bptr & 0xffffffff; __asm __volatile("sync" ::: "memory"); + cpu_flush_dcache(__DEVOLATILE(struct cpu_release *,rel), sizeof(*rel)); if (bootverbose) printf("Waking up CPU %d via CPU release page %p\n", pc->pc_cpuid, rel); @@ -397,11 +400,13 @@ mpc85xx_smp_start_cpu(platform_t plat, struct pcpu *pc cpuid = pc->pc_cpuid + 24; } bp_kernload = kernload; + bp_virtaddr = (vm_offset_t)&__boot_page; /* - * bp_kernload is in the boot page. Sync the cache because ePAPR - * booting has the other core(s) already running. + * bp_kernload and bp_virtaddr are in the boot page. Sync the cache + * because ePAPR booting has the other core(s) already running. */ cpu_flush_dcache(&bp_kernload, sizeof(bp_kernload)); + cpu_flush_dcache(&bp_virtaddr, sizeof(bp_virtaddr)); ap_pcpu = pc; __asm __volatile("msync; isync"); Modified: head/sys/powerpc/powerpc/pmap_dispatch.c ============================================================================== --- head/sys/powerpc/powerpc/pmap_dispatch.c Sat Nov 2 21:02:54 2019 (r354265) +++ head/sys/powerpc/powerpc/pmap_dispatch.c Sat Nov 2 21:15:56 2019 (r354266) @@ -145,7 +145,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t p, v u_int flags, int8_t psind) { - CTR6(KTR_PMAP, "pmap_enter(%p, %#x, %p, %#x, %x, %d)", pmap, va, + CTR6(KTR_PMAP, "pmap_enter(%p, %#x, %p, %#x, %#x, %d)", pmap, va, p, prot, flags, psind); return (MMU_ENTER(mmu_obj, pmap, va, p, prot, flags, psind)); } From owner-svn-src-head@freebsd.org Sat Nov 2 21:52:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2614A166FA3; Sat, 2 Nov 2019 21:52:46 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475CTp0CMvz4GH4; Sat, 2 Nov 2019 21:52:46 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF6BC1C3F; Sat, 2 Nov 2019 21:52:45 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA2LqjQ4027653; Sat, 2 Nov 2019 21:52:45 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA2Lqj6R027652; Sat, 2 Nov 2019 21:52:45 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911022152.xA2Lqj6R027652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sat, 2 Nov 2019 21:52:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354267 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 354267 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 21:52:46 -0000 Author: tsoome Date: Sat Nov 2 21:52:45 2019 New Revision: 354267 URL: https://svnweb.freebsd.org/changeset/base/354267 Log: r354264 did mix up the directory path The correct path is sys/cddl/contrib/opensolaris/common/lz4, not sys/cddl/contrib/opensolaris/lz4 Reported by: Michael Butler Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Nov 2 21:15:56 2019 (r354266) +++ head/sys/conf/files Sat Nov 2 21:52:45 2019 (r354267) @@ -152,7 +152,7 @@ cddl/compat/opensolaris/kern/opensolaris_vm.c optio cddl/compat/opensolaris/kern/opensolaris_zone.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/acl/acl_common.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/avl/avl.c optional zfs compile-with "${ZFS_C}" -cddl/contrib/opensolaris/lz4/lz4.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/common/lz4/lz4.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/opensolaris_fnvpair.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair_alloc_fixed.c optional zfs compile-with "${ZFS_C}"